#clojure log - Sep 04 2012

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

2:48 AustinYun: can someone tell me what the target directory that leiningen creates does?

2:50 michaelr525: AustinYun: probably for compiled java classes, no?

2:51 AustinYun: oh

3:25 michaelr525: can i import symbols using (use) and rename them in the current namespace?

3:27 something like this (:use [clojure.string :only [split :as sp]])

3:29 tomoj: (:use [clojure.string :only [split] :rename {split sp}])

3:30 see docs for use/require/refer

3:31 michaelr525: cool

3:31 :)

3:32 tomoj: i actually looked up the doc for use, but didn't read everything just skimmed over the examples and there is no example for rename :)

3:36 tomoj: I don't remember why I believe this, but I think :use :only is going out of style in favor of :require :refer

3:41 kral: namaste

3:47 michaelr525: tomoj: in :refer's docs I've seen this: "Use :use in the ns macro in preference to calling this directly."

3:49 err

3:49 it's written that use is like require+refer

3:51 what use does refer have without require?

3:52 hyPiRion: ,(doc refer)

3:52 clojurebot: "([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to somethin...

3:55 michaelr525: hyPiRion: but in which case would i use refer without a require?

4:01 tomoj: I can't think of any reason

4:03 other than like (:refer-clojure :exclude [replace])

4:05 michaelr525: hmm

4:05 so why :use goes out of style? looks like :use should be the most used of these forms..

4:07 tomoj: I hardly ever use :use

4:07 except at the repl

4:07 some believe that :use is only acceptable when paired with :only

4:08 but :require :refer works for that, and works in clojurescript too

4:08 noidi: michaelr525, it's easier to :use all names in a namespace without thinking about it too much

4:08 :require makes you explicitly state that it's really what you want

4:08 with (:require foo :refer :all)

4:09 I guess that's the reason

4:09 alex_baranosky: what are you all using to manage your SQL schema migrations?

4:09 michaelr525: noidi: oh

4:09 i see

4:10 that's what i did when I started actually, just imported everything with use. now I usually specify what I need with :only/

4:13 samrat: what's the way to do background task queueing in Clojure?

4:13 noidi: samrat, you could use agents or futures

4:14 michaelr525: samrat: i use langohr

4:14 with rabbitmq

4:16 samrat: thanks, I'll look those up

4:16 anything based on redis, I did find resque-clojure, but that doesn't seem to have been updated in a while

4:20 michaelr525: ,(doc require)

4:20 clojurebot: "([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents...

4:22 michaelr525: noidi: was the :refer options added to :require in clojure 1.4?

4:23 noidi: it's mentioned in the docs in the source but not mentioned int the docs at clojuredocs.org (the version there is 1.3)

4:24 amalloy: michaelr525: yes

4:25 michaelr525: ah, now everything is clear ;)

4:25 amalloy: what

4:27 amalloy: err ignore that what

4:47 AustinYun: wow

4:47 circle ci and travis ci both work with datomic

5:00 muhoo: https://www.refheap.com/paste/4864 i give up

5:01 amazon s3 requires jackson 1.9.9. cheshire 4.0.0 requires jackson 2.0.0 and i'm just screwed

5:01 clgv: muhoo:is one compatible with the other?

5:02 muhoo: in that case you could specify :exclusions in the project.clj

5:03 muhoo: they don't appear to be.

5:04 java.lang.ClassNotFoundException: org.codehaus.jackson.smile.SmileFactory

5:04 clgv: muhoo: maybe a slightly older version of cheshire then?

5:04 muhoo: noir depends on 4.0.0. the tree i posted shows the tangle

5:04 sleepy now, must sleep. tired, dependency hell, no work getting done, only pain.

5:05 clgv: muhoo: well maybe noir is fine with a slightly older version?

5:05 muhoo: "amazon s3" is a lib for the equal named service of amazon? or is their runtime env?

5:06 muhoo: it's all here: https://www.refheap.com/paste/4864

5:06 tomoj: the latest aws sdk seems to depend on an even older version of jackson

5:06 clgv: ok, I didnt play with any amazon services yet ;)

5:07 muhoo: (+ clj-aws-s3 noir) => trouble

5:07 tomoj: a kludge to get it working might be jarjar

5:07 clgv: muhoo: does amazon also throw an exception if you use 2.0.0?

5:08 muhoo: the api has changed.

5:08 clgv: ok. damn

5:08 muhoo: i'll look into jarjar, thanks

5:09 clgv: binx? :P

5:09 muhoo: no, not elmo-in-space. the library

5:09 clgv: just kidding. go get some sleep - that often helps^^

5:09 tomoj: I can't find the example but I think e.g. storm uses jarjar to rewrite the package names of thrift so that storm's thrift won't conflict with user code thrift

5:10 well that won't help you much

5:10 cus you'd have to write the classnames in clj-aws-s3 or cheshire

5:11 er, in aws-java-sdk or cheshire :(

5:11 muhoo: i might throw this to weavejester and see if he has any ideas

5:12 weavejester: What's the problem?

5:12 muhoo: but he depends on the amazon library, and they're the ones digging their heels in with old jackson smile

5:12 weavejester: https://www.refheap.com/paste/4864

5:13 clj-aws-s3 wants jackson 1.9.9, noir wants cheshire 4.0.0 which wants jackson 2.0.0

5:13 tomoj: (and latest aws-java-sdk wants jackson 1.8.9, it seems)

5:14 weavejester: Is jackson 1.9.9 incompatible with jackson 2.0.0?

5:14 muhoo: end result is this: https://www.refheap.com/paste/4865

5:14 java.lang.ClassNotFoundException: org.codehaus.jackson.smile.SmileFactory

5:14 weavejester: Have you tried forcing both to use 2.0.0?

5:15 muhoo: weavejester: i did, some time ago. i don't remember the exact result, but it didn't help

5:15 weavejester: On the dependency tree Cheshire is further away from base than clj-aws-s3, so maybe it you added the jackson classes to your deps tree directly to use 2.0.0

5:17 muhoo: i didn't

5:17 perhaps noir did

5:17 weavejester: ?

5:17 muhoo: sorry, cheshire did

5:18 weavejester: Have you tried adding the jackson classes directly to your project deps?

5:18 muhoo: also, it's a bit different. clj-aws wants jackson-core-asl, etc, but cheshire wants jackson-core, etc

5:18 and i don't understand the differences, not being an expert on jackson

5:19 it looks to my naive eyes like the api and library structure changed a lot between those versions

5:20 weavejester: Hm… they're different package families too.

5:20 muhoo: right. so that's why i'm stuck atm.

5:20 weavejester: Do they produce the same library?

5:21 muhoo: i don't know

5:21 jackson is a black box to me. cheshire is quite nice though.

5:22 tomoj: hmm "Differences from Jackson 1.x" "Java package is now com.fasterxml.jackson.core (instead of org.codehaus.jackson)"

5:22 (about 2.0)

5:22 so it should work fine??

5:22 lazybot: tomoj: What are you, crazy? Of course not!

5:22 muhoo: hehe

5:22 tomoj: it didn't last i tried, but no harm in trying again. here come :exclusions, let's see

5:23 weavejester: Okay, so have you actually tried forcing all deps to 2.0.0?

5:23 That seems a simple thing to try to see if it works.

5:23 tomoj: muhoo: I mean, if the libraries are in different packages, it should work fine to exclude nothing

5:24 shouldn't it?

5:24 weavejester: Different Maven packages, not necessarily different Java packages

5:24 muhoo: weavejester: trying now

5:25 weavejester: So exclude the 1.9.9 version I guess

5:26 tomoj: if you exclude the 1.9.9, org.codehaus.jackson.smile.SmileFactory would not be found

5:26 muhoo: java.lang.ClassNotFoundException: org.codehaus.jackson.JsonFactory

5:26 tomoj: since jackson 2.0 moved from org.codehaus to com.fasterxml

5:27 weavejester: So they even changed the namespaces?

5:27 muhoo: the ns looks the same, just the artifact changed

5:28 tomoj: 1.9.9 is entirely contained in org.codehaus

5:28 2.0.0 in com.fasterxml

5:28 what is the symptom when you don't exclude anything and specify just clj-aws-s3 and noir?

5:29 maybe the problem is jackson's deps ?

5:29 doesn't seem to have any deps

5:29 muhoo: tomoj: without exclusions, i get java.lang.ClassNotFoundException: org.codehaus.jackson.smile.SmileFactory

5:30 with exclusions, i get java.lang.ClassNotFoundException: org.codehaus.jackson.JsonFactory

5:31 i should post a minimal project which fails, might help if anyone wants to try to repro.

5:32 tomoj: bizarre

5:33 add [org.codehaus.jackson/jackson-smile "1.9.9"] ?

5:33 (with no exclusions)

5:34 muhoo: ok

5:36 tomoj: nice, that worked

5:36 but but but

5:36 tomoj: doesn't make sense

5:36 muhoo: why wouldn't that dependency be included in clj-aws-s3?

5:36 tomoj: I wouldn't guess clj-aws-s3/aws-java-sdk make use of smile

5:37 old cheshire would require that codehaus SmileFactory class though..

5:38 pre 3.1.0

5:38 muhoo: even weirder https://www.refheap.com/paste/4866 that's what results

5:39 adding that dependency explicitly, makes stuff disappear

5:39 tomoj: well the jackson-core-asl just got moved down as a dep to jackson-smile, right?

5:40 muhoo: oh it's not under clj-aws-s3 anymore, but still there, i see it

5:40 kral: anyone knows if EuroClojure videos can be downloaded (maybe via torrent?)

5:41 muhoo: tomoj: i have to wonder if other stuff will break now. will try a lein check and see

5:42 tomoj: would be nice if you could see who asked for that missing class

5:44 dhofstet: kral: yes, they can be downloaded http://vimeo.com/euroclojure

5:46 muhoo: tomoj: it's in that stacktrace. gotta love errors on line 1 of a file :-/

5:47 tomoj: so it's coming from cheshire

5:48 muhoo: looks that way. that's why... i'm suspicious that other things will break

5:48 tomoj: but you have cheshire 4.0.0 in deps, which specifies com.fasterxml

5:48 muhoo: *i* don't have cheshire 4.0.0 in deps, noir does. and yes, it wants the com.fasterxml package version of the same library

5:52 tomoj: fwiw, with [clj-aws-s3 "0.3.2"] [cheshire "4.0.0"], I get no error requiring cheshire.core

5:54 the only explanation I can think of is that one of your transitive deps has an old version of cheshire AOT'd .. but that seems unlikely

6:01 kral: dhofstet: oh, thanks

6:27 clgv: ui new vids to view :)

6:28 michaelr525: what?

6:28 clojurebot: what is exceptions

6:28 michaelr525: err

6:28 clgv: clojurebot: botkick ;)

6:28 clojurebot: No entiendo

6:29 michaelr525: a function may return 1 item or a collection of items, i would like to map this function over a collection and concatenate the results. mapcat won't work since concat requires all arguments to be a collection.

6:30 clgv: can't you make sure that your functions always returns collections?

6:30 michaelr525: should I make my function return only a collection and use mapcat ?

6:31 i can but i'm not sure that I want to...

6:31 clgv: michaelr525: do you need lazy? otherwise implement the combining logic via reduce that chooses between conj and concat

6:32 michaelr525: hmm

6:32 suppose that i need lazy..

6:33 i don't really need lazy, but i don't like writing that reduce - i'd rather make my function return only collections

6:33 clgv: thats probably better

6:34 I know one example where it is really annoying that the function returns a value if there is only one but a collection if there are many

6:34 michaelr525: i think that once someone here wrote some neat solution using (into)

6:34 clgv: incanter's selection of columns does (maybe did) that

6:35 michaelr525: humm but into needs a collection as well

6:37 michaelr525: yeah

6:50 clgv: michaelr525: you could also use (apply concat (map #(let [r (apply f %&)] (if (sequential? r) r [r])) coll))

6:55 michaelr525: clgv: yeah, i think that I'll take that route

6:56 now the problem is to find a suitable name for that function ;)

6:56 maybe (mapcat-always)?

6:56 (mapcat-anyway)

6:56 clgv: your choice ;)

6:56 michaelr525: (mapcat-everything)

6:57 (map-my-cat)

6:58 clgv: then you need an additional (map-my-dog) ;)

6:58 michaelr525: heh

6:59 i think it'll be something like this: (mapcat #(ensure-seq (my-function)) col)

7:00 clgv: I have assure-coll somewhere in my projects ;)

7:00 or even assure-vec?

7:04 michaelr525: settled on (mapcatz) :)

7:04 clgv: I demand (mapdogz) as well ;)

7:05 michaelr525: you are barking at the wrong tree ;)

7:56 iDesperadO: how to read clojure's doc. Is there any guid for it? like (doc clojure.set/project) => clojure.set/project ([xrel ks]) Returns a rel of the elements of xrel with only the keys in ks

7:57 I read this doc time and time again, with no idea what project indents to do

7:58 S11001001: iDesperadO: rel means set

7:58 iDesperadO: how rel means set?

7:58 S11001001: a set relates its elements to each other

7:59 iDesperadO: and there's xrel

7:59 S11001001: iDesperadO: try reading the docs of functions you're familiar with

7:59 iDesperadO: what a irony...I don't need to read the doc that I've already familiar with... only ones I'm not

8:00 S11001001: why is that?

8:01 tomoj: some of the clojure.set docs are just confusing

8:01 a rel is a set of maps ##(clojure.set/project #{{:foo 1 :bar 2} {:foo 3 :bar 4}} #{:foo})

8:01 lazybot: ⇒ #{{:foo 1} {:foo 3}}

8:01 S11001001: thanks tomoj

8:02 relational algebra ahoy

8:03 iDesperadO: tomoj: where can I find that a rel is a set of maps?

8:05 tomoj: I mean if I can't understand the doc of a function, where can I turn to?

8:05 clgv: iDesperadO: I think there is some more doc in the namespace docs

8:06 iDesperadO: clojuredocs.org has often some examples on the usage

8:06 iDesperadO: ah...

8:07 clgv: then how to find namespace doc? like some docs about the namespace clojure.set?

8:08 clgv: iDesperadO: http://clojure.github.com/clojure/ but there is none for clojure.set - seems I read it somewhere else

8:08 iDesperadO: clgv: I often miss python's help function which can tell me something like list/dictionary `help(list)/help(dict)`

8:10 tomoj: iDesperadO: http://clojuredocs.org/clojure_core/clojure.set/project

8:10 iDesperadO: I'm reading it

8:11 clgv: iDesperadO: in case you wanted project entries from a map - this is named select-keys

8:12 iDesperadO: so, other from clojuredocs.org I will have no idea project deals with a set of maps...why they can't tell this in the doc???

8:12 lazybot: iDesperadO: How could that be wrong?

8:13 tomoj: they probably should

8:13 iDesperadO: I find clojure's doc is not friendly to newbies, at least to someone like me

8:23 clgv: iDesperadO: out of curiosity do you really need `project`? I have not needed it, yet. I think there are some questionable function in clojure.set - all those dealing with relations

8:27 iDesperadO: clgv: no, I just happen to pick project as an example to show that sometimes I don't understand the doc and wonder to know guys here have better way to teach me how to lean a function on repl

8:29 clgv: at first I'm confused by tokens like "x" "xs"...and after I get used to I find more doc that I can't understand...

8:30 clgv: iDesperadO: ah ok. I think in clojure.core the docs are better.

8:33 iDesperadO: clgv: do clojure has some way to know something about a namespace?

8:33 clgv: iDesperadO: you have to be more specific for a helping answer ;)

8:34 iDesperadO: otherwise my generic answer is that the clojure cheat sheet has a section on namespace related functiosn

8:34 iDesperadO: like if I don't know nrepl is something like swank-clojure, but if I want to know more what's nrepl is, the only way is to look on the web?

8:35 clgv: iDesperadO: nrepl is a third-party library. you'll have to find its project page and read the docs overthere

8:35 pandeiro: iDesperadO: i've seen (ns..) declarations annotated with :doc metadata

8:36 but i'm not sure how to retrieve that at the repl

8:36 clgv: clgv: most clojure projects have their source and documentation hosted on github

8:36 ,(doc clojure.core)

8:36 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.core>

8:36 gfredericks: ,(-> "clojure.core" find-ns meta :doc)

8:36 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol>

8:36 clgv: humm shouldnt that work with 1.4?

