#clojure log - Feb 25 2011

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:44 Sgeo: @(macroexpand '(comment Lah de dah))

0:44 &(macroexpand '(comment Lah de dah))

0:44 sexpbot: ⟹ nil

0:47 Null-A: Gen-class isn't working for me https://gist.github.com/843408

0:47 When I execute the let statement, i get class not found.

0:48 * Sgeo tries IDEA

0:57 Sgeo: It simply won't run :(

0:59 Here we go

2:08 no_mind: using compojure, I want to defien a route which has an optional param. How do I this ?

2:42 Derander: no_mind: my routing api knowledge is low because it's late right now, but I would define the route twice once w/ param, once w/o

3:16 bartj: If I reference a string as:

3:16 blah/x

3:16 I am not able to dynamically construct it:

3:17 ie. given "blah" and "x" are strings

3:17 Derander: no_mind: oh, I was also thinking rails instead of compojure. whoooooooooooooooooops

3:27 TobiasRaeder: morning

3:28 bartj: anyone ?

3:34 Chousuke: bartj: I don't understand your question

3:34 bartj: do you mean creating a symbol like blah/x? Just (symbol "blah" "x")

3:35 bartj: yes and evaluate it

3:35 Chousuke: sounds suspicious

3:36 you can evaluate things with eval, of course, but make sure it's what you really need to do.

3:36 most clojure code will never need to use eval directly.

3:37 and if user input is involved, it becomes somewhat of a security issue.

3:37 mroh: hey

3:41 Adamant: Chousuke: not somewhat, it does. one of the classic security issues for the Lisps and derived languages with an eval function

3:50 bartj: Chousuke, when I do a : (eval (symbol "blah" "x"))

3:50 I get a: No namespace blah

3:50 but, things work just fine when I do a: blah/x

3:51 Chousuke: huh

3:53 so what is it that you're trying to do anyway?

3:54 It's hard to tell what's broken when there's no real code to look at

3:54 and I'm interested in what you are trying to accomplish by using eval anyway.

4:01 bartj: sorry for the delay

4:01 let me explain

4:02 I dynamically want to pick up strings from a files

4:02 let us call them A and B

4:02 these files have the same variables defined: x

4:03 no, I would like to pick up B/x if B is the file I would like to get it from

4:03 *now

4:04 so, what I do is:

4:04 (:require [path.A :as A] [path.B :as B])

4:05 and (eval (symbol "B" "x"))

4:09 fliebel: morning

4:12 raek: bartj: I don't know if this approach is the best way to do it (what you presented is a solution, but we still don't know the underlying problem you are trying to solve), but I don't see where the error is: http://pastebin.com/DH1P5Bfb

4:14 if you are making your own file format, it's probably safer to make a function that interprets it rather than converting it to clojure code and evaling it.

4:15 (interpret-in-context {:x "hello"} (slurp "filename.txt")), rather than (eval (slurp "filename.txt"))

4:34 fliebel: Does anyone here have experience with protobuf?

4:38 I was thinking it could be used to parse binary files, but it seems to generate and parse a fixed type of file?

4:41 bartj: raek, sorry, I was away for lunch

4:41 strangely, it does work from the REPL

6:13 * lypanov is debating moving from .nl to .de in the coming few years and wonders if there are any clojurians here in .de that (possibly) work in it professionally

6:15 hoeck: lypanov: why? are you afraid of the climate change and a flooded country?

6:15 lypanov: hoeck: various reasons - no startup culture, annoying health care (bad personal experiences)

6:16 as for climate change... no response.

6:16 :)

6:16 hoeck: just joking :P

6:16 lypanov: phew :P

6:17 dutch people sometimes even have that view... kinda scares me. probably the safest (from water level issues) country on the planet other than maybe tibet.

6:17 america / india / etc, now they are fucked ;) they hire dutch people...

6:18 hoeck: lypanov: where do you live currently, and what do you expect from moving to germany?

6:20 lypanov: hoeck: the hague. previously amsterdam. as i said - start up culture, actual programmers in large companies. etc.

6:21 ogrim: Does anyone know how I may store '(101010 001100) as integers instead of (101010 576) as it evaluates to?

6:21 babilen: lypanov: and where do you plan to move? (just curious)

6:21 lypanov: probably berlin

6:21 hoeck: personally, I was astonished that there are even some "startups" in the city I'm living in (dresden), thought at first that such things only exist in the big urban areas

6:21 lypanov: maybe frankfurt

6:22 tomoj: ,010

6:22 clojurebot: 8

6:22 babilen: lypanov: don't move to frankfurt. berlin is a good choice, but you might want to look around. hamburg is nice as well. anyway, one goes where the job is :)

6:22 hoeck: lypanov: if I would have to move, I'd either move to Hamborg or Berlin

6:23 there are even some companies there listing clojure on their job ads :)

6:24 ejackson: ogrim: (Integer/parseInt "10101" 2) if they are strings initially

6:25 ogrim: tomoj: I see that converts 001100 to 576, but I just want to store 001100 in a list. ejackson: they should be integers initially. I do (def init-pop '(001100)) and want it to stay 001100

6:26 The only workaround I found was parsing it with java calls, but that seemed uncessesarily complex

6:27 Chousuke: ogrim: there's no way to do that.

6:27 ejackson: the convention is that if it starts with 0 its octal

6:27 Chousuke: since 001100 *is* 576

6:27 ejackson: you could make it a list of integers, or a bit array i guess

6:27 clgv: ogrim: you understand that integers are always stored as binary? just the repl prints them as decimals bei default? ;)

6:28 Chousuke: (dunno if it actually is, just going by what you said :P)

6:28 the point being, numbers are numbers, no matter which base they're in.

6:28 clgv: Chousuke: lol it isnt. 001100 = 12 ;)

6:28 Chousuke: clgv: that's what I thought. :P

6:29 hm

6:29 ogrim: oh ok. I'll see what I'll figure out then. I'm pretty new to Clojure as I come straight from Java and CLisp

6:29 ejackson: octal

6:29 Chousuke: I guess 001100 gets parsed as octal

6:29 yeah

6:29 clgv: ah leading zero, ok ;)

6:29 Chousuke: what was the binary syntac?

6:30 syntax

6:30 ogrim: thanks for the help everyone :)

6:30 clgv: ogrim: in java it's the same ;)

6:32 ejackson: Chousuke: I cant find one !

6:37 Chousuke: ,2r1010

6:37 clojurebot: 10

6:37 Chousuke: that works at least

6:37 but there was another one too

6:38 ejackson: nice

6:38 Chousuke: ,0b1010

6:38 clojurebot: Invalid number: 0b1010

6:38 Chousuke: hm

6:38 clgv: ,1010d

6:38 clojurebot: Invalid number: 1010d

6:38 Chousuke: ,b1010

6:38 clojurebot: java.lang.Exception: Unable to resolve symbol: b1010 in this context

6:39 Chousuke: gah, oh well

6:40 I should know, I've written a clojure reader before ;/

6:41 clgv: chousuke: http://faustus.webatu.com/clj-quick-ref.html seems there isnt

