#clojure log - Apr 14 2012

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

0:58 scottj: muhoo: where the highest rated comments are about smalltalk or yc vs kickstarter.

1:05 y3di: muhoo: he joined the ranks only few have reached before him

2:30 muhoo: scottj: the kickstart vs yc flamewar was annoying. the smalltalk stuff was at least on-topic.

2:34 i have to say, the more i learn about and understand clojure, the more sourcecode i can actually read and understand, the more in awe i am of what frickin geniuses y'all are.

2:35 rather than taking the magic out of it, the more i understand of it, the *more* magical it seems.

3:05 amalloy: jayunit100: you can't splicing-unquote outside of a syntax quote, because that would be a single form "expanding" into multiple forms, which breaks pretty much everything about the reader

3:06 you can do it just fine inside of a syntax quote, because `(x ~@foo y) is still a single form - the syntax-quote is "taking responsibility" for the forms under it

3:07 wkmanire: Howdy folks.

3:07 Working with clojure from my linux box for a (nice) change.

3:08 technomancy: You have these instructions for instaling swank-clojure. "Add [lein-swank "1.4.4"] to the :plugins section of either project.clj or your user profile."

3:08 technomancy: what do you mean by user profile/

3:08 ?

3:12 _ato: wkmanire: if you're using the Leingingen 2 preview version (which is where the profile stuff comes from) see the plugins section here https://github.com/technomancy/leiningen/wiki/Upgrading

3:13 if you're on Lein 1 just do: lein plugin install swank-clojure 1.4.2

3:15 wkmanire: _ato: All done.

3:15 I just jacked into my first clojure lein projuct.

3:15 I know kung-fu.

3:16 _ato: wkmanire: congrats! :)

3:17 muhoo: wkmanire: fantastic!

3:18 amalloy: hey, you got it to work

3:18 muhoo: wkmanire: are you going to use a linux vm on your windows box for clojure stuff?

3:18 wkmanire: :)

3:19 muhoo: No, I'll just work with inferior lisp.

3:19 muhoo: that's how i do it

3:19 wkmanire: muhoo: My clojure installation on my windows box is for my 10 minutes here and there when I can't make myself stay on task for work.

3:19 10~cough 30 minutes.

3:19 muhoo: i discovered the clj-stacktrace plugin, which is great in the shell, but looks like ass in comint-mode

3:20 there has to be a way to turn off the damn colors, but i can't find that knob anywhere

3:20 wkmanire: I've never really used comint.

3:20 muhoo: inferior lisp, i think, uses comint-mode

3:21 i have a clojure repl running on a machine out in the network, which i can connect to from connectbot on my phone

3:21 ssh, really, and port forwarding to the repl

3:22 * muhoo takes a jackhammer to clj-stacktrace and just edits the source to remove the colorizing function completely

3:24 wkmanire: :D

3:25 muhoo: I'm trying to understand the work flow here.

3:25 muhoo: there are lots of options

3:25 wkmanire: muhoo: After I've spent a while hacking out some stuff in the REPL, is there a way I can export everything to a buffer?

3:25 muhoo: save it to a file

3:26 wkmanire: The whole REPL session?

3:26 muhoo: in your project

3:26 no, jsut the code you want to keep

3:26 wkmanire: So I have to traverse my repl session and copy over what I want to keep.

3:26 muhoo: have a look at the structure of the skeleton file that "lein new" creates and you'll see it creates a core.clj file, for example

3:27 wkmanire: There it is.

3:27 muhoo: when i'm just playing around in the repl, i just save the buffer in emacs as my "notes"

3:27 as like "playingaround.clj"

3:27 wkmanire: That sounds like a good idea.

3:28 It'd be nice if I could tell it to grab everything in namespace x and save it to file xyz.clf

3:28 muhoo: then, when i decide to write some actual code, i think about the structure of namespaces, etc, and put things in a more sensible place

3:28 wkmanire: clj*

3:28 I could see namespaces being used in the repl to organize your "thoughts"

3:28 muhoo: you could probably write some clojure to do that :-)

3:29 it's worth reading up on namespaces and what they are, what they do.

3:29 wkmanire: I read what was written in chapter 1 of Cemerick's book on them.

3:29 amalloy: wkmanire: i generally write anything i might conceivably want to save (ie, everything) in an emacs buffer, and send it to the repl with C-M-x or whatever

3:30 wkmanire: hmm

3:31 amalloy: you can use *scratch* for that buffer if you don't want to "commit" to writing a real file :P

3:31 wkmanire: Good points.

3:32 muhoo: craig andera's talk at cljwest on namespaces was good too.

3:32 idk if the video is up though.

3:35 basically "require" means "load", "refer" means bring everything from another namespace into the current one, "use" means "require + refer", and he also explains what the (ns) macro does and why.

3:35 might be readable from here: github.com/strangeloop/clojurewest2012-slides

3:36 wkmanire: muhoo: Thanks for the link.

3:37 whew, my to read favorites list is getting longer and longer.

3:39 muhoo: arrrgh, clj-stacktrace is included in lein 1.7.1, or is otherwise being brought in from somewhere else

3:39 curse you, ted turner!

3:40 yep, included in lein. search and destroy time

3:41 hmm, no wait, it's not. odd. it's coming from somewhere, i'll find it

3:42 hehe, it's hidden inside lein-cljsbuild

3:43 and swank-clojure :-/

3:44 wkmanire: uh oh.

3:44 Guess I shouldn't try to use read-line from the slime-repl.

3:45 muhoo: no, readline and emacs aren't good together

3:46 cool, removed a bunch of lein plugins, and now i have my non-color hack of clj-stacktrace working. i win.

3:47 wkmanire: i generally use this elisp to launch a repl: https://refheap.com/paste/2110

3:48 wkmanire: I see.

3:48 muhoo: if you do M-x ielm, get an elisp repl, dump that code in there, then you can do "M-x lein-local" and start up clojure from that

3:48 it's hacky but it works for me

3:48 wkmanire: Thats alright, I just popped open a terminal window and ran clojure code.clj...

3:48 it worked great

3:48 I read a line of text from stdin and crapped it back out.

3:48 muhoo: or just add that to your .emacs

3:49 nice.

3:49 wkmanire: Now that I can talk to the keyboard and the hard drive I can start playing.

3:50 muhoo: yeah, there's always cut-and-pasting

3:50 &"hello wkmanire"

3:50 lazybot: ⇒ "hello wkmanire"

3:51 wkmanire: &(let [x (read-line)] (print x))

3:51 he he

3:51 thought that might get ignored.

3:52 lazybot: Execution Timed Out!

3:52 wkmanire: sweet

3:52 muhoo: haha

3:54 amalloy: &(binding [*in* (java.io.StringReader. "hello wkmanire\nmore text here\n")] (doall (repeatedly 2 read-line)))

3:54 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

3:54 amalloy: ,(binding [*in* (java.io.StringReader. "hello wkmanire\nmore text here\n")] (doall (repeatedly 2 read-line))) ;; i hate you, lazybot

3:54 clojurebot: #<ClassCastException java.lang.ClassCastException: java.io.StringReader cannot be cast to java.io.BufferedReader>

3:54 amalloy: and also i hate java, apparently

3:57 wkmanire: amalloy: excellent attempt all the same.

4:00 muhoo: &(doto (Thread. #(println "woo hoo")) .start .join)

4:00 lazybot: ⇒ #<Thread Thread[Thread-7006,5,]>

4:11 andyfingerhut: Is this a game of abuse-the-lazybot?

4:57 laurus: What do I do in leiningen if I want to include a .jar file that is not available through Maven?

5:00 scottj: laurus: install it in your local maven repo ~/.m2

5:01 muhoo: well, use lein local-repo plugin, even better

5:01 laurus: scottj, what do you mean "install it"?

5:01 muhoo: http://www.google.com/url?q=https://github.com/kumarshantanu/lein-localrepo&sa=U&ei=ejuJT-aVOsSdiQKwsrX2Cw&ved=0CBAQFjAA&usg=AFQjCNGP89lrjM3tY7LZZxFD9jRSUUMujw

5:01 gawd DAMN google

5:01 https://github.com/kumarshantanu/lein-localrepo

5:01 laurus: muhoo, ah, thanks.

5:02 muhoo: np

5:02 scottj: laurus: there's a long mvn command maven spits out occasionally in errors, muhoo's solution is probably better though

5:02 laurus: Oh, I am using lein 2. That's why I couldn't install it maybe?

5:04 Maybe I should use scottj's solution?

5:04 muhoo: lein2 might have it built in?

5:04 laurus: muhoo, when I type "lein plugin install ..." I get "That's not a task."

5:05 muhoo: ah, lein2 has different plugin install system

5:05 scottj: laurus: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

5:05 laurus: scottj, I'll use that, thanks.

5:05 muhoo, I see.

5:05 muhoo: laurus: youadd it to ~/.lein/profiles.clj:

5:06 {:user {:plugins [[lein-newnew "0.2.6"]]}}

5:06 well local-repo, not newnew, but that's the basic thing

5:06 laurus: muhoo, ah, ok.

5:06 I'm sure I'm not the first person to say this, but all of this is quite complicated.

5:07 muhoo: so i guess add {:user {:plugins [[lein-localrepo "0.3"]]}} to ~/.lein/profiles.clj

5:07 yeah, it's complicated, but i find it less so than maven or ant

5:08 laurus: muhoo, what do I do after creating that file and adding that line?

5:08 muhoo: i'm new myself 220 hours into learning clojure, just starting to get comfortable with it

5:09 scottj: laurus: btw, if you put the jar in your project.clj then lein deps will show you the maven error where it gives you the exact command to run

5:09 muhoo: lein2? i use lein 1.7.1 so i'm not sure if it behaves differently

5:10 in 1.7.1, if you have added the plugin, you can do

5:10 lein localrepo install <filename> <[groupId/]artifactId> <version>

5:10 probably same for lein2

5:11 for example, i did

5:11 lein localrepo install osc-0.7.1.jar local.repo/osc 0.7.1

5:11 laurus: What is this group and artifact stuff?

5:11 muhoo: maven stuff

5:12 it's like a fqdn

5:12 laurus: "java.io.FileNotFoundException: Could not locate leiningen/util/maven__init.class or leiningen/util/maven.clj on classpath."

5:13 muhoo: hmm, maybe lein localrepo doesn't work at all with lein2.

5:13 laurus: OK! I will do the "manual" way then.

5:14 muhoo: yeah, can't argue with that :-/

5:15 scottj: laurus: I think you can give it whatever group and artifact you want, you'll just have to use that in your project.clj. (someone correct me if wrong here)

5:15 muhoo: oic, lein localrepo has been updated for lein2, in git: https://github.com/kumarshantanu/lein-localrepo/commit/4b69d19b41000f0495441c79eb33db1f53e29da1 but not in the released version yet

5:16 scottj: laurus: in project.clj it's [group/artifact "version"] you're probably familiar with that. just fill in the blanks on mvn command

5:16 laurus: OK, thanks!

5:18 What should I use for a groupId?

5:18 I mean, what is recommended?

5:19 scottj: something descriptive of jar, "laurus" or "org.lauruswebsite" if it's yours

5:20 descriptive or organization that made the jar that is

5:20 laurus: Ah, I see.

5:20 Thanks!

5:20 And by the way, what should I put for "packaging"?

5:21 scottj: jar

5:21 laurus: Thanks :)

5:22 By the way, how do I install Maven so that it will work with Java 7? I am on Debian GNU/Linux.

5:24 Is there a way to set which version of Java Maven uses, or is that somehow "built-in"?

5:28 helino: hi everyone, I'm trying to do some we development using ring, but when I run "lein ring server" using leiningen, I get a ClassCastException. How do I debug this?

5:28 scottj: helino: pastebin the entire error

5:29 _ato: laurus: set the JAVA_HOME environment variable

5:29 laurus: _ato, thanks.

5:30 helino: scottj: http://pastebin.com/qdk07Bcr

5:31 scottj: helino: lein --version?

5:32 helino: scottj: Leiningen 1.7.1 on Java 1.7.0_03 Java HotSpot(TM) Client VM

5:33 scottj: here is the project.clj file: http://pastebin.com/xjbHxCSx

5:35 _ato: the :ring option needs to be a map I think. At least the example in the lein-ring readme is :ring {:handler hello-world.core/handler}

5:36 helino: _ato: yes, that was it!

5:36 _ato and scottj, thanks for your help!

5:38 scottj: helino: get a better font :)

5:38 smallest terminus makes very hard to see diff between ( and {

5:39 laurus: Got the jar installed. Thanks scottj and muhoo!

6:15 By the way, does anyone here use clojure-py?

6:15 fliebel: laurus: I think it's a bit early to use it, but experiment, yes.

6:16 laurus: fliebel, to be honest I'm excited about it!

6:16 fliebel: I was tempted to rewrite a pice of Python software in it, but didn't.

6:16 laurus: Well why not? :)

6:17 fliebel: Because not even all the core functions are there yet, let alone the libraries.

6:17 laurus: Wow. I wish I could donate some money to that project or something.

6:18 samaaron: fliebel: hey there - how did you send me a mail via lazybot - that's cool

6:18 is that automatic?

6:18 fliebel: laurus: If yu asked, them, they would probably let you buy them a coffee or bear, i guess, but I think it would be mroe helpfull to take a fn from https://github.com/halgari/clojure-py/blob/master/clojure/untranslated.clj and port it.

6:19 samaaron: $mail username message ;)

6:19 samaaron: that's awesome

6:20 so you do it without the $?

6:20 fliebel: ?

6:20 samaaron: $mail fliebel hello there - do you read me?

6:20 lazybot: Message saved.

6:21 samaaron: ah, got you

6:21 you were able to use the full command because you prefixed your string with my username

6:21 this is insanely cool

6:21 lazybot: ftw!

6:22 fliebel: samaaron: I ended up using Python though, because I failed horribly at making RxTx work.

6:22 samaaron: fliebel: but to answer your message, I the RxTx thing only has serial libraries

6:22 and it really is a horribly cobbled together mess

6:22 i tried sooo many different compiled versions before i found one that worked

6:22 and i couldn't compile the beta versions myself

6:23 it was all a real nightmare

6:23 fliebel: samaaron: Does RxTx only have serial, or your version?

6:23 samaaron: so it only has serial natives

6:23 fliebel: samaaron: Have a look at PureJavaComm. same API, no natives... only serial :(

6:24 samaaron: oh nice

6:24 i wonder how effecient it is

6:24 i'm having issues with my monome library with message throughput

6:24 i'm not sure where the issue is

6:24 it will be useful to test out with other libs

6:25 fliebel: samaaron: Don't know. It's a JNA wrapper over Terminos, while RxTx uses it via C.

6:25 samaaron: At which baud rate does the monome run?

6:27 samaaron: fliebel: to be honest, i'm not exactly sure

6:27 fliebel: I needed to get my DPScope to work at 500000 baud, which didn't work with any Java lib I tried.

6:27 samaaron: oh wow

6:27 so what did you end up using?

6:28 fliebel: Python, as I just said to laurus. Tempting to go for clojure-py though...

6:28 samaaron: $mail TimMc I totally agree with you regarding Overtone docs. All it needs is someone to make it happen :-)

6:28 lazybot: Message saved.

6:29 samaaron: how annoying that the JVM can't do something python can

6:29 laurus: fliebel, I am a beginner at Clojure so I don't think I can contribute to that project though, yet.

6:29 fliebel: samaaron: Rather, that the Mac implementation of Terminos doesn't support it. PySerial uses some custom command on Mac to se the baud rate.

6:31 laurus: Porting functions from untranslated.clj shouldn't be to hard, if you stay away from the ones involving concurrency.

6:31 samaaron: ah ok

6:32 laurus: fliebel, well I will take a look! Thanks for the encouragement.

6:32 fliebel: laurus: That is, if you know Python. Most of it is just javaisms that need to become pythonisms.

6:33 samaaron: fliebel: this purejavacomm project looks interesting

6:35 fliebel: so i noticed you threw a commit at them - did you get things working?

6:37 fliebel: samaaron: I don't know... I copied what PySerial did, and it it is not completely broken, but it doesn;t work with the DPScope either.

6:37 samaaron: fair enough

6:38 if i had any further issues with rxtx, my next plan was to wrap up the binaries shipped with Processing

6:38 to be honest, it's super frustrating that there's no standard serial lib shipped with the JVM

6:39 fliebel: samaaron: https://github.com/nyholku/purejavacomm/issues/4

6:39 samaaron: It would be great if you had any serial device around to verify the change is broken or not.

6:42 samaaron: fliebel: do you have an example of using this lib?

6:42 that i could just hack with and hook my monome up with?

6:43 i'd love to say goodbye to rxtx

6:44 sandbags: guess it's old hate for you guys but i just saw the lighttable demo, pretty nice

6:44 fliebel: samaaron: The pull request has my example code: https://github.com/nyholku/purejavacomm/pull/5

6:44 sandbags: as someone just getting in to learning clojure, that looks like it would be useful and fun

6:44 samaaron: fliebel: cool, thanks

6:45 fliebel: btw, I only today realised that you're Pepijn

6:45 fliebel: samaaron: It's the same api, just a different namespace.

6:45 samaaron: i'm terrible with names :-)

6:45 fliebel: samaaron: Yea, for historical reasons, this is the only place on the internet my nick is fliebel. Tried to change it once, didn't work well.

6:46 samaaron: haha

6:46 oh damn, this API is *nice*

8:12 fliebel: how did you pull down purejavacomm via lein?

8:13 fliebel: samaaron: He has his own maven repo, it's on his homepage.

8:13 samaaron: I tried this to no avail: https://refheap.com/paste/2111

8:13 fliebel: samaaron: Just this part: "http://www.sparetimelabs.com/maven2/&quot;

8:14 samaaron: ah cool

8:14 hmm, doesn't seem to work either

8:15 i must be doing something wrong in my project.clj

8:15 it now looks like this: https://refheap.com/paste/2113

10:16 yoklov: wow, cljs.core.str is very slow.

10:18 much slower than (.join (array …) "")

10:19 at least, in chrome.

10:24 khaliG: I'm wondering how to use this http://clojuredocs.org/clojure_contrib/clojure.contrib.io/write-lines in 1.3?

10:29 yoklov: Hm, you could do (spit the-file (apply str (interleave my-seq (repeat "\n"))

10:30 though that function is probably somewhere now.

10:30 TimMc: lazybot: Mail for me?

10:30 khaliG: i've got a hacky version of it but i'd rather use a standard one if it exists? :/

10:30 yoklov: contrib is gone

10:30 khaliG: yoklov :(

10:31 yoklov: khaliG, i know its hard, but it's better this way

10:33 yeah i don't think that function made the cut for clojure.java.io

10:34 khaliG: fair enough, i'm just going to append some "\n"s and then join them together for spit

10:40 yoklov: you could also do (cl-format the-file-writer "~{~A~%~}" the-seq)

10:40 llasram`: Oh yeah, as far as I can tell, all the functions which try to make lazy seqs work with automatically opening and closing files are gone