8:36 gfredericks: ,(-> "clojure.core" symbol find-ns meta :doc)

8:36 clojurebot: "Fundamental library of the Clojure language"

8:37 gfredericks: ,(-> "clojure.walk" symbol find-ns meta :doc)

8:37 clojurebot: nil

8:37 Bronsa: ((comp :doc meta find-ns) 'clojure.core)

8:37 gfredericks: yep, lots of docs there

8:37 Bronsa: ,((comp :doc meta find-ns) 'clojure.core)

8:37 clojurebot: "Fundamental library of the Clojure language"

8:39 iDesperadO: seems only ((comp :doc meta find-ns) ns) can find doc only for clojure.core

8:39 clgv: ,((comp :doc meta find-ns) 'clojure.test)

8:39 clojurebot: nil

8:39 iDesperadO: mostly it just returns nil

8:39 clgv: ,(-> "clojure.test" symbol find-ns meta :doc)

8:39 clojurebot: nil

8:39 iDesperadO: right

8:40 clgv: clojure.test should have some

8:40 cf. http://clojure.github.com/clojure/clojure.test-api.html

8:41 iDesperadO: clgv: I need to read the Overview part there

8:41 right now I just want to read on my repl

8:41 no to read it on the wed

8:41 web

8:42 clgv: iDesperadO: then you are stuck with `doc` for function docstrings

8:42 iDesperadO: the Overview part tells me what the ns is for and maybe some examples about the usage

8:42 clgv: iDesperadO: probably, you should read one of the introductory books on clojure if you are serious about learning it - that'll speed you up

8:42 iDesperadO: I'm reading it

8:43 clgv: clojure programming

8:43 clgv: but...but I hope clojure's doc can be at least as good as python:)

8:46 clgv: just my wishes:)

8:46 wmealing_: is there any ssl client/server certificate libraries for clojure, i'm not getting much luck with the google

8:46 iDesperadO: I'd better to finish my reading and start writing something

8:46 clgv: iDesperadO: in the 1.4 release they did a lot of doc writing afair

8:46 hyPiRion: iDesperadO: It's going to be better... I hope.

8:46 clgv: wmealing_: try java libs?

8:47 wmealing_: clgv: might have to

8:47 hyPiRion: At least Clojure developers are aware that the doc is bad, so it should be on a prioritized list.

9:05 jcromartie: I am torn over wether it's a good thing or a bad thing, that there is no standard command called "clojure"

9:06 a la scala, python, ruby, perl

9:06 alias clojure="lein repl" # goo enough

9:06 s/goo/good/

9:11 ,default-data-readers

9:11 clojurebot: {inst #'clojure.instant/read-instant-date, uuid #'clojure.uuid/default-uuid-reader}

9:12 jcromartie: ,(println #uuid 1234)

9:12 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.AssertionError: Assert failed: (string? form)>

9:12 jcromartie: this quits my REPL

9:12 ,(println "I'm still here")

9:12 clojurebot: I'm still here

9:12 gfredericks: ,(println #uuid "1234")

9:12 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Invalid UUID string: 1234>

9:13 jcromartie: I'm not trying to read a valid UUID :)

9:13 I just noticed it quit the REPL ("Bye for now!")

9:14 looks like it works in the latest leiningen though

9:16 wilfredh: is there any easy way to convert [:1 :2 :3] to [1 2 3] ?

9:16 rather than converting to a string, stripping the colon, then parsing the string as a number

9:19 gfredericks: wilfredh: name instead of str will save you a step

9:20 ,(mapv (comp read-string name) [:1 :2 :3])

9:20 clojurebot: [1 2 3]

9:20 jcromartie: I'd imagine read-string is slower than Integer/parseInt

9:21 S11001001: jcromartie: yeah, but it works with all the integers fit to print

9:21 jcromartie: true

9:22 S11001001: we had a prod bug caused by parseInt where we should have been read-stringing once

9:22 gfredericks: ,(read-string "372824723724728477417915793579237952973479234375373733000N")

9:22 clojurebot: 372824723724728477417915793579237952973479234375373733000N

9:23 wilfredh: gfredericks: thanks.

9:23 S11001001: wilfredh: in this case, though, you want to ##(-> :3 name first int (- (int \0)))

9:23 lazybot: ⇒ 3

9:24 jcromartie: there should be a better way to coerce a string into an integer number :)

9:24 without read-string

9:24 read-string is not eval, but it's close enough to make me nervous

9:24 maybe I should relax

9:25 S11001001: wilfredh: I'm assuming your keywords are one digit each

9:25 wilfredh: afraid not

9:25 jcromartie: S11001001: why would you assume one digit?

9:25 oh, you're being silly :)

9:25 xeqi: heh, bind *read-eval* to false and you might be safe reading

9:26 gfredericks: jcromartie: read-string is perfectly awesome if you have read-eval off

9:26 it's just like reading json

9:26 S11001001: I guard it with [0-9]+ for integer reading

9:27 wilfredh: ,(mapv (comp Integer/parseInt name) [:1 :2 :3])

9:27 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0)>

9:27 jcromartie: Where is "#=" documented?

9:27 it's not in http://clojure.org/reader

9:27 or is it

9:27 gfredericks: ,(doc *read-eval*)

9:27 clojurebot: "; When set to logical false, the EvalReader (#=(...)) is disabled in the read/load in the thread-local binding. Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) Defaults to true"

9:27 jcromartie: yeah

9:27 but #= itself

9:27 wilfredh: why can't I use comp with Integer/parseInt?

9:27 jcromartie: why in the world would *read-eval* be true by default anyway

9:27 who uses #=

9:27 wilfredh: (sorry for novice questions...)

9:28 S11001001: wilfredh: it's not a function; the gods of clojure are interfering with your repl to encourage you to use read-string instead :]

9:28 gfredericks: jcromartie: I think it's a lot less necessary now that there are data readers; I hope it gets defaulted to off

9:29 jcromartie: wilfredh: because it's a Java class method, not a Clojure fn

9:29 when Clojure sees Integer/parseInt by itself, it tries to access it as a static field

9:29 babilen: wilfredh: You can use (memfn Integer/parseInt)

9:29 jcromartie: the source code of memfn is instructuve

9:29 gfredericks: ,Integer/parseInt

9:29 wilfredh: ,(mapv (comp (memfn Integer/parseInt) name) [:1 :2 :3])

9:29 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0)>

9:29 #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: parseInt for class java.lang.String>

9:30 chouser: There's really no point in memfn now that we have #()

9:30 babilen: wilfredh: Or just use an anonymous function such as #(Integer/parseInt %) ...

9:30 gfredericks: chouser: point-free nerds!

9:31 babilen: chouser: Right, I use #(Foo/bar %) more often anyway.

9:31 jcromartie: (memfn Integer/parseInt) should work locally… I think clojurebot is doing something clever

9:31 S11001001: ,(doc memfn)

9:31 clojurebot: "([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."

9:31 stain: chouser: unless it takes many arguments (unlikely for typical functional uses of memfn though)

9:32 S11001001: jcromartie: I think memfn makes member method calls

9:32 jcromartie: ,((memfn Integer/parseInt) "1234")

9:32 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: parseInt for class java.lang.String>

9:33 jcromartie: weird

9:33 oh right

9:33 hyPiRion: jcromartie: Works only on methods, not static methods.

9:33 S11001001: ugh, I can't believe I said "member methods"

9:34 hyPiRion: ,((memfn parseInt) 1 "1234")

9:34 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval55$fn>

9:34 S11001001: *instance*, S11001001, *Instance*

9:34 hyPiRion: ,((memfn parseInt) "1234")

9:34 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: parseInt for class java.lang.String>

9:34 jcromartie: anyway

9:34 hyPiRion: ,((memfn parseInt) (Integer. 1) "1234")

9:34 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval111$fn>

9:34 jcromartie: use #(Integer/parseInt %)

9:34 hyPiRion: yeah - seems to be no way out of it.

9:35 Eventually, you could just fire off #(Integer. %)

9:35 ,(#(Integer. %) "1234")

9:35 clojurebot: 1234

9:35 S11001001: sure there is, resurrect clojure.contrib.import-static and (import-static (java.lang.Integer read-string)) :]

9:35 chouser: memfn only supports instance methods

9:35 S11001001: hyPiRion: badness, no sharing instances of small nums

9:36 hyPiRion: S11001001: hm?

9:36 ,(identical? (Integer. "10") (Integer. "10"))

9:36 clojurebot: false

9:36 S11001001: ,[(identical? (Integer/valueOf "1") (Integer/valueOf "1")) (identical? (Integer. "1") (Integer. "1"))]

9:36 clojurebot: [true false]

9:36 jcromartie: Interesting

9:37 S11001001: very annoying that deserialize doesn't exploit the shared pools

9:38 chouser: memfn also still requires points, as far as I understand the definition

9:38 ,((memfn substring x y) "hello" 3 5)

9:38 clojurebot: "lo"

9:40 chouser: So again, how is that better?

9:40 (#(.substring %1 %2 %3) "hello" 3 5)

9:41 ,(#(.substring %1 %2 %3) "hello" 3 5)

9:41 clojurebot: "lo"

10:09 nz-: ,(identical? (Integer/valueOf "1234567") (Integer/valueOf "1234567"))

10:10 clojurebot: false

10:10 nz-: ,(identical? (Integer/valueOf "12") (Integer/valueOf "12"))

10:10 clojurebot: true

10:11 jeremyheiler: Integer caches the first 128 Integers, I think.

10:11 casion: 256

10:11 hyPiRion: jeremyheiler: The cache is from -128 to 127

10:12 I believe.

10:12 casion: hyPiRion is correct

10:12 jeremyheiler: yep, you're correct, just found it

10:12 casion: I spent an hour figuring out that same thing last night

10:18 S11001001: java FindBugs warns against using new Integer et al for this reason

10:21 casion: ,(identical? (int 13) (int 13))

10:21 clojurebot: true

10:21 casion: ,(identical? (int 313) (int 313))

10:21 clojurebot: false

10:21 * casion snickers

10:25 S11001001: this is pretty ordinary for lisp; standard common lisp and most schemes have some such cutoff, though the lisps typically bit-twiddle instead of maintaining an in-memory cache

10:26 technomancy: usually that's done through fixnums though, which the JVM unfortunately lacks

10:27 casion: with boxing ints to Integers in 1.4, I think it becomes a bit silly

10:27 nvy: ,(identical? 1311 1311)

10:27 clojurebot: false

10:27 S11001001: because some implementor decided to have separate value and reference types instead of a unified value model

10:27 nvy: man what

10:28 ,(identical? (- 1311 1311) (- 1311 1311))

10:28 clojurebot: true

10:28 S11001001: nvy: that's nothing, this is allowed in r5rs scheme: (let ((x #\a)) (eq? x x)) => false

10:28 nvy: I've never heard of R5RS before

10:29 jeremyheiler: S11001001: Why?

10:29 arrdem: S11001001: what in the seven hells...

10:29 technomancy: nine

10:29 arrdem: %s/seven/nine/g

10:30 samrat: in Noir-async, how do I do a push on the completion of a future?

10:30 technomancy: seven is purgatory =)

10:31 S11001001: jeremyheiler, arrdem: to allow lexical binding strategies that don't necessarily map to the object-identity space

10:32 I wonder...

10:32 * arrdem ponders this

10:32 S11001001: ,(let [x 12343] (identical? x x))

10:32 clojurebot: false

10:32 hyPiRion: Well, I mean

10:32 S11001001: thought so

10:32 hyPiRion: Yeah.

10:33 arrdem: ,(doc identical?)

10:33 clojurebot: "([x y]); Tests if 2 arguments are the same object"

10:33 casion: I think I'm just going to avoid all lisps forever now

10:33 arrdem: ah.

10:33 hyPiRion: ,(let [x (atom 12343)] (identical? x x))

10:33 clojurebot: true

10:33 arrdem: (dec casion) ; shun the non-beleiver

10:33 lazybot: ⇒ -1

10:33 casion: lol :)

10:33 gfredericks: wait why the non-identical 12343's?

10:33 S11001001: casion: it makes perfect sense. Forbidding you from making assumptions that aren't very useful in reality allows the implementation strategies to be more creative.

10:34 chouser: first, let's be clear that identical? often lets you see implementation details. "Equality" in any reasonable sense is implemented in = or ==

10:34 S11001001: it's certainly somewhat surprising that this can happen, but it's not actually ever useful to test identity in cases where your references are tautologically the same

10:35 weavejester: technomancy: ping

10:35 hyPiRion: ,(let [a (Integer. "1000")] (identical? a a))

10:35 clojurebot: true

10:35 arrdem: see... the (identical?) I can understand I guess. The (eq?) hacks me off a bit.

10:35 S11001001: arrdem: eq? is identical?

10:35 arrdem: S11001001: srs5 eq? as mentioned above

10:35 casion: S11001001: it doesn't make any sense to me atm at all

10:35 S11001001: casion: you saw the recent discussion on clojure about how take-while requires its pred be pure?

10:36 arrdem: (inc hyPiRion)

10:36 lazybot: ⇒ 3

10:36 S11001001: arrdem: what?

10:36 arrdem: hang on I'm having a revalation

10:36 casion: S11001001: no

10:37 S11001001: casion: okay, ##(doc take-while) why make that restriction on pred?

10:37 lazybot: ⇒ "([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."

10:38 casion: S11001001: I don't know. I've never understood the use of 'must' in that sentence

10:39 S11001001: casion: it's a requirement about the pred you pass in

10:39 hyPiRion: ,(let [eq? (fn [a] (identical? a a))] (eq? 1000))

10:39 clojurebot: true

10:39 S11001001: casion: must has the meaning from rfc 2119, if you want further documentation :)

10:39 nvy: great

10:40 chouser: ,(keep #(when-not (identical? (read-string %) (read-string %)) %) (map str (range -130 130)))

10:40 clojurebot: ("-130" "-129" "128" "129")

10:40 casion: S11001001: one moment

10:42 S11001001: yeah, I have no idea

10:43 chouser: so, the numbers between -128 and 127 (inclusive) when *read* are taken from a cache instead of creating new objects on the heap), and identical? is letting you see that.

10:43 djanatyn: hmm. records and protocols are kind of cool.

10:43 S11001001: casion: The requirement that pred must be pure means that `take-while' is free to change how it calls `pred'. It could call it more often, or less, or change the order of calls, or change the mix of lazy-seq value production and pred calls.

10:44 djanatyn: is there anything that makes them very different from regular classes and generic methods?

10:44 hyPiRion: The reason why identical? doesn't return true for values outside -128 to 127 is because they are wrapped in a Long when identical? is called.

10:44 As far as I can understand.

10:44 djanatyn: I've used CLOS and I'm trying to get used to clojure's version of OOP so that I can follow along in my java class

10:45 gfredericks: hyPiRion: so it is a primitive long before being passed in as args?

10:45 casion: S11001001: is this to avoid things breaking if/when take-while is changed, or does it apply to the current implementation?

10:45 S11001001: casion: take-while sacrifices predictability of pred calls for creativity in its own implementation. It's the same with this identical? thing; by making identical? counterintuitive (but still correct), the implementation can get more creative

10:46 And yes, identical? is giving the right answer here. Intuitiveness is not only unnecessary for correctness, it can sometimes lead you down the wrong path.

10:47 jeremyheiler: &(let [x 1234] (identical? x x)) ; even for this?

10:47 lazybot: ⇒ false

10:48 hyPiRion: gfredericks: Well, it certainly seems like it.

10:49 nvy: jeremyheiler: I'm a newbie, but I think in your case, x is not an object before it reaches identical?

10:49 hyPiRion: ,(let [eq? (fn [a] (let [b a] (identical? a b))) c 1000] (eq? c))

10:49 clojurebot: true

10:49 jeremyheiler: ah... makes sense

10:49 nvy: it is a primitive

10:49 casion: gfredericks: I was discussing that with you yesterday I think, when I was asking if there was a better way to avoid using unchecked-int everywhere

10:49 since clojure seems to promote to long quite liberally

10:49 and early

10:50 gfredericks: casion: promoting to long is slightly different from boxing

10:51 boxing is the issue here I think

10:52 casion: gfredericks: I thought boxing only every happened with similar types in clojure, int->Integer, long->Long etc..

10:52 ever*

10:52 hyPiRion: So it's boxed in a Long when sent as a parameter to a function.

10:52 gfredericks: casion: in 1.3 it started promoting to longs as well

10:53 casion: ah ok

10:53 technomancy: weavejester: hi

10:53 casion: well, it's all very confusing to someone who's used to C ;)

