#clojure log - Mar 15 2013

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

0:10 johnmn3_: (let [fr (js/FileReader.) _ (.readAsBinaryString fr my-file)] (.-result fr))

0:11 there's the bytes

0:17 I'm constantly getting brepl disconnects. socket write errors. Is there a way to avoid that?

0:20 rationalrevolt: ,(defmacro a [] `(fn [d#] (+ @~d#)))

0:20 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

0:21 rationalrevolt: this gives me an error "Unable to resolve symbol: d# in this context"

0:22 is this not allowed / is there an alternative?

0:22 ,`(fn [d#] (+ @~d#))

0:22 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: d# in this context, compiling:(NO_SOURCE_PATH:0:0)>

0:30 ambrosebs: rationalrevolt: you want (apply + d#)

0:31 rationalrevolt: no, i think its not allowing me to defer to g# inside the unquote splice

0:31 *refer

0:31 d#

0:31 bbloom: rationalrevolt: yeah, you can't refer to gensyms in unquoted contexts

0:32 rationalrevolt: because those symbols represent stuff in code that has yet to be constructed, never mind evaluated... and unquoted code is evaluated

0:32 rationalrevolt: ambrosebs provides the solution

0:32 rationalrevolt: but the outer most expression has a `

0:32 hiredman: ,`d#

0:32 clojurebot: d__35__auto__

0:32 hiredman: ,'d#

0:32 clojurebot: d#

0:33 bbloom: rationalrevolt: ~ and ~@ undoes a layer of `

0:34 rationalrevolt: alright

0:38 johnmn3_: https://www.refheap.com/paste/12580

0:39 I'm having trouble with a defn in cljs, in the above refheap

0:39 hiredman: johnmn3_: the js file reading stuff is all async

0:40 johnmn3_: I need a doall?

0:40 hiredman: no

0:41 it is async in js, you need to setup on onload call back on the rdr

0:41 johnmn3_: ooooh

0:41 even though I already have the file stored in an atom?

0:42 hiredman: https://gist.github.com/hiredman/5167534

0:43 johnmn3_: okay, I think I'm tracking

0:44 does it matter what the onload function does? if all I want is the result of readAsBinaryString?

0:55 oh, the -result goes in the onload

0:59 jjjddd0: Does anyone here know how to make luminus app work in counterclockwise ??

0:59 lazybot: jjjddd0: Definitely not.

1:00 jjjddd0: I'm having a problem with this at the moment: I keep getting "FileNotFoundException Could not locate clabango/parser__init.class or clabango/parser.clj on classpath: clojure.lang.RT.load (RT.java:443)"

1:00 akhudek: jjjddd0: I don't know much about cc, but it sounds like your deps were not pulled in.

1:01 amalloy: ~helpme

1:01 clojurebot: A bug report (or other request for help) has three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it's awfully hard to help you.

1:02 jjjddd0: akhudek: the weird part is running lein ring server in terminal works fine. But I can't load myproject.repl in the CCW repl without getting this error

1:03 Also weird, in the previous version of luminus, clabango was not included as a dep and things worked fine

1:05 Frozenlock: (binding [noir.session/*noir-session* {:username "a"}] (session/get :username)) ----> ClassCastException clojure.lang.PersistentArrayMap cannot be cast to java.util.concurrent.Future

1:05 o_O

1:06 (binding [noir.session/*noir-session* {:username "a"}] (get noir.session/*noir-session* :username)) ---> "a"

1:07 The atom is trolling me...

1:07 tomoj: noir?

1:07 clojurebot: noir is great

1:07 Frozenlock: lib-noir

1:08 amalloy: Frozenlock: sounds like *noir-session* isn't supposed to be a map

1:08 Raynes: tomoj: lib-noir has a whole lot of noir.

1:08 amalloy: presumably it's supposed to be a future of a map

1:08 Raynes: amalloy, Frozenlock: amalloy is right, it is an atom.

1:08 Well, he *was* right until he went and caught the dums there at the end.

1:09 wat, why that error

1:09 tomoj: goddamn exclamation points everywhere

1:09 excuse me, just woke up :)

1:09 amalloy: &(deref {})

1:09 lazybot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IDeref

1:10 Frozenlock: Yup, works fine with an atom.

1:10 Raynes: Yeah, it certainly shouldn't ever be a future.

1:10 Frozenlock: Thanks :)

1:10 tomoj: in 1.5 deref falls back to Future

1:10 Raynes: But amalloy didn't catch the dums like I thought, since the error alluded to it.

1:10 amalloy: Frozenlock: i doubt if you're supposed to bind it yourself, though

1:10 Raynes: You are not.

1:10 But he is probably testing.

1:10 In which case he has to do that.

1:11 Frozenlock: No I'm not, but I'm trying to debug a function that was working in Noir and isn't anymore...

1:11 amalloy: i'm surprised there isn't a (with-session {} ...) macro

1:11 you apparently can't use sessions except by wrapping a ring handler

1:12 Frozenlock: amalloy: There was a 'with-noir' function in the days...

1:12 IIRC it was just binding the dynamic variables.

1:26 yunfan: bbloom: but i am a chinese, 28 server is really not that cheaper than my times

1:26 bbloom: yunfan: then optimize away

1:27 yunfan: bbloom: ]

1:42 Frozenlock: Anyone familiar with *excel*? (creepy music in the background). I wonder if I should export some time data as an iso-8601 string or a milliseconds timestamp.

1:43 bbloom: Frozenlock: i'd go with milliseconds

1:44 Frozenlock: http://office.microsoft.com/en-us/excel-help/excel-functions-by-category-HP005204211.aspx

1:44 the DATEVALUE function is quite limited when it comes to standard formats

1:45 those pages also document windows AND mac epochs, internal date formats, etc

1:45 there is also an absurdly large spec for excel.... somewhere

1:45 GODSPEED.

1:50 Frozenlock: bbloom: Thank you very much

1:51 I shiver just by opening this page

2:37 holo: hi

2:41 it seems the class org.apache.log4j.net.SMTPAppender is in log4j which i have as a dependency in project.clj - [log4j "1.2.17"] . when i try to do (:import org.apache.log4j.net.SMTPAppender), i get class not found exception

2:46 durka42: confused about array hashing. is there a rational explanation for this? http://pastebin.com/bUGJfck1

2:48 oh, it seems { } is a macro and it checks for equality before evaluating

2:49 you can't make a {(rand) 1, (rand) 2} either

2:49 weird

2:51 holo: durka42, it seems the generated number is the same, so it complains it cannot create a key a duplicate key

2:52 *create a duplicate key

2:52 durka42: holo: but once evaluated, the keys _are_ different

2:52 ,[(rand) (rand)]

2:52 clojurebot: [0.2257251605859344 0.5444336271390366]

2:52 durka42: ,{(rand) 1, (rand) 2}

2:52 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: (rand)>

2:53 durka42: ,(hash-map (rand) 1, (rand) 2)

2:53 clojurebot: {0.9717426194056751 2, 0.9426321195663582 1}

2:53 holo: i see, the problem is before evaluation

2:53 durka42: it seems like a bit of a reader bug?

2:54 an inconsequential one

2:54 holo: surely looks unexpected behaviour

2:55 durka42: there are some sentence fragments here http://dev.clojure.org/display/design/Allow+duplicate+map+keys+and+set+elements

2:55 tomoj: you expect (read-string "{(rand) 1, (rand) 2}") to return a map with two values for '(rand) ?

2:56 durka42: tomoj: well I would have expected (read-string "{(rand) 1, (rand) 2}") == (read-string "(hash-map (rand) 1, (rand) 2)")

2:56 tomoj: then you don't understand the reader yet :)

2:57 &(read-string "(hash-map (rand) 1 (rand) 2)")

2:57 lazybot: ⇒ (hash-map (rand) 1 (rand) 2)

2:57 tomoj: &(read-string "{(rand1) 1 (rand2) 2}")

2:57 lazybot: ⇒ {(rand1) 1, (rand2) 2}

2:58 durka42: wait, what's that rand1 and rand2

2:58 tomoj: I just did that because ##(read-string "{(rand) 1 (rand) 2}")

2:58 lazybot: java.lang.IllegalArgumentException: Duplicate key: (rand)

2:59 tomoj: but {} is not like a macro for hash-map or something, it's a literal map notation. so "{(rand) 1 (rand) 2}" makes no sense

2:59 you have to read it and return a map before evaluating '(rand)

3:00 durka42: so in ##{(+ 1 2) 3, (+ 4 5) 6}

3:00 lazybot: ⇒ {3 3, 9 6}

3:00 durka42: conceptually, the map is constructed and returned, and then the additions are computed?

3:00 tomoj: &(keys (read-string "{(+ 1 2) 3, (+ 4 5) 6}"))

3:00 lazybot: ⇒ ((+ 1 2) (+ 4 5))

3:00 durka42: oh

3:00 interesting

3:01 tomoj: lazybot won't let me eval, but, yeah. the map is then eval'd which evals the keys and the vals

3:01 disclaimer: maybe there's more going on in the guts than I know about

3:02 durka42: and tomoj said unto durka42, { } is not a macro for hash-map!

3:02 and durka42 was enlightened

3:03 tomoj: it is something like a data reader for hash-maps

3:03 "data macro" never occurred to me

3:04 "reader macro" is avoided since it means something else to other people. but so {} is like a hypothetical #hash-map 'reader macro'

3:05 I kind of think everything should be a reader macro

3:06 durka42: everything?

3:07 anyway I need some sleep

3:07 p_l: well, in CL it is, and works quite fine

3:07 (other than "base" symbols and numbers, and, iirc, lists)

3:08 tomoj: s/reader macro/data macro/ :)

3:08 ..i.e. data reader

3:09 take `. if it was interpreted via default data readers 'syntax-quote, 'unquote, and 'unquote-splicing (so that `(foo ~x ~y) == #syntax-quote (foo #unquote x #unquote y)), then 1) you could customize syntax-quote (ala bblöom's wonderful backtick) and 2) you could get ` into edn (not that rich would have it)

3:11 aliasing would just be an override of the 'keyword default reader

3:12 Chousuke: I tried to implement syntax-quote like that once. It's tricky

3:12 tomoj: "like that" == with data readers?

3:12 Chousuke: as a regular macro

3:12 tomoj: ah

3:13 I don't think I even would have tried, luckily bblöom's tests pass

3:25 huh, did dnolen get source-maps working last night? :O

3:36 catkc: As a point of curiosity, and also since I want to make double-checking future assignments more efficient, does anyone have any ideas for how to solve equations with so many knowns for an unknown? I don't particularly like the brute solution of writing one function for each possible rearrangement.

3:36 The more convoluted the solution the better, of course. This is a learning exercise.

3:55 tomoj: sweet, seeing a sourcemap in chrome

3:55 of course everything is 404'ing because the urls are like http://localhost/repl/file:/home/tom/.m2/repository/org/clojure/... etc

4:54 luxbock: does anyone here use cljr? https://github.com/liebke/cljr

5:04 mpfundstein: right now i am using clojure with vim + lein repl. but i heard great stories about emacs + slime? can anyone point me to a good tutorial how to set it up?

5:06 borkdude: luxbock it looks nice, especially the installer. maybe leiningen could have such an installer (for windows)

5:06 luxbock: yeah that's what I was thinking as well

5:07 but it hasn't been updated in 3 years and the readme talks about clojure-contrib so I was wondering if it's still usable

5:08 borkdude: luxbock yeah, don't think so

5:09 luxbock: I'd like to have the option to install libraries the cljr way

5:10 borkdude: luxbock plugins were installed this way before kind of I think

5:10 luxbock you can do the same with pomegranate now

5:10 luxbock just load a library from clojars etc on demand

5:10 luxbock: yeah I was loooking into that before but I had some trouble with it, but that was a while ag'

5:10 guess I should try it again

5:10 ago*

5:18 borkdude: I was looking at the xml api here: https://github.com/clojure/clojure/blob/master/src/clj/clojure/xml.clj and noticed the use of dynamic vars

5:19 is this considered idiomatic and/or functional? It works in Clojure of course

5:25 fredyr: isn't it a result of managing state while working w/ the java sax parser

5:25 ?

5:29 borkdude: fredyr ah yes, probably.

5:32 fredyr what would be the way if this were purely functional: reduce with a map representing the state, which gets updated every "iteration"?

5:34 fredyr: something like that i'd guess

5:35 it's not entirely clear to me what a pure functional approach would look like working with a callback API like that

5:36 isn't the point of the callback to manage state transitions

5:36 borkdude: fredyr which a java interop callback it can't be purely functional

5:36 with

5:36 fredyr: right

5:40 illiux: So Ive managed to get myself into a situation where someone expects me to make a UML class diagram for a clojure program...lol

5:42 p_l: illiux: class diagrams are evil

5:42 borkdude: illiux lol

5:42 p_l: but some of the other UML diagrams are better :D

5:42 borkdude: illiux a sequence diagram might make sense?

5:47 ambroseb_: bbloom: had a chance to look at any more AST spec stuff? I recently released clr.tools.analyzer and unsurprisingly it's almost identical to the JVM version.

5:48 illiux: I asked to use clojure instead of java and got an okay on it, but I don't think this guy is aware of the existance of functional programming, in retrospect

5:48 and kind of assumed that clojure was object oriented

5:50 p_l: technically, lisps are more object oriented than java most of the time... ;)

5:50 (no special-casing of primitives)

5:52 illiux: too bad uml class diagrams revolve around mutable state

5:52 borkdude: illiux maybe you can fool him by making a class for each namespace ;)

5:54 the official uml website looks a bit 90ies http://www.uml.org/

5:55 illiux: Thats probably because UML is a bit 90ies

6:02 p_l: illiux: no, that's because UML Class diagram is perverted by the perversion of Simula's object model that exists in certain languages

6:03 n.b. trying to make Class diagram be 1:1 to code is *stupid*

6:04 illiux: I think that's true for everything but an ideal language

8:23 PeregrinePDX: dfcr[p-p-4~4~4~4~~4~4~as|78

8:45 sirvaliance: Are there any clojure tools to autoformat code? I know eastwood is a lint tool, but something that would properly fix syntax (like indents)

8:57 TimMc: sirvaliance: You mean in an automated fashion from the command line, as opposed to on a spot basis in an editor?

8:57 sirvaliance: TimMc: Ideally, yes

8:57 I use vim for editing and use the clojure plugins

8:58 TimMc: There was a discussion of this within the past month... mayb eI can find it.

9:00 sirvaliance: Start from here: http://clojure-log.n01se.net/date/2013-02-24.html#16:52b

9:00 I forget how it ends.

9:01 sirvaliance: Thanks (reading it now)

9:35 pandeiro: can a lein new template pull down any remote resources?

9:36 ie if i wanted it to grab the latest jquery instead of providing a static one

9:40 cemerick: pandeiro: even better, have your template use a jquery dependency from http://www.webjars.org/

9:41 pandeiro: cemerick: awesome thanks

9:42 cemerick: pandeiro: you just need a resources route in the app that loads the files from where they sit in the jar, e.g. (route/resources "/" {:root "META-INF/resources/webjars/foundation/4.0.4/"})

9:43 pandeiro: cemerick: ah ok, gotcha

9:51 jcromartie: man I can never keep the clojure.zip, clojure.data.zip, clojure.data.zip.xml stuff straight

9:52 (clojure.data.zip.xml/xml-> (clojure.zip/xml-zip (clojure.xml/parse something)) ...)

9:52 three namespaces just to query… :/

9:52 I know I can just get away with clojure.xml

9:52 p_l: to be abstracted by single function! :P

9:53 jcromartie: yeah

10:11 sundbp: is it possible to make a protocol "private" i.e. (defprotocol ^:private XYZ ..) ? in such a way the it does not produce and public vars

10:14 clgv: sundbp: why do you care about that?

10:16 sundbp: clgv: it's a weird use-case. i'm basically writing a mini-language for my domain (financial derivatives). i define entities via a macro. central to everything is a time-manager, which i'd like to define using the macro, but i don't want it exposed

10:17 if i move the time-manager to it's own namespace (to avoid polution), i get a cyclical dependency (need the macro from ns1 to setup ns2, but the rest of ns1 depends on the time-manager)

10:18 right now my way is to define ns2 (time-manager) not via macro and get around it that way. if i could keep it in ns1 as a "private" that'd be nicer though

11:37 jcromartie: is this overkill? https://gist.github.com/anonymous/6cdd57718f14454bbe46

11:37 I'm thinking maybe the hierarchy should be orthogonal to the pattern matching

11:37 like, just define patterns and the lowest-level tags, then expand them

11:38 because things won't always be hierarchical

11:57 luxbock: I added clojure.math.numeric-tower to my dependencies for a project and ran lein deps

11:57 but now I can only access it when I run 'lein repl' from the projects directory

11:58 I know this is an issue with the CLASSPATH but I already have the /.m2/repository/ folder set up as a part of the CLASSPATH environment variable

11:59 how can I access it from wherever I want?

12:00 hyPiRion: luxbock: you wait for 2.1.0 because technomancy/leiningen#957 fixed it.

12:00 lazybot: lein run doesn't close stdin of the clojure process. -- https://github.com/technomancy/leiningen/issues/957 is open

12:00 hyPiRion: dur, I mean technomancy/leiningen#966

12:00 lazybot: :user profile not getting picked up in non-project repls -- https://github.com/technomancy/leiningen/issues/966 is closed

12:00 luxbock: oh

12:01 technomancy: you can put it in :plugins to have it available in non-project repls

12:01 luxbock: alright, thanks

12:08 is there a way for me to define a list of dependencies that get loaded everytime I nrepl-jack-in in Emacs?

12:14 hyPiRion: luxbock: like ac-nrepl for instance?

12:14 and paredit

12:14 luxbock: I mean clojure libraries

12:14 technomancy: luxbock: yeah, that's what the :user profile is for

12:15 convenience dependencies like slamhound or tools.trace that aren't used by the code you're hacking on

12:15 luxbock: alright I'll google up on that

12:26 jcromartie: is there a function to turn a value into a list if it's not already a collection?

12:27 I'm just doing (if (coll? x) x (list x))

12:28 rahcola: i'm getting "only interfaces are supported, had: derp_octo_cyril.error.ParseError" when trying to implement a protocol when defining a record

12:28 any ideas?

12:28 hyPiRion: jcromartie: you don't convert it to a list though? You just wrap in one

12:28 llasram: jcromartie: Not in the core lib. Exists in various people's utility libraries. I'm not certain such functions are a good idea myself

12:28 jcromartie: hyPiRion: right, not convert it...

12:29 it comes in handy with mapcat when you sometimes have a collection and sometimes a single value

12:29 i.e. (mapcat to-coll [:foo [:bar bat] :baz])

12:29 contrived I know

12:30 hyPiRion: ,*clojure-version*

12:30 clojurebot: {:major 1, :minor 5, :incremental 0, :qualifier "RC6"}

12:32 hyPiRion: I was thinking perhaps cond-> could make it more evident, but I'm not entirely sure how it's used

12:32 jcromartie: specifically, I have a seq of keywords or sets of keywords

12:33 so flatten doesn't work

12:33 ,(flatten '(:foo #{:bar} :bat))

12:33 clojurebot: (:foo #{:bar} :bat)

12:33 jcromartie: ,(flatten '(:foo [:bar] :bat))

12:33 clojurebot: (:foo :bar :bat)

12:36 tomoj: #(cond-> % (not (set? %)) set) ?

12:37 hyPiRion: tomoj: isn't easier to write, like, #(if-not (set? %) %)

12:37 tomoj: I've been trying to resist extending my IReduce-like protocol to all values so that they just call the reducef with themselves

12:37 hyPiRion: bur, forgot the (set %) part

12:37 tomoj: yeah, probably

12:38 #(if (set? %) % #{%})

12:38 jcromartie: tomoj: I already use #(if (coll? %) % (list %)) to be a little more generic

12:38 supports sets and vectors etc

12:38 and mapcat doesn't care

12:39 what the return type is, as long as it's a coll

12:39 hyPiRion: jcromartie: do you want mapcat to care?

12:40 jcromartie: no, because I'll just call set on it later

12:40 (set (mapcat to-coll things-possibly-nested-once))

12:42 I could just build up a set with reduce

12:42 hyPiRion: ,(reduce (fn [S a] (if (coll? a) (into S a) (conj S a))) #{} [:hello #{:hello :world} [:gogo :gadget]])

12:42 clojurebot: #{:world :gogo :hello :gadget}

12:42 tomoj: in which case, be careful if you use r/mapcat, it does care about the return value..

12:42 jcromartie: heh :) I'm not, it's not that intensive

12:43 tomoj: neither of the bots have reducers

12:44 jcromartie: this is what I'm doing https://gist.github.com/anonymous/5171258

12:45 the example in the docstring doesn't include a set-to-coll mapping

12:45 but it happens

12:55 tomoj: hmm, Data.Data looks interesting

12:56 it seems like you should be able to say to a macro "nested set of keywords" and get CollReduce

12:57 aaelony: hey guys, can someone point me to a ring/compojure/hiccup example that works with lein2 and clojure 1.5 ?

12:57 something like https://github.com/mmcgrana/adder would be great

12:57 edw: I saw something recently on the Clojure Google Group about a db migration tool. Anyone recall what it was?

12:58 antares_: Raynes: please ping me when you are around

12:58 edw: ragtime? lobos?

12:59 edw: It was called bridge or sludge or slide or smear or something like that. I am open-minded though. I love South in Django.

13:01 clgv: aaelony: why not use the "adder" project, learn the basics and then setup a web project with the latest versions?

13:01 aaelony: clgv: that's the plan for now. It doesn't quite compile straight up though. likely needs a few tweaks

13:02 mindbender1: is it possible to specify a path/dir of my own javascript sources to the cljs compiler rather than a single file as done with the :libs option?

13:02 clgv: aaelony: uhhh clojure 1.2.0-beta1 - thats damn old

13:02 aaelony: lol, yeah

13:03 clgv: aaelony: there should be something more recent

13:03 aaelony: clgv: I'm sure there is… just haven't found it yet

13:03 clgv: aaelony: I learned to use ring and compojure just from reading their docs.

13:04 mindbender1: dnolen:

13:04 dnolen: mindbender1: ?

13:04 mindbender1: ^^

13:04 is it possible to specify a path/dir of my own javascript

13:04 sources to the cljs compiler rather than a single file as done

13:04 with the :libs option?

13:05 http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html

13:07 aaelony: clgv: that's always good advice. :)

13:21 dnolen: mindbender1: I think that's what :foreign-libs is for?

13:58 Raynes: antares_: ping

13:58 antares_: Raynes: hey. How are things?

14:00 Raynes: antares_: Well enough.

14:00 :p

14:01 jjido: ,(map #("pong") ['ping 'ping 'ping])

14:01 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval35$fn>

14:05 antares_: Raynes: cool. Have you seen my tryclj pull request? does it look reasonable to you?

14:06 Raynes: antares_: Haven't looked at it yet. Just got in to work.

14:07 antares_: Raynes: ok, let me know once you get to it :)

14:08 jjido: ,(map (fn [_] 'pong) ['ping 'ping 'ping])

14:08 clojurebot: (pong pong pong)

14:08 Raynes: antares_: I'm fine with linking to that, but "Clojure Tutorials" and "Clojure Guides" is confusing. What is the difference between these two things? Also, you capitalized 'tutorials' but not 'guides' there.

14:08 antares_: Raynes: tutorials are for complete beginners, guides are for "novice to upper-intermediate" kind of developers

14:08 Raynes: guides go into a lot of details

14:09 ibdknox: that's non-obvious from the names :)

14:09 Raynes: Yeah, I don't like the names.

14:09 Is there somewhere we can just link to once?

14:09 ibdknox: I would pick one and then just categorize them as "beginner" and "intermediate"

14:09 antares_: if you want to re-word that, I'd be happy to, I'm just curious if you think clojure-doc.org is good enough to replace two popular links with it

14:09 Raynes: Sure.

14:09 antares_: Raynes: we can link it as "Clojure documentation"

14:09 that would be ideal

14:09 I just followed the way links were structured before

14:10 Raynes: I will update the PR

14:10 ibdknox: <3 Raynes. He is wise.

14:10 antares_: Raynes rocks :)

14:10 Raynes: antares_: I'd link to clojure-doc's top level and title it "Clojure Tutorials and Guides"

14:10 I'll be signing tshirts afterwards.

14:11 antares_: Raynes: got it

14:11 by the way, Leiningen survey is up: https://lein-survey-2013.herokuapp.com/

14:11 technomancy: oh yeah, forgot to mention that in here; silly me

14:17 Raynes: antares_: Fwiw, you could have rebased the current pull request instead of opening a new one. It doesn't matter to me at all, but just a general tip for similar things in the future because it is sometimes faster.

14:17 antares_: Raynes: I edit stuff on github and it creates a new branch for each edit. Here: https://github.com/Raynes/tryclojure/pull/37

14:18 Raynes: Oh, I see.

14:18 pocho: is there an easy way to use map that returns a vector, assuming im calling map on a vector?

14:19 joegallo: ,(doc mapv)

14:19 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

14:19 joegallo: ,(mapv + [1 2 3])

14:19 clojurebot: [1 2 3]

14:20 joegallo: ,(mapv inc [1 2 3]) ;; is what i meant

14:20 clojurebot: [2 3 4]

14:20 pocho: why isnt that on clojuredocs?

14:20 technomancy: pocho: clojuredocs doesn't cover 1.4

14:21 Raynes: Clojuredocs is a disaster these days. :(

14:22 I really wish antares_'s thing had a different name so that we could say that without potentially damaging its reputation.

14:24 technomancy: afaiu the API works great; it's just the rails web frontend that sucks

14:26 antares_: Raynes: next gen clojuredocs.org now lived under the same GH account

14:27 dakrone: ping

14:27 *lives

14:37 tomoj: does non-native imply safe-test?

14:45 jcromartie: I like the idea of xml zippers but it seems like overkill

14:46 I don't need to go up/down/sideways

14:46 TimMc: So which direction do you need to go? :-P

14:48 nDuff: jcromartie: Think about XPath expressions. They go up and down all the time.

14:48 jcromartie: yeah, Xpath is handy

14:48 but clojure.data.zip.xml is not Xpath, unfortunately

14:48 actually I have a xpath lib here

14:49 I'm just parsing RSS and Atom

14:49 it's not very complicated

14:49 (yet)

14:51 nDuff: jcromartie: One can do a lot of XPath-y things with zippers

14:51 ...but, bigger picture, yes.

14:51 * nDuff is a fan of XQuery, and not about to claim that there's anything of equivalent power available in the Clojure stack right now.

14:52 jcromartie: don't get me wrong, zippers are awesome

14:53 nDuff: ...actually, its tendency to discard namespace data makes me pretty uncomfortable with clojure.data.xml

14:53 jcromartie: hm yeah

14:58 jeremyheiler: jcromartie: What lib are you using for XPath?

14:58 jcromartie: I wrote it myself

14:58 I'm pretty sure I stole some ideas from something else

14:59 jeremyheiler: Nice. I just released an XPath library https://github.com/jeremyheiler/xenopath

14:59 I wasn't a fan of clj-xpath, so that was born.

15:01 nDuff: jeremyheiler: Which version does it support?

15:01 ...ahh, I suppose I should be asking which version of XPath the JDK's libraries support

15:01 jeremyheiler: 1.0 I think

15:02 but yeah,s econd question is better lol

15:06 jcromartie: jeremyheiler: cool

15:06 I just have one little namespace

15:07 antares_: Spyglass 1.1.0-beta3 is released: http://blog.clojurewerkz.org/blog/2013/03/15/spyglass-1-dot-1-0-beta3-is-released/

15:08 akhudek: sometimes JNI just drives me crazy: if I don't set java.library.path, the library cannot be found. If I set java.library.path to /usr/local/lib, it finds it, but not a method within it. If I symlink /usr/local/lib to a local directory in the project folder and set java.library.path to this, it both finds the library and can use the methods within it.

15:09 tomoj: how do you handle initialization in cljs? exactly one namespace does a top-level call to kick things off?

15:09 akhudek: yep

15:09 hiredman: I generally export a boot function, and have a <script></script> at the bottom of the html page that calls it

15:10 tomoj: right, nice

15:11 hiredman: https://github.com/hiredman/ideapad/blob/master/cljs/boot.cljs#L82 https://github.com/hiredman/ideapad/blob/master/src/com/thelastcitadel/page.clj#L71

15:13 jeremyheiler: jcromartie: Cool. Do you worry about re-using xpathfactoy, xpath, or xpathexpression objects?

15:13 phuff: So I have a little program that I'm using leiningen to develop/run

15:13 It goes and parses an xml feed and then sends an email

15:13 jcromartie: jeremyheiler: this is it right now https://gist.github.com/jcromartie/5172313

15:13 works fine

15:13 phuff: I'm updating it so that it stores the results of the parsing in a datomic db.

15:14 And now, when I run lein run it gets to the end of my program and lein run never returns.

15:14 jcromartie: (oops… updated!)

15:14 jeremyheiler: reload if you haven't

15:14 tomoj: I wonder how much it helps to intersperse the script tags throughout a moderately-sized DOM

15:15 jcromartie: jeremyheiler: so you say for example (with-ns-mappings {"media" "http://search.yahoo.com/mrss/&quot;} ...)

15:15 assuming they have good namespaces… :|

15:15 sometimes they don't

15:20 I pretty much assume that you'll only be using xpath to return node sequences

15:20 and that you can get the text out of it or do whatever you want after the fact

15:20 it's a limited subset of Xpath but it makes more sense

15:20 konr`: How can I get the "this" variable in clojurescript?

15:21 llasram: phuff: Sounds like you have some extra non-daemon threads hanging around

15:21 pocho: Is there something like pmapv that a parallel version of mapv?

15:21 phuff: llasram How do I find them and kill them? :)

15:21 aroemers: technomancy: what is the bind-key set to, for tmux in a syme session?

15:21 llasram: &(doc shutdown-agents)

15:21 lazybot: ⇒ "([]); Initiates a shutdown of the thread pools that back the agent system. Running actions will complete, but no new actions will be accepted"

15:22 llasram: phuff: That may help. If the problem is a thread started by something else, System/exit is your main option

15:22 phuff: Ah okay...

15:22 I'm not expllicitly calling System/exit...

15:22 llasram: Well, that or going through the clean-up protocol of whatever started the thread

15:22 phuff: Is there some command I can use to print all the running threads?

15:22 jeremyheiler: jcromartie: Cool. That's the next thing I want to tackle. Currently I don't expose the XPath and XPathFactory instances, and I am hoping I wont have to, but we'll see. It depends on how I add support for namespaces. RE: Only returning nodes. Yeah, that make sense, I just find the get text case useful enough to warrent a fn.

15:23 jcromartie: yeah

15:23 phuff: llasram I probably just have not properly told things I'm done with them, and I'd like to figure out what I have done improperly :)