10:40 yoklov: after (use 'clojure.pprint)

10:41 llasram: This one doesn't look unreasonable, but read-lines was a file leak waiting to happen

10:41 yoklov: that's probably a good thing, sounds like you might run into issues if you dont wrap it in (doall) or something

10:43 khalig, you could also bind *out* and (dorun (map prn …))

10:43 or println

10:44 khaliG: yoklov, cheers, thanks for the help :)

10:44 yoklov: gotta say, i've never had to use it but i'm glad that cl-format is available should i want to replace a loop with a small and unreadable format string

10:45 khaliG: yoklov, is that from CL?

10:45 yoklov: it is

10:45 khaliG: oooh

10:57 LauJensen: Do we have an fn like .replaceAll, but which takes a pattern instead of a concrete string?

10:59 llasram: LauJensen: ##(doc clojure.string/replace)

10:59 lazybot: ⇒ "([s match replacement]); Replaces all instance of match with replacement in s. match/replacement can be: string / string char / char pattern / (string or function of match). See also replace-first."

11:00 LauJensen: Exactly what I needed, thanks llasram

11:01 llasram: np :-) For future reference, you might find the `clojure.repl/find-doc` macro useful. Also, http://clojuredocs.org/

11:02 LauJensen: Naah, #clojure is my find-doc, usually has better info :)