10:53 weavejester: technomancy: Hey there! I was wondering if you could release clj-stacktrace 0.2.5, since I've just ran into a bug that was fixed after 0.2.4

10:55 technomancy: weavejester: I was waiting for chouser's patches to do the next release, but at this point I've probably waited long enough

10:55 weavejester: technomancy: Thanks :)

10:56 chouser: technomancy: sorry :-(

10:56 weavejester: sorry :-(

10:56 technomancy: chouser: well it's been an convenient excuse

10:57 weavejester: I just want mva's NPE fix :)

10:57 technomancy: I'll see if I can push it out later today

10:58 weavejester: No real hurry. I forked the repo and pushed a version to a custom group in clojars in the meantime.

11:26 naeg: would be great if someone could help me with a bit-fiddling code in clojure: http://bpaste.net/show/deSQBXgSWer59qAqshCM/

11:26 clgv: can I use (derive :a :b) without namespace qualification of :a?

11:27 naeg: it's a neat algorithm for checking whether a player has won a connect four game

11:30 clgv: ah, I need an own hierarchy...

11:31 chouser: clgv: keywords in hierarchies must all be namespaced, iirc

11:31 scriptor: naeg: does >> have a higher or lower precedence?

11:31 *higher or lower than *

11:31 clgv: chouser: nope. only in the global one afair

11:31 ,(doc derive)

11:32 clojurebot: "([tag parent] [h tag parent]); Establishes a parent/child relationship between parent and tag. Parent must be a namespace-qualified symbol or keyword and child can be either a namespace-qualified symbol or keyword or a class. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to, and modifies, the global hierarchy."

11:32 scriptor: ah, looks like its lower

11:34 naeg: scriptor: I'm fiddling around with the code, but it always returns 0 where it should return 1 afaik

11:34 e.g. for number 15

11:46 canweriotnow: did something change recently with clojure.java.jdbc?

11:47 chouser: clgv: sure enough. Interesting.

11:47 clgv: chouser: it's not in the docstring but in the assert in the source

11:48 should be mentioned in the docstring though

11:48 lispnik: hi, i signed a CA and it has been received, so I requested to join the clojure-dev mailing list. membership to that group is still pending after about a week though

11:48 pjstadig: canweriotnow: why do you ask?

11:49 are you on 1.3/1.4?

11:49 (clojure that is)

11:50 there are some "unexpected" interactions between clojure 1.3/1.4 and databases containing bigint columns

11:50 canweriotnow: I'm getting IllegalArgumentException (missing a required parameter) for my db-spec, and I don't think my code changed… I also can't figure out what I'm missing.

11:50 I'm on 1.3.

11:50 I'm not even connecting at this point...

11:50 and I don't think any of the columns are bigint, anyway :-/

11:52 I've got classname, subprotocol, sub name, user, password keys in the db spec hash… can't figure out what's missing.

11:57 lispnik: canweriotnow: can you paste the db spec? (sans credentials)

11:58 canweriotnow: and a stack trace

12:01 canweriotnow: lispnik: yeah, one sec, working on two machines, thx :)

12:07 (defn bbts-dev []

12:07 { :classname (get-property "acedia.bbts")

12:07 :subprotocol (get-property "acedia.bbts.subprotocol")

12:07 :subname (str "@" (get-property "acedia.bbts.dev.host") ":" (get-property "acedia.bbts.dev.port") ":" (get-property "acedia.bbts.dev.sid"))

12:07 :user (get-property "acedia.bbts.dev.user")

12:07 :password (get-property "acedia.bbts.dev.password")})

12:07 eh, lemme do a gist, sorry...

12:08 lispnik: https://gist.github.com/2a2e87c24e495cf340f5

12:08 lispnik: canweriotnow: have you checked the return values of each of those get-property calls?

12:08 canweriotnow: yup… all correct.

12:10 lispnik: what db is this for?

12:10 oh oops

12:10 just saw you have that in your gist

12:12 canweriotnow: lispnik: having the same problem with MSSQL, though (multi-db app;ication)

12:13 Thinking of trying it with my postgres system just to be sure, but… yeah, I don't get it. this all worked previously.

12:13 muhoo: is there a way to specify in lein/nrepl that a form be executed 1) whenever the project starts and 2) whenever a new repl is started ?

12:14 in other words, 1) whenever the repl starts, and 2) whenever the user connects to it.

12:14 technomancy: muhoo: for 1) you can put an :injections key in the :repl profile

12:14 you might need to copy the :dependencies from Leiningen's :repl profile since the one in your project will shadow Leiningen's

12:15 muhoo: they don't merge?

12:15 technomancy: no, profiles of the same name shadow existing ones

12:15 unlink: Is there an if form that wraps its else block in an implicit do?

12:15 muhoo: thanks. any idea about (2)?

12:15 technomancy: otherwise there's no way to support removing things that Leiningen brings in implicitly

12:16 muhoo: that'd be more of an nrepl question

12:17 muhoo: ok

12:17 lispnik: canweriotnow: sorry i got nothing… perhaps in the full stack trace there is an indication on what param it's complaining about

12:18 canweriotnow: lispnik: okay, thanks anyhow.

12:25 uvtc: I'm using mustache (clostache) and am looking for a good way to have it "include" header and footer content in a template. I'm currently using partials, but `slurp` to get the actual header and footer content from those template files... anyone have any ideas for a better way to do this?

12:27 What I'd like is to just put `{{> header}}` at the top of my this-page.mustache template and have it "include" header.mustache right there, but that doesn't seem to be the way clostache/mustache operates.

12:35 samflores: uvtc, I'm using something like this: https://gist.github.com/3623177

12:36 it's basically what your are doing

12:36 *you

12:40 uvtc: samflores: Thanks. Why are you using `clojure.java.io/resource` instead of just having `slurp` grab the file?

12:46 What is the purpose of clojure.java.io/resource?

12:47 gfredericks: get a fileish thing on the classpath without having to worry about if you're in an FS project or a jar or etc?

12:48 austinh: Does anyone have an example of using virtual hosts with Clojure/Jetty?

12:49 I'm getting a ClassNotFoundException when importing org.eclipse.jetty.servlet.ServletContextHandler and I can't figure out how to proceed.

12:52 mrb_bk: dnolen: are there any decent technical book stores in NYC

12:53 dnolen: mrb_bk: hmm ... I always order everything online.

12:53 mrb_bk: dnolen: same, i wish there was a great used store though

12:53 dnolen: mrb_bk: oh right, yeah I get most of my of used books off amazon

12:54 mrb_bk: dnolen: i want a copy of bratko's AI book

12:55 duck1123: austinh: you're trying to run multiple hosts in the same application?

12:57 dnolen: mrb_bk: there's a newer 4th edition now w/ quite a bit of new material it seems.

12:57 austinh: duck1123: yes

12:57 xeqi: uvtc: clojure.java.io/resources will read resources inside of jar files

12:57 uvtc: gfredericks: Ok, looks like io/resource gets the java.lang.ClassLoader for this thread (which is used for loading classes and resources (from somewhere on the classpath)), and calls its getResource method which returns a java.net.URL. Not exactly sure why it returns a URL instead of a File though. I suppose because resources can be found in places other than local files. :)

12:58 S11001001: uvtc: like in jars

12:58 mrb_bk: dnolen: hmm, will look into that, thanks!

12:58 xeqi: oh, gfredericks already said that

12:58 S11001001: as xeqi said

12:59 uvtc: xeqi S11001001 : Thanks. So, it could return a URL that points into a jar? What would that look like?

12:59 S11001001: uvtc: ask for clojure/core__init.class and find out :)

12:59 duck1123: austinh: I'm affraid I don't know much about Jetty WRT virtual hosts. Just wanted to make sure you weren't simply trying to run two domains on the same machine. (which is different)

13:00 TimMc: It is?

13:01 uvtc: ,(str (clojure.java.io/resource "clojure/core__init.class"))

13:01 clojurebot: ""

13:01 uvtc: Give me results on my system though. Thanks, S11001001 .

13:01 "jar:file:/home/john/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar!/clojure/core__init.class"

13:02 duck1123: TimMc: If he was just trying to run two domains, I would suggest having 2 apps with a common frontend http server

13:03 uvtc: gfredericks: tanks.

13:03 gfredericks: also, *thanks.

13:08 austinh: How do you know which Java classes can be imported? Is it determined by the JVM that I'm running, or by a jar that is packaged with Clojure, or something else?

13:10 * austinh understands next to nothing about Java

13:10 S11001001: austinh: you a leiningen user?

13:10 austinh: S11001001: Yes, but I currently run everything using clojure-jack-in and evaluating in the buffer.

13:10 nDuff: austinh: ...in terms of the _details_, it's determined by your classloader, but in the general case, anything accessible to your JVM -- packaged by it, added to your classpath, etc etc

13:11 uvtc: austinh: you can import any java classes on your classpath.

13:11 nDuff: austinh: (there are things that can be done to artificially restrict what classes you can see, or enable download/install/access of new packages within a running instance, or so forth, but if we're just sticking to the general case...)

13:12 S11001001: austinh: then, as nDuff said

13:12 clojurebot: Excuse me?

13:12 nDuff: austinh: ...generally, the easiest thing to do is to let leiningen manage it all for you -- adding a description of anything you need to your project.clj, and letting it download those and make sure they're on the classpath.

13:13 austinh: Ok, so are classes under org.eclipse.jetty available because ring-jetty-adapter depends on org.eclipse.jetty/jetty-server?

13:13 nDuff: austinh: ...if you use "lein swank", you can then attach a running emacs instance to it; I don't know the details of what clojure-jack-in does.

13:13 austinh: org.eclipse.jetty is just where jetty-server comes from

13:13 austinh: it doesn't guarantee that it gives you all of org.eclipse.jetty

13:13 austinh: Right. That's what I thought.

13:13 nDuff: austinh: ...you'd have to look at the docs for jetty-server to know exactly what is and isn't included

13:13 uvtc: austinh: Oh, if you're talking about getting them onto your classpath to begin with, then as the others are pointing out, you just add them to the dependencies in your project.clj and let lein get them for you.

13:14 austinh: I was wondering why some classes under org.eclipse.jetty can be imported, but others are not found.

13:14 nDuff: *nod* -- you'll have to find out which packages the ones you need that aren't there come from and add them.

13:14 austinh: I see. Thank you all.

13:14 nDuff: If you were in an OSGi container, the explanation would be longer and much more complicated, but if you were, you'd probably know. :)

13:15 austinh: I don't even want to know.

13:16 uvtc: austinh: You find the packaged-up libs you want at http://search.maven.org/ , then add the "coordinates" you find there to the dependencies in your project.clj.

13:17 austinh: uvtc: Thank you.

13:18 uvtc: austinh: y/w.

13:24 austinh: Is 'lein search' deprecated?

13:24 technomancy: austinh: you need to be running preview10 for it to work properly

13:25 since maven moved the index location for central

13:25 s/maven/sonatype/

13:25 austinh: Ok, I just updated. Thanks.

13:33 cemerick: technomancy: unbelievable

13:33 no redirect?

13:33 technomancy: cemerick: err--they changed the format too

13:34 cemerick: awesome

13:34 technomancy: supposedly the old indices were the "legacy" ones

13:35 probably there's a mailing list I should be on so I would find out about these things before they happen? dunno

13:35 cemerick: Seems like something like central shouldn't break APIs/paths until the heat death.

13:36 xeqi: does the same hold for clojars?

13:36 technomancy: cemerick: I have a bit of sympathy since the old indices were huge, monolithic, and crazy slow.

13:36 and the new format allows for incremental updates

13:36 canweriotnow: technomancy: does lein2 change any behavior re: loading libs from the system class path, i.e., jdbc drivers?

13:37 technomancy: canweriotnow: yeah, we now ignore $CLASSPATH

13:37 cemerick: Sure. I'm all for improvements, but when the underlying data is the same, and you're just providing different manifestations of it, the marginal cost of leaving prior revs in place is marginal. Or, it is compared to the pain that can be caused by breaking tools that depend on centralized services.

13:37 technomancy: we've never explicitly supported anything that could be called the "system class path", but $CLASSPATH was an undocumented way to do certain sketchy things

13:38 cemerick: I think it's more a problem of bandwidth costs

13:38 canweriotnow: technomancy: Is there a proper way to make sure proprietary jars (oracle, mssql) get loaded (i.e., from /usr/lib/jvm/*version*/jre/lib/ext)?

13:38 technomancy: canweriotnow: you need to get them into a repository

13:39 canweriotnow: so, e.g., lein-localrepo should solve it?

13:39 cemerick: xeqi: Dunno. How many tools depend upon clojars APIs? Is the population depending on them growing, shrinking, or flat?

13:40 (rhetorical questions there)

13:40 technomancy: canweriotnow: if you're just working on the project solo that's fine

13:40 canweriotnow: I have to say, Clojure's stack traces (well, really jvm's) make me miss the CL REPL :)

13:40 technomancy: canweriotnow: otherwise you'll want to set up a private repository, which can be just a pile of files served over HTTP

13:41 canweriotnow: technomancy: Yeah, I'm the only one on this for the moment, we're going to set up maven or sonatype locally for some stuff once it needs sharing. Thanks! :D

13:49 technomancy: cemerick: we used to consume the simple indices with raw lucene, but now the index structure is so complicated we have to use their indexer API

13:49 so on the bright side if they have any more incompatible index changes, it'll be a simple version bump on our dependency to fix it =)

14:01 Moses: I'm getting bugs when trying to use Marginalia, anyone have any experience using it?

14:02 Specifically its telling me I can't create an ISeq from a clojure.lang.Symbol

14:04 dnolen_: Moses: does your own code compile?

14:04 Moses: Yes

14:05 hiredman: are you sure?

14:05 Moses: Shit, I just figured it out

14:05 I apologize

14:05 In Defproject, I had :dev-dependencies [lein-marginalia "0.7.1"]

14:06 Should have been :dev-dependencies [[lein-marginalia "0.7.1"]]

14:06 technomancy: :plugins [[lein-marginalia "0.7.1"]] actually

14:07 Moses: Oh @@

14:08 BTW, to anyone that hasn't played with it yet, I just got it working, and I'm already in love with it!!!

14:08 Thanks :technomancy

14:08 technomancy: np

14:17 amalloy: seancorfield: you around? stackoverflow noticed an issue with data.priority-map

14:18 pandeiro: cemerick: is there a way i can use vars from another ns referring to javascript fns as strings with clutch/view-server-fns?

14:19 cemerick: pandeiro: Not sure what you mean.

14:19 Oh, you just want to push some code-as-strings to the server?

14:19 pandeiro: cemerick: yup

14:19 it seems to be just taking the symbol and converting to string

14:20 instead of resolving it

14:20 maybe just don't use view-server-fns but update-document instead?

14:21 ToxicFrog: This marginalia thing looks neat.

14:25 cemerick: pandeiro: or force the resolution of the var at read-time with syntax-quote

14:27 pandeiro: cemerick: gotcha, but view-server-fns really isn't nec for my case i'm thinking

14:27 i do love how easily you can write :cljs views

14:27 cemerick: pandeiro: sure, if you're comfortable with the expected layout of view docs, then have at it with update-document

14:27 pandeiro: but the compilation time is killing me every time i restart the server while i am developing

14:28 cemerick: thanks, sorry to bother

14:28 cemerick: no bother :-)

14:28 I think there's an issue for that; the cljs (or other language) source could be stored in the view doc, and only recompiled when it changes

14:29 SegFaultAX|work2: Anyone else having trouble submitting solutions on 4clojure?

14:32 amalloy: argh, what do i need to put in my project.clj to get snapshots of clojure contrib projects? i've added :repositories [["sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/&quot;]], and have a dependency on [org.clojure/data.priority-map "0.0.2-SNAPSHOT"], and if i navigate to that URL in my browser i see that version; but leiningen seems to only be checking the default repos

14:44 whitaker: Anyone here familiar with issues using noir.util.test to drive noir-async related tests?

14:45 Background...

14:46 Relevant lein deps: [noir-async "1.1.0-beta9"] and [aleph "0.3.0-beta2"]

14:46 :use'ing noir.util.test

14:47 (and midje.sweet, though errors are the same with noir.test/deftest versions, I checked)

