2011-07-29
| 00:15 | jcromartie | rock on |
| 00:16 | Pupeno | Good morning. |
| 00:24 | jcromartie | that reminds me... it's time to go to bed |
| 00:44 | Pupeno | What's the best way to run Clojure tests in Emacs? I'm using Slime. |
| 00:56 | scottj | Pupeno: I don't know but there's clojure-test-mode so you can C-c t I think to go from code to tests and C-c C-, maybe to run the tests and have failing ones highlighted |
| 00:56 | jcromartie | yeah |
| 00:56 | jcromartie | that's the way to go |
| 00:57 | jcromartie | so I said to myself "hey it would be cool to have a really dead simple CMS/string-management/localization as part of this app" |
| 00:57 | jcromartie | middleware! |
| 00:57 | jcromartie | (wrap-localization) |
| 00:58 | jcromartie | which replaces $foo$ in the body of the response with the localized string for key "foo" |
| 01:31 | jcromartie | except, $ doesn't work with the nice replace in str-utils2 ! |
| 01:31 | jcromartie | it complains of an invalid group |
| 01:32 | jcromartie | nah nevermind |
| 02:25 | laker | hello, what's clojure's answer to heavy client concurrency, is 1 agent per client a reasonable option? |
| 02:47 | dsantiago | Is there an easy way to take a namespace like "a.b.c-d" and have that be converted to a file path that clojure would look for, like "a/b/c_d"? |
| 02:48 | amalloy | &(clojure.string/replace "a.b.c-d" #"[.-]" (comp str {\. \/, \- \_} first)) |
| 02:48 | lazybot | ⇒ "a/b/c_d" |
| 02:49 | amalloy | and i guess you could get it shorter if you used strings in the map, instead of going from strings to characters and back |
| 02:49 | amalloy | &(clojure.string/replace "a.b.c-d" #"[.-]" {"." "/", "-" "_"}) |
| 02:49 | lazybot | ⇒ "a/b/c_d" |
| 02:50 | amalloy | dsantiago: ^ all that |
| 02:51 | dsantiago | Yeah, I guess in hindsight I can't think of why it isn't that simple. |
| 03:01 | tsdh | Hi all. |
| 03:01 | ischyrus | Which function takes a list of functions and stops with the first function that returns a non-nil value? |
| 03:01 | tsdh | ischyrus: some-fn, I think. |
| 03:01 | tsdh | ischyrus: But that's probably only in clojure 1.3. |
| 03:02 | amalloy | tsdh: really, some-fn? that seems silly, whatever it does |
| 03:02 | amalloy | ,(doc some-fn) |
| 03:02 | clojurebot | "([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns the first logical true value returned by one of its composing predicates against any of its arguments, else it returns logical false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical true result against the original predicates." |
| 03:02 | ischyrus | I remember seeing it in 1.2, I just can't recall the name |
| 03:03 | amalloy | oh. that |
| 03:03 | tsdh | http://clojure.github.com/clojure/branch-master/clojure.core-api.html#clojure.core/some-fn |
| 03:03 | amalloy | 's a useful function, but not really related to his request, i think |
| 03:03 | amalloy | ischyrus: i don't think it's a common enough desire that it has a whole top-level name for itself, but it's easy to construct |
| 03:04 | amalloy | &(let [fs [(constantly nil) (constantly true)]] (some #(%) fs)) |
| 03:04 | lazybot | ⇒ true |
| 03:04 | ischyrus | ah, it's cond |
| 03:05 | ohwow_ | Hellol |
| 03:07 | tsdh | I have a function that iterates some seq and picks out elements of a certain type (class). I have a strict (exactly the given class) and a non-strict (subclasses allowed, too) version. The former uses (identical? class (.getClass obj)), the latter (instance? class obj). The interesting thing is that the non-strict version is actually ~3 times faster! How can that be explained? |
| 03:08 | amalloy | tsdh: instanceof is a single bytecode instruction, and identical/getClass are methods you have to invoke |
| 03:09 | amalloy | would be my guess |
| 03:09 | tsdh | amalloy: Hm, might be. I just wondered because some years ago we were all warned that instanceof and reflection in general is slow... |
| 03:10 | amalloy | instanceof has never been slow, and does not use reflection |
| 03:10 | tsdh | Ok, then the teacher was wrong. ;-) |
| 03:11 | amalloy | it's not as fast as just casting to some known interface and then calling a (polymorphic) method on that interface, but in a java context a lot of instanceof calls are used for bad reasons |
| 03:12 | amalloy | like, instead of defining an interface that classes x, y, z all implement, you test x, then test y, then test z, with special handling for each. *that*'s certainly slower than doing it the right way |
| 03:14 | ohwow_ | So, if I understand correctly, Clojure doesn't have named LET's? |
| 03:15 | ohwow_ | If so, how can I do nested loops? |
| 03:15 | kumarshantanu | ohwow_: doseq |
| 03:16 | kumarshantanu | (doseq [i (range 100) j [:a :b :c]] (println i j)) |
| 03:16 | kumarshantanu | or, doseq within doseq |
| 03:16 | kumarshantanu | ,(doseq [i (range 100) j [:a :b :c]] (println i j)) |
| 03:16 | clojurebot | 0 :a |
| 03:16 | clojurebot | 0 :b |
| 03:17 | clojurebot | 0 :c |
| 03:17 | clojurebot | 1 :a |
| 03:17 | clojurebot | 1 :b |
| 03:17 | clojurebot | 1 :c |
| 03:17 | clojurebot | 2 :a |
| 03:17 | clojurebot | 2 :b |
| 03:17 | clojurebot | 2 :c |
| 03:17 | clojurebot | 3 :a |
| 03:17 | clojurebot | 3 :b |
| 03:17 | clojurebot | 3 :c |
| 03:17 | clojurebot | 4 :a |
| 03:17 | clojurebot | 4 :b |
| 03:17 | clojurebot | 4 :c |
| 03:17 | clojurebot | 5 :a |
| 03:17 | kumarshantanu | clojurebot: stop |
| 03:17 | clojurebot | 5 :b |
| 03:17 | clojurebot | 5 :c |
| 03:17 | clojurebot | 6 :a |
| 03:17 | clojurebot | 6 :b |
| 03:17 | clojurebot | 6 :c |
| 03:17 | clojurebot | 7 :a |
| 03:17 | clojurebot | 7 :b |
| 03:17 | clojurebot | 7 :c |
| 03:17 | clojurebot | 8 :a |
| 03:17 | clojurebot | 8 :b |
| 03:17 | clojurebot | 8 :c |
| 03:17 | clojurebot | 9 :a |
| 03:17 | clojurebot | 9 :b |
| 03:17 | clojurebot | 9 :c |
| 03:17 | clojurebot | 10 :a |
| 03:17 | clojurebot | 10 :b |
| 03:17 | clojurebot | 10 :c |
| 03:17 | clojurebot | 11 :a |
| 03:17 | clojurebot | 11 :b |
| 03:17 | clojurebot | 11 :c |
| 03:17 | clojurebot | 12 :a |
| 03:17 | clojurebot | 12 :b |
| 03:17 | kumarshantanu | clojurebot: kill |
| 03:17 | clojurebot | 12 :c |
| 03:17 | clojurebot | 13 :a |
| 03:17 | clojurebot | 13 :b |
| 03:17 | clojurebot | 13 :c |
| 03:17 | clojurebot | 14 :a |
| 03:17 | clojurebot | 14 :b |
| 03:17 | clojurebot | 14 :c |
| 03:17 | clojurebot | 15 :a |
| 03:17 | clojurebot | 15 :b |
| 03:17 | clojurebot | 15 :c |
| 03:17 | clojurebot | 16 :a |
| 03:17 | clojurebot | 16 :b |
| 03:17 | clojurebot | 16 :c |
| 03:17 | clojurebot | 17 :a |
| 03:17 | clojurebot | 17 :b |
| 03:17 | clojurebot | 17 :c |
| 03:17 | clojurebot | 18 :a |
| 03:17 | clojurebot | 18 :b |
| 03:17 | clojurebot | 18 :c |
| 03:17 | clojurebot | 19 :a |
| 03:17 | clojurebot | 19 :b |
| 03:17 | clojurebot | 19 :c |
| 03:17 | clojurebot | 20 :a |
| 03:17 | kumarshantanu | anybody knows how to stop clourebot from executing a long loop |
| 03:17 | clojurebot | 20 :b |
| 03:18 | clojurebot | 20 :c |
| 03:18 | clojurebot | 21 :a |
| 03:18 | clojurebot | 21 :b |
| 03:18 | clojurebot | 21 :c |
| 03:18 | clojurebot | 22 :a |
| 03:18 | clojurebot | 22 :b |
| 03:18 | clojurebot | 22 :c |
| 03:18 | clojurebot | 23 :a |
| 03:18 | clojurebot | 23 :b |
| 03:18 | clojurebot | 23 :... |
| 03:18 | clojurebot | we can't stop here! this is bat country! |
| 03:18 | clojurebot | No entiendo |
| 03:18 | Pupeno_ | It seems it's done. |
| 03:18 | ohwow_ | oh |
| 03:18 | ohwow_ | [11:17] < clojurebot> we can't stop here! this is bat country! |
| 03:18 | ohwow_ | hehe |
| 03:19 | ohwow_ | well, doseq is not always handy :( |
| 03:19 | amalloy | kumarshantanu: i think he has a maximum number of output characters |
| 03:19 | amalloy | and apparently \n is included in that |
| 03:19 | amalloy | ohwow_: (for) follows the same syntax as doseq |
| 03:19 | ohwow_ | For example, we are trying to find an element in matrix |
| 03:20 | ohwow_ | and once we found it we must exit |
| 03:20 | kumarshantanu | ohwow_: I know what you mean -- this is the toughest part of transitioning to functional programming |
| 03:20 | kumarshantanu | but well worth it |
| 03:20 | ohwow_ | well, |
| 03:20 | ohwow_ | I am a Scheme programmer |
| 03:20 | ohwow_ | so I sould just use nested lets |
| 03:21 | ohwow_ | and from the inner LET I can call the outer |
| 03:21 | kumarshantanu | ohwow_: you can use loop-recur as a last resort |
| 03:21 | amalloy | ohwow_: laziness means never having to explicitly exit early |
| 03:23 | amalloy | &(first (let [m [[1 2] [3 4]]] (for [x (range (count m)), y (range (count (first m))), :let [elt (get-in m [x y])], :when (= elt 3)] [x y]))) |
| 03:23 | lazybot | ⇒ [1 0] |
| 03:23 | amalloy | just construct a lazy-seq of all the work, and only consume as much of it as you want |
| 03:24 | Pupeno_ | There's some kind of shorthand to write functions, like #(+ 1 %), right? |
| 03:24 | MasseR | Pupeno_: That's a short anonymous function, yes |
| 03:24 | MasseR | (fn [x] (+ 1 x)) would be the longer version |
| 03:25 | Pupeno_ | Does that form have a name or where is it documented? |
| 03:25 | ohwow_ | so Loop returns a lazy sequence? |
| 03:25 | amalloy | ohwow_: for does |
| 03:25 | ohwow_ | oh for |
| 03:25 | ohwow_ | okay |
| 03:25 | ohwow_ | I guess I should take my time to get used to lazy programming |
| 03:25 | MasseR | Pupeno_: http://clojure.org/other_functions seems to have it |
| 03:26 | MasseR | "#() reader macro" |
| 03:26 | amalloy | ohwow_: if you actually use range as in my example, you get tripped up by the fact that range produces a chunked seq, so more elements get realized than you want |
| 03:26 | Pupeno_ | Thanks. |
| 03:27 | amalloy | &(first (let [m [[1 2] [3 4]]] (for [x '(0 1), y '(0 1), :let [elt (get-in m (doto [x y] (->> (println "trying"))))], :when (= elt 3)] [x y]))) |
| 03:27 | lazybot | ⇒ trying [0 0] trying [0 1] trying [1 0] [1 0] |
| 03:27 | MasseR | Altough, I can't find more documentation about it either :/ (then again, I started yesterday) |
| 03:27 | Pupeno_ | MasseR: yay! Welcome to Clojure... I re-started last week :) |
| 03:27 | amalloy | but here i used '(1 0) explicitly for total laziness, and printed each element before testing it; you can see it only went as far as necessary for one match |
| 03:28 | ohwow_ | hm |
| 03:28 | ohwow_ | thanks |
| 03:31 | ohwow_ | Wow, -> macro looks handyu |
| 03:32 | amalloy | ohwow_: yeah, that and ->> |
| 03:32 | amalloy | and doto |
| 03:33 | amalloy | and everything else :) |
| 03:55 | ohwow_ | I have a question regarding clojure-mode for emacs. Why does emacs ident my code like this http://paste.lisp.org/display/123631 ? |
| 03:55 | ohwow_ | I am using latest clojure-mode from ELPA |
| 03:59 | amalloy | ohwow_: that's how it indents lisp-mode too |
| 04:01 | amalloy | i'd guess it sees what the indent is, on the last line on which a sexp at the same level began. here, c began on a line with four spaces |
| 04:02 | amalloy | in fact, if i paredit-reindent-defun, it indents "correctly" |
| 04:03 | amalloy | but the TAB key is bound to something that only looks around locally |
| 04:04 | amalloy | (again, just guessing) |
| 04:10 | ohwow_ | amalloy: I see, so is there a workaround ? |
| 04:11 | amalloy | uh. paredit-reindent-defun? |
| 04:11 | amalloy | bound to M-q by default |
| 04:14 | ohwow_ | But even if I do it the code looks like http://pastebin.com/LkhseZ43 , not like http://pastebin.com/k0dVZ4tD |
| 04:14 | ohwow_ | I guess that's because in other Lisps different branches are enclosed in lists |
| 04:18 | amalloy | yes |
| 04:27 | MasseR | Hmm.. Clojure doesn't have pattern matching by default? |
| 04:31 | Pupeno_ | MasseR: Rich said so in the Clojure for Java programmers ted talk. |
| 04:32 | raek | MasseR: no, it doesn't. |
| 04:45 | tufflax | Can I serialize a record using pr-str and read-string somehow? Maybe by going through some additional functions on the way |
| 04:48 | MasseR | Couple of koans done. Let's see when I next have the time :P (next would be references) |
| 04:58 | amalloy | tufflax: in 1.3, pr-str and read-string with Just Work |
| 04:59 | amalloy | *will |
| 05:08 | tufflax | ok |
| 05:09 | tufflax | But if one could turn a map into a record, that should work... is there a way to do that? |
| 05:14 | tufflax | The reason I have not transitioned is mainly because most documentation around is for 1.2 btw. Is there like a new version of the clojure.org docs for 1.3 somewhere? I think it would be a good idea to reread the docs anyway, so it would be 2 birds with 1 stone |
| 05:15 | genokuber | is there anyone who sits on #java? |
| 05:15 | tufflax | genokuber what do you mean? |
| 05:16 | triyo | Anyone have some experience in moustache micro-web-framework? |
| 05:16 | JochenR | tufflax:Same with me :-) |
| 05:16 | tufflax | :) |
| 05:17 | triyo | I have a question about routing and named var bindings and how to pass them on to my view-function |
| 05:19 | triyo | Here is the codehttps://gist.github.com/1113502 |
| 05:20 | thorwil | triyo: how does your route look like? |
| 05:20 | triyo | https://gist.github.com/1113502 |
| 05:20 | thorwil | ah, nm |
| 05:21 | triyo | Basically what I want is, for my view function to receive "request" binding and and the named params |
| 05:21 | triyo | something like (defn essay [req slug] (...)) |
| 05:21 | triyo | I'm trying to figure out how it handles this. |
| 05:23 | thorwil | oh, that wrap-params can be around several routes is news to me |
| 05:23 | triyo | Yup, it can and inline per route-request |
| 05:24 | triyo | As per docs.... (app ["foo" name] my-handler) ; will route requests to "/foo/", "/foo/bar" to my-handler and bind @name@ (a local) to the matched segment (eg "" or "bar") |
| 05:24 | triyo | does that mean "name" will become a local thread bound var? |
| 05:25 | triyo | how does my function receive it including the "request" map? |
| 05:25 | thorwil | triyo: a fn inside wrap-params will receive req-params as first and only arg, afaik |
| 05:26 | triyo | thorwil: yup, that seems to be the case, because if I try to make my fn with two args, I get IllegalAgEx |
| 05:26 | laker | if trying to replace erlang with clojure, is 1 agent per client equivalent to erlang's 1 process/client |
| 05:26 | thorwil | to also work with an url segment, you can put in a function that will return an fn that will take the params |
| 05:26 | thorwil | triyo: partial can be useful there |
| 05:27 | triyo | True |
| 05:27 | triyo | Let me try that out quick |
| 05:30 | triyo | throwil: partial worked |
| 05:31 | thorwil | cool |
| 05:31 | triyo | however request binding needs to be bound to last argument of function, so instead of (defn essay [req slug] (...)) I swapped the args to (defn essay [slug req] (...)) |
| 05:31 | triyo | this is due to partial.... unless there is something like Haskell's flip function :) |
| 05:32 | triyo | (comp partial flip) ;-) |
| 05:32 | thorwil | well, args in the sequence they will be delivered makes sense, anyway, right? :) |
| 05:33 | triyo | yup, true, order doesn't really matter any case that I can think of, well except an `apply` ... but even then req is last |
| 05:35 | triyo | Though a flip function in clojure would be walk in a park (defn flip [f] (fn [& args] (apply f (reverse args)))) |
| 05:45 | neotyk | Good morning everyone! |
| 05:49 | triyo | morning |
| 05:51 | ohwow_ | Why `rseq' doesn't work on lists? |
| 05:53 | raek | ohwow_: because lists don't have any "natural" way of traversing them backwards |
| 05:54 | ohwow_ | hm |
| 05:54 | ohwow_ | Oh, so rseq is lazy, while reverse is not? |
| 05:54 | raek | yes |
| 05:54 | ohwow_ | That makes sense, thanks |
| 05:54 | raek | rseq is constant time |
| 05:54 | ohwow_ | but `rseq' returns a list |
| 05:54 | ohwow_ | even if I pass a vector to it. |
| 05:55 | raek | no, it returns a sequence |
| 05:55 | raek | which is a traversal of the elements of a data structure in some order |
| 05:55 | ohwow_ | ,(rseq '[1 2 3]) |
| 05:55 | clojurebot | (3 2 1) |
| 05:55 | raek | vectors can be traversed in to direction, so you have both seq and rseq |
| 05:55 | raek | *two directions |
| 05:56 | raek | sequence is an interface (ISeq) and the list (PersistentList) is one implementation |
| 05:56 | raek | the vector seq is another |
| 05:57 | raek | ,(map class (seq [1 2 3]) (rseq [1 2 3])) |
| 05:57 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (2) passed to: core$class> |
| 05:57 | ohwow_ | Okay, then why does (rseq (seq '[1 2 3])) gives me an error? |
| 05:57 | raek | ,(map class [(seq [1 2 3]) (rseq [1 2 3])]) |
| 05:57 | clojurebot | (clojure.lang.PersistentVector$ChunkedSeq clojure.lang.APersistentVector$RSeq) |
| 05:58 | ohwow_ | Seq is supposed to return a sequence |
| 05:58 | ohwow_ | and rseq can take a sequence as an argument |
| 05:58 | raek | yes, and sequences does not support rseq in general |
| 05:58 | raek | it can? |
| 05:58 | ohwow_ | hm |
| 05:58 | ohwow_ | Oh |
| 05:58 | morphling | ,(doc rseq) |
| 05:58 | clojurebot | "([rev]); Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in reverse order. If rev is empty returns nil" |
| 05:59 | raek | rseq work on data structures (vectors, sorted-sets, etc) not sequences |
| 05:59 | ohwow_ | Oh |
| 05:59 | ohwow_ | ok, sorry |
| 05:59 | ohwow_ | I was confused there for a moment |
| 05:59 | raek | you can often partition the clojure functions in two camps: those that operate on sequences and those that operate on data structures |
| 06:04 | tufflax | raek but clojure is all about programming to abstractions right? So those fns that operates on "data structures" is really just operationg on other abstractions? |
| 06:07 | tufflax | are really* |
| 06:07 | raek | yes |
| 06:12 | fredeu | Hi! Is this current? (I want to run Emacs/Slime) http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html |
| 06:12 | fredeu | When I follow https://github.com/technomancy/swank-clojure , it tells me to add marmalade to my package-archives -- but the package-archives var apparently doesn't exist... (I'm running emacs pulled yesterday from github.) |
| 06:13 | raek | fredeu: no, that one is very old |
| 06:13 | raek | the first one |
| 06:14 | raek | fredeu: you probably need to install package.el |
| 06:14 | raek | technomancy/swank-clojure is the official readme, so that's the one you should follow |
| 06:14 | raek | fredeu: are you running emacs 23 or 24? package.el should be included in 24 |
| 06:15 | fredeu | raek: Thanks! Yeah, I looked at package.el, and it looked to be the same version that's on my distribution (emacs 24)... but I'll recheck... |
| 06:15 | fredeu | I'm running: GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.4) of 2011-07-28 on ubuntu |
| 06:16 | raek | then you shouldn't need to install package.el |
| 06:17 | fredeu | Hmm... it installed something when I didn't execute the marmalade sexp, but I imagine it's badly outdated... |
| 06:17 | fredeu | (I mean, I skipped the marmalade step.) |
| 06:18 | fredeu | Ah, never mind, I should use the clojure-jack-in method... |
| 06:19 | raek | clojure-jack-in is provided by clojure-mode, which you get from marmalade or git |
| 06:19 | fredeu | raek: Ok thanks, then git it is. ;) |
| 06:20 | raek | can you run M-x package-list-packages ? |
| 06:20 | raek | it's strange the var doesn't exist |
| 06:20 | fredeu | Yep. |
| 06:21 | raek | so you have package.el but you can't add the marmalade repo? |
| 06:21 | fredeu | Exactly. But I'm now double-checking everything... maybe there's some weird conflict, or something... |
| 06:23 | fredeu | Yeah, it's so weird, because after a seemingly-successful (require 'package), I keep getting "Debugger entered--Lisp error: (void-variable package-archives)" |
| 06:25 | fredeu | And when I look at vars like package-alist, emacs links me to the "10 Mar 2007" version of package.el -- the same one technomancy links to in the clojure-mode readme. |
| 06:27 | fredeu | Ok, a cleaner .emacs resolves the conflict... Thanks for listening to me yakkk, sorry for taking your time... :) |
| 07:21 | wjlroe | Anybody know anything about Maven + Leiningen? I'm having real problems trying to get it to work. When I use the mvn cmd line I can see what errors are happening but they way Leiningen fetches dependencies, it doesn't print useful error messages. |
| 07:22 | wjlroe | So I get this error: "[WARNING] repository metadata for: 'artifact org.clojure:clojure' could not be retrieved from repository: artifactory-rel due to an error: Error transferring file" But it doesn't say whether it's an SSL problem or an auth problem... |
| 08:20 | MasseR | Haha. "spit" and "slurp" |
| 09:23 | MasseR | (disclaimer: Started learning clojure yesterday) I'm unable to create a executable clojure file. I tried 'lein new foo' and edited the created src clojure file to have (:gen-class) in the namespace. the project.clj has :main and :aot directives. Compiler complains about noclassdeffounderror |
| 09:23 | MasseR | http://asymmetrical-view.com/2010/06/08/building-standalone-jars-wtih-leiningen.html pretty much like this |
| 09:25 | MasseR | lein run complains about the same error |
| 10:06 | TimMc | MasseR: I first learned the complement to slurp as "barf", which is a bit more horrifying. |
| 10:06 | jcromartie | hah |
| 10:07 | ambrosebs | lol |
| 10:11 | TimMc | MasseR: When I first started with Clojure, my problems getting lein run to work mostly revolved around misnamed class files or namespaces. |
| 10:12 | TimMc | s/class files and // |
| 10:12 | TimMc | lazybot: What's with you today? |
| 10:13 | TimMc | MasseR: Does your namespace have any hyphens or underscores? |
| 10:13 | jcromartie | TimMc: your regex was wrong |
| 10:13 | TimMc | yeah? |
| 10:13 | MasseR | TimMc: No. http://stackoverflow.com/questions/6874338/standalone-clojure-app |
| 10:13 | TimMc | oh, "or" |
| 10:13 | TimMc | Just as well, I don't like that feature. |
| 10:14 | TimMc | MasseR: Are you working from the src folder? |
| 10:14 | MasseR | TimMc: Root |
| 10:15 | TimMc | I mean, is your "core.clj" in ./src/test/ ? |
| 10:15 | MasseR | src/test/core.clj yes |
| 10:15 | TimMc | There is also the "test" folder, which is going to be confusing if you also have a namespace called that. |
| 10:15 | TimMc | Hmm, OK. |
| 10:16 | TimMc | You don't need the :aot, by the way, not for this. |
| 10:16 | MasseR | Oh ok |
| 10:16 | TimMc | What does lein compile do? |
| 10:17 | MasseR | The same error |
| 10:17 | MasseR | Hmm.. I moved the same project as is to my desktop computer where it works |
| 10:18 | TimMc | huh |
| 10:18 | MasseR | My laptop is ubuntu 10.04 with clojure 1.2.1 (not from repositories) and leiningen from git |
| 10:18 | MasseR | The desktop is arch with clojure from repository and leiningen from aur |
| 10:19 | TimMc | lein from git? |
| 10:19 | TimMc | Oh, right. github |
| 10:25 | Poet_ | Hi . Can anyone give me link to simple basic gui tutorial in clojure ? I need something with paint and mouse action listeners . I checked google and i found everything without paint examples |
| 10:26 | kumarshantanu | Poet_: Clj-Shoes |
| 10:27 | kumarshantanu | https://github.com/abhijith/clj-shoes |
| 10:33 | manutter | Poet_: you might also want to look up SeeSaw (clojure swing tools) |
| 10:37 | jcromartie | any comments on my form validation lib? https://gist.github.com/660666aff8742ab77ad9 |
| 10:37 | jcromartie | I think I need to call it done... I get so distracted by the other stuff |
| 10:38 | jcromartie | I spent about 5 hours last night twiddling middleware instead of making progress towards and actual app |
| 10:39 | Poet_ | kumarshantanu: thank you |
| 10:52 | tmountain | is there an official clj script for invoking .clj files or is it still a matter of rolling your own shell script? |
| 10:59 | neotyk | Anyone from clojure/core working today on ClojureScript? |
| 11:07 | fredeu | Hi! I have lein 1.6.1, which appears not to support the jack-in task. (Or am I missing something?) I installed it today as per the GitHub instructions... should I do something else? |
| 11:07 | fredeu | (I apparently need jack-in for the Slime command clojure-jack-in to work.) |
| 11:16 | fredeu | I'm beginning to think that clojure-mode may be broken, as I don't see the jack-in task in lein's GitHub repo. But it's clearly in clojure-mode: https://github.com/technomancy/clojure-mode/blob/master/clojure-mode.el#L852 |
| 11:50 | gtrak | anyone know hot to fix "java.lang.ClassNotFoundException: com.sun.jdi.VirtualMachine" with lein ritz ? |
| 11:59 | tmountain | found the answer to my question: https://github.com/richhickey/clojure-contrib/blob/master/launchers/bash/clj-env-dir |
| 12:01 | technomancy | swank? |
| 12:01 | clojurebot | swank is try the readme. seriously. |
| 12:22 | hugod | gtrak: I just added the exception explicitly in the ritz readme |
| 12:35 | cgrand | Should (rand-nth []) returns nil or (rand-nth nil) throws an exception or the docstring for rand-nth to be "fixed" to say the collection mus not be empty? |
| 14:00 | mefesto | Hello everyone. I'm trying to set some jmv options using the JVM_OPTS env var when running a leiningen project. Is there a known issue when using muliple flags or am I doing it wrong? https://gist.github.com/1114355 |
| 14:00 | mefesto | s/jmv/jvm/ |
| 14:00 | lazybot | <mefesto> Hello everyone. I'm trying to set some jvm options using the JVM_OPTS env var when running a leiningen project. Is there a known issue when using muliple flags or am I doing it wrong? https://gist.github.com/1114355 |
| 14:01 | mefesto | this is the error i receive: "export: 130: -Xms512m: bad variable name" |
| 14:59 | manutter | mefesto: try putting "env " in front of your command |
| 15:00 | mefesto | manutter: like: env JVM_OPTS="... |
| 15:08 | gtrak | hmm, what does slime need to see source from another project? |
| 15:12 | gtrak | I'm trying to hack on source in a lib by running swank on the project that uses the lib, and I've got a symlink to the lib's project root in the using project's checkouts/ |
| 15:14 | amalloy | gtrak: you don't need to do that. just have the lib as a normal dependency, and M-. one of the symbols it defines when you use it from your code |
| 15:16 | gtrak | amalloy, I think the issue is the lib is AOT compiled and doesn't have the source in it |
| 15:16 | amalloy | haha ew. you on your own there, sorry |
| 15:18 | Pupeno | Is there an easy way to re-start slime after doing clojure-jack-in? |
| 15:19 | technomancy | Pupeno: sure: M-x clojure-jack-in |
| 15:20 | Pupeno | That didn't work. Should I close swank or some other buffers? |
| 15:20 | technomancy | yeah, there's a bug where it doesn't kill the *swank* buffer in some cases; haven't been able to repro here |
| 15:20 | technomancy | you could kill it manually |
| 15:23 | Pupeno | Can La Clojure behave like Slime or close? |
| 15:28 | hiredman | Pupeno: to what end? |
| 15:29 | Pupeno | hiredman: have a REPL and get whole files or parts compiled into it. |
| 15:29 | hiredman | ah, does La Clojure not do that by default? |
| 15:29 | hiredman | I just take it as a given that any clojure editor will provide such |
| 15:33 | Pupeno | Well… Emacs doesn't do it by default either. |
| 15:33 | hiredman | Pupeno: sure, but emacs doesn't have "Clojure" in the name |
| 15:34 | hiredman | which swank-clojure and La Clojure both do |
| 15:34 | Pupeno | IntelliJ Idea doesn't either. |
| 15:34 | hiredman | (swank-clojure being the bit that provides it for emacs) |
| 15:35 | hiredman | right, emacs+swank-clojure has it, so I would assume La Clojure + IDEA does |
| 15:35 | Pupeno | hiredman: you still have to do meta-x clojure-jack-in to get with swank-clojure. It doesn't automagically happens. |
| 15:36 | hiredman | Pupeno: I fail to see your point |
| 15:36 | Pupeno | hiredman: in Emacs with swank-clojure you have to do something to get the REPL going… I know what it is…. in IntelliJ+La Clojure I don't. |
| 15:36 | hiredman | ah |
| 15:36 | Pupeno | I think I found how to do it but IntelliJ doesn't know where Clojure is. |
| 15:37 | hiredman | you asked "can" instead of "how" up above |
| 15:37 | Pupeno | Yeah… I'm still not sure it can do it. It seems it can run a REPL… not sure about compiling little parts and so on. |
| 15:37 | hiredman | have you see the getting started with La Clojure page? |
| 15:39 | Pupeno | I seen the plugin page (http://plugins.intellij.net/plugin/?id=4050), let me search for that. |
| 15:39 | hiredman | http://dev.clojure.org/display/doc/Getting+Started+with+La+Clojure+and+IntelliJ+IDEA |
| 15:39 | hiredman | not that there is much there |
| 15:42 | Pupeno | Start Clojure Console is disabled here, apparently, IntelliJ can't find clojure yet :P |
| 15:44 | gtrak | how do you guys do find-usages from slime? |
| 15:45 | hiredman | there is a slime-who-calls I think |
| 15:45 | hiredman | (as you should be able to tell from the above I don't use it, just rgrep) |
| 15:46 | gtrak | rgrep, thanks |
| 15:47 | gtrak | ah, slime-who-calls works great |
| 15:48 | gtrak | except when it doesnt! |
| 15:50 | gtrak | it doesn't seem to catch usages from different files |
| 15:51 | netrealm | Ah, okay, this maybe a stupid question, but: How would I go about prepending a colon ":" to an arbitrary string for a map value? |
| 15:52 | hiredman | why do you want to do that? |
| 15:52 | netrealm | As in, I'm converting an arbitray map to be used by lazy-xml/emit, so trying to go from {somename somevalue} to {:tag :somename :content ["somevalue"]} |
| 15:53 | hiredman | http://clojure.org/data_structures#Data%20Structures-Keywords |
| 15:53 | netrealm | I have everything working except I can't get :somename |
| 15:53 | hiredman | those are not strings |
| 15:53 | hiredman | ,:somename |
| 15:53 | clojurebot | :somename |
| 15:53 | amalloy | netrealm: i suspect lazy-xml is perfectly happy to have the tag be a symbol/string instead of a keyword |
| 15:54 | amalloy | the new data.xml certainly is |
| 15:55 | hiredman | it amazes me that people will pick up a language and try to do something as complex as xml rangling without bothering to learn the language basics |
| 15:55 | hiredman | netrealm: not to pick on you, it happens all the time |
| 15:56 | amalloy | too much exposure to ant? |
| 15:57 | netrealm | hiredman: yeah...I'm just trying to learn by doing. |
| 15:57 | hiredman | clojure.org is required reading |
| 15:57 | netrealm | so, I've got (keyword (key v)), where v is an element from my original map, is this the correct way of doing this? |
| 15:58 | hiredman | starting from rationale |
| 15:58 | hiredman | it depends on what the key of v is |
| 15:58 | netrealm | clojure.org is good, but sometimes I find that I have to start trying to solve problems and find out what I don't understand. |
| 15:59 | hiredman | I guess |
| 16:00 | netrealm | right, so, I've got (def my-map {somename somevalue othername othervalue}), and I have a function (defn make-xml [v] {:tag (keyword (key v)) :content [(val v)]}), and I do (map make-xml my-map). |
| 16:01 | netrealm | And that gives me my desired output that works with lazy-xml/emit |
| 16:08 | imade | amalloy: hey, if you're there, I solved it with lazy-seq like you suggested, thanks for the tip, look at the third solution https://gist.github.com/1112440 |
| 16:08 | amalloy | imade: ah, cool |
| 16:09 | amalloy | &(take 10 (map first (iterate (fn [[a b]] [b (+ a b)]) [1 1]))) ; is how i usually do it |
| 16:09 | lazybot | ⇒ (1 1 2 3 5 8 13 21 34 55) |
| 16:10 | amalloy | but the lazy-seq approach is nice, because you don't have to explicitly manage the two-element vector |
| 16:12 | dbushenko | how to update clojure version in the counterclockwise? |
| 16:13 | imade | amalloy: iterate is a cool function |
| 16:16 | dbushenko | cgrand, hi, do you know how to update clojure version in ccw? |
| 16:16 | kephale | you know, iterate kind of annoys me actually, not the functionality, but in non-clojure code i use the function name "iterate" all the time |
| 16:16 | amalloy | kephale: so use it in clojure too. there's no Shadowing Police |
| 16:17 | kephale | amalloy: i know, i just hate potentially confusing people that read my code |
| 16:17 | kephale | although shadowing police… you could be onto something there |
| 16:19 | kephale | i might take you up on that if i'm non-lazy enough to keep every such call namespace qualified |
| 16:31 | eddayyy | are you supposed to be able to follow ClojureScript quickstart page and not have any problems, or what deps do you need? |
| 16:31 | amalloy | in a macro, i want to build a list with 3 elements, say (a b c ); i have a variable elsewhere that tells me whether or not i need to add a fourth element, x, at the end of the list. my usual solution to this is `(a b c ~@(when test [x])), but this is not very readable. does anyone have a better way? |
| 16:37 | kephale | can you convert test to a function? |
| 16:37 | kephale | ##(let [test (fn [x] (when true x))] |
| 16:37 | kephale | (list 'a 'b 'c (test 'x))) |
| 16:37 | kephale | &(let [test (fn [x] (when true x))] (list 'a 'b 'c (test 'x))) |
| 16:37 | lazybot | ⇒ (a b c x) |
| 16:39 | kephale | err in a macro, duh... |
| 16:41 | amalloy | kephale: at any rate that would result in a list which is always four elements long, ending with either nil or x |
| 16:42 | amalloy | &`(a b c ~@(when false ['x])) ;; actually only three elements |
| 16:42 | lazybot | ⇒ (clojure.core/a clojure.core/b clojure.core/c) |
| 16:42 | kephale | indeed… hrm |
| 16:50 | eddayyy | CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: sun.org.mozilla.javascript.internal.Context, compiling:(cljs/compiler.clj:971) |
| 16:50 | eddayyy | anyone have a clue what this means? |
| 16:51 | eddayyy | (trying to start clojurescript and get presented with mozilla errors... downloaded rhino & placed jars in classpath (= no-luck)) |
| 16:53 | amalloy | eddayyy: you're probably trying to use openjdk |
| 16:53 | amalloy | with which cljs is apparently not yet compatible |
| 16:53 | eddayyy | amalloy: correct |
| 16:53 | eddayyy | amalloy: ah i see, thank you |
| 16:54 | Blackfoot | question about clojurescript: when I have code "(.play (goog.fx.dom.FadeOut. counter 1000))" it translates to (new goog.fx.dom.FadeOut(counter__1996,1000)).play |
| 16:54 | Blackfoot | ie it does not actually run execute play |
| 16:55 | kephale | amalloy: what do you have readability issues with there? the @ makes it a little unclear i guess |
| 16:55 | amalloy | ##(macroexpand '(.play x)) vs ##(macroexpand '(. x (play))) |
| 16:55 | lazybot | (macroexpand (quote (.play x))) ⇒ (. x play) |
| 16:56 | lazybot | (macroexpand (quote (. x (play)))) ⇒ (. x (play)) |
| 16:56 | amalloy | Blackfoot: on the jvm, the compiler can tell at runtime whether the thing you're trying to get at is a field or a method; in js, functions are just fields, so it needs to know at compile time |
| 16:56 | amalloy | i suspect |
| 16:57 | amalloy | so when you want to call a no-arg "method", i'd play safe with (. x (play)) |
| 16:59 | Blackfoot | amalloy: thanks, that worked. i haven't used the unsugared notation before |
| 17:00 | kephale | amalloy: not in a macro but ##(concat '(a b c) (when true ['x])) ##(concat '(a b c) (when false ['x])) |
| 17:00 | lazybot | (concat (quote (a b c)) (when true [(quo... ⇒ (a b c x) |
| 17:00 | lazybot | (concat (quote (a b c)) (when false [(qu... ⇒ (a b c) |
| 17:00 | Blackfoot | i wonder if it could eventually tell that it was a function |
| 17:00 | kephale | err, i need to learn lazybot... |
| 17:00 | amalloy | Blackfoot: so what? even if it is a function, you might be intending to access it as a field and pass it around without calling it |
| 17:01 | Pupeno | I got La Clojure working beautifully… documenting how now. |
| 17:01 | kephale | i'm not sure if you can get anything smaller than what you have, but concat would hide that nil for you |
| 17:01 | amalloy | kephale: the ~@ stuff is basically the same as that concat |
| 17:02 | amalloy | i just feel like there should be an append-if function or something like that. maybe i should just write it |
| 17:04 | kephale | amalloy: that does sound like the best way to make it anymore readable without bloat |
| 17:04 | kephale | any more* |
| 17:05 | Blackfoot | amalloy: that doesn't seem to be what http://clojure.org/java_interop indicates is the JVM behavior |
| 17:05 | amalloy | If the second operand is a symbol and no args are supplied it is taken to be a field access - the name of the field is the name of the symbol, and the value of the expression is the value of the field, unless there is a no argument public method of the same name, in which case it resolves to a call to the method. |
| 17:06 | Blackfoot | amalloy: yea, isn't 'play' a no arguement public method? |
| 17:06 | amalloy | no, it is a field, which happens to be a function |
| 17:06 | amalloy | in java, trying to access a method as a field is an error |
| 17:06 | amalloy | so the compiler special-cases that |
| 17:06 | amalloy | in js, it's perfectly fine |
| 17:06 | Blackfoot | so javascript doesn't have any methods, basically? |
| 17:07 | amalloy | i mean, i'm not a js expert, so that's probably oversimplifying, but yes |
| 17:07 | dnolen | Blackfoot: JS just has properties. But if you call a function property, it will have it's context bound to the object to which that function was a property of. |
| 17:08 | dnolen | Blackfoot: but no, "methods" are not an actual construct of the language. |
| 17:08 | Blackfoot | hmm, so would ((.play (FadeOut ...)) work? trying... |
| 17:08 | amalloy | probably |
| 17:08 | Blackfoot | i'm not a js expert either, just playing around with clojurescript. pretty cool stuff |
| 17:09 | Blackfoot | guess not... Uncaught TypeError: Object [object DOMWindow] has no method 'onBegin' |
| 17:10 | Blackfoot | generates (new goog.fx.dom.FadeOut(counter__1996,1000)).play.call(null) |
| 17:10 | Blackfoot | i'm not familiar with the call() function |
| 17:10 | dnolen | Blackfoot: "this" was not set. |
| 17:10 | dnolen | Blackfoot: all functions have a call property which allows to do 2 things |
| 17:10 | dnolen | 1) set the value of 'this' 2) pass the args |
| 17:11 | dnolen | .call(object, a0, a1, ..., an) |
| 17:11 | dnolen | in your case object was probably set to null |
| 17:12 | Blackfoot | yea looks like it |
| 17:14 | dnolen | Blackfoot: in anycase (. x (play)) is what you want because of in JS you just have properties. |
| 17:14 | Blackfoot | yep, that is working. I like learning about the reasons why, too, thanks for the explanations |
| 17:36 | kyleburton | hello |
| 17:37 | kyleburton | anyone running into RejectedExecutionException's with lein? I upgraded to 1.6.1 and build swank-clojure from Technomancy's git repo just to make sure I was up to date... |
| 17:37 | kyleburton | trying to load a file, I get that exception |
| 17:39 | hiredman | your swank-clojure isn't really up to date, double check |
| 17:41 | duncanm | how that i program in JRuby, i really appreciate the Clojure reader decision to require explicit forward declarations |
| 17:41 | kyleburton | thank you - Technomancy responded on #leiningen |
| 17:42 | kyleburton | I couldn't see it, but he said I had an 1.3.2 on my classpath - nuking my ~/.m2/repo/.../swank-clojure dirs fixed it |
| 17:42 | kyleburton | thanks! |
| 17:57 | Raynes | I wonder if Stuart Sierra knew that he didn't have to fork clojurescript to clojure. You can actually move repositories, watchers and all, from the admin panel. |
| 17:57 | Raynes | Not that it matters. The repository was private, so there weren't any watchers to propagate. |
| 19:01 | momox | what does this line of code do? http://pastebin.com/sdCAhDPq |
| 19:01 | momox | its part of the source code of conj |
| 19:01 | amalloy | it calls clojure.lang.RT.conj |
| 19:01 | amalloy | which is in java |
| 19:02 | hiredman | clojure.lang.RT/conj |
| 19:06 | momox | amalloy: i can't view the source from the repl? |
| 19:07 | hiredman | it's a java method |
| 19:09 | momox | hiredman: so the only way to view it is to open the .java file using a text editor? |
| 19:09 | hiredman | *shrug* whatever floats your boat |
| 19:10 | amalloy | other ways include: looking at the .java file on github |
| 19:13 | momox | good idea |
| 19:13 | momox | thanks hiredman and amalloy |
| 19:19 | momox | it looks like that line of code will keep on calling itself over and over again |
| 19:19 | momox | (conj coll x) |
| 19:20 | hiredman | http://clojure.org/java_interop |
| 19:25 | the-kenny | Thanks for implementing Multimethods in ClojureScript. Makes my life so much easier :) |
| 19:25 | dnolen | momox: the Clojure code is calling out to Java to do the actual work. |
| 19:26 | dnolen | the-kenny: did multimethods get merged to master? |
| 19:26 | the-kenny | dnolen: Yup |
| 19:29 | momox | dnolen: thanks. I understand it now. Just realised that (. Classname-symbol (method-symbol args*)) is equivalent to (. Classname-symbol method-symbol args*) |
| 20:15 | pmbauer | [ANN] First Clojure User Group Meeting. https://groups.google.com/d/msg/clj-phx/l_S4qcOSuaY/WhOC7T8HOK8J |
| 20:15 | pmbauer | Phoenix, AZ |
| 20:15 | pmbauer | http://clj-phx.wikispaces.com/ |
| 20:15 | pmbauer | That is all, thank you! |
| 20:27 | dnolen | pmbauer: cool! |
| 20:31 | Pupeno | Here's how I got La Clojure working: http://pupeno.com/blog/getting-started-with-la-clojure-on-mac-os-x-a-visual-guide/ |
| 20:33 | hiredman | well there is your problem right there |
| 20:33 | hiredman | using the system package manager to install clojure |
| 20:35 | hiredman | you should be fetching it from a maven repo via lein/maven |
| 20:54 | tauntaun | Newbie Q: Any reason why I can't (import '(javax.swing SwingUtilities)) in Clojure, seeing as I can import it in Java? |
| 20:55 | hiredman | what makes you think you cannot import it? |
| 20:55 | tauntaun | Nevermind :) It was a typo... |
| 21:18 | dnolen | man i love metadata on symbols. |
| 21:25 | dnolen | if anybody wants to follow along the pattern matching / predicate dispatch developments, you can check in here, https://github.com/swannodette/match/wiki/Design-Wiki, not much there yet, but there will be. |
| 21:27 | hiredman | dnolen: "3 or 4" means it depends on the ordering? |
| 21:27 | dnolen | hiredman: yeah. those are ambrose notes. |
| 22:58 | sritchie | hey all -- this is a very beginner web development question, but I was wondering -- would it make sense to embed clojurescript in an existing rails application, for some view that requires lots of UI? |
| 22:58 | sritchie | I'm trying to get a feel for how these web stacks incorporate their js |
| 23:08 | gfrlog | sritchie: that sounds like a pretty tame use case to me |
| 23:09 | sritchie | haha, sure, I get that |
| 23:11 | gfrlog | um. so yes it makes sense? |
| 23:11 | sritchie | I just don't have a good feel for, say, whether to design a full application in clojurescript, scrapping the rails part, or whether it finds its place nested in another web framework |
| 23:12 | Scriptor | sritchie: that's more of a choice in what you want your app to be like |
| 23:12 | Scriptor | if you go for clojurescript-only, that means you already decided you want to have a one-page app, basically a desktop app in a browser |
| 23:12 | Scriptor | and have something like sinatra on the server |
| 23:12 | sritchie | I see |
| 23:13 | sritchie | so a more complicated data model would push toward a need for a bigger web framework to back clojurescript |
| 23:13 | Scriptor | not really |
| 23:14 | Scriptor | what do you mean by a more complicated data model? Google Docs is a good example of a one-page app and it seems pretty complicated :) |
| 23:14 | sritchie | I'll lay out what I'm thinking -- I'm designing a registration system for kayak regattas |
| 23:14 | sritchie | these are sprint races, with a progression based on a set of rules -- so, users need to be able to register for races all season, and the particular regatta events contain logic to manage progressions, juggle results, etc |
| 23:16 | sritchie | beyond that, athletes are members of teams, which have their own area within the site |
| 23:16 | sritchie | I'm not saying at all that I don't think clojurescript can handle that stuff -- I'm just not familiar with the javascript side of all this, so I'm trying to get a feel for how one might make the decision between going full-clojurescript vs rails et al |
| 23:17 | Scriptor | hmm, it's not really a matter of clojurescript vs rails |
| 23:17 | Scriptor | keep in mind that the niche clojurescript is meant to be an alternative to something like dojo, extjs, or yui |
| 23:17 | Scriptor | basically, heavyweight js frameworks |
| 23:18 | Scriptor | it's perfectly fine to have clojurescript and rails at the same time |
| 23:18 | Scriptor | just like you can have dojo and rails at the same time |
| 23:19 | sritchie | great, this gives me a good place to start absorbing |
| 23:21 | goodieboy | what is "&" in clojure? for example when using defn to specify optional arguments... |
| 23:22 | sritchie | goodieboy: & packs all optional arguments (if they exist) into a list bound to the var following & |
| 23:22 | Scriptor | in the simplest sense, it means all remaining arguments that are passed are bound as a list to the variable name that comes after the & |
| 23:22 | amalloy | argh don't encourage him to think of it as "optional" |
| 23:23 | amalloy | "additional", or "further" or something. "optional" implies, among other things, that you could put multiple bindings after the & |
| 23:23 | sritchie | amalloy: good point, sorry about that |
| 23:23 | amalloy | just the other day someone was asking why (fn [x & y z]) didn't work |
| 23:24 | amalloy | anyway, Scriptor's definition is good |
| 23:25 | leonid_ | is there a way to define a var arg function using #()? |
| 23:25 | amalloy | %& |
| 23:25 | leonid_ | ! |
| 23:26 | leonid_ | thanks ! |
| 23:26 | amalloy | clojure and perl: members of a small group of languages in which you can answer a question using only punctuation |
| 23:26 | goodieboy | ok thanks guys, i guess i'm wondering more about if it's just defn that sees & as something "special" or if the language itself sees & as a global "keyword" of sorts? |
| 23:27 | amalloy | goodieboy: mostly, it's just defn (actually, it's destructure, which is used by fn and by let) |
| 23:28 | amalloy | i learned recently that that's a bit of a simplification, but i didn't encounter any of the exceptions for over a year |
| 23:29 | goodieboy | cool ok thanks... coming from ruby, this homoiconic stuff is fascinating :) |
| 23:29 | amalloy | (and when i did, i was doing something evil. so you shouldn't worry about it) |
| 23:30 | amalloy | specifically, it turns out you can't define a macro named & |
| 23:30 | amalloy | because the reader refuses to macroexpand it |
| 23:30 | goodieboy | oh really? so it is something "special"? |
| 23:30 | goodieboy | ahh ok |
| 23:30 | amalloy | like i said, there are some exceptions |
| 23:30 | amalloy | but you won't see them unless you're evil |
| 23:31 | goodieboy | ok good to know. well, i am not evil, but wish i were :) |
| 23:32 | amalloy | well, lisp is a good place to start: http://tch515866.tch.quora.com/My-5-year-old-daughter-is-interested-in-becoming-Empress-of-the-Universe-as-a-career-path-What-programming-languages-technologies-should-I-teach-her-to-aid-her-galaxy-domination-goals |
| 23:32 | amalloy | jeez that's a stupidly long url |
| 23:33 | goodieboy | wow that is long but thanks! i go back to the sicp ebook all the time, just trying to grasp as much as possible. awesome stuff. |
| 23:36 | goodieboy | ha ha, the last comment is the best |
| 23:56 | rimmjob_ | is there a list of differences between clojure and emacs lisp ? |
| 23:56 | lucca | indirectly |
| 23:56 | amalloy | differences (1) they are very different |
| 23:56 | amalloy | (2) see 1? |
| 23:57 | lucca | http://clojure.org/lisps might help |
| 23:57 | lucca | depending on how well you know elisp |
| 23:57 | rimmjob_ | thankee |
| 23:58 | amalloy | lucca: someone should fix "All (global) Vars can be dynamically rebound without interfering with lexical local bindings. No special declarations are necessary to distinguish between dynamic and lexical bindings. Since Clojure is a Lisp-1, (global) functions can be dynamically rebound." |
| 23:58 | hiredman | the docs are from the last release (1.2.x) |
| 23:59 | amalloy | or...maybe not? it reads like they're saying you can rebind things without special declarations, but when i look closer i can't see it actually saying that |