#clojure log - Mar 04 2011

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

0:17 joshua__: http://stackoverflow.com/questions/5189983/failing-to-upload-items-to-database-using-congomongo

0:19 Spent an hour looking into how MongoDB worked to see if that could be the cause. I'm really stumped. The best I can come up with is that I'm actually submitting to a database other than the one I'm trying to connect to, but I just don't know.

0:24 amalloy: joshua__: i don't think anyone will have an easy time answering your question from the information given

0:29 joshua__: amalloy, adding code

0:31 amalloy: hm

0:32 bartj: I am looking to build an interface similar to Google Squared

0:33 would compojure be suitable for this ?

0:33 amalloy: joshua__: i'd try adding some debug code to the upload-item code

0:33 eg, if you find that it's nil print something

0:33 joshua__: amalloy, It is downloading properly. I checked.

0:33 amalloy: ahem, upload. the insert! code

0:35 joshua__: Good idea.

0:40 I'm so confused. It isn't calling upload-item, but I don't understand why.

0:41 amalloy: joshua__: well, now you have something to work with. mongo isn't getting involved at all; see what's happening in the function above it

0:45 joshua__: So basically a list of two 'items

0:45 properly like I would expect to be..

0:45 is being passed to (map upload-item ..)

0:45 Double checking that upload-item isn't being called

0:46 amalloy: joshua__: laziness?

0:46 joshua__: amalloy, I don't know how.. but maybe?

0:46 How would I check?

0:46 amalloy: joshua__: just don't use any lazy function (eg map) for side effects

0:46 change it to doseq

0:47 or wrap it with (dorun)

0:47 joshua__: Alright so doseq instead of map

0:52 amalloy, thank you, your a genius

0:53 Do you want to post the StackOverFlow answer for me to accept or I can write it up myself if you would prefer?

0:54 amalloy: oh hm. i guess i should do that. i only recently joined SO :P

0:55 joshua__: From now on I'll try to be more idiomatic by wrapping side effect calls in doseq. I never realized that their was a good reason to do so before now.

0:56 amalloy: joshua__: it also kinda makes me twitch to see an if with no else branch; usually you should use (when) if there's no else. among other things, it helps you notice if you've forgotten the else accidentally

0:59 joshua__: amalloy, I'm really starting to see why open source coding is the way to go. I get to learn so much more than were I to go it alone.

0:59 amalloy, Thanks for the tips.

1:00 pdk: another bonus is when wraps the then form in an implicit do

1:01 amac: I've always used if expr nil... I'll have to be more aware of that little tidbit

1:02 DespiteItAll: i've only ever used when-not, but then I'm used to thinking in "unless"es