14:47 juhu_chapa: Hi all! Why the following expr returns false: (case "A" Class/staticValueEqualsToA true false)

14:47 whitaker: Example:

14:47 hiredman: ,(doc case)

14:47 whitaker: (facts "about 'GET /server-name'"

14:47 (:status (send-request "/server-name")) => 200)

14:47 clojurebot: "([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can foll...

14:48 whitaker: In core:

14:48 (na/defpage-async [:get "/server-name"] [] conn

14:48 (na/async-push conn (str server-name "\n")))

14:48 Works fine in the browser and on the command line

14:48 But:

14:49 java.lang.IllegalArgumentException: No implementation of method: :subscribe of protocol: #'lamina.core.result/IResult found for class: nil

14:49 I have RTFM'd for days on this issue

14:49 The 'na', by the way: required [noir-async.core :as na]

14:50 hiredman: whitaker: most likely noir's automatic code reloading is breaking lamina's protocols

14:50 whitaker: Ah

14:50 Hmm

14:51 Any suggested workaround? Lemme break out my -main, one sec...

14:51 hiredman: whitaker: please don't

14:51 whitaker: ok

14:51 ?

14:52 hiredman: whitaker: I'd suggest not using noir, but generally by the time I do that people have there code so entangled in noir they resist the idea

14:52 whitaker: I'm not emotionally tied to it

14:52 Moses: Just curious, what's wrong with noir?

14:52 hiredman: don't use noir, and don't use automatic code reloading

14:52 whitaker: I'm open to suggestions

14:53 hiredman: what do you prefer?

14:53 And is there a flag I can pass to disable auto code reloading?

14:53 hiredman: Moses: it is stateful and doesn't compose, is full of all kinds of (add-whatever calls) that need to happen in a certain order etc

14:53 I use ring and compojure

14:53 Moses: Ah, thanks.

14:54 technomancy: compojure's route definitions are a lot nicer

14:54 it's easy to see everything in one place, but also easy to follow things if you do need to spread them out

14:54 whitaker: In the last day, I've gotten the sense that noir isn't as… clean as its promoters might claim it to be.

14:54 hiredman: I haven't written anything with noir, but the few places I've seen it used the project would have been better served with ring+compojure

14:56 whitaker: I'm certainly at wits' end, and am perfectly willing to rip out all the noir code and try that approach.

14:56 * jkkramer also endorses ring+compojure

14:57 whitaker: Problem for me is this, though: I need to be able to do websockets.

14:57 technomancy: part of the problem is that protocols don't play well with reloading, but at least if you're invoking the reloading manually it's a lot easier to do damage control.

14:57 whitaker: I found noir-async, and was trying to make it work, defining defpage-async where necessary and defaulting to defpage elsewhere.

14:58 Apage43: aleph has websocket built in, no?

14:58 whitaker: yes

14:58 noir-aysnc is written on top of aleph

14:59 s/noir-aysnc/noir-async

15:00 Moses: What tech stack do you guys use for compojure sites? Just compojure and ring, do you use a templating language? Is there anything else that's generally in your web development toolkit when using compojure?

15:00 Apage43: whitaker: you can use aleph with compjure directly with wrap-ring-handler/wrap-aleph-handler http://ztellman.github.com/aleph/aleph.http-api.html#aleph.http/wrap-aleph-handler

15:00 as long as you wrap in both places it should work asyncly

15:01 Raynes: Moses: Compojure is just the routing portion of things. It is very specific and you definitely need other stuff to build a complex website.

15:01 whitaker: Apage43: much obliged, thanks

15:01 technomancy: Moses: I've taken to always pulling in environ and drawbridge as a matter of course. for templating you'll need to pick between hiccup and enlive based on how much tolerance for cleverness you have and the skillset of the people who'll be needing to write templates.

15:01 weavejester: Moses: I use Ring/Compojure/Hiccup with Environ for handling the config and Lein-Ring for running/testing.

15:02 Raynes: Moses: There is Hiccup, Enlive, and Stencil (mustache) for templating.

15:02 weavejester: I've also been working on Ragtime for migrations, and it's about ready for use.

15:02 Raynes: technomancy: Eh, if Hiccup or Enlive were my only options for templating I'd probably write websites in Haskell.

15:02 weavejester: Ouch! :)

15:02 kingtim: kingtim, D#scu3v3

15:02 Moses: Thank you all very much, I've been using Noir, but I recognize many of your names, and would prefer to just copy what you're all using, again, thanks very much.

15:02 Raynes: weavejester: Not that there is anything wrong with Hiccup!

15:03 SrPx: Is it possible to make macros so #(1% etc) can feature nested functions?

15:03 weavejester: Haha :)

15:03 technomancy: Hiccup is a joy for me to use but a bitter pill to swallow if you have non-clojurists working on a project.

15:03 Raynes: technomancy: Hiccup just got messy for me with larger projects, and it got harder for things to grow.

15:03 technomancy: I want to like Enlive, but I get lost working with it so easily =(

15:04 TimMc: Just needs a different API, I think.

15:04 technomancy: likely

15:04 whitaker: As for my own application, I have no need for templating: I'm doing a very thin, very simple JSON/plaintext RESTful interface for network device status polling.

15:04 Raynes: I still use hiccup for tryclj, though people have sought to change that (TimMc), but I have persevered.

15:04 dnolen_: whitaker: I looked around at the source - noir doesn't seem to expose a simple way to turn off reloading without disabling :dev. That said, seems like a simple patch.

15:04 technomancy: that's kind of indicative of the problems with noir in general

15:04 TimMc: I want to carve out some time to write relying code against that non-existent better Enlive API.

15:05 technomancy: orthogonal things aren't exposed orthogonally; everything's bundled together

15:05 dnolen_: technomancy: it's complected for sure. But decomplecting is often an incremental affair.

15:05 whitaker: dnolen_: thanks. And to technomancy's point, it might not be worth the bother to fork/pull request a fix.

15:06 dnolen_: whitaker: sure, which I'm sure you'll figure out soon enough ;)

15:06 Urthwhyte: While you guys are on the topic of web dev stuff, could you suggest a sinatra-esque clojure framework?

15:06 Raynes: technomancy, dnolen_: If you decomplect Noir you get Compojure.

15:06 technomancy: actually my other complaints I were thinking of were with korma now that I think about it

15:06 Raynes: I recently came to that realization.

15:06 Urthwhyte: I'm a Python/Ruby guy who learned Scheme as his first language and is trying to get back into lisp

15:06 whitaker: dnolen_: heh… "complected"… I just yesterday listed to Rich Hickey's talk wherein he (re)introduces that archaicism into the language

15:06 dnolen_: Raynes: having things decomplected doesn't mean sugar ain't good.

15:06 Raynes: dnolen_: But there isn't really any sugar there.

15:07 It's just a slightly different syntax for routes with mutability tying them together instead of an outer defroutes.

15:07 And because of that, a whole host of issues with doing interesting things with middleware and such.

15:08 dnolen_: Raynes: noir *is* sugar over compojure+ring - a few more knobs would be nice. in anycase I don't really have that strong of an opinion about it. people seem happy w/ noir since you don't have to go sniffing around in the source quite as much.

15:08 SegFaultAX|work2: amalloy: I'm sorry. I just had to hammer the API endpoint for 4clojure for about 30 seconds.

15:08 whitaker: Urthwhyte: similar career arc myself. Read SICP years ago, couldn't use it vocationally, did the usual C/Perl/C++/Java/Python/Ruby/Rails thing for years, recently found Clojure, now working with it. At work. Yay me.

15:09 Raynes: SegFaultAX|work2: You reduced amalloy's health bar to half!

15:09 Urthwhyte: work for me right now is Java :/

15:09 SegFaultAX|work2: Raynes: :D

15:09 Urthwhyte: well, internship

15:09 Raynes: amalloy: Quick, quaff a health potion!

15:09 SegFaultAX|work2: Raynes: I was making this: https://gist.github.com/3607101