15:24 jeremyheiler: jcromartie: Adding support for resolvers will be interesting

15:24 phuff: I suppose I could just attach a debugger, eh?

15:24 But then I'd have to figure out how to attach a debugger ;)

15:24 * phuff is a lazy bones...

15:25 jcromartie: jeremyheiler: take a look at mine, it's super easy

15:25 just a map

15:25 and a binding

15:25 llasram: phuff: Yeah, that's probably the main option. jvisualvm is probably sufficient though

15:27 tyler__: whats the difference between putting require,import,use in namespace delcaration vs the "body"? Cleanliness?

15:27 phuff: llasram: Thanks for the help

15:27 jeremyheiler: jcromartie: I don't think I want to do it that way. It's definitely clean, but at the very least I want to support passing in the values directly.

15:29 jcromartie: you mean vs a macro?

15:30 jeremyheiler: jcromartie: Yeah

15:41 aroemers: technomancy: nvm, figured it out by looking at your .symerc/.tmux.conf :)

15:44 tyler__: "You are receiving this email because you registered for Clojure/West 2013." woot woot

15:44 mrb_bk: ohpauleez: fuck, http://mitpress.mit.edu/books/software-abstractions looks insane

15:45 jeremyheiler: tyler__: I'm pumped!

15:45 tyler__: jeremyheiler: im stoked becsause its across the street from my office