11:04 xeqi: theres also $findfn

11:04 $findfn "asdfxx" #"x" "s" "asdfss"

11:04 lazybot: [clojure.string/replace]

11:11 llasram: I always forget about one

11:15 mdeboard: What exactly does clojure.java.io.resource do ? I'm looking at a code snippet here, and trying to reference the API

11:15 but the API isn't much help

11:15 snippet https://gist.github.com/cad792af9612ddcc060a

11:15 lines 14-16

11:16 I'm only familiar with reader/writer from that module

11:17 yoklov: that gets the file at "testdata/mol-1000.txt" in the classpath

11:17 mdeboard: Oh I see, returns nil ?

11:17 yoklov: resource returns the url i think

11:18 mdeboard: hm

11:18 xeqi: it will return nil if it can't find it

11:18 mdeboard: I see

11:18 xeqi: are you using lein?

11:18 mdeboard: Oh, so even if I provide an absolute path it stil must be on project class path

11:18 ?

11:18 yoklov: probably not

11:19 but you wouldn't use resource

11:20 mdeboard: xeqi: Yes, I'm using lein

11:23 xeqi: lein uses "resources" as the directory on the classpath by default

11:26 mdeboard: xeqi: I actually have no such directory, but I see it in the output of `lein classpath`. That snippet I linked is actually someone else's that I'm trying to adapt for my own purposes. Where should this text file sit ?

11:28 xeqi: test-resources/testdata/mol-1000.txt should work

11:28 since it's test data

11:30 mdeboard: Well, here's what I'm actually trying to execute https://gist.github.com/45ffc442e4a5f018536b

11:33 xeqi: I'd recommend moving access.upstream.log.sample into your resources dir

11:33 or just using clojure.java.io/file

11:35 mdeboard: Oh, I see, it seems that (resource) fetches the absolute path?

11:36 (moving to resources and calling `(as-file (resource "access.upstream.log.sample"))` returned `#<File /home/matt/matts-hadoop-interview-test/resources/access.upstream.log.sample>`)

11:37 xeqi: resource looks through the classpath for the file, and returns a URL to it

11:37 its useful for loading non-source files from a jar

11:38 mdeboard: Gotcha, so could I have just used `(as-file "/absolute/path/to/file")`

11:38 xeqi: yeah

11:38 mdeboard: Gotcha

11:38 xeqi: resource is more useful for loading something like images from the classpath

11:43 gfredericks: what's that function that lets you combine predicates in an or fashion?

11:44 mdeboard: xeqi: Thanks for your help, I was stuck.

11:44 xeqi: or fashion?

11:45 Raynes: Morning sirs.

11:45 gfredericks: (def boolean? (or-pred true? false?))

11:45 Raynes: I woke up this morning wondering why lazybot couldn't allow eval in a recursive fashion

11:46 Raynes: I was pondering the meaning of the life, but that's cool too.

11:47 gfredericks: What do you mean?

11:47 wkmanire: Mornin' folks.

11:48 gfredericks: Raynes: I mean if you redef eval to defer to clojail, then I could enter ##(eval '(+ 3 4)) and it would recursively pass the (+ 3 4) back to the clojail-eval mechanism

11:48 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

11:48 xeqi: &((some-fn true? false?) false)

11:48 lazybot: ⇒ true

11:48 gfredericks: xeqi: dat it

11:48 thx

11:50 Raynes: gfredericks: That might be possible.

11:50 gfredericks: Open an issue on clojail about it.

11:50 gfredericks: okay.

11:51 done.

11:54 I'm working on a macro that allows unquoting just to prove it can be done

12:09 yoklov: anybody know if cljs's (set! obj.prop val) is supposed to work? looking through the compiler it seems like it might just... happen to work

12:12 happen to work in such a way that it wouldn't work after being closure compiled

12:27 Hali_303: hi! I've just read that defrecords cannot act as functions like regular maps. why is that? isn't that problematic, since much code already uses the (map :akey) notation in code?

12:28 yoklov: i'm not sure that that's true

12:28 hm, seems to be, actually

12:28 well, you can do

12:29 ,(do (defrecord Test [a]) (:a (Test. 4)))

12:29 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

12:29 yoklov: :(

12:29 well, that returns 4.

12:29 its not much help for you but it might ease porting.

12:31 gfredericks: this has been talked about before; I don't remember the reasoning

12:31 might just be to allow other impls of IFn

12:31 speaking of which you can probably implement it explicitly

12:31 Hali_303: yoklov: yeah it works the other way around

12:31 yoklov: yeah

12:31 oh

12:32 you can do (defrecord Test [a] clojure.lang.IFn (invoke [this a] (get this a)))

12:32 then ((Test. 4) :a) will work.

12:32 Hali_303: whoa, nice :)

12:32 ibdknox: wow, dnolen wasn't kidding about doubling my karma

12:33 yoklov: thats probably not particularly clear because i used a as both a property of Test and the argument to invoke but… yeah.

12:33 Hali_303: I'm curious what's the official take on this though

12:33 yoklov: Hali_303, I think gfredericks is right.

12:33 its to allow other impls. of IFn

12:34 and if you want the map-like behavior you should explicitly implement it (as above)

12:39 ibdknox: you might know, does (set! foo.bar val) work in cljs due to the compiler just emitting exactly "foo.bar = val" or is it actually supposed to work?

12:41 wkmanire: Is it common for clojure code to be full of Java objects?

12:41 llasram: wkmanire: It depends on what you're doing. I'd say it isn't uncommon for it to be full of Java objects

12:41 wkmanire: Let's say I wanted to make a simple CRUD application (don't really wish that on anyone)

12:42 An address book that stores information in an SQLite database

12:42 and provides as simple GUI.

12:42 Would I be able to do that without newing up a java object?

12:42 directly that is.

12:43 ibdknox: yoklov: it works accidentally intentionally I think ;)

12:43 yoklov: wkmanire: you should use clojure/java.jdbc for the SQL, but the gui portions you will either end up using java objects directly or using a lib like seesaw

12:43 lucian: wkelly: if you choose the right libraries, probably

12:43 llasram: wkmanire: Probably not 100%, but mostly. There are nice Clojure bindings for e.g. JDBC SQL and Swing

12:44 yoklov: ibdknox: yeah, i thought so, darn.

12:44 mfex: yoklov, set! is used a lot in clojurescript itself

12:44 ibdknox: yoklov: it won't disappear

12:44 llasram: wkmanire: That said, unless you're writing code that you want/need to be portable across Clojure implementations, avoiding direct platform interaction for the sake of avoiding it is just shooting yourself in the food

12:44 ibdknox: there's no reason for it to

12:45 wkmanire: llasram: What a waste of nutrition.

12:45 llasram: ha!

12:45 s,food,foot, :-p

12:45 yoklov: ibdknox: it seems like it might be a thing that breaks after the code is closure compiled though

12:45 ibdknox: ?

12:45 yoklov: actually no, that doesn't make sense.

12:45 ibdknox: yeah, that'll be fine

12:45 mfex: yoklov, it doesn't break clojurescript itself when advanced compiling, so it's save

12:46 llasram: Clojure is designed for solid interop, and it works great. Obviously there are benefits to re-using cleaner abstractions when available, but being able to use rock-solid Java libraries is one of the big benefits of Clojure

12:46 yoklov: it doesn't work if the var is top-level, as opposed to a let.

12:46 or at least, didnt' used to.

12:46 wkmanire: Well, one of the draws of clojure is its practicality so going out of my way to avoid using Java interop doesn't make sense.

12:46 But I have to admit, reading nice pretty clojure code and then all of sudden running across java.something.something.ANewOneOfThese.

12:47 Is like putting salt in your coffee.

12:47 yoklov: wkmanire: well, you can put (:import [java.something.something ANewOneOfThese]) and then just do (ANewOneOfThese.)

12:48 * put in your ns form

12:48 wkmanire: That's be a lot better actually.