15:09 Urthwhyte: so much boilerplate :(

15:09 SegFaultAX|work2: Raynes: All my solutions. Need to collect the title and difficulty for each problem I've solved.

15:10 amalloy: SegFaultAX|work2: why would i care? hammer away; i don't think a single computer can generate enough traffic to do much damage

15:10 Raynes: SegFaultAX|work2: You should make a little website for extracting solutions like that for other people.

15:10 I'm sure people would find it useful.

15:10 SegFaultAX|work2: Raynes: I talked to amally about extending the API to allow fetching of solutions.

15:10 Raynes: amalloy: I think people get wrong ideas about the fragility of our infrastructure because of how 4clojure goes down all the time.

15:10 SegFaultAX|work2: Raynes: To do this I had to ask for a dump right from mongo.

15:10 ivaraasen: whitaker: somewhat similar situation here. I study petroleum engineering. lots of Matlab and Java spaghetti code.

15:11 pandeiro: i am a newb compared to all of you but i think the answer to the noir issue are more specialized compojure templates for general webapp categories

15:11 that is what i myself have resorted to

15:11 Urthwhyte: I've been tempted to write a book wrapped around 4clojure

15:11 amalloy: well yes, i suppose that's a fair assumption for them to make. because our infrastructure is rubbish

15:11 Raynes: pandeiro: That's basically my idea.

15:11 technomancy: pandeiro: yeah, I wrote a template for heroku compojure apps that adds stacktrace middleware, environ, and drawbridge

15:11 Raynes: amalloy: Well, not really. We can handle a huge load (lol), it just goes down because we allow code eval in a shitty sandbox.

15:11 pandeiro: kind of like compojure already has 'api' and 'site'... a few more middleware bundles and lein templates for slightly more specialized use cases and voila

15:12 technomancy: pandeiro: the great thing about templates is that they expose the composition of orthogonal components in really visible ways

15:12 SrPx: Wow is it me or this channel is way more active than when I first came in?

15:12 SegFaultAX|work2: SrPx: That depends on what you first came in I think.

15:12 whitaker: ivaraasen: Matlab… ugh. Of course, I'm having to use Octave for Andrew Ng's Machine Learning course, so I'm having to deal with it again (I'd thought I'd left Matlab when I left academia)

15:12 SrPx: 4 months ago SegFaultAX|work2

15:12 amalloy: right. so we do a lot of things well, and a few things terribly that brings the whole site down. sounds like a rubbish infrastructure to me!

15:12 Urthwhyte: whitaker, ivaraasen: It's better than sage ;)

15:12 hiredman: win 15

15:13 SegFaultAX|work2: amalloy: Did you see the output of the dump you gave me?

15:13 amalloy: yeah, it's pretty

15:13 i command you! add an API endpoint to expose user solutions!

15:13 SegFaultAX|work2: I feel ashamed, though. I did it in Python.

15:13 I don't know the json, HTTP, and file IO APIs yet.

15:14 SrPx: Anyway, nobody answered. Can I somehow use macros or something to make this kind of syntax: ((#(a? b?') {a:1 b:2}) {a:3 b:4}), output: (1 3) .

15:14 amalloy: cheshire, slurp, and clojure.java.io, respectively, probably solve your problems

15:15 SegFaultAX|work2: amalloy: Yea, I'm just not quite there yet.

15:15 amalloy: My additions to 4clojure API might be my first actually beneficial addition in Clojure :)

15:15 Scrum time, bbl.

15:16 amalloy: SrPx: the code you pasted makes no sense at all. i can't figure out what meanings you would assign to get the output you expect

15:16 shaungilchrist: SrPx: it sounds like you want type based "apply"

15:17 ivaraasen: whitaker: granted, gradient descent and all that is somewhat of a pretty thing in Matlab. but my professors tend to obfuscate even the simplest of code anyway

15:17 whitaker: Huh… dammit, looks like I'd been wasting my time fighting with noir-async, when I could have used this approach: https://gist.github.com/656227

15:19 ivaraasen: Octave's support for gradient descent (i.e. gradient ascent for minimization, sign-flipped ;-)) is pretty sweet. I was thinking of finding its Clojure/Incanter equivalent and playing with it.

15:20 lnostdal: hi guys, this pops up from time to time, but perhaps things have changed now (a new library or something new in git?) .. but is it possible to do inheritance the "old way" in clojure somehow?

15:21 TimMc: inheritance?

15:21 clojurebot: multiple inheritance is http://www.piratejesus.com/nerdcore/nerdcore017.gif

15:21 whitaker: Someone mentioned a few weeks ago at a San Francisco Clojure Meetup I attended that he'd "done Ng's machine learning course in Clojure"; I've been meaning to track him down and ask about it

15:21 TimMc: not helpful, clojurebot

15:21 SrPx: amalloy: #(a% b%') would mean a function that receives a hash, gets the 'a' value on that hash (Ill call it x), and returns a function that receives another hash, gets the 'b' element of that hash (Ill call it y), and returns (x y). Or, in JavaScript (I dont know Clojure well enough to write that): (function(x){ return function(y){ return [x.a,y.b]; }})({a:1,b:2})({a:3,b:4});

15:21 dnolen_: lnostdal: not really. wouldn't be hard to construct something from scratch if you really want it. otherwise just use delegation.

15:21 weavejester: The drawbridge example could probably be more concisely expressed with the context macro

15:21 SrPx: amalloy: or, in other words, a short syntax for lambdas which allows nested functions

15:22 ivaraasen: whitaker: just found a small implementation of SGD in Clojure myself

15:22 lnostdal: ok, thanks

15:22 weavejester: e.g. (context "/repl" [] (cemerick.drawbridge/ring-handler))

15:22 whitaker: ivarassen: in the Incanter libs?

15:22 ivaraasen: whitaker: no, it's this small repo on github

15:23 whitaker: url pls?

15:23 dnolen_: lnostdal: I'm surprised no one's done a Tiny / Medium CLOS, seems like everything you would need to build it is there - and it could probably even be really fast.

15:25 lnostdal: dnolen_: hm, yeah .. just single dispatch would at least (jvm limitation i think)

15:26 but even that would be good enough for many cases ..

15:28 whitaker: OK, for those who care, it was Terje Norderhaug, the maintainer of MCLIDE, who'd mentioned at http://www.meetup.com/The-Bay-Area-Clojure-User-Group/events/47874302/ that he'd done Ng's ML course "in Clojure"; not sure what that means in respect of auto grading code & such (only starting the 3rd week of the course today)

15:28 ro_st: is there a way to have ring force no-cache on all the stuff it serves?

15:29 weavejester: ro_st: Add some middleware to add a no-cache Cache-Control header?

15:29 ro_st: simple as that?

15:29 will that work for static resources, too? i'm using noir

15:31 Urthwhyte: if your static resources are being served through ring there's no reason it wouldn't

15:35 pandeiro: weavejester: where is the drawbridge example you were referring to?

15:36 weavejester: pandeiro: Oh, on it's README. When I Github-searched, I got technomancy's repo first, so I mistook who was maintaining it.

15:36 pandeiro: Github search could be better :/

15:37 ro_st: this should do it, right? https://www.refheap.com/paste/4872

15:38 pandeiro: weavejester: np, found it; re: github i do like the repo filter box on individual users' pages tho

15:40 ro_st: that middleware breaks static stuff

15:41 cemerick: weavejester: I would have used context, but I didn't want to require compojure.

15:42 weavejester: cemerick: I just meant on the example in the README, not in the library

15:42 cemerick: Sure. s/require/presume, then

15:42 pandeiro: weavejester: i am putting together an api with (context "/api" [] api/endpoints) and now i want to break the api into a few categories (different namespaces) - can i do that composably?

15:43 ro_st: pandeiro: what does multiple (context "/" …) do?

15:44 if that allows all of them to operate, perhaps api/endpoints could do this internall

15:44 y

15:44 pandeiro: ro_st: i am still clunky with ring handlers at the rEPL, gonna try to see that though

15:45 ro_st: in api, (defroutes endpoints (context "/" (composed1/endpoints)) (context "/" (composed2/endpoints))

15:46 i'm also a compojure noob so that could blow up

15:46 weavejester: context tables a set of bindings

15:46 tables=takes

15:46 pandeiro: ro_st: i'm wondering if i can just do (context "/api" [] auth/endpoints user/endpoints document/endpoints) or similar

15:46 weavejester: And there's no point in doing (context "/" …) :)

15:47 pandeiro: That's valid, if all the endpoints are handlers

15:47 pandeiro: right i understood context is just to avoid having to retype an internal part of the path

15:47 ro_st: how would pandeiro compose multiple defroutes into a single context, weavejester?

15:47 ah

15:47 weavejester: Right

15:47 pandeiro: weavejester: all the endpoints are defroites

15:47 SrPx: As nobody answered: can I use macros to somehow enable a syntax like this: (%a %b') . That would be an anonymous function that receives an object, gets object.a, then returns a function that receives another object, gets object.b and returns.

15:47 pandeiro: defroutes

15:47 ro_st: super!

15:48 weavejester: ro_st: It's routes all the way down. defroutes (or routes) just combines multiple routes into one.

15:48 * ro_st throws 'monad' over the wall to SrPx

15:48 ro_st: neat

15:48 pandeiro: it is a pleasure learning compojure

15:48 SrPx: ro_st: ? ;s

15:49 ro_st: weavejester: using noir, why would https://www.refheap.com/paste/4872 cause all my static files to 404 instead?

15:49 forgive my laziness in asking you this. been a long day :-(

15:49 amalloy: SrPx: that syntax is not possible, and as an uninvited editorial it sounds like an awful thing to have if it were possible

15:49 cemerick: SrPx: No.

15:50 SrPx: amalloy: why?

15:50 shaungilchrist: it does not really make sense why %a would refer to one application and %b to the next

15:51 or is that what the single quote after b is meant to denote?

15:51 weavejester: ro_st: I can't see anything wrong with that middleware. Could it be something else? Perhaps where you apply it?

15:51 amalloy: it's an absurdly over-specialized syntax for a very rare thing to want to do

15:51 SrPx: shaungilchrist: %b would refer to the next because of the '. It could be anything else

15:51 shaungilchrist: yes

15:51 weavejester: ,(assoc-in nil [:headers "Foo"] "Bar")

15:51 clojurebot: {:headers {"Foo" "Bar"}}

15:51 SrPx: (%a %b'' %c') would get a, then c, then b, of hashes, in order of application

15:51 weavejester: ro_st: If (handler request) returns nil, then the assoc-in would change it into a map.

15:52 SrPx: So bad it is not possible }:

15:52 but oaky

15:52 shaungilchrist: well such a thing could be done but with a normal macro e.g. (craziness [:a :b']) etc.

15:52 SrPx: thanks

15:52 ro_st: ah, that's good to know

15:53 amalloy: entertainingly, ro_st, monads don't have anything to do with SrPx's problem, but a maybe monad would have avoided yours

15:54 ro_st: ok i'm doing something basically wrong. the headers i'm adding aren't the issue

15:54 amalloy: -grin- i just read about monads in Marick's fp-oo book. i'm an utter noob at this stuff. makes my brain fizz. love learning about it

15:54 SrPx: shaungilchrist: sorry, I dont understand this? Im pretty much asking if macros could be used to transform something like (make-my-fun (%a %b')) into (I guess, not sure if this is right): (fn [o1] (fn [o2] [o1.a o1.b]))

15:55 dnolen_: SrPx: it's possible

15:56 shaungilchrist: SrPx: yes it could but in your example you just had (#(%a %b') ...) and (without hackery) that is not something you can control via macro (symbols in an anon func)

15:57 SrPx: shaungilchrist: yes. I was not sure people were saying it was not possible because of the syntax or because macros couldnt do the job

15:57 (the problem is that my syntax was conflicting with clojures, right?)

15:58 dnolen_: SrPx: you can't override the meaningof #. and yes the macro can take whatever follows unevaluated, so you can embed whatever language you want.

15:58 shaungilchrist: yes, you just need to examine the symbols

16:00 ro_st: hey dnolen_! how's the source map quest going?

16:01 ah. some middleware running after my own is seeing a blank response and then doing a filesystem search. and since i'm writing headers, the response isn't blank, and it doesn't look on disk any more

16:02 Raynes! help! :-)

16:02 SrPx: dnolen_: Nice!

16:02 Just another question

16:03 dnolen_: ro_st: OK, can decode the GClosure source map, I have rough plan for how to emit source map info from the compiler. Next step writing some source map generating code.

16:03 SrPx: Is it possible to make a 'macro' or something that will affect everything in a clojure program? For example, could I somehow make a rule that would change every string ever created with the a format like '15...190' into (range 15 190)? Or a macro that would change any hash containing this keyval pair: a:1 into something else?

16:03 ro_st: you mean from cljs compiler

16:03 dnolen_: ro_st: after that it'll be figuring what the best way to merge that info is.

16:04 SrPx: no

16:04 ro_st: SrPx: that's the clojure reader's job. rhickey has the keys to that.

16:04 shaungilchrist: SrPx: "yes" but with the caveat that it would in fact be a preparser step

16:05 so you'd be creating .clsrpx files

16:05 ro_st: github.com/lynaghk/cljx for a fun example of that

16:05 kenneth: hey what happens if a thread throws an exception

16:06 ro_st: you wanna narrow that question down some, kenneth? some folks might get wordy on you

16:06 -grin-

16:07 solussd: Does anyone have any idea what this means? (clojurescript is throwing it: uncaught exception: No dispatch macro for m

16:07 hiredman: you have #m somewhere

16:07 ,#m

16:07 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

16:07 hiredman: clojurebot: jerk

16:07 clojurebot: you cut me deep, man.

16:08 hiredman: ,#m foo

16:08 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag m>

16:08 abalone: ~loop

16:08 clojurebot: LOOP is complect complected

16:08 solussd: oh geez.

16:09 abalone: if i want to poll for a condition, is there something i should use instead of loop?

16:09 TimMc: abalone: Have you looked at while?

16:09 amalloy: hiredman, solussd: he has #m, but is probably using a version of clojure before 1.4, where i think the error message for #m f changed

16:09 kenneth: alright, say i'm launching a thread using (.start (Thread. …)) and i'm catching exceptions inside the main thread but i don't have any try/catches inside the launched thread

16:09 hiredman: amalloy: he is using clojurescript

16:09 solussd: hiredman: afaict i do not… :/ hmm… I'll keep looking I guess

16:09 kenneth: will the main thread catch them, will they crash the program, crash just the thread?

16:09 TimMc: ,# m foo

16:09 hiredman: solussd: don't worry, you do, you'll find it

16:09 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag m>

16:10 amalloy: $google java thread uncaughtexceptionhandler

16:10 lazybot: [Thread.UncaughtExceptionHandler (Java 2 Platform SE 5.0)] http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.UncaughtExceptionHandler.html

16:10 TimMc: solussd: Look for /#\s+m/

16:10 you probably have whitespace between the two

16:10 amalloy: TimMc: no good; it's probably being generated by some code somewhere, and he's barfing when he reads it

16:11 solussd: oh, space after the #, got it..

16:11 kenneth: oh, also, is there a way to pretty-print an exception from the object

16:11 solussd: second the "must be generated"..

16:12 SrPx: shaungilchrist: but wait. with that you mean it would not be a dynamic behaviour, right?

16:13 shaungilchrist: I could not expect to implement a rule that would update every hash containing x > 10 into x = 10 and hope it would work if some hash happened to have x > 10 mid execution, right? This would just be impossible in clojure? (and I guess any language)

16:13 solussd: ,#m blah

16:13 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag m>

16:13 solussd: ,# m ldsfkj

16:13 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag m>

16:13 abalone: TimMc: is there something like while which lets me refer to the result of the test?

16:13 SrPx: ro_st: reading about that brb

16:13 solussd: yeah, that was it-- "serialized" record being fed to clojurescript

16:14 or, printed record, rather

16:14 abalone: TimMc: that is, while polling and not getting the desired value, i'd like to report what the current offending value is and when i use 'while' instead of loop i lose the value

16:16 whitaker: dnolen_ technomancy & others: thanks for help earlier, looks like ring + compojure works fine for me.

16:19 TimMc: abalone: loop is probably better, then.

16:19 Make a let-while or something.

16:19 *while-let

16:20 amalloy: abalone: what condition are you polling?

16:30 bergelmir: is there something special i need to do to install :dev-dependencies?

16:31 i have "lein-conjure" in :dev-dependencies but it won't be installed by "lein deps"

16:31 clojurebot: lein deps is the equivalent of taking the cartridge out and blowing on it

16:31 technomancy: bergelmir: :dev-dependencies are deprecated; they're only used in lein 1.x

16:31 conjure, huh? is that still around?

16:32 TimMc: technomancy: Oho, "deprecated". Is lein 2.x released?

16:32 technomancy: TimMc: it's released enough.

16:32 TimMc: heh

16:32 bergelmir: i have lein 2.0.0-p7 installed

16:32 technomancy: bergelmir: yeah, whatever docs told you to put something in :dev-dependencies must be pretty old

16:33 are you just getting started with clojure?

16:33 bergelmir: yep :)

16:33 technomancy: conjure might not be the best bet for that; it's pretty obscure

16:33 I recommend reading up on compojure and ring

16:34 clojurebot: google brehaut ring compojure

16:34 clojurebot: First, out of 19 results is:

16:34 A Lazy Sequence: A Brief Overview of the Clojure Web Stack - Brehaut

16:34 http://brehaut.net/blog/2011/ring_introduction

16:34 technomancy: ^ good place to start

16:34 rbxbx: technomancy I know peeps were just talking about how noir is a mixed bag with too much coupling, but I think noir is a nice place to get your feet wet...

16:34 amalloy: technomancy: ughhh, $google doesn't waste nearly as many newlines

16:34 technomancy: amalloy: heh; noted for next time =)

16:35 uvtc: I see Conjure listed at the Clojure Toolbox along with some others.

16:36 technomancy: uvtc: see, in my eyes that's an indictment of the manually-curated approach as a whole =)

16:36 compare http://clojuresphere.herokuapp.com/conjure/conjure vs http://clojuresphere.herokuapp.com/compojure/compojure

16:36 uvtc: technomancy: I think manually curated works when the community as a whole is doing the curating. Getting people involved is another problem though.

16:38 technomancy: uvtc: agreed

16:38 it's possible if everyone's on board; it's just incredibly difficult to get there

16:39 jkkramer: technomancy: FYI there's clojuresphere.com now. do you know if there's a way to redirect *.herokuapp.com?

16:39 bergelmir: okay, will have a look at compojure and ring and thanks for the link ;)

16:39 cemerick: curation vs. bubbling are good at different things, of course

16:40 uvtc: cemerick: By "bubbling" do you mean the clojuresphere approach?

16:40 cemerick: yes

16:40 maybe "statistical methods" is a better term

16:41 technomancy: jkkramer: off the top of my head I'd do it in a middleware; not sure if there's a platform-level feature for that

16:41 amalloy: jkkramer: is clojuresphere.com pointing to the heroku IP, or is it a different server?

16:41 technomancy: I'll look into it

16:41 because I really should know this =)

16:42 jkkramer: amalloy: pointing to heroku

16:42 technomancy: amalloy: CNAME usually

16:42 SegFaultAX|work2: ClojureSphere is pretty neat.

16:42 amalloy: jkkramer: 4clojure has a middleware for redirecting 4clojure.org to www.4clojure.com, if you're looking for something to steal

16:42 jkkramer: I figured it could be done in-app…wasn't sure if heroku had another way

16:43 technomancy: jkkramer: at least with SSL redirects they're done in userland

16:43 jkkramer: amalloy: I will do that. I already stole your gzip middleware fork

16:44 amalloy: start with https://github.com/4clojure/4clojure/blob/develop/src/foreclojure/ring.clj#L57 but it's kinda messy as it is now; if you happen to clean it up while you're in there i'd be happy to take a pull request

16:45 jkkramer: amalloy: k will see, thanks

16:49 SegFaultAX|work2: amalloy: Did you know that /datatable/users 500's on 4clojure?

16:50 abalone: amalloy: i'm polling the state of a windows service using sc.exe

16:50 SegFaultAX|work2: I'm assuming that's the end-point that drives the user listing. Should it return some default page?

16:52 amalloy: passing it no arguments is an error

16:52 if you want to know how to use that page you'll have to read up on the datatables server-side processing language/protocol/whatever

16:52 SegFaultAX|work2: amalloy: I'm working my way through the source now.

16:52 bergelmir: https://github.com/weavejester/compojure/wiki/Getting-Started --> lein compojure new hello-world --> "compojure is not a task"

16:53 weavejester: bergelmir: Are you using Lein 2?

16:53 bergelmir: weavejester: Leiningen 2.0.0-preview7 on Java 1.7.0_05 Java HotSpot(TM) 64-Bit Server VM

16:53 weavejester: bergelmir: Oh, you've just got the "new" and "compojure" the wrong way round

16:54 bergelmir: lein new compojure hello-world

16:54 bergelmir: hmpf :)

16:57 why aren't there any packages available at repo1.maven.org/maven2? lein is always trying to get the packages from that repo but there aren't any packages...

16:57 uvtc: bergelmir: lein always checks there first, before clojars.

16:58 bergelmir: uvtc: yeah but i am always getting "could not find artifact ..." for that repo. why don't they change the order?

16:59 xeqi: because maven central was around first, and is the canonical place to looks for jars

17:00 technomancy: there's an open issue for decreasing the verbosity

17:00 bergelmir: localhost:3000 --> Hello World

17:00 technomancy: you're just seeing the behaviour of the underlying libraries that we haven't figured out how to change yet

17:00 bergelmir: yay :)

17:01 xeqi: * spent time to

17:05 uvtc: Maybe if the successful clojars download messages were colored green in my terminal I wouldn't mind seeing all those "could not find at maven repo!" messages. :)

17:06 amalloy: uvtc: just switch your whole terminal to green on black. then everything looks successful! very soothing

17:07 technomancy: preferably with the glastty font

17:08 amalloy: what is it you like about glasstty?

17:09 uvtc: technomancy: I read that as "ghastly" font.

17:09 amalloy: does it just remind you of ye good olde days? it looks terribly illegible to me, but i'm willing to accept that maybe that's my fault for not seeing well

17:09 tanzoniteblack: uvtc: you might as well have read that correctly :)

17:09 technomancy: amalloy: here's the problem; computers are too small. you can't go running around the console's blinkenlights making things happen like when the doctor is flying the tardis. so you need alternate methods to add a theatrical flair.

17:10 uvtc: Well, anyway, when a terminal-based program gives me colored output, color me pleasantly surprised.

17:11 scriptor: technomancy: so…movieOS?

17:11 amalloy: uvtc: always withold your pleasant surprise until you check whether it produces reasonable output when you redirect it to a file as well

17:11 technomancy: scriptor: yes, precisely.

17:11 amalloy: (or to a pipe, or whatever). if it inserts ansi control characters even when it's not going to a terminal, murder the author

17:12 uvtc: amalloy: yup, it certainly should be careful to check if it's being used interactively.

17:24 unlink: I'm often tempted to do something like (update-in some-map [just-one-key] a-fn) just so that I don't have to name the map again (as I would with assoc). Is there a version of update-in that just takes one key?

17:27 amalloy: no

17:30 unlink: what's the idiomatic way of doing this, then: (let [... headers (update-in (:headers response) ["content-length"] #(Integer/parseInt %)) ...] ...)

17:32 gfredericks: I think that's it :(

17:32 I end up defining my own update function half the time

17:32 if I do that more than once in a file

17:32 jeremyheiler: &(update-in {:a {"b" 1}} [:a "b"] inc)

17:32 lazybot: ⇒ {:a {"b" 2}}

17:33 unlink: It's very tempting to use ->, because then I wouldn't need to wrap Integer/parseInt in an anonymous function.

17:33 gfredericks: how would you do it with ->?

17:33 jeremyheiler: Integer/parseInt isn't a function, so you still need to wrap it.

17:35 hyPiRion: ,(update-in {"content-length" "1000"} ["content-length"] read-string)

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

17:35 hyPiRion: ,(update-in {"content-length" "1000"} ["content-length"] read-string)

17:35 clojurebot: {"content-length" 1000}

17:36 hyPiRion: But I'd go for #(Integer/parseInt %) if I were you.

17:36 unlink: (let [... headers (assoc (:headers response) "content-length" (-> response :headers (get "content-length") (Integer/parseInt))) ...] ...)

17:37 amalloy: unlink: baaaarrrrf. use update-in for sure

17:37 unlink: right, naming response twice is not nice.

17:37 gfredericks: not to mention "content-length"

17:37 unlink: I have a slight allergic reaction to anonymous functions, though.

17:37 gfredericks: use read-string then

17:38 unlink: read-string is worse, though, because then I need to ensure *read-eval* is bound to false.

17:38 hyPiRion: unlink: Well, you could do (defn read-int [string] (Integer/parseInt string))

17:38 then it's not anonymous anymore.

17:38 gfredericks: dammit when can we get rid of read-eval

17:38 it's scaring everybody off

17:39 unlink: heh, that's true, but I think #(Integer/parseInt %) is more idiomatic.

17:39 (with (-> ... (Integer/parseInt)) being the most idiomatic of all, when it's possible)

17:39 (that is to say, not here.)

17:40 hyPiRion: Well, it's more or less idiomatic because of java interop. You'd generally prefer some Clojure variant if that existed.

17:40 amalloy: gfredericks: i wouldn't be astonished to see it gone in, say, clojure 1.6

17:40 gfredericks: amalloy: at the very least defaulted to false

17:40 amalloy: meh. defaulted to false isn't useful at all. nobody will ever turn it on

17:41 hyPiRion: Stuff will break regardless, won't it?

17:41 technomancy: wouldn't be the first time stuff was intentionally broken in a minor release

17:42 though to be fair, breaking undocumented behaviour is less of a problem

17:43 hyPiRion: ,(doc *read-eval*)

17:43 clojurebot: "; When set to logical false, the EvalReader (#=(...)) is disabled in the read/load in the thread-local binding. Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) Defaults to true"

17:44 gtrak: weavejester: re lein-ring issue 45, I'm willing to fix it if you think it's a good idea, otherwise I'll use my hand-rolled stuff

17:44 weavejester: gtrak: I managed to miss that one. Let me take a look.

17:45 gtrak: I just put it in a second ago

17:46 weavejester: gtrak: That would explain it :)

17:46 gtrak: I kinda just assumed that would work

17:46 it didn't :-)

17:48 weavejester: gtrak: Let me think about it. It could be implemented in ring-server in a ring.server.webxml namespace… or perhaps ring.server.legacy :)

17:48 gtrak: What custom stuff do you have in web.xml?

17:49 In general I like to steer people away from Java web dev when possible :)

17:49 gtrak: we need it right now for jetty's CrossOriginFilter, I tried to use ring-cors and it wasn't apparent why it didn't work, but I'd just like to have the option to use servlet stuff when necessary.

17:52 for instance, previously I had a whole 'nother servlet app embedded into the clojure app, but I got rid of that when my coworkers decided I should just reimplement it in clojure

17:53 meanwhile, having the option in the first place let our UI guy get started immediately instead of having to wait

17:55 weavejester: I think it's reasonable to have as a last resort… for when you really really need to stoop to using web.xml.

17:55 gtrak: yea, a .legacy ns should inform people they need to feel dirty while doing it

17:55 weavejester: Perhaps the presence of a manual web.xml would trigger it.

17:58 gtrak: yea, I can imagine a scenario where you don't want a web.xml during development either, I'd be comfortable with a flag

18:03 unlink: Using read-string when you mean Integer/parseInt is simply less robust. It's much easier to do it wrong that way.

18:03 read-string isn't going to throw a NumberFormatException on "abc123"

18:03 sorry, "abc"

18:03 Frozenlock`: js/cljs question: I'm trying to use the google datepicker, following this example: http://closure-library.googlecode.com/svn/trunk/closure/goog/demos/datepicker.html. Nothing too fancy, should be easy enough... but I was wrong! I expected this to at least show me the datepicker: (.render (goog.ui.DatePicker.) (domina/by-id "date")). Yet I get this error: #<TypeError: object is not a function>. Did I call js in a bad way?

18:04 hiredman: Frozenlock`: are you sure you didn't forget the . in thr constructor?

18:04 (goog.ui.DatePicker) vs. (goog.ui.DatePicker.)

18:05 Frozenlock`: Yes, I pasted exactly what I typed in my REPL.

18:06 S11001001: unlink: I've had a prod bug due to using Integer/parseInt instead of read-string, where read-string was the fix.

18:07 auser: hola

18:08 unlink: S11001001: You probably didn't mean Integer/parseInt, then.

18:08 S11001001: unlink: I meant parse an integer

18:09 unlink: How was parseInt failing

18:09 S11001001: unlink: overflow

18:11 Raynes: &(Long. "123424354524657567457665")

18:11 lazybot: java.lang.NumberFormatException: For input string: "123424354524657567457665"

18:11 Raynes: Heh

18:11 gtrak: tooo long

18:11 long is shorter

18:25 Frozenlock`: Ok now I'm really confused. (def dp (goog.ui.DatePicker.)), (.render (goog.ui.DatePicker.) (domina/by-id "date")) --> #<TypeError: object is not a function> Ok, no surprise here. However, if I do it again: (.render (goog.ui.DatePicker.) (domina/by-id "date")) --> #<TypeError: object is not a function> AAAAND the goog-date-picker div is added in my DOM.

18:26 So I get an error buuuuut the object is added. o_O

18:26 I still don't see any in the browser, but in the dom explorer it's there.

18:33 nDuff: Frozenlock: Have you looked at the generated javascript (and the stack trace it throws) to figure out exactly where the error is?

18:33 Frozenlock: ...generally speaking, that's where I've tended to start (without advanced-mode compilation, of course) when successfully debugging cljs.

18:36 Frozenlock`: Yes, but I don't see anything enlightening (keep in mind that I have but a very basic understanding of js)

18:37 https://www.refheap.com/paste/4875

18:37 (first 3 lines)

18:37 nDuff: That's not very helpful without having the generated javascript next to it.

18:39 Frozenlock`: er... How do I get the generated javascript from the repl?

18:40 nDuff: Use a browser that shows it to you in the debugger? :)