15:45 heh

15:46 jeremyheiler: tyler__: Very nice. I'm travelling across the country :-/

15:46 pandeiro: is there a way to directly access or know about a memoized functions cache, if there is one?

15:46 akhudek: pandeiro: https://github.com/clojure/core.cache

15:47 hyPiRion: pandeiro: not if you're using memoize, as the cache is within a closure.

15:48 pandeiro: hyPiRion: akhudek: thanks

15:48 akhudek: pandeiro: or maybe https://github.com/clojure/core.memoize

15:49 the library has had many name changes :-/

15:50 technomancy: aroemers: motd should explain that when you log in; did that work for you?

15:50 akhudek: http://clojure.github.com/ has docs for both libraries

15:51 technomancy: pandeiro: I submitted a patch for that, but it was rejected

15:51 really annoying since it was like a 2-line change

15:51 I've looked at core.cache like three times trying to figure it out and always just give up and roll something stupid

15:51 ohpauleez: mrb_bk: It's going to be… wait for it… awesome

15:53 mrb_bk: ohpauleez: i'm looking for tools to analyze ASTs, looks like it could be cool for that

15:54 ohpauleez: mrb_bk: It operates at a slightly higher level than that, but if you modeled your AST process in some form of domain model (like you made a query language for it), Alloy could help you there