12:48 dnolen: ibdknox: pretty crazy 1200+ on HN and 1500+ on reddit. congrats!

12:48 ibdknox: now what? :)

12:48 ibdknox: dnolen: that's a very good question

12:49 I applied to YC with a very different idea

12:49 I mostly did this thing on a whim

12:49 With the intent primarily of throwing some ideas out there

12:49 but judging by the response, this would be worth a lot of money to a lot of people

12:49 dnolen: ibdknox: I think so.

12:50 ibdknox: also much better learning environment than this codeacademy codeschool crap

12:50 ibdknox: haha my first idea before the medical one was Kodowa

12:50 wkmanire: ibdknox: Talking about lightbox?

12:50 ibdknox: an environment to teach you how to code

12:50 wkmanire: Light Table

12:50 wkmanire: lighttable

12:50 sorry

12:51 ibdknox: Any plans for a part 2 of your video?

12:51 I'd really like to see more about that last view you presented.

12:51 ibdknox: I think if there were to be a part 2 it would be showing it working in JS

12:51 wkmanire: Actively showing how what you're hacking on affects the rest of your code.

12:52 mdeboard: I didn't realize that was ibdknox

12:52 I didn't even watch the video

12:52 ibdknox: dude

12:52 how could you not watch the video? :p

12:52 haha

12:52 wkmanire: Can't believe I said light box. That cheesy javascript image display that ended up on half of the internet for a few years.

12:52 mdeboard: I'm typical internet person

12:53 ibdknox: dnolen: biggest bang for the buck would be JS don't you think?

12:53 dnolen: ibdknox: yeah definitely should target JS.

12:53 ibdknox: I might kickstarter it just to see what happens

12:54 dnolen: ibdknox: there's lots of really fast JS parsers in JS now that generate JSON AST. Now's a good time to try it.

12:54 ibdknox: I looked at esprima, any other suggestions?

12:54 Esprima looked good

12:54 dnolen: ibdknox: esprima was the new hotness at JSConf

12:54 ibdknox: k

12:55 longer term I was thinking closed source until launch, then open maybe with a pay what you want model (assuming kickstarter can make it worth the time I'd have to put into it)

12:56 hopefully open source and money don't have to be mutually exclusive lol

12:57 wkmanire: ibdknox: If your IDE is well accepted and becomes a standard tool

12:57 it'll get stolen one way or another.

12:57 ibdknox: yeah

12:58 wkmanire: Microsoft manages to get around that by sueing their customers.

12:58 :D

12:58 ibdknox: lol

12:59 wkmanire: ibdknox: What about making it an HTML5 app?

12:59 ibdknox: it *is* one :)

12:59 wkmanire: So you can start a subscription service.

12:59 ibdknox: eh

12:59 wkmanire: and have levels of features.

12:59 ibdknox: you want to run it locally

12:59 real-time + internet = meh

13:00 real-time + 0latency = win

13:00 dnolen: ibdknox: I would at least try putting it on KickStarter. If you say you will open source it and it will target JS who knows what could happen?

13:01 ibdknox: dnolen: yeah, very ambiguous territory

13:01 wkmanire: ibdknox: :) Well one way or another I hope you make money off of it.

13:01 I want to see people make money for good ideas open-source or not.

13:01 I'm all for open source but programmers have to eat.

13:03 dnolen: ibdknox: one question is whether you actually want to write the whole thing in JS :)

13:05 devn: ibdknox: id drop a dime into a kickstarter for light table fwiw

13:05 mdeboard: Yeah, ditto.

13:05 A literal dime, but.

13:06 devn: ibdknox: as long as clojure/script is the first environment and js the second :)

13:06 ibdknox: dnolen: yeah, that's the question

13:06 yoklov: couldn't you write it in cljs and target js?

13:06 mdeboard: I'd like to get kenneth reitz, ibdknox and mitchell hashimoto together in a single company

13:06 dnolen: ibdknox: personally I'm not excited about writing big projects in JS anymore.

13:06 ibdknox: I do not envy the Meteor guys at all.

13:07 ibdknox: dnolen: I never was ;)

13:07 dnolen: ibdknox: wise man

13:07 ibdknox: dnolen: I don't have to write it in JS really, just a JS parser service backend

13:07 the cool thing is that the interface will be scriptable in anything that compiles to JS :)

13:07 so clojurescript and JS get to work together mostly for free

13:08 dnolen: ibdknox: definitely - but that might probably limit the JS OSS interest.

13:09 ibdknox: might not matter at all as long as people can extend via pure JS.

13:09 ibdknox: the architecture I was thinking of would extremely plugin oriented so you could just right your own thing to replace the ClojureScript one if you wanted all JS all the time

13:10 dnolen: ibdknox: ok that's pure win then.

13:10 ibdknox: wow that was full of fail. would be* write*

13:10 dnolen: ibdknox: that would be a real gift to JS and CLJ/S

13:10 ibdknox: dnolen: yeah

13:10 yoklov: if you did it in cljs it would boost interest in cljs

13:10 ibdknox: it would help everybody

13:10 yoklov: definitely

13:11 dnolen: ibdknox: so Noir on Node? ;)

13:11 ibdknox: haha

13:11 do you know if there's a packaging story for the node runtime yet?

13:11 that's the one thing I'm worried about

13:13 dnolen: ibdknox: not really. No one's owned the Node stuff, it could be really awesome I think.

13:14 ibdknox: dnolen: hm have to figure out a lot there then :/

13:14 dnolen: ibdknox: what packaging issues do you forsee?

13:17 ibdknox: dnolen: nothing specific: just distributing the binary (for each platform) and such

13:18 just a use case that I don't think anyone's had yet and that makes it a little scary - it's always that last 20% that kills you

13:18 lol

13:18 Hali_303: when in emacs REPL, how to make it forget all uses and requires? just as if I've restarted it

13:22 dnolen: ibdknox: well with CLJS you can avoid Node's module system for you own stuff. The only missing bit I think is a good Node REPL, which at most a couple of days of focused work.

13:24 ibdknox: so you don't think the distribution will be a problem then? I remember always having to build from source

13:24 dnolen: ibdknox: oh - but as far as shipping Light Table I'm not sure there's much else you would need beyond what CLJS provides.

13:24 ibdknox: Node?

13:24 ibdknox: binaries for all major platforms now.

13:27 ibdknox: ah, well then I'm not worried about that anymore

13:50 yoklov: well this might be/is an really noobish question but, i'm making a (totally static) cljs page and i'm getting a security error because i'm trying to load an image from elsewhere (e.g. in a local subfolder) and get it's imagedata. I know from experience that this is because i'm not serving anything and i'm just loading the html into my browser, so… what's the best way for me to serve a few static files locally?

13:57 dnolen: yoklov: probably ring or noir

14:01 ibdknox: yoklov: hm.. as long as it's relative to the current file, that should just work

14:02 yoklov: ibdknox: nope. I've had this issue before too

14:02 ibdknox: hm

14:02 clojurebot: excusez-moi

14:02 yoklov: it works if served but gives me "Unable to get image data from canvas because the canvas has been tainted by cross-origin data." and "SECURITY_ERR: DOM Exception 18"

14:02 otherwise

14:02 ibdknox: bah, stupid browsers

14:03 yoklov: yup.

14:03 ibdknox: well lein noir new blahblah and drop it in resources/public/ and you're done

14:04 then just go to localhost:8080/myhtml.html

14:09 yoklov: i actually ended up just using a 6 line node.js script to serve the files, noir seemed like overkill

14:10 muhoo: is there any facility in either lein1 or lein2 to specify :repl-port as a per-USER configuration variable instead of per-project?

14:10 yoklov: still, thanks

14:22 ibdknox: well

14:27 I think light table is going to happen :)

14:27 with a vision far larger than even the ultimate IDE

14:29 crassus: ibdknox: that's awesome

14:30 eggsby: ibdknox: SMALLTALK DID IT FIRST!

14:30 :p

14:30 ibdknox: man

14:30 that stuff kind of pissed me off

14:30 lol

14:30 They didn't do it. If they had, we'd all be using it ;)

14:31 I think people underestimate the value of execution when they see such things

14:31 of course, now I have to execute to prove that :)

14:31 eggsby: meh, if anyone can it's you, certainly have the track record for it

14:32 * ibdknox goes to start filling out a kickstarter :)

14:36 ferd: ibdknox: yes! you read my mind. Go for kickstarter!

14:36 muhoo: well, smalltalk did do a lot of it, but it was UGGLAY.

14:37 ibdknox: muhoo: the design of the thing is the thing (to me)

14:37 muhoo: every used squeak? it's like 80s retro night

14:37 ibdknox: haha

14:38 wow

14:38 a friend asked me in how many countries that post has been seen in

14:38 mdeboard: all

14:38 ibdknox: the answer is 156

14:38 muhoo: most of technology goes in circles. people rediscover and reinvent stuff that existed generations ago. but with a new look, and a new flavor.

14:39 ibdknox: the only large-ish landmasses not accounted for are in central africa

14:39 muhoo: look, we are using a lisp, ffss!

14:39 ibdknox: lol

14:39 Bronsa: lol

14:40 muhoo: so, this is the right time for this. you're in for a wild ride.

14:41 ibdknox: indeed

14:42 it'll be interesting

14:45 ferd: so? where's the kickstarter link? The closest match for "light table" is a bed lamp

14:45 muhoo: compaare and contract lighttable with this: http://bace.s3.amazonaws.com/itwasdonefirst.jpg

14:45 contrast, feh