18:40 Chrome does that out-of-the-box.

18:41 (once you know where the break-on-exception button is, anyhow)

18:42 Frozenlock`: I'm sure I can find that, please don't go away :p

18:51 oh wow, that was long

18:54 https://www.refheap.com/paste/4876#L-10

18:54 mdeboard: Anyone here have overwhelmingly positive experience developing Clojure using an IDE instead of emacs/vim?

18:54 nvy: mdeboard: *which* IDE?

18:54 mdeboard: nvy: Any.

18:55 nvy: I thought emacs was an IDE

18:55 mdeboard: Nah, not IMO. Though to what degree it isn't an IDE depends on the mode I guess.

18:56 nvy: good point

18:56 technomancy: pedantically, it's hard to come up with a definition of IDE that excludes Emacs

18:57 kenneth: (let [head-match #(.equals (String. %2 0 (min (.length %2) (count %1))) %1 )]

18:57 hey so i'm defining head-match as a function to that takes two args, a string and a byte array

18:58 right now it crashes on .length, i thought that byte arrays had a length function?

18:58 hiredman: technomancy: I think you could if you said "does X well" instead of just

18:58 xeqi: &(.length (byte-array 3))

18:58 hiredman: does X"

18:58 mdeboard: zing

18:58 technomancy: oh snap

18:58 mdeboard: true though

18:58 xeqi: ,(.length (byte-array 3))

18:58 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: length for class [B>

18:58 mdeboard: It's hard to come up with a definition of "IRC client" that excludes emacs

18:59 technomancy: "An IDE is a thing that is designed to let you write Java."

18:59 mdeboard: lol

18:59 hiredman: hahah

18:59 mdeboard: ANYWAY

18:59 brehaut: technomancy: Or compile a MS language project

18:59 mdeboard: My original question was if anyone would recommend using Intellij/emacs/etc over emacs/vim for writing Clojure

19:00 er

19:00 IntelliJ/Emacs

19:00 tanzoniteblack: technomancy: so coincidentally doing that excludes it since it wasn't designed for it? Hm...similarly, does that mean that my mousepad isn't a coaster since it wasn't designed for that?

19:00 mdeboard: GOD DAMMIT

19:00 IntelliJ/eclipse

19:00 Pardon my language.

19:00 hiredman: I've explored a lot of java codebases using emacs, but written very little java in emacs

19:00 kenneth: xeqi: right, so what's up with that?

19:00 nDuff: mdeboard: Personally, I've tried the available IDEs, and my answer is a resounding "no"

19:00 mdeboard: ...that said, given the survey results, there certainly are people who disagree.

19:00 ~survey

19:00 clojurebot: survey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/

19:00 technomancy: tanzoniteblack: Emacs grudgingly allows you to write java

19:00 xeqi: it sounds like the eclipse w/ counterclockwise is the best of them

19:00 mdeboard: nDuff: Yeah but most people are very bad programmers.

19:01 xeqi: having never used any

19:01 mdeboard: I ask because I've been using MonoDevelop with a C# application we have at work and it's been pretty nice.

19:01 tanzoniteblack: mdeboard: I use Eclipse for most Java projects at work, but couldn't stand using it for Clojure

19:01 mdeboard: Also because I'm giving a "Why CLojure" talk at the local Scala meetup next week.

19:01 * nDuff uses IDEA for Java, Emacs for Clojure

19:01 mdeboard: tanzoniteblack: Why is that

19:01 nDuff: ...right tool for the right job and such.

19:03 SegFaultAX|work2: mdeboard: Are you going to subtitle it "... is better than Scala"?

19:03 tanzoniteblack: mdeboard: Only real benefit I've seen to use Eclipse is if you're working with a large code base that's not yours, then eclipse gives intelligent completion options for methods/fields. the clojure plugins didn't seem to give me that very well (or maybe I just wasn't working with a large code base...or maybe I just prefer Emacs, which is what I use for IRC, Python, org-mode, etc. etc.)

19:04 cemerick: Any from #{emacs vim eclipse} will do. Use what you're comfortable with and what you know.

19:04 nDuff: tanzoniteblack: Emacs Live does a pretty decent job of that too out-of-the-box (re: method/field completion)

19:04 tanzoniteblack: mdeboard: i.e. I might be a bit biased towards emacs anyways; especially since it's what I used for common lisp before hand

19:04 technomancy: it's a shame enclojure seems to have disappeared because it had a really great logo

19:05 tanzoniteblack: nDuff: I will go check that out now

19:05 xeqi: kenneth: hmm, I read something that the bytecode to invoke it is different, wonder if thats the issue

19:05 ,(count (byte-array 3))

19:05 clojurebot: 3

19:05 mdeboard: SegFaultAX|work2: No, I've never used Scala. It's not a either/or talk. The Scala meetup is basically a "make us smarter" meetup, you can talk about anything relevant.

19:05 xeqi: kenneth: could do something like ^, but its probably calling seq on it underneath

19:05 mdeboard: cemerick: I'll accept that as a response to my tweet at you earlier then

19:06 cemerick: mdeboard: oh, did I miss one?

19:06 Ah, right.

19:06 mdeboard: :D

19:06 cemerick: mdeboard: Not sure what you mean by 'inline REPL' though.

19:09 tanzoniteblack: nDuff: you know, I wish I knew about Overtone and emacs-live when I was working with Super Collider last year...that would've made my life a lot easier

19:10 amalloy: xeqi: it's not calling seq, it's using reflection to discover the type of the array

19:22 dnolen: kenneth: (.length foo) doesn't work on arrays. Just use count or alength.

19:42 austinh: Reporting back: it took me about 8 hours to figure out how to implement virtual hosts.

19:42 That was not fun, but it works, and I honed my interop chops a little.

19:44 seneth: whats the best IDE for clojure, I am thinking about using eclipse's plugin?

19:44 aniero: seneth: vim! :D

19:44 seneth: >_>

19:44 nDuff: emacs!

19:44 (no, really, emacs)

19:44 aniero: nDuff: thank you!

19:44 nDuff: ~survey

19:44 clojurebot: survey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/

19:44 nDuff: seneth: See the survey for numbers on what folks use re: environments

19:44 seneth: thanks

19:45 nDuff: seneth: If you don't already have a preferred emacs setup for LISP, I'd suggest looking at Emacs Live, by the Overtone folks

19:45 seneth: ...there's a nice video available showing off the features.

19:47 seneth: If what you're doing is experimenting with the language, by the way, you might have fun with Light Table, though it isn't ready for real work yet.

19:47 technomancy: use what you already know; it's hard enough learning a new language without throwing in a bunch of unrelated crap.

19:48 unless it's like textmate or something

19:48 gfredericks: the more things you are learning at the same time the harder it is to blame something when you don't know what just happened

19:50 amalloy: there's no hard evidence that there's a better way to learn to swim than being ejected from a submarine on the ocean floor

19:51 mdeboard: Kind of a weird question here but I'm looking for a venn diagram image that I swore was used in this talk http://www.infoq.com/presentations/Functional-Architecture, but I can't find it. It was labeled the "sweet spot for functional programming", and the overlapping circles were concurrency, DSL, and something else that I can't recall. Does anyone happen to know what graphic I'm referring to? I want to use it in thi

19:51 s talk.

19:51 google works, I'm an idiot.

19:52 hiredman: submarines are for poseurs, just grab a big rock and take a long walk off a short pier

19:52 mdeboard: nm, no I'm not.

19:52 Urthwhyte: whoa

19:53 mdeboard: Make like a tree and get outta here

19:54 Urthwhyte: mdeboard: I have three irrsi sessions going at the same time and thought your message was from work's and was very confused as to how an FP q got into my gwt-ffffuuuuu rant

19:54 channel

19:54 mdeboard: I see

19:57 I believe the third domain was math ops

19:57 austinh: Here is my code for setting up virtual hosts with Clojure/Ring/Jetty: https://gist.github.com/3628228

19:58 seneth: I am experimenting. For the last two days I was looking for a new language, because i am tring to move away from verboseness of java. And the languages I am interested in now are Scala and Clojure. I am kinda familliaer with recursion and s-expressions type syntax. I would use it for my own projects. Any suggestions?

19:59 gfredericks: ~scala

19:59 clojurebot: Unfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala

19:59 technomancy: seneth: you mean suggestions on whether to choose Clojure or Scala?

19:59 this might be the wrong channel for that

19:59 weavejester: austinh: Compojure should be able handle virtual hosts by setting routes with absolute URLs

19:59 Urthwhyte: technomancy: Presumably he's asking the same thing in #scala

19:59 seneth: yes

20:00 Urthwhyte: (and getting nothing in there, considering how dead it is)

20:00 seneth: I am not

20:00 hiredman: weavejester: interesting fact

20:00 weavejester: e.g. (GET "http://api.myproject.com/&quot; [] …)

20:00 amalloy: Urthwhyte: and in here we'll suggest clojure, while in there they'll suggest scala. which i think was technomancy's point

20:00 technomancy: hooray, we win by default then?

20:00 weavejester: And if Clout 1.1.0 is explicitly included, you can also do:

20:00 (GET "//api.myproject.com/" [] …)

20:00 technomancy: jkkramer: ^ possibly of interest for clojuresphere

20:01 gfredericks: maybe he will forward the arguments back and forth and conduct an indirect fight

20:01 Urthwhyte: it'll be like the good ol' #ruby v. #python days

20:01 or #noun1 v. #noun2

20:02 gfredericks: well this may surprise you but I would recommend clojure.

20:02 seneth: Let me put it differently. Is clojure practical for every day projectS, like Building guis, db acess, etc..?

20:02 austinh: weavejester: Good to know! (But I'm not using compojure).

20:03 weavejester: austinh: You could also use middleware that dispatches off the "Host" header

20:04 austinh: Because that's all there is to virtual hosts.

20:05 austinh: weavejester: middleware would've been a good idea. Initially, I was trying to keep the two applications separated, and I was hoping to be able to start/stop them independently.

20:06 weavejester: (defn virtual-hosts [& {:as handlers}] (fn [req] ((handlers (get-in req [:headers "host"])) req)))

20:06 austinh: Now I hate you.

20:06 weavejester: austinh: :)

20:06 austinh: :)

20:07 weavejester: nginx is often a good choice if you want a webapp to be made of multiple processes

20:07 gfredericks: seneth: yes.

20:07 weavejester: Whether you're using Clojure or Ruby or whatever

20:08 anyway goodnight :)

20:08 austinh: Good night!

20:09 I can't believe I didn't think of middleware. Middleware rules my world right now.

20:10 mdeboard: Anyone know what Akamai uses Clojure for?

20:12 Aha. "mobile adaptation product"

20:13 Or more completely, "real-time content transformation from a customer's desktop website and to present the data in a format suitable for a mobile phone, all while requiring minimal changes to the site by a customer. The main strength of our technique is that we directly consume their HTML and Javascript in the live system. The resulting application required a complex, many-layered architecture, including multiple DS

20:13 L's, parsers, and DOM query tools"

20:14 technomancy: definitely couldn't pull that off with a single DSL; no sir =)

20:15 casion: so I'm converting an int to a float in range of -1.0/1.0, is (float (/ int 0x7fffffff)) is the most reasonable way? casting the ratio to float seems slow

20:16 gfredericks: &(float 0x7fffffff)

20:16 lazybot: ⇒ 2.14748365E9

20:16 gfredericks: why not divide by that directly?

20:16 hiredman: ,(* 1 1.0)

20:16 clojurebot: 1.0

20:17 casion: gfredericks: I think I tried that… let me check again

20:17 gfredericks: casion: it would sidestep ratios at least

20:18 casion: it's faster on its own, but not in this function

20:18 which I guess means there's something else going on that I'm missing

20:18 mdeboard: technomancy: can't tell if serious

20:18 casion: let me put it up, sec

20:19 technomancy: mdeboard: I have a hard time taking the term "DSL" seriously.

20:19 gfredericks: technomancy: you wouldn't understand, it's too domain specific

20:19 mdeboard: Yeah I always associate it with a much more crude acronym too

20:19 technomancy: mdeboard: "Metaprogramming in Lisp is like Chinese food in China; they just call it food there."

20:19 mdeboard: oh

20:19 that too

20:19 whitaker: ok, I'm now absolutely convinced to stay away from noir/noir-async, after having successfully ripped it out this (PST) afternoon, reverting to Ring + Compojure + Aleph

20:19 technomancy: clojurebot: Metaprogramming in Lisp is like Chinese food in China; they just call it food there.

20:19 clojurebot: Alles klar

20:20 amalloy: i've heard that what's served as chinese food in america isn't easily recognized in china

20:20 jballanc: what's it take to add a task to lein 2.0?

20:20 mdeboard: whitaker: Why so

20:20 technomancy: jballanc: typically write a plugin, though there are other ways too; what do you need?

20:21 Sgeo: I should make an expr function

20:21 whitaker: mdeboard: see the day's log :)

20:21 jballanc: I'm trying to update ClojureScript One for lein 2.0

20:21 but it has a "bootstrap" task defined in the project

20:21 shaungilchrist: you're-gonna-have-a-bad-time

20:21 whitaker: I had reloading issues which made my noir-async app untestable

20:21 technomancy: jballanc: if you just need to run application code, you can use a partial alias to the run task

20:21 jballanc: not strictly necessary to carry it over...but I got curious

20:21 shaungilchrist: get lein1.6 for now

20:21 casion: https://www.refheap.com/paste/4877

20:21 mdeboard: whitaker: I don't have the whole day's log, I use a bouncer that only retains the diff between my logins. tl;dr version?

20:22 casion: to convert a collection of bytes (little-endian) to a 32-bit float in range -1.0/1.0

20:22 jballanc: shaungilchrist: is there an effort to port to lein 2.0 underway?

20:22 technomancy: jballanc: if you're adapting a legacy codebase it's probably simplest to echo "tasks" > .lein-classpath and make tasks/leiningen/bootstrap.clj

20:22 jballanc: I couldn't find anything

20:22 technomancy: ah, yeah...that might work :)

20:22 casion: maybe I'm doing something else wrong that I'm not noticing in there

20:22 shaungilchrist: I do not know - I was just in same boat a week ago

20:22 whitaker: mdeboard: http://clojure-log.n01se.net/ - CTL-F/grep for 'whitaker', first instance of subthread on the matter starts from there

20:22 technomancy: I doubt clojurescript one is doing anything that actually justifies a custom task, but that would get you going the quickest

20:23 gfredericks: man #clojure hasn't been this noisy since they first announced they were adding parentheses

20:23 jballanc: it isn't

20:23 bootstrap is just "deps + git-deps"

20:23 technomancy: oh man... git deps =(

20:23 mdeboard: whitaker: huh

20:23 technomancy: welp

20:23 jballanc: not really worth it...like I said...was more curious than anything

20:23 technomancy: jballanc: :aliases {"bootstrap" ["do" "deps," "git-deps"]}

20:23 mdeboard: gfredericks:

20:23 \(。◕‿◕。)/

20:24 jballanc: yeah, that's much simpler

20:24 * mdeboard is surprised that noir is stateful, if hiredman can be believed

20:24 technomancy: jballanc: it should probably be ported to lein-cljsbuild, but that would probably be pretty involved.

20:25 jballanc: technomancy: well...I'm looking to build on this, so it might just be worth my effort

20:25 technomancy: mdeboard: noir has weird top-level non-var forms

20:25 whitaker: mdeboard: noir was my punishment as a Ruby/Rails guy trying to replicate the "give me an entire opinionated stack dammit" experience unnecessarily.

20:25 jballanc: (and by build, I mean organizationally, not just code-wise)

20:26 mdeboard: whitaker: ah yeah, you have to unclench your fist

20:26 you know, the fist of your mind.

20:27 (◎_◎)

20:27 whitaker: Maybe noir was a Gom Jabbar test for me.

20:28 mdeboard: I see

20:29 whitaker: I almost got pricked by the needle

20:30 technomancy: clojurebot: recite the litany against cons

20:30 clojurebot: eventual consistency is for losers

20:30 technomancy: =(

20:30 clojurebot: litany against cons

20:30 clojurebot: litany against cons is "I must not cons. Cons is the perf-killer. Cons is the little death that brings total obliteration. I will face my cons and permit it to pass over me and through me, and when it has gone past I will turn my GC to see its path. And where it has gone there will be nothing; only I will remain."

20:30 gfredericks: ~conso

20:30 clojurebot: excusez-moi

20:30 jballanc: poor clojurebot...the things you all make him remember

20:31 hoover_damm: seriously

20:31 gfredericks: ~botsnack

20:31 clojurebot: Thanks! Can I have chocolate next time

20:31 technomancy: ~scoobysnack

20:31 clojurebot: Titim gan ?ir? ort.

20:32 gfredericks: clojurebot: scoobysnack is botsnack

20:32 clojurebot: Roger.

20:32 gfredericks: ~scoobysnack

20:32 clojurebot: scoobysnack is botsnack

20:32 gfredericks: ~scoobysnack

20:32 clojurebot: Thanks! Can I have chocolate next time

20:32 gfredericks: what a smot bot

20:32 whitaker: ~chocolate

20:32 clojurebot: excusez-moi

20:32 technomancy: gfredericks: have a scoobysnack

20:32 whitaker: ~42

20:32 clojurebot: 42 is forget (+ 2 3)

20:33 gfredericks: technomancy: Thanks! Can I have chocolate next time

20:33 whitaker: ~cheezburger

20:33 clojurebot: It's greek to me.

20:33 whitaker: ~cheeseburger

20:33 clojurebot: It's greek to me.

20:33 whitaker: I see clojurebot lacks felid lol mode

20:34 but has a canid mode

20:37 In light of my day's experience's with noir, I am gratified that yesterday I listened to an hour-long talk by Rich Hickey on "complection"

20:38 gfredericks: "Rich Hickey and Makeup"

20:38 frio: whitaker: link :)?

20:39 whitaker: gfredericks: amusing Google result from that phrase: "How do I fake a hickey with makeup? | ChaCha"

20:40 wmealing_: i knew he was a robot

20:40 whitaker: frio: lemme look… I was listening to it on my iPad as a car passenger yesterday

20:40 rbarraud: Any Wellington clojurists in here?

20:41 I am in town visiting family

20:41 Well, in Upper Hutt...

20:42 whitaker: Wellington where? UK? Canada? Australia? NZ?

20:42 mdeboard: One oughtn't find oneself in Lower Hutt after sundown

20:42 rbarraud: Definitely ;-)

20:42 frio: whitaker: i just found it :)

20:43 and im guessing NZ's wellington, if there's hutts in it

20:43 rbarraud: NZ

20:43 frio: im in auckland rbarraud :)

20:43 rbarraud: Yup

20:43 Hi frio ... That's my usual domicile... Greenhithe to be precise :-)

20:43 frio: haha

20:43 the horrible horrible north shore :p

20:44 whitaker: frio: cool, because I couldn't find it in the history on my iPhone or iPad. URL for others here (and The Historical Record)?

20:44 mdeboard: Is Korma looked upon with similar disdain as Noir

20:44 @ hiredman

20:44 rbarraud: According to some twisted views of the universe, perhaps so ;-)

20:44 frio: whitaker: http://www.infoq.com/presentations/Simple-Made-Easy

20:45 whitaker: While we're on the topic of "Are there any NNNN clojurists here," I'll ask too: any San Francisco / SF Bay Area clojurists here?

20:45 frio: that's the one, thanks much

20:46 Anyone else seen the 2011 "Skills Matter" talk by "Uncle Bob" on "The Last Programming Language"?

20:48 Sgeo: How does = on functions work?

20:48 mdeboard: whitaker: Dude, Twitter is based in the bay area

20:48 Sgeo: ,(= + +)

20:48 clojurebot: true

20:49 Sgeo: I take it it's identity-based?

20:49 ,(= (fn [x] (+ x 1)) (fn [x] (+ x 1)))

20:49 clojurebot: false

20:49 dnolen`: Sgeo: identity