15:55 mrb_bk: ohpauleez: awesome

15:55 ohpauleez: Alloy is great at telling you if you missed something in your query language, or your protocol, or your security system

15:55 for example, when you toss XPath at it, you find a hole in XPath

15:56 akhudek: ohpauleez: it's some sort of model checking type tool?

15:56 mrb_bk: got it

15:56 ohpauleez: where the spec is underspecified and ambiguous

15:56 akhudek: Yeah, it's a model checker // verifier.

15:56 it's like test generative for your domain model // requirements

15:57 akhudek: man, more reading for me to do!

15:57 dnolen: ohpauleez: have you been using it on your Clojure projects?

15:58 ohpauleez: dnolen: On Monday, you will find out

15:58 akhudek: huh, so it uses reduction to sat

15:58 ohpauleez: But yes, I have an interface where you can do it all dynamically and run the checker in the repl // environment

15:58 dnolen: ohpauleez: hehe cool

15:58 sexpFunc: hey Clojurians... I've got a little question: basically I think I just had an "ah ah" moment yesterday evening while coding in Clojure. I noticed that I tend to pass way less parameters around than in Java code, mainly for two reasons:

15:59 first reason is that by using a map containing all the parameters, there's no need to call functions with a crazy number of parameters (and there's no need to create as many objects as in Java)

16:00 ohpauleez: dnolen: and it I *sort of* have it working with Records too

16:00 the_malkolm: sexpFunc: cool, huh?

16:00 sexpFunc: and then the second reason is that I realized that apparently in a lot of case instead of passing parameters to a function and calling another function inside the outer function, I can pass a HOF to my other function, which "encloses" the parameters.

16:00 ohpauleez: just following the same ideas in DynAlloy

16:01 sexpFunc: So I'm not "seeing things" right!? There's *way* less boilerplate than in Java?

16:01 jcromartie: how do bindings and lazy seqs work together

16:01 arrdem: sexpFunc: yep! you're sane!

16:02 dnolen: ohpauleez: cool, looking forward to hearing more - I looked at Alloy once a very long time ago but never looked at closely enough to understand what it was really all about.

16:02 aroemers: technomancy: sorry, just logged out.. will check the next time I start syme.

16:02 dnolen: sexpFunc: yep

16:03 sexpFunc: what about monads, for those who are using them? In addition to having less mutable state, aren't monads typically yelding shorter programs? (specifically because you don't need all these "parameter juggling" / "parameters passing around", seen that the state is inside, say, the state monad?

16:03 dnolen: I love your videos btw... core.logic is next on my todo list.

16:04 dnolen: sexpFunc: I prefer atoms to the state monad

16:04 bbloom: sexpFunc: monads aren't super interesting or common in Clojure

16:04 sexpFunc: dnolen: so you're keeping the mutable state in an atom?

16:05 dnolen: sexpFunc: yes, and nobody that uses needs write their code in the monadic style, nor do you need to mess w/ lifiting etc

16:05 bbloom: sexpFunc: all the main haskell monads have similar/analogous things in clojure, but they aren't quite monads per say