1:02 amalloy: &(macroexpand '(when x y))

1:02 sexpbot: ⟹ (if x (do y))

1:03 joshua__: &(macrodexpand `(defn [x] (+ x)))

1:03 sexpbot: java.lang.Exception: Unable to resolve symbol: macrodexpand in this context

1:04 joshua__: &(macrodexpand '(defn [x] (+ x)))

1:04 &(macrodexpand '(defn [x] (+ x)))

1:04 sexpbot: java.lang.Exception: Unable to resolve symbol: macrodexpand in this context

1:04 amalloy: &(macroexpand '(defn [x] (+ x)))

1:04 sexpbot: java.lang.IllegalArgumentException: Parameter declaration + should be a vector

1:04 amalloy: huh

1:04 joshua__: sexpbot, I'm bad at you.

1:04 Despite_: you got a extra d in there

1:05 joshua__: &(macroexpand '(defn [x y] (+ x y)))

1:05 sexpbot: java.lang.IllegalArgumentException: Parameter declaration + should be a vector

1:05 amalloy: &(macroexpand '(defn foo [x] (+ x)))

1:05 sexpbot: ⟹ (def foo (.withMeta (clojure.core/fn foo ([x] (+ x))) (.meta (var foo))))

1:05 Despite_: also, wtf

1:05 joshua__: Now I see what I was doing wrng...

1:05 How the heck do I ever get anything done ;p

1:06 Where is the implicit do?

1:06 amalloy: it's in the expansion of fn

1:06 &(macroexpand '(fn [x] (+ x)))

1:06 sexpbot: ⟹ (fn* ([x] (+ x)))

1:06 amalloy: well whatever

1:06 amac: hah

1:06 amalloy: it's in the compiler's interpretation of fn* :P

1:07 amac: its in there somewhere, I promise

1:07 amalloy: &((fn [] (println 1) 2))

1:07 sexpbot: ⟹ 1 2

1:07 joshua__: $((fn [] 1 2))

1:08 &((fn [] 1 2))

1:08 sexpbot: ⟹ 2

1:08 joshua__: Your right it seems.

1:08 amalloy: joshua__: let also has an implicit do

1:09 joshua__: amalloy, Thank you. Thank you so much. You have no idea how many times I'm using do in my code without need.

1:09 amalloy: joshua__: see also doto

1:09 ,(doto (inc 1) println)

1:09 clojurebot: 2

1:09 2

1:12 joshua__: amalloy, I should probably have a language exploration day where I cruise around looking for things I didn't notice. So many cool functions that I don't use.

1:13 Despite_: Huh, I thought doto was only for java objects

1:13 amalloy: Despite_: you can do whatever you want with doto. it just rewrites forms

1:14 &(macroexpand '(doto x inc))

1:14 sexpbot: ⟹ (let* [G__13499 x] (inc G__13499) G__13499)

1:14 Despite_: yeah, makes sense

1:14 I've just never had need for it

1:17 amalloy: Despite_: it can be handy for debugging

1:52 joshua__: for fun, i searched my src/ dir, and while it does contain plenty of (do ...) forms, none of them are in code i wrote :P

1:54 joshua__: amalloy, very nice.

1:54 amalloy: which of course is not actually meaningful. i probably needed local bindings or synchronization for most of them, so they're actually let or dosync

1:55 but you should rarely need an actual do

1:55 joshua__: amalloy, I figured that was the case. I didn't know about let either so it is pretty much every instance of do that could be a do that is a do.

1:56 amalloy, it worked out though, because it led me to a realization about how functional programming owrks.

1:56 good night everybody

1:57 amalloy: heh

4:06 clgv: organization question: how do I get to run clojure-contrib with clojure 1.3.0-alpha4 by using leiningen?

4:07 changing version string "1.3.0-alpha4" for clojure.contrib in the project.clj doesnt work

4:08 robink: clgv: Different namespace.

4:08 clgv: robink: so which?

4:09 the information on the contrib sites is kinda sparse or well hidden ;)

4:10 robink: clgv: org.clojure.contrib.clojure-contrib/standalone I think.

4:10 clgv: You're using Leiningen, right?

4:10 clgv: yes

4:10 robink: clgv: It may just be org.clojure.contrib/standalone. I can check.

4:10 clgv: ok I'll try now :)

4:13 robink: seemed to work. except that the name is a bit odd: standalone-1.3.0-alpha4.jar

4:13 robink: clgv: Just org.clojure.contrib/standalone "1.3.0-alpha4"

4:13 clgv: Oh, hm

4:13 clgv: I would have expected "clojure" and "contrib" somewhere in it ;)

4:13 robink: clgv: Probably, there's a way to get it in lib/ as 'clojure-contrib-1.3.0-alpha4.jar'.

4:14 talios: thats a downside of the way stuart did the split up. contrib is now something like 60+ individual artifacts, or the combined "standalone".

4:14 clgv: robink: it's not a problem but odd ;)

4:15 robink: clgv: Holdon, I'm playing around. I did manage to get it installed as clojure-contrib-1.3.0-alpha4.jar somehow.

4:16 clgv: robink: I won't go anywhere for the next 8 hours ;)

4:16 robink: clgv: Heh, 'k

4:18 clgv: Oh, looks like I just had it stored as standalone.

4:19 clgv: The artifact namespacing is to delineate the full jar (entire contrib API) with individual libraries in the contrib project.

4:20 As indeed, the name of the .jar on build.clojure.org is standalone-1.3.0-alpha4.jar.

4:20 There may be a way to coerce Lein to rename the .jar for you, but that's a question for someone skilled at Lein, which I am not.

4:21 clgv: ok. maybe they should add clojure and contrib somehow - since it might get really strange in a project with lots of jars ;)

4:22 robink: clgv: Yes, it can, but I'm OK with the naming in its current state as I have little need of very unique namespacing (don't have a project that depends on another standalone-1.3.0 jar.

4:22 s/\./\)\./

4:22 sexpbot: <robink> clgv: Yes, it can, but I'm OK with the naming in its current state as I have little need of very unique namespacing (don't have a project that depends on another standalone-1).3).0 jar).

4:22 robink: haha, didn't know sexpbot would do that.

4:23 clgv: *g*

4:23 robink: Oh jeez, it assumes /g.

4:23 (plus I forgot about the dots in the version number)

4:24 s/\.$/\)\./ would have been a better regexp

4:24 * robink doesn't regexp often.

4:25 clgv: Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj

4:25 hmm guess it moved

4:26 robink: clgv: Depricated since clojure-contrib 1.2

4:26 clgv: what's the replacement?

4:26 robink: clgv: (according to http://clojure.github.com/clojure-contrib/#duck-streams.

4:26 Agh I did it again

4:26 s/\.$/\)\./

4:26 See if sexpbot fixes it this time.

4:26 hm, interesting

4:27 clgv: it cant since you wrote inbetween ;)

4:27 robink: Oh, OK

4:27 clgv: I dunno what the replacement is.

4:36 clgv: &(doc clojure.contrib.monadic-io-streams/read-lines)

4:36 sexpbot: java.lang.Exception: Unable to resolve var: clojure.contrib.monadic-io-streams/read-lines in this context

4:36 clgv: &(doc read-lines)

4:36 sexpbot: java.lang.Exception: Unable to resolve var: read-lines in this context

4:37 clgv: &(find-doc ("read-lines)

4:37 sexpbot: java.lang.Exception: EOF while reading string

4:37 Despite: most of duck-streams is in c.core or c.java.io i think

4:37 clgv: &(find-doc "read-lines")

4:37 sexpbot: ⟹ ------------------------- clojure.contrib.duck-streams/read-lines ([f]) Like clojure.core/line-seq but opens f with reader. Automatically closes the reader AFTER YOU CONSUME THE ENTIRE SEQUENCE. ------------------------- clojure.contrib.io/read-lines ([f]) Lik... http://gist.github.com/854399

5:06 raek: clgv: duck-streams has been replaced by clojure.java.io: http://clojuredocs.org/clojure_core/clojure.java.io

5:06 clgv: raek: thanks. got it running with it :)

5:24 raek: clgv: note that the features that has gotten promoted from contrib into clojure might behave slightly differently

5:24 clgv: so reading the throught the new docs can be a good idea

5:24 clgv: raek: reading in the file in lines works.

5:32 bennylu: are you using throw/ catch?

5:32 AWizzArd: bennylu: yes

5:33 You too? (:

5:33 bennylu: AWizzArd, i tried but it lead to massy code - dont you think?

5:33 as in clojure it not so nice to define new exceptions ..

5:34 AWizzArd: Stable programs sometimes do require this chatty code bits.

5:34 bennylu: we cannot throw "clojure" objects right?

5:35 AWizzArd: You can throw Exceptions.

5:35 raek: (this is being discussed http://dev.clojure.org/display/design/Error+Handling)

5:35 bennylu: thanks ill take a look

5:36 raek: the jvm exception system requires you to define new types to define new kinds of errors

5:57 tsdh: Hi. I just want to do my first clojure project using leiningen. I did lein new foo, but what's the correct way to specify local jars in the defproject's :dependencies vector?

6:07 I mean, I want to add a jar as dependency that's not available from some repository on the net, but which resides somewhere on my local filesystem.

6:18 cinch: tsdh: i've never done this, but the lein faq says how to do it https://github.com/technomancy/leiningen/

6:20 i hope they add a way to simply drop a jar in the /lib folder

6:20 tsdh: cinch: You mean, install it into the local maven repo using the command that's issued for non-downloadable deps?

6:21 Dropping into lib/ works, but get's erased when doing "lein deps" another time...

6:22 cemerick: cinch: "It's much better to get the dependency in a remote repository for repeatability reasons though."

6:22 just dropping stuff into /lib is sooo 2001 ;-)

6:23 clgv: tsdh: drop the additional jars in the lib folder and set: ":disable-implicit-clean true"

6:25 tsdh: clgv: Thanks, I'll try that.

6:29 bennylut: is there equivalance for "contains" in clojure (such that works for seq , vec strings etc.)

6:29 AWizzArd: ~seen rhickey

6:29 clojurebot: rhickey was last seen in #clojure, 3892 minutes ago saying: ataggart: thanks for that patch! I hope to get some time to look at it soon

6:30 AWizzArd: $(/ 3892 60.0)

6:30 ~(/ 3892 60.0)

6:30 clojurebot: :negative/num-1 + :positive/num-1 = :zero/zero

6:30 clgv: &

6:30 sexpbot: java.lang.Exception: EOF while reading

6:30 AWizzArd: wow

6:30 clgv: &(/ 3892 60.0)

6:30 sexpbot: ⟹ 64.86666666666666

6:33 clgv: Exception in thread "main" java.lang.NullPointerException, compiling:

6:33 how can that happen in clojure 1.3.0?

6:37 AWizzArd: clgv: have a look at the stacktrace

6:38 There is maybe some other class missing, or you forgot to add a (:gen-class) to your ns declaration

6:38 clgv: it fails in some ns-statements. and lein doesnt show the complete one

6:38 bennylut: how to check mail? -sexpbot- says that i have new message..

6:39 clgv: $mail

6:39 sexpbot: You have no messages.

6:39 clgv: -> $mail

6:39 bennylut: thanks

6:39 $mail

6:41 clgv: where would I need a (:gen-class) except in the ns with my Main method?

6:45 AWizzArd: clgv: (ns my.namespace (:use ...) (:require ...) (:import ...) (:gen-class))

6:45 clgv: yes, but I thought I only need it in my main-ns

6:46 AWizzArd: In the one that contains the -main fn that you want to be run on startup in your resulting .jar file.

6:46 clgv: the other files are normal clojure and do compile in 1.2

6:46 yes. there it is

7:02 raek: bennylut: contains? checks for keys in maps and elements in sets (and does so in constant time). you can use (some #{element} coll) if you want to scan a list in linear time

7:03 if you need to check for membership often, consider using a set as the data structure rather than a list or a vector

7:03 bennylut: raek, thanks - i never heard of some

7:03 clgv: error is: java.lang.NullPointerException: null

7:03 at clojure.lang.Compiler$ObjExpr.emitVar (Compiler.java:4482)

7:03 clojure.lang.Compiler$DefExpr.emit (Compiler.java:393)

7:03 bennylut: raek, dosnt vector is realy a map behindt the scenes?

7:05 raek, nevermind i forgot that the values in the map are not hashed only the keys ...

7:11 raek: a vector has a similar tree structure underneath

7:14 but the interface you access it through does not necessarily reveal that

7:14 contains? on a vector checks whether an index is in range

7:35 clgv: WARNING: defn already refers to: #'clojure.core/defn in namespace: Blubb, being replaced by: #'Blubb/defn

7:36 is this local symbol override not allowed in clojure 1.3 anymore?

7:37 I get the above exception right after this warning

7:37 AWizzArd: It seems that it is allowed, but just warns you. You did not explicitly exclude defn in your ns declaration.

7:38 clgv: but it directly breaks after this warning

7:39 the override is now modified to do nothing at all

7:39 cemerick: clgv: probably because you're wanting to use clojure.core/defn after you shadow it with something else

7:40 clgv: cemerick: it doesnt do anything now. but in general it will call clojure.core/defn explicitly later

7:42 I have this running with 1.2

7:45 cemerick: clgv: Are you attempting to use defn after you shadow it?

7:47 clgv: cemerick: you mean like (defn f [x] (* x (inc x))) or something?

7:47 cemerick: right

7:47 that form will use whatever you shadowed defn to be, not clojure.core/defn

7:49 clgv: exactly what it should

7:49 cemerick: so, any exceptions at that point are on you, is what I'm getting at ;-)

7:50 clgv: thats true. but I am trying to find out why. it works with 1.2 since several months

7:51 cemerick: paste your stack trace

7:51 clgv: ok I'll paste the stacktrace where my shadowed defn simply return nil

7:53 http://pastebin.com/2Nxghj7r

7:54 cemerick: I guess you can simply skip to the cause part

7:56 cemerick: clgv: That's not very helpful. Shadowing defn and using that shadowed version appears to be just fine. https://gist.github.com/cf5a740be05fd99b5342 Perhaps paste what you're shadowing defn with?

7:56 clgv: I create a macro that shadows defn

7:57 cemerick: Well, it sounds like it needs to be tweaked for 1.3 then.

7:57 clgv: probably. but there is no general bigger change in 1.3 that might lead me directly to the problem?

8:00 cemerick: 1.3 has a number of breaking changes: for starters, vars are no longer dynamic by default and primitive support has been added http://dev.clojure.org/display/doc/Enhanced+Primitive+Support

8:00 clgv: ^^

8:04 bennylut: cemerick, vars are no longer dynamic?

8:04 cemerick: bennylut: in 1.3, not by default

8:04 clgv: yeah. I guess changes related to macros would be the first starting point

8:04 bennylut: that means that they cannot be redefined?

8:04 cemerick: no, redefinition is unaffected

8:05 If you plan on binding a var, tack ^:dynamic true metadata onto the var's symbol

8:05 bennylut: ah ok.. thanks

8:06 clgv: cemerick: you know what Compiler.emitVar means semantically?

8:07 cemerick: That's an implementation detail. I believe it's specifying a constant referring to a var in bytecode.

8:08 clgv: hm the strange thing is, that I can "use" the ns where the error occurs in "lein repl" with clojure-1.3.0-alpha4

8:09 hmm well I skip it for now

8:18 tsdh: When I want to create a clojure function wrapping some java lib, and on the java side I have methods like X.foo(), X.foo(A), X.foo(A, B) where omitting a paramerter is equvialent to passing null, is there something better than having a foo function with 3 argument lists? I guess, something like keyword parameters would be handy...

8:20 AWizzArd: tsdh: you can use indeed such keyword args

8:20 tsdh: Found that: http://groups.google.com/group/clojure/msg/51bb53ca077154f8

8:21 naeu: cemerick: what does it mean that vars are no longer dynamic? Does it mean that we won't be able to rebind them in the REPL by default?

8:21 cemerick: naeu: right

8:21 tsdh: AWizzArd: Should I use that, or is something like that in core in the meantime?

8:21 AWizzArd: tsdh: einfach mit Destructuring: (defn foo [a b {:keys [x y z]}) (prn a b x y z))

8:21 naeu: interesting

8:22 cemerick: Actually, redefining a var as dynamic after the fact would be simple.

8:22 naeu: ok, that was going to be my next question

8:22 AWizzArd: tsdh: Better not use what Rich posted there. That is more like internal stuff and now implicitly available, as you can see in my example.

8:22 cemerick: The point is that vars don't need to be dynamic 99% of the time, and there's a big performance hit for supporting it 100% of the time.

8:22 tsdh: AWizzArd: Ok, I'll try that out.

8:22 AWizzArd: But 3 years ago, when Rich posted that, it was a good way.

8:23 naeu: I'm currently doing a lot of music live coding and redeffing vars is a key aspect

8:23 tsdh: AWizzArd: But with your suggestion the caller needs to pass an explicit map, right?

8:23 cemerick: naeu: redefining vars is not affected at all.

8:24 only using binding and set! are affected

8:24 naeu: cemerick: oh ok, perhaps I don't get what being dynamic means in this context then

8:25 so what's the typical usecase for set! on a var?

8:25 I don't think I've ever seen that in the wild

8:25 cemerick: naeu: it's a more esoteric feature :-)

8:26 naeu: :-)

8:26 cemerick: The real power of dynamic vars and binding.

8:27 naeu: and with binding, I didn't realise that it was actually temporarily changing the var's val, I thought it was just modifying the lexical environment of the enclosed forms such that any reference to the original var would be intercepted by the temporary val

8:27 and therefore leaving the original var untouched

8:27 dnolen: naeu: and it's thread local.

8:28 naeu: sure, so I still don't really get what the difference between a static and dynamic var is

8:28 cemerick: binding will fail

8:29 AWizzArd: tsdh: no, the caller does not have to pass in a map

8:29 pyr: hi

8:29 naeu: ok, so it's really an implementation issue w.r.t. 'dynamic' vars

8:30 AWizzArd: tsdh: but right, I forgot a & symbol. The example should be: (defn foo [a b & {:keys [x y z]}) (prn a b x y z))

8:30 (foo 10 20 :y 30)

8:30 pyr: does anyone know why (class "foo") yields java.lang.String but (isa? String "foo") or (isa? java.lang.String "foo") yields false

8:30 cemerick: naeu: https://gist.github.com/a60e9df0af7ccdeac539

8:30 naeu: you can still redefine them (which to me has always been the notion of dynamic that I understood)

8:30 tsdh: AWizzArd: Ah, great, works.

8:31 naeu: but you won't be able to rebind or set! them without declaring something first

8:31 stuartsierra: pyr: ` isa?` is not the same as `instanceof` in Java.

8:31 cemerick: right

8:31 AWizzArd: tsdh: you can also specify default values: (defn foo [a b & {:keys [x y z] :or {z 88}}] (prn a b x y z))

8:31 naeu: cemerick: cool

8:31 stuartsierra: ,(instance? String "foo")

8:31 clojurebot: true

8:31 stuartsierra: ,(isa? String CharSequence)

8:31 clojurebot: true

8:32 pyr: ah ok

8:32 ,(count [1 2 3])

8:32 clojurebot: 3

8:32 pyr: didn't know clojure bot :)

8:32 naeu: will Clojure 1.3 go through a beta phase at somepoint?

8:32 pyr: stuartsierra: thx

8:32 tsdh: AWizzArd: Oh, this is superb! I just found out that passing null to the java method won't do, so I started to write conditionals on the existance of keyword params, which is just as bad as 3 different arg lists. :-)

8:32 stuartsierra: naeu: yes

8:37 http://dev.clojure.org/display/design/Release.Next+Planning describes the state of the upcoming release

8:46 clgv: stuartsierra: not much details over there ;)

8:47 stuartsierra: yeah, true

8:47 Check the links to tickets, though

8:48 clgv: 19 open tickets looks not too bad - but I don't know how much complexity that small number hides ;)

8:50 stuartsierra: clgv: The top features for Release.Next are 1) bugs in new numeric stuff; and 2) defrecord improvements

8:53 clgv: hmm I think I didn't read about it yet - are there developers that work fulltime on clojure?

8:54 stuartsierra: no

8:55 Clojure/core aims to put 20% of our work time toward Clojure.

8:55 clgv: ah thanks for that info :)

8:56 chouser: stuartsierra: so there's only one Clojure book left that doesn't have one of it's authors working for you guys

8:57 I don't have a point, just seems worthy of a remark. :-)

8:57 stuartsierra: chouser: That's Amit R., right?

8:57 chouser: yep

8:57 stuartsierra: Where's he? San Fran?

8:57 chouser: I think so

8:58 stuartsierra: See, too far away.

8:58 chouser: But I bet he could use a co-author. What's Bedra doing these days. ;-)

8:58 clgv: :D

8:58 stuartsierra: Heh, writing an article about JSVC.

9:00 cemerick: chouser: we're still resisting the NC evil empire ;-)

9:00 I'd probably just drive people nuts anyway, so it's better if we just stay friends. :-P

9:01 chouser: cemerick: Fogus lasted until about week before his book went to press. You've got a while.

9:01 cemerick: chouser: I may be fundamentally unemployable.

9:02 chouser: cemerick: hmmm, I guess I could believe that. :-D

9:02 * cemerick makes a faux sad-face :-P

9:02 cemerick: :-D

9:02 chouser: So, anyone want to take bets on how long before we see akka for Node.js?

9:02 You've all seen that akka now has Clojure-style STM?

9:03 dnolen: ick

9:03 stuartsierra: chouser: Yep, they even admit they stole it from Clojure ;)

9:03 dnolen: not Akka w/ STM (knew about that)

9:03 cemerick: The same things that made me make a choice in the rich vs. king dichotomy probably make me difficult to work with in someone else's workplace.

9:03 chouser: yep. All the benefits of Clojure without the nasty syntax.

9:03 cemerick: akka seems like it's got everything for everyone

9:04 * cemerick doesn't mean that in a good way

9:05 stuartsierra: cemerick: agreed, it's the kitchen-sink approach

9:06 chouser: did they include something that Clojure doesn't?

9:06 stuartsierra: chouser: configurable thread pools

9:07 chouser: ok

9:07 cemerick: not exactly a watershed feature

9:08 stuartsierra: yeah

9:08 * cemerick is reminded to lean on that for 1.3/2.0

9:08 cemerick: stuartsierra: can we get the super-secret skinny on the 1.3/2.0 poll results, or is that super-super-secret?

9:09 stuartsierra: Basically an even split.

9:09 cemerick: I should have ramped up that bot more. :-P

9:10 stuartsierra: Basically, everyone likes Semantic Versioning, but no one likes the consequence.

9:10 chouser: heh

9:10 cemerick: Unprincipled sycophants.

9:11 stuartsierra: cemerick: Isn't that the definition of open-source communities? ;)

9:12 chouser: there have been breaking changes within 1.x already. Seems like there's no principle to stand on really.

9:12 cemerick: chouser: nothing of consequence really though, right?

9:12 stuartsierra: Amen, brother.

9:12 chouser: is this change "of consequence"?

9:13 * dnolen is w/ chouser

9:13 chouser: I really have no strong opinion.

9:13 stuartsierra: Technically, no public APIs broke from 1.0 to 1.1 and 1.1 to 1.2.

9:13 cemerick: chouser: In relative terms, I don't know. Do you remember the breaking changes in 1.x?

9:14 stuartsierra: Some unspecified behavior changed.

9:14 chouser: "2.0" will make a bigger news splash for about a week. After that, I can't imagine anyone really caring.

9:14 I'm pretty sure things were deprecated. ^

9:14 stuartsierra: Deprecated, yes, but not broken.

9:15 cemerick: well, that's what's supposed to happen before they're removed

9:15 chouser: ^ does something completely different

9:15 cemerick: Anyway, i'm sure Rich already had an opinion and probably won't be swayed in either direction by polls and ML posts.

9:16 * chouser nods

9:17 chouser: just checked. If you have ^ in your code, Clojure 1.0 will act very differently than Clojure 1.2. *shrug*

9:17 clgv: reading "deprecated", I wonder if there will be some kind of mechanism that warns the programmer that he is using deprecated functions?

9:18 stuartsierra: chouser: Yes, but that's forward compatibility :)

9:22 chouser: clgv: in general, warnings are printed, but there's no cohesive mechanism yet.

9:22 clgv: chouser: I didn't see any when using clojure.contrib.str-utils and others in 1.2

9:23 stuartsierra: clgv: All of clojure.contrib.* is essentially deprecated now.

9:23 clgv: stuartsierra: great :P

9:23 stuartsierra: http://dev.clojure.org/display/design/Common+Contrib+Build

9:23 chouser: clgv: hm, good point. Contrib has been less rigorous about printing deprecation warnings.

9:24 clgv: hm yeah I noticed when wanting to get clojure.contrib 1.3.0 with leiningen. ;)

9:24 but no problem, I'll stay with 1.2 for the time being until the 1.3/2.0 release

9:30 amac: anyone know why ring.middleware.wrap-params won't pull :form-params (or any params) out of something like <form name="fname" method="post" action="/myhandler"><input type="text" name="bleh" value="testval"/><input type=submit value="send!"/></form>

9:30 I must be missing something simple

9:30 dnolen: stack splitting in GCC, http://gcc.gnu.org/wiki/SplitStacks, any other langs that people have used that implement this?

9:30 amac: I get the request to the handler just fine, but wrap-params isn't parsing the post form

9:52 bennylut: is there a way to set! a var defined in let? ( like: (let [x 5]

9:52 (do (set! x 7)

9:52 x)) )

9:53 dnolen: bennylut: let doesn't define vars. it defines locals. and you can't set locals.

9:53 amac: you can recur with updated values though

9:54 bennylut: amac, recur is a good option, but i will restart all what i done..

9:55 dnolen, so how can i handle state if i need to (not globaly)

9:58 amac: bennylut: hmm... perhaps wrap your state with an agent to control state? http://clojure.org/agents

9:58 dnolen: bennylut: you could use an atom. but it's best to see if you can just find a functional solution. not always possible to do cleanly - but that's rare I think.

9:59 ,(let [x (atom 5)] (reset! x 7) @x)

9:59 clojurebot: 7

9:59 bennylut: dnolen, amac, thanks ill take a look in atoms and agents :)

10:00 * dnolen thinks Clojure may be a 5th generation computer.

10:01 raek: bennylut: recur can "jump pack" to a point closer to the recur call than the function start if you use 'loop'

10:02 bennylut: all this depends on what you are trying to do. using concurrency primitives (atoms/refs/agents/vars) for basic computations is usually unideomatic in clojure

10:03 bennylut: raek, yes i know - the case is that i want to parse some text and to do lookahead, when some times after "looking ahead" some vars need to be changed...

10:03 but i think i will use atoms for that

10:04 raek: lookahead sounds like a perfect fit for (lazy) sequences

10:05 (if (= (nth elements 3) "foo") (do-one-thing elements) (do-another-thing elements))

10:06 bennylut: i need to do somthing like (let [x (heavy-calc) y (somthing-depend-on-the-heavy-calc)] and so i want during the "heavy calc" assign y

10:07 raek: bennylut: can't you just use an if in the right hand side?

10:07 (let [x (if (neg? x) (-x) x)] ...)

10:07 this looks somewhat like assignment, but really isn't

10:08 bennylut: raek, it not depend on the value of x but durring the calculation of x y can be calced reletivly costlessly ..

10:08 raek: perhaps you could use destructuring

10:09 bennylut: destructuring??

10:09 raek: (let [[x y] (heavy-calc)] ...)

10:09 and make heavy-calc return a vector/list of two things

10:09 bennylut: i didnt know i can do that - this is just what i needed

10:09 raek, great! thank you very much

10:11 ev4l: good morning everyone. i think i may be facing a common clojure error, but still haven't figured it out.

10:12 i'm intending to use the defvar- macro from 'clojure.contrib.def', but when i require it, the environment whines telling that the 'clojure.contrib.def' namespace is inexistent.

10:12 (throws a ClassNotFoundException)

10:12 i suspected the possibility of clojure-contrib not being on the classpath, but it is

10:12 raek: ev4l: that sounds like you do (require clojure.contrib.def) instead of (require 'clojure.contrib.def)

10:13 ClassNotFoundException means that a Java class could not be loaded, and if you don't quote the namespace name, it will be interpreted as a name of a class

10:14 ev4l: raek: that's it =]

10:14 raek: it worked. I knew that was something stupid...lol

10:14 raek: thx alot

10:14 raek: (if you have the require in your ns form it should look like (ns foo (:require clojure.contrib.def)) though. i.e. no quote and : before require)

10:14 amac_: I do crap like that constantly

10:15 TimMc: chouser: Eep, I think I didn't see #8 before! My bad.

10:15 gtrak: hmm, damn netsplits

10:16 clojurebot: destructuring is http://clojure.org/special_forms#let

10:21 clgv: what is a netsplit anyway?

10:22 TimMc: Two IRC servers lose a link, I think.

10:22 clgv: why do they? did they forget to pay their ISPs?

10:22 :P

10:23 TimMc: Naw, just transient network errors.

10:23 Wikipedia actually has a decent article on this.

10:25 clgv: uff

10:25 shouldnt have loaded the wikipedia article, eh?

10:28 TimMc: How many new tabs do you have open now? :-P

10:30 gtrak: in counterclockwise, when debugging, what do you guys use for the source lookup path?

10:31 thegabble: Hi all, I had a newbie question... if I have absolutely no knowledge of Java am I going to find it impossible to pick up Clojure? Would it be better to tackle another LISP/Scheme?

10:32 gtrak: you don't know java nor a lisp?

10:32 thegabble: I totally missed the Java revolution as my CompSci was pretty much Pascal, C, Ada and professionally it's been Python and Fortran

10:33 Clojure seems really cool so was going to give it a go… but the Java thing scares me :)

10:33 stuartsierra: thegabble: Java knowledge is not a strict prerequisite for learning Clojure, but to do any real work in the language you will at least need to learn the common Java APIs for things like I/O.

10:33 gtrak: you can pick up a working knowledge of java in a couple weeks, read effective java and look over the apis

10:33 thegabble: Ahhh… that was the feeling I was getting from everything I've read/seen

10:34 Great… thanks for the info gtrack & stuartsierra

10:34 stuartsierra: 'welcome

10:35 raek: thegabble: my experience is that you are expected to at some point learn how to call java methods from clojure. for instance know that when you see http://download.oracle.com/javase/6/docs/api/java/lang/String.html#toUpperCase(), you can do (.toUpperCase "foo") in clojure

10:36 and that most often, you don't need to know how to write code in java

10:36 thegabble: raek: but you do need to know the API's right? so that would be a good place to start

10:37 * raek notes: TODO - make a blog post about the Java classes clojure programmers should know about

10:38 raek: thegabble: you don't need to know much at all about the java api to learn the core clojure language

10:38 Pisketti: I'd like to read that

10:39 raek: thegabble: but there are areas (for instance I/O) where you usually just use java directly

10:40 gtrak: actually knowing java well wouldn't hurt you, but depends on your timeframe what's most useful

10:40 thegabble: Just started working my way through 'Programming Clojure' and was wondering how much trouble I was getting myself into :)

10:41 It's more for fun/trying something new/thinking new ways so time frame is long

10:41 Thanks for the info guys!

10:44 clgv: a strategic thought: I have complex objects that are constructed within a thread each and then will be used unaltered in the main thread. would it be a good choice to implement these objects as deftype and to use transients for their parts which are made persistent! when the thread finished construction?

10:47 stuartsierra: clgv: perhaps, but remember that transients still aren't mutable in-place.

10:48 clgv: stuartsierra: that restriction means in detail? does a (transient (vector (range 10))) grow wenn I'll do assoc! ?

10:48 I mean when I do assoc in the range 0...9

10:49 stuartsierra: It just means when you call (assoc! …) you have to use the return value.

10:49 The transient thing you called assoc! on is no longer valid.

10:49 clgv: oh.

10:49 stuartsierra: For example, you can't do (dotimes [i 10] (assoc transient-thing i ...))

10:50 s/assoc/assoc!/

10:50 sexpbot: <stuartsierra> For example, you can't do (dotimes [i 10] (assoc! transient-thing i ...))

10:50 clgv: in general or in special cases?

10:50 stuartsierra: In other words, transients don't give you a free pass on writing your code in a functional style.

10:50 You have to use the transient "!" functions the same way you use their non-transient counterparts.

10:51 They're just slightly more efficient.

10:51 clgv: ok

10:51 stuartsierra: And you can't use an old value once you've called a transient "!" function on it.

10:51 clgv: the strange thing is, that I have a case where it worked

10:52 stuartsierra: Sometimes it will, but it's not guaranteed.

10:52 clgv: yeah I'll change it

10:53 stuartsierra: Rule of thumb: write your code without transients first, then add the "!" characters to make it transient when you're sure only one thread needs access to those data structures.

10:54 clgv: ok. good one

10:55 rindolf: Hi all. My message to the Google Groups did not arrive there yet. I am shlomif@iglu.org.il / Shlomi Fish.

10:56 stuartsierra: new members are moderated - it will show up as soon as a moderator has a chance to look at it

10:57 rindolf: stuartsierra: yes, I figured out something like that.

10:58 OK, let me pastebot the message text, in any case.

10:58 stuartsierra: It will get to the list eventually, just be patient.

11:00 TimMc: thegabble: Note that some of the syntax in Programming Clojure is out of date -- nothing major, but something to be aware of. (It was written against Clojure 1.1.)

11:00 rindolf: stuartsierra: yes, OK.

11:00 http://www.shlomifish.org/Files/files/text/clojure-script.mbox - here it is if you're interested.

11:01 thegabble: TimMc: Thanks for that, good to know.

11:02 TimMc: The only thing that specifically comes to mind is the behavior of ^ for metadata.

11:03 Anyone know if Stu H. hangs out in this channel>

11:05 amac_: TimMc: all the cool people hang out here ;)

11:05 TimMc: heh

11:05 cemerick: TimMc: rarely

11:06 TimMc: OK. Was just wondering if his book will be updated with notes on 1.2 syntax.

11:07 clgv: TimMc: would be only worth it if 1.3 will still take a lot of time, I guess

11:21 TimMc: Netsplit over?

11:23 ,ping

11:23 clojurebot: java.lang.Exception: Unable to resolve symbol: ping in this context

11:23 TimMc: Oh good.

11:33 tsdh: Hi, I'm suffering from a strange defmulti dispatching problem. Somehow, the dispatch function complains about too many params. But a totally similar defmulti works fine. I've restarted swank, but the error persists. And ideas? http://pastebin.com/UPwvpju3

11:45 Ah, got it. A missing & in the parameter list. I needed more than 30 minutes of staring at the code to spot that error. :-)

12:52 fliebel: Is there a way to make a for parallel?

13:01 dnolen: fliebel: still plugging away at the logos bug. I think I have the solution but it turned out there are other things that needed fixing as well. I'm amazed that this issue didn't crop up with any of the other programs like flatten-o, append-o or zebra-o.

13:03 opqdonut: fliebel: not as such. use map or make your own macro

13:06 fliebel: dnolen: It almost seems one needs to have the precision of a watchmaker to implement miniKanren.

13:09 dnolen: fliebel: haha, perhaps. but I think this really is the last issue. It's actually the last bit about the original miniKanren implementation I didn't fully understand.

13:09 fliebel: opqdonut: You know how these executor pools work?

13:10 dnolen: ,(reduce concat (pmap identity (partition 2 [1 2 3 4 5 6])))

13:10 clojurebot: (1 2 3 4 5 6)

13:10 dnolen: fliebel: the important thing is that there needs to be enough work. so you need to pick a proper batching size ^

13:11 fliebel: dnolen: Well, since I have only few cores, a few huge chunks of work seems appropriate.

13:13 * dnolen loves delay

13:13 fliebel: delay…? ##(doc delay)

13:13 sexpbot: ⟹ "Macro ([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls."

13:14 dnolen: fliebel: delay will probably be part of my solution to the overflow bug.

13:15 does anybody else ever feel the need for an interleave that continues after some seqs have been exhausted?

13:16 (weave [a b c d] [e f]) ;; (a e b f c d)

13:18 fliebel: dnolen: No, but I guess it is useful for interleaving solution streams :)

13:18 dnolen: fliebel: ;)

13:24 opqdonut: fliebel: oh, I misunderstood "parallel"

13:24 fliebel: I thought parallel insted of nested traversal of the sequences

13:24 sorry

14:22 TimMc__: OK, is freenode done thrashing yet?

14:22 lucian: TimMc: maybe it's GCing :)

14:46 TimMc: Man, I can't even get to the freenode website from here.

14:54 amalloy: ieure: heh, i sent a link to php-repl around to my coworkers. the php programmers are like "meh", but the ruby programmers who have to write occasional php are like "zomg plz give"

15:10 ohpauleez: amalloy: haha, the first thing I picked up when I had to start doing php at my current job was php-repl

15:10 the same thing happened to me

15:10 I was like, "Guys, this is rad, finally, a repl"

15:10 and the php devs just shrugged

15:10 amalloy: ohpauleez: facebook's phpsh looks like it has way more awesome features, excep the one critical feature of "it works"

15:11 ohpauleez: haha, yes, I found that to be true as well

15:11 mattmitchell: i'm trying to figure out how to write a test, that uses an external web service as it's datasource. how can i test without actually calling the service. i realize it'd be mocking, but how in clojure?

15:12 amalloy: $google clojure mock unit test

15:12 sexpbot: First out of 5400 results is: Unit Testing in Clojure

15:12 http://nakkaya.com/2009/11/18/unit-testing-in-clojure/

15:12 ohpauleez: Raynes: I'm working on clj-bitbucket right now, just a heads up if you wanted to roll it into sexpbot

15:12 amalloy: ^

15:12 amalloy: hm, doesn't mention mocking. lame

15:13 spewn: mattmitchell: There does exist http://richhickey.github.com/clojure-contrib/mock-api.html

15:13 amalloy: mattmitchell: you can use http://richhickey.github.com/clojure-contrib/mock-api.html or https://github.com/marick/Midje

15:13 mattmitchell: excellent :) i'll try those out.

15:13 thank you

15:13 amalloy: ohpauleez: bitbucket the scm system?

15:14 ohpauleez: yeah, the api to bitbucket

15:14 which is like the api to github

15:15 spewn: Midje looks sweet; I wish I learned about this earlier.

15:15 TimMc: chouser: Point #8 does seem to cover it, must have missed it before. (Resending because I'm on a stable server now.)

15:19 amalloy: TimMc: good choice to resend, cause i haven't seen that message yet :P

15:19 TimMc: Yeah, looking back, the channel was suspiciously quiet. :-)

15:19 amalloy: ohpauleez: i'm not interested in bitbucket myself but i've echoed you to #sexpbot so if he's interested he can

15:20 ohpauleez: cool

15:20 amalloy: I also have little interest in it, but I needed it to grab clojure lib stats... so alas

15:20 amalloy: hah

15:23 semperos: amalloy: where can I get the php-repl you guys are talking about? I see a few tools upon Googling

15:23 amalloy: semperos: it's on github

15:23 $google github ieure php-repl

15:23 sexpbot: First out of 14 results is: ieure/php_repl - GitHub

15:23 https://github.com/ieure/php_repl

15:23 semperos: k

15:23 that's the first I found, thx

15:33 stuartsierra: Hey rhickey: https://gist.github.com/855659

15:33 This works, but I don't know if it's usable in practice.

15:34 It depends on how quickly the PhantomReference gets garbage-collected.

15:35 TimMc: I don't see rhickey...

15:35 stuartsierra: eh, ok. It was his suggestion.

15:36 TimMc: (I have JOIN/PART/NICK/QUIT hidden, so... I should fire up my alt.)

15:38 there

15:42 nawk: is clojure a Java program?

15:42 stuartsierra: nawk: The compiler is written in Java, yes.

15:42 amalloy: nawk: it's more of a java library

15:43 though "platform for writing programs in java" is more useful than either definition imo

15:43 gfrlog: you use clojure to write java?

15:44 nawk: so I run java.exe clojureComputer.class <clojure_source> to compile a program?

15:44 gfrlog: (public class Amalloy (public static void main (String args[])))

15:44 amalloy: gfrlog: the output of both languages is jvm bytecode

15:44 stuartsierra: nawk: Where are you seeing clojureComputer.class?

15:44 gfrlog: amalloy: that's how I would have put it :)

15:46 nawk: stuartsierra, I didn't. Mmm.. how do I run the compiler than?

15:46 it's said to run under the JVM right?

15:46 stuartsierra: yes

15:46 You can run "java -cp clojure.jar clojure.main" to start the Clojure REPL (interactive console)

15:48 nawk: stuartsierra, that's what I mean, when I asked if it's a Java program :-)

15:48 s/mean/&t/

15:48 sexpbot: <nawk> stuartsierra, that's what I &t, when I asked if it's a Java program :-)

15:49 gfrlog: I'm sure &t is an emoticon, but I don't know what for...

15:49 nawk: meant*

15:49 TimMc: Some regex engines use a bare ampersand to mean "include match here".

15:49 nawk: gfrlog: I was using the vim replacement, sorry my bad

15:49 gfrlog: nawk: I know; I was making a worthless joke

15:50 TimMc: Sed might not, or might want it escaped, or might use \0, etc.

15:50 ah

15:50 gfrlog: TimMc: that right there is a good summary of why I can't ever figure out how to use a regex in bash

15:51 TimMc: I always have to build up my regexes a piece at a time because of that.

15:51 gfrlog: I just open up a ruby prompt most of the time

15:52 if that's not sufficient, I convince myself that I don't have to do whatever I was trying to do

15:57 tsdh: Hi. Does contains? only work with clojure data types? At least (contains? [(vertex g 1)] (vertex g 1)) ==> false

15:57 jweiss: you could make it work with other datatypes using protocols.

15:59 tsdh: jweiss: Ah, ok. I'll have a look at that. But IMHO at least its docstring should mention that it won't just work for anything.

15:59 ah, everything.

15:59 TimMc: tsdh: contains? is a little weird I think

15:59 jweiss: tsdh: well, i am not sure how it works, but you'd at least have to have some kind of "equals" implemenntation

15:59 TimMc: &(contains? [3 4] 3)

15:59 sexpbot: ⟹ false

16:00 TimMc: &(contains? [3 4] 0)

16:00 sexpbot: ⟹ true

16:00 jweiss: wow that *is* weird

16:00 TimMc: tsdh, jweiss: It looks at keys, not vlues.

16:00 stuartsierra: "contains?" works on sets and maps, not sequences

16:00 jweiss: right, those are indexes

16:00 technomancy: should have been called contains-keys?, but too late for that now

16:00 stuartsierra: indeed

16:00 tsdh: Oh, that makes it clear.

16:01 So what's the proper membership check for seqs?

16:01 jkkramer: ,(some #{2} [1 2 3])

16:01 clojurebot: 2

16:01 jweiss: i think you use some

16:02 tsdh: Oh, what an obvious name! :-)

16:02 TimMc: &(.contains [3 4] 3)

16:02 sexpbot: ⟹ true

16:02 TimMc: &(.contains [3 4] 0)

16:02 sexpbot: ⟹ false

16:02 TimMc: How about that?

16:03 gfrlog: (defn seq-has? [el coll] (boolean (some #{el} coll)))

16:04 nawk: okay, I see how it being a "platform for writing programs in java"

16:05 jweiss: how is it a platform for writing programs "in java"? You're not writing them in java :) you're writing them to be run on the jvm perhaps.

16:07 gfrlog: jweiss: I pointed that out too 10 minutes ago

16:08 jweiss: ah yes you did :)

16:09 sorta like saying you're hiring a chinese translator so you can write letters to your chinese girlfriend in chinese.

16:09 gfrlog: that is a strange thing to say

16:10 jweiss: hehe

16:10 technomancy: except the word "java" means about 4 distinct things, including a stock ticker

16:10 jweiss: i suppose it could be put better than that

16:10 gfrlog: technomancy: very good.

16:10 I suppose we ought to stop using the word 'Java' then

16:10 what'll we call the language?

16:10 jweiss: yeah but "writing programs in java" narrows the meaning a bit

16:11 technomancy: true

16:11 jweiss: i think i'd name it "Ceremony"

16:11 gfrlog: church?

16:11 jweiss: church is good

16:12 lots of repeating yourself in both

16:12 amalloy: TimMc: i think hava's regex flavor uses \0 as "include match here"

16:12 gfrlog: amalloy implicitely suggests calling it 'hava' apparently

16:12 amalloy: s/hava/\0(java)

16:12 sexpbot: <amalloy> TimMc: i think 0(java)'s regex flavor uses \0 as "include match here"

16:12 amalloy: damn

16:12 * technomancy thinks alonzo's name should be respected more than that

16:13 amalloy: s/damn/$0 it all

16:13 sexpbot: <amalloy> damn it all

16:13 TimMc: \o/

16:14 gfrlog: oh I have a name suggestion

16:14 Static Void

16:16 TimMc: >_<

16:16 dsantiago: Is there some way to prevent a symbol from being namespace resolved in a syntax-quote?

16:16 gfrlog: with ~' maybe?

16:17 amalloy: yeah that's the one

16:17 dsantiago: gfrlog, nope, fraid not.

16:17 gfrlog: amalloy endorsed it stronger than I did. it's his fault.

16:17 amalloy: dsantiago: gfrlog is totally right. if it isn't working you have some other issue

16:18 dsantiago: Hmkay.

16:18 amalloy: &`[a 'a ~'a]

16:18 sexpbot: ⟹ [clojure.core/a (quote clojure.core/a) a]

16:18 dsantiago: So, if I have nested syntax-quotes, how do you make that work?

16:19 amalloy: &``~'~'a

16:19 sexpbot: ⟹ (quote a)

16:19 amalloy: &``~~'a

16:19 sexpbot: ⟹ a

16:19 gfrlog: my head is hurting

16:19 dsantiago: Ah, yes, there we go.

16:19 Thanks!

16:19 amalloy: $google macro writing macros amalloy

16:19 sexpbot: First out of 144 results is: Clojure: macro-writing macros

16:19 http://hubpages.com/hub/Clojure-macro-writing-macros

16:19 gfrlog: &``a

16:19 sexpbot: ⟹ (quote clojure.core/a)

16:20 amalloy: dsantiago: my article on the topic. doesn't address your specific issue but is probably good reading anyway

16:20 gfrlog: &'`a

16:20 sexpbot: ⟹ (quote clojure.core/a)

16:20 dsantiago: Yeah, I'll read this.

16:20 I was looking at the Clojure wikibook, which has some good explanation of syntax-quote and unquote.

16:21 amalloy: dsantiago: link? there are some things i have to puzzle out every time, like the order in which nested unquotes get resolved

16:22 dsantiago: amalloy: http://en.wikibooks.org/wiki/Learning_Clojure/Reader_Macros

16:23 gfrlog: hmmm...those references to core functions like (clojure/deref ...) should be (clojure.core/deref ...), right?

16:23 any reason I shouldn't change it?

16:23 I see it uses clojure.core down the page

16:24 amalloy: gfrlog: yeah, you probly should. though there's not much point; you could structure your requires so that `foo resolved to clojure/foo

16:24 gfrlog: yes

16:24 wait really?

16:25 the reader pays attention to your namespaces requires?

16:25 amalloy: &(require '[clojure.set :as set])

16:25 sexpbot: ⟹ nil

16:26 amalloy: &(use 'clojure.set)

16:26 sexpbot: ⟹ nil

16:26 amalloy: &`union

16:26 sexpbot: ⟹ clojure.core/union

16:26 amalloy: hm

16:26 gfrlog: wait maybe I'm asking the wrong question...do these things get resolved to vars?

16:26 amalloy: &`intersection

16:26 sexpbot: ⟹ clojure.core/intersection

16:26 gfrlog: I would think so....

16:26 TimMc: amalloy: Weird...

16:26 amalloy: i guess i can't make it work right

16:27 i thought there was a way to do it, but i could be wrong

16:27 gfrlog: ,(read-string "'a")

16:27 TimMc: &(require '[clojure.contrib.math :as m])

16:27 sexpbot: java.io.FileNotFoundException: Could not locate clojure/contrib/math__init.class or clojure/contrib/math.clj on classpath:

16:27 clojurebot: (quote a)

16:27 gfrlog: ,(read-string "`a")

16:27 clojurebot: (quote sandbox/a)

16:27 gfrlog: ooh interesting

16:27 &(read-string "`a")

16:27 sexpbot: ⟹ (quote sandbox11264/a)

16:28 amalloy: gfrlog: syntax-quote necessarily has to be aware of your imports, otherwise it would turn `(reader f) into myns/reader instead of clojure.java.io/reader

16:28 gfrlog: but imports can be changed dynamically

16:28 TimMc: Whoa... I didn't realize the difference was important.

16:28 I thought syntax-quote was just if you needed unquote.

16:29 gfrlog: TimMc: yep it's weird

16:29 amalloy: TimMc: that is the case in common lisp

16:29 TimMc: Ah, OK.

16:29 amalloy: clojure gives you namespace resolution and automatic gensyms in syntax-quote

16:29 TimMc: I learned PLT Scheme.

16:30 Is Clojure different from most lisps in that regard?

16:30 amalloy: as far as i know, yes

16:31 TimMc: ...and there it is on http://clojure.org/lisps, which I probably should re-read every week.

16:31 "syntax-quote does symbol resolution, so `x is not the same as 'x"

16:31 Should that be namespace resolution instead of symbol resolution?

16:32 I don't think I would have understood it until today.

16:32 amalloy: TimMc: if there's a difference, it's not interesting enough to merit a change

16:33 gfrlog: how do you know it's not interesting if you don't know what the difference is?

16:33 amalloy: heh

16:33 TimMc: New approach: Read all those clojure.org pages, but this time stop and figure out anything I don't understand immediately.

16:34 amalloy: gfrlog: the resolution being talked about is "resolving symbols into namespaced symbols". both terms seem accurate to me

16:34 TimMc: "The read table is currently not accessible to user programs" <-- starting with that.

16:34 gfrlog: amalloy: very good

16:34 amalloy: I never should have said anything. I am ashamed.

16:35 TimMc: Is this talking about reader macros?

16:35 amalloy: TimMc: yeah

16:35 i think so anyway

16:38 devn_: 'lo all

16:38 fliebel: hi devn

16:38 devn_: oh no my nick changed so now i need to part and rejoin :(

16:39 amalloy: god i want (partial) and some sort of non-verbose map/array syntax in php please

16:40 fliebel: Hah! I found a way to make for parallel. I made the return value a anonymous function, and wrapped it in (pmap #(%)) :D

16:40 gfrlog: amalloy: write the clojure bootstrap code in PHP, complete the clojure-in-clojure project, and there you go

16:41 amalloy: gfrlog: pharen sounds like an easier approach

16:41 gfrlog: amalloy: ah, but first you would have to know that pharen exists!

16:41 fliebel: How does the future/agent threadpool work? Is it fixed at cores+x, or will it reach in the thousands if asked to?

16:41 amalloy: fliebel: send vs send-off

16:42 gfrlog: fliebel: I think it's fixed...cores+2 maybe?

16:42 fliebel: amalloy: I'm mainly concerned with future for now.

16:42 stuartsierra: fliebel: there are 2 thread pools

16:42 amalloy: the future pool is unbounded, agents have a fixed pool and a bounded one; pmap and friends make sure to create at most N futures at once

16:43 sritchie_: hugod: hey, I think I'm going to start working on this hadoop crate later today. I wanted to ask, though, have you used crane at all, or do you have some sense of what that project is trying to do that pallet can't?

16:43 pallet seems pretty mature

16:43 fliebel: stuartsierra: A post by raek suggest agent and send-off share pools, what is the other one?

16:44 stuartsierra: No, 'send' uses a fixed-size pool. 'send-off' and 'future' use an unbounded pool.

16:45 fliebel: oh, right...

16:46 hugod: sritchie_: I haven't spent much time with crane recently, so you'll have to ask a crane user :)

16:47 sritchie_: tbatchelli has been working on the hadoop crate

16:48 sritchie_: hugod: cool, didn't see his fork

16:48 nawk: Another noobish question, is there an open specification for the clojure language, so that others can use on platforms other than the jvm?

16:48 hugod: sritchie_ I don't think he has pushed his mods yet

16:48 nawk: s/use/write or implement/

16:48 sexpbot: <nawk> Another noobish question, is there an open specification for the clojure language, so that others can write or implement on platforms other than the jvm?

16:49 stuartsierra: nawk: not yet

16:49 There is an active CLR/.NET port.

16:49 sritchie_: hugod: okay, maybe I'll send him a note, or wait to see what he's been working on

16:49 amac_: isn't there a clr version of clojure?

16:52 tbatchelli1: sritchie_, I will be trying to finish it up this weekend

16:53 fliebel: I've heard people consider languages without a formal spec immature :(

16:53 sritchie_: tbatchelli1: I'm new to pallet, but I'm at the point in my current project where I have a need to spin up a hadoop cluster, and log in to a repl on the master node

16:54 nawk: I am looking to learn my first functional language, at the moment comparing: haskell, racket, clojure, erlang. My prof keeps telling me about racket but I am thinking about going to something more popular like haskell

16:54 sritchie_: tbatchelli1: so! I'd love to help, if needed

16:54 nawk: what do you guys think?

16:54 TimMc: nawk: Clojure, duh. :-P

16:54 nawk: hah

16:54 amalloy: nawk: did you see the sign on the door when you came in?

16:54 TimMc: nawk: Racket is a pretty good first language.

16:54 tbatchelli1: sritchie_, I'll definitely need another pair of eyes on it

16:55 devn: fliebel: hola

16:55 dnolen: nawk: any of those 4 would be very good. haskell will probably be the most challenging by far.

16:55 tbatchelli1: sritchie_: I'll ping you when I have something relatively tested

16:55 fliebel: devn: olah, got your nick back?

16:55 devn: fliebel: indeed :)

16:55 setting up my new nas...

16:55 sritchie_: tbatchelli1: great. I'll be here, or sritchie on github. following you now

16:57 nawk: TimMc: yea, he was showing me how I can construct my own language constructs (i.e., extending the language features) on the fly

16:57 TimMc: nawk: Who was?

16:58 ossareh: greets clojurians

17:00 fliebel: Final version, making for parallel: (apply concat (pmap #((apply juxt %)) (partition 32 (for))))

17:00 ossareh: TimMc: nawk's professor.

17:00 TimMc: ah

17:00 fliebel: Brouch time down from 227241 to 138864 :)

17:01 nawk: TimMc: nvm. I will go with racket if I find there are open projects out there that uses it. So far, I am getting the impression that the learning curve for haskell is steep, as the first functional language

17:01 dnolen: nawk: if you want to see someone who has really dived _deep_ into Haskell *and* Scheme, you should check this out: http://okmij.org/ftp/

17:01 TimMc: nawk: Racket (previously "PLT Scheme") is in pretty wide use in education and research.

17:01 nawk: Big set of libs.

17:04 dnolen: these peeps seem to be doing commercial Racket work, http://untyped.com/

17:07 amalloy: man, who wrote this wikibooks stuff on reader macros? it's mostly accurate, but a lot of the english is mangled

17:10 nawk: dnolen: thanks. But I think I need to find a beginners/intro site on the fundamentals.

17:10 sritchie_: hugod, tbatchelli: are there any example crates that require a master node, and a number of slave nodes

17:10 ?

17:11 nawk: the language (e.g.monad) used in that okmij site assumes prior knowledge

17:11 TimMc: nawk: htdp.org

17:12 dnolen: nawk: Haskell - Learn You a Haskell ..., Racket - How To Design Programs

17:13 TimMc: That book (free to read online) introduces structure-driven functional programming very nicely.

17:13 dsantiago: Anyone have any insight on how to make a zipper do a postorder tree walk instead of preorder?

17:14 nawk: TimMc: thanks. I was kinda overwhelmed with the wiki article on functional programming

17:14 dsantiago: I have the feeling I'm going to have to learn everything about zippers and write a new version of clojure.zip/next for myself.

17:15 nawk: dnolen: yo man, that "Learn you a haskell" site is exactly what I need

17:16 I was reading the wiki definition on Lambdas, and I was like "wtf"

17:16 TimMc: Wikipedia is terrible for stuff like this.

17:16 It is basically written by aliens.

17:17 amalloy: TimMc: especially the wiki on unfold

17:17 nawk: hah

17:17 amalloy: it's so awful there's a note at the top "this article contains too much technical jargon"

17:18 nawk: amalloy, haha: it's another way of saying, "go away"

17:18 dnolen: nawk: I highly recommend picking up the Little Schemer / The Seasoned Schemer, the predecessor for tutorials that drop serious CS in an approachable cute fashion. Not available online, but well worth having a physical copy.

17:18 sritchie_: dnolen: seconded

17:18 amalloy: all this nonsense about hylomorphisms and catamorphisms

17:19 nawk: .dict hylomorphisms

17:19 amalloy: $dict hylomorphism

17:19 sexpbot: amalloy: noun: The doctrine that every physical substance is the sum of its component matter and the form taken by that matter.

17:20 TimMc: catamorphism: A cat-preserving operation.

17:24 sritchie_: hugod: do you have any recommendations for sample projects, pallet or otherwise, that require a master node, with access to a number of slave nodes?

17:24 hugod: I'm wondering how that would work with the converge command

17:24 hugod: sritchie_: I posted a very simple exampl on the mailing list today

17:25 sritchie_: also https://github.com/pallet/pallet-examples/tree/master/webapp-haproxy-nodes/

17:26 sritchie_: hugod: great, joined the mailing list. I'll look for that post

17:26 TimMc: Wikipedia's editor culture involves a serious obsession with jargon.

17:29 Also, I should correct myself: It is not written *by* aliens, it is written *for* aliens.

17:29 amalloy: you're thinking aliens would put in some effort to translate?

17:31 nawk: TimMc: well, I want to learn something w/o being discouraged after reading the first paragraph

17:31 gfrlog: what's faster, a struct-map or a small vector?

17:31 or a cheetah?

17:32 TimMc: gfrlog: I can generally get a vector into bed faster than a small vector.

17:32 s/small vector/struct-map/

17:32 sexpbot: <TimMc> gfrlog: I can generally get a vector into bed faster than a struct-map.

17:32 TimMc: I've never dated cheetahs.

17:34 nawk: Are you familiar with algebraic data structures?

17:35 nawk: https://secure.wikimedia.org/wikipedia/en/wiki/Algebraic_data_type

17:35 gfrlog: Are you asking about creation, access, what?

17:35 nawk: TimMC: as in data structures that allow you to perform operations on?

17:35 for example, vector additons

17:35 ?

17:35 gfrlog: TimMc: hmm. I guess destructuring and creating

17:36 say I'm doing something that would make sense as a struct-map, but I use a size-3 vector instead cause it's simpler to type

17:36 and am wondering if that's a bad idea performancewise

17:36 nawk: A=(1,2,3), B=(2,3,4); A+B = (3,5,7)

17:36 TimMc: nawk: Look at the link. It eventually wanders off into type theory, but the top of the article might be useful. You can use it as a way of reasoning about immutable data types.

17:37 HTDP covers this a bit, but I don't think it explicitly uses the term "algebraic".

17:44 amalloy: gfrlog: i think it's probably faster to use the vector anyway, but seriously if there are three elements don't even worry about it

17:45 TimMc: gfrlog: Write whatever will introduce fewer bugs.

17:45 amalloy: also struct-maps are deprecated anyway. if you want convenience use maps or vectors; if you want performance use records. struct-maps are a compromise that is more appealing than useful

17:47 gfrlog: amalloy: good point

17:48 amalloy: the reason 3 elements makes me worry about it is because I saw an explanation of how vectors are implemented that makes me think some 32 slots are being created or something wasteful like that

17:48 amalloy: *shrug* 32 slots are indeed being created

17:49 and the same will happen if you use a hash-map

17:49 gfrlog: struct-map has special slots though, doesn't it?

17:49 (and records?)

17:50 amalloy: probably, but i bet they also allocate an empty map to hold extra keys

17:50 gfrlog: amalloy: I'd hope they keep it null until you actually add something

17:50 amalloy: $source struct-map

17:50 sexpbot: struct-map is http://is.gd/u4dU5R

17:50 amalloy: (pardon me while i go digging)

17:51 gfrlog: I'll come too

17:52 amalloy: gfrlog: looks to me like it creates a persistentarraymap to hold the "special" slots

17:53 gfrlog: how are records implemented? actual classes with member variables?

17:53 amalloy: so, yes, there are special slots, but it doesn't allocate "exactly enough" to hold those either

17:53 yes

17:54 gfrlog: that would be much faster, right?

17:54 amalloy: gfrlog: for creation or lookup?

17:54 gfrlog: yes

17:54 amalloy: the lookup is maybe three times faster

17:54 last i checked

17:55 creation probably is substantially faster

17:56 oh, of course the faster lookup only applies if you type-hint your records and get at them with (.member obj) instead of (:member obj)

17:56 gfrlog: hmm

17:57 can you destructure a record like a map?

17:57 amac_: is there a performance benefit to using partial instead of a regular anonymous fn?

17:57 amalloy: gfrlog: yes. amac_: no, partial is slower

17:58 gfrlog: but if you destructure the record like a map you get no performance benefits

17:59 gfrlog: yeah, that's what I figured

17:59 are records the ones with mutable fields?

17:59 I'm just going to go read the thing

18:00 hiredman: since partial doesn't close over values the compiler could in theory lift them into static methods

18:00 amac_: hmm, having a hard time seeing the usefulness... what's a good use case for partial? will partial return if enough (but not all) args are provided?

18:01 amalloy: hiredman: but partial will still have to call apply

18:02 gfrlog: amac_: http://twitter.com/gfrlog/status/38726503944552448

18:02 amac_: err, I guess partial doesn't have an arg arity, my question doesn't make sense - sry

18:03 amalloy: amac_: (partial + 10) is arguably easier to read than #(+ 10 %), and certainly easier than #(apply + 10 %&); you also can't nest #(...) forms

18:03 amac_: ooooooooooooooooooooooooh, thats how to nest #()

18:03 that *is* useful

18:03 hiredman: amalloy: the fn partial returns can be a multifn just like partial is so it doesn't have to apply for all arities

18:03 amalloy: hiredman: good point

18:04 gfrlog: amac_: when I want to nest #(), I use (fn [] ...) for the outer ones

18:04 amalloy: amac_: sunil wrote a version of partial that *does* have fixed arity, and returns a further partial if you don't pass it enough args

18:05 amac_: gfrlog: still trying to wrap my head around your tweet

18:06 gfrlog: amac_: it is short for:

18:06 (defn generate-unique-id []

18:06 (let [a (atom 0)]

18:07 (swap! a inc)))

18:07 the atom is used to keep track of the last id returned

18:08 tomoj: that doesn't look very useful :)

18:08 amac_: it is beautifully short

18:08 gfrlog: tomoj: why not?

18:08 tomoj: &(repeatedly 10 #(let [a (atom 0)] (swap! a inc)))

18:08 sexpbot: ⟹ (1 1 1 1 1 1 1 1 1 1)

18:08 _ulises: you're always inc'ing 0

18:09 ^^^ that

18:09 amalloy: uh

18:09 gfrlog: I may have mistyped something

18:09 I know the tweet version works

18:09 oh yes I remember

18:09 amalloy: gfrlog: you nested your scopes wrong

18:09 gfrlog: amalloy: yup

18:09 amalloy: (let [a (atom 0)] (defn ...))

18:09 gfrlog: my apologies to all

18:09 that's what I get for writing code directly into IRC off the top of my head

18:10 amac_: the tweet works

18:10 :)

18:10 gfrlog: yeah I checked that before tweeting it :)

18:10 tomoj: using partial there is neat

18:11 gfrlog: sometimes things get crazy short but you can't see how to do it until you cross your eyes

18:13 Raynes: ohpauleez: https://gist.github.com/855885 :p

18:16 gfrlog: where does the clojure community stand on comma usage?

18:16 I like using them in any context with implicit pairs

18:17 ohpauleez: Raynes: haha, sounds good

18:17 tomoj: gfrlog: e.g. in let-bindings?

18:17 amalloy: gfrlog: there's a reason they're optional. you use them where you want em

18:18 technomancy: gfrlog: not really necessary if you have each pair on a separate line. on the same line I could go for it though.

18:18 amalloy: i usually write my code with spaces and then s/ /,/g so that nobody else can read it

18:19 gfrlog: tomoj: that's one example; also maps

18:19 technomancy: true

18:20 amac_: ,(map,#(char(+(int%)1))[a,b,c])

18:20 clojurebot: java.lang.Exception: Unable to resolve symbol: a in this context

18:20 amac_: fuck spaces.

18:20 amalloy: amac_: int%

18:20 gfrlog: yeah NASA is so 20th century

18:20 amalloy: still needs a separator

18:21 amac_: ,(map,#(char(+(int%)1)"abc")

18:21 clojurebot: EOF while reading

18:21 amac_: goddam brackets

18:21 amalloy: &(let [int% (constantly 10)] (#(int%)10))

18:21 sexpbot: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector

18:21 amalloy: whoa really? i could swear % was legal in symbols

18:21 &'int%

18:21 sexpbot: ⟹ int

18:22 amac_: ,(map,#(char(+(int%)1))"abc")

18:22 clojurebot: (\b \c \d)

18:22 amac_: theeeeeeeeeeeeeeere we go

18:22 * amalloy submits

18:24 gfrlog: amalloy: maybe it got added in edge-clojure along with the apostrophes?

18:24 amac_: all that to say the application of whitespace is very liberal in clojure, and its easy to make things ugly

18:24 gfrlog: I realized a bit ago that being a programmer has completely changed my mental bindings for the ' character

18:25 amalloy: &((fn[[?<&,%*+,$*|]](?<&,%*+,$*|))({[^:<?>,'*$][+(+(*)(*))(*,3(*))]}['*$]))

18:25 sexpbot: ⟹ 5

18:25 gfrlog: from an apostraphe to a single-quote

18:25 amalloy: amac_: stolen from fliebel and chouser several weeks ago

18:25 gfrlog: apostrophe*

18:25 amac_: that code?

18:25 amalloy: yeah

18:26 amac_: I came up with that ugliness independently, I was going to put it on the back of an ipod

18:27 nifty way to do a rot13 that no one would understand

18:29 oh jesus, I didn't see the code you posted

18:30 that is... special

18:31 amalloy: heh

18:31 want to decompose it yourself, or shall i tell you what i discovered it to boil down to?

18:32 amac_: I'm trying to figure it out

18:32 it hurts

18:32 * amalloy recommends pasting it into an editor and replacing bits

18:34 TimMc: amalloy: You cheated, there's a 3 in there!

18:34 (Or they did, rather.)

18:35 amalloy: TimMc: i think representing 3 without any numbers would have made it a little too clear what the rest of the code was doing :P

18:35 TimMc: ,(+(*)(*)(*))

18:35 clojurebot: 3

18:35 amalloy: indeed

18:44 amac_: ok i'm stuck

18:45 amalloy: amac_: hints are $1.50

18:45 TimMc: amac_: Mind if I post a version without gratuitous use of weird characters in symbols?

18:45 amalloy: TimMc: just gist it

18:45 then he can follow if he wants

18:45 TimMc: Oh, wait, I shouldn't step on amalloy's profits.

18:45 amalloy: (as can any lurkers)

18:49 TimMc: https://gist.github.com/855925

18:49 * __name__ lurks

18:50 amalloy: *chuckle*

18:50 * __name__ steals the gist and runs away.

18:57 gfrlog: $findfn [5 4 3 2] [5 4 3]

18:57 sexpbot: [clojure.core/butlast clojure.core/drop-last clojure.core/pop]

18:57 gfrlog: $findfn (list 5 4 3 2) (list 5 4 3)

18:57 sexpbot: [clojure.core/butlast clojure.core/drop-last]

18:57 gfrlog: I support abbreviating butlast to blast

18:58 amac_: (I snuck a look at TimMc's code snippet

18:59 TimMc: Help, I'm trapped in a sexpr!

18:59 amac_: curious why the fn ignores the first and last element of the vector without looking like fn [_ [a b c] _] ...

18:59 amalloy: ))))

18:59 amac_: )

18:59 gfrlog: oh that's what sexpbot means...

19:00 I guess I'm an adult now

19:00 amalloy: heh

19:00 given the Common-Lisp convention of using p instead of ? (eg listp), i've always been baffled by the survival of the term sexp

19:01 amac_: sexpression doesn't really roll off the toungue

19:01 amalloy: even s-exp

19:01 would be fine

19:02 technomancy: I've seen sexpr

19:02 TimMc: "secks-per"

19:02 shachaf: amalloy: And not loop?

19:02 TimMc: "ess-expression"

19:02 amalloy: technomancy: sure, or sexpr

19:02 shachaf: that one doesn't really stand out to me cause we americans never talk about the loo

19:02 gfrlog: how about 'the-birds-and-the-bees-pression'

19:03 amalloy: plus loop is an actual word already unlike sexp

19:03 TimMc: (sexp) => 't

19:03 shachaf: sexp is an actual word in a LISPer's vocabulary. Hence its survival. :-)

19:06 amac_: oooooooooooooooooooooooooh, I get how its pulling the val out now

19:06 stupid useless meta

19:06 TimMc: haha

19:07 Metadata is orthogonal to comparison semantics!

19:07 gfrlog: does clojure.test have an assertion that an expression doesn't throw an exception?

19:08 TimMc: gfrlog: What's the point?

19:08 Oh, clojure.test

19:08 Well, same question.

19:08 amalloy: gfrlog: if an exception is thrown, the test will fail. why declare it?

19:09 gfrlog: amalloy: that there is a good point.

19:09 TimMc: There's a way to fail if an exception *wasn't* thrown.

19:09 gfrlog: I guess the purpose of the test is clearer

19:09 if I say (is (happy-times))

19:09 it looks like I expect (happy-times) to return true

19:09 when really I'm just checking that it doesn't throw anything

19:10 TimMc: No need for (is ...)

19:10 gfrlog: (deftest happy-times-test (happy-times)) ?

19:10 amalloy: TimMc: i think the "is" counts as an assertion for the summary

19:10 TimMc: Should work.

19:10 gfrlog: hmm

19:10 TimMc: Ah, good point.

19:11 amalloy: (deftest happy-times-no-exception (happy-times))

19:11 gfrlog: very good

19:11 amalloy: i think you actually don't want the (is), because then if happy-times returns false or nil you'll fail

19:12 TimMc: (defmacro succeed [&exprs] `(do ~@exprs (is true)))

19:12 gfrlog: amalloy: right

19:12 TimMc: nice

19:12 amalloy: nice, though i'd do (is (do ~@exprs true))

19:12 gfrlog: are there any crypto wrapper libraries for clojure?

19:13 TimMc: amalloy: Good call.

19:13 tomoj: testing that code doesn't throw an exception seems strange

19:13 TimMc: I think c.test also tells you how many test forms were run as well.

19:13 gfrlog: tomoj: yes, I was surprised to even hear myself ask

19:13 TimMc: I wouldn't actually use that succeed macro myself.

19:13 tomoj: maybe if it's hard to actually test the code?

19:14 gfrlog: tomoj: I think that's why I did it; heavily iterated numerical stuff

19:14 TimMc: Ran 28 tests containing 72 assertions. 0 failures, 0 errors.

19:14 tomoj: or if all the code does is conditionally throw an exception?

19:14 gfrlog: where the easiest way to get the expected value is to just run the code I just wrote anyhow

19:14 tomoj: ...huh?!

19:14 oh

19:14 right :)

19:16 gfrlog: I repeat my crypto question in case it got lost up there: any wrapper crypto libraries for clojure?

19:16 would such a thing be appreciated if it doesn't currently exist?

19:16 clojure.contrib.crypto?

19:16 clojurebot: compiling clojure is rarely necessary to do yourself.

19:18 TimMc: clojurebot: That was... cryptic.

19:18 clojurebot: Pardon?

19:18 amac_: BCrypt everything

19:18 TimMc: gfrlog: What crypto primitives do you plan on using?

19:19 amac_: jBCrypt exists, perhaps sexifying a library for it

19:19 gfrlog: hashing personally; but I would think symmetric and asymmetric algs would be useful too

19:22 TimMc: What kind of hashing?

19:22 MD5? SHA256?

19:22 gfrlog: yes, that sort of thing

19:23 tomoj: I'd mostly appreciate the byte-array->hex-string function I'd expect to find there

19:23 hashing is easy

19:23 swart: formatting strings isn't too hard either

19:23 gfrlog: tomoj: I'd appreciate two functions -- one that returns byte arrays, one that returns hex-string, and both taking any reasonable kind of argument and doing reasonable things with them

19:24 on that note, it's not-being-on-irc-anymore-time

19:25 tomoj: formatting strings?

19:27 swart: I mean is a wrapper library really necessary? there's a ton of stuff for java out there. if all you want to do is convert a byte-array to a hex string, how much code would it take?

19:29 TimMc: There's a small but annoying amount of Java verbosity involved in getting a simple hash.

19:29 tomoj: mine is about 7 lines, slow, stupid, and ugly

19:31 johnmn3: DAE type out a really long function or set of functions, run it, and the get really suprised when it works the first time... and you didn't even have to debug it?

19:31 Thamster_: and then 2 months later you realize there was a logical error not a compiler error in it?

19:32 just kidding

19:32 hey clojurerers

19:32 riddle me this

19:32 TimMc: "Parameter declaration clojure.core/deref should be a vector"

19:32 Thamster_: how do i write the following lisp expression in clojure

19:32 TimMc: ^ ...why is Clojure suddenly dying when trying to compile my code?

19:33 Thamster_: (DEFINE SQUARE (LAMBDA(x) (* x x)))

19:33 johnmn3: (def square (fn [x] (* x x)))

19:33 amac_: (defn square [x] (* x x))

19:33 Thamster_: must there be the square brackets?

19:33 johnmn3: yea

19:34 Thamster_: i know there are like 10 different define macros

19:34 johnmn3: binding forms use a vector [...]

19:34 Thamster_: oh :(

19:34 TimMc: Thamster_: Clojure has reader support for (lists), [vectors], and {maps}

19:34 Thamster_: i guess these aren't my father's parentheses

19:34 TimMc: ...and uses them syntactically.

19:34 johnmn3: it actually makes it easier to read, I think.

19:34 amac_: ,(#(* % %) 3)

19:35 TimMc: clojurebot: ping?

19:35 amac_: that doesn't use square brackets

19:35 TimMc: &(#(* % %) 3)

19:35 sexpbot: ⟹ 9

19:35 amac_: did I kill clojurebot?!

19:36 Thamster_: haha , it was like hey no square brackets … forget this!

19:36 johnmn3: yea, you could use:

19:36 Thamster_: amac_: was hoping to define something to use later though

19:36 johnmn3: (def square #(* % %))

19:36 Thamster_: aha!

19:36 now we're talking

19:37 johnmn3: little sugar

19:37 amac_: square brackets are part of a healthy diet

19:37 Thamster_: thanks johnmn3

19:37 johnmn3: little non-fat sweetner

19:37 tomoj: TimMc: something like (defn foo @bar) ?

19:37 TimMc: Thamster_: More importantly, Clojure has abstract notions of "collection" and "sequence" which accept maps, lists, vectors, whatever.

19:38 tomoj: Why do I want that?

19:38 tomoj: you don't

19:38 I meant, something like that would cause your error

19:39 TimMc: Oh!

19:39 Thanks, now I understand the error message.

19:39 Thamster_: hey johnmn3 how would i do the same for multiple params?

19:39 amalloy: Thamster_: #(* %1 %2). but omg don't :P

19:39 tomoj: &'@foo

19:39 sexpbot: ⟹ (clojure.core/deref foo)

19:40 Thamster_: amalloyirc of course not , scouts honor

19:40 johnmn3: (def mulitply #(* %1 %2))

19:40 Thamster_: honour*

19:41 johnmn3: it's much better to do:

19:41 (defn multiply [x y] (* x y))

19:42 Thamster_: yeah i just don't think i'm ready for square brackets

19:43 amalloy: haha

19:43 Thamster_: i'm going through a lisp tutorial and clojure is way easier to install and square brackets diverge too far from the examples

19:43 TimMc: I'm writing a HOF that takes a function of Point2D->Point2D and composes it like (comp vtow f vtow) with functions that take a point between world and view coordinates.

19:43 amalloy: TimMc: do you mean for one of those to be wtov?

19:44 TimMc: amalloy: yup

19:44 What's a good way to name this function?

19:44 I'd love to use something like pt-op%view

19:44 tomoj: I was thinking about functions like that earlier with (comp char inc int)

19:45 feels like elegance lurking out of my reach

19:45 TimMc: :-)

19:45 johnmn3: like what?

19:45 whats that do?

19:46 TimMc: It's like you're transforming the function from one vector space to another, to use a linear algebra comparison.

19:46 amalloy: it kinda feels like there is a monad underneath all this

19:46 TimMc: heh

19:46 tomoj: I was thinking of haskell too

19:46 amalloy: somewhere

19:47 * johnmn3 stares blankly

19:47 amalloy: johnmn3: he has a function that operates on...ip addresses, say

19:47 tomoj: I guess what bothers me is that the concept of going into a new space and back isn't really encoded there

19:47 amalloy: and he has functions for converting between IPs and domain names

19:47 tomoj: the two functions on either side could be anything

19:48 amalloy: and he wants to make a version of his function that works with domain names, by converting to an IP, running the existing function, then going back to a domain name

19:48 TimMc: Oh man! I've already got functions to take both locations and offsets to and from view coords... why not also take functions to and from?

19:48 Sounds like I need multimethods

19:48 johnmn3: oh

19:48 amalloy: except his actual use case involves math

19:48 johnmn3: ,((comp char inc int) /3)

19:49 tomoj: then, what, dispatch based on whether its view or world?

19:49 johnmn3: &((comp char inc int) /3)

19:49 sexpbot: java.lang.Exception: Invalid token: /3

19:49 johnmn3: &((comp char inc int) \3)

19:49 sexpbot: ⟹ \4

19:49 johnmn3: is what I meant

19:49 TimMc: &((comp char inc int) \space)

19:49 sexpbot: ⟹ \!

19:49 johnmn3: I like it

19:50 But it feels like threading

19:50 TimMc: tomoj: Dispatch on what kind of thing I am manipulating: Point, Vector, or function.

19:50 tomoj: oh :/

19:50 TimMc: I really want to annotate points and such with which coordinate system they are in.

19:51 tomoj: been thinking about stuff like that too, with minecraft's 4 or so coordinate systems

19:51 don't see an elegant way to deal with it

19:51 also sparse vs dense vectors

19:51 TimMc: That's just me being Java-ish, though. I'd notice right away if I were using view coordinates in a world-expecting function.

19:51 tomoj: maybe not so bad with only two representations but with 4 my ideas are all messy

19:52 TimMc: tomoj: Not familiar with Minecraft. Is there a canonical world coordinate frame?

19:52 If not, pick one.

19:52 tomoj: that might work

19:53 basically did that with my sparse vs dense vectors too, the result being that as soon as you add, you get dense, which is unacceptable

19:53 amac_: Minecraft is an amazing timesink

19:55 TimMc: lolwut... I just reworked my code so that I can drag the canvas, not just elements on it... and the canvas dragging works fine, but somehow the elements are now being dragged in the wrong direction.

19:55 gregh: subtraction is hard, use addition instead :)

19:56 TimMc: I'm using addition in both places!

19:56 amac_: then you're adding wrong.

19:56 TimMc: (loc-from-view (pt+ (loc-to-view old) delta))

19:57 where delta is (pt-diff cur old)

20:04 amalloy: TimMc: different coordinate system for points within the canvas and whatever the canvas is sitting on?

20:05 TimMc: amalloy: I should clarify -- I do not actually drag the canvas, I drag the viewpoint that the canvas displays.

20:06 I think I just have to sit back and work out what I want to happen.

20:11 In paredit, how do I kill just the next form?

20:11 amalloy: C-M-k

20:11 (which is actually a plain emacs binding, whether or not you have paredit on)

20:11 TimMc: Great, thanks.

20:11 understood

20:12 amalloy: (all this has the fun side effect that you can use it when editing, say, PHP or XML too)

20:13 johnmn3: so...

20:14 I'm trying to write a follow up to my blog post, but I need to squeeze some more performance out first.

20:15 TimMc: What is the post on?

20:15 johnmn3: http://sexp.posterous.com/a-whole-lotta-automata

20:15 the follow up is about using parallel to make it go faster

20:15 amalloy: oh cool, i remember reading that

20:15 johnmn3: yea, automata is a fun topic

20:15 amac_: plz ping when updated

20:16 johnmn3: but at the end, I show where I'm experimenting with pmap, etc.. and I'm not really getting any major performance jumps

20:17 you'd think an automaton would be a simple case where it's easy to break the problem down into smaller pieces, but I'm not sure why it's not making a difference.

20:18 amalloy: johnmn3: the pieces are probably too small

20:18 TimMc: I'm not sure how parallelism would help here.

20:18 What amalloy said.

20:18 amalloy: it costs resources to start up a new thread, to glue together the results of N threads...

20:18 johnmn3: 100,000 items, split 10 ways

20:18 TimMc: With a really large world, vector computing might help, though.

20:19 johnmn3: 10,000 items per thread

20:19 amalloy: even so, the time to do 10k arithmetic operations doesn't seem very large

20:19 syscalls are expensive

20:19 but i could be wrong

20:19 johnmn3: I've tried 10,000,000

20:19 and 100,000,000, split 10 ways, 4 ways, 100 ways

20:20 amalloy: huh

20:21 johnmn3: chunkify takes the horizontal state string and splits it according to your desired chunk size

20:21 TimMc: johnmn3: How long does it take for one iteration, no parallelism?

20:21 with 100M

20:22 johnmn3: mmm. give me a few minutes.. I'll spin the project up.

20:23 tomoj: you parallelize for each iteration separately?

20:24 TimMc: tomoj: Each column depends on the last value of its neighbors.

20:24 *values

20:24 johnmn3: I take a whole time step (say, 10,000,000 wide) and break it into large chunks, then pmap over that

20:25 DespiteItAll: I still don't see how that would be enough cpu time to make pmap worth it

20:25 tomoj: and then combine all the answers into one big vector and repeat?

20:26 DespiteItAll: but hard numbers would definitely help

20:26 johnmn3: tomoj: right

20:26 tomoj: vectors aren't good at combining :(

20:27 amalloy: tomoj: yeah, but to get the random access later surely it's worth it

20:27 DespiteItAll: might be better to work with lists, stitch them together, then convert to vector

20:27 how long does that conversion take anyway?

20:27 johnmn3: well, if 10,000 items take 1 second under non-parallel conditions, should 100,000 items still take 10 seconds (with 10,000 item chunks) if paralleled?

20:27 tomoj: seems like there's got to be a better way given the problem

20:28 don't really need random access, do you?

20:28 johnmn3: lists got slower for me.

20:28 amalloy: yeah, i was thinking about that too tomoj

20:28 johnmn3: forgot why, cause I'm conjing, or something

20:28 amalloy: you could maybe memoize a lookup-in-previous-list

20:28 to let you keep working with vectors

20:29 er, work with lists but get fastish access

20:29 johnmn3: memoizing shouldn't help, if the input is seamingly random.

20:30 for the whitespace on the sides, it'd help.

20:30 if the cache lookup is faster than an 8 element hash-map

20:30 amalloy: johnmn3: to look up element 100000 in a list, you have to look up items 1-99999

20:30 so memoizing could help

20:30 johnmn3: ?

20:31 amalloy: suppose you didn't convert to a vector at all

20:31 johnmn3: nth on a vector is faster than a list, right?

20:31 TimMc: johnmn3: Have you explored whether transients are any faster?

20:31 amalloy: johnmn3: of course

20:31 but creating the vector is crazy slow

20:31 johnmn3: TimMc: I should

20:32 amalloy: and if you could simulate random access on a list by memoizing, building up a vector-ish thing as you go, it might be faster

20:32 johnmn3: what do you mean by using memoize?

20:32 dnolen: johnmn3: have you tried using a JVM profiler ?

20:33 johnmn3: dnolen: no, not yet. I should though.

20:33 amalloy: johnmn3: (def get-nth-subseq (memoize #(nth % previous-generation)))

20:34 except that instead of using nth, you (a) find the furthest into the list you've looked so far and start from there, and (b) return a whole subseq, not just a single element

20:34 dnolen: johnmn3: yup. Otherwise you just end up guessing.

20:35 johnmn3: what is memoize returning there?

20:35 what are the chances you have the same data?

20:36 amalloy: johnmn3: it's starting to feel like getting my point across is not worth the effort given that i don't actually know this will help

20:37 tomoj: I've got one agent with always nil state which dispatches to itself with a delay. seems silly. better way?

20:37 johnmn3: amalloy: there might be a way to treat the data more like a stream

20:44 almost up with the project, had to pull it down on this new vm

21:08 TimMc: Haha, my subtraction *was* backwards... but my intuition regarding viewpoint dragging was also backwards... I think.

21:11 tomoj: but they didn't cancel out?

21:11 TimMc: tomoj: They canceled out for the canvas dragging, sure.

21:11 viwpoint dragging, excuse me

21:11 But any time I tried to drag an *object* in the view, it moved in opposition!

21:12 (Whereas befor my edits, they hadn't.)

21:14 OK, beautiful.

21:17 gfrlog: ,(((constantly constantly) constantly) constantly)

21:20 &(((constantly constantly) constantly) constantly)

21:20 sexpbot: ⟹ #<core$constantly$fn__3551 clojure.core$constantly$fn__3551@1182c98>

21:21 johnmn3: does anyone know how to read the output of visualvm?

21:21 I have an overview tab, monitor tab, threads tab, sampler tab, and a profiler tab.

21:23 dnolen: johnmn3: you'll probably want to profile the CPU

21:23 johnmn3: under the sampler tab, org.netbeans.lib.profiler.server.ProfileServer.notifyClientOnResultsAvailability () is taking up 97.4% of the time

21:24 under the Profiler tab, java.util.concurrent.ThreadPoolExecutor$Worker.run () is taking up 85% of the time.

21:25 looks like there are only 2 thread pools too

21:31 running again. Does it sound wrong that 95% cpu time is spent in java.util.concurrent.ThreadPoolExecutor$Worker.run ?

21:37 strange

21:37 running non-parallel now. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run = 75% now

21:38 and clojure.lang.LineNumberingPushbackReader.read = 18%

21:38 it's using boxed Numbers.add and Numbers.Lt too

21:41 DespiteItAll: I think you have to ignore the rmi stuff. I think that's an artifact of the profiling.

21:43 johnmn3: okay. and I see now that adding profiling causes the program to take around 1100 to 1200% longer

21:43 so don't user large numbers

21:44 DespiteItAll: yeah, it's more about relative times. Boxed arithmetic is an easy target to eliminate.

21:44 johnmn3: but for some reason, the automaton is thrashing hard on the LineNumberingPushbackReader

21:44 is that an artifact?

21:44 DespiteItAll: That's interesting

21:45 johnmn3: 98% on the last go round

21:45 DespiteItAll: let me look at your code again, I have no idea where that would be coming from

21:45 you're using visualvm?

21:45 johnmn3: yea

21:45 DespiteItAll: you can take a snapshot, then look to see where in your code that's getting called

21:46 it's like snapshot -> hotspots -> call trace, I think.

21:46 johnmn3: there's code up here: git://github.com/johnmn3/automata.git

21:49 DespiteItAll: what function are you profiling?

21:51 TimMc: tomoj, johnmn3, amalloy: I ende up defining "isomap" <https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/utils.clj#L88-92> for that isomorphic transform HOF. Very simple, but it seems useful.

21:51 tomoj: clojure for your homework? lucky

21:52 TimMc: indeed

21:52 Choice of languages.

21:52 amalloy: tomoj: he just names his programs cryptic numbers so that it looks like they're homework

21:52 TimMc: Here's an example of usage: https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/core.clj#L439

21:52 johnmn3: I don't know what I'm doing. I just launched visualvm, then did a lein repl, load-file, (ns automata.par), and ran some tests on par and non-par... visualvm sees the application start up and I just open it from there and view it.. not sure how to do more specific profiling yet

21:53 DespiteItAll: right, I'm just wondering what exactly you ran when you saw all that pushbackreader activity

21:53 johnmn3: oh, sec

21:54 tomoj: load-file would be an understandable culprit

21:54 only if that's about all you were profiling..

21:54 johnmn3: (def initial-conditions (core/make-initial-conditions 10000))

21:54 load-file doesn't run anything automatically

21:54 (time (take 20

21:54 (drop 490

21:54 (last

21:54 (core/run-steps 10 rules/rule-90-stepper initial-conditions)))))

21:56 does anyone think it would be a bad idea to farm the chunks in the par version out to agents? isn't the same thing going on with pmap anyway?

21:56 DespiteItAll: it's really helpful to understand what pmap is doing, where its weaknesses are, etc

21:57 johnmn3: with pmap, I was seeing 2 threadpools with around 50 to 100 threads at any given time, each

21:57 DespiteItAll: this talk helped me a log http://clojure.blip.tv/file/4645227/

21:57 lot

21:57 johnmn3: I thought it used fixed size threadpools

21:58 DespiteItAll: and made me wish the fork-join stuff was mainlined already

21:58 johnmn3: yea, I watched that. It was quasi-inspirational for me to delve into par for this automaton

21:58 DespiteItAll: Yeah, I saw the same thing with pmap. When you're consuming as much as you can, it just spawns threads like crazy

21:58 that's contrary to every description I'd read of it

21:59 johnmn3: yea, I thought I read that it uses a fixed size thread pool.. rather, it looks like a fixed number of threadpools

21:59 amac_: n

21:59 johnmn3: and I have a quad-core intel = 8 visible threads to the OS.. and only 2 threadpools?

22:00 DespiteItAll: i think the number should be procs + 2

22:01 johnmn3: I wonder if the threadpool is jacking me up though.. cause I've seen all 8 OS procs pinged out when running pmap over the automaton, while looking at window's task manager.

22:01 erm, s/threadpool/profiler

22:01 amalloy: johnmn3: if you actually wait on the pmapped list entry there should be a fixed number of them

22:02 but if you consume them all and then wait on them all, it can't help but give you loads of future objects

22:03 DespiteItAll: my conclusion is that it's difficult to use pmap correctly

22:03 amalloy: not sure if that's your issue as i haven't looked at the code, but it seems worth mentioning

22:03 johnmn3: amalloy: not sure if I understand. say I have a 1000 item set, I break that into 100 item sets, in a 10 item set. If I pmap across that, the function should be applied to 100 items, for each thread in parallel, right?

22:04 not "set" in the clojure.set sense

22:04 a vector

22:04 amalloy: johnmn3: you were asking about having too many active futures, where you expected a fixed threadpool

22:04 johnmn3: k

22:05 amalloy: (vec (pmap foo (range 1000))) has to return to you a vector of 1000 (future ...) objects

22:05 and futures run on an unbounded pool

22:05 TimMc: I'd like to dispatch on arity & type -- any easy way?

22:06 johnmn3: TimMc: dispatch on function with multi-methods

22:06 amalloy: if you instead did something like (let [results (pmap foo (range 1000))] (doseq [x results] @x) results) i think you would have far fewer actually-active threads at once

22:06 TimMc: johnmn3: I know about multimethods but I'm not sure what you're saying.

22:07 johnmn3: amalloy: how many futures result from (vec (pmap foo [(range 1000) (range 1000)])) ?

22:07 TimMc: Wait... can the dispatch function... count the args?

22:07 amalloy: 2

22:07 johnmn3: TimMc: what ever you want it to do, it's a function

22:07 TimMc: fascinating

22:08 Alas! I want a different return type on one of these. Oh well.

22:08 johnmn3: amalloy: so that's what I'm doing.. I'll take a 1000,000 element sequence and split it ten ways, then pmap on it.. should that spawn 10 threads?

22:08 amalloy: heh. multi-methods, the fantastic clojure construct that allows any logic in the dispatcher...except arithmetic!

22:08 johnmn3: yeah, sounds like ten to me

22:09 johnmn3: right, that's not what I'm seeing. it's strange

22:11 what do the different colors of the threads mean in visualvm? yellow, red, green..

22:12 DespiteItAll: should be a key there. active, waiting, sleeping

22:12 amalloy: they're like bananas: yellow ones are ripe; the green ones you should leave on the tree for a while

22:12 johnmn3: :)

22:12 DespiteItAll: red is what the hell kinda banana do you have

22:12 amalloy: indeed!

22:13 johnmn3: so, I think the LineNumberingPushbackReader is just the repl sitting idle

22:13 DespiteItAll: heh

22:13 I think you may be tracing the wrong process?

22:13 are there two clojure processes?

22:13 johnmn3: what do you mean? no, just one

22:14 and jline.consoleRunner

22:14 DespiteItAll: Ok, that must just be how I launch mine

22:14 amalloy: that's part of some comedy sketch i remember. bananas are like traffic lights but the numbers mean different things: "Green means whoa, slow down a little; Yellow is yeah, go right ahead; Red means where the hell you get that banana from"

22:14 DespiteItAll: I think it's vimclojure doing it

22:14 Mitch Hedberg, RIP

22:14 johnmn3: whats it doing?

22:14 DespiteItAll: "My buddy asked me if I wanted a frozen banana, I said no, but I want a regular banana later, so yes"

22:15 * johnmn3 registers redbanana.com

22:15 amalloy: DespiteItAll: oh, neat. i never actually heard his show; someone just told me a couple of the funny bits

22:15 DespiteItAll: oh god, find his cd's ASAP. best show i've ever been to.

22:17 johnmn3: deref takes up 0.3% cpu time

22:17 * amalloy listens

22:17 amalloy: er, looks

22:17 * amalloy can't tell his senses apart either

22:17 johnmn3: it's all the same in cyberspace

22:17 clojurebot: 9

22:17 johnmn3: all character strings

22:18 amalloy: thanks clojurebot

22:18 i wasn't sure what number was most appropriate for this conversation but you've cleared it all up

22:18 DespiteItAll: heheh

22:18 TimMc: lol

22:18 ^ I only say that when it's true.

22:18 johnmn3: DespiteItAll: I never found a "hotspot" option

22:19 DespiteItAll: Hrm, just a sec

22:19 did you take a snapshot?

22:19 TimMc: clojurebot: testing42 is <reply>42

22:19 yada testing42 yada

22:19 amalloy: TimMc: he doesn't jump on every message

22:19 johnmn3: hmm. KirinDave's irc client is hosted on amazonaws.com? DespiteItAll: yea, then what?

22:19 amalloy: ~testing42

22:19 testing42?

22:20 meh whatever

22:20 TimMc: I wonder what it triggered on.

22:20 amalloy: TimMc: he's set to trigger randomly

22:20 johnmn3: 42

22:20 amalloy: in addition to some specific intentional triggers

22:20 TimMc: And just spew random?

22:20 amalloy: well i didn't write it obviously, but my understanding is he interprets 0.5% of all messages as if they were addressed to him

22:21 and does his best to answer them

22:21 johnmn3: clojurebot: what?

22:21 TimMc: weird

22:22 #apache, last time i was there, had an *amazing* helper bot.

22:22 "fajita" would answer about 25% of the questions that people would come in to ask

22:22 I think most of them never knew it was a bot.

22:22 KirinDave: johnmn3: My internet connection sometimes plays caching games because AT&T sucks.

22:22 johnmn3: I tunnel through an EC2 instance to alleviate these issues

22:23 johnmn3: mmm

22:23 KirinDave: Crazy as it sounds, going through EC2 is better than going through a broken cache run by AT&T

22:24 TimMc: KirinDave: You might also get better latency, weirdly enough.

22:24 johnmn3: what do you mean a cache? like an optimizer?

22:24 DespiteItAll: Ok, I'm in linux but it should be the same. At the bottom of the snapshot window there are tabs for call tree, hot spots, combined, and info

22:24 johnmn3: I wonder if I'm running through a cache

22:25 DespiteItAll: hot spots gives me the same sort of info as the main profiler. but I can right-click on a function and choose either backtraces or call-tree

22:25 johnmn3: DespiteItAll: which tab are you in? for a given snapshot, I have "overview" "Monitor" and "Threads"

22:25 hmm

22:25 TimMc: johnmn3: If the cache isn't broken, you wouldn't be able to tell without using timing info.

22:26 DespiteItAll: johnmn3: oh I think there's two different "snapshots". Are you hitting the snapshot button from the profiler window?

22:26 johnmn3: yyyyea, I think

22:26 I'm taking a snapshot while it's running

22:27 DespiteItAll: Weird. When I do that, I get a snapshot on the left side that's under the main process. The tabs on top are then overview, monitor, threads, profiler, [snapshot]

22:27 johnmn3: while it's running, from the toplevel menu, I'll click "Applications" and "application snapshot"

22:28 DespiteItAll: ahhh, do you have "profiler snapshot"?

22:28 johnmn3: what version are you running?

22:28 yea, I do have a profiler snapshot

22:28 do that?

22:28 DespiteItAll: yeah, try that

22:28 I'm running 1.2.2

22:28 johnmn3: aaaaah

22:28 there it is

22:29 1.3.2 here

22:29 DespiteItAll: When profiling, I have a few buttons. a trash can, an arrow, "snapshot", and some disks. I just hit that snapshot button.

22:29 johnmn3: ah

22:29 DespiteItAll: I should updat4e

22:29 johnmn3: for realz

22:29 you running fedora?

22:29 DespiteItAll: ubuntu

22:29 9.04 or something

22:29 johnmn3: 11.04 has 1.3

22:30 DespiteItAll: I don't like change :)

22:30 johnmn3: yea, that's ancient

22:30 :)

22:30 DespiteItAll: it's not my fault they're determined to make every new version suck more than the last

22:30 anyway, I gotta run. Good luck profiling!

22:31 gfrlog: ,(alias 'a 'b)

22:31 &(alias 'a 'b)

22:31 sexpbot: java.lang.NullPointerException: Expecting Symbol + Namespace

22:31 johnmn3: DespiteItAll: thanks!

22:31 gfrlog: &(doc alias)

22:31 sexpbot: ⟹ "([alias namespace-sym]); Add an alias in the current namespace to another namespace. Arguments are two symbols: the alias to be used, and the symbolic name of the target namespace. Use :as in the ns macro in preference to calling this directly."

22:31 johnmn3: wow.. way too many futureTasks

22:31 TimMc: johnmn3: I have a pristine Install/Live CD pair pack of Ubuntu 5.10 :-)

22:32 johnmn3: interesting though, to drill down into the call stack. TimMc: that you're running?

22:32 TimMc: Naw. I'm on 10.04 or something.

22:33 Was on 9.04ish for a while because of a FS corruption bug they still haven't fixed in an intermediate release.

22:34 johnmn3: I can't help my self.. I'm running the new 11.04 with unity in a vm

22:34 I used linux as my primary OS for... 6 or 7 years

22:35 then I bought this new envy 14

22:35 with one of those new "hybrid graphics cards" ... and I decided to just leave win7 on there

22:35 Linux can't do anything with these new hybrid graphics cards.. frustrating

22:37 does anyone know how to set the number of threadpools in clojure, for agents?

22:37 *threadpool* or something?

22:42 amalloy: the...number of threadpools? do you maybe mean the number of threads in the pool? either way though i don't think there's an easy way to do it; i think your best bet is dealing with j.u.concurrency yourself

22:47 gfrlog: I am thinking it would be convenient to have a pr-str function where lists are either converted to vectors or quoted :-/

22:48 johnmn3: something made me think that threadpools have only one active thread at a time. and the pool manages timeshares between the threads, and you have multiple pools for multiple procs

22:48 looks like most of my time is spent on deref

22:49 and creating vectors

22:50 amalloy: I guess it makes more sense what you said, given the term "fixed size threadpool"

22:51 amalloy: gfrlog: it kinda would, wouldn't it, now that you mention it

22:53 &(use 'clojure.walk)

22:53 sexpbot: ⟹ nil

22:54 amalloy: &(let [f [1 '(2 3 [1])]] (postwalk #(if (seq? %) (vec %) %) f))

22:54 sexpbot: ⟹ [1 [2 3 [1]]]

22:54 amalloy: gfrlog: good enough?

22:57 gfrlog: oh sorry

22:57 um

22:58 that looks fantastic

22:58 thanks.

22:59 I need to get more familiar with clojure.walk I think.

22:59 amalloy: i have a transform-if in my little toolbox which would be well-suited for that

22:59 (postwalk (transform-if seq? vec) f)

23:01 gfrlog: on that note -- g2g lol rofl l8ers bye

23:01 s/g2g lol rofl l8ers bye/goodnight

23:01 sexpbot: <gfrlog> on that note -- goodnight

23:02 amalloy: gfrlog: https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/transform.clj#L3 if you want to steal it

23:02 hah! got it before he left

23:07 gfrlog: amalloy: you may have got it before I left, but it immediately was lost off my screen and it took me several minutes on the IRC log sites to retrieve it because apparently it is tomorrow in certain time zones already.

23:07 amalloy: heh

23:07 yeah, i figured as much. i was going to tweet it for you actually

23:07 gfrlog: makes me think the n01se.net thinger must be in argentina

23:08 you can tweet it anyway, then the people who do social graph analysis will think we're slightly more popular and influential

23:08 amalloy: gfrlog: other way round, surely? like england or something

23:09 gfrlog: amalloy: I'm in eastern US and it's still an hour from midnight. One hour later puts it farther east, which is either the eastern half of south america or maybe someplace in canada or iceland or something

23:10 amalloy: gfrlog: yeah you seem to be right, there. i'm even worse at geography than i thought

23:11 gfrlog: oh then this will be fun: Which US state is closest to Africa?

23:11 amalloy: because it's fun, i'm going to assume hawaii

23:11 gfrlog: no, but if you picked several more fun states you might get it

23:11 just bounce around a bit at various extremes

23:12 amalloy: um, alaska? can i wrap around a pole or something?

23:13 gfrlog: no, it's not that drastic of a trick

23:13 more of a bending...

23:14 * amalloy only knows of two US states

23:14 gfrlog: okay okay fine

23:14 Maine it is

23:14 amalloy: who knew

23:15 tomoj: along the surface?

23:15 gfrlog: yeah

23:15 it's completely obvious if you look at a globe

23:15 google earth would do as well

23:15 the standard projection completely distorts it

23:17 okay. Let's try this again

23:17 no sneaky links at the last second

23:17 bye

23:18 amalloy: whoops. accidental empathic /part there i guess

Logging service provided by n01se.net