2010-07-17
| 00:03 | tautologico | is there any nice, built-in 2d matrix data structure available in clojure? or should I roll my own? |
| 00:06 | wooby | tautologico: you may consider incanter.Matrix |
| 00:06 | tautologico | wooby: will search for it, thanks |
| 00:06 | wooby | tautologico: http://wiki.github.com/liebke/incanter/matrices |
| 00:07 | zkim | tautologico: Might help: http://measuringmeasures.com/blog/2010/3/28/matrix-benchmarks-fast-linear-algebra-on-the-jvm.html |
| 00:10 | tautologico | both links will be useful, thanks |
| 00:45 | slyrus | anyone around care to give my toy undirected graph implementation a quick review? |
| 00:45 | slyrus | http://gist.github.com/479247 |
| 00:45 | clojurebot | http://github.com/hiredman/clojure-dependency-grapher |
| 03:05 | slyrus | well, perhaps in the morning then... |
| 05:24 | vu3rdd | ,quit |
| 05:24 | clojurebot | java.lang.Exception: Unable to resolve symbol: quit in this context |
| 05:24 | vu3rdd | oops.. slime-isms..:-( |
| 05:41 | vasily_pupkin | hi |
| 05:42 | vasily_pupkin | how can i get value linked to symbol via it's name? |
| 05:42 | vasily_pupkin | just now i do: (eval (symbol "a")) |
| 07:48 | idrop | hi, is there any function that will return a map with keys as keywords when given a map without? i.e ..... {foo 1 bar 2} ----> {:foo 1 :bar 2} |
| 07:52 | mikem | idrop: this would work |
| 07:52 | mikem | ,(reduce #(apply assoc %1 %2) {} (map #(vector (keyword (str (first %))) (second %)) {\a 1 \b 2})) |
| 07:52 | clojurebot | {:b 2, :a 1} |
| 07:52 | mikem | don't know if there's a function for that |
| 07:54 | idrop | mikem: thanks for that! just have to digest it now.. |
| 08:04 | raek | idrop: this could be useful too: http://github.com/richhickey/clojure/blob/c1c39162608551d50cfb18998d015974b11cfecc/src/clj/clojure/walk.clj#L95 |
| 08:05 | raek | if you have a multi-leveled structure |
| 08:06 | raek | (more here http://richhickey.github.com/clojure/clojure.walk-api.html) |
| 08:10 | raek | (defn keywordize [m] (into (empty m) (for [[key val] m] [(keyword key) val]))) |
| 08:10 | raek | my solution for one level |
| 08:13 | raek | ,(let [keywordize (fn [m] (into (empty m) (for [[key val] m] [(keyword key) val])))] {'some-symbol 1, "some-string" 2, 'symbol.with/namespace 3}) |
| 08:13 | clojurebot | {some-symbol 1, "some-string" 2, symbol.with/namespace 3} |
| 08:13 | raek | ,(let [keywordize (fn [m] (into (empty m) (for [[key val] m] [(keyword key) val])))] (keywordize {'some-symbol 1, "some-string" 2, 'symbol.with/namespace 3})) |
| 08:13 | clojurebot | {:some-symbol 1, :some-string 2, :symbol.with/namespace 3} |
| 08:13 | raek | *ahem* |
| 08:14 | mikem | why does a vector not implement ISeq? iow, why does (seq? [1 2 3]) return false? |
| 08:15 | raek | you can think of a sequence as some kind of iterator |
| 08:15 | raek | that provides a sequential view of something |
| 08:15 | raek | in java, an ArrayList is not an iterator, but can provide one |
| 08:16 | raek | it's kind of the same in clojure: a vector is not a sequence, but it can make one (with seq) |
| 08:16 | raek | a seq is just something you can do first and rest on |
| 08:17 | raek | (those functions also call (seq) on their arguments) |
| 08:17 | mikem | ok, so the reason vector doesn't implement ISeq is for ... performance reasons? or vectors are just used for different purposes...? |
| 08:17 | raek | a vector seq is implemented as something like a reference to the vector and a counter for the current index |
| 08:18 | raek | it would be possible to make the vector implement ISeq, but what should rest on it return? |
| 08:18 | mikem | ok, it's due to the underpinning implementation then |
| 08:19 | raek | seqs and collections are not the same thing |
| 08:19 | raek | I think this is a intentional design decision |
| 08:19 | mikem | ok, this is something i'll need to deeper understand as time goes on i guess :) |
| 08:20 | raek | seqs are just first rest |
| 08:20 | raek | and *behaves* as cons cells |
| 08:20 | raek | /linked lists |
| 08:22 | raek | this might be helpful to understand the rationale: http://clojure.blip.tv/file/734409/ |
| 08:22 | raek | but beware that the behaviour of rest has changed slightly since then |
| 08:23 | raek | rest does not have to return nil if the rest of the seq is empty anymore |
| 08:23 | raek | but what it returns should become nil when passed though (seq( |
| 08:23 | raek | next behaves as the rest |
| 08:23 | mikem | woah, it's 75 minutes of rhickey talking about sequences! awesome |
| 08:24 | mikem | oh yeah, i'm familiar of the distinction between next and rest |
| 08:28 | mikem | raek: thanks :) the video is on my to-do list |
| 09:11 | raek | wow: http://www.st.cs.uni-sb.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf |
| 09:11 | raek | I had no idea that the ideas of clojure could be such a great fit for game programming |
| 09:12 | raek | especially take a look at slide 51 and forward |
| 09:16 | raek | another thing: |
| 09:16 | raek | is there a simple way of delaying the effects of certain functions until a transaction succeds? |
| 09:17 | raek | like how sends to agents are held? |
| 09:17 | carkh | sends to agents are also delayed within transactions |
| 09:18 | carkh | and only sent upon success |
| 09:18 | raek | yes |
| 09:18 | raek | is there any known way of having this behaviour for other functions? |
| 09:19 | lpetit | hello, I'm having trouble with a macro. Maybe I'm not totally awaken, maybe it's subtle ... |
| 09:19 | rhudson | Can't you just execute the function in an agent? |
| 09:19 | raek | well, I guess so |
| 09:19 | lpetit | (defmacro f ([a] a) ([] (f 1)) |
| 09:19 | raek | but I might not need the serializing effect agents have |
| 09:19 | carkh | ,(send (agent) println "coucou") |
| 09:19 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$agent |
| 09:20 | raek | i.e. all operations are queued up |
| 09:20 | carkh | ,(send (agent nil) println "coucou") |
| 09:20 | clojurebot | #<Agent@667ed7: nil> |
| 09:20 | lpetit | this does not work. (if I call (f) it complains with java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$f (NO_SOURCE_FILE:0) |
| 09:21 | carkh | lpetit: you're calling f with one parameter from your second definition |
| 09:21 | carkh | when it has either 0 or 2 |
| 09:21 | lpetit | carkh: ? |
| 09:22 | raek | (f) => 1, (f 2) => 2 for me with your definitoin |
| 09:22 | carkh | ah sorry wasn't awake either =P |
| 09:23 | carkh | anyways you're using f as a function in your second definition |
| 09:23 | lpetit | carkh, raek: got it. By the time the macro is compiled, I should not emit a direct call to f, or I'll get strange results since f is not totally compiled yet (so cannot correctly macroexpand) |
| 09:23 | raek | hrm, aha |
| 09:23 | lpetit | carkh: I'm using f as a callable, as can be done with macros, but you're right, |
| 09:23 | carkh | (defmacro f ([a] a) ([] `(f 1))) |
| 09:23 | lpetit | carkh: yes |
| 09:24 | raek | that looks more right |
| 09:24 | rhudson | carkh: you could use multiple agents if you're concerned about serialization |
| 09:24 | lpetit | carkh: since it's the return value of the macro, it does the job. Thanks guys for the brainstorming |
| 09:24 | carkh | raek: carkh: you could use multiple agents if you're concerned about serialization |
| 09:25 | carkh | =) |
| 09:25 | carkh | i feel like an agent now |
| 09:26 | rhudson | d'oh! |
| 10:15 | bmh | What is the random number generator of choice in Clojure? Should I rely on probabilities.random-numbers or call out to something in java? I'm not doing Monte Carlo simulations so the quality of the RNG isn't very important right now |
| 10:37 | raek | rand-int is useful |
| 10:37 | raek | ,(doc rand-int) |
| 10:37 | clojurebot | "([n]); Returns a random integer between 0 (inclusive) and n (exclusive)." |
| 10:40 | bmh | That does seem useful. |
| 11:00 | defn | hello everyone |
| 11:01 | defn | $seen zkim |
| 11:01 | sexpbot | zkim was last seen quitting 293 minutes ago. |
| 11:01 | defn | $(/ 293 60.0) |
| 11:01 | sexpbot | This command is old. Use -> now. It's a hook, so it can evaluate anything, even stuff that doesn't start with parentheses. |
| 11:01 | defn | ->(/ 293 60.0) |
| 11:01 | sexpbot | => 4.883333333333334 |
| 12:07 | Lajla | defn, does Clojure support tail calls? |
| 12:10 | raek | clojure does not, since function calls build on top of jvm method invokations |
| 12:10 | Lajla | raek, HAH |
| 12:10 | Lajla | You fell for me trap. |
| 12:10 | Lajla | I did not say taill cal optimization, now did I. |
| 12:10 | Lajla | Also, invokation? |
| 12:10 | raek | Lajla: ah, now I get it |
| 12:10 | raek | sure, you can do tail calls :) |
| 12:11 | Lajla | I can feel my sanity sleeping away between the holes of my teeth, I try to to keep my mouth shut and keep it in, but it is not working |
| 12:11 | Lajla | slipping |
| 12:12 | raek | invoKe, invoCation |
| 12:12 | raek | English, tsk tsk tsk |
| 12:12 | raek | "Also, invokation?" <-- was that regarding the spelling? |
| 12:14 | Lajla | raek, I was just asking if it was the proper one. |
| 12:14 | Lajla | No hard feelings |
| 12:14 | Lajla | raek, but french me, french me passionately to keep my sanity in. |
| 12:17 | raek | I don't take offence on behalf of the English spelling system |
| 12:17 | raek | so, it's cool |
| 12:26 | Lajla | raek, MY SANITY |
| 12:26 | Lajla | I am losing it lke we lost the world cup. |
| 12:26 | Lajla | Bloody hell, that octopus bought my sanity from that ref. |
| 12:26 | Lajla | That was a clear offside in my sanity. |
| 12:26 | Lajla | Now the Spanish have it and they will use it to become the second best programmers in the world. |
| 12:29 | raek | Lajla: write a programming book. |
| 12:29 | Lajla | raek, hmm |
| 12:29 | Lajla | and excellent suggestion |
| 12:29 | Lajla | I was busy expressing the formal semantics of that language in FOL anyay. |
| 12:30 | Lajla | raek, shall I dedicate it to you? |
| 12:31 | raek | your choise |
| 14:01 | defn | Lajla: choice ;) |
| 14:01 | Lajla | defn, what? |
| 14:02 | defn | he said choise -- it is choice, like your invokation vs invocation |
| 14:17 | raek | I always get that wrong... :) |
| 14:18 | defn | raek: what's new |
| 14:18 | defn | whatcha workin on today |
| 14:35 | LauJensen | I know we've talked about some of the UI options for Java before, but please remind me. We have Swing/AWT (ewww), and then Qt which is a little nicer but not fully baked yet, then there are those funky Mac Components, anything else? |
| 14:35 | LauJensen | (thats nice ofc) |
| 14:36 | qbg | SWT? |
| 14:37 | LauJensen | Isnt that as vile as SWT ? |
| 14:37 | Raynes | I thought Qt was pretty much abandoned? |
| 14:38 | Raynes | Jambi, that is. |
| 14:39 | LauJensen | Raynes: I dont think so, but as anything OpenSource it crawls |
| 14:39 | LauJensen | It was neeearly good when they dropped official support |
| 14:42 | bobo_ | javaFX? |
| 14:43 | LauJensen | bobo_: Not available through Clojure |
| 14:43 | bobo_ | suspected that |
| 14:44 | Raynes | There is that Pivot thing. |
| 14:44 | LauJensen | Got link? |
| 14:45 | LauJensen | I also wonder why the web isnt drowing in these SetLookAndFeel UIs for Java |
| 14:47 | Raynes | LauJensen: http://lmgtfy.com/?q=Java+pivot |
| 14:48 | Raynes | http://pivot.apache.org/ |
| 14:48 | bobo_ | that looks like web gui's to me? |
| 14:49 | Raynes | Someone mentioned it here in the context of desktop GUIs a while back. |
| 14:49 | Raynes | I've never investigated. |
| 14:49 | LauJensen | Sure does - And at least in Conkeror they suck the life out of the browser |
| 14:50 | LauJensen | "Apache Pivot is an open-source platform for building rich internet applications in Java. It combines the enhanced productivity and usability features of a modern RIA toolkit with the robustness of the Java platform. Pivot applications are written using a combination of Java and XML and can be run either as an applet or as a standalone, optionally offline, desktop application. " |
| 14:51 | Hodapp | BINGO! |
| 14:51 | Hodapp | ...oh, wait, we weren't playing web 2.0 buzzword bingo. |
| 15:02 | LauJensen | Hodapp: No we always save that for later, when the whole gang is here |
| 15:07 | Plouj | is forexmercenary written in clojure? : http://www.forexmachines.com/reviews/forex-mercenary/#comment-5592 |
| 15:08 | LauJensen | Raynes: Thanks for pointing to Pivot, its very interesting |
| 15:08 | Raynes | You're welcome. <3 |
| 15:08 | LauJensen | Plouj: Certainly looks like it |
| 15:15 | eshira | Hi, I'm trying to setup clojure on os x. I git cloned clojure and clojure-contrib, built it, and symlinked the jars into ~./clojure/clojure.jar and ~./clojure/clojure-contrib.jar |
| 15:16 | eshira | first question, how do i run the repl w/ jline (i have this dependency)? |
| 15:19 | eshira | second, i'm trying to setup vimclojure. I follow the instructions (http://kotka.de/projects/clojure/vimclojure.html) to build PrettyPrinter. But i still get erros about it not finding it: java.io.FileNotFoundException: Could not locate clojure/contrib/pprint__init.class or clojure/contrib/pprint.clj on classpath. |
| 15:20 | slyrus | hmm... what does this warning mean? Warning: protocol #'ugraph/Edge is overwriting method nodes of protocol Graph |
| 15:21 | LauJensen | osx..vim-clojure... I think Im staying away from this one :) |
| 15:22 | Raynes | There is a vim-clojure ggroup that seems to be active enough: http://groups.google.com/group/vimclojure |
| 15:35 | eshira | *sign* i've gotten this whoel setup working once on another mac.. |
| 15:35 | eshira | there are just wayyyy too many ways (pacakage managers, manual installs) to do it |
| 15:40 | technomancy | eshira: with swank at least the main problem is everyone posts on their blog about how they think they've got it figured out, and nobody reads the official documentation |
| 15:48 | slyrus | anyone up for helping solve a defprotocol/defrecord problem? i don't understand why the last two forms in http://gist.github.com/479786 give different results |
| 15:50 | raek | is edged both a method name and a field name? |
| 15:50 | raek | *edges |
| 15:51 | raek | maybe edges in (bar [g node] (edges g node))) resolvs to the field instead of the method |
| 15:51 | slyrus | why, yes it is. ok, thanks! |
| 15:51 | raek | np |
| 15:53 | slyrus | raek: is this a defprotocol bug or just my lack of grokking how this is supposed to work? |
| 15:53 | raek | you can get the value of a field by just using it's name |
| 15:54 | raek | they work a bit like locals |
| 15:54 | slyrus | locals? |
| 15:54 | raek | local "variables" |
| 15:54 | raek | like a surrounding let |
| 15:54 | rhudson | within the defrecord scope |
| 15:55 | slyrus | thanks rhudson |
| 15:55 | raek | (they're not exactly variables, since they cannot be mutated) |
| 15:55 | slyrus | they're akin to CLOS accessors then? but outside of the defrecord scope I still have to do (:edges g)? |
| 15:56 | raek | (:edges g) is how you access the field from the outside of a record, yes |
| 15:56 | raek | fields are like instance variables in java classes |
| 15:57 | raek | I'm not familiar with CLOS vocabulary, but I would call :edges an accessor |
| 15:57 | slyrus | right, but inside the defrecord scope there's _another_ accessor (edges ...) that returns the value of the field, right? |
| 15:58 | slyrus | or the same accessor called by a different name |
| 15:58 | raek | no, you don't call it |
| 15:58 | raek | use use the name as if it was a variable |
| 15:58 | raek | (bar [g node] edges) |
| 15:58 | slyrus | "(edges g)" isn't a function application? |
| 15:58 | raek | it is, but edges is not a functoin |
| 15:59 | raek | edges contains the value |
| 15:59 | slyrus | is used to a lisp-n |
| 16:00 | raek | in the scope of a record method, the name of the fields are bound to the field values |
| 16:01 | raek | (defrecord pair [one two] SomeProto (some-method [p x y] (+ (* x one) (* y two)))) |
| 16:02 | raek | nonsensial example... |
| 16:02 | raek | this could also be written with the accessors: |
| 16:02 | raek | (defrecord pair [one two] SomeProto (some-method [p x y] (+ (* x (:one p)) (* y (:two p))))) |
| 16:04 | raek | "The class will have the (immutable) fields named by fields, which can have type hints. [...] Note that method bodies are not closures, the local environment includes only the named fields, and those fields can be accessed directy." |
| 16:05 | slyrus | but (defrecord pair [one two] SomeProto (some-method [p x y] (+ (* x one) (* y two))) (one one)) would allow me to say (one p) from outside of the defrecord scope, right? Otherwise I'd have to do (:one p), I think. |
| 16:05 | slyrus | (for suitable values of p, of course) |
| 16:05 | qbg | No |
| 16:05 | slyrus | I mean (one [p] one) |
| 16:05 | yason | Decided to try 1.2 beta on Ubuntu; none of the installation tutorials did the trick. Are things in clojure/slime/swank-clojure world in order or should I debug into it once again? |
| 16:06 | qbg | Oh, yeah then |
| 16:06 | raek | slyrus: then "one" could mean one of two things |
| 16:07 | raek | which can be confusing for someone reading the code |
| 16:07 | raek | if you want to hide the fact that thefunctionality is implemented with records, give the fields other names |
| 16:07 | slyrus | not for those of us coming from a lisp-n background where if you wanted the accessor one you would have to say #'one :) |
| 16:07 | raek | since they will not be visible to the user |
| 16:07 | slyrus | right, I'm starting to come to the realization |
| 16:08 | raek | if the fact that they are records is a part of the API, then using :edges as accesor functions should be fine |
| 16:09 | raek | *should be sufficient for getting the work done |
| 16:10 | raek | I don't know if naming conventions for these things have came up, since records are still pretty new |
| 16:11 | slyrus | ok, works as expected now. thanks for your help! |
| 16:25 | slyrus | can I have methods of the same name in different protocols? |
| 16:26 | raek | yes, but not in the same namespace |
| 16:26 | raek | they are still used as functions |
| 16:26 | slyrus | so, no, in other words :) |
| 16:26 | raek | exactly... :) |
| 16:27 | slyrus | Ok, defrecords being able to implement multiple interfaces makes it easy enough to factor the common stuff out into its own interface |
| 16:27 | raek | in java, classes both group together functions (as methods) and play the role of namespaces |
| 16:27 | raek | in clojure, these are separated |
| 16:27 | slyrus | clojure-mode could use some defrecord love |
| 16:28 | raek | if to things have the same name, they should probably do the same thing too |
| 16:28 | raek | (unless the term itself is ambigous) |
| 16:29 | raek | the indentation? |
| 16:29 | raek | that has ben bugging me too |
| 16:29 | slyrus | yeah two more spaces in for the methods (is that the right term?) so that they're to the right of the protocol names would be nice |
| 16:30 | slyrus | oh, and I'm still getting used to seeing CamelCase identifiers in my lispy code :) |
| 16:30 | raek | agreed. |
| 16:31 | raek | I think "methods" is an accepted term |
| 16:31 | raek | the docs uses that word anyway |
| 16:34 | slyrus | can I specify protocol methods with variable arity? |
| 16:35 | caio | how can I extend a namespace? |
| 16:36 | slyrus | e.g.: (defprotocol Moose (foo [x]) (foo [x y])) |
| 16:36 | yason | A follow-up question: What's the situation with swank-clojure? Usable with 1.2? |
| 16:36 | slyrus | i'm using it |
| 16:37 | raek | caio: if you're at the the repl, just (in-ns 'the.name.space) and define stuff |
| 16:37 | raek | using it too |
| 16:37 | slyrus | oh, nvm... i already discovered how to do that yesterday, and promptly forgot... |
| 16:37 | raek | the docs in swank-clojure is the most up to date |
| 16:38 | yason | slyrus: latest from git://github.com/jochu/swank-clojure.git? |
| 16:38 | raek | take technomany's instead |
| 16:38 | slyrus | yason: I use http://github.com/technomancy/swank-clojure.git |
| 16:38 | raek | he's the maintainer now |
| 16:38 | yason | oh, there are *two*? |
| 16:38 | yason | ok |
| 16:38 | yason | no wonder mine had "NOTE: swank-clojure.el is currently unmaintained." |
| 16:38 | raek | jochu was the original maintainer, I think |
| 16:39 | yason | yeah, makes sense |
| 16:39 | raek | yes, it's bad that jochu's the one that comes first on google |
| 16:40 | yason | for us who update their clojure a few times a year, this begs for an intelligent setup script. It's always the same trial-google-and-error hassle |
| 16:40 | raek | 21:38 < technomancy> eshira: with swank at least the main problem is everyone posts on their blog about how they think they've got it figured out, and nobody reads the official documentation |
| 16:40 | raek | I do git pull origin on clojure-mode, swank-clojure and slime |
| 16:41 | raek | but my .emacs is a mess |
| 16:41 | raek | no packages |
| 16:41 | yason | raek: yeah, I've noticed that. But people love things where documentation isn't needed :) |
| 16:42 | raek | yason: here is my .emacs: http://gist.github.com/443590 |
| 16:43 | raek | the important line is (ad-activate 'slime-read-interactive-args) |
| 16:43 | yason | raek: thanks, I'll cross-check with mine |
| 16:43 | raek | it is required if you don't use ELPA, I think |
| 16:46 | raek | I think there are clojure-mode forks on github that fixes record indentation too |
| 16:46 | raek | anyone else notices that dosync and future indents the body *one* space? |
| 16:47 | caio | raek: Im trying to extend the namespace clojure.contrib.sql, I created a (ns extended.sql), how can I import all functions of clojure.contrib.sql into this namespace? |
| 16:47 | cemerick | I wonder if anyone knows off-hand where the discussion about case dispatch can be found (e.g. using lists for grouping multiple dispatch constants, etc)? |
| 16:48 | cemerick | I think it was here, but I've not had any luck googling. |
| 16:48 | caio | look, I have to call (:require extended.sql) then have all functions defined in contrib.sql too |
| 16:48 | raek | there's immigrate in c.c.ns-utils |
| 16:49 | raek | but it has caveats |
| 16:50 | caio | whats "the right way (tm)" for doing this type of thing? |
| 16:50 | raek | namespaces are not designed to be copied and extended, I think... |
| 16:50 | caio | use immigrate? |
| 16:50 | yason | raek: swank-clojure automagically offered to install 1.1, did you say you tweaked it to work with 1.2 too? |
| 16:50 | raek | what is the usage scenario? |
| 16:51 | raek | yason: don't use the auto features |
| 16:51 | caio | i need to extend contrib.sql to support returning insert-id when I insert rows |
| 16:51 | caio | and other stuffs like this |
| 16:51 | raek | I think that is ELPA trying to download its latetest version |
| 16:51 | raek | which is not the one on github |
| 16:52 | raek | caio: the most common way (I think) would be to have your extensions in your own namespace |
| 16:52 | raek | and a user that want's to use te original sql API plus your simply uses both |
| 16:52 | yason | raek: it didn't seem to find my clojure 1.2 eventhough I pointed swank-clojure-jar-path to it -> tried the automatical features to see if they would add some setup lines to .emacs or .emacs.d |
| 16:54 | raek | have you added to the load path? |
| 16:54 | yason | raek: you mean emacs load path? |
| 16:54 | raek | yes |
| 16:55 | yason | raek: they're good |
| 16:55 | raek | I'm not an emacs guru... |
| 16:55 | raek | so I don't know how to debug emacs probelms |
| 16:56 | yason | I know emacs, I know clojure, but only slightly about the internals of slime and even less about swank-clojure |
| 16:56 | yason | well, i'll take a look at that tomorrow |
| 16:56 | raek | you might have to delete the packages ELPA have downloaded |
| 16:57 | raek | I only use the 3 git projects + the .emacs file you saw, nothing more |
| 17:00 | slyrus | i had to turn off slime-autodoc to get things working well :( |
| 17:00 | slyrus | not sure if that's still the case though |
| 17:06 | yason | raek: I had deleted elpa stuff already, just trying to find out how to point swank-clojure to *my* clojure.jar |
| 17:07 | raek | (setq swank-clojure-jar-path "path/to/clojure.jar") |
| 17:12 | Lajla | IN YOUR HEEEEEEAAAAD, IN YOUR HEEEEEAD. |
| 17:12 | Lajla | qbg, functions used by people that are bad at functional programming and try to duplicate imperative. |
| 17:13 | qbg | take-nth would benefit |
| 17:17 | qbg | Ooh, you could make lazy vectors with that |
| 17:18 | qbg | Well, not vectors, but a lazy indexed sequence |
| 17:27 | Lajla | qbg, indexing lists, or indexing at all really has little palce in functional style I think. |
| 17:27 | Lajla | I know of no library function in any functional language except one that indexes itself that I have seen implemented using indexing. |
| 17:28 | qbg | first/rest places limits on the computational complexity of algorithms |
| 17:28 | Lajla | People always say that lists are slow on indexing, and they are, that is why they are not used for that in general. |
| 17:28 | Lajla | qbg, well, functional style usually means you do stuff with all the elements in the list. |
| 17:28 | Lajla | And not pick them out accordingly runtime information |
| 17:28 | Lajla | You tend to transform lists, not select elements from them. |
| 17:30 | qbg | But sometimes you do select elements from them |
| 17:31 | qbg | (this is all just an excuse for me to play with protocols) |
| 18:13 | Nanakhiel | qbg, name me an example? |
| 18:13 | Nanakhiel | I would be most gracious |
| 18:14 | qbg | Nanakhiel: Of? |
| 18:15 | Lajla | qbg, explain? |
| 18:15 | Lajla | How does one binary search a list? |
| 18:15 | qbg | The same way you normally perform a binary search |
| 18:16 | Lajla | qbg, I just mean, why binary search a list when you can also binary search a vector. |
| 18:16 | Lajla | I think that actually first converting it a vector is going to end up faster than if you were to index from the start all over again, of course, that is not needed if you do it smartly. |
| 18:16 | qbg | An indexable list is an abstraction |
| 18:16 | Lajla | No it's not! |
| 18:17 | Lajla | It's a binary tree whose rightmost leave is null. |
| 18:17 | Lajla | Do not let the people who tell you that it is anything other confuse you |
| 18:18 | qbg | How is it not an abstraction? |
| 18:18 | Lajla | qbg, because it is what it is.. =( |
| 18:18 | Lajla | A binary tree |
| 18:18 | Lajla | which like any binary tree supports exactly two operations |
| 18:18 | Lajla | left branch, right branch |
| 18:19 | qbg | Instead of first/rest, you have first/rest/nth |
| 18:19 | Lajla | NO YOU DOOON'T |
| 18:19 | Lajla | You have car and cdr. |
| 18:20 | Lajla | rest is a nondescriptive name. |
| 18:20 | Lajla | first and second are good too. |
| 18:20 | rhudson | Wrong language Lajla |
| 18:20 | Lajla | You are frightening me with your conceptualism. |
| 18:20 | Lajla | HEY, there are already eyes in here. |
| 18:21 | qbg | Hmm.. Perhaps I should make it first/rest/nth/nthrest |
| 18:22 | Lajla | WAAHH |
| 18:22 | Lajla | So you're like implementing them on top of ARRAYS? |
| 18:22 | qbg | I can get a vector in terms of my abstraction |
| 18:23 | qbg | I can get a sequence of the form (map f (range length)) in terms of my abstraction |
| 18:24 | Lajla | Every time you do this, a lisp machine dies... |
| 18:24 | Lajla | Say you believe in cons pairs. |
| 18:25 | qbg | No love for hunks? |
| 18:25 | qbg | ;) |
| 18:25 | qbg | (http://maclisp.info/pitmanual/hunks.html) |
| 18:38 | claj | how to get the clojure.set.union (and other set-functions) to work? I've tried (clojure.set.union #{1 2 3} #{4 5 2}) without results... is it my classpath? |
| 18:39 | claj | I get java.lang.Exception: Unable to resolve symbol: union in this context (NO_SOURCE_FILE:16) |
| 18:39 | Raynes | ->(clojure.set/union #{1 2 3} #{4 5 2}) |
| 18:39 | sexpbot | => #{1 2 3 4 5} |
| 18:39 | claj | big thx^inf |
| 19:03 | Lajla | qbg, my toy lisp has that actually, vectors are homogenous, so I invented tuples for hetrogenous random access, then I realized that a tuple of 2 is essentially a cons cell |
| 19:11 | somnium | Lajla: see SRFI 101 -> some percentage of schemers no longer believe in cons cells either |
| 19:12 | somnium | at least not of the 'look ma, its just like the lambda calculus' variety |
| 19:13 | Lajla | somnium, actually, I just like to be insane, in reality I have given the issue _a lot_ of thought in my own toy lisp and am leaning towards cons pairs which are just a special case of tuples in thend. |
| 19:14 | Lajla | I considered storing the length of the list in it too but I figured in the end that tail-hopping was going to have too much overhead to be worth it unless every cons pair had to store the length of what was to come. |
| 19:16 | technomancy | "Just like grandma used to make!" |
| 19:18 | Lajla | My grandma used to make me fish eyes. |
| 19:18 | Lajla | I still eat them. |
| 19:18 | Lajla | It grosses people out. |
| 19:24 | Lajla | Probably some Chinese thing though, I hear it's normal in the... our culture. |
| 19:52 | Lajla | somnium, dicisne latinam? |
| 19:53 | somnium | nil |
| 19:53 | Lajla | I like your response |
| 20:51 | ericthorsen_ | o where do type hints go with defrecord and deftype on the fields that are not ints or floats? It appears everything turns into Object otherwise. Is thing information used/stored anywhere in the genned class? |
| 20:51 | ericthorsen_ | so |
| 20:56 | ericthorsen_ | so where do type hints go with defrecord and deftype on the fields that are not ints or floats? It appears everything turns into Object otherwise. Is thing information used/stored anywhere in the genned class? |
| 21:46 | bmh | I've got a list of characters '(\a \b \c), what's the proper way of turning that into a bonafide string? |
| 21:47 | rhudson | ,(apply str '(\a \b \c)) |
| 21:47 | clojurebot | "abc" |
| 23:38 | TimMc | Raynes: Where do you want feedback on try-clojure.org? |