16:06 sexpFunc: the `for macro is the list monad, atoms are like state monads, nil punning emulates the maybe monad, etc

16:06 sexpFunc: bbloom: like 'let' which is more or less the identity monad you mean?

16:06 bbloom: I see...

16:06 bbloom: sexpFunc: if you're interested in monads, study haskell. if you're trying to learn clojure, it's best not to even think about monads

16:06 jcromartie: ugh, laziness and bindings don't play well together!

16:07 bbloom: jcromartie: true story: see #(doc bound-fn)

16:07 jcromartie: er ##(doc bound-fn)

16:07 lazybot: ⇒ "Macro ([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."

16:07 bbloom: jcromartie: or doall/doseq/dorun/mapv/vec or some other way to force eagerness

16:07 jonasen: dnolen: What's the :as key used for in the context of constraint maps passed to unify?

16:08 dnolen: jonasen: it allows you to name subforms

16:08 sexpFunc: Regarding atoms and swap!, I've got a question about swap! : swap! doc says it returns the value that was swapped in. What if I want both the value that was swapped in and the value that was swapped out?

16:08 dnolen: :as {?x [?z (1 2)]}, then in the list of unification terms ?x will refer to that.

16:08 jonasen: dnolen: are there any examples? All I've found is the core.logc tests

16:09 jcromartie: bbloom: I was trying to track it down, but I forced all of the lazy calls I could see

16:09 dnolen: jonasen: it's not a complex idea :), for example you have (?x ?y) and you in a term, but you also want to give it a name, :as lets you do that.

16:10 bbloom: jcromartie: passing identity to clojure.walk is a decent way to force evaluation. i don't recommend that as a SOLUTION, but i've used it to debug laziness/binding interactions

16:10 ie performing a manual bisect by walking sub trees to figure out which subtrees are lazy

16:10 jcromartie: hm

16:11 ibdknox: bbloom: that is both clever and depressing lol

16:11 ppppaul: cool bbloom !

16:11 bbloom: ibdknox: i view it as a bug that laziness doesn't defacto capture bindings :-P

16:12 ppppaul: bbloom, have you used that with datomic?

16:12 bbloom: ppppaul: no, i haven't done more than play with datomic

16:12 dnolen: bbloom: it's desirable, but the perf implications are not good.

16:12 sexpFunc: How do I send this to the bot: ((fn [a] (do (println "swaped out: " @a) (println "swaped in: "(swap! a inc)))) (atom 0))

16:12 bbloom: dnolen: i know, it sucks :-/

16:13 sexpFunc: ,(+ 2 3)

16:13 clojurebot: 5

16:13 sexpFunc: ,((fn [a] (do (println "swaped out: " @a) (println "swaped in: "(swap! a inc)))) (atom 0))

16:13 clojurebot: swaped out: 0\nswaped in: 1\n

16:13 ro_st: ohpauleez: ehy

16:14 s/ehy/hey :-)

16:14 ohpauleez: ro_st: Welcome to the west!

16:14 I just sent you an email

16:14 ro_st: are my tweets getting through to you? :-)

16:14 aha!

16:14 sexpFunc: "inc" is a stupid example here but if another thread swap! between my deref and my swap!, the "swaped out" value ain't correct. How can get I know exactly which value was swaped out when using a swap! on an atom?

16:14 ohpauleez: I'm basically just hammering away at some content and code today. So I can totally meet you and your crew downtown for a beer/coffee

16:15 sexpFunc: ("inc" is a stupid example because obviously if I get back 3 I know that 2 is the value that got swaped out, but that's not my question ; )

16:15 stuartsierra: sexpFunc: With built-in functions, you can't. But you can easily define an alternate version of `swap!` that returns the old value.

16:16 ro_st: hey stuart. looking forward to meeting you :-)

16:16 next week is going to be a blast

16:17 hyPiRion: Oh you guys

16:17 ro_st: it took us 30 hours to get from capetown to portland. was killer

16:18 sexpFunc: stuartsierra: thanks... (love your vids too btw)

16:18 hyPiRion: I'll be here in this cold country programming Erlang next week, so go enjoy ClojureWest for me.

16:19 jonasen: dnolen: I think I get it now. For example (unify {:as '{?x (?y 2)}} '[[?y ?x] [1 (1 2)]]) unifies

16:19 while (unify {:as '{?x (?y 2)}} '[[?y ?x] [2 (1 2)]]) doesn't

16:20 dnolen: jonasen: yes, because ?y can't be 1 & 2

16:20 ro_st: and you, too, dnolen!

16:21 gosh. going to be mad.

16:24 stuartsierra: sexpFunc: Thanks, and you're welcome.

16:26 tomoj: can't you get the old value with add-watch?

16:26 amalloy: tomoj: you don't need add-watch, you can just wrap the swap function

16:27 jonasen: dnolen: so should not the following unify: (unify {:as '{?x (?y ?y)}} '[[?y ?x] [1 (1 1)]])?

16:27 tomoj: oh yeah

16:27 gfredericks: amalloy: to reset some other local atom?

16:27 amalloy: gfredericks: yeah

16:27 dnolen: jonasen: it should unify yes.

16:28 squidz: Im trying to get started with clojurescript, and when trying to lein cljsbuild once I get an exception (NoClassDefFoundError com/google/protobuff/MessageOrBuilder). Does anybody have an idea why this is happening=?

16:28 jonasen: dnolen: I'll open a ticket then :)

16:28 dnolen: jonasen: thanks!

16:28 gfredericks: (defn $wap! [a f & args] (let [a' (atom nil)] (swap! a #(do (reset! a' %) (apply f % args))) @a'))

16:29 amalloy: &(let [a (atom 10), old-value (atom nil), instrumented-inc ((fn [f] (fn [x & args] (reset! old-value x) (apply f x args))) inc)] [(swap! a instrumented-inc) @old-value])

16:29 lazybot: ⇒ [11 10]

16:33 jonasen: dnolen: I wish I'd understand the unifier internals better so I'd be able to provide patches along with the issues

16:34 dnolen: jonasen: well it's not very much code :)

16:35 jonasen: what it does is pretty simply, walk everything looking for ?foo, those are the vars. That's the prep phase, then pass those to core.logic to do the real unification work.

16:35 jonasen: the interface changed for 0.8.0 since I wanted to support options. :as is one, and of course more fine grained constraints on vars.

16:36 jonasen: that much I understand. But I've yet to understand how constraints are implemented

16:36 dnolen: jonasen: it's mostly irrelevant for the unifier code.

16:36 jonasen: they are just passed along.

16:37 sexpFunc: (I asked the question on SO: http://stackoverflow.com/questions/15441638/alternate-version-of-swap-also-returning-swapped-out-value so there's a trace of it)

16:37 squidz: it is only happening when I try to use clojurescript in an already existing project. When I start a new project it compiles fine

16:38 dnolen: jonasen: internally the substitution has a queue for the constraints. So unifier just queues them up, after all the terms have been unified, we run the queue to make sure nothing has been violated.

16:38 jonasen: dnolen: yesterday, I tried to figure out how (unifier ..) produces the result map {?x .. ?y ..}.

16:41 sexpFunc: amalloy: sweet example with the instrumented-inc : )

16:41 dnolen: jonasen: opts will contain all the lvars the user cares about. we use this to look inside the substitution to get a seq of vectors of lvar -> value that we pour into a map.

16:42 jonasen: line 123-129. note we call fix-constraints after unify, like I said.

16:42 jonasen: in unifier.clj

16:43 jonasen: one subtlely is is that (lvar 'foo) generates random names - we don't want that. ?x should always refer to ?x every where it occurs. thus (lvar 'foo false), prevents gen-syming

16:44 borkdude: jonasen I tried kibit yesterday. I found another rule you can add: (if-not .. (do ....)) ;;=> (when-not .. ….)

16:44 dnolen: jonasen: there rest is pretty simply, walk the lvar, reify it's value.

16:44 borkdude: jonasen and other variations on that

16:44 jonasen: borkdude: pull request welcome :)

16:44 borkdude: jonasen cool :)

16:44 technomancy: aroemers: do you remember if it had a fancy "SYME" ascii-art baner when you logged in or if it was the boring default Ubuntu one?

16:45 jonasen: dnolen: I'll try to tackle LOGIC-121 then. One possible reason for the bug might be that (for some reason) opts does not contain all the lvars

16:45 dnolen: jonasen: that's a possibility

16:46 sexpFunc: amalloy: sweet example with identity-inc. What if swap! gets called multiple times: identity-inc is free of side-effect and it's guaranteed that on the last call (if it's called multiple times), then the inner atom (old-value) shall be reset! to the last swapped-out value?

16:47 * sexpFunc oops, significant other is yelling, brb very soon

16:47 jcromartie: jeremyheiler: got it!

16:48 jeremyheiler: instead of just returning the raw java XML DOM node, I use an internal hash map to keep the xpath context along with the parsed doc and any node seqs

16:48 all of my xpath functions now take this map representation and use the bundled xpath context

16:48 dnolen: jonasen: another possible bug, unifier* may need to be like unify*, unify* does the right thing, all unifications proceed w/o reifying vars to symbols ?foo, except for the very last unification. I see unifier* isn't written this way.

16:49 jcromartie: so you set up the namespace mappings when you parse the document

16:51 dnolen: jonasen: hrm ... unifier* just may be wrong :P, unify* is correct. I think all that stuff in -unifier* line 122-129 should probably only happen the last time.

16:57 jeremyheiler: jcromartie: Nice! I was thinking of doing something similar, where there is my own protocol+type that you pass around instead of the mutable XPath one.

16:59 aroemers: technomancy: I guess the default ubuntu one, since I didn't notice anything special. Want me to test it for you?

17:00 borkdude: jonasen does kibit work transitively in the sense that a -> b (meaning suggest rewrite a to b) and b -> c, so it suggests a -> c?

17:01 jonasen from one test I added I sense it does

17:01 aroemers: technomancy: opening a new session now...

17:02 jonasen: borkdude: I doesn't do that

17:02 borkdude: jonasen then I don't know why '(when-not test body) '(if (not test) (do body)) passes

17:03 jonasen because maybe (not test) unifies with one single thing?

17:04 aroemers: technomancy: nope, just the ordinary ubuntu message.

17:05 and this time I waited until Syme was done configuring before I connected.

17:06 stuartsierra: sexpFunc: provided my answer on StackOverflow

17:09 jonasen: borkdude: I think it might actually do transitive simplification. I'm not actually sure (both are possible: it depends on if the tests use simplify or simplify-one)

17:09 technomancy: aroemers: good to know; thanks.

17:09 baffles me why motd doesn't get installed though

17:10 since when I run the exact same bootstrap script when I'm logged in it works fine

17:10 I guess I could turn off the custom .tmuxrc since syme supports user-specific dotfiles now

17:11 I didn't want to inflict C-a-stealing on people, but now they have a way out

17:13 konr`: How can I turn a clojurescript entity into a console-friendly js object?

17:14 aroemers: technomancy: And by C-a you mean C-b? (the default) :)

17:14 technomancy: but yeah, I think users expect defaults now that they can have their own .symerc

17:15 technomancy: aroemers: they're both so horrible that I think of them as the same thing =)

17:15 aroemers: heh

17:15 technomancy: aroemers: if you have the inclination to dig into the motd thing I would love some help with it

17:15 also the shutdown hook is broken, and I have no idea why

17:16 believe it or not, it's really hard to debug a feature that only triggers upon the shutdown of an EC2 node =)

17:16 aroemers: Ah, you mean the hook that notifies Syme of a shutdown?

17:16 technomancy: aroemers: yeah, so that it shows "halted" as the status

17:17 aroemers: I'll have a look, Syme is not that much of source code anyway.

17:17 technomancy: that's my favourite thing about it =)

17:17 I'm sure the shutdown hook is obvious to anyone who knows how update-rc.d works

17:18 aroemers: I don't, but one can find out. "To the bus!"

17:18 technomancy: heh

17:18 magic school bus?

17:18 aroemers: Yep

17:18 technomancy: haha

17:19 aroemers: Gotta love XKCD

