#clojure log - May 17 2011

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

0:00 hugod: it uses some of the ideas from cdt

0:01 mainly the same one about building a map of locals to provide a context to eval in

0:10 scottj: hugod: k readme refs old version

0:11 hugod: scottj: thanks - I forgot to push

0:12 scottj: k also this doesn't work on openjdk?

0:13 hugod: not tried it on openjdk…

0:14 scottj: k I don't actually know how openjdk differs from sun's, but fails for me on Caused by: java.lang.ClassNotFoundException: com.sun.jdi.VirtualMachine

0:14 technomancy: either of you guys try the M-x clojure-jack-in yet?

0:14 hugod: mm, looks like it isn't finding the jdi classes

0:15 technomancy: no

0:15 technomancy: thinking of cutting a 1.3.1 release of swank with jack-in but without the cdt stuff that's still somewhat untested

0:15 hugod: looks interesting from the screencast

0:15 scottj: technomancy: nope, I can if you wan

0:15 technomancy: scottj: that'd be great

0:16 would like confirmation that it works on at least one other machine before cutting a release

0:16 scottj: technomancy: so I need latest clojure-mode and latest swank-clojure?

0:16 technomancy: scottj: yeah, clojure-mode from git, swank-clojure 1.4.0-SNAPSHOT from clojars or git

0:17 scottj: btw what happens if you clojure-jack-in but have an old swank-clojure?

0:17 technomancy: scottj: just "that's not a task"

0:17 scottj: ok

0:17 technomancy: hmm... it will keep the *swank* buffer polling though

0:18 hugod: I get /bin/bash/lein command not found

0:18 scottj: I need to get a vm of ubuntu up for this kind of thing so I don't accidently mess up my dev environment :)

0:19 technomancy: scottj: well one advantage is this is very non-invasive

0:19 scottj: exit Emacs and the changes are gone

0:20 hugod: maybe a path mix-up? on OS X sometimes GUI-launched processes don't pick up $PATH customizations from ~/.profile

0:22 hugod: that's like the #1 thing people run into with magit on OS X

0:22 hugod: lein works from emacs shell, terminal, but not eshell

0:22 technomancy: hugod: yeah, that's the path issue then. try from emacs -nw

0:24 scottj: technomancy: I installed swank-clojure 1.4.0-SNAPSHOT as lein plugin but clojure-jack-in says not a task

0:25 technomancy: scottj: hmm; let me confirm it's on clojars

0:26 scottj: is there another swank shadowing that perhaps? in ~/.lein/plugins or lib/dev?

0:26 scottj: yeah probably let me check

0:28 nope, lein version 1.5.2

0:30 technomancy: hmmm... curious

0:30 what's the output of DEBUG=y lein version ?

0:32 hugod: technomancy: maybe a defvar for lein location?

0:32 scottj: maybe it's installing an old version of swank-clojure 1.4.0-snapshot out of ~/.m2?

0:32 I opened up the jar and didn't see any files modified in may

0:33 technomancy: hugod: yeah, clojure-swank-command is actually already a defvar

0:36 scottj: swank-clojure on clojars shows it from gjahad on 04-24

0:36 hugod: I'm picking up swank-clojure-1.4.0-20110417.030036-3.jar

0:37 technomancy: hmm. I wonder how I'm picking up the new one even after clearing ~/.m2/repository/swank-clojure

0:37 amalloy: how do i get (the equivalent of?) c.c.pr-xml in clojure 1.3? it looks like data.xml is empty

0:37 technomancy: eh; I'll try re-scping

0:37 scottj: (I was going off web search)

0:38 technomancy: oh... I may have scp'd without the pom earlier.

0:39 ok, try clearing it from m2 and re-downloading

0:39 amalloy: technomancy: you should try writing a build tool of some kidn that will scp to clojars for you

0:39 technomancy: amalloy: brilliant =)

0:40 I have a shell alias, but I never use it because scp is supposedly simple enough.

0:40 hugod: scottj: you have openjdk jdk or jre?

0:40 technomancy: apparently not!

0:40 amalloy: hah

0:41 technomancy: actually better would be getting clojars to accept proper mvn deployments; I've already got that implemneted.

0:41 for some reason the new version claims to be 1.4.0-20110417.030036-4 even though I just uploaded it.

0:41 can I blame java.util.Date?

0:41 amalloy: that's rarely far off

0:42 try java's UUID package though. that one's *always* wrong

0:42 technomancy: amalloy: yeah, but off-by-one errors in the month seems suspect?

0:42 dunno

0:43 scottj: I think that clojars updates the list before it's fully received the file, technomancy how long did your scp take?

0:43 hugod: clojars keeps the first upload date of any snapshot, and just revs it

0:43 technomancy: hugod: that makes perfect sense.

0:43 hugod: ie it is the -4 that is important

0:43 technomancy: can't believe I never noticed that before =)

0:44 scottj: cause it gave me half the file when plugin installed right after you reupped

0:44 technomancy: scottj: I didn't notice it taking particularly long

0:44 scottj: technomancy: this could be the start of a beautiful program.

0:44 technomancy: woooo

0:45 although my favourite is "Take this REPL brother; may you use it well."

0:45 *may it serve you well

0:45 scottj: technomancy: so it only supports one at a time?

0:46 technomancy: scottj: I haven't really thought through the implications of multiple connections in a single emacs instance

0:46 slime doesn't really make it easy

0:46 scottj: I noticed ensime (slime for scala, better in several ways) copies slime with those style messages

0:46 technomancy: slime-connect does

0:47 technomancy: scottj: I mean you have to manually switch between connections, right?

0:47 hugod: that's what the port file was for iiuc…

0:47 technomancy: there's no way to say "all files in this project-root go to connection 0 and the rest go to connection 1"

0:47 or is there?

0:47 someone told me there wasn't; I never bother since I just start multiple emacs instances =)

0:47 scottj: technomancy: yeah actually that part I don't understand, I typically use multiple but only the most recent and disconnect from that then it notices and re-defaults the most recent active I think

0:48 technomancy: well, it's just running its own slime-connect, so I'm not sure that this would interfere with that

0:48 scottj: btw maybe take a directory with C-u M-x clojure-jack-in

0:48 technomancy: yeah, not a bad idea

0:48 scottj: or prompt if not in a valid dir

0:49 or both

0:49 technomancy: yeah, that'd be slick

0:49 what do you like about ensime?

0:49 hugod: working here too, btw

0:49 technomancy: hugod: sweet; thanks!

0:49 I think I'll cut a 1.3.1 without the cdt stuff for now

0:52 scottj: is the proper way to search for params like -U on google/gmail to do "-U" ?

0:55 hugod: not actually sure, I have openjdk-6-jdk and -server works

0:56 hugod: that class should be in jdk/lib/tools.jar

1:00 technomancy: scottj: some of the debugger stuff doesn't work if you try it with a JRE rather than a JDK

1:01 scottj: I had that problem with cdt on ubuntu's 32-bit JVM

1:03 dunno if it's the same problem

1:07 I wonder if it'd be worth publishing swank with a 1.2.1 classifier in order to allow AOT

1:08 let's see how much it improves boot time

1:10 shaves a couple seconds of... pretty nice

1:10 hmm...