14:45 ibdknox: I would argue that doesn't accomplish the same thing

14:47 fliebel: samaaron: Did you find a solution for the serial thing?

14:47 muhoo: it's a non-debate really, anyway, a hipster-ish kind of complaint "i was into it before it was cool!"

14:48 ibdknox: haha

14:48 very true

14:48 damn those smalltalk hipsters ;)

14:49 muhoo: good luck. success often finds people in places they least expect it.

14:55 ibdknox: https://twitter.com/#!/ibdknox/status/191236200768610305 :)

14:57 LauJensen: Fine, now kickstart it

14:57 rads: ibdknox. like. I will contribute when the kickstart is up

14:58 LauJensen: Did you guys catch the Pebble project on Kickstart?

14:59 ibdknox: yep

15:03 ferd: ibdknox: I guess you've seen Code Bubbles? http://www.andrewbragdon.com/codebubbles_site.asp just for ideas

15:10 autodidakto: ferd: ibdknox's voice is much better than the Code Bubbles guy. That's how I decide IDEs, anyway

15:12 ferd: autodidakto: #-)

15:12 gfredericks: what is a good name for a macro that is like quote but allows ~ and ~@?

15:14 xeqi: like syntax-quote?

15:14 gfredericks: but without the expansion and the foo# stuff

15:15 autodidakto: Don't be shy -> fred-quote

15:15 gfredericks: ha

15:15 quoot

15:16 xeqi: unhygienic-quote ?

15:16 ferd: soft-quote

15:16 gfredericks: dirty-quote

15:16 ferd: is there something by that name in scheme?

15:16 ferd: dunno

15:16 gfredericks: google time

15:16 man that's a worthless search term

15:21 ferd: regarding quoting: '() is to (quote) as ` is to ... ?

15:21 Bronsa: there is no macro equivalent

15:21 gfredericks: &(read-string "`()")

15:21 lazybot: ⇒ (clojure.core/list)

15:22 Bronsa: ` is hard-coded in the reader

15:22 xeqi: ferd: http://stackoverflow.com/questions/3704372/how-does-clojures-syntax-quote-work

15:22 gfredericks: but the unquoting feature can be extracted

15:23 ferd: thanks... hmm that's cheating ;-)

15:27 gfredericks: there's always qu00t

15:28 ferd: gfredericks: misquote

15:28 gfredericks: haha

15:28 ferd: gfredericks: or... scare-quote

15:28 gfredericks: o_O?

15:28 oh scarecrow

15:29 ferd: ahh, no... a scare quote

15:29 google for it

15:30 gfredericks: that is an odd thing to not know about

15:30 ferd: gfredericks: hey... and English not my native language

15:30 gfredericks: sometimes that can make you more attentive

15:31 ferd: gfredericks: it's not that I "think out of the box"... I AM outside of the box ;-)

15:32 gfredericks: heh

15:32 ferd: ok then, I vote for "misquote"

15:33 gfredericks: okeedoke

15:33 ferd: I like soft-quote, but is too formal

15:33 gfredericks: the other choice was ##(format "lib-%04d" (rand 10000)), which is what I normally name things

15:33 lazybot: java.util.IllegalFormatConversionException: d != java.lang.Double

15:33 gfredericks: wut

15:33 the other choice was ##(format "lib-%04n" (rand 10000)), which is what I normally name things

15:33 lazybot: java.util.IllegalFormatWidthException: 4

15:34 gfredericks: I give up

15:37 mfex: gfredericks, look into gensym

15:37 gfredericks: the function?

15:37 mfex: yeah for the lib-%04d stuff

15:37 ferd: gfredericks: it's rand-int

15:38 gfredericks: ferd: oh duh

15:38 ferd: ##(format "lib-%04n" (rand-int 10000))

15:38 lazybot: java.util.IllegalFormatWidthException: 4

15:38 gfredericks: &(lib-%04d" (rand-int 10000))

15:38 ferd: ##(format "lib-%04n" (rand-int 1000))

15:38 lazybot: java.lang.RuntimeException: EOF while reading string

15:38 java.util.IllegalFormatWidthException: 4

15:38 ferd: hmm

15:38 gfredericks: &("lib-%04d" (rand-int 10000))

15:38 lazybot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

15:38 gfredericks: &(format "lib-%04d" (rand-int 10000))

15:38 lazybot: ⇒ "lib-9833"

15:38 gfredericks: finally

15:39 mfex: &(gensym "lib-")

15:39 lazybot: ⇒ lib-7119

15:39 mfex: &(str (gensym "lib-"))

15:39 lazybot: ⇒ "lib-7127"

15:39 gfredericks: that's not quite random though

15:40 mfex: it's unique

15:40 gfredericks: I'd hate for my lib names to be dependent on lazybot usage history

15:41 mfex: hmm, not sure what your use-case is :)

15:41 gfredericks: naming libraries

15:41 Null-A: wow light table is still on HN

15:41 i've never seen something get 1300 points

15:42 i wonder how many of those people are interested in clojure though

15:53 gfredericks: Okay, pushed up misquote: https://github.com/fredericksgary/misquote

15:53 now to find that guy who needed this yesterday

15:56 mdeboard: Are '-' characters invalid in namespace definitions?

15:56 e.g. (ns some-namespace) ?

15:56 gfredericks: no...

15:56 they'se used all the time

15:56 mdeboard: Yeah, I'm just confused about an error I'm getting.

15:57 gfredericks: are you forgetting where they get converted to underscores?

15:58 mdeboard: Forgetting would imply that at one time I knew

15:58 gfredericks: :) package names and filepaths

15:58 i.e., the things java touches

15:58 mdeboard: https://gist.github.com/2677328cfb1dc72c19ec

15:58 ah

15:59 gfredericks: hm; that's weird

16:02 mdeboard: I'm stumped as to why I can't run this uberjar.

16:06 Anyone have any insight into why I get the error message at the bottom here https://gist.github.com/12d2e610c321e1d51dce with the rest of the code above it?

16:07 ferd: gfredericks: I actually needed "misquote" not long ago for this macro: http://goo.gl/bvUHI . I ended up using '~ all over the place

16:10 gfredericks: ferd: clearly the world has been yearning for it

16:12 xeqi: mdeboard: try adding :impl-ns dat-doop.core to your :genclass

16:14 mdeboard: xeqi: No change.

16:16 It feels like every blog post about Clojure was written in 2010

16:16 gfredericks: those are the ones that have been around long enough for google to know that they're good

16:16 LauJensen: mdeboard: Yea I know. I should really change that :)

16:17 mdeboard: gfredericks: Yeah, but there have been plenty of changes both to Clj and Lein since then

16:17 xeqi: gen-class is converting the ns to a package (- to _). I guess its then reconverting that to the ns to look for the methods

16:17 *not reconverting

16:20 mdeboard: xeqi: So that sounds like if I remove the hyphen it should resolve the problem

16:22 gfredericks: jayunit100: I wrote you a macro for your quoting needs

16:45 sgarrett|afk: Hello #clojure. I'm kind of confused. I'm using bigint however when I try to call methods from the java class I'm getting an error. Does anyone know why this would be happening? I'm getting an error when doing the example code here: http://clojuredocs.org/clojure_core/clojure.core/bigint

16:46 gfredericks: sgarrett|afk: is it the clojure bigint class instead?

16:46 &(type (bigint 84))

16:46 lazybot: ⇒ clojure.lang.BigInt

16:47 gfredericks: wait unless that's what you meant by "the java class"

16:47 my point is there's two bigint classes to be confused by

16:48 Bronsa: ,(.isProbablePrime (.toBigInteger (bigint 97)) 1)

16:48 clojurebot: true

16:48 gfredericks: (-> (BigInteger "83492948924398248289489243") .nextProbablePrime)

16:48 ,(-> (BigInteger "83492948924398248289489243") .nextProbablePrime)

16:48 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Expecting var, but BigInteger is mapped to class java.math.BigInteger>

16:48 gfredericks: ,(-> (BigInteger. "83492948924398248289489243") .nextProbablePrime)

16:48 clojurebot: 83492948924398248289489297

16:48 gfredericks: I love numbers

16:48 Bronsa: ,(.isProbablePrime (biginteger (bigint 97)) 1)

16:48 clojurebot: true

16:48 Bronsa: ,(.isProbablePrime (biginteger 97) 1)

16:48 clojurebot: true

16:48 Bronsa: derp

16:51 sgarrett: I see. Well I'm working with binary numbers is why I guess I'm running into the issue. I was declaring the numbers like 2r1111111111111111000000000000000000000000000000000000000000000000 and then I wanted to call toByteArray so that I could go through each bit. So I have to convert to biginteger?

16:51 Just want to make sure there isn't a better way I guess.

17:34 groovemonkey: quick question, because #leiningen is extremely quiet...

17:34 I just added a /data directory to the root of my lein project.

17:34 Now 'lein run' produces a FileNotFound Exception for the files

17:34 that I've moved to the new directory. How do I add this

17:34 directory to those that Leiningen knows about?

17:39 yoklov: i think it's something like :resources-path "data/" in project.clj

17:39 or just rename the directory to resources/

17:43 sgarrett: Is there a way to do a bit-and on a BigInt?

17:44 groovemonkey: yoklov: sorry, didn't see until now. Thanks, I'll try that.

17:44 yoklov: lol, don't worry about it. hope it works.

17:54 groovemonkey: didn't work :( -- I tried setting the :resources-path to "resources/" and "data/" respectively -- it seemed to get leiningen looking in the right place, but it still throws a FileNotFound Exception: could not locate <classfile> or <correct/path/to/file.clj> on classpath.

17:55 is there a way to add things manually to the classpath?

18:04 jayunit100: hmm is there a way i can look up all functions that have args related to a given type ?

18:04 i.e. All clojure.core functions which operate on sequences .

18:08 amalloy: functions don't have types

18:09 jayunit100: yeah thats the trouble. But it is true that some functions are type constrained.

18:09 Raynes: Yes, but not in a way that you can actively check for.

18:09 jayunit100: (assoc '(1 2 3) 0 1) ---> fails (because lists aren't associative).

18:10 ok.. oh well i guess i can use doc-find

18:10 amalloy: well, you can try http://www.clojureatlas.com/, or the clojure cheatsheet

18:10 jayunit100: (find-doc) i mean. Yeah the atlas is a good resource.

18:14 octagon: whoa @clojureatlas

18:14 awesome

18:17 is there a doc that describes all of the clojure means of abstraction, with a rundown of where each one is and is not appropriate/useful? i'm trying to get the big picture view.

18:18 gfredericks: jayunit100: did you see my thing-I-said two hours ago?

18:22 octagon: some of the essays on clojure.org might be helpful?

18:24 octagon: gfredericks: yes, i was looking for the lazy way; i guess i need to compile my own notes from there, anyway

18:26 gfredericks: &(let [a (make-array Byte/TYPE 50)] (dotimes [n (count a)] (aset a n 5)))

18:26 lazybot: java.lang.IllegalArgumentException: No matching method found: aset

18:26 gfredericks: what on earth is going on there

18:30 amalloy: (instace? Byte/TYPE 5)

18:30 &(instance? Byte/TYPE 5)

18:30 lazybot: ⇒ false

18:30 gfredericks: oh hm

18:31 that makes total sense in hindsight

18:31 amalloy: &(let [a (make-array Byte/TYPE 10)] (dotimes [n (count a)] (aset a n (byte 5))) (seq a))

18:31 lazybot: ⇒ (5 5 5 5 5 5 5 5 5 5)

18:31 gfredericks: I will never know the exact conditions under which java numbers can be converted to other types.

18:31 muhoo: base 5, eh?

18:32 gfredericks: somehow I was convinced I was using dotimes wrong

18:32 that it was acting like doto for some perverse reason

18:35 amalloy: gfredericks: well, it's confounded by the fact that clojure has its own type-conversion rules

18:35 gfredericks: that does sound confounding

18:37 muhoo: don't java numbers have their own static Num/toFoo methods for converting to the things they're allowed to be converted to?

18:41 amalloy: so i learned something new about java today. for some values of Foo and bar, you can write (without causing an NPE):

18:41 Foo x = null;

18:41 x.bar();

18:58 huangjs: hmm... there's lein-clojurescript and lein-cljsbuild, which one would you recommend?

19:06 muhoo: there's also cljs-template. and clojurescriptone. i'd love to know how all this stuff fits together (or doesn't).

19:18 mads-: Hi. Does anyone know where I can find clojure.jar if I have downloaded clojure through apt-get install clojure?

19:19 lynaghk: huangjs: you want lein-cljsbuild.

19:20 amalloy: mads-: start with apt-get uninstall clojure :P

19:20 or remove, i guess? i don't uninstall stuff that often

19:20 mads-: amalloy: aaand theen? :)

19:21 amalloy: http://stackoverflow.com/questions/5983427/how-to-install-clojure-on-ubuntu-10-04-from-github-repo-with-no-clojure-jar

19:21 see also the leiningen readme

19:23 mads-: thanks

19:25 muhoo: what's the advantage of using midje versus clojure built-in test machinery?

19:29 huangjs`: lynaghk: thanks