17:19 konr`: ah-ha, it's `clj->js`!

17:19 ravster: aroemers: hmmm, I need to catch up with that.

17:20 tyler__: is there a way to parallelize a list comprehension?

17:21 aroemers: ravster: http://xkcd.com/911/

17:21 tyler__: im trying to do (for [item collection] (long-lived-computation))

17:22 technomancy: tyler__: can't do it with for; try pmap

17:22 tyler__: technomancy: ok. i guess pmap is the swiss army knife of parallel land heh

17:22 technomancy: eh

17:22 actually it's mostly demo-ware

17:23 for IO-bound stuff it's no good

17:23 you would need to drop down to Executors for that

17:24 tyler__: technomancy: ... by computation i meant response from ssh session. i thought it would be the same deal but guess not

17:24 technomancy: pmap refuses to let the newest computation get too far ahead of the oldest unfinished element

17:25 so it's also only good for lists of uniform compute load

17:25 tyler__: ah so for io bound things that have the same io bound

17:25 its ok?

17:25 technomancy: well, it's also lazy

17:31 hyPiRion: I find pmap the weirdest thing parallel thing

17:32 it's like, "oh, you're most likely interested in speed. Let me give you a partially lazy function which confuses you"

17:36 amalloy: tyler__: like technomancy said, pmap is demo-ware. it's really hard to profitably use pmap, but it's really easy to say "look, i just added a single character and now my app is multithreaded and threadsafe"

17:37 "(isn't clojure great)"

17:42 QSteven: when I run lein cljsbuild clojure.browser.repl is not found on the classpath

17:45 here is the offending code: https://github.com/sdevijver/webfui-repl

17:47 when I run lein cljsbuild once I get this error message: http://pastebin.com/aw3rsRY4

17:48 aroemers: technomancy: sent you a PR for the MOTD problem.

17:49 tomoj: QSteven: clojure.browser.repl is cljs

17:49 looks like you're trying to require it from clj

17:49 are you doing that so you can alias in a macro?

17:50 tyler__: amalloy: i love your tongue-in-cheekness ;)

17:50 QSteven: tomoj, I forked this example, it works perfectly here: https://github.com/emezeske/lein-cljsbuild/blob/0.3.0/example-projects/advanced/project.clj

17:50 technomancy: aroemers: woooo thanks

17:50 aroemers: technomancy: no thanking yet, not sure if it works ;)

17:50 tomoj: QSteven: where did wrepl.clj come from?

17:50 QSteven: tomoj, I'm doing this: https://github.com/sdevijver/webfui-repl/blob/master/src-cljs/wrepl.clj

17:51 tomoj: that says .clj

17:51 it should be .cljs

17:52 QSteven: tomoj, *danj*

17:53 tomoj, thank you, you're a scholar and a gentleman!

17:54 technomancy: aroemers: deployed; I'll start an instance and see

17:56 one of these days I'll get around to writing a manifesto re: remote hacking and how syme fits into that

17:58 aroemers: my hat is off to you; that was bugging me for ages and now it works =)

17:59 aroemers: technomancy: nice

18:07 Guest: aroemers: The big secret behind this is that technomancy doesn't wear a hat at all and thus gave you no tribute.

18:08 amalloy: Raynes: your switch to a Guest account to mock technomancy wasn't subtle enough. i think he knows it was you

18:08 Raynes: Yeah, no clue what znc is doing.

18:09 technomancy: amalloy: I used to have all NICK events ignored, but now with the latest ERC it only ignores NICK/JOIN/PART of lurkers so the ruse is up!

18:09 aroemers: Raynes: thanks, makes me feel much better.. I think.. wait..

18:10 amalloy: c'mon, let's all /nick spartacus so that one of us can safely say something rude

18:14 aroemers: I have all NICKs ignored as well. Had to do a /whowas to find out..

18:15 technomancy: aroemers: derp; the shutdown hook was just a chmod problem

18:16 aroemers: technomancy: nice, you solved it!

18:17 * aroemers stops reading about update-rc

18:17 technomancy: aroemers: if you want to keep hacking there are some actually-interesting problems on the issue tracker =)

18:17 aroemers: heh, already there :)

18:18 technomancy: sweet; which one?

18:19 aroemers: not decided yet

18:19 technomancy: all the functions for DNS manipulations already exist in the syme.dns namespace if you want to do that one

18:19 I wasn't handling it because I couldn't do deregistration without the shutdown hook

18:20 QSteven: how can I load macros from a cljs repl?

18:20 technomancy: aroemers: but #6 might be the best bang-for-buck

18:20 oh, oops; but maio already volunteered =)

18:22 aroemers: technomancy: #6 is a nice one as well. As a user, I would like such a function. Will think about it.

18:25 technomancy: and why is technomancy/syme#20 reopened?

18:25 lazybot: Support inviting an entire organization at once -- https://github.com/technomancy/syme/issues/20 is open

18:25 technomancy: aroemers: I had it working, but I removed it during a refactoring and haven't bothered to bring it back.

18:27 QSteven: from loading macros in the cljs repl should I also use load-namespace?

18:27 aroemers: technomancy: alright, will keep it all in mind. Going to sleep now.

18:28 technomancy: aroemers: cool; thanks for your help

18:36 tyler__: anyone know of an app that convert the output of `ps` into a datastructure?

18:36 perferably edn

18:37 i think rich went on a rant about this one time

18:39 piping everything with `awk` is kinda bollocks

18:39 technomancy: using strings for everything is the Unix Way

18:40 hyPiRion: Imagine an EDN OS? Everything is functional, piping as well.

18:41 Except pr and pprint, which print to stdout and return nil

18:41 technomancy: my shell's already in lisp, thankyouverymuch =)

18:41 hyPiRion: huh, I wonder how far one would get with such an os.

18:42 * hyPiRion reinvents lisp machines.

18:44 tyler__: its not the shells fault

18:44 its the applications fault

18:44 for having bullshit output

18:44 heh

18:45 technomancy: well... nature vs nurture

18:45 the application is a product of its environment and upbringing

18:45 if it had been raised in a loving lisping home it wouldn't be exhibiting this dysfunctional behaviour

18:48 Rich_Morin: I need to spider and parse some machine-generated HTML pages. I've done this sort of thing in Ruby, but never in Clojure. Looking around, I see a number of proposed approaches, but I'd like to know if there is a consensus on the top few, at least. Help?

18:49 * tyler__ buys a sign for his living room that says "loving lisping home"

18:49 tyler__: (inc technomancy)

18:49 lazybot: ⇒ 48

18:51 ravster: I'm trying to make ring use datomic as a session store. The ring docs say that I need to make something that implements the SessionStore protocol. How does this work? I don't understand what they mean by 'protocol' in this context.

18:53 hyPiRion: ravster: https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/session/store.clj ?

18:53 You have to implement that protocol.

18:53 ravster: hyPiRion: so I just create a new 'protocol' that exposes those three functions?

18:55 tyler__: peat: lurker

18:55 ravster: are protocols a clojure-specific thing?

18:55 tyler__: ;)

18:56 peat: tyler__: creeper.

18:56 * tyler__ wears that like a badge

18:56 hyPiRion: ravster: yep, look at http://www.infoq.com/presentations/Clojure-Expression-Problem for understanding it more thorough

18:56 ravster: hyPiRion: will do. Thanks.

18:57 hyPiRion: Though you can consider it as an interface which you can define outside a "class".

18:57 craigbro: need help with a name

18:58 for a simple package that provides a wrapper around core.logic defrel and generates DB schema and sql from a set of relations/facts

18:58 logisql is my beer-starved brain's first attempt

19:00 technomancy: http://static.gamesradar.com/images/mb/GamesRadar/us/Features/2010/08/Scott%20Pilgrim%20videogame%20references/v6/v6-3-shatterband--article_image.jpg

19:02 OscarZ: as a long time Java programmer, now it seems funny that Clojure seems so natural, so little "bullshit" and boilerplate...

19:04 tyler__: wooot

19:04 just found an awk script that converts unix column output to JSON

19:04 good enough

19:04 https://github.com/mgrundy/awkward/blob/master/awkward for the curious

19:05 llasram: What's the Clojure/JVM standard way to parse the HTTP 'Accept' header?

19:05 technomancy: llasram: that's been the one thing I felt like is completely missing in the clojure web ecosystem.

19:06 or maybe there's something I'm just unaware of

19:06 OscarZ: I guess its human that there is always momentum in these kinds of movements... OO programming fixed a bit too much... now Clojure seems to take a step back

19:06 concentrating on lists and functions..

19:07 llasram: technomancy: Huh, okay. Interesting. Bishop does it, and looks exposes a function to do it. Using just compojure right now, so was hoping for something more common

19:08 I'd expect parsing it to be a pretty common need

19:11 technomancy: I've never needed more than two formats for a given endpoint, so I can get away with (if (re-find #"json" (:content-accepts headers)) ...)

19:11 llasram: What if you get application/json;q=0 ?

19:12 technomancy: no idea!

19:14 tomoj: who uses that? people who use webmachine so they can demonstrate their superiority?

19:15 llasram: There's some hermit out there who only wants XML, and doesn't want JSON even if there's no alternative. And you'd turn around and give them JSON anyway, just because "who does that"?

19:16 Not very ethical. Or polite.

19:17 amalloy: llasram, technomancy: https://github.com/ngrunwald/ring-middleware-format ?

19:17 technomancy: "If I gave people what they wanted we would have just built a faster horse"

19:17 amalloy: I'm thinking of just the "HTML vs everything else" question

19:17 human vs automaton

19:18 no offense to the humans who prefer json to HTML

19:18 llasram: And I want to know if I need to decompress my gzip'd blob before serving it, or if I can just slap a Transfer-Encoding on it and be done

19:19 technomancy: can't nginx do that for you?

19:20 llasram: Detect what I'm serving is gziped and automatically decompress it for the client? I hope not

19:20 technomancy: oh, I meant do the actual compression

19:20 squidz: im trying to get started with clojurescript and after following the directions on the cljsbuild lein github readme, I got an exeption. I then tried to use a local version of clojurescript and got another error. Here are the stack traces: https://www.refheap.com/paste/12613 The first paste is when just following the instructions to get the most basic clojurescript project up. The second stacktrace is after I tried cloning a local version of clojurescript and u

19:21 llasram: technomancy: Ah, but I have the opposite problem -- data stored compressed, need to potentially decompress. I could just unilaterally decompress then let my frontend server optionally recompress, but I'd rather not

19:22 * technomancy nods, trying to conceal the fact that his attention has drifted onto other shiny things several times over.

19:22 technomancy: sorry

19:22 llasram: np :-)

19:31 jonasac: whats a good way to do auth in a ring app ?

19:31 lynaghk: jonasac: look into cemerick's friend library.

19:31 tazle: hm, which class loader does Clojure use to look up classes corresponding java interop macros?

19:32 squidz: After including org.clojure/data.json in my project the json error is gone, but now i'm back at the first exception I pasted

19:32 tazle: and can I affect it somehow?

19:32 jonasac: lynaghk: thanks

19:32 squidz: jonasac: I think friend is supposed to be good, but I havnet tried it out yet

19:32 antares_: new clojure-doc.org guide is up: http://clojure-doc.org/articles/language/laziness.html, feedback welcomed

19:32 tazle: I think I saw somewhere that it was supposed to be the context classloader of the thread, but that doesn't seem to be the case

19:33 squidz: I would really like to try clojurescript but can get it started

19:33 Sgeo: "Clojure is not a lazy language."

19:33 Ok, glad it got that right. I'm happy now.

19:33 antares_: squidz: looks like another missing dependency. There were some added to ClojureScript recently, I believe: https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/usE_hrROGvA

19:34 Sgeo: happy that it makes you happy :)

19:35 squidz: maybe ask on the mailing list? groups.google.com/group/clojurescript

19:35 squidz: okay the json dependency was easy to figure out but NoClassDefFoundError for com/google/protobuf/MessageOrBuilder is more confusing

19:35 jonasac: bah, whenever im looking into a clojure library on github i find 10 other libaries i need to check out :p

19:38 bbloom: jonasac: i'm that way with research papers... damn internet is a bottomless pit. my tree search algorithm needs tuning

19:39 antares_: squidz: it comes from com.google.protobuf/protobuf-java but I have no idea why ClojureScript may need that

19:39 squidz: maybe some other library does

19:41 squidz: antares_: hm I wish I could figure out. This also means that it should not run for anybody else that tries to use the latest versions I think

19:45 jonasac: bbloom: reading research paper sound like something that might help you tune that algo , just read the right papers :)

19:46 bbloom: jonasac: oh, i know. i've been using a neural network to tune my heuristics for 26 years... it might converge by the time i'm 300 years old

19:46 jonasac: :)

19:48 technomancy: jonasac: good thing you have this channel to help you decide between competing libraries =

19:48 =)

19:50 jonasac: true dat :)

19:50 llasram: I just throw them all in the same project, walk away for a bit, and see which has emerged victorious

19:53 nbeloglazov: Hi. I have a string that contains clojure code. I now position where starts some s-expression. What is the easiest way to get position where it ends?

19:53 I only came up with solution when I need manually iterate through string counting parenthesis, ignoring inner strings and comments

19:56 tazle: apparently if I load-file in with-bindings {clojure.lang.Compiler/LOADER my-shiny-loader}, my shiny loader is used

20:01 llasram: nbeloglazov: What's the broader goal?

20:03 mpenet: ambroseb_: is there an equivalent of "Values" in core.typed: Union of multiple values? I mean syntatically instead of repeating (U (Value :a) (Value :b) ...). If that makes any sense

20:05 nbeloglazov: llasram: I want to get start and end of an expression in order to be able to higlight whole expression.

20:10 llasram: I'm playing with kibit lib and want to create web page for displaying analysis info of clojure source file.

20:11 llasram: nbeloglazov: Hmm. Interesting. You should be able to use the clojure reader to extract the info, but I've got to go, so can't engage in exploring the approach at the moment

20:11 nbeloglazov: Good luck!

20:12 antares_: nbeloglazov: take a look at https://github.com/clojure/tools.reader, maybe it exposes some functions will help

20:12 nbeloglazov: llasram: thanks. But clojure reader seems to give only line and position of expression start point. Not the end

20:13 llasram: hm, I'll take a look, thanks.

20:13 ohpauleez: llasram: Look at how the line-plugin is processing files.

20:14 You can use all the same hooks, and just expose the appropriate web endpoints

20:14 lein**

20:17 ravster: In both the cookie- and memory-store examples for ring-sessions, they don't use the 'store' argument in the functions. Do I need to use it when making a datomic session store?

20:24 ambroseb_: mpenet: Could you elaborate on Values?

20:25 As in some compile-time constant?

20:26 mpenet: yes

20:26 ambroseb_: Use case?

20:26 mpenet: https://github.com/mpenet/hayt/blob/typed/src/qbits/hayt/types.clj

20:27 native datatypes on a datastore as kw in clj

20:28 ambroseb_: Do you mean (Values :a :b :c)?

20:28 mpenet: yes something like that

20:28 ambroseb_: Ok, I think you can quote keywords and you don't need to wrap them in Value

20:29 And I may allow they raw at some point

20:29 mpenet: I will try

20:31 perfect

20:31 thanks

20:31 ambroseb_: great

20:33 squidz: antares_: It was a proto-buf dependency. I added a org.flatland.protobuf dependency, and cljs now compiles my js

20:34 antares_: squidz: I am still surprised cljbuild needs a protobufs library

20:35 squidz: yeah, or if it does, why it isnt automatically required

20:38 antares_: anyways, i'm excited to finally have it running enfocus and shorleave here I come

20:39 antares_: squidz: good stuff

21:05 mpenet: ambroseb_: weird thing here https://github.com/mpenet/hayt/blob/typed/src/qbits/hayt/types.clj#L7 It returns an exception: Cannot parse list but works fine in the repl. I am doing something wrong I guess

21:05 ambroseb_: mpenet: use t/Option

21:06 Option is just an alias, which is imported like a var.

21:06 mpenet: right, I should have thought of that

21:17 bbloom: well this is surprising: ##(let [{x :x} (list :x 1)] x)

21:17 lazybot: ⇒ 1

21:18 bbloom: ,(let [{x :x} [:x 1]] x)

21:18 clojurebot: nil

21:18 bbloom: ,(let [{x 0} [:x 1]] x)

21:18 clojurebot: :x

21:18 bbloom: seems that seqs are mapified...

21:18 hiredman: huh

21:18 amalloy: that was added in...1.4, i think

21:19 ambroseb_: This was to support fn parameter destructuring right?

21:19 or rest arg destructuring rather.

21:19 bbloom: ,(macroexpand '(let [{x :x} :in] :out))

21:19 clojurebot: (let* [map__182 :in map__182 (if (clojure.core/seq? map__182) (clojure.lang.PersistentHashMap/create (clojure.core/seq map__182)) map__182) x ...] :out)

21:19 bbloom: ambroseb_: ah, that makes sense

21:20 ambroseb_: still, somewhat surprising in that it adds a (if (seq? ...) test

21:20 amalloy: yeah, but that part would have been added in 1.2. i think there was some more-recent change that slightly broadened the scope in which seqs are allowed

21:21 ambroseb_: bbloom: IIRC rest arguments are always seqs, or nil.

21:21 bbloom: ambroseb_: the surprising bit is the willingness to pay the cost of an extra test on every map destructuring, but i guess it's probably a miniscule part of the cost of lookups

21:22 TimMc: I just learned about map destructuring of vectors from cemerick's book. :-)

21:22 amalloy: fwiw it looks like i'm wrong, the only stuff to touch that recently has been optimizations and bugfixes

21:23 bbloom: apparently there is a bunch of little destructuring secrets

21:23 ambroseb_: I've never seen map destructuring of sequences documented.

21:23 bbloom: for example amalloy basically just schooled me on the fundamental syntax of destructuring maps that i apparently didn't understand at all lol

21:24 amalloy: i think i know everything there is to know about destructuring, but i'd be excited to be proven wrong

21:24 TimMc: &(let [{x 3} "hello"] x)

21:24 lazybot: ⇒ \l

21:24 bbloom: in general, i'm thinking about this interaction between predicates, binding, and syntax.... there's destructuring, pattern matching, unification, then other things are similar in other domains, stuff like XPath and CSS Selectors, and all this other stuff

21:25 i'm wondering if there are some common bits that can be generalized so that one can invent new pattern-matching-like constructs as needed & reuse some machinery

21:25 amalloy: &(get "hello" 3)

21:25 lazybot: ⇒ \l

21:25 amalloy: whew. TimMc had me worried that the string was being coerced into a vector somehow

21:25 bbloom: heh

21:26 TimMc: No, I was mistaken about the applicability of that form.

21:27 &(let [[x] {:a 1}] x) :-(

21:27 lazybot: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap

21:27 bbloom: so i was looking at Prismatic's Graph/Plumbing, & they have a specialized new destructuring syntax tuned for trees of maps with keywords as keys

21:27 the fnk things

21:27 https://github.com/Prismatic/plumbing/blob/master/src/plumbing/fnk/README.md

21:28 TimMc: &(let [{x :a & rest} {:a 1 :b 2}] x)

21:28 lazybot: ⇒ 1

21:28 TimMc: amalloy: Check *that* out!

21:28 (Yes, I'm being sneaky.)

21:29 amalloy: cute

21:29 hiredman: ,(let [{x :a & rest} {:a 1 rest 2}] &)

21:29 clojurebot: 2

21:29 TimMc: :-)

21:30 &(let [[:as [:as [:as foo]]] [0 1 2]] foo)

21:30 lazybot: ⇒ [0 1 2]

21:32 TimMc: &(let [[x :as a & don't mind me] [0 1 2 3]] [x a])

21:32 lazybot: ⇒ [0 [0 1 2 3]]

21:33 TimMc: &(let [{:keys [a b]} {:a 1 :b 2}] [a b])

21:33 lazybot: ⇒ [1 2]

21:34 TimMc: &(let [{:keys [a b & c]} {:a 1 :b 2}] [a b])

21:34 lazybot: ⇒ [1 2]

21:34 TimMc: &(let [{:keys [a b & c]} {:a 1 :b 2}] [a b & c])

21:34 lazybot: ⇒ [1 2 nil nil]

21:34 TimMc: Whoops, forgot which window I was in. Those first two :keys things weren't meant to demonstrate anything. :-)

21:35 It's a good thing I didn't start having an intimate conversation with lazybot or something.

21:37 hyPiRion: ,(let [{:keys [a b c] :or {a b, b 2}} {:c 1}] [a b c])

21:37 clojurebot: [2 2 1]

21:37 hyPiRion: ,(let [{:keys [a b c] :or {a 2, b a}} {:c 1}] [a b c])

21:37 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>

21:38 hyPiRion: ordering matter, in other words

21:48 Frozenlock: I'm using compojure with lib-noir and getting a bunch of these messages printed on the console: "2013-03-15 21:48:34.314:WARN:oeji.nio:javax.net.ssl.SSLException: Inbound closed before receiving peer's close_notify: possible truncation attack?"

21:48 Is there a way to correct this?

21:49 hyPiRion: Yeah, the logger is rather verbose

21:49 Frozenlock: Should I just ignore it?

21:53 hyPiRion: Well, it basically logs more or less everything, so I'd guess it's safe

21:54 Frozenlock: But.. but.. there's the word 'attack'!

21:54 * Frozenlock runs in circle, with his arms in the air

21:55 bbloom: one other odd thing about destructuring is how errors are handled

21:55 ,(let [[x] 5])

21:55 clojurebot: #<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: Long>

21:55 bbloom: makes perfect sense

21:55 until i want to if-let

21:55 (if-let [[x] 5] x)

21:55 ,(if-let [[x] 5] x)

21:55 clojurebot: #<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: Long>

21:56 bbloom: b/c that's basically a single step pattern match, only it doesnt work :-/

21:56 gfredericks: bbloom: what do you want that to do? fail?

21:56 i.e., act falsy?

21:56 bbloom: gfredericks: well ##(let [[x] nil] x)

21:56 lazybot: ⇒ nil

21:56 hiredman: destructuring is not pattern matching

21:56 gfredericks: nil is seqable though

21:56 also what hiredman said

21:57 bbloom: i understand the difference, i'm just trying to study the minutia of it

21:57 gfredericks: &(let [[x] 5] x)

21:57 lazybot: java.lang.UnsupportedOperationException: nth not supported on this type: Long

21:57 bbloom: i wonder if it would be desirable for that to return nil

21:58 and what other things can cause destructuring to throw?

21:59 gfredericks: sets, which I think is odd

21:59 &(let [[x] "foo"] x)

21:59 lazybot: ⇒ \f

21:59 bbloom: gfredericks: sets are different b/c that's an error at macro expand time

21:59 ,

21:59 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

21:59 bbloom: ,(macroexpand '(let [#{x} 5]))

21:59 clojurebot: #<Exception java.lang.Exception: Unsupported binding form: #{x}>

22:00 gfredericks: no I mean the other way

22:00 bbloom: ,(macroexpand '(let [[x] 5]))

22:00 clojurebot: (let* [vec__251 5 x (clojure.core/nth vec__251 0 nil)])

22:00 gfredericks: &(let [[x] {:foo 12 :bar 15}] x)

22:00 lazybot: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap

22:00 gfredericks: I guess it's anything you can pass to nth?

22:00 &(nth {} 0)

22:00 lazybot: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap

22:00 bbloom: seems odd right? heh

22:00 gfredericks: &(nth "foo" 1)

22:00 lazybot: ⇒ \o

22:02 gfredericks: when I was doing graph theory with graphs as sets of #{a b} I wanted to be able to (let [[a b] #{1 2}] ...)

22:03 bbloom: i find it annoying when i get that nth not supported error

22:03 hyPiRion: gfredericks: It makes perfect sense though

22:03 gfredericks: bbloom: arguably if you're destructuring something not nthable it's a mistake

22:03 hyPiRion: what is the first and second element in a set?

22:03 gfredericks: hyPiRion: I know, but it woulda been useful to me

22:03 I shoulda made a macro

22:03 bbloom: gfredericks: except apparently seqs are coerced into maps, so that mistake is forgiven :-P

22:04 gfredericks: ,(let [{foo :foo} [[:foo 12]]] foo)

22:04 clojurebot: nil

22:04 bbloom: ,(let [[a b] (seq #{1 2}] a)

22:04 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

22:04 bbloom: ,(let [[a b] (seq #{1 2}] a))

22:04 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

22:04 bbloom: ,(let [[a b] (seq #{1 2})] a)

22:04 clojurebot: 1

22:04 bbloom: braces. i can't count.

22:05 i find it *extremely annoying* when destructuring from arguments throws, since you can't print anything before that. you need to insert a let form

22:06 gfredericks: do preconditions run first?

22:06 ToxicFrog: ,(defmacro foo [body] `(fn [line] (str body line))) (macroexpand '(foo ""))

22:06 gfredericks: ,(macroexpand-1 '(fn [[a]] {:pre [(+ 1 2)]} a)

22:06 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

22:06 #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

22:06 ToxicFrog: ,(macroexpand '(foo ""))

22:06 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

22:06 gfredericks: ,(macroexpand-1 '(fn [[a]] {:pre [(+ 1 2)]} a))

22:06 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

22:07 gfredericks: &(macroexpand-1 '(fn [[a]] {:pre [(+ 1 2)]} a))

22:07 lazybot: ⇒ (fn* ([p__13848] (clojure.core/let [[a] p__13848] (clojure.core/assert (+ 1 2)) a)))

22:07 gfredericks: nope

22:07 ToxicFrog: &(defmacro foo [body] `(fn [line] (str body line))) (macroexpand '(foo ""))

22:07 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

22:07 ToxicFrog: Dammit

22:07 yedi: does anyone know what the aws channel is

22:07 hyPiRion: &(let [{foo :bar} :baz] foo)

22:07 lazybot: ⇒ nil

22:07 ToxicFrog: Anyways, when testing locally this expands to (fn* ([user/line] (clojure.core/str user/body user/line)))

22:07 bbloom: gfredericks: they can't b/c the preconds can refer to the destructured arg names

22:07 hyPiRion: oh, right.

22:07 ToxicFrog: At which point everything goes horribly wrong because it's [user/line] rather than just [line]

22:07 gfredericks: bbloom: ah right

22:07 ToxicFrog: How do I fix this?

22:08 hyPiRion: ToxicFrog: instead of line, do ~'line

22:08 Or even better, do line#

22:08 ToxicFrog: line# everywhere or #line just in the argument?

22:09 Er, line#

22:09 hyPiRion: everywhere you're referring to line#. line will always expand to namespace/line.

22:09 gfredericks: how are the syntax colors in clojure-mode determined?

22:09 are they configurable?

22:11 hyPiRion: ToxicFrog: If you've not read up on gensyms, you should do so before wandering into macros

22:11 it'll save you some time debugging later on.

22:15 ToxicFrog: hyPiRion: where do I read up on them? /macros doesn't mention them, /reader mentions them only in passing

22:15 I really wish /macros were more comprehensive rather than most of the macro-writing stuff being documented in /reader.

22:17 And now I'm deeply confused: Exception in thread "main" java.lang.ClassCastException: ifirc.core$fn__35 cannot be cast to java.lang.CharSequence, compiling:(core.clj:23)

22:18 Oh wait

22:19 '() and () are totally not the same thing!

22:19 bbloom: ToxicFrog: eh, actually...

22:19 ,(= '() ())

22:19 &(= '() ())

22:19 lazybot: ⇒ true

22:19 bbloom: &(= ''''''''''() ())

22:19 lazybot: ⇒ false

22:19 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

22:19 bbloom: &(= ''() ())

22:19 lazybot: ⇒ false

22:19 bbloom: () is weird....

22:20 amalloy: ToxicFrog: they evaluate to identical values, but they are not identical forms

22:20 ToxicFrog: Yeah, what was happening was that my macro was evaluating to (def name (...)) rather than (def name '(...))

22:20 With tragic consequences

22:21 bbloom: RE: destructuring again, nth isn't the only case it can throw, there is also nthnext, which is basically the same class of problem

22:21 amalloy: ie, there's no function f that could tell the difference between (f ()) and (f '()), but a macro could

22:22 ToxicFrog: Sorry, I should have been more clear, I wasn't referring to literally () and '(), there's stuff in the parens. And '(1 2 3) is not at all identical to (1 2 3).

22:22 Among other things, the latter is a runtime error~)

22:22 bbloom: ,```````()

22:22 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

22:22 bbloom: &```````()

22:22 poor little bot

22:22 exponential macro explosion

22:23 &"you alive?"

22:23 lazybot: ⇒ "you alive?"

22:23 bbloom: &```````()

22:24 &```()

22:24 lazybot: ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/list))))

22:24 bbloom: &````()

22:24 lazybot: ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/concat)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core... https://www.refheap.com/paste/12616

22:24 bbloom: &`````()

22:24 lazybot: ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/concat)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core... https://www.refheap.com/paste/12617

22:24 bbloom: &``````()

22:24 lazybot: ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/concat)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core... https://www.refheap.com/paste/12618

22:24 bbloom: &```````()

22:24 kaboooom

22:24 locally i get:

22:24 CompilerException java.lang.ClassFormatError: Invalid method Code length 212580 in class file user$eval366, compiling:(NO_SOURCE_PATH:0)

22:27 Google Code likes to 500

23:32 ToxicFrog: Goddamnit, re-matches

23:57 yedi: excuse my newbness but where does System.getproperty() get the property from...

23:57 ?

23:57 are they just environment variables

23:57 on the machine?

23:58 jeremyheiler: yedi: System.getenv() is for environment variables.

23:58 System.getProperty has many sources.

23:58 yedi: hm

23:58 jeremyheiler: For one, the -D command line options.

23:59 like java -Dmy.property=cool Main

23:59 yedi: this guide (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.rds.html) tells me that I should use system.getproperty to get out what RDS's db info

Logging service provided by n01se.net