1:13 scottj: was there any word on how that 1.3/2.0 survey turned out? if they wanted to call it 2.0 last summer I can only imagine how much they'll want to use that number this summer/whenever it ships

1:15 technomancy: yeah, never heard anything back from that

1:15 hopefully they can learn from scala 2.8 =)

1:22 maybe I'll re-record the video tomorrow with 1.3.1 and show the clojure-mode install, but I wanted to get this out tonight: http://technomancy.us/149

1:26 pretty impressed with how easy http://diveintohtml5.org/video.html made embedding the viid

1:34 scottj: this one might be exception because it's short, but generally I think youtube makes sense to have free bandwidth and better controls

1:35 hugod: no final answer for you on openjdk, I see it has the right classes so I'd guess it works fine for ppl who can get it to put tools on their classpath

1:36 technomancy: the controls are browser-supplied; are they not so great on some browesrs?

1:36 seems pretty solid on gecko

1:37 oh wow, yeah it's a mess on chromium

1:38 at least before it finishes buffering

1:38 scottj: on my old geck (pre firefox 4) they're about the same as my chrome controls wise,

1:38 so not an issue for this video, but for others I'd miss popout and fullscreen buttons

1:39 technomancy: once it buffers it's ok

1:40 full screen might be handy for larger ones I guess

1:40 I haven't used youtube much until recently since they've been doing the webm transition

1:41 scottj: do you use conkeror?

1:41 technomancy: yeah

1:41 using the ff4 runtime though

1:42 couple minor bugs, but it's so much faster that I don't care =)

1:42 scottj: technomancy: http://jaderholm.com/paste/youtube-conkeror.html

1:43 technomancy: still kinda getting over the novelty of video that actually plays in the browser TBH.

1:43 tomoj: does "ff4 runtime" refer to a particular version of xulrunner?

1:43 scottj: allows you to do n I f 0 on a youtube video page or link and it will open it in popout hd quality

1:43 technomancy: scottj: handing off to vlc or what?

1:43 scottj: tomoj: the one in ff4, firefox -app somexulapp

1:44 technomancy: no, flash still

1:44 technomancy: tomoj: yeah, FF4 is just another xulrunner app

1:44 scottj: oh, ok. I don't have flash.

1:44 tomoj: so do native websockets work?

1:45 technomancy: tomoj: haven't tried that

1:45 tomoj: they don't in my conkeror, I don't even think the flash version works, but ff4 they work fine

1:45 er, actually I never tried native on ff4

1:45 technomancy: tomoj: definitely worth using conk on ff4; it makes a huge difference

1:46 what do you use websockets for?

1:46 tomoj: is that some build step you do for conkeror?

1:46 technomancy: tomoj: it's just how you launch it

1:47 cat ~/bin/conkeror # => ~/bin/firefox/firefox -app ~/src/conkeror/application.ini $@

1:47 tomoj: oh.. thanks

1:47 technomancy: conkeror's just a pile of JS and XML on disk somewhere; no real build

1:48 * technomancy heads off to get some rest

7:21 yoav_: Hi, I have a question about the clojure compiler

7:23 I would like to do something like - :gen-class :methods [ [myMethod [String] double[] ]]

7:23 meaning - to set the return value of the function to be an array double

7:24 I used the above line and the compiler generated a function that returns only double, not an array

7:25 raek: double[] is two tokens in clojure: double and [] (so you don't write array types that way)

7:27 I think you have to you the quirky "descriptor" syntax for arrays, i.e. array of objects: "[java.lang.Object;"

7:28 yoav_: you could try [myMethod [String] "[D"]

7:28 yoav_: ok, I'll try, thanks

7:29 raek: (also, the array-of-objects example should have been "[Ljava.lang.Object;")

7:45 yoav_: raek: thanks, it worked, but now it seems that I need to convert the vector returned from myMethod (written in clojure) to a [D ,

7:46 when I call that myMethod from Java

7:49 fliebel: does Clojure have an @overwrite macro or something like that, to make sure you actually overwrite a method in a gen-class?

7:52 raek: yoav_: yes, you can use ##(into-array Double/TYPE [1.0 2.0 3.0])

7:52 sexpbot: ⟹ #<double[] [D@1f5ca0b>

7:53 raek: yoav_: you also have to make sure the elements are of type Double

7:53 clojurebot: http://www.assembla.com/wiki/show/clojure/Datatypes

7:55 raek: ,(into-array Double/TYPE [1 2 3])

7:55 clojurebot: #<double[] [D@4d6f8c>

7:56 raek: ok, it seems that widening conversions happens automatically, but you would need to do (map byte [1 2 3]) if you were to use an array of bytes

8:05 fliebel: Is there any data structure that allows constant time concatenating? Finger trees? Persistent doubly linked lists(is that even possible?)?

8:07 clgv: fliebel: seqs? ;)

8:07 fliebel: clgv: What? really?

8:08 $source concat

8:08 sexpbot: concat is http://is.gd/HpiI86

8:08 clgv: well it's an iterator approach isnt it?

8:09 if they don't it should be possible to write a constant time concatenating seq-like implementation

8:10 fliebel: clgv: Well, yea, concat generates a lazy seq, but it really just builds a lot of conces, with the last one having the second seq as crd.

8:11 clgv: fliebel: it is almost the constant time behavior except that you have the lazy overhead

8:11 fliebel: hmpf, then I can do constant time sorting...

8:12 clgv: lol. I doubt that ;)

8:13 fliebel: I mean in a mutable world you would write an iterator implementation that uses iterators of the lists that shall be concatenated

8:13 concat looks like the semantic equivalent

8:14 chouser: single or double-linked (mutable) lists can be concat'ed in constant time.

8:14 assuming you have a pointer to the tail of the first list

8:14 fliebel: clgv: constant time sort: http://boss-level.com/?p=92 (just some overhead while consuming)

8:15 chouser: heh. not at all.

8:15 getting the first item in O(n)

8:16 clgv: fliebel: comparison based sorting can't be done in less than O(n log n). there is a proof for that

8:17 chouser: indeed. you have to look at all elements at least.

8:18 fliebeL: but if this is done for all elements you'll get n*n ;)

8:18 yoav_: <raek> thanks, got myself a running app :-)

8:18 fliebel: clgv: I know, I was just trying to make clear my view that concatenating a lazy seq will still cost you linear time. Just like sorting is n log n, but defining the lazy seq is just as constant time as your constant concatenation.

8:20 clgv: fliebel: you read my iterator statement? thats the idea. concat does that semantically but includes the lazy overhead and the burden of immutability.

8:22 fliebel: clgv: I did. I still don't agree it's constant though.

8:23 clgv: fliebel: It indeed is. you have only one additional if-check each time one of your iterators passes its last element

8:23 I wrote something quite similar in c# yesterday