7:03 tscheibl: hi there

7:04 (if a a b) ... is there a function which does the same without the redundant 'a' ?

7:04 ejackson: or

7:05 tscheibl: ahhhh

7:05 Dranik: hi all!

7:05 tscheibl: ,(let [a 42 b 43] (or a b)

7:05 clojurebot: EOF while reading

7:05 tscheibl: ,(let [a 42 b 43] (or a b) )

7:06 clojurebot: 42

7:06 Dranik: again, what's the difference between #^ and ^ except that #^ is old?

7:06 tscheibl: ,(let [a nil b 43] (or a b) )

7:06 clojurebot: 43

7:06 tscheibl: I'm such a noob :(

7:07 ejackson: we're all noobs.

7:07 if we're not, we're working below potential.

7:10 tscheibl: for the last 5 days I manage to reduce the lines of code of my project for about 75% while retaining all the functionality

7:10 ejackson: that is the joy of clojure :)

7:10 wel... one of them.

7:10 tscheibl: I mean I mange to reduce it to 75% EVERY day

7:11 clgv: tscheibl: calling it a success depends on whether it's still readable and easily understandable ;)

7:11 ejackson: it also has lots or lurvely, curvely parentheses. That cuonts for something

7:11 tscheibl: I just ask 1 question at irc every where the answer enlightens me so much to make this possible

7:12 clgv: it gets more readable every day, indeed

7:12 clgv: ok thats good then ;)

7:13 tscheibl: and the indentation depth also has been reduced by at least 50% since the start

7:13 luv that language and the really helpful irc community

7:14 raek: Dranik: in 1.1, #^ was used for attaching metadata to source code and ^foo was sugar for (meta foo). since 1.2, ^ is for attaching metadata to source code and #^ should be unused (but behaves as 1.2's ^ for backward compability, I think)

7:15 Dranik: raek, so the main conclusion: just use ^ and forger about #^ completely, yep?

7:15 *forget

7:15 raek: unless you have to deal with 1.1 code, yes

7:15 Dranik: ok, thanks

7:15 tscheibl: (forget "#^")

7:16 ;)

7:16 clgv: I noticed that sometimes ^:keyword doesnt work and causes a compiler error in a defn or defn-

7:17 raek: I think that shortcut (^:foo instead of ^{:foo true}) was added in 1.3

7:17 clgv: but I couldnt tell the difference between the few calls where it didnt and the plenty ones where it did

7:17 raek: clgv: was this within the same clojure version?

7:17 clgv: raek: it was all in clojure 1.2

7:19 raek: hrm. I think I got something wrong. ^:foo does compile in 1.2 for me, but it becomes ^{:tag :foo}

7:19 ...just like typehints behave

7:21 * raek realizes that this is unknown territory for him and stands back

7:21 clgv: ah ok. didnt realize that.

7:21 I tried it with ^:static

7:22 though I am still curious what ^{:static true} does

7:22 raek: it is/was a 1.3 feature

7:23 I don't know if :dynamic has replaced it

7:23 clgv: http://clj-me.cgrand.net/2010/06/10/primitive-types-support-for-fns-coming-to-a-clojure-branch-near-you/

7:24 clgv: raek: oh thanks. reads to be enlightened ;)

7:26 raek: I think the idea is that if a function is static, then every call to it will be hard coded to that version of the function (so if you redefine the function, you have to reevaluate all the dependent defns too)

7:26 this allows for better performance and primitive support, or something like that

7:27 clgv: sounds reasonable

7:27 wow. my program is twice as fast on my home computer compared to the one at university :D

7:27 I like the core-i7 cpus ;)

7:29 raek: clgv: I would also check out the new :dynamic thing. It is a more recent approach that might solve the same problem as :static.

7:29 clgv: the other one is a core2 for comparison

7:30 raek: I didn't necessarily need :static but found it when trying to optimize the runtime of the arithmetic part of my program

7:34 raek: the static thing has structural similarities with the :inline one

7:37 tscheibl: hah.. reduced by 5%, again

7:39 my boss will ask me what I did all the time when he counts the lines of code... maybe I should switch back to C++ again :D

7:40 clgv: what is the most efficient way to calculate all partial sums of a sequence of doubles?

7:40 I'd guess: loop-recur

7:40 ejackson: reductions ?

7:41 ,(reductions + 0 [1 2 3 4 5 6])

7:41 clojurebot: (0 1 3 6 10 15 21)

7:42 ejackson: ,(reductions + [1 2 3 4 5 6])

7:42 clojurebot: (1 3 6 10 15 21)

7:42 ejackson: is better, if I understand what you mean by 'partial sums'

7:42 clgv: oh interesting. I didnt know that one

7:42 ejackson: its a cutey

7:42 clgv: &(doc reductions)

7:42 sexpbot: ⟹ "([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init."

7:43 clgv: $source reductions

7:43 sexpbot: reductions is http://is.gd/cZqevO

7:45 clgv: thx :)

8:05 Bleadof: Should (identical? "foo" "foo") be false?

8:06 I was just looking at Clojure data structures video where it returned false for that, but I tested and it returns true... It was a bit spooky.

8:33 jcromartie: Bleadof: I think it's reasonable for two string literals to be the same object.

8:33 strings, keywords, numbers

8:34 empty lists

8:34 empty vectors

8:34 heh

8:34 interesting

8:34 NOT symbols though

8:34 every symbol parsed is a new object?

8:36 Dranik: is clojure 1.2 available for .NET ?

8:48 tscheibl: Dranik: https://github.com/richhickey/clojure-clr

8:48 Dranik: tscheibl, the question is whether it is stable or not?

8:49 tscheibl: https://github.com/richhickey/clojure-clr/zipball/1.2.0

8:49 Dranik: thanks!

8:49 tscheibl: dunno... there is a zipball at least

8:50 u can also find a 1.3.0 alpha there

8:50 Dranik: hmmm... intriguing...

9:00 phenom_: anyone tried out 1.3.0 with the developer jdk7 release ?

9:06 Dranik: phenom_, really interesting...

9:07 phenom_: Dranik: did you see any improvements outside primitive math?

9:07 Dranik: in java7?

9:09 well, for me java7 contains just some enhancements of the existing functional

9:09 NIO.2, new file system api and so on -- nothing special

9:09 the only interesting thing there is InvokeDynamic

9:10 but who knows how much time will pass before every java scripting language will use it

9:14 phenom_: and the invoke dynamic is there to support tco ?

9:16 Dranik: whats tco?

9:17 stuartsierra: invokedynamic is basically an easier way to do what Clojure already does –– dynamic method calls without reflection

9:29 Bleadof: jcromartie, I think that's because symbol is always itself so they must not be identical. :)

9:41 ejackson: If I have a namespace hierarchy like: ns1 :uses ns2 :uses ns3. What do I do in ns2 to make vars from ns3 visible in ns1 ?

9:42 stuartsierra: ejackson: you can't

9:42 ejackson: that's a bummer.

9:42 thanks.

9:43 stuartsierra: It's a feature: each namespace declaration shows exactly where every symbol in that namespace comes from.