19:34 jayunit100: ,(assoc (vector-of :char) 0 "s")

19:34 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>

19:34 jayunit100: odd error message.

19:35 Understandable... but i think it should simply report that "" is not a char.

19:35 gfredericks: that looks like the jvm's doing

19:37 jayunit100: Well... so is everything :)

19:38 But the difference here is that, in java, the statement ------ new Vector<Character>().add('c') ; ----- would not compile.

19:38 I mean, new Vector<Character>().add("c") ; .....

19:39 So I think it should be a :pre assert ~ that the assoc value is the same type as the assoc enum.

19:40 dnolen: bbloom: heya, could you create a patch for the column modifications to the Clojure compiler?

19:40 bbloom: hey

19:40 i'm working on both my patches right now

19:40 the track-pos patch for the cljs compiler is a pain in the butt to maintain

19:40 each time you change the compiler, i have a lot of work to redo :-P

19:41 dnolen: bbloom: yeah sorry about that. that's why I want to get it in now.

19:41 bbloom: yup

19:41 shouldn't be long, but i may get interrupted

19:41 you going to be around for a while?

19:41 dnolen: bbloom: probably not for too much longer this evening - but as soon as you have a new patch I will test and apply.

19:42 bbloom: ok great

19:42 i'll probably finish the cljs change, but i don't know if i'll get to the clj reader one

19:43 sparkleshy: is there any better way to do C-like static locals than wrapping the defn in a let or using def inside the defn?

19:43 bbloom: dnolen: do you have good test cases for your recent optimizations? the variadics, the dynamics, etc?

19:43 dnolen: bbloom: sure, a clj reader patch would be nice so it passes Andy's prescreening script

19:43 bbloom: because i don't think my twitter test covers them & i'm merging those conflicts now

19:43 amalloy: sparkleshy: def inside defn is evil and also not anything like static locals

19:44 i don't see how you could want something "better" than wrapping the defn with a let - that's about as good as it could possibly be

19:44 bbloom: dnolen: i can make a patch for the clj reader, but it's highly untested :-) if the concern is to meet the prescreener, that's no problem

19:44 but if you want it to work… that's another story ;-)

19:44 my patch did build and pass the tests when i made my github branch tho

19:44 dnolen: bbloom: no tests for the optimizations - my assumption was that all the current tests should just work :)

19:44 bbloom: i just didn't dig in to make sure it's solid & covers everything i need it to cover

19:44 jayunit100: what are the limits on lazy-seq ?

19:45 in terms of its inputs -

19:45 raek: sparkleshy: you want to maintain state between function calls?

19:45 sparkleshy: amalloy: I know, it's _so_ evil.

19:45 dnolen: bbloom: sure but having the patch is a good reference point.

19:45 bbloom: k

19:45 dnolen: bbloom: also people can easily apply and get to work on the source mapping stuff.

19:45 bbloom: k

19:45 raek: jayunit100: anything seqable is fine

19:46 jayunit100: so what im wondering though is - how can it gaurantee laziness ?

19:46 dnolen: bbloom: by actually working on source mapping I think we can discover what's missing.

19:46 bbloom: it was reassuring that you patch was good enough for Light Table ;)

19:47 raek: sparkleshy: using global state: (def state (atom 0)) (defn next-number [] (swap! state inc))

19:47 jayunit100: I mean, if I have function which returns a list ... And it precalculates all 10 vals in the list --- then its not really lazy, is it

19:47 bbloom: dnolen: I didn't realize that it was used for that

19:47 awesome! :-)

19:47 sparkleshy: raek: Not between; more like (let [rand (java.util.Random.)] (defn gaussian (.nextGaussian rand))). Which is bad code but it's an example.

19:47 raek: Er, put a [] after gaussian

19:48 raek: (def ^{:private true} rand (java.util.Random.)) is another way

19:48 jayunit100: IS there a "loop-recur" aware lazy seq that invokes the loop, caching state between invocations ? That would be "true" laziness.

19:49 raek: jayunit100: you can easily translate a function that is implemented using loop, recur, and cons into one that is lazy

19:49 jayunit100: i.e. something like the python "yield" idiom.

19:49 sparkleshy: raek: I know, I can do a def outside, but I wish I could keep my internal data inside because it feels cleaner and stuff.

19:49 raek: I think the let is fine in that case

19:50 bbloom: dnolen: http://dev.clojure.org/jira/browse/CLJ-960

19:50 sparkleshy: raek: The real issue is that with code folding, the def is completely hidden by the let.

19:50 dnolen: bbloom: excellent thx

19:50 sparkleshy: raek: But the let is part of the implementation of the def, not the other way around

19:50 bbloom: ant succeeds, didn't check anything else

19:51 dnolen: bbloom: Andy's prescreener will catch problems.

19:51 raek: jayunit100: let's assume you have this: (loop [n 5, result []] (if (zero? n) result (recur (dec n) (conj result n)))

19:51 bbloom: cool

19:51 back to untangling this compiler emit stuff :-)

19:52 dnolen: bbloom: thx very much.

19:52 jayunit100: raek okay good start -> how to lazify it

19:52 ?

19:53 The problem of course is that loop/recur will recur all 5 times inside the function body , unless you wrap it in a macro or something .

19:53 raek: the lazy variant would then be: (letfn [(f [n] (lazy-seq (if (zero? n) nil (cons n (f (dec n))))))] 5)

19:54 the difference is that each step gets wrapped in a lazy-seq

19:54 and that the recursive call is not done using 'recur'

19:54 and the result is not built up using an accumulator variable

19:55 sgarrett|afk: Is there a way to bit-and with a BigInt?

19:55 jayunit100: hmm but this function would have to be manually iterated.

19:56 Is there a way to make it more decoupled - so that it simply emits the next value , repeatedly.

19:56 raek: in a way, that's what f does here