8:28 ilyak: ,(#{"yes" "true" "on"} "on")

8:28 clojurebot: "on"

8:29 ilyak: ,(#{"yes" "true" "on"} "off")

8:29 clojurebot: nil

8:30 fliebel: clgv: Well, okay, in a mutable world you might do that, but Clojure actually creates n new conses.

8:31 clgv: fliebel: thats the mentioned overhead^^

8:31 Chousuke: don't assume the implementation is slower just because it's immutable, or uses lazy seqs, though

8:31 fliebel: …which isn't constant in any way

8:32 Chousuke: the jvm is good at reusing objects, and the objects might be in cache. :)

8:32 clgv: yep, but you could try a mutable implementation if you really need it

8:32 Chousuke: so it may well be just as fast if not faster than some sort of mutable thing (if the mutability happens to invalidate caching)

8:34 clgv: Chousuke: but it remains a linear overhead if you analyse it on paper, like fliebel says

9:07 markskilbeck: Aloha!

9:08 When I'm running `lein run -m myproj.core` I've noticed it's quite slow to start up. I assume this has something to do with firing up the JVM? Any way to make this faster?

9:14 fliebel: markskilbeck: use a persistent vm or port clojure to another vm, like v8 or pypy :)

9:15 dnolen: markskilbeck: firing up the JVM + compiling Clojure + compiling your source. If you want to decrease startup time AOT compile your project.

9:19 fliebel: dnolen: I got a great book full of logic puzzles, it's tempting to solve them all in Logos. fun :) Only, I suppose a constraint solver is more suitable for most.

9:20 markskilbeck: fliebel: Logos?

9:20 dnolen: fliebel: cool! eventually I get back to the constraint stuff, but I have some hefty reading to do first.

9:20 markskilbeck: core.logic now.

9:31 loading AOT clojure.jar is like 1.5s, non AOT clojure.jar is like 7-8s.

9:49 ilyak: Can someone help me with testing code in clojure-ant-tasks?

9:49 I don't understand why it doesn't seem to run the overriden report

9:50 http://pastebin.com/VcQr3Gbm

9:50 For some reason it never fails with BuildException, even when there are failures

9:51 It also doesn't println anything, but I might be guilty, I'll check

9:53 Nope, it does

9:53 Looks like the function is incorrect

9:55 Nope, I guess it doesn't

9:56 shanmu: hello! I am trying to get clojure.pprint/print-table to print a list of maps where some map values are small seq. but then when printing, it gets printed as a #LazySeq

9:58 (clojure.pprint/print-table (list {:a "1" :b (take 2 (range 10))}))

10:00 Using doall on the inner seq does not help...

10:00 clgv: &(clojure.pprint/print-table (list {:a "1" :b (take 2 (range 10))}))

10:00 sexpbot: java.lang.ClassNotFoundException: clojure.pprint

10:01 ilyak: Where can I read on how to override report properly for tests?

10:02 shanmu: clgv: clojure.pprint is reorganised in 1.3, I think...

10:02 clgv: &(clojure-version)

10:02 sexpbot: ⟹ "1.2.0"

10:03 clgv: ah the other way round, probably ;)

10:05 shanmu: yes, I am using 1.3

10:12 clgv: I don't, so I can't check

10:20 ZabaQ: I'm in a bit of pother with authentication with compojure/ring

10:20 raek: shanmu: if you see a #LazySeq, then some code is calling str instead of pr-str on some value

10:22 shanmu: you could try (clojure.pprint/print-table [{:a "1" :b (pr-str (take 2 (range 10)))}])

10:22 shanmu: raek:Many thanks! you are star, as always... :)

10:24 ZabaQ: the thing to to seems to be to write a bit of middleware to check the session and see if its authenticated and redirect if it's not, no?

10:25 raek: it can be a bit confusing, but str means "turn this into a string somehow" and pr-str means "turn this clojure data into a readable string"

10:26 ZabaQ: but what to actually use for the actual authentication bit, I'm not sure.

10:26 raek: you can easily see the difference if you consider strings: ##(dorun (map println ((juxt str pr-str) "foo\"bar")))

10:26 sexpbot: ⟹ foo"bar "foo\"bar" nil

12:05 cemerick: fliebel, ejackson: I think you may find this interesting (remembering the chartered-conj-flight chatter from a while ago): http://www.fastcompany.com/1753756/social-flights-puts-private-flying-within-reach-of-the-everyday-traveler?partner=homepage_newsletter

12:06 ejackson: cemerick: you're on a mission :)

12:06 fliebel: cemerick: wee, I'll reed

12:06 cemerick: ejackson: Nah, I just saw it fly by on the twitters, and was reminded of the discussion. :-)

12:07 ejackson: i did eventually figure it out, the main problems was the multiple points of departure and even then it was about 5k a pop

12:07 so somebody needs to found, build and exit a startup before the conj in order to fund it :)

12:07 cemerick: huh

12:08 er, heh

12:08 that seems really out of bounds

12:08 I suppose the international flavour of it probably ticks up the costs a lot more than e.g. NYC<=>Austin netjets arrangements.

12:09 ejackson: it is a large puddle

12:15 pyr: hi

12:15 I still often times hit a wall when I try to use I/O operations in futures or agents

12:25 amalloy: pyr: that's cause you shouldn't

12:29 dnolen: amalloy: what makes you say that?

12:30 amalloy: dnolen: well, it's a slight overstatement. you can do i/o in agents as long as you don't try to modify anything other than the agent you're working with

12:30 oh, he said futures. i read it as refs. futures are fine

12:30 TimMc: You scared me, man. :-)

12:31 amalloy: haha good thing someone caught me

12:31 fliebel: amalloy: What is send-off for, if not for i/o?

12:31 pyr: yeah futures

12:32 amalloy: mutter mutter, i hate you all. i'm going back to bed

12:33 dnolen: pyr: what's the wall you're running into?

12:34 pyr: dnolen: i get operations blocking forever

12:35 say you want to bind two services together

12:35 or you want to accept messages over a protocol

12:35 do some async ops

12:35 and reply when ready

12:37 e.g: you want to fetch urls on an AMQP queue do some stuff with it, reply on an exchange when done

12:37 dnolen: pyr: sure, but how are you writing code such that it blocks forever?

12:37 pyr: what i do is seq over incoming messages, run the handler in a future and publish to the exchange back (through an agent to ensure thread safeness) when done

12:37 if i do that

12:37 the http outgoing op which happens in the future

12:38 never returns

12:41 dnolen: pyr: not sure I totally get that, do you have some snippet of Clojure that illustrates your pattern?

12:42 hiredman: pyr: why does publishing through an agent ensure threadsafeness?

12:43 pyr: hiredman: because the agent's value is the publisher, and access to it is atomic

12:44 hiredman: pyr: isolated

12:44 atomic doesn't make sense in that sentence

12:46 pyr: yep

12:46 indeed

12:46 hiredman: pyr: you would be better off creating a channel per future and publishing from the future instead of doing that

12:46 pyr: the thing is

12:46 i usually don't get to that point :)

12:47 markskilbeck: technomancy: why do you use binding here: https://github.com/technomancy/mire/blob/master/src/mire/server.clj#L24

12:49 pyr: i'll try to isolate the blocking issue

12:49 any tool you guys might know to help with debugging that ?

12:57 chrissbx: Is there a way to pretty-print Clojure code? Including rewrapping lines sensibly.

12:57 i.e. useful to make a nice looking output from generated code.

12:58 dnolen: chrissbx: clojure.pprint, use code printing mode.

12:59 chrissbx: thanks

13:14 rlb: Should it be OK to pass (assoc (into {} (System/getenv)) "foo" "bar") as sh's :env parameter?

13:14 I'm getting an error that seems to be caused by that.