9:43 ejackson: that makes sense.

9:44 stuartsierra: It's a huge help for debugging and refactoring.

9:44 ejackson: i'll :require ns3 in ns2, and make defs.

9:44 stuartsierra: Or just ;use ns3 in ns1.

9:44 ejackson: i have a sprawling namespace (accounting.*) and want an interface nampsace acconting. cose.

9:44 s/acconting. cose/accounting.core

9:44 sexpbot: <ejackson> i have a sprawling namespace (accounting.*) and want an interface nampsace accounting.core.

9:45 ejackson: but I'll refactor to clean up. Thanks stuartsierra.

9:45 stuartsierra: 'welcome

9:47 raek: jcromartie: symbols with the same names are the same instances

9:48 ,(identical? 'foo 'foo)

9:48 clojurebot: false

9:48 raek: hm?

9:48 stuartsierra: raek: Clojure symbols are not interned like in Common lisp.

9:48 Keywords are.

9:48 ejackson: ,(identical :foo :foo)

9:48 clojurebot: java.lang.Exception: Unable to resolve symbol: identical in this context

9:48 stuartsierra: ,(identical? :foo :foo)

9:48 clojurebot: true

9:48 ejackson: ha

9:48 raek: hrm. I assumed they were...

9:49 I imagined symbols and keywords to work exactly the same way, modulo eval semantics

9:50 stuartsierra: Nope, symbols are just labels, almost like Strings.

9:50 raek: whose literals are interned..?

9:50 ,(identical? "foo" "foo")

9:50 clojurebot: true

9:51 raek: I recall that changed at some point

9:51 stuartsierra: Yeah, that's a little odd. Symbols probably could be interned, ...

9:51 Yes, very early on, as a perf optimization.

9:51 But since you rarely do equality tests on symbols, there's less benefit.

9:51 _fogus: stuartsierra: How would metadata on interned symbols work?

9:51 dnolen: fliebel: exist has an implicit all. exist is like let. all is like do.

9:51 stuartsierra: _fogus: An excellent point!

9:52 That's probably why.

9:52 raek: ah!

9:52 then it makes much more sense

9:53 _fogus: *bows*

9:56 dnolen: fliebel: (a c b d) is a possible odering, but it's important to make no assumptions about ordering. No assumptions also means that the notion of concurrency is sort of baked in.

9:56 _fogus: staurtsierra: BTW, you can do some nasty side-effecty stuff using create-ns and intern

9:57 ogrim: /quiy

9:57

9:57 stuartsierra: _fogus: Oh yes, I've had evil fun with that.

9:57 _fogus: Yeah really (eville == fun)

10:01 fliebel: dnolen: Ah, thanks for explaining that.

10:01 _fogus: I once had an idea for a namespace library with a thin prototypal skin over it. But I'm fairly sure that would get my Clojure card revoked.

10:02 fliebel: Is Logos concurrent/parallel?

10:02 dnolen: fliebel: no yet, but that's a goal, and it's built on a good conceptual foundation to allow it.

10:03 _fogus: dnolen: Do you mind elaborating? What foundation do you mean?

10:05 dnolen: _fogus: no assumptions about the ordering of results from disjunction.

10:07 _fogus: Is that a property of kanren or your impl?

10:07 dnolen: _fogus: property of kanren, and miniKanren.

10:08 _fogus: Are there interesting variants of parallel-kanren?