19:56 jayunit100: hm okay me analyze it some more and get back .

19:57 raek: you can think of lazy-seq as yield and seq as a call to a generator

19:57 well, rougly

19:58 here's a function defined in many equivalent ways: https://gist.github.com/951633

19:58 sparkleshy: summary: is there any better way to do C-like static locals than wrapping the defn in a let or just doing another def outside? Not for keeping state between calls; more like (let [rand (java.util.Random.)] (defn gaussian [] (.nextGaussian rand))). Which is bad code but it's an example. Since the let is part of the implementation of the def, I want it inside, and I want only the def to appear when using code folding.

19:59 raek: sparkleshy: no.

20:00 gfredericks: sparkleshy: (def my-fun (let [rand ...] (fn [] (.nextGaussian rand))))

20:00 if you can tolerate def instead of defn

20:00 sparkleshy: gfredericks: cool! but I want something better. Like (defn gaussian [] (.nextGaussian (cache (java.util.Random.))))

20:02 gfredericks: sparkleshy: there are definitely some ugly-ass ways to do something like that

20:02 raek: it is definitely possible to write such a cache macro, though

20:02 gfredericks: raek: could even be a function

20:02 that just does a bunch of offensive global mutation

20:03 sparkleshy: but with a function wouldn't it create another Random each time through gaussian?

20:03 raek: in the current form, it looks like you only would like the argument to 'cache' to be evaluated once

20:03 gfredericks: sparkleshy: my guess is that at this point every possible way of giving you what you want would be quite unidiomatic

20:04 sparkleshy: gfredericks: So... this thing I want is inherently bad?

20:04 gfredericks: the main issue is code folding? i.e., you want the first line to summarize the thing?

20:05 raek: well, you could make (cache foo) expand into (cache* (fn [] foo)), where cache* is a function

20:06 gfredericks: raek: I think you have to do some kind of global mutation, whether it's a macro or function

20:06 sparkleshy: gfredericks: It wouldn't be actually clean without an implementation of the cache macro