13:15 i.e. can't cast clojure.lang.PersistentHash to java.util.Map...

13:15 But it looked like sh was using as-env-strings to handle something like that.

13:39 amalloy: &(supers clojure.lang.PersistentHashMap)

13:39 sexpbot: ⟹ #{clojure.lang.ILookup clojure.lang.IPersistentCollection clojure.lang.AFn clojure.lang.IFn java.lang.Runnable java.io.Serializable clojure.lang.IMeta java.lang.Iterable clojure.lang.IEditableCollection clojure.lang.Associative clojure.lang.APersistentMap clojure.lan... http://gist.github.com/976948

13:39 amalloy: rlb: it extends j.u.Map, so that can't be the error you were getting

13:42 ilyak: I made clojure-ant-tasks to build and work with newer clojure

13:42 https://github.com/alamar/clojure-ant-tasks

13:45 cemerick: ilyak: It's good to know someone is taking care of the ant side of the house. :-)

13:46 I wonder — in the same DRY spirit — if it's feasible to use the maven-ant-tasks to reuse clojure-maven-plugin if you happen to be driving your builds with ant?

13:46 * cemerick having never used the maven-ant-tasks

13:46 technomancy: cemerick: that should work

13:46 cemerick: technomancy: yeah, I just wonder how much overhead you'll be taking on for each ant target maybe having to put together a maven environment, etc.

13:47 Maybe I'm thinking of the maven-ant-tasks as being more heavyweight than they are.

13:53 technomancy: redinger: ping

13:54 markskilbeck: rebinding *in* and *out* to thread-local values makes read-line and println DTRT inside the application. we can pretend the user's socket is stdin/stdout.

13:55 ilyak: We have a build system based on ivy and we don't seem to be huge fans of maven

13:55 hiredman: we?

13:55 ilyak: (I've never ever used maven myself, excluding running "mvn" to build third party library)

13:56 By we I mean the organization unit where I work

13:56 cemerick: ilyak: sure; wasn't saying maven is the end-all-be-all or anything, just thinking out loud :-)

13:58 * technomancy extends his ping to any core members

14:00 ilyak: ant tasks should be useful to people having a tiny bit of clojure in their huge ant-build proprietary java application

14:00 as opposed to tiny clojure-only modular libraries or projects

14:00 cemerick: yeah; I have one lone holdout still using ant, and I'm not looking forward to doing anything with it, really

14:32 Null-A: Does anyone else dislike lisp syntax? Haskell and python is much easier to read

14:33 It'd be interesting if you made a lisp where lists are denoted without parens

14:34 technomancy: no, but I did just realize we've been way overdue for this recurring discussion.

14:34 Null-A: hah

14:34 has anyone tried to do lisp without parens?

14:34 technomancy: it's been nearly a year since someone proposed it; usually it happens at least every six months.

14:34 Null-A: i'd like to see an implementation

14:35 technomancy: http://www.dwheeler.com/readable/sweet-expressions.html and http://en.wikipedia.org/wiki/Dylan_(programming_language) come to mind

14:35 scgilardi: google knows about even more

14:36 raek: I wonder how/if macros are done in Dylan...

14:37 Null-A: technomancy: that's pretty awesome

14:37 I don't care so much about infix support, but that's nice too

14:38 pjstadig: "Dr. Strange Parens or How I Learned to Stop Worrying and Love the Parens"

14:38 Null-A: ah yah I know nathan marz

14:39 I just spent the last 4 months reading/writing clojure code, and I found it hard to scan large blocks of code

14:39 relative to haskell or python

14:39 hiredman: Null-A: get a bigger monitor

14:39 technomancy: and don't write large blocks of code

14:40 pjstadig: don't work with nathan marz

14:40 no just kidding

14:40 Null-A: nathan is awesome

14:40 pjstadig: keep working with him

14:40 jmatt: Null-A: I did 15+ years ago when I first saw it. 6 weeks later the parens disappeared. In my opinion it just takes time for your perspective to change. The "old" example of lisp without the syntax was python … the story goes John McCarthy showed up to a Norvig presentation at stanford about how python is a lisp and pointed out code isn't data and that was the end of python being called a lisp. http://news.ycombinator.com/item?id=1803627

14:42 All that being said when I'm not writing clojure I'm usually writing python.

14:43 Null-A: *nods* my python looks like clojure

14:46 even though I don't love the parens, clojure is an obvious win to me

14:49 thearthur: since adopting paredit i dont efen see the parens anymore

14:50 Null-A: unfortunately that doesn't play nicely with viper-mode

14:50 amalloy: i hear that claim a lot. i like the paren syntax, and it's easy to ignore them, but not seeing them seems far-fetched and not useful

14:51 technomancy: i'm sure it's been less than six months

14:51 technomancy: amalloy: lucky me; I must have missed a few then =)

14:52 * Null-A adding local bindings to clojure code is more involved than haskell

14:52 Null-A: e.g. (defn foo [x] (+ x 3)) changed to (defn foo [x] (let [y 3] (+ x y)))

14:52 you have to adjust parens using paredit

14:53 although it probably makes little difference at the end of the day in terms of productivity

14:53 haskell is foo x = x + 3, changed to foo x = x + y where y = 3

14:53 amalloy: Null-A: just use M-( to wrap the (+ x y) clause with a set of parens

14:54 then you can type "let [y 3]" and you're done

14:54 Null-A: oh, i'll try it out thanks

14:54 amalloy: anytime you fiddle with parens or lists manually, there's a paredit feature to do it faster and with less chance of errors

14:55 Null-A: amalloy: nice :)

14:55 thanks

14:55 amalloy: Null-A: see also M-<UP> and C-M-k

14:55 dnolen: raek: Dylan does have macros, but it has some usability problems.

14:56 amalloy: dnolen: heh, so does lisp. the problem is people complaining about how unusable it is

14:56 dnolen: amalloy: usability problems compared to CL style, Clojure style, and Scheme style.

14:59 cemerick: if someone knows how to use a saw fairly well, they'll likely experience a period of adjustment when they start using an axe

14:59 dnolen: http://www.fun-principles.info/slot/site/dylan/alpha/openpoints/Dylanmacrosareakludge..html

15:00 Null-A: i'm very amazed when I write clojure code that would've required macros/templates in C++, but doesn't in clojure

15:00 cemerick: That is, all these languages have their often-exclusive syntactic idiosyncrasies.

15:00 Null-A: e.g. generic algorithms that operate on any type, requires templates in C++

15:00 or programmatically constructing type hierarchies requires macros in C++

15:01 but is just a call to derive in clojure, if you're using multi methods

15:01 amalloy: that's because c++ throws away a bunch of type information at runtime, once it's satisfied with the compile-time static typing

15:02 java keeps all that information around at run-time so that it can 100% prevent typing errors (by throwing a classcast exception instead of doing something dangerous)

15:02 Null-A: *nods*

15:03 and performance is pretty good despite all that

15:10 Is there a way to define an algebraic data type, and then pattern match on that for function input?

15:10 like data MyType = 4 | 5 | :empty

15:11 amalloy: no

15:11 Null-A: hm, that was pretty useful in haskell

15:11 amalloy: dnolen is working on pattern-matching, and you can kinda fake it with multimethods that dispatch on :type or something

15:11 Null-A: *nods*