10:08 (I'm using "kanren" to stand in for both mini- and not)

10:10 dnolen: _fogus: miniKanren researchers did a parallel version, but just forking processes on every disjunction is of course not going to work.

10:10 Ciao-Prolog does task granularity analysis. So perhaps that's a direction of investigation for miniKanreners

10:12 http://clip.dia.fi.upm.es/papers/granularity.pdf

10:15 pjstadig: _fogus: you have a clojure card?!

10:15 * pjstadig feels left out

10:16 _fogus: pjstadig: Yeah, my kid colored one for me.

10:16 pjstadig: nice

10:21 _fogus: "just be- cause something can be done in parallel does not nec- essarily mean, in practice, that it should be done in parallel."

10:21 What!?! But I just got done seding all of my maps to pmap!

10:21 jcromartie: :P

10:21 pmap

10:21 * _fogus UNDO UNDO

10:22 jcromartie: I was having some fun with that yesterday... http://imgur.com/HUXsI

10:22 &(dorun (pmap #(dorun (pmap println %)) '((I put a thread in your thread) (so you can compute while you compute))))

10:22 sexpbot: ⟹ nil

10:22 jcromartie: oh wait

10:22 ,(dorun (pmap #(dorun (pmap println %)) '((I put a thread in your thread) (so you can compute while you compute))))

10:22 clojurebot: nil

10:23 jcromartie: printing from other threads doesn't work in these bots eg?

10:23 eh?

10:24 pjstadig: haha it took me a second to get that one

10:24 i was like, "this doesn't make any sense its all mixed togeth--oooooohhh"

10:25 * _fogus wasting time with http://wonder-tonic.com/zombie/

10:26 ejackson: _fogus: thank god I'm use Firefox and it doesn't load.... lucky break.

10:29 rsenior: it's not clear to me how to do an internal forward using compojure, i.e. a form was submitted, I take some action and want another page to render the results, am I missing something?

10:30 jcromartie: rsenior: you would just pass the request off to the appropriate handler no?

10:31 ejackson: yes, I imagine there is only one function on the compojure end the accepts the POST, processes and renders the results ?

10:34 rsenior: jcromartie: do you mean call the name I bind the defoutes to? I'm using defroutes, not the handlers directly

10:34 ejackson: I have one now, but can break it up

10:34 jcromartie: I have to admit I'm a bit confused by some changes to compojure lately, myself.

10:35 Can you paste your routes code?

10:37 Dranik: !seen rhicker

10:37 !seen rhickey

10:38 rsenior: not much to see, but it's here https://gist.github.com/843940

10:39 the template stuff is enlive

10:39 jcromartie: three cheers for protocols, BTW... check out https://github.com/weavejester/compojure/blob/master/src/compojure/response.clj

10:39 rsenior: jcromartie: just saw that not long ago, I had always been using maps

10:41 Raynes: $seen rhickey

10:41 sexpbot: rhickey was last seen quitting 6 days and 16 hours ago.

10:41 jcromartie: rsenior: you could redirect by passing a new request to admin-app from within a handler

10:41 tscheibl: can I somehow get a reference to the currently executing function object? .. I'm not sure that I used the correct terminology here but I don't know better...

10:41 Raynes: Draggor: ^

10:41 jcromartie: just make sure it's not a loop

10:41 Raynes: Dranik, even.

10:41 Dranik: Raynes, thanks

10:42 tscheibl: I mean from within that function?

10:42 Dranik: $where_is rhickey

10:42 doesn't work any more :-(

10:42 tscheibl: Dranik: I hope busy finishing 1.3 :)

10:42 Dranik: :-)

10:42 mduerksen: Dranik: he does work, and that's why he isn't on chatrooms all the time ;)

10:43 Dranik: that's good! I can't wait for 1.3!

10:43 :-)

10:44 rsenior: jcromartie: so that admin app accepts a uri snippet and params?

10:44 jcromartie: rsenior: check out https://gist.github.com/843950

10:44 anybody else, please comment

10:44 tscheibl: ,(let [f (println f)] ())

10:44 clojurebot: java.lang.Exception: Unable to resolve symbol: f in this context

10:45 tscheibl: exctly

10:45 exactly

10:45 but I'd need a reference to this function

10:45 inside it

10:46 rsenior: jcromartie: ahh, takes a map that has the url

10:46 raek: tscheibl: an anonymous function? you can have a "named anonymous" function: (fn f [] (... f ...))

10:46 tscheibl: ahh

10:46 raek: this is also done if you use letfn

10:46 ,(letfn [(f [] (str f))] (f))

10:46 clojurebot: "sandbox$eval2185$f__2186@359a33"

10:47 jcromartie: rsenior: what do you mean

10:47 it just takes the original request, a new uri, and the handler to apply

10:47 but it's not complete

10:47 it's not really a redirect

10:48 you should be doing a HTTP redirect

10:48 what I wrote is really a handler transfer

10:48 although actually, I'm not sure what you want... but if you're trying to implement the POST/redirect/GET pattern

10:48 rsenior: I mean this part of your code (handler (assoc req :uri uri :redirected-to uri))

10:49 jcromartie: well handlers (and routes, which are handlers) only ever take a request map

10:49 http://en.wikipedia.org/wiki/Post/Redirect/Get

10:49 rsenior: right

10:49 jcromartie: so you want a HTTP 303

10:50 if that's what you're trying to do

10:50 tscheibl: raek: thx for the enlightenment :) but I checked back and saw that is was a proxy (let [timer-task (proxy [TimerTask] []... so I could use 'this' within the implemented members

10:50 raek: rsenior: you don't need to (apply str ...) the output from enlive. ring adapters accept seqs-of-strings

10:53 rsenior: jcromartie: I think that is what I'm trying to do, it's been a while since I've done web development at that low of a level

10:53 jcromartie: yeah welcome to the trenches :P

10:53 rsenior: raek: good idea, I'll switch it

12:00 TimMc: jcromartie: There's a *name* for that?

12:15 DespiteItAll: Hmm, the clojure.xml api page is missing the emit function. Now I'm wondering what else isn't on the api pages

12:22 cinch: raek: regarding "ring adapters accept seqs-of-strings", wrap-lint throws an exception if you feed it a seq of strings, but i think it's a bug in wrap-lint because the ring spec says seqs are allowed but wrap-lint doesn't check for seqs. i should submit a bug report

12:34 * devn tips his hat

12:34 sritchie_: hey all -- I'm having trouble figuring out how to use clojure.contrib.probabilities.random-numbers/rand-stream

12:34 I see it's using defstream,

12:35 and I want to be able to take values off of it -- I'm just not sure how to bind a new stream to anything

12:36 (for now, I'm using (defn rands [x] (take x (repeatedly rand)))

12:36 )

12:47 kencausey: sritchie_: https://github.com/clojure/clojure-contrib/blob/master/modules/stream-utils/src/main/clojure/clojure/contrib/stream_utils.clj (includes doc at top)

12:50 sritchie_: kencausey: great, thanks for that, time to do some reading

14:57 Max-69: ciao

15:03 Sgeo: Hmm

15:03 Is it my imagination, or is it too easy to do concurrency wrongly, even with Clojure's primitives, thanks to ability to read without being in a transaction?

15:03 I should write an example

15:04 pdk: you don't need to worry about catching only half an update

15:05 Sgeo: But I do have to worry about making decisions in the wrong place

15:24 Can I make ending parentheses not automatically be placed in La Clojure?

15:27 http://ideone.com/NpTeh

15:29 TimMc: Sgeo: You don't want Paredit mode?

15:30 Sgeo: TimMc, if that's the name for it, how do I disable it?

15:31 TimMc: Dunno. I haven't used La Clojure, but it sounds like Paredit mode. (Paredit is an Emacs minor mode that has analogs in many s-expression editing programs.)

15:31 You probably want it, even if you don't know it yet. :-P

15:32 (That said, La Clojure might do it poorly, for all I know.)

15:32 Sgeo: I want to know why Clojure doesn't provide security against what I posted >.>

15:33 TimMc: Are you proposing a language that only allows reading inside transactions? Because that could still be misused very easily.

15:33 I don't think there's a way to protect against that.

15:34 Sgeo: Just curious, how could it be misused?

15:34 TimMc: Simple, by wrapping each read in a separate transaction. :-P

15:35 hiredman: if you do that you are using agents incorrectly

15:35 TimMc: Anyway, I think your example is flawed. Aren't agents supposed to be updated with functions that run entirely inside the agent's update transaction?

15:35 hiredman: if you need coordination and the stm you want refs

15:36 clojure provides a number of different concurrency primitives with different options for you to choose from

15:37 Sgeo: I think it may be too easy for people to choose the wrong concurrency primitives

15:37 TimMc: Don't worry about other people.

15:39 hiredman: Sgeo: and?

15:39 TimMc: There will always be a large supply of programmers who will mess up concurrency no matter how easy it is in some language. YOu have to let that go.

15:40 Null-A: I'm trying to use gen-class with slime, I C-c k the filed, but I still can't import or reference it

15:40 the file*

15:47 DespiteItAll: Seeing all the cool stuff in IDE's makes me wish I'd never gotten attached to vim

15:48 TimMc: DespiteItAll: Like what?

15:49 DespiteItAll: somebody mentioned la clojure earlier, so i googled it and came up with this http://plugins.intellij.net/preview/popup/?sid=2625&pid=4050 I don't know what's going on there but it looks cool.

15:49 TimMc: Autocompletion and javadocs are the only thing I really use in Eclipse, for instance.

15:50 raek: Null-A: gen-class requires compilation. http://clojure.org/compilation

15:50 Null-A: raek: So how do I use it with slime?

15:50 raek: Null-A: you usually use some thing like "lein/cake compile" to start the compilation

15:50 Null-A: raek: run lein compile, add aot to project.clj

15:51 TimMc: I assume Emacs can do autocomplete, etc., but I don't know how to do it yet. :-P

15:51 Null-A: raek: restart swank server?

15:51 raek: Null-A: yes, you have to restart the clojure instance if you need to update a class that you have already loaded

15:51 Null-A: k

15:52 raek: the first time, you should be able to compile the namespace with the 'compile' clojure function and then just use the class

15:52 Null-A: cool, thanks raek

15:53 DespiteItAll: yeah, emacs has a bunch of cool features that I wish I had in vim.

15:53 jcromartie: TimMc: M-/ for a simple text lookup and M-Tab for the Swank autocomplete

15:53 DespiteItAll: I could probably duplicate them, but the effort is always too much

15:53 jcromartie: M-Tab does autocomplete on things like Java packages and Clojure namespaces such

15:54 amalloy: jcromartie: i can't give up M-Tab as my window-manager window-switching key :P

15:54 jcromartie: hm

15:54 well on Mac I use the Mac option key as Emacs meta

15:55 but on Windows yeah that's tricky

15:55 or Linux

15:55 I think just plain Tab works in the repl though

15:55 amalloy: jcromartie: i could use the windows key as Super (which i do), but i don't want to rebind everything to S-Tab

15:56 and the autocomplete plugin does a pretty good job for me without having to manually activate it

15:56 so i'm not inclined to add a binding

15:56 jcromartie: What plugin?

15:56 amalloy: jcromartie: http://www.emacswiki.org/emacs/AutoComplete

15:56 jcromartie: oh my

15:56 amalloy: also Sgeo your example is wrong in more ways than you intended :P

15:58 (send agent #(%2) {:balance result}) is not the same as (send agent (constantly {:balance result}))

15:59 &(let [a (agent {:balance 1000})] (send a #(%2) {:balance 500}) (Thread/sleep 1000) @a)

15:59 sexpbot: ⟹ {:balance 1000}

16:00 amalloy: &(let [a (agent {:balance 1000})] (send a (constantly {:balance 500})) (Thread/sleep 1000) @a)

16:00 sexpbot: ⟹ {:balance 500}

16:03 jcromartie: that's the wrong way to model an account anyway

16:03 how about a better example?

16:05 Sgeo: amalloy_, ok.. why?

16:06 jcromartie: amalloy_: THANK YOU <3 for auto-complete-mode

16:06 awesome

16:07 Sgeo: Why does it work like that?

16:07 jcromartie: #(%2) is a function that calls its second argument

16:08 &(#(%2) nil {:foo :bar})

16:08 sexpbot: java.lang.IllegalArgumentException: Wrong number of args (0) passed to: PersistentArrayMap

16:08 Sgeo: How would I make it just return the second argument?

16:08 jcromartie: &((constantly {:foo :bar}))

16:08 sexpbot: ⟹ {:foo :bar}

16:08 jcromartie: &(#(identity %2) nil :foo)

16:08 sexpbot: ⟹ :foo

16:09 jcromartie: but if you already have what you want, you don't need to muck with args... just use constantly

16:09 Sgeo: Maybe I should stick with fn?

16:09 jcromartie: !doc constantly

16:09 is that how you do it?

16:09 Sgeo: &((fn [a b] b) 5)

16:09 sexpbot: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: sandbox6385$eval9330$fn

16:09 Sgeo: &(fn [a b] b) 5

16:09 sexpbot: ⟹ #<sandbox6385$eval9339$fn__9340 sandbox6385$eval9339$fn__9340@19b38d7>

16:10 jcromartie: Sgeo: we're trying to solve the wrong problem here

16:10 Sgeo: &((fn [a b] b) 0 5)

16:10 sexpbot: ⟹ 5

16:10 jcromartie: &(#(do %2) :foo :bar)

16:10 sexpbot: ⟹ :bar

16:10 jcromartie: but anyway

16:11 Sgeo: That's... unintuitive to me

16:11 Hm wait

16:11 I think I get it

16:11 jcromartie: it's exactly the same as (fn [_ b] b)

16:11 Sgeo: #(stuff) seems to be (fn [] (stuff))

16:11 jcromartie: yes

16:12 Sgeo: Ok

16:12 jcromartie: but you never do #(stuff) because you could just use stuff

16:12 &(map inc [1 2 3])

16:12 sexpbot: ⟹ (2 3 4)

16:13 jcromartie: well, that's a bad example

16:13 #(stuff) is pretty useless

16:13 unless it's purely for side-effects

16:14 &(let [counter (atom 0) count #(send counter inc)] (map #(count) [1 2 3]) @counter)

16:14 sexpbot: ⟹ 0

16:14 jcromartie: &(let [counter (atom 0) count #(send counter inc)] (doall (map #(count) [1 2 3])) @counter)

16:14 sexpbot: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: sandbox6385$eval9386$fn

16:14 jcromartie: heh

16:14 anyway

16:14 Sgeo: jcromartie, I didn't mean literally stuff

16:14 jcromartie: I know

16:14 but #(foo)

16:16 but anyway, don't store an account balance :)

16:27 Sgeo: Are refs readable outside of transactions?

16:27 stuartsierra: yes

16:28 Sgeo: :/

16:28 danbell: is there a core way to map a set of arguments across a sequence of functions?

16:28 stuartsierra: Sgeo: deref on a Ref will always return the most-recently-committed value, never the value inside a transaction.

16:29 hiredman: ,((apply juxt [inc dec]) 1)

16:29 clojurebot: [2 0]

16:29 danbell: ,(doc juxt)

16:29 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, a...

16:29 danbell: cool, thanks

16:30 DespiteItAll: why would you not store an account balance?

16:32 Sgeo: There is something about Clojure that .. hmm

16:36 amalloy: jcromartie: ouch, you think thunks (that is, no-arg functions) aren't useful?

16:37 jcromartie: amalloy: they can be useful but it's almost always for side-effects and it's hard to think of an example off the top of my head

16:37 Sgeo: I was recently fascinated by Slate. They have something called Prototypes with Multiple Dispatch. They talk about methods being defined in terms of all their objects. I know Clojure uses immutable stuff, so it's not exactly the same, but I think multimethods serve a similar purpose.

16:37 And may be more flexible

16:37 amalloy: jcromartie: try implementing lazy-seqs without thunks

16:37 Sgeo: I should translate their example to Clojure

16:38 amalloy: eg, (range 10) is a pair of (data, thunk-for-next-data) elements

16:38 stuartsierra: Sgeo: Clojure doesn't implement Prototype inheritance directly, but it's easy to implement yourself.

16:40 Sgeo: The PMD paper on Multiple Dispatch alone: "

16:40 However, there remain problems with the example, as expressed. It is still

16:40 awkward to express stateful behavior; this is still represented by the control

16:40 flow branches inside encounter methods. Furthermore, the code describing that

16:40 unhealthy sharks swim away from all other animals is duplicated in two different

16:40 encounter method"

16:40 Sorry

16:40 The first criticism does not apply to Clojure's multimethods, I think

16:40 As it's not strictly "class" based

16:41 dnolen: stuartsierra: prototypal inheritance is simple via ad-hoc hierarchies. rhickey based his work on the Self paper if I recall correctly.

16:41 amalloy: jcromartie: that is, they're useful not just for side effects, but for delaying/modifying computation/evaluation. eg in sexpbot, most user code is wrapped up in a thunk to be computed on another thread while the core engine goes back to listening for requests

16:41 stuartsierra: dnolen: cool, I'll have to look that up.

16:42 dnolen: http://dosync.posterous.com/beyond-javascript-prototype-chains

16:42 I compared JS prototypal inheritance to Clojure's more general facilities a while back ^

16:42 jcromartie: amalloy: true, I guess I was just scratching the surface

16:42 stuartsierra: dnolen: thanks, I'll take a look

16:43 jcromartie: hooray for thunks!

16:43 :)

16:43 amalloy: lol

16:43 there we go, that's the kinda of enthusiasm i like to see!

16:44 Sgeo: type?

16:44 clojurebot: http://www.assembla.com/wiki/show/clojure/Datatypes

16:45 Sgeo: Oh, I was skipping ahead?

16:45 Bad bot

16:45 And that wasn't a question. I was skipping ahead

16:46 Oh, wait

16:46 ,(doc type)

16:46 clojurebot: "([x]); Returns the :type metadata of x, or its Class if none"

16:48 Null-A: raek: So each NS `foo` as a foo_init.class generated for it. Will this coperate with java namespaces of the same name?

16:49 cooperate*

16:49 I think normally in java you can't have a package 'foo' and a class 'foo', name conflict

16:52 hmh, maybe you can after all

16:52 with the jvm

17:09 amalloy: jcromartie: oh, and you're welcome re autocomplete

17:12 Sgeo: How difficult could it be to make a very very basic DrClojure?

17:12 * Sgeo wonders if he should try it

17:13 amalloy: it took me a while to realize, but M-n and M-p are the intended way to move through the suggested completions

17:14 Sgeo: Maybe I should try emacs

17:14 I certainly like emacs on the command-line

17:14 But in Windows, as a Windows program?

17:14 lucian: Sgeo: it's fine, if you like emacs, use it everywhere

17:15 Sgeo: I like it just fine when my choices are pretty much emacs, vim, nano, is what I meant

17:16 lucian: ah, so you don't actually like emacs all that much

17:17 me, i like vim everywhere (in particular it's input scheme)

17:18 s/it's/its/

17:18 sexpbot: <lucian> me, i like vim everywhere (in particular its input scheme)

17:18 lucian: sexpbot: you're not being very useful with that

17:21 jcromartie: Sgeo: Emacs for Windows is pretty solid.

17:23 lucian: jcromartie: except he doesn't actually like emacs

17:28 amalloy: lucian: i can make him stop sedding your messages if you want

17:29 people seem to have a love/hate relationship with the feature so it's not gonna go away, but if it bugs you...

17:29 stuartsierra: w00t! No red dots on http://build.clojure.org for the first time!

17:29 lucian: amalloy: meh

17:30 amalloy: it's not really that annoying, but it doesn't seem very useful either

17:35 hugod_: just ran into http://dev.clojure.org/jira/browse/CLJ-444 in clojure 1.2 - if I read file:///Users/duncan/lisp/docs/java/docs/api/java/lang/ref/ReferenceQueue.html#poll%28%29 correcty though there is still an issue with enqueued references being dropped by the call to rq.poll and not being cleared from the table

17:36 amalloy: hugod_: puzzlingly enough that file: link is no good for the rest of us :P

17:36 hugod_: oops

17:38 this one works a little better http://download.oracle.com/javase/1.4.2/docs/api/java/lang/ref/ReferenceQueue.html#poll()

17:38 raek: Null-A: when AOT compiling the namespace foo.bar.baz, the class foo.bar.baz_init will be generated (baz_init class in foo.bar package). you would get a conflict if you have "package foo.bar; public class baz_init { ... }" in any java sources...

17:41 there shouldn't be any problem with calling the class the same as the last component of the package

17:50 Null-A: raek: k, when you use :gen-class on ns, interestingly it creates directory baz, and class file baz.class as siblings in the directory

17:51 (direcotry foo/bar/)

18:48 raek: Null-A: the baz_init class has a static initializer that will evaluate the code of the namespace, and the baz class is the one that will have the methods declared in :gen-class. you can set that name to something else by adding the option :name OtherName to the :gen-class part

18:50 Null-A: awesome thanks

18:51 raek: (methods of generated classes will always have an implementation that calls a clojure fn in a ns)

18:51 Null-A: yah that's really convinient

18:52 convenient*

18:53 raek: so by reevaluating the corresponding defn form, you update the behaviour of all existing instances of the generated class

18:53 Null-A: exactly :)

19:01 ossareh: hola

19:09 TimMc: Sgeo: I think most Emacs users on GNU/Linux systems use the graphical version anyway.

19:12 sritchie_: hey all -- one quick question on storing records of data

19:12 I want to encode some of the information on these MODIS products as a clojure datastructure --

19:12 https://lpdaac.usgs.gov/lpdaac/products/modis_products_table

19:13 I'll be using the product name as a key, but I want to be able to store multiple values

19:13 is this a job for defrecord?

19:19 TimMc: I've enever actually been clear on the use-cases of defreord over, say, maps.

19:20 I suppose defrecord with (.field-name obj) gets you some type hinting.

19:22 sritchie_: here's one about maps... say I want to check a substring against a few possible options

19:22 is it more efficient to look the substring up in a map? Or to use cond?

19:24 https://gist.github.com/1455e310c21417ad13b5

19:24 as an example

19:27 amalloy: sritchie_: well your cond example is broken

19:27 sritchie_: because it has no :else?

19:27 amalloy: no, because you're using cond as if it were case

19:28 sritchie_: amalloy: oh, whoops

19:28 condp = s, then

19:28 amalloy: to answer your actual question: case is going to be way faster, though at the scales we're talking about, even if it were a million times faster it wouldn't matter

19:28 so like case < map < cond

19:29 sritchie_: amalloy: got it

19:29 so the issue at this scale is reusability of the cases, I guess

19:30 amalloy: actually for small maps i'm not sure whether cond or map is faster b/c small maps are implemented as arrays

19:30 sritchie_: so a map makes sense if I need access from multiple functions, case or cond for a single function

19:30 amalloy: sritchie_: not so! you can reuse them with case. the issue is that you have to know it all at compile time

19:30 Sgeo: Hmm

19:31 Maybe Clojure multimethods aren't more powerful than Factor's system

19:31 I'd need to think about what Factor does to be sure

19:31 sritchie_: amalloy: hmm, interesting

19:31 amalloy: how would I reuse cases?

19:32 Sgeo: " there's a multi-methods vocabulary. the core generics implementation is single-dispatch though"

19:32 amalloy: eg (let [tests [1 2 4] ] (defmacro switch-with-values [elt & rets] `(case ~elt ~@(for [[test val] (map vector tests rets)] test val))))

19:33 sritchie_: haven't typed it into a repl, but something like that would work, and allows you to use the same test values (1 2 4) with different return values

19:33 it's simpler if you always want to use the exact same map

19:34 sritchie_: got it. I'm still not used to thinking about how macros can sub in anything at compile time, and produce the same code

19:34 sorry, I mean, condense that idea of reusing a block of cases down, so nothing gets repeated

19:35 amalloy: (defmacro mapped-case [elt] (cons 'case (cons elt (for [[test val] {1 1000 2 500 4 250}] test val)))) ; a different style to keep you on your toes

19:36 sritchie_: time to go study these

19:36 amalloy: also that one doesn't compile. that's what i get

19:36 for trying to be clever

19:37 sritchie_: amalloy: once I can recognize the fact that it won't compile at a glance, I'll have studied enough

19:37 amalloy: on this example, anyways

19:37 amalloy: sritchie_: hah. i didn't recognize it either. i got up a real repl

19:39 * Sgeo ponders Clojure vs. Factor

19:40 amalloy: aha

19:40 this version works and is much tidier: (defmacro mapped-case [elt] `(case ~elt ~@(apply concat {1 1000 2 500 4 250})))

19:40 sritchie_: amalloy: I didn't realize that destructuring a map split it into keys and values

19:41 amalloy: sritchie_: destructuring a map *entry* splits it

19:41 sritchie_: ah, and in your example, for walked across a map, which produced entries

19:42 amalloy: &(let [m {1 2 3 4}] [(seq m) (first m) (let [[k v] (first m)] [k v]))

19:42 sexpbot: java.lang.Exception: Unmatched delimiter: )

19:42 sritchie_: &(take 2 {1 1000 2 500})

19:42 sexpbot: ⟹ ([1 1000] [2 500])

19:42 sritchie_: got it

19:42 amalloy: &(let [m {1 2 3 4}] [(seq m) (first m) (let [[k v] (first m)] [k v])])

19:42 sexpbot: ⟹ [([1 2] [3 4]) [1 2] [1 2]]

19:46 amalloy: ANYWAY. moral of the story: you can use case or a map, and there are differences, and it's up to you to pick

19:47 sritchie_: amalloy: haha, that is a good takeaway

19:47 thanks for the help

19:55 Null-A: any idea on how to declare array of bytes return value in gen-class :methods?

19:55 its not `bytes`

19:56 amalloy: Null-A: i seem to recall seeing this on the mailing list in the last couple weeks

19:56 Null-A: i'll take a look

19:56 amalloy: ^"[B" probably works

19:57 but (in 1.3, at least - not sure about 1.2) i think ^bytes is supposed to be the hint for a byte[], which won't work for clojure fns but ought to for gen-class methods

19:57 Null-A: ^

19:58 Null-A: ah, well i'm on 1.2

19:58 amalloy: you think :methods [[foo [] "[B"]] will work?

19:59 there's never a caret

19:59 amalloy: that would be my best try

20:02 looks like no, though

20:03 actually maybe i just don't know how to use gen-class :P. anyway try it out and let me know, Null-A

20:03 Null-A: amalloy: didn't work

20:03 amalloy: i think I can get by with ByteArrayOutputStream as return type

20:03 amalloy: thanks for the help ;)

20:05 hiredman: b

20:10 amalloy: hiredman: for returning a byte[]?

20:21 hiredman: amalloy: focus on the wrong window, that b was meant for emacs

20:22 amalloy: that was my second guess (modulo specificity about where you meant to send it)

21:00 sattvik: Null-A: For gen-class, you can have a return type of "[B" for an array of bytes

21:01 For example: (ns MyClass (:gen-class :methods [[myMethod [] "[B"]]))

21:02 Null-A: sattvik: I did try that

21:03 sattvik: are you sure it works? it didn't work when I tried it

21:03 classnotfound "[B"

21:05 sattvik: Hmmm... I just tried it out, but let me be sure.

21:11 Null-A: This code seems to be working for me: https://gist.github.com/844849

21:12 Null-A: sattvik: on 1.2 clojure?

21:12 sattvik: yes

21:12 Null-A: k, i'll retry

21:12 TimMc: The "[Foo" notation offends my balancing sensibilities. :-(

21:12 sattvik: It is rather ugly.

21:12 TimMc: (Interestingly, emoticons do not.)

21:13 I suppose my brain sees "face" before "code".

21:16 Sgeo: I think Clojure might have gotten me interested in Haskell again >.>

21:17 Lulu58e2: Haskell keeps defeating me and I keep coming back for more

21:23 Sgeo: Maybe I'll find Leksah to be a nice usable IDE

21:23 Which is more than I can say for all the Clojure stuff I've found

21:24 Then again, I probably should try to get familiar with a Lisp at some point

21:27 Although my Android phone does have a nice Clojure REPL, which is more than I can say for Hasell

21:27 Haskell

21:27 Null-A: sattvik: ah it did work

21:27 thanks

21:27 sattvik: No problem. I'm glad it helped.

21:29 Null-A: sattvik: doesn't seem to work with gen-interface though, just gen-class

21:30 that's why I originally thought it didn't work

21:31 sattvik: Null-A: Yes, that's right. The patch to get it to work in gen-interface and definterface just got committed today. For those, you can use ^bytes.

21:32 Lulu58e2: Huzzah! Finally got Clojure running through Slime

21:35 gfrlog: so let's say I want to load several versions of a namespace at the same time...

21:35 sattvik: Actually, with the new patch, you will be able to use bytes instead "[B" for gen-class, too.

21:36 dnolen: Sgeo: or you could stop wasting your time looking for an 'perfect' environment and start writing code. From what I hear Simon Peyton Jones writes GHC in Emacs :)

21:36 and debugs w/ print statements.

21:37 Sgeo: Decent environments I have seen: Newspeak's IDE, and DrRacket. Although I seem to be satisfied with things like Notepad++ when it comes to Python

21:38 Then again, I have little experience with Newspeak's IDE or with DrRacket

21:43 groovy2shoes: DrRacket has some nice features for Lisps. One of my favorites is the way it highlights nested lists with different shades depending on how deep they are.

21:57 amalloy: combining -> and doto yields some pretty powerful stuff. it's really nice how these two play nice together automatically - props to whoever thought them up

22:09 spewn: groovy2shoes: Not exactly the same, but emacs and vim can be set up to have rainbow parens.

22:17 groovy2shoes: spewn: Yeah. The shading makes it even more visually distinct :)

22:42 Lulu58e2: Is there a new f macro that expands to fn?

22:46 amalloy: Lulu58e2: uh, i don't think so but maybe you'd better clarify

22:54 Null-A: I have :aot all, but when I run lein compile, it can't find my gen-class

22:54 its not even generating any class files inside classes/ dir

22:55 tomoj: you have literally ":aot all" ?

22:55 Null-A: tomoj: yah

22:55 in my project clj

22:55 joshua__: $find-fn 1 2 3

22:56 tomoj: what made you think that would work?

22:56 joshua__: &find-fn 1 2 3

22:56 sexpbot: java.lang.Exception: Unable to resolve symbol: find-fn in this context

22:56 joshua__: &findfn 1 2 3

22:56 sexpbot: java.lang.Exception: Unable to resolve symbol: findfn in this context

22:56 Null-A: tomoj: my boss wrote it

22:56 tomoj: ah :)

22:56 Null-A: what works?

22:56 tomoj: I'd guess lein would say "well, I don't see any namespace called 'all'.."

22:56 sample.project.clj says you can supply a regex

22:56 Null-A: ohm

22:57 tomoj: but doesn't provide an example.. wonder if it means :aot #".*" or :aot ".*"

22:57 Null-A: tomoj: actually its ":aot :all"

22:58 which I think is valid

22:58 tomoj: yeah, that looks more likely to work

22:58 :aot [#""] appears to work

22:58 joshua__: find-fn 1 2 3

22:59 Null-A: tomoj: i'll try it..

22:59 I tried the namespace too

22:59 none of it worked

22:59 tomoj: I do see checks for :all

22:59 should work

22:59 then :all is not the problem, I guess

22:59 Null-A: tomoj: wierd how classes/ dir is empty

23:02 joshua__: $find-fn 2 2 4

23:02 $findfn 2 2 4

23:02 sexpbot: [clojure.core/unchecked-multiply clojure.core/+ clojure.core/* clojure.core/unchecked-add]

23:03 tomoj: Null-A: does `lein compile` say it's compiling things, or nothing?

23:04 Null-A: tomoj: i took out the references to my clojure genenerated class, and now it compiles

23:04 tomoj: but none of the clojure classes are present in classes/ dir

23:05 oh I see some stuff, actually

23:05 just not my gen-class, hmh

23:10 uhg, bbl

23:16 Lulu58e2: amalloy: I'm running Clojure in Emacs via swank; I tried (filter (fn [x] (< 2 x) [1 2 3 4 5 6]) and it complains that it can't find "fnn"

23:16 amalloy: So I try it (filter (f [x] (< 2 x) [1 2 3 4 5 6]) and it works

23:17 DespiteItAll: clearly you have an invisible 'n'

23:17 oh, actually, i know what it is

23:17 Lulu58e2: I did C-c C-m over "f" and it shows "fn" in whatever the slime buffer is called

23:17 DespiteItAll: it's turning fn into the greek letter

23:17 it's an annoying thing that clojure mode does sometimes

23:18 amalloy: Lulu58e2: is that the parens you're actually using? cause there should be an ) after (< x 2)

23:18 Lulu58e2: So, that's why I asked about the "f" macro; seems "f" is macro-expanding to "fn"

23:18 amalloy: lol, no, I had a 2nd ) after the anon fn

23:19 DespiteItAll: Lulu58e2: look at the 'f' closely. it's not really an 'f'

23:19 amalloy: Lulu58e2: i'm inclined to agree with DespiteItAll: there's an invisible n in there somewhere

23:19 Lulu58e2: Okay, it does look like a fancy f with a bit of a tail

23:20 lol, okay, interesting.

23:20 DespiteItAll: yeah, you need to turn off 'pretty-fns' I'm not sure how to

23:20 Lulu58e2: Yup, did backspace and it goes back to regular old "f"

23:20 Thanks!

23:21 amalloy: heh. when no logical solution is possible, search for ghosts

23:21 Lulu58e2: :)

23:22 I'm making the switch from Clojure in IDEA on Windows to Clojure in Emacs on Ubuntu.

23:22 Garsh, what a mind-job.

23:23 (and I'm quite new at Clojure at that)

23:24 amalloy: nice. i made the switch, more or less, from java in eclipse on windows to clojure in emacs on ubuntu at about the same time

23:25 every choice well worth it

23:25 Lulu58e2: Same, switching from Java after reading Seven Languages in Seven Weeks

23:26 I'm not sold on emacs yet, but it gets good press. Worth a shot.

23:26 I did the tutorial and watched "Meet Emacs" from PeepCode

23:26 amalloy: http://norvig.com/21-days.html

23:26 Lulu58e2: lol "in Ten Years"

23:27 amalloy: true words

23:27 Lulu58e2: Oh I'm sure truer words were never spoken

23:28 amalloy: i think the url is almost as funny as the rest of the article

23:29 Lulu58e2: I like the Alan Perlis "... change the way you think ..." quote

23:29 Haskell had me thinking like a crazy person. :D

23:30 amalloy: sure it didn't just make you crazy?

23:30 Lulu58e2: <snicker>

23:31 I'm convinced there's something there. After I get a little more comfortable with Clojure I'm going to hit that last chapter in 7Lin7W

23:31 * seancorfield uses eclipse on ubuntu for clojure (with counterclockwise)

23:31 amalloy: Lulu58e2: something "there" where?

23:32 cuz in isolation "i'm convinced there's something there" sounds like a crazy person :)

23:32 Lulu58e2: rofl

23:33 Come on, with words like monad and things like "function lifting" I'm sure it must have 110% of awesome baked right into it.

23:33 Plus, the "Learn you a Haskell for Great Good" sells it all by itself.

23:33 amalloy: oh in haskell

23:34 yeah haskell is a language that i am convinced will be fabulous for me if i can ever muster the strength to really learn it like i did clojure

23:35 Lulu58e2: I can still read it fairly well, which surprised me, but I think Clojure will help me learn more of the FP I need to tackle Haskell

23:35 I need Clojure to change the way I think (i.e. functionally) and then Haskell to take it to the "pure" level.

23:41 Okay, why does clojure-mode insist on doubling up my parens? Is it Paredit or Fill doing it?

23:41 amalloy: paredit

23:42 i hated it for a while but it's actually super-handy

23:42 Lulu58e2: Hmm, okay, thx

23:42 What's the idiomatic way to look up Paredit info? Google?

23:42 amalloy: not so much because it doubles your parens, but because it knows your code is well-balanced it can perform handy list-editing functions on it for you

23:43 Lulu58e2: or #emacs. i'm not a pro myself

23:43 the ones i use most are C-<RIGHT>, M-(, M-<UP>, and M-r

23:44 Lulu58e2: Please excuse my ignorance, but what's with the different colours? (I'm using XChat)

23:44 amalloy: uhm, what colors?

23:44 Lulu58e2: (I tried Googling it but I'm not sure if it's XChat, Freenode, or what)

23:44 Sometimes your nick and text is red, sometimes blue

23:44 Mine is light grey

23:44 amalloy: mine? it's something your client is doing, but i don't know what

23:45 Lulu58e2: maybe it has to do with whether ive mentioned you in the message

23:45 Lulu58e2: I suppose I should find a #xchat or #irc-retards channel

23:45 Hmm, yes, that does seem to be a pattern

23:45 amalloy: Lulu58e2: lol, i would join that channel. i actually just use pidgin as a holdover from my windows days

23:45 it's a pretty awful irc client, but i'm comfortable with it

23:45 seancorfield: Lulu58e2: how many IRC clients have you tried on Ubuntu? i tried a bunch and settled on Konversation

23:46 Lulu58e2: Um, let me count ... 1

23:46 seancorfield: oh... heh... ok...

23:46 Lulu58e2: I suppose I should try more but Clojure-Emacs-Swine-Swank takes precedence

23:47 amalloy: slime, or is swine an actual thing?

23:47 Lulu58e2: D'oh

23:47 nvmd, is slime

23:48 (had to quickly double-check my web page :)

23:48 Okay, C-<RIGHT> is cool

23:49 Ack! M-<UP>

23:49 amalloy: lol

23:49 C-/ to undo

23:53 Lulu58e2: seancorfield: are you using KDE?

23:56 lol "slurp" and "barf" commands (paredit)

23:58 amalloy: oh, and paredit's C-k is imo a lot more useful than the built-in

23:59 Lulu58e2: amalloy: yeah, I can see now the value of paredit

23:59 amalloy: I didn't even realize there were commands associated with it.

23:59 That's another point for Emacs

23:59 (and obviously for paredit itself)

Logging service provided by n01se.net