20:06 what about (defmacro cache [exp] (let [sym (gensym)] (eval `(def ~sym ~exp)) sym)) ?

20:06 raek: gfredericks: yes.

20:07 which would add runtime overhead, I guess

20:07 since the function would need to check if the value has been calculated

20:09 gfredericks: I guess it all seems very sneaky

20:10 sparkleshy: okay. That implementation works.

20:11 in (println "hi") (cache (println "beta")) can I rely on hi printing before beta?

20:12 also, is the way it uses def going to cause performance issues vs the previous wrap-the-defn-in-a-let solution?

20:12 i mean, in really intensive code. Like, is performance _ever_ something to worry about with the cache macro?

20:14 gfredericks: I don't think there are any performance issues there

20:14 it should be equivalent to using an explicit top-level (def)

20:14 everything else happens at compile-time

20:17 sparkleshy: yeah... rephrase: would (let [rand (java.util.Random.)] (defn gaussian [] (.nextGaussian rand))) be any slower than (def rand (java.util.Random.)) (defn gaussian [] (.nextGaussian rand)) ?

20:17 gfredericks: the let might be faster since there's no var involved

20:18 but I don't know much about those things

20:23 bbloom: *sigh* waiting on the v8 compile…. i sometimes forget how much i appreciate instantaneous development feedback

20:24 dnolen: bbloom: haha, though v8 build time isn't so bad.

20:24 bbloom: i'm on a year old macbook air

20:24 my poor little cpu can't handle it :-)

20:24 my big bad machine is at the office

20:25 dnolen: bbloom: heh oh yeah. As much as I like the MB Air, having a 2.66 dual core i7 has it's perks.

20:26 gfredericks: debugging aleph is hard :(

20:27 bbloom: dnolen: i'm seeing something a bit odd with cljs compiler output (before my changes), maybe you can explain

20:27 dnolen: bbloom: it will be a happy day when we can debug CLJS right in the browser.

20:27 bbloom: hopefully browsers will support some JSON syntax highlighting description format.

20:27 bbloom: what's up?

20:27 bbloom: i'm seeing a few calls to cljs.core.get.SOMEGENSYM

20:27 what's that about?

20:28 dnolen: bbloom: __N, direct multi arity dispatch support

20:28 bbloom: ah ok

20:29 for my debugging diffs, i have been using sed to rewrite gen syms so they don't show up on diffs

20:29 but it can be confusing b/c ALL THE GEN SYMS LOOK THE SAME :-)

20:29 hehe

20:29 thanks

20:31 and nice work on all the recent perf improvements

20:31 good stuff!

20:32 lynaghk: dnolen: yeah, those performance improvements were boss.

20:33 dnolen: bbloom: lynaghk: thanks!

20:35 lynaghk: dnolen: what's the story with the GSoC stuff, by the way?

20:36 dnolen: lynaghk: I just sent out an email about that on clojure-dev, we need to pick up the pace a bit, 9 more days to review and score etc.

20:36 lynaghk: we've been allocated 4 slots, which is nuts for a first time mentoring organization.

20:36 lynaghk: I sent you an email a while back about the students who contacted me---I dunno if you want me to reproduce that on Melenage. (I thought it'd be safer to send you an email than try and figure out how to write something private on that terrible UI)

20:37 dnolen: guess Google is excited about the ()'s

20:37 dnolen: lynaghk: all admins and mentors can leave private comments.

20:37 lynaghk: Melange is so lame.

20:38 lynaghk: I our crop of proposals was surprisingly strong.

20:38 Clojure programmers don't mess around.

20:38 lynaghk: dnolen: okay, I might poke around and put some updates on Melenage then. I really want the students to actually write some code before I feel like moving ahead.

20:38 dnolen: I "think our proposals" I mean.

20:38 lynaghk: dnolen: yeah. I particularly liked Chris Granger's difficulty level of "medium to insane".

20:39 Go big or go home.

20:39 ibdknox: lynaghk: it's true

20:39 dnolen: lynaghk: yes, please go through the proposals thoroughly, even ones you aren't mentoring.

20:39 ibdknox: a choose your own adventure of sorts ;)

20:40 dnolen: anything that doesn't have a mentor at this point isn't something we should consider.

20:40 bbloom: dnolen: so the column numbers are pretty easy to screw up if with-out-string or anything like that gets used

20:40 dnolen: bbloom: but nobody should be using that right?

20:40 bbloom: dnolen: i'm tracking down one new issue now… but i'm trying to think about how to prevent this going forward

20:40 dnolen: right

20:41 k think i got it

20:41 my little column-aligned line number comment trick is good enough for now

20:41 a bug or two may creep in before source-maps gets implemented proper

20:41 but visual inspection will do until then

20:42 lynaghk: If I write {:a @(future (x)) :b @(future (y))} will the calls to x and y be executed in parallel?

20:42 ibdknox: dnolen: light table just passed Meteor in points on HN

20:42 dnolen: bbloom: cool, your changes are nice, it's a necessary step for decoupling the compiler from JS any how.

20:42 ibdknox: not surprising, Light Table is way more impressive IMHO.

20:43 bbloom: dnolen: thanks. they also clean up a few small things. in the output: a few less random blank lines, eliminates some redundant parens, cleans up spacing. in the compiler code: fewer (println (str ….)) with teh various extra ()() forms :-)

20:49 michaelbarton: I have a beginner's question. I'm trying to create a lazy sequence from a file but I'm getting either OutOfMemory (heap) errors or stream closed errors. I feel like there must be an idomatic way for this that I'm missing.

20:51 The stream closed errors come when I try to wrap the reader in a with-open block.

20:53 bbloom: dnolen: ok, ready with patch for track-pos

20:53 struggling with git format-patch tho :-P

20:54 S11001001: michaelbarton: dynamic scope and laziness mix weirdly

20:54 bbloom: http://stackoverflow.com/questions/616556/how-do-you-squash-commits-into-one-patch-with-git-format-patch :-)

20:55 S11001001: if you like, you can do this instead, just note that unless you consume the whole input, the stream won't close: (concat my-lazy-seq (lazy-seq (.close stream) nil))

20:56 michaelbarton: OK. Thank you for the suggestion.

20:56 bbloom: dnolen: http://dev.clojure.org/jira/browse/CLJS-176

20:57 michaelbarton: How does the concat work in that function?

20:58 arohner: is there a fn like partition, but splits the seq into n equal sized seqs?

21:01 bbloom: ,(doc partition-all)

21:01 clojurebot: "([n coll] [n step coll]); Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end."

21:01 bbloom: that what you mean?

21:01 gfredericks: arohner: oh you want something where the partition size is based on the length of the sequence?

21:01 arohner: gfredericks: yes

21:01 gfredericks: arohner: I don't think there is anything built in; would not be lazy-friendly

21:02 (partition (quot (count coll) n) coll)

21:02 michaelbarton: arohner: Divide the length of the sequence by n, then partition by n size?

21:02 arohner: yes. I know how to implement it, I was just checking that it didn't exist yet

21:02 michaelbarton: arohner: OK

21:11 dnolen: bbloom: thx a million. gotta run but will give this a serious look tomorrow and try to appy then.

21:11 Clojure community rocks.

21:11 bbloom: :-)

21:25 socksandsandals: really n00b question here: if I have (def foo 12) in a file, how does one go about later changing that variable's value?

21:25 should I just (def) it again later?

21:25 S11001001: socksandsandals: try not to change it ever

21:26 socksandsandals: exactly the answer I wasn't looking for

21:26 S11001001: socksandsandals: so, as a newbie, you may be reaching for solutions appropriate in other languages, but not clojure

21:26 I can't be sure, so I err on the side of caution

21:26 typically, vars are only changed during development

21:26 socksandsandals: I'm a n00b to Clojure, not programming or Lisp

21:27 S11001001: right, that's what I said

21:27 socksandsandals: so I have a shutdown function that isn't determined until runtime

21:27 S11001001: if your program, while running, requires changes to global state, then setting a var is the wrong solution

21:27 socksandsandals: so I need to assign it to something to hold on to it for when I go to shutdown the server

21:28 S11001001: instead, you probably want an atom, ref, or future, depending on the concurrency semantics you desire

21:28 s/future/agent/

21:28 clojurebot: Titim gan éirí ort.

21:28 S11001001: in this case, it sounds like you want an atom

21:28 socksandsandals: there's no concurrency involved in this case which is why I was wondering if I could just rebind the def

21:28 but an atom would work, too

21:28 thanks S11001001

21:28 S11001001: np

21:29 socksandsandals: S11001001: if an atom holds a function, I can still call it with just @atomname, right?

21:30 S11001001: (@atomname args...)

21:30 socksandsandals: yeah, ok nice, thanks

21:30 right, Clojure is a Lisp1 so no need for apply

21:30 perfect

21:30 S11001001: funcall, rather

21:30 socksandsandals: oh right

21:37 S11001001: I wish it had funcall, anyway; sometimes it's just what you need for some HOF. Same for this: (defn first-arg [x & _] x)

21:38 gfredericks: (def first-arg (comp first list))

21:38 S11001001: gfredericks: strict in the rest

21:38 having written first-arg 3 or 4 times, and $ (funcall) at least once

21:39 gfredericks: S11001001: you mean it realizes any lazy-seq-args?

21:39 S11001001: aye

21:40 gfredericks: ,(doc list)

21:40 clojurebot: "([& items]); Creates a new list containing the items."

21:40 gfredericks: ,(-> (range) (apply list) (first))

21:40 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn>

21:40 gfredericks: ,(->> (range) (apply list) (take 10) last)

21:41 clojurebot: Execution Timed Out

21:41 gfredericks: well wudduyaknow

21:41 S11001001: clojure.walk depends on it

21:42 michaelbarton: I'm struggling to process a 2.5m line file.

21:42 I'm trying to create a set and a map from the data but I'm running out of memory

21:43 S11001001: michaelbarton: https://groups.google.com/d/topic/clojure/FC36I1iqZcs/discussion

21:44 michaelbarton: Interesting, I am working on a graph too.

21:44 Thank you.

21:45 S11001001: gfredericks: not only does it realize them, it constructs a proper PersistentList structure, setting aside whatever conses/chunkedseqs/magic bits you had

21:45 (that is what clojure.walk required)

21:46 michaelbarton: especially beware if you first walk the whole list creating the set, then again creating the map. That won't let go of the source lazy sequence, whereas doing them together will

21:46 gfredericks: that structure being just a vanilla linked list?

21:46 S11001001: gfredericks: it is also counted

21:47 gfredericks: oh nice

21:47 S11001001: I guess

21:47 I'm against wasting all the bits really, but oh well

21:52 fdaoud: ,(first (map / [1 1] [2 0]))

21:52 clojurebot: 1/2

21:52 S11001001: huh, weird

21:52 ,1/0

21:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ArithmeticException: Divide by zero>

21:52 S11001001: ,(do 1/0 nil)

21:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ArithmeticException: Divide by zero>

21:52 fdaoud: ,(first (map #(%) [#(/ 1 2) #(/ 1 0)]))

21:52 clojurebot: #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

21:52 fdaoud: why does the first version work but not the second? (lazy)

21:53 S11001001: oh, right

21:53 because the variadic map doesn't do fancy tricks for chunked

21:53 fdaoud: huh?

21:53 S11001001: you only get fancy tricks in the one-sequence case

21:53 the multi-sequence version is naive, and doesn't do chunking

21:54 fdaoud: so lazy is only lazy by chunks?

21:55 S11001001: in general, laziness cannot be relied upon to be "pure". There are exceptions, like iterate

21:55 for efficiency, vectors yield "chunked" sequences, therefore lazy operations on them also "chunk" if someone implemented that

21:56 fdaoud: ,(first (map #(%) (concat (repeat 1000 #(/ 1 2)) [#(/ 1 0)])))

21:56 clojurebot: 1/2

21:56 S11001001: map, filter, and several other operations special-case for the chunking case

21:56 fdaoud: I understand, thanks for the explanation S11001001

21:56 michaelbarton: Is there a way to increase the java memory size from inside a clojure program?

21:56 fdaoud: if it wasn't for you I would not have slept tonight.

21:57 S11001001: happy to help then :)

21:57 fdaoud: ,(first (map #(%) (concat (repeat 100 #(/ 1 2)) [#(/ 1 0)])))

21:57 clojurebot: 1/2

21:57 fdaoud: ,(first (map #(%) (concat (repeat 10 #(/ 1 2)) [#(/ 1 0)])))

21:57 clojurebot: 1/2

21:59 S11001001: ,(count (chunk-first (seq (concat [1 2 3] (vec (range 35))))))

21:59 clojurebot: 3

22:00 S11001001: ,(count (chunk-first (seq (chunk-rest (seq (concat [1 2 3] (vec (range 35))))))))

22:00 clojurebot: 32

22:00 S11001001: ,(count (chunk-first (seq (chunk-rest (seq (chunk-rest (seq (concat [1 2 3] (vec (range 35))))))))))

22:00 clojurebot: 3

22:00 S11001001: ,(count (chunk-first (seq (chunk-rest (seq (chunk-rest (seq (concat [1 2 3] (vec (range 39))))))))))

22:00 clojurebot: 7

22:00 S11001001: concat is good

22:01 mdeboard: Does anyone else have trouble with Cascalog in Emacs?

22:01 Get a lot of weird errors

22:01 program just constantly throws errors after awhile any time I try to run anything.

22:03 runs out of memory, seems like.

22:04 S11001001: michaelbarton: if there is, it's probably buried in JMX somewhere, but I really doubt it

22:05 mdeboard: Speaking of, how DO You set -Xmx/-Xms for slime ?

22:08 S11001001: probably by setenv JVM_OPTS in emacs

22:08 mdeboard: orite

22:12 michaelbarton: OK. I'm running the script using the clj shebang so I'm not sure how to increase the memory.

22:13 S11001001: never used that. Never installed clojure, honestly

22:13 clojurebot: Gabh mo leithscéal?

22:13 michaelbarton: Perhaps java environment arguments.

22:14 Never installed clojure?

22:14 S11001001: nope

22:14 michaelbarton: How do you use it?

22:14 S11001001: I use leiningen

22:15 michaelbarton: Ah, I see.

22:15 S11001001: you could do this #!/bin/sh\ntrue; SOMEENV=someval clojure-thingy "$0" "$@"

22:15 with an exec in there somewhere

22:16 michaelbarton: Is it easy to create short scripts with lein?

22:16 S11001001: maybe not, but I would do it that way anyway

22:17 #!/bin/sh\njava -cp `cd my-proj && lein classpath` clojure.main -e '(run this)'

22:18 michaelbarton: OK

22:18 S11001001: I love libraries

22:18 and I bet the #! thing doesn't work well with them

22:19 michaelbarton: I tried lein previously. I found the learning curve a little steep so I'm using scripts until I'm more comfortable with clojure.

22:19 S11001001: I can't speak to the efficacy of that approach

22:19 michaelbarton: OK

22:23 mdeboard: michaelbarton: Yeah you really don't want to futz with running clojure itself. Use lein

22:26 S11001001: I would agree, but I love build systems and emacs, so maybe I am the wrong one to ask

22:27 michaelbarton: OK

22:27 My script is only 19 lines long so it seemed ling using a clj shebang was simpler

22:29 S11001001: it may end up 19 lines long, but you also have to write it :)

22:33 michaelbarton: I guess I'll try playing about with trying to make my script more lazy, then otherwise make in in lein.

22:33 S11001001: good luck

22:33 michaelbarton: Does clojure GC automatically clear up unused variables?

22:34 I mean no longer used.

22:34 S11001001: do you mean vars created by def or bindings created by let?

22:34 bbloom: 4clojure.com is down :-( trying to work through a problem or two a day :-P

22:35 michaelbarton: def variables after they're used and not referenced again.

22:35 S11001001: michaelbarton: no

22:36 michaelbarton: OK

22:36 I should use an atom instead, then clear it?

22:36 S11001001: hmm, what are you trying to do?

22:37 aperiodic: yeah, if you use an atom and then change its value, the old value will be GC'd if there are no other references to it

22:37 michaelbarton: I have pairs of key/values and I need to covert them to a network format. The problem is key1-key2 and key2-key1 need to be merged to a single value.

22:38 S11001001: data in general shouldn't be stored in vars at all; vars are best for your functions, static data, and dynamic context bindings. So if this is intermediate state, you should usually just pass it between functions

22:38 michaelbarton: OK

22:39 bbloom: michaelbarton: if you're concerned with leaking memory during interactive development, you can use ns-unmap

22:39 that will "delete" the Var

22:40 michaelbarton: OK

22:40 Thank you both.

23:07 TimMc: $mail samaaron I don't know if I'll get aorund to making the Overtone instrument-samples doc tool anytime soon, so that idea is free to a good home. :-)

23:07 lazybot: Message saved.

Logging service provided by n01se.net