15:12 dnolen: Null-A: it'll actually be much cooler than what Haskell gives you, but it's gonna be some work, and it will probably need a lot of testing, so don't expect anything usable in anything less than a couple of months.

15:13 Null-A: exciting

15:13 hopefully its as low overhead as haskell

15:14 dnolen: Null-A: honestly it's just the super fast pattern matching algorithms found in PLs like Haskell but wired to a logic engine to avoid the problems.

15:14 Null-A: How do you mimic algebraic datatypes feature of haskell? defrecord, and do type checking in constructor?

15:14 raek: there is a adt library in contrib

15:15 amalloy: Null-A: you might be happier if you just dove in and drank some kool-aid. figure out what the idiomatic way to do X is in clojure, rather than asking "in haskell i solved X by doing Y, how do i do Y in clojure"

15:15 dnolen: Null-A: won't mimic algebraic datatypes, I'm not interested in the limitations of Haskell pattern matching.

15:15 amalloy: that is: there's nothing wrong with "in haskell I solved X by doing Y, how would i do X in clojure"

15:16 but asking how to do Y instead won't get you far

15:16 Null-A: hm

15:16 dnolen: Null-A: like SML, OCaml, Haskell limits the matches to be of the same type, there will be no such limitation in what I want to build.

15:17 benreesman: there was a great site with a bunch of clojure puzzles to solve, i can't remember the name of it. anyone remember off hand?

15:17 Null-A: where do I paste?

15:18 gist

15:18 dnolen: Null-A: that's what I use.

15:18 fliebel: benreesman: 4clojure probably?

15:18 stirfoo: benreesman: https://www.4clojure.com/

15:18 benreesman: exactly right thanks!

15:19 amalloy: benreesman: hey, glad you like it. feel free to stop by in #4clojure if you have some feedback

15:20 benreesman: amalloy: yeah it's great, i'll make sure to swing by if i have any comments!

15:20 Null-A: Here's what I'm trying to do amalloy https://gist.github.com/977174

15:21 it's a function for converting AST in infix notation to prefix notation, and lines 2 and 3 need some work

15:21 amalloy: i know nothing about clojure's pattern-matching, and only very little about haskell's. ask dnolen

15:22 (cuz that function looks like a mess of question marks with no real purpose, to me :)

15:22 dnolen: Null-A: you're using matchure right? I haven't really messed w/ that much.

15:22 Null-A: hah yah

15:22 dnolen: yah

15:22 dnolen: what do you use?

15:22 (for pattern matching)

15:23 dnolen: Null-A: there's nothing satisfactory for pattern matching in Clojure at the moment. That's part of the reason why I'm working on it.

15:23 Null-A: obviously I can do all this with cond's and if statements, but it's much less readable than pattern matching

15:23 k

15:23 dnolen: but to be clear, what I'm building isn't pattern matching. it's more like predicate-dispatch++

15:23 Null-A: dnolen: where's your lib? published

15:24 dnolen: Null-A: no, just sketches on how to do it, a couple more details to work out and then I'll probably start in earnest. Was also hoping people would lend a hand.

15:25 edwardg: erm, pattern matching? very interesting. is this an extension, or will it be core?

15:25 dnolen: Null-A: the tricky bit is implementing an OCaml algorithm that compiles decision trees using lazy evaluation semantics.

15:25 Null-A: hm, sorry a bit beyond me

15:25 I look forward to using it though

15:26 dnolen: edwardg: I doubt it will be core, but I will definitely submit it to contrib.

15:26 amalloy: Null-A: i'd write it as a multimethod that dispatches on count

15:27 since you're not matching on any actual values

15:27 Null-A: amalloy: the first pattern accepts 2 or more count

15:27 edwardg: pattern matching rocks, i'll be checking it out, thanks.

15:27 Null-A: amalloy: look at the comments, I want to

15:27 amalloy: matchure doesn't really support it afaik

15:27 amalloy: so the first and the third version accept 2+ args

15:28 Null-A: lines 2 and 4 accept 2+ and 4+ respectively

15:28 1+ and 4+*

15:28 amalloy: bake them both into the :default case of the multimethod, and switch based on whether the first entry is a function?

15:29 dnolen: Null-A: the other problem with matchure is I don't think it has any notion of guards.

15:29 Null-A: amalloy: that works but is overly verbose

15:30 stirfoo: dnolen: guards = predicates?

15:30 dnolen: stirfoo: yes.

15:30 amalloy: Null-A: well we don't have any good pattern-matching libs, so you have to compromise somewhere

15:30 Null-A: dnolen: uh they do have support, but it was limited

15:30 amalloy: yep

15:30 amalloy: anyways that's the whole "I'm doing X"

15:30 amalloy: *smile*

15:30 Null-A: amalloy: and the clojure way sucks right now

15:31 dnolen: Null-A: Clojure doesn't even provide a solution for your problem.

15:31 stirfoo: trying to recall what I learned about pattern matching in PAIP

15:32 Null-A: dnolen: the solution is cond and if statements or multi method

15:32 dnolen: Null-A: I wouldn't consider those solutions, but yes you can write a really verbose version of what you really want.

15:33 Null-A: news: clojure is turing complete :)

15:33 I had this CS assignment is class on how to design a calculator (not actually implement it)

15:34 and we spent all this time going through visitor design pattern and different tradeoffs, singletons, and the whole lot of OOP

15:34 future fitness of designs

15:34 I wrote implemented a prefix notation calculator it in clojure in like 2 minutes

15:34 and a infix calculator in like 30

15:35 dnolen: Null-A: visitor pattern, ick.