20:49 mdeboard: ,(identity +)

20:49 clojurebot: #<core$_PLUS_ clojure.core$_PLUS_@72ab19c0>

20:50 Sgeo: mdeboard, not what I meant >.>

20:50 mdeboard: (╯°□°)╯︵ ┻━┻

20:50 whitaker: mdeboard: I know Twitter is based here. I meant clojurists _here and now_ on this channel

20:50 mdeboard: whitaker: Oh, good god no

20:50 whitaker: ?

20:50 Please be more cryptic.

20:51 mdeboard: I've said too much

20:51 frio: hahahahaha

20:51 whitaker: mdeboard: was that somehow addressed to the "clojurists in the Bay area" thing, or?

20:52 Guys, did I just miss an inside joke by mdeboard, who exited?

20:52 mdeboard: no

20:52 whitaker: What was the "Oh, good god no" then?

20:52 mdeboard: Poor brain-mouth filter.

20:55 whitaker: Anyway, I'll take the resounding silence as meaning I'm the only Bay area clojurist on channel who happens to be paying attention at the moment.

20:56 gfredericks: ain't it quittin time in the bay area at the moment?

20:58 arohner: whitaker: me

20:58 phao: Hi... This is a bit offtopic, but since "value oriented" is sort of a big deal here, maybe someone may be able to answer it... Isn't it problematic, in terms of performance, to be value oriented?

20:58 arohner: gfredericks: no, it's coding time, because all the emails have finally stopped!

20:58 phao: I mean, won't it spend lots of memory, or cause huge network traffic... or ... ?

20:58 gfredericks: phao: also problematic to have a GC

20:58 phao: what specific case are you thinking of?

20:59 phao: the networking thing looks huge...

20:59 gfredericks: sending JSON over the wire?

20:59 whitaker: gfredericks: not at my office in San Francisco, where I'm waiting for dinner to be delivered

20:59 arohner: do you attend any of the local Clojure meetups?

21:00 phao: gfredericks, tbh, I really don't quite know...

21:00 gfredericks: phao: I must not understand what you mean by "the networking thing"

21:00 arohner: whitaker: sometimes. I've probably been to 3-4 since January

21:01 phao: the JVM is pretty good at GC'ing garbage that doesn't last one generation

21:01 whitaker: mdeboard: re: Korma, I'd be surprised if it were held in the same disregard as noir, given "Copyright © 2011 Chris Granger. All rights reserved."

21:01 http://sqlkorma.com/

21:02 arohner: so if your problem can handle be written in Java, it can probably handle being value oriented

21:02 mdeboard: whitaker: Chris Granger was inventor of Noir as well

21:02 ibdknox: Someone rang?

21:03 mdeboard: ibdknox: I was asking about how people would rate Korma given the recent bad eperience with noir that was discussed at length earlier

21:03 ibdknox: say what?

21:03 Sgeo: Bad experience with Noir?

21:04 ibdknox: What bad experience?

21:04 whitaker_: ibdknox: see log: http://clojure-log.n01se.net/

21:04 CTRL-F for 'whitaker', first occurrence, read from there

21:06 ibdknox: to be very clear

21:06 I have nothing to do with noir-async

21:06 moreover

21:07 meh, not worth it

21:08 apparently people like speaking ill of my work while I'm away lol

21:10 rbxbx: ibdknox I'm sure people speak positively of your work while you're away as well, just not so much today.

21:10 shaungilchrist: well to add balance to the force - I like noir. The examples actually work and the documentation is clear

21:13 mdeboard: I think ibdknox's ego is safe given that he sleeps on a pile of Kickstarter funds every night and is very well-regarded for his contributions to the Clojure community (and aforementioned Kickstarter-funded Light Table, which is awesome)

21:13 Scrooge McDuck-style

21:13 whitaker: I spent several days trying to get noir.util.test/send-request to play nice with noir-async/defpage-async, and gave up today in frustration

21:14 ibdknox: whitaker: I know *nothin* about noir-async

21:14 chances are if you just use aleph directly

21:14 it would've been fine

21:14 whitaker: who is ibdknox? I thought Light Table was Chris' project

21:14 TimMc: ...

21:14 ibdknox: I'm Chris Granger

21:14 lol

21:14 whitaker: !

21:14 heh

21:14 hi Chris

21:15 ibdknox: hola

21:15 whitaker: (we met in SF a few weeks ago at Climate Corp.)

21:15 mdeboard: lol

21:15 whitaker: Love Light Table, always talking it up to friends

21:15 ibdknox: haha that was a couple months ago ;)

21:15 whitaker: temps fugit and all that.

21:15 arg

21:15 ibdknox: Sorry you had a bad experience with noir :(

21:15 whitaker: damned autocorrect

21:15 Not noir

21:16 noir-async, sorry to conflate them

21:16 wasn't noir's fault

21:16 "tempus fugit"

21:16 there

21:16 ibdknox: If it were me, I would intentionally separate the async part to another process anyways, unless you can guarantee you're never going to have to scale it

21:16 fwiw, LT actually uses noir on top aleph

21:17 whitaker: Oh, I did go back to straight Aleph

21:17 Sgeo: Aleph?

21:17 ibdknox: Sgeo: https://github.com/ztellman/aleph

21:17 TimMc: $google aleph clojure

21:17 lazybot: [ztellman/aleph · GitHub] https://github.com/ztellman/aleph

21:17 whitaker: I, er, "decomplected" things a bit

21:17 mdeboard: Every time I think I need a macro it turns out a function is fine.

21:18 whitaker: ibdknox: makes since that LT sits on top of Aleph

21:18 rbxbx: mdeboard thankfully you're trying first instead of jumping straight to the macro like so many do ;_;

21:18 whitaker: I like Aleph the more I learn about it

21:18 mdeboard: rbxbx: I'm actually turning a macro into a function atm

21:18 whitaker: "makes sense"

21:18 I really need to find the preference in my irc client that keeps doing that...

21:19 mdeboard: Oh, wait, I remember now.

21:19 ibdknox: fwiw here's a little gist I made for it: https://gist.github.com/1257857

21:19 mdeboard: I DO need a macro. I should document this.

21:19 ibdknox: lol

21:20 Sgeo: The thing that used to be in clojure.contrib for monads uses a macro unnecessarily

21:20 whitaker: ibdknox: thanks Chris

21:21 Sgeo: (You'd need a macro in Haskell, but Clojure is not Haskell)

21:21 ibdknox: whitaker: though to be honest, you're probably better off just using lib-noir with compojure or whatnot - depending on what you're doing

21:21 whitaker: lib-noir has most of the middleware for noir in it, and is designed to be used with any ring project

21:22 so that the people who will never accept anything short of raw ring or maybe compojure can get some of the niceness too :)

21:23 mdeboard: Wait, DO I need a macro here? https://gist.github.com/3628843 I didn't write enough documentation.

21:23 whitaker: ibdknox: I have to do websockets, which was my reason for trying out noir-async in the first place; does lib-noir address that need?

21:23 mdeboard: I think this is one of htose instances where I was pounding my head against something that I lost sight of what was the actual goal

21:24 ibdknox: whitaker: nah, you use aleph for that. lib-noir just provides the stuff you'll probably want if you intend to server webpages from that same server. e.g. sessions, cookies, etc

21:25 whitaker: ibdknox: thanks for making the distinction

21:27 Thanks guys! G'nite.

21:29 mdeboard: Ah right... https://gist.github.com/3628877 ... the reason I used a macro there was because afaik you can't use a variable in the 1st arg to (proxy)

21:30 Now that I mention it, why the heck doesn't that worK?

21:30 emezeske: mdeboard: Because proxy is a macro itself

21:31 mdeboard: Ahhhhh right.

21:31 rbxbx: ,(doc proxy)

21:31 clojurebot: "([class-and-interfaces args & fs]); class-and-interfaces - a vector of class names args - a (possibly empty) vector of arguments to the superclass constructor. f => (name [params*] body) or (name ([params*] body) ([params+] body) ...) Expands to code which creates a instance of a proxy class that implements the named class/interface(s) by calling the supplied fns. A single class, if provided, mus...

21:31 emezeske: mdeboard: It looks at its arguments at compile time, so they have to be set then

21:31 rbxbx: :(

21:32 emezeske: mdeboard: That's IMHO the best reason to avoid macros if possible -- they sort of leak macro-ness to their users

21:32 mdeboard: emezeske: Indeed, I had gone through all this before but I failed to write it down.

21:33 emezeske: mdeboard: Heh, I know how that goes! :)

21:35 technomancy: mdeboard: korma has a few similar issues but the situation is different because raw clojure.java.jdbc is a lot less pleasant to work with than raw compojure.

21:36 nobody has found the right level of abstraction primitives for DB queries yet

21:42 samrat: anyone here using noir-async?

21:42 mdeboard: samrat: There was just a guy here

21:43 so, no

21:44 arohner: technomancy: because there isn't a right level of abstraction over SQL?

21:45 the problem is SQL, IMO

21:45 hoover_damm: arohner, I would argue the right solution is going to be opinionated

21:46 arohner: hoover_damm: I have an opinionated solution. Don't use SQL :-p

21:46 or, don't expect an ORM to work 100% on top of SQL

21:46 hoover_damm: arohner, I was sold on that pattern back in 2008

21:46 arohner, I tried explaining that to my peers (i'm an ops person) and the blank looks I got was amazing

21:47 arohner: http://arohner.blogspot.com/2009/04/db-rant.html

21:47 hoover_damm: arohner, sometimes people know so little that they don't know how to work outside of their box

21:47 and yet they will hold steadfast to their ignorance

21:49 dysinger: where did clojure.contrib.reflect run off to ? I've been out of the game for a while

21:50 xeqi: $seen kingtim

21:50 lazybot: kingtim was last seen quitting 1 hour and 42 minutes ago.

21:50 xeqi: ~contrib

21:50 clojurebot: Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

21:51 xeqi: looks like no one has moved it forward

21:51 dysinger: thanks lazybot!

21:52 bummer I need that get-field fun

21:56 Sgeo: I think the whole macros infecting users so that they tend to need to be macros thing is a very good argument for doing things in a Tcl-style way

21:57 emezeske: Sgeo: Well you can of course do that in clojure with eval

21:58 Sgeo: Isn't eval generally discouraged?

21:58 emezeske: Who cares if it's discouraged?

21:58 You can still use it

21:59 There are good reasons for it to be discouraged, anyway. They're the same reasons that evaling code in Tcl is painful

21:59 amalloy: dysinger: clojure.java.reflect

22:00 mindbender1: an appeal to clojure lib writers. Please document your apis in the manner of elisp

22:00 dysinger: amalloy:

22:00 thanks

22:00 Sgeo: Hmm, how is evaling code in Tcl painful? Tcl at least is an environment where eval (well, uplevel usually) is an ordinary practice

22:01 emezeske: Efficiency is a decent reason. Making your code understandable is a better one.

22:03 Sgeo: I wonder if a delay monad would make sense

22:03 It wouldn't make sense in Haskell because everything is lazy by default, but that's not the case in Clojure

22:03 *non-strict

22:05 mindbender1: imagine this https://gist.github.com/3629127, no matter how the author tried to explain the fn, nothing beats knowing what the arguments are and what is returned

22:10 rbarraud: Us antipodeanz iz pays teh attentions ;-) Whitaker

22:13 dysinger: argh. leiningen includes jars that are marked :scope "provided" in the uberjar

22:17 xeqi: dysinger: yeah, they need to be in the :provided profile

22:20 mpan: I'm calling assoc on a hash-map and getting back a lazy sequence. How can I get a hash-map?

22:21 dnolen: mpan: that doesn't sound right.

22:21 mpan: in particular, I'm using reduce to assoc a bunch of stuff into an empty map

22:21 dnolen: ,(assoc {} :foo 1)

22:21 clojurebot: {:foo 1}

22:21 mpan: and I'm... idk somehow I get back a lazy seq

22:22 dnolen: mpan: paste your example somewhere.

22:22 mpan: (reduce #(assoc %1 (%2 0) (%2 1)) listens (hash-map))

22:22 listens is a seq of 2-length vectors

22:22 which I'm trying to convert into the key-val pairs of a map

22:22 and uh... I get something strange out

22:23 xeqi: (doc reduce)

22:23 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the resu

22:23 xeqi: that passes listen as the initial value

22:23 TimMc: clojurebot, y u so verbose

22:23 clojurebot: because the parentheses grow lonely if their closing brackets are all kept separated and segregated.

22:23 dnolen: mpan: the problem is your initial value. generally the type of the intial value will be type of the final value.

22:23 mpan: eek

22:23 how am I doing it backwards and getting seemingly sane results?

22:23 or at least, far less insane than doing something backwards usually gets

22:24 but wow thanks guys

22:24 dnolen: mpan: assoc is polymorphic

22:24 xeqi: ,(into {} [[:a 1] [:b 2] [:c 3]]

22:24 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

22:24 xeqi: ,(into {} [[:a 1] [:b 2] [:c 3]])

22:24 clojurebot: {:a 1, :b 2, :c 3}

22:25 xeqi: mpan: might consider into ^

22:25 dnolen: ,(assoc [1 2 3] 1 :foo)

22:25 clojurebot: [1 :foo 3]

22:25 mpan: (doc into)

22:25 clojurebot: "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."

22:25 dnolen: mpan: ^, vectors support assoc

22:26 mpan: btw, semi-related, why do a lot of the data types support (collection index) but lazy seqs don't?

22:27 TimMc: mpan: seqs are not associative data structures.

22:27 vectors and maps are, so they are functions of their keys

22:28 mpan: all right, thanks!

22:29 dnolen: mpan: a lot of operations w/ the notable (an probably suprising) exception of nth & count are organized around computational complexity.

22:29 technomancy: arohner: insufficient data to make a conclusion =)

22:29 but that's certainly a possibility

22:30 arohner: given the number of failed ORMs, and none of the active ones are 100%, I claim the evidence is on my side :-)

22:30 mpan: dnolen: do you mean that they don't want people getting the nth of just an arbitrary seq if it can be avoided?

22:30 technomancy: I'm sure you can do better than strings of SQL if for no other reason than you don't get syntax highlighting in that case

22:31 and monochrome code has serious usability concerns

22:31 but maybe that's a tooling issue

22:31 TimMc: Part of the issue is certainly SQL's variability between DBs.

22:31 dnolen: mpan: yes

22:32 arohner: I agree tooling is a problem. I'm reasonably convinced the problem can't be solved with an ORM on top of SQL though. It can't be abstracted away 100%

22:33 technomancy: yes, I agree that an ORM is not the solution

22:34 TimMc: create table kvstore (`key` text primary key, `value` text); -- done

22:35 imeredith: arohner: in scala people have made typesafe query generators, but that only works if you dont have any bugs in the generators

22:35 TimMc: arohner, technomancy: Has either of you used datalog to any appreciable degree?

22:36 arohner: not yet. I'm really interested in datomic, haven't had time yet

22:36 technomancy: not yet

22:37 TimMc: I'm eager to read up on it and see if it is something I can use instead of SQL. :-)

22:37 arohner: it's supposed to be

22:37 I've heard of people using it in production already

22:37 mpan: what does it mean to get a NullPointerException when compiling?

22:38 arohner: probably a syntax error

22:38 mpan: if I break the statement down, I get different errors

22:38 TimMc: and the syntax in error could be a macro usage

22:38 dnolen: mpan: also easily possible if you have executable stuff at the top level.

22:39 mpan: so I def something, and a line later, it says the symbol can't be resolved

22:39 and I dunno what I did wrong

22:39 dnolen: mpan: use a paste service - gist, refheap, lisppaste if you want people to help you w/ your problem.

22:40 mpan: as in, put the relevant source in a paste-bin service?

22:40 dnolen: mpan: yep

22:41 mpan: http://pastie.org/4665896 at the very bottom it tells me it can't resolve lines

22:41 which I def'd just right before

22:41 not sure if the rest of the file is any relevant

22:42 TimMc: Doing work at compile time isn't usually a great idea.

22:42 mpan: I only put it in for testing this part

22:42 and running it at the repl has the same issue

22:43 TimMc: mpan: If that get-lines call fails, then #'lines will be unbound.

22:45 mpan: I'm digging further into it and it does seem like another part had failed

22:45 Is there some way to get like a stack trace?

22:45 dnolen`: optimized printing landings in CLJS http://github.com/clojure/clojurescript/commit/c8bc05ca8e3c7e30a85148dd67398aa4d0e6b468

22:45 s/landings/lands

22:47 mpan: what dev environment are you using?

22:47 mpan: eclipse + counterclockwise

22:48 I've traced the error up to an error in my regex which caused me to feed something invalid to parseInt

22:48 dnolen`: mpan: hmm I would think CCW should show you the trace.

22:49 mpan: perhaps someone that uses CCW can tell you how to get a trace. In the meantime *e always hold the last exception in the REPL. You can print it by using clojure.repl/pst (don't forget to require it first)

22:50 mpan: thanks

22:50 rbarraud: Grraarrrg.... Anyone recommend an iPad IRC client that doesn't lose conversation history on disconnect? :-(

22:51 mpan: Is (require '(clojure repl)) the statement I'm looking for?

22:52 zerokarmaleft: rbarraud: iSSH + screen/tmux + irssi?

22:53 dnolen`: mpan: (require '[clojure.repl])

22:53 mpan: or (require '[clojure.repl :as repl]), which make it less tedious

22:53 (repl/pst *e)

22:53 rbarraud: Zerokarmaleft thanks

22:54 Heh

22:54 zerokarmaleft: rbarraud: it's a valid option :D

22:55 mpan: does this require some special external jars?

22:55 rbarraud: Yeah ... Given a suitable Linux host :-)

22:55 Might try It actually

22:55 dnolen`: mpan: not for clojure.repl

22:55 mpan: I'm still getting RuntimeException java.io.FileNotFoundException: Could not locate clojure/repl/pst__init.class or clojure/repl/pst.clj on classpath:

22:55 dnolen`: mpan: pst is a function, you want to require a library

22:56 mpan: what are you entering into the REPL?

22:56 mpan: (require '[clojure.repl]) which appears to succeed

22:56 dnolen`: mpan: and how are you trying to use it?

22:56 mpan: then (clojure.repl/pst *e) which fails as above

22:57 dnolen`: mpan: hmm just tried that and it seems to work.

22:58 mpan: I did find what I broke in the other place, though, and this is almost absurd... I accidentally used a built-in with a similar name to something I had but an entirely different meaning

22:59 emezeske: dnolen`: thanks for merging CLJS-340!

22:59 mpan: which gets me back to the earlier problem of, I'm definitely not doing my regexes correctly, but that's something different at least

22:59 dnolen`: emezeske: np!

23:18 mrevil: i'm doing interop with java and it's forcing me to obtain a lock before iterating through a collection. Is there a way to wrap a map so that I can return a lazy collection, and when the collection goes out of scope or is consumed something similar to a finally block is called allowing me to release the lock?

23:25 emezeske: mrevil: AFAIK that is not possible. The same question comes up regarding the use of with-open around a lazy-seq, and the answer is always that you have to manage the resource (file open or in your case lock) yourself.

23:25 mrevil: hmmm

23:26 emezeske: mrevil: There's no way for clojure to know that your program is done using the lazy-seq. The closest you could come would be to release the lock in a Java finalizer, but that's a bad idea

23:27 mrevil: sometimes I wish I had shared_ptr or auto_ptr from c++

23:28 emezeske: Well what you really want are scoped destructors from c++, but Java just doesn't have that.

23:28 That's life in a garbage-collected world.

23:30 mrevil: backing away from a rant, but i'm registering my annoyance and shaking my fist at the pedantic and arrogant java world view

23:32 emezeske: Not allocating objects on the stack is pedantic?

23:33 devth: what's a nice way of filtering out a specific specific character from a string? i tried clojure.contrib.string/replace-char, but don't know of an empty character to replace it with.

23:34 emezeske: devth: Caveat: I have no idea how (in)efficient this is: (apply str (remove #(= % "z") "abczzzdef"))

23:34 devth: ah, nice. thx

23:35 mrevil: i think that the garbage collector doesn't really solve problems, and in fact introduces all sorts of new problems. i resent the we know better than you, we're going to take away the pointy scissors, you slow bumbling little child.

23:36 emezeske: mrevil: What? It's not like the Java authors took away your ability to write C or C++

23:36 mrevil: You resent them for giving you another option that you may freely choose not to use?

23:37 nsxt: is clojurecheck the "definitive" quickcheck implementation for clojure?

23:37 mrevil: just because I like some feature (clojure) of an environment doesn't mean I have to be happy with all of the baggage that comes with it

23:37 xeqi: nsxt: theres also test.generative

23:40 emezeske: mrevil: Well, it's silly to resent the design of Java. And I doubt any of the Java authors claim to "know better than you". Lots of people consider garbage collection useful. You're certainly entitled to think otherwise, but it's ridiculous to call Java's design "arrogant" because it does not agree with your preferences.

23:42 * emezeske shuts up.

23:44 iDesperadO: ,(def m {:hello 1, :world 2}) ,(map :hello m)

23:44 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

23:44 mpan: it doesn't want you to def :/

23:44 it's happy with let though

23:44 (or so I hope)

23:44 emezeske: ,(let [m {:hello 1 :world 2}] (map :hello m))

23:44 clojurebot: (nil nil)

23:44 mpan: ,(let [x 1] x)

23:44 clojurebot: 1

23:44 emezeske: iDesperadO: workaround ^

23:45 iDesperadO: (let [m {:hello 1 :world 2} (map :hello m))

23:45 ,(let [m {:hello 1 :world 2} (map :hello m))

23:45 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

23:45 mpan: um, close your ]

23:45 iDesperadO: ,(let [m {:hello 1 :world 2}] (map :hello m))

23:45 clojurebot: (nil nil)

23:45 iDesperadO: ,(let [m {:hello 1 :world 2}] (map :hello [m]))

23:45 clojurebot: (1)

23:45 iDesperadO: why's that?

23:46 mpan: map expects certain arguments

23:46 (doc map)

23:46 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence 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."

23:46 mpan: specifically, it wants something it can call and something that's a coll

23:47 I'm afraid to get the details wrong so I'll be quiet here :(

23:47 iDesperadO: :hello is function {:hello 1 :world 2} is collection...I use function :hello to call {:hello 1 :world 2}. I'm afraid it's supposed to be right

23:47 ,(:hello {:hello 1 :world 2})

23:47 clojurebot: 1

23:48 iDesperadO: ,(let [m {:hello 1 :world 2}] (map :hello m))

23:48 clojurebot: (nil nil)

23:48 mpan: it calls 1st arg to /each elem in/ 2nd arg

23:48 not to 2nd arg directly

23:49 so when you wrap it in vector, it calls it to each elem in the vector, namely, m

23:49 once again, I'm new and afraid I might be giving you wrong details

23:50 iDesperadO: mpan: ah..it helps

23:50 :)

23:52 jparishy: Hi! Is there a best practice for wrapping a C library for use in Clojure?

23:55 I found this library https://github.com/Chouser/clojure-jna but it's pretty old

23:57 casion: I've just used JNA directly

23:58 uvtc: I wonder if clojurebot has any wisdom to spread on this topic?

23:58 ~c

23:58 clojurebot: ClojureBooks is http://clojure.org/books

23:58 uvtc: Hm.

23:58 casion: using C from java seems a bit counter to the purpose of using java in the first place though

23:58 I'

23:59 I've only used it to check my work against known working libraries that I"m familiar with

23:59 jparishy: Yep, but I'd like to use the Clojure parser along with a C library (llvm api) so you kinda have to go in that direction me thinks

23:59 wmealing_: casion: seen that clojureC work ?

Logging service provided by n01se.net