15:35 Null-A: all this accidentally complexity around OOP, and the teacher has no idea :(

15:35 and I get marked on learning that crap

15:35 I looked at the visitor design pattern, scratched my head for a few minutes

15:35 then realized it was just multi methods

15:36 joly: dnolen: I was using the core.logic zebra puzzle framework to try another logic problem, but ran into an issue with negative constraints (Irishman doesn't have the fish, or similar). Any ideas on how I could adapt it?

15:36 Null-A: here's my prefix notation calculator https://gist.github.com/977216

15:36 joly: dnolen: I tries working on a "not-member-o" but ran into trouble

15:37 s/tries/tried/

15:37 sexpbot: <joly> dnolen: I tried working on a "not-member-o" but ran into trouble

15:38 dnolen: joly: negation in general is a problem in Prolog and miniKanren (as far as I understand)

15:38 joly: dnolen: hmm, so we need something more like a constraint solver?

15:38 dnolen: joly: was considered adding stratified negation to core.logic.

15:38 joly: or that yes.

15:39 Null-A: nathan just recently added negation to cascalog if that helps

15:40 joly: dnolen: I have some interest on the constraint side, but I'm not well read on it

15:40 dnolen: joly: in the meantime you could look at examples of how Prologists solve it - negation as failure.

15:41 joly: dnolen: cool, I'll give it a look

15:41 dnolen: thanks

15:41 dnolen: joly: constraint solving, it's ridiculous huge rapidly evolving area. I find the CHR folks work most promising, they've been helping out the Haskell folks w/ some things related to type inference.

15:45 joly: dnolen: I'd heard you mention CHR before and took a quick look at it. I wasn't sure where to start, especially since it seems a lot of the work is recent and ongoing

15:46 dnolen: joly: best place to mess w/ CHR is SWI-Prolog, it comes bundled.

15:47 joly: dnolen: ok, I might give that a try. My Prolog is pretty weak though :(

15:47 dnolen: joly: so is mine.

15:48 joly: all this stuff is new to me, but I'm interested in seeing these wacky ideas put to use in real programs.

16:41 symbole: When macroexpanding, is it possible to get rid off the namespaces for readability purposes? It's very difficult to read otherwise.

16:46 dnolen: symbole: I think clojure.pprint can do that.

16:50 symbole: dnolen: Seems like it's still printing the namespaces.

16:51 dnolen: symbole: you need to use code-dispatch

16:54 stirfoo: I've bound clojure.pprint/*print-suppress-namespaces* to true for one-off macroexpansions

16:56 dnolen: (binding [*print-suppress-namespaces* true] (with-pprint-dispatch code-dispatch (pprint `(+ 1 2))))

17:00 symbole: Thanks. I have something to work with.

17:02 Setting *print-suppress-namespaces* worked quite well. I should turn that into a macro. :)

17:02 stirfoo: dnolen: so that's using a closure to make *print-suppress-namespaces* true on subsequent pprint calls?

17:03 dnolen: stirfoo: no dynamic binding

17:03 stirfoo: dnolen: ok, so *print-suppress-namespaces* is still only true within that form?

17:03 dnolen: stirfoo: yes.

17:03 stirfoo: I haven't used with-pprint-dispatch

17:04 dnolen: stirfoo: useful mostly for debugging, I learned how it worked get macroexpansion working swank-clojure.

17:04 working in

17:04 many moons ago now.

17:05 stirfoo: heh, works great in swank, imo

17:05 I had been doing something like: (binding [clojure.pprint/*print-suppress-namespaces* true]

17:05 (pprint (macroexpand-1 '(foo 3))))

17:05 dnolen: stirfoo: yeah, debugging macros used to be truly unbearable.

17:06 not sure what level support everyone else has for expanding macros - La Clojure, Enclojure, CCW ...

17:48 replaca: pprint, ftw :)

17:48 I should add a pp-macroexpand to pprint itself

17:48 so that it will be avail at every repl

18:20 stirfoo: or just learn the 400lb gorilla emacs/slime! ;)

18:28 technomancy: it's recently lost weight!

18:28 down to 300 lbs

18:33 stirfoo: (E)ight (M)egabytes (A)nd (C)onstantly (S)wapping, must have been rough in those days. I've got 6gb of ram and an i7. I *can't* slow this laptop down.

18:34 actually I want to get into concurrency to see if I can make this thing breath fire

18:34 amalloy: stirfoo: i like Editor for Middle-Aged Computer Scientists

18:35 stirfoo: amalloy: ahahah, that's a great one

18:35 brehaut: Escape Meta Alt Control Shift

18:36 stirfoo: I remember a vid of hickey talking about running a clojure program that was generating gigs of garbage a second or some such astonomical figure. Concurrency sounds fun!

18:36 amalloy: stirfoo: java loves object churn. it doesn't mind picking up boatloads of garbage as long as the objects that die are young

18:37 and of course immutability and primitive-boxing both create more churn

18:44 matthias__: hrm, im trying to recompile my whole file (using slime). tried C-c C-k, says it compiles without warnings (even though i commented out a function that is still being called later). and when i run it, its still the old version

18:46 amalloy: matthias__: C-c C-k doesn't "unload" stuff that's no longer there. it just sends all the text in the buffer to the repl

18:47 matthias__: so how would i do it? i could restart swank and reconnect, but that's seems wrong

18:47 amalloy: (ns-unmap *ns* 'the-function-to-delete) is a fine-grained way

18:48 or ##(doc remove-ns) should remote everything in a whole namespace

18:48 sexpbot: ⟹ "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."

18:48 matthias__: thanks

19:01 rlb: amalloy: right you were -- different problem entirely. Thanks.

19:02 amalloy: rlb: what was i right about? that must have been a while ago

19:04 aha, found it

19:17 gtrak: hmm, why can't i conj a list onto a map?

19:18 &(conj {:a 1} '(:b 2))

19:18 sexpbot: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry

19:20 gtrak: &(conj {:a 1} (list :b 2))

19:20 sexpbot: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry

19:20 stirfoo: &(conj {:a 1} (vec '(:b 2)))

19:20 sexpbot: ⟹ {:b 2, :a 1}

19:21 gtrak: yea, but that's cheating

19:21 stirfoo: good question though, I suppose a list cant be coerced to a map entry (vecotr)

19:23 gtrak: oddly inconsistent

19:23 amalloy: &(supers (class (first {:a 1})))

19:23 sexpbot: ⟹ #{clojure.lang.ILookup clojure.lang.AMapEntry clojure.lang.Sequential clojure.lang.IPersistentCollection clojure.lang.AFn clojure.lang.IFn java.lang.Runnable java.io.Serializable clojure.lang.Reversible clojure.lang.IPersistentStack java.lang.Iterable clojure.lang.In... http://gist.github.com/977651

19:23 amalloy: map entries *are* vectors

19:24 they are *not* lists

19:24 gtrak: ah

19:25 &(supers (class '())

19:25 sexpbot: ⟹ #{clojure.lang.Sequential clojure.lang.IPersistentCollection java.io.Serializable clojure.lang.IMeta clojure.lang.IPersistentStack java.lang.Iterable clojure.lang.Obj java.lang.Object java.util.Collection clojure.lang.IObj clojure.lang.IPersistentList java.util.List ... http://gist.github.com/977657

19:26 brehaut: http://davidpetersen.blogspot.com/2011/05/reference-model-port-sumac-new-mouse.html

19:26 stirfoo: &(conj {:a 1} '([:b 2]))

19:26 sexpbot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry

19:27 brehaut: bugger wrong window

19:28 gtrak: stirfoo, huh?

19:28 i thought we just proved they were vectors?

19:28 &(source conj)

19:28 sexpbot: java.lang.Exception: Unable to resolve symbol: source in this context

19:29 amalloy: we showed that clojure.lang.MapEntry extends vector

19:29 stirfoo: gtrak: well, when given a list, conj seems to be looking at the first of the list, in that example, any way

19:29 amalloy: we did not show that vector extends java.util.MapEntry

19:29 stirfoo: ah

19:30 gtrak: hmm, java util map vs clojure lang map

19:30 stirfoo: I hope to have a larger clue when I finish this book (joy of clojure)

19:31 gtrak: on my list as well

19:31 i mean vector

19:32 amalloy: gtrak: it's not just the different MapEntry types. the relationship is also backwards: A extends B does not imply B extends A

19:34 gtrak: right

19:35 been going through all the 4clojure problems, I'm glad it exists

19:36 amalloy: gtrak: with the newest release, we're accepting problem submissions from anyone who's solved 50 problems already

19:36 gtrak: cool, it's an easy way for someone lazy like me to practice clojure :-)

19:37 amalloy: yeah, that's basically the target audience

19:37 stirfoo: I got started on 4clojure then this book came. Probably get back on in when I'm finished.

19:38 gtrak: JoC? I like it, though it's a bit dense to just read through and get it, I need to work some stuff out

19:38 stirfoo: amalloy: are my solutions stored locally?

19:39 by locally I mean on the 4clojure box

19:39 amalloy: stirfoo: no. that's been on the todo list for quite a while

19:39 stirfoo: ah, ok

19:39 amalloy: if you choose to share them, we create a gist for you, though

19:39 stirfoo: ok

19:41 amalloy: stirfoo: we're always happy to get more contributors, though, so if you want to add it...

19:41 all the code is at https://github.com/dbyrne/4clojure

19:57 stirfoo: I stumbled upon a language called SETL a while ago. It's got some nice syntax like {x**2 : x in {1..33} | odd x}. That got me to looking at clojur's for. (for [x (range 1 34) :when (odd? x)] (Math/pow x 2))

19:57 neat stuff

19:58 probably be a good exercise converting all the SETL idoms to clojure

19:58 amalloy: stirfoo: that syntax is very like haskell, and also mathematics

19:58 though (* x x) is way better than Math/pow

19:58 stirfoo: oh? I read Python has some of it's roots in SETL as well

19:59 yes, (* x x) how did I miss that? ;)

20:00 amalloy: $heval [x*2 | x <- [1..10], x*2 >= 12]

20:00 sexpbot: ⟹ Not in scope: `?|?'Not in scope: `?<-?'A section must be enclosed in parentheses thus: (? x * 2 ?>=? 12)Not in scope: `?'Not in scope: `?>=?'

20:00 amalloy: wow what

20:00 anyway that's what the haskell syntax looks like

20:01 stirfoo: is \$heval running haskell or has some mad scientist written a haskell parser in clojure?

20:01 shachaf: The Haskell language is just some syntax sugar for a few list functions, though.

20:01 (Or a few monad functions soon, so I hear!)

20:02 SETL looks like it's actually about sets.

20:02 amalloy: it's running haskell

20:02 or shelling out to a haskell web service, i forget which

20:02 stirfoo: shachaf: yes, it's an interesting language (from the little I've looked at it) It's been around a long time too

20:02 brehaut: pythons list comprehensions were directly inspired by haskells

20:03 * shachaf much prefers the Haskell syntax.

20:03 stirfoo: brehaut: I think python's unpack was inspired from SETL, from what I found

20:16 (take (dec 5) (repeat rest))

20:16 wrong buffer...

20:18 amalloy: stirfoo: fwiw, ##(repeat (dec 5) rest) is easier

20:18 sexpbot: ⟹ (#<core$rest clojure.core$rest@e63294> #<core$rest clojure.core$rest@e63294> #<core$rest clojure.core$rest@e63294> #<core$rest clojure.core$rest@e63294>)

20:18 amalloy: assuming that you really like clojure.core/rest

20:18 stirfoo: ah, it's an example from joc

20:19 amalloy: i think the count argument for repeat was new in 1.2, and i know JoC was right up against the border of targeting 1.1 vs 1.2, since 1.2 only got released a little before it was published

20:22 scottj: joy of clojure was published april 4, 2011, clojure 1.2 released august 2010

20:24 amalloy: scottj: yes, actual physical paper publishing. but they had the author's version of "feature complete" long before that

20:24 Null-A: j #tutbot-testing

20:25 jtoy: hi all, im coming to clojure from no java experience at all

20:25 can I just keep adding jars to a classpath file for them to have the libraries loaded?

20:25 amalloy: jtoy: don't manage classpaths at all! way too much pain

20:26 stirfoo: jtoy: that makes at least two of us having zero java experience

20:26 amalloy: see eg http://stackoverflow.com/questions/5983427/how-to-install-clojure-on-ubuntu-10-04-from-github-repo-with-no-clojure-jar/5984183#5984183 to get leiningen installed, and read the readme for that project to specify dependencies for your project

20:27 jtoy: amalloy: i did just install leiningen, my issue is that I cant run my basic sql script

20:28 amalloy: $google java maven jdbc mysql connector

20:28 sexpbot: First out of 4460 results is: Maven Repository: mysql » mysql-connector-java » 5.1.6

20:28 http://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.6

20:28 amalloy: add a dependency on that to your project.clj

20:28 jtoy: I'm trying to do a simple sql example http://pastebin.com/nFeNKqiQ and I get : java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/socmetrics (NO_SOURCE_FILE:0) is that classpath issue ?

20:28 * hiredman has a half finished jdbc connector written in clojure

20:29 hiredman: https://github.com/hiredman/agilezen-jdbc

20:29 level 4

20:29 amalloy: anyway scottj, i can't find the google-group posting now, but when 1.2 came out, either fogus or chouser was like "whew we almost had to ship the book recommending 1.1"

20:30 scottj: amalloy: yeah I trust you, I remember 1.0 was also released in large part for stu's book

20:31 amalloy: heh, i wasn't around for that one

20:31 stirfoo: Is there a blog/post somewhere describing how to manage my local projects? Like if I create "lein new foo" and "lein new bar", how would I require/use foo in bar?

20:32 scottj: stirfoo: other than lein docs not sure

20:32 stirfoo: would I have to package foo up and put it in ~/.m2/repository ?

20:32 scottj: stirfoo: you lein install or put foo on clojars or your own maven repo and then add it to project.clj in bar

20:32 amalloy: yes

20:32 seancorfield: jtoy: i suspect you don't have the postgres driver in your project.clj file?

20:32 scottj: stirfoo: lein install will do that for you

20:33 stirfoo: ok, thanks scottj

20:33 technomancy: stirfoo: look at "checkout dependencies" in "lein help readme"

20:33 amalloy: stirfoo: lein also has a concept of "checkout dependencies", which might let you get around the need to install them, but i'm not sure

20:33 technomancy: amalloy: too slow, bro!

20:33 amalloy: ouch. ninja'd by the man himself

20:33 stirfoo: ahaha, lots of lein reading to do

20:33 * technomancy credits dvorak

20:33 * scottj suspects keyboard pants

20:33 amalloy: technomancy: i'm gonna go ahread and credit your terseness and my verbosity

20:34 i would also accept keyboard pants

20:35 seancorfield: i wonder who will publish the first clojure 1.3 book?

20:35 jtoy: seancorfield: no, im still learning how to do this

20:36 so how do I add a dependecy that is at another url

20:36 technomancy: jtoy: try "lein new tutorial"

20:36 seancorfield: you'll need to tell lein about the repo

20:36 technomancy: sorry: lein help tutorial

20:36 scottj: seancorfield: chas or raynes

20:36 amalloy: $google java maven jdbc postgres connector

20:36 sexpbot: First out of 3450 results is: DatabaseConfigurations - Trails Framework - Codehaus

20:36 http://docs.codehaus.org/display/TRAILS/DatabaseConfigurations

20:36 seancorfield: e.g., :repositories { "eaio.com" "http://eaio.com/maven2" }

20:36 Raynes: scottj: ?

20:36 seancorfield: but for postgres

20:36 amalloy: scottj: i don't think Raynes is doing any 1.3-oriented stuff

20:36 Raynes: Oh.

20:37 jtoy: amalloy: I found the postgresql driver at here: http://mvnrepository.com/artifact/postgresql/postgresql but I think i still need to tel llein about it

20:37 Raynes: Yes, I am. My book will be 1.3 compatible and so will Chas.

20:37 amalloy: yeah, if it's not in maven central

20:37 Raynes: Chas's book will probably be out before mine though.

20:37 amalloy: jtoy: like seancorfield said. add a :repositories key to project.clj, like :repositories {"sun" "http://download.java.net/maven/2"}

20:38 oh, but that's maven central. you shouldn't need to add a repo for that, lein already knows about it

20:39 so you can just have a dependency on [postrgresql "9.0-801.jdbc4"]

20:39 except spell postgresql right

20:39 seancorfield: jtoy: the following works: :repositories { "postgresql" "http://mvnrepository.com" }

20:39 :dependencies [[org.clojure/clojure "1.2.1"]

20:39 [postgresql/postgresql "9.0-801.jdbc4"]])

20:40 i didn't try the regular repo... let me try that too

20:40 technomancy: mvnrepository.com is just a search engine

20:40 amalloy: feh

20:41 i've only needed to add a repo once, for java-getopt, and i'd imagine postgres would make it to central

20:41 seancorfield: yup, don't need that repo spec... my bad

20:41 * technomancy has found search.maven.org to be nicer

20:41 technomancy: mvnrepository has a lot of downtime

20:41 seancorfield: i had to add a repo for clojure 1.3.0 snapshots :)

20:41 amalloy: technomancy: fair enough, but so far mvnrepository.com has only pointed me at jars that exist in maven central. will that not always be the case?

20:42 technomancy: amalloy: that's right; I was reacting to putting it in the :repositories list

20:42 amalloy: oh

20:45 seancorfield: i also had to add a repo for the eaio uuid (although i see a fork of it in maven from stephen connelly)

20:48 * amalloy hates uuids

20:48 amalloy: they're so hard to work with in jara

20:48 java

20:57 jtoy: lein compile

20:57 produces: No namespaces to :aot compile listed in project.clj. does that mean my code didnt work?

20:57 amalloy: means you don't need to compile clojure code

20:58 unless you have a compelling reason to do so

21:04 technomancy: you can do "lein compile :all" if you just need a quick sanity check that things are working well. but in most cases "lein compile" shouldn't be necessary.

21:06 jtoy: it looks like I need to manually add contrib also?

21:16 ihodes: jtoy: yes, to your project.clj. add any libraries you want to use!

21:16 jtoy: if you're set on compiling your code, there are some good articles that came up for me on google last time i checked. you have to do a little extra work.

21:17 * ihodes is done with his byweekly (hopefully correct) contribution to #clojure

22:05 Raynes: amalloy: I bet they're hard to work with in jara as well.

22:26 stirfoo: does compare only look at the first element of each vector here?: (compare [2333 15 "Eno"] [979 99 "Burial"])

22:34 well I'm guessing yes because (compare 3 "x") throws, but (compare [1 3] [2 "x"]) does not

22:36 darevay: Yeah. See compareTo() here: https://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/APersistentVector.java

22:39 stirfoo: ah so it will blast through until it finds two different elements

22:40 thanks darevay

22:40 darevay: np

22:42 it's interesting that shorter vectors are "less than" longer vectors. I would have expected it to act like a string comparison.

22:45 amalloy: &(< "" "1")

22:45 sexpbot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

22:45 amalloy: &(.compareTo "" "1")

22:45 sexpbot: ⟹ -1

22:45 amalloy: darevay: "" is less than "1"

22:45 so it sounds like a strcmp to me

22:48 darevay: &(.compareTo "abc" "aaaaaaa")

22:48 sexpbot: ⟹ 1

22:48 stirfoo: is there a way to print that Java method source from a repl? like (source compare)

22:48 that would be neat

22:49 amalloy: stirfoo: it's much harder

22:50 darevay: amalloy: "abc" is greater than "aaaa" even though it's shorter :)

22:50 amalloy: darevay: oh, i see. i didn't read the source; it compares length before going by element?

22:50 stirfoo: yep

22:50 darevay: yeah

22:51 amalloy: i suppose it's just faster, and you don't "need" equivalence with strcmp like you do for strings

22:53 stirfoo: (javadoc (. clojure.lang.Util compare))

22:54 darevay: That's probably the case. I'm sure there's a lot of room for debate over the "natural" ordering of vectors

22:54 stirfoo: well that was dumb, but (javadoc [1 2 3]) produces _something_, a google search

22:55 amalloy: &(doc javadoc)

22:55 sexpbot: java.lang.Exception: Unable to resolve var: javadoc in this context

22:55 amalloy: &(use 'clojure.repl)

22:55 sexpbot: ⟹ nil

22:55 amalloy: &(doc javadoc)

22:55 sexpbot: java.lang.Exception: Unable to resolve var: javadoc in this context

22:55 stirfoo: ah, class-or-object

23:20 KirinDave: Jeez. I need to convert Clothesline to using the monad library REALLY BADLY.

23:27 symbole: Anyone know what's going on at Clojure NYC tomorrow?

23:42 dnolen: symbole: seems like noone's stepped up to present something :(

23:43 seancorfield__: so i presented an intro to functional programming (using clojure) to a bunch of cfml devs last week...

23:43 dnolen: seancorfield__: how'd that go?

23:44 seancorfield__: really well! within 30 mins after the talk, one guy had CCW installed and was already trying out some examples :)

23:44 several devs were pretty excited about learning something new

23:45 although one eval of the talk complained "There wasn't enough CFML in the talk" ... but he also said "Still plenty of interesting stuff I can try in CF"

23:45 amalloy: seancorfield__: any new 4clojure users?

23:45 seancorfield__: heh, i expect there will be at some point :)

23:47 dnolen: seancorfield__: good to hear. presented some macro philosophy to the NYC FP Meetup tonight - went well - Haskellers, Scalaists, Schemers, Prologists, Racketeers seemed to dig it. Though that's a bit of preaching to the choir I suppose :P

23:47 seancorfield__: now that i can work with CCW and clojure 1.3.0, i can at least make sure the other devs at work can all fire up a REPL and try code out in their normal env

23:48 yeah, the cfml community is definitely not "choir" as far as FP is concerned :)

23:50 amalloy: most of those folks aren't choir for macros either

23:50 seancorfield__: i showed one macro example and it blew several people away...

23:51 scala days is coming up soon... anyone here going? i don't know how much cross over there is between scalaists and clojurians

23:52 dnolen: seancorfield__: I was actually lamenting that tonight.

23:52 seancorfield__: a lack of such cross over?

23:53 dnolen: seancorfield__: well there was a Scalaist in the audience that understood where I was coming from about macros. He noted the dynamic / static divide, but I think that's pure fiction.

23:53 I mean that the dynamic / static divide is not a real one.

23:54 seancorfield__: i see some very strong feelings on both sides of that issue tho'... so it's very real to some people :)

23:55 dnolen: seancorfield__: logic programming shows the way, you don't know need one or the other, you can have both. Was happy that the static camp there was there got that.

23:57 seancorfield__: strangely, in the cfml community - very much dynamic - i see quite a few folks wanting their language to change (to the static side)...

23:58 i've even given talks suggesting they look more at other dynamic languages instead of stuff like java :)

23:59 dnolen: seancorfield__: Dynamic programmers like unit test - aka proofs. Static programmers want expressiveness - aka generic programming. The divide is artificial.

Logging service provided by n01se.net