#clojure logs

2012-09-04

02:48AustinYuncan someone tell me what the target directory that leiningen creates does?
02:50michaelr525AustinYun: probably for compiled java classes, no?
02:51AustinYunoh
03:25michaelr525can i import symbols using (use) and rename them in the current namespace?
03:27michaelr525something like this (:use [clojure.string :only [split :as sp]])
03:29tomoj(:use [clojure.string :only [split] :rename {split sp}])
03:30tomojsee docs for use/require/refer
03:31michaelr525cool
03:31michaelr525:)
03:32michaelr525tomoj: 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 :)
03:36tomojI don't remember why I believe this, but I think :use :only is going out of style in favor of :require :refer
03:41kralnamaste
03:47michaelr525tomoj: in :refer's docs I've seen this: "Use :use in the ns macro in preference to calling this directly."
03:49michaelr525err
03:49michaelr525it's written that use is like require+refer
03:51michaelr525what use does refer have without require?
03:52hyPiRion,(doc refer)
03:52clojurebot"([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...
03:55michaelr525hyPiRion: but in which case would i use refer without a require?
04:01tomojI can't think of any reason
04:03tomojother than like (:refer-clojure :exclude [replace])
04:05michaelr525hmm
04:05michaelr525so why :use goes out of style? looks like :use should be the most used of these forms..
04:07tomojI hardly ever use :use
04:07tomojexcept at the repl
04:07tomojsome believe that :use is only acceptable when paired with :only
04:08tomojbut :require :refer works for that, and works in clojurescript too
04:08noidimichaelr525, it's easier to :use all names in a namespace without thinking about it too much
04:08noidi:require makes you explicitly state that it's really what you want
04:08noidiwith (:require foo :refer :all)
04:09noidiI guess that's the reason
04:09alex_baranoskywhat are you all using to manage your SQL schema migrations?
04:09michaelr525noidi: oh
04:09michaelr525i see
04:10michaelr525that's what i did when I started actually, just imported everything with use. now I usually specify what I need with :only/
04:13samratwhat's the way to do background task queueing in Clojure?
04:13noidisamrat, you could use agents or futures
04:14michaelr525samrat: i use langohr
04:14michaelr525with rabbitmq
04:16samratthanks, I'll look those up
04:16samratanything based on redis, I did find resque-clojure, but that doesn't seem to have been updated in a while
04:20michaelr525,(doc require)
04:20clojurebot"([& 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...
04:22michaelr525noidi: was the :refer options added to :require in clojure 1.4?
04:23michaelr525noidi: it's mentioned in the docs in the source but not mentioned int the docs at clojuredocs.org (the version there is 1.3)
04:24amalloymichaelr525: yes
04:25michaelr525ah, now everything is clear ;)
04:25michaelr525amalloy: what
04:27michaelr525amalloy: err ignore that what
04:47AustinYunwow
04:47AustinYuncircle ci and travis ci both work with datomic
05:00muhoohttps://www.refheap.com/paste/4864 i give up
05:01muhooamazon s3 requires jackson 1.9.9. cheshire 4.0.0 requires jackson 2.0.0 and i'm just screwed
05:01clgvmuhoo:is one compatible with the other?
05:02clgvmuhoo: in that case you could specify :exclusions in the project.clj
05:03muhoothey don't appear to be.
05:04muhoojava.lang.ClassNotFoundException: org.codehaus.jackson.smile.SmileFactory
05:04clgvmuhoo: maybe a slightly older version of cheshire then?
05:04muhoonoir depends on 4.0.0. the tree i posted shows the tangle
05:04muhoosleepy now, must sleep. tired, dependency hell, no work getting done, only pain.
05:05clgvmuhoo: well maybe noir is fine with a slightly older version?
05:05clgvmuhoo: "amazon s3" is a lib for the equal named service of amazon? or is their runtime env?
05:06muhooit's all here: https://www.refheap.com/paste/4864
05:06tomojthe latest aws sdk seems to depend on an even older version of jackson
05:06clgvok, I didnt play with any amazon services yet ;)
05:07muhoo(+ clj-aws-s3 noir) => trouble
05:07tomoja kludge to get it working might be jarjar
05:07clgvmuhoo: does amazon also throw an exception if you use 2.0.0?
05:08muhoothe api has changed.
05:08clgvok. damn
05:08muhooi'll look into jarjar, thanks
05:09clgvbinx? :P
05:09muhoono, not elmo-in-space. the library
05:09clgvjust kidding. go get some sleep - that often helps^^
05:09tomojI 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
05:10tomojwell that won't help you much
05:10tomojcus you'd have to write the classnames in clj-aws-s3 or cheshire
05:11tomojer, in aws-java-sdk or cheshire :(
05:11muhooi might throw this to weavejester and see if he has any ideas
05:12weavejesterWhat's the problem?
05:12muhoobut he depends on the amazon library, and they're the ones digging their heels in with old jackson smile
05:12muhooweavejester: https://www.refheap.com/paste/4864
05:13muhooclj-aws-s3 wants jackson 1.9.9, noir wants cheshire 4.0.0 which wants jackson 2.0.0
05:13tomoj(and latest aws-java-sdk wants jackson 1.8.9, it seems)
05:14weavejesterIs jackson 1.9.9 incompatible with jackson 2.0.0?
05:14muhooend result is this: https://www.refheap.com/paste/4865
05:14muhoojava.lang.ClassNotFoundException: org.codehaus.jackson.smile.SmileFactory
05:14weavejesterHave you tried forcing both to use 2.0.0?
05:15muhooweavejester: i did, some time ago. i don't remember the exact result, but it didn't help
05:15weavejesterOn 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
05:17muhooi didn't
05:17muhooperhaps noir did
05:17weavejester?
05:17muhoosorry, cheshire did
05:18weavejesterHave you tried adding the jackson classes directly to your project deps?
05:18muhooalso, it's a bit different. clj-aws wants jackson-core-asl, etc, but cheshire wants jackson-core, etc
05:18muhooand i don't understand the differences, not being an expert on jackson
05:19muhooit looks to my naive eyes like the api and library structure changed a lot between those versions
05:20weavejesterHm… they're different package families too.
05:20muhooright. so that's why i'm stuck atm.
05:20weavejesterDo they produce the same library?
05:21muhooi don't know
05:21muhoojackson is a black box to me. cheshire is quite nice though.
05:22tomojhmm "Differences from Jackson 1.x" "Java package is now com.fasterxml.jackson.core (instead of org.codehaus.jackson)"
05:22tomoj(about 2.0)
05:22tomojso it should work fine??
05:22lazybottomoj: What are you, crazy? Of course not!
05:22muhoohehe
05:22muhootomoj: it didn't last i tried, but no harm in trying again. here come :exclusions, let's see
05:23weavejesterOkay, so have you actually tried forcing all deps to 2.0.0?
05:23weavejesterThat seems a simple thing to try to see if it works.
05:23tomojmuhoo: I mean, if the libraries are in different packages, it should work fine to exclude nothing
05:24tomojshouldn't it?
05:24weavejesterDifferent Maven packages, not necessarily different Java packages
05:24muhooweavejester: trying now
05:25weavejesterSo exclude the 1.9.9 version I guess
05:26tomojif you exclude the 1.9.9, org.codehaus.jackson.smile.SmileFactory would not be found
05:26muhoojava.lang.ClassNotFoundException: org.codehaus.jackson.JsonFactory
05:26tomojsince jackson 2.0 moved from org.codehaus to com.fasterxml
05:27weavejesterSo they even changed the namespaces?
05:27muhoothe ns looks the same, just the artifact changed
05:28tomoj1.9.9 is entirely contained in org.codehaus
05:28tomoj2.0.0 in com.fasterxml
05:28tomojwhat is the symptom when you don't exclude anything and specify just clj-aws-s3 and noir?
05:29tomojmaybe the problem is jackson's deps ?
05:29tomojdoesn't seem to have any deps
05:29muhootomoj: without exclusions, i get java.lang.ClassNotFoundException: org.codehaus.jackson.smile.SmileFactory
05:30muhoowith exclusions, i get java.lang.ClassNotFoundException: org.codehaus.jackson.JsonFactory
05:31muhooi should post a minimal project which fails, might help if anyone wants to try to repro.
05:32tomojbizarre
05:33tomojadd [org.codehaus.jackson/jackson-smile "1.9.9"] ?
05:33tomoj(with no exclusions)
05:34muhoook
05:36muhootomoj: nice, that worked
05:36muhoobut but but
05:36tomojdoesn't make sense
05:36muhoowhy wouldn't that dependency be included in clj-aws-s3?
05:36tomojI wouldn't guess clj-aws-s3/aws-java-sdk make use of smile
05:37tomojold cheshire would require that codehaus SmileFactory class though..
05:38tomojpre 3.1.0
05:38muhooeven weirder https://www.refheap.com/paste/4866 that's what results
05:39muhooadding that dependency explicitly, makes stuff disappear
05:39tomojwell the jackson-core-asl just got moved down as a dep to jackson-smile, right?
05:40muhoooh it's not under clj-aws-s3 anymore, but still there, i see it
05:40kralanyone knows if EuroClojure videos can be downloaded (maybe via torrent?)
05:41muhootomoj: i have to wonder if other stuff will break now. will try a lein check and see
05:42tomojwould be nice if you could see who asked for that missing class
05:44dhofstetkral: yes, they can be downloaded http://vimeo.com/euroclojure
05:46muhootomoj: it's in that stacktrace. gotta love errors on line 1 of a file :-/
05:47tomojso it's coming from cheshire
05:48muhoolooks that way. that's why... i'm suspicious that other things will break
05:48tomojbut you have cheshire 4.0.0 in deps, which specifies com.fasterxml
05:48muhoo*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
05:52tomojfwiw, with [clj-aws-s3 "0.3.2"] [cheshire "4.0.0"], I get no error requiring cheshire.core
05:54tomojthe 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
06:01kraldhofstet: oh, thanks
06:27clgvui new vids to view :)
06:28michaelr525what?
06:28clojurebotwhat is exceptions
06:28michaelr525err
06:28clgvclojurebot: botkick ;)
06:28clojurebotNo entiendo
06:29michaelr525a 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.
06:30clgvcan't you make sure that your functions always returns collections?
06:30michaelr525should I make my function return only a collection and use mapcat ?
06:31michaelr525i can but i'm not sure that I want to...
06:31clgvmichaelr525: do you need lazy? otherwise implement the combining logic via reduce that chooses between conj and concat
06:32michaelr525hmm
06:32michaelr525suppose that i need lazy..
06:33michaelr525i don't really need lazy, but i don't like writing that reduce - i'd rather make my function return only collections
06:33clgvthats probably better
06:34clgvI 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
06:34michaelr525i think that once someone here wrote some neat solution using (into)
06:34clgvincanter's selection of columns does (maybe did) that
06:35clgvmichaelr525: humm but into needs a collection as well
06:37michaelr525yeah
06:50clgvmichaelr525: you could also use (apply concat (map #(let [r (apply f %&)] (if (sequential? r) r [r])) coll))
06:55michaelr525clgv: yeah, i think that I'll take that route
06:56michaelr525now the problem is to find a suitable name for that function ;)
06:56michaelr525maybe (mapcat-always)?
06:56michaelr525(mapcat-anyway)
06:56clgvyour choice ;)
06:56michaelr525(mapcat-everything)
06:57michaelr525(map-my-cat)
06:58clgvthen you need an additional (map-my-dog) ;)
06:58michaelr525heh
06:59michaelr525i think it'll be something like this: (mapcat #(ensure-seq (my-function)) col)
07:00clgvI have assure-coll somewhere in my projects ;)
07:00clgvor even assure-vec?
07:04michaelr525settled on (mapcatz) :)
07:04clgvI demand (mapdogz) as well ;)
07:05michaelr525you are barking at the wrong tree ;)
07:56iDesperadOhow 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
07:57iDesperadOI read this doc time and time again, with no idea what project indents to do
07:58S11001001iDesperadO: rel means set
07:58iDesperadOhow rel means set?
07:58S11001001a set relates its elements to each other
07:59iDesperadOand there's xrel
07:59S11001001iDesperadO: try reading the docs of functions you're familiar with
07:59iDesperadOwhat a irony...I don't need to read the doc that I've already familiar with... only ones I'm not
08:00S11001001why is that?
08:01tomojsome of the clojure.set docs are just confusing
08:01tomoja rel is a set of maps ##(clojure.set/project #{{:foo 1 :bar 2} {:foo 3 :bar 4}} #{:foo})
08:01lazybot⇒ #{{:foo 1} {:foo 3}}
08:01S11001001thanks tomoj
08:02S11001001relational algebra ahoy
08:03iDesperadOtomoj: where can I find that a rel is a set of maps?
08:05iDesperadOtomoj: I mean if I can't understand the doc of a function, where can I turn to?
08:05clgviDesperadO: I think there is some more doc in the namespace docs
08:06clgviDesperadO: clojuredocs.org has often some examples on the usage
08:06iDesperadOah...
08:07iDesperadOclgv: then how to find namespace doc? like some docs about the namespace clojure.set?
08:08clgviDesperadO: http://clojure.github.com/clojure/ but there is none for clojure.set - seems I read it somewhere else
08:08iDesperadOclgv: I often miss python's help function which can tell me something like list/dictionary `help(list)/help(dict)`
08:10tomojiDesperadO: http://clojuredocs.org/clojure_core/clojure.set/project
08:10iDesperadOI'm reading it
08:11clgviDesperadO: in case you wanted project entries from a map - this is named select-keys
08:12iDesperadOso, 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???
08:12lazybotiDesperadO: How could that be wrong?
08:13tomojthey probably should
08:13iDesperadOI find clojure's doc is not friendly to newbies, at least to someone like me
08:23clgviDesperadO: 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
08:27iDesperadOclgv: 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
08:29iDesperadOclgv: 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...
08:30clgviDesperadO: ah ok. I think in clojure.core the docs are better.
08:33iDesperadOclgv: do clojure has some way to know something about a namespace?
08:33clgviDesperadO: you have to be more specific for a helping answer ;)
08:34clgviDesperadO: otherwise my generic answer is that the clojure cheat sheet has a section on namespace related functiosn
08:34iDesperadOlike 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?
08:35clgviDesperadO: nrepl is a third-party library. you'll have to find its project page and read the docs overthere
08:35pandeiroiDesperadO: i've seen (ns..) declarations annotated with :doc metadata
08:36pandeirobut i'm not sure how to retrieve that at the repl
08:36clgvclgv: most clojure projects have their source and documentation hosted on github
08:36clgv,(doc clojure.core)
08:36clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.core>
08:36gfredericks,(-> "clojure.core" find-ns meta :doc)
08:36clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol>
08:36clgvhumm shouldnt that work with 1.4?
08:36gfredericks,(-> "clojure.core" symbol find-ns meta :doc)
08:36clojurebot"Fundamental library of the Clojure language"
08:37gfredericks,(-> "clojure.walk" symbol find-ns meta :doc)
08:37clojurebotnil
08:37Bronsa((comp :doc meta find-ns) 'clojure.core)
08:37gfredericksyep, lots of docs there
08:37Bronsa,((comp :doc meta find-ns) 'clojure.core)
08:37clojurebot"Fundamental library of the Clojure language"
08:39iDesperadOseems only ((comp :doc meta find-ns) ns) can find doc only for clojure.core
08:39clgv,((comp :doc meta find-ns) 'clojure.test)
08:39clojurebotnil
08:39iDesperadOmostly it just returns nil
08:39clgv ,(-> "clojure.test" symbol find-ns meta :doc)
08:39clojurebotnil
08:39iDesperadOright
08:40clgvclojure.test should have some
08:40clgvcf. http://clojure.github.com/clojure/clojure.test-api.html
08:41iDesperadOclgv: I need to read the Overview part there
08:41iDesperadOright now I just want to read on my repl
08:41iDesperadOno to read it on the wed
08:41iDesperadOweb
08:42clgviDesperadO: then you are stuck with `doc` for function docstrings
08:42iDesperadOthe Overview part tells me what the ns is for and maybe some examples about the usage
08:42clgviDesperadO: probably, you should read one of the introductory books on clojure if you are serious about learning it - that'll speed you up
08:42iDesperadOI'm reading it
08:43iDesperadOclgv: clojure programming
08:43iDesperadOclgv: but...but I hope clojure's doc can be at least as good as python:)
08:46iDesperadOclgv: just my wishes:)
08:46wmealing_is there any ssl client/server certificate libraries for clojure, i'm not getting much luck with the google
08:46iDesperadOI'd better to finish my reading and start writing something
08:46clgviDesperadO: in the 1.4 release they did a lot of doc writing afair
08:46hyPiRioniDesperadO: It's going to be better... I hope.
08:46clgvwmealing_: try java libs?
08:47wmealing_clgv: might have to
08:47hyPiRionAt least Clojure developers are aware that the doc is bad, so it should be on a prioritized list.
09:05jcromartieI am torn over wether it's a good thing or a bad thing, that there is no standard command called "clojure"
09:06jcromartiea la scala, python, ruby, perl
09:06jcromartiealias clojure="lein repl" # goo enough
09:06jcromarties/goo/good/
09:11jcromartie,default-data-readers
09:11clojurebot{inst #'clojure.instant/read-instant-date, uuid #'clojure.uuid/default-uuid-reader}
09:12jcromartie,(println #uuid 1234)
09:12clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.AssertionError: Assert failed: (string? form)>
09:12jcromartiethis quits my REPL
09:12jcromartie,(println "I'm still here")
09:12clojurebotI'm still here
09:12gfredericks,(println #uuid "1234")
09:12clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Invalid UUID string: 1234>
09:13jcromartieI'm not trying to read a valid UUID :)
09:13jcromartieI just noticed it quit the REPL ("Bye for now!")
09:14jcromartielooks like it works in the latest leiningen though
09:16wilfredhis there any easy way to convert [:1 :2 :3] to [1 2 3] ?
09:16wilfredhrather than converting to a string, stripping the colon, then parsing the string as a number
09:19gfrederickswilfredh: name instead of str will save you a step
09:20gfredericks,(mapv (comp read-string name) [:1 :2 :3])
09:20clojurebot[1 2 3]
09:20jcromartieI'd imagine read-string is slower than Integer/parseInt
09:21S11001001jcromartie: yeah, but it works with all the integers fit to print
09:21jcromartietrue
09:22S11001001we had a prod bug caused by parseInt where we should have been read-stringing once
09:22gfredericks,(read-string "372824723724728477417915793579237952973479234375373733000N")
09:22clojurebot372824723724728477417915793579237952973479234375373733000N
09:23wilfredhgfredericks: thanks.
09:23S11001001wilfredh: in this case, though, you want to ##(-> :3 name first int (- (int \0)))
09:23lazybot⇒ 3
09:24jcromartiethere should be a better way to coerce a string into an integer number :)
09:24jcromartiewithout read-string
09:24jcromartieread-string is not eval, but it's close enough to make me nervous
09:24jcromartiemaybe I should relax
09:25S11001001wilfredh: I'm assuming your keywords are one digit each
09:25wilfredhafraid not
09:25jcromartieS11001001: why would you assume one digit?
09:25jcromartieoh, you're being silly :)
09:25xeqiheh, bind *read-eval* to false and you might be safe reading
09:26gfredericksjcromartie: read-string is perfectly awesome if you have read-eval off
09:26gfredericksit's just like reading json
09:26S11001001I guard it with [0-9]+ for integer reading
09:27wilfredh ,(mapv (comp Integer/parseInt name) [:1 :2 :3])
09:27clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0)>
09:27jcromartieWhere is "#=" documented?
09:27jcromartieit's not in http://clojure.org/reader
09:27jcromartieor is it
09:27gfredericks,(doc *read-eval*)
09:27clojurebot"; 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"
09:27jcromartieyeah
09:27jcromartiebut #= itself
09:27wilfredhwhy can't I use comp with Integer/parseInt?
09:27jcromartiewhy in the world would *read-eval* be true by default anyway
09:27jcromartiewho uses #=
09:27wilfredh(sorry for novice questions...)
09:28S11001001wilfredh: it's not a function; the gods of clojure are interfering with your repl to encourage you to use read-string instead :]
09:28gfredericksjcromartie: I think it's a lot less necessary now that there are data readers; I hope it gets defaulted to off
09:29jcromartiewilfredh: because it's a Java class method, not a Clojure fn
09:29jcromartiewhen Clojure sees Integer/parseInt by itself, it tries to access it as a static field
09:29babilenwilfredh: You can use (memfn Integer/parseInt)
09:29jcromartiethe source code of memfn is instructuve
09:29gfredericks,Integer/parseInt
09:29wilfredh ,(mapv (comp (memfn Integer/parseInt) name) [:1 :2 :3])
09:29clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0)>
09:29clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: parseInt for class java.lang.String>
09:30chouserThere's really no point in memfn now that we have #()
09:30babilenwilfredh: Or just use an anonymous function such as #(Integer/parseInt %) ...
09:30gfrederickschouser: point-free nerds!
09:31babilenchouser: Right, I use #(Foo/bar %) more often anyway.
09:31jcromartie(memfn Integer/parseInt) should work locally… I think clojurebot is doing something clever
09:31S11001001,(doc memfn)
09:31clojurebot"([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."
09:31stainchouser: unless it takes many arguments (unlikely for typical functional uses of memfn though)
09:32S11001001jcromartie: I think memfn makes member method calls
09:32jcromartie,((memfn Integer/parseInt) "1234")
09:32clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: parseInt for class java.lang.String>
09:33jcromartieweird
09:33jcromartieoh right
09:33hyPiRionjcromartie: Works only on methods, not static methods.
09:33S11001001ugh, I can't believe I said "member methods"
09:34hyPiRion,((memfn parseInt) 1 "1234")
09:34clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval55$fn>
09:34S11001001*instance*, S11001001, *Instance*
09:34hyPiRion,((memfn parseInt) "1234")
09:34clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: parseInt for class java.lang.String>
09:34jcromartieanyway
09:34hyPiRion,((memfn parseInt) (Integer. 1) "1234")
09:34clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval111$fn>
09:34jcromartieuse #(Integer/parseInt %)
09:34hyPiRionyeah - seems to be no way out of it.
09:35hyPiRionEventually, you could just fire off #(Integer. %)
09:35hyPiRion,(#(Integer. %) "1234")
09:35clojurebot1234
09:35S11001001sure there is, resurrect clojure.contrib.import-static and (import-static (java.lang.Integer read-string)) :]
09:35chousermemfn only supports instance methods
09:35S11001001hyPiRion: badness, no sharing instances of small nums
09:36hyPiRionS11001001: hm?
09:36hyPiRion,(identical? (Integer. "10") (Integer. "10"))
09:36clojurebotfalse
09:36S11001001,[(identical? (Integer/valueOf "1") (Integer/valueOf "1")) (identical? (Integer. "1") (Integer. "1"))]
09:36clojurebot[true false]
09:36jcromartieInteresting
09:37S11001001very annoying that deserialize doesn't exploit the shared pools
09:38chousermemfn also still requires points, as far as I understand the definition
09:38chouser,((memfn substring x y) "hello" 3 5)
09:38clojurebot"lo"
09:40chouserSo again, how is that better?
09:40chouser(#(.substring %1 %2 %3) "hello" 3 5)
09:41chouser,(#(.substring %1 %2 %3) "hello" 3 5)
09:41clojurebot"lo"
10:09nz-,(identical? (Integer/valueOf "1234567") (Integer/valueOf "1234567"))
10:10clojurebotfalse
10:10nz-,(identical? (Integer/valueOf "12") (Integer/valueOf "12"))
10:10clojurebottrue
10:11jeremyheilerInteger caches the first 128 Integers, I think.
10:11casion256
10:11hyPiRionjeremyheiler: The cache is from -128 to 127
10:12hyPiRionI believe.
10:12casionhyPiRion is correct
10:12jeremyheileryep, you're correct, just found it
10:12casionI spent an hour figuring out that same thing last night
10:18S11001001java FindBugs warns against using new Integer et al for this reason
10:21casion,(identical? (int 13) (int 13))
10:21clojurebottrue
10:21casion,(identical? (int 313) (int 313))
10:21clojurebotfalse
10:25S11001001this 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:26technomancyusually that's done through fixnums though, which the JVM unfortunately lacks
10:27casionwith boxing ints to Integers in 1.4, I think it becomes a bit silly
10:27nvy,(identical? 1311 1311)
10:27clojurebotfalse
10:27S11001001because some implementor decided to have separate value and reference types instead of a unified value model
10:27nvyman what
10:28nvy,(identical? (- 1311 1311) (- 1311 1311))
10:28clojurebottrue
10:28S11001001nvy: that's nothing, this is allowed in r5rs scheme: (let ((x #\a)) (eq? x x)) => false
10:28nvyI've never heard of R5RS before
10:29jeremyheilerS11001001: Why?
10:29arrdemS11001001: what in the seven hells...
10:29technomancynine
10:29arrdem%s/seven/nine/g
10:30samratin Noir-async, how do I do a push on the completion of a future?
10:30technomancyseven is purgatory =)
10:31S11001001jeremyheiler, arrdem: to allow lexical binding strategies that don't necessarily map to the object-identity space
10:32S11001001I wonder...
10:32S11001001,(let [x 12343] (identical? x x))
10:32clojurebotfalse
10:32hyPiRionWell, I mean
10:32S11001001thought so
10:32hyPiRionYeah.
10:33arrdem,(doc identical?)
10:33clojurebot"([x y]); Tests if 2 arguments are the same object"
10:33casionI think I'm just going to avoid all lisps forever now
10:33arrdemah.
10:33hyPiRion,(let [x (atom 12343)] (identical? x x))
10:33clojurebottrue
10:33arrdem(dec casion) ; shun the non-beleiver
10:33lazybot⇒ -1
10:33casionlol :)
10:33gfrederickswait why the non-identical 12343's?
10:33S11001001casion: 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:34chouserfirst, let's be clear that identical? often lets you see implementation details. "Equality" in any reasonable sense is implemented in = or ==
10:34S11001001it'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:35weavejestertechnomancy: ping
10:35hyPiRion,(let [a (Integer. "1000")] (identical? a a))
10:35clojurebottrue
10:35arrdemsee... the (identical?) I can understand I guess. The (eq?) hacks me off a bit.
10:35S11001001arrdem: eq? is identical?
10:35arrdemS11001001: srs5 eq? as mentioned above
10:35casionS11001001: it doesn't make any sense to me atm at all
10:35S11001001casion: you saw the recent discussion on clojure about how take-while requires its pred be pure?
10:36arrdem(inc hyPiRion)
10:36lazybot⇒ 3
10:36S11001001arrdem: what?
10:36arrdemhang on I'm having a revalation
10:36casionS11001001: no
10:37S11001001casion: okay, ##(doc take-while) why make that restriction on pred?
10:37lazybot⇒ "([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."
10:38casionS11001001: I don't know. I've never understood the use of 'must' in that sentence
10:39S11001001casion: it's a requirement about the pred you pass in
10:39hyPiRion,(let [eq? (fn [a] (identical? a a))] (eq? 1000))
10:39clojurebottrue
10:39S11001001casion: must has the meaning from rfc 2119, if you want further documentation :)
10:39nvygreat
10:40chouser,(keep #(when-not (identical? (read-string %) (read-string %)) %) (map str (range -130 130)))
10:40clojurebot("-130" "-129" "128" "129")
10:40casionS11001001: one moment
10:42casionS11001001: yeah, I have no idea
10:43chouserso, 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:43djanatynhmm. records and protocols are kind of cool.
10:43S11001001casion: 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:44djanatynis there anything that makes them very different from regular classes and generic methods?
10:44hyPiRionThe 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:44hyPiRionAs far as I can understand.
10:44djanatynI'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:45gfrederickshyPiRion: so it is a primitive long before being passed in as args?
10:45casionS11001001: is this to avoid things breaking if/when take-while is changed, or does it apply to the current implementation?
10:45S11001001casion: 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:46S11001001And 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:47jeremyheiler&(let [x 1234] (identical? x x)) ; even for this?
10:47lazybot⇒ false
10:48hyPiRiongfredericks: Well, it certainly seems like it.
10:49nvyjeremyheiler: I'm a newbie, but I think in your case, x is not an object before it reaches identical?
10:49hyPiRion,(let [eq? (fn [a] (let [b a] (identical? a b))) c 1000] (eq? c))
10:49clojurebottrue
10:49jeremyheilerah... makes sense
10:49nvyit is a primitive
10:49casiongfredericks: 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:49casionsince clojure seems to promote to long quite liberally
10:49casionand early
10:50gfrederickscasion: promoting to long is slightly different from boxing
10:51gfredericksboxing is the issue here I think
10:52casiongfredericks: I thought boxing only every happened with similar types in clojure, int->Integer, long->Long etc..
10:52casionever*
10:52hyPiRionSo it's boxed in a Long when sent as a parameter to a function.
10:52gfrederickscasion: in 1.3 it started promoting to longs as well
10:53casionah ok
10:53technomancyweavejester: hi
10:53casionwell, it's all very confusing to someone who's used to C ;)
10:53weavejestertechnomancy: 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:55technomancyweavejester: I was waiting for chouser's patches to do the next release, but at this point I've probably waited long enough
10:55weavejestertechnomancy: Thanks :)
10:56chousertechnomancy: sorry :-(
10:56chouserweavejester: sorry :-(
10:56technomancychouser: well it's been an convenient excuse
10:57weavejesterI just want mva's NPE fix :)
10:57technomancyI'll see if I can push it out later today
10:58weavejesterNo real hurry. I forked the repo and pushed a version to a custom group in clojars in the meantime.
11:26naegwould be great if someone could help me with a bit-fiddling code in clojure: http://bpaste.net/show/deSQBXgSWer59qAqshCM/
11:26clgvcan I use (derive :a :b) without namespace qualification of :a?
11:27naegit's a neat algorithm for checking whether a player has won a connect four game
11:30clgvah, I need an own hierarchy...
11:31chouserclgv: keywords in hierarchies must all be namespaced, iirc
11:31scriptornaeg: does >> have a higher or lower precedence?
11:31scriptor*higher or lower than *
11:31clgvchouser: nope. only in the global one afair
11:31clgv,(doc derive)
11:32clojurebot"([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:32scriptorah, looks like its lower
11:34naegscriptor: I'm fiddling around with the code, but it always returns 0 where it should return 1 afaik
11:34naege.g. for number 15
11:46canweriotnowdid something change recently with clojure.java.jdbc?
11:47chouserclgv: sure enough. Interesting.
11:47clgvchouser: it's not in the docstring but in the assert in the source
11:48clgvshould be mentioned in the docstring though
11:48lispnikhi, 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:48pjstadigcanweriotnow: why do you ask?
11:49pjstadigare you on 1.3/1.4?
11:49pjstadig(clojure that is)
11:50pjstadigthere are some "unexpected" interactions between clojure 1.3/1.4 and databases containing bigint columns
11:50canweriotnowI'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:50canweriotnowI'm on 1.3.
11:50canweriotnowI'm not even connecting at this point...
11:50canweriotnowand I don't think any of the columns are bigint, anyway :-/
11:52canweriotnowI've got classname, subprotocol, sub name, user, password keys in the db spec hash… can't figure out what's missing.
11:57lispnikcanweriotnow: can you paste the db spec? (sans credentials)
11:58lispnikcanweriotnow: and a stack trace
12:01canweriotnowlispnik: yeah, one sec, working on two machines, thx :)
12:07canweriotnow(defn bbts-dev []
12:07canweriotnow { :classname (get-property "acedia.bbts")
12:07canweriotnow :subprotocol (get-property "acedia.bbts.subprotocol")
12:07canweriotnow :subname (str "@" (get-property "acedia.bbts.dev.host") ":" (get-property "acedia.bbts.dev.port") ":" (get-property "acedia.bbts.dev.sid"))
12:07canweriotnow :user (get-property "acedia.bbts.dev.user")
12:07canweriotnow :password (get-property "acedia.bbts.dev.password")})
12:07canweriotnoweh, lemme do a gist, sorry...
12:08canweriotnowlispnik: https://gist.github.com/2a2e87c24e495cf340f5
12:08lispnikcanweriotnow: have you checked the return values of each of those get-property calls?
12:08canweriotnowyup… all correct.
12:10lispnikwhat db is this for?
12:10lispnikoh oops
12:10lispnikjust saw you have that in your gist
12:12canweriotnowlispnik: having the same problem with MSSQL, though (multi-db app;ication)
12:13canweriotnowThinking of trying it with my postgres system just to be sure, but… yeah, I don't get it. this all worked previously.
12:13muhoois 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:14muhooin other words, 1) whenever the repl starts, and 2) whenever the user connects to it.
12:14technomancymuhoo: for 1) you can put an :injections key in the :repl profile
12:14technomancyyou might need to copy the :dependencies from Leiningen's :repl profile since the one in your project will shadow Leiningen's
12:15muhoothey don't merge?
12:15technomancyno, profiles of the same name shadow existing ones
12:15unlinkIs there an if form that wraps its else block in an implicit do?
12:15muhoothanks. any idea about (2)?
12:15technomancyotherwise there's no way to support removing things that Leiningen brings in implicitly
12:16technomancymuhoo: that'd be more of an nrepl question
12:17muhoook
12:17lispnikcanweriotnow: sorry i got nothing… perhaps in the full stack trace there is an indication on what param it's complaining about
12:18canweriotnowlispnik: okay, thanks anyhow.
12:25uvtcI'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:27uvtcWhat 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:35samfloresuvtc, I'm using something like this: https://gist.github.com/3623177
12:36samfloresit's basically what your are doing
12:36samflores*you
12:40uvtcsamflores: Thanks. Why are you using `clojure.java.io/resource` instead of just having `slurp` grab the file?
12:46uvtcWhat is the purpose of clojure.java.io/resource?
12:47gfredericksget a fileish thing on the classpath without having to worry about if you're in an FS project or a jar or etc?
12:48austinhDoes anyone have an example of using virtual hosts with Clojure/Jetty?
12:49austinhI'm getting a ClassNotFoundException when importing org.eclipse.jetty.servlet.ServletContextHandler and I can't figure out how to proceed.
12:52mrb_bkdnolen: are there any decent technical book stores in NYC
12:53dnolenmrb_bk: hmm ... I always order everything online.
12:53mrb_bkdnolen: same, i wish there was a great used store though
12:53dnolenmrb_bk: oh right, yeah I get most of my of used books off amazon
12:54mrb_bkdnolen: i want a copy of bratko's AI book
12:55duck1123austinh: you're trying to run multiple hosts in the same application?
12:57dnolenmrb_bk: there's a newer 4th edition now w/ quite a bit of new material it seems.
12:57austinhduck1123: yes
12:57xeqiuvtc: clojure.java.io/resources will read resources inside of jar files
12:57uvtcgfredericks: 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:58S11001001uvtc: like in jars
12:58mrb_bkdnolen: hmm, will look into that, thanks!
12:58xeqioh, gfredericks already said that
12:58S11001001as xeqi said
12:59uvtcxeqi S11001001 : Thanks. So, it could return a URL that points into a jar? What would that look like?
12:59S11001001uvtc: ask for clojure/core__init.class and find out :)
12:59duck1123austinh: 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:00TimMcIt is?
13:01uvtc,(str (clojure.java.io/resource "clojure/core__init.class"))
13:01clojurebot""
13:01uvtcGive me results on my system though. Thanks, S11001001 .
13:01uvtc"jar:file:/home/john/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar!/clojure/core__init.class"
13:02duck1123TimMc: If he was just trying to run two domains, I would suggest having 2 apps with a common frontend http server
13:03uvtcgfredericks: tanks.
13:03uvtcgfredericks: also, *thanks.
13:08austinhHow 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:10S11001001austinh: you a leiningen user?
13:10austinhS11001001: Yes, but I currently run everything using clojure-jack-in and evaluating in the buffer.
13:10nDuffaustinh: ...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:11uvtcaustinh: you can import any java classes on your classpath.
13:11nDuffaustinh: (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:12S11001001austinh: then, as nDuff said
13:12clojurebotExcuse me?
13:12nDuffaustinh: ...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:13austinhOk, so are classes under org.eclipse.jetty available because ring-jetty-adapter depends on org.eclipse.jetty/jetty-server?
13:13nDuffaustinh: ...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:13nDuffaustinh: org.eclipse.jetty is just where jetty-server comes from
13:13nDuffaustinh: it doesn't guarantee that it gives you all of org.eclipse.jetty
13:13austinhRight. That's what I thought.
13:13nDuffaustinh: ...you'd have to look at the docs for jetty-server to know exactly what is and isn't included
13:13uvtcaustinh: 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:14austinhI was wondering why some classes under org.eclipse.jetty can be imported, but others are not found.
13:14nDuff*nod* -- you'll have to find out which packages the ones you need that aren't there come from and add them.
13:14austinhI see. Thank you all.
13:14nDuffIf you were in an OSGi container, the explanation would be longer and much more complicated, but if you were, you'd probably know. :)
13:15austinhI don't even want to know.
13:16uvtcaustinh: 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:17austinhuvtc: Thank you.
13:18uvtcaustinh: y/w.
13:24austinhIs 'lein search' deprecated?
13:24technomancyaustinh: you need to be running preview10 for it to work properly
13:25technomancysince maven moved the index location for central
13:25technomancys/maven/sonatype/
13:25austinhOk, I just updated. Thanks.
13:33cemericktechnomancy: unbelievable
13:33cemerickno redirect?
13:33technomancycemerick: err--they changed the format too
13:34cemerickawesome
13:34technomancysupposedly the old indices were the "legacy" ones
13:35technomancyprobably there's a mailing list I should be on so I would find out about these things before they happen? dunno
13:35cemerickSeems like something like central shouldn't break APIs/paths until the heat death.
13:36xeqidoes the same hold for clojars?
13:36technomancycemerick: I have a bit of sympathy since the old indices were huge, monolithic, and crazy slow.
13:36technomancyand the new format allows for incremental updates
13:36canweriotnowtechnomancy: does lein2 change any behavior re: loading libs from the system class path, i.e., jdbc drivers?
13:37technomancycanweriotnow: yeah, we now ignore $CLASSPATH
13:37cemerickSure. 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:37technomancywe'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:38technomancycemerick: I think it's more a problem of bandwidth costs
13:38canweriotnowtechnomancy: 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:38technomancycanweriotnow: you need to get them into a repository
13:39canweriotnowso, e.g., lein-localrepo should solve it?
13:39cemerickxeqi: Dunno. How many tools depend upon clojars APIs? Is the population depending on them growing, shrinking, or flat?
13:40cemerick(rhetorical questions there)
13:40technomancycanweriotnow: if you're just working on the project solo that's fine
13:40canweriotnowI have to say, Clojure's stack traces (well, really jvm's) make me miss the CL REPL :)
13:40technomancycanweriotnow: otherwise you'll want to set up a private repository, which can be just a pile of files served over HTTP
13:41canweriotnowtechnomancy: 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:49technomancycemerick: 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:49technomancyso 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:01MosesI'm getting bugs when trying to use Marginalia, anyone have any experience using it?
14:02MosesSpecifically its telling me I can't create an ISeq from a clojure.lang.Symbol
14:04dnolen_Moses: does your own code compile?
14:04MosesYes
14:05hiredmanare you sure?
14:05MosesShit, I just figured it out
14:05MosesI apologize
14:05MosesIn Defproject, I had :dev-dependencies [lein-marginalia "0.7.1"]
14:06MosesShould have been :dev-dependencies [[lein-marginalia "0.7.1"]]
14:06technomancy:plugins [[lein-marginalia "0.7.1"]] actually
14:07MosesOh @@
14:08MosesBTW, to anyone that hasn't played with it yet, I just got it working, and I'm already in love with it!!!
14:08MosesThanks :technomancy
14:08technomancynp
14:17amalloyseancorfield: you around? stackoverflow noticed an issue with data.priority-map
14:18pandeirocemerick: is there a way i can use vars from another ns referring to javascript fns as strings with clutch/view-server-fns?
14:19cemerickpandeiro: Not sure what you mean.
14:19cemerickOh, you just want to push some code-as-strings to the server?
14:19pandeirocemerick: yup
14:19pandeiroit seems to be just taking the symbol and converting to string
14:20pandeiroinstead of resolving it
14:20pandeiromaybe just don't use view-server-fns but update-document instead?
14:21ToxicFrogThis marginalia thing looks neat.
14:25cemerickpandeiro: or force the resolution of the var at read-time with syntax-quote
14:27pandeirocemerick: gotcha, but view-server-fns really isn't nec for my case i'm thinking
14:27pandeiroi do love how easily you can write :cljs views
14:27cemerickpandeiro: sure, if you're comfortable with the expected layout of view docs, then have at it with update-document
14:27pandeirobut the compilation time is killing me every time i restart the server while i am developing
14:28pandeirocemerick: thanks, sorry to bother
14:28cemerickno bother :-)
14:28cemerickI 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:29SegFaultAX|work2Anyone else having trouble submitting solutions on 4clojure?
14:32amalloyargh, 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:44whitakerAnyone here familiar with issues using noir.util.test to drive noir-async related tests?
14:45whitakerBackground...
14:46whitakerRelevant lein deps: [noir-async "1.1.0-beta9"] and [aleph "0.3.0-beta2"]
14:46whitaker:use'ing noir.util.test
14:47whitaker(and midje.sweet, though errors are the same with noir.test/deftest versions, I checked)
14:47juhu_chapaHi all! Why the following expr returns false: (case "A" Class/staticValueEqualsToA true false)
14:47whitakerExample:
14:47hiredman,(doc case)
14:47whitaker(facts "about 'GET /server-name'"
14:47whitaker (:status (send-request "/server-name")) => 200)
14:47clojurebot"([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:48whitakerIn core:
14:48whitaker(na/defpage-async [:get "/server-name"] [] conn
14:48whitaker (na/async-push conn (str server-name "\n")))
14:48whitakerWorks fine in the browser and on the command line
14:48whitakerBut:
14:49whitakerjava.lang.IllegalArgumentException: No implementation of method: :subscribe of protocol: #'lamina.core.result/IResult found for class: nil
14:49whitakerI have RTFM'd for days on this issue
14:49whitakerThe 'na', by the way: required [noir-async.core :as na]
14:50hiredmanwhitaker: most likely noir's automatic code reloading is breaking lamina's protocols
14:50whitakerAh
14:50whitakerHmm
14:51whitakerAny suggested workaround? Lemme break out my -main, one sec...
14:51hiredmanwhitaker: please don't
14:51whitakerok
14:51whitaker?
14:52hiredmanwhitaker: 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:52whitakerI'm not emotionally tied to it
14:52MosesJust curious, what's wrong with noir?
14:52hiredmandon't use noir, and don't use automatic code reloading
14:52whitakerI'm open to suggestions
14:53whitakerhiredman: what do you prefer?
14:53whitakerAnd is there a flag I can pass to disable auto code reloading?
14:53hiredmanMoses: 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:53hiredmanI use ring and compojure
14:53MosesAh, thanks.
14:54technomancycompojure's route definitions are a lot nicer
14:54technomancyit's easy to see everything in one place, but also easy to follow things if you do need to spread them out
14:54whitakerIn the last day, I've gotten the sense that noir isn't as… clean as its promoters might claim it to be.
14:54hiredmanI 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:56whitakerI'm certainly at wits' end, and am perfectly willing to rip out all the noir code and try that approach.
14:57whitakerProblem for me is this, though: I need to be able to do websockets.
14:57technomancypart 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:57whitakerI found noir-async, and was trying to make it work, defining defpage-async where necessary and defaulting to defpage elsewhere.
14:58Apage43aleph has websocket built in, no?
14:58whitakeryes
14:58whitakernoir-aysnc is written on top of aleph
14:59whitakers/noir-aysnc/noir-async
15:00MosesWhat 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:00Apage43whitaker: 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:00Apage43as long as you wrap in both places it should work asyncly
15:01RaynesMoses: Compojure is just the routing portion of things. It is very specific and you definitely need other stuff to build a complex website.
15:01whitakerApage43: much obliged, thanks
15:01technomancyMoses: 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:01weavejesterMoses: I use Ring/Compojure/Hiccup with Environ for handling the config and Lein-Ring for running/testing.
15:02RaynesMoses: There is Hiccup, Enlive, and Stencil (mustache) for templating.
15:02weavejesterI've also been working on Ragtime for migrations, and it's about ready for use.
15:02Raynestechnomancy: Eh, if Hiccup or Enlive were my only options for templating I'd probably write websites in Haskell.
15:02weavejesterOuch! :)
15:02kingtimkingtim, D#scu3v3
15:02MosesThank 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:02Raynesweavejester: Not that there is anything wrong with Hiccup!
15:03SrPxIs it possible to make macros so #(1% etc) can feature nested functions?
15:03weavejesterHaha :)
15:03technomancyHiccup is a joy for me to use but a bitter pill to swallow if you have non-clojurists working on a project.
15:03Raynestechnomancy: Hiccup just got messy for me with larger projects, and it got harder for things to grow.
15:03technomancyI want to like Enlive, but I get lost working with it so easily =(
15:04TimMcJust needs a different API, I think.
15:04technomancylikely
15:04whitakerAs 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:04RaynesI still use hiccup for tryclj, though people have sought to change that (TimMc), but I have persevered.
15:04dnolen_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:04technomancythat's kind of indicative of the problems with noir in general
15:04TimMcI want to carve out some time to write relying code against that non-existent better Enlive API.
15:05technomancyorthogonal things aren't exposed orthogonally; everything's bundled together
15:05dnolen_technomancy: it's complected for sure. But decomplecting is often an incremental affair.
15:05whitakerdnolen_: thanks. And to technomancy's point, it might not be worth the bother to fork/pull request a fix.
15:06dnolen_whitaker: sure, which I'm sure you'll figure out soon enough ;)
15:06UrthwhyteWhile you guys are on the topic of web dev stuff, could you suggest a sinatra-esque clojure framework?
15:06Raynestechnomancy, dnolen_: If you decomplect Noir you get Compojure.
15:06technomancyactually my other complaints I were thinking of were with korma now that I think about it
15:06RaynesI recently came to that realization.
15:06UrthwhyteI'm a Python/Ruby guy who learned Scheme as his first language and is trying to get back into lisp
15:06whitakerdnolen_: heh… "complected"… I just yesterday listed to Rich Hickey's talk wherein he (re)introduces that archaicism into the language
15:06dnolen_Raynes: having things decomplected doesn't mean sugar ain't good.
15:06Raynesdnolen_: But there isn't really any sugar there.
15:07RaynesIt's just a slightly different syntax for routes with mutability tying them together instead of an outer defroutes.
15:07RaynesAnd because of that, a whole host of issues with doing interesting things with middleware and such.
15:08dnolen_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:08SegFaultAX|work2amalloy: I'm sorry. I just had to hammer the API endpoint for 4clojure for about 30 seconds.
15:08whitakerUrthwhyte: 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:09RaynesSegFaultAX|work2: You reduced amalloy's health bar to half!
15:09Urthwhytework for me right now is Java :/
15:09SegFaultAX|work2Raynes: :D
15:09Urthwhytewell, internship
15:09Raynesamalloy: Quick, quaff a health potion!
15:09SegFaultAX|work2Raynes: I was making this: https://gist.github.com/3607101
15:09Urthwhyteso much boilerplate :(
15:09SegFaultAX|work2Raynes: All my solutions. Need to collect the title and difficulty for each problem I've solved.
15:10amalloySegFaultAX|work2: why would i care? hammer away; i don't think a single computer can generate enough traffic to do much damage
15:10RaynesSegFaultAX|work2: You should make a little website for extracting solutions like that for other people.
15:10RaynesI'm sure people would find it useful.
15:10SegFaultAX|work2Raynes: I talked to amally about extending the API to allow fetching of solutions.
15:10Raynesamalloy: I think people get wrong ideas about the fragility of our infrastructure because of how 4clojure goes down all the time.
15:10SegFaultAX|work2Raynes: To do this I had to ask for a dump right from mongo.
15:10ivaraasenwhitaker: somewhat similar situation here. I study petroleum engineering. lots of Matlab and Java spaghetti code.
15:11pandeiroi 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:11pandeirothat is what i myself have resorted to
15:11UrthwhyteI've been tempted to write a book wrapped around 4clojure
15:11amalloywell yes, i suppose that's a fair assumption for them to make. because our infrastructure is rubbish
15:11Raynespandeiro: That's basically my idea.
15:11technomancypandeiro: yeah, I wrote a template for heroku compojure apps that adds stacktrace middleware, environ, and drawbridge
15:11Raynesamalloy: Well, not really. We can handle a huge load (lol), it just goes down because we allow code eval in a shitty sandbox.
15:11pandeirokind 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:12technomancypandeiro: the great thing about templates is that they expose the composition of orthogonal components in really visible ways
15:12SrPxWow is it me or this channel is way more active than when I first came in?
15:12SegFaultAX|work2SrPx: That depends on what you first came in I think.
15:12whitakerivaraasen: 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:12SrPx4 months ago SegFaultAX|work2
15:12amalloyright. 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:12Urthwhytewhitaker, ivaraasen: It's better than sage ;)
15:12hiredmanwin 15
15:13SegFaultAX|work2amalloy: Did you see the output of the dump you gave me?
15:13amalloyyeah, it's pretty
15:13amalloyi command you! add an API endpoint to expose user solutions!
15:13SegFaultAX|work2I feel ashamed, though. I did it in Python.
15:13SegFaultAX|work2I don't know the json, HTTP, and file IO APIs yet.
15:14SrPxAnyway, 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:14amalloycheshire, slurp, and clojure.java.io, respectively, probably solve your problems
15:15SegFaultAX|work2amalloy: Yea, I'm just not quite there yet.
15:15SegFaultAX|work2amalloy: My additions to 4clojure API might be my first actually beneficial addition in Clojure :)
15:15SegFaultAX|work2Scrum time, bbl.
15:16amalloySrPx: 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:16shaungilchristSrPx: it sounds like you want type based "apply"
15:17ivaraasenwhitaker: 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:17whitakerHuh… 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:19whitakerivaraasen: 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:20lnostdalhi 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:21TimMcinheritance?
15:21clojurebotmultiple inheritance is http://www.piratejesus.com/nerdcore/nerdcore017.gif
15:21whitakerSomeone 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:21TimMcnot helpful, clojurebot
15:21SrPxamalloy: #(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:21dnolen_lnostdal: not really. wouldn't be hard to construct something from scratch if you really want it. otherwise just use delegation.
15:21weavejesterThe drawbridge example could probably be more concisely expressed with the context macro
15:21SrPxamalloy: or, in other words, a short syntax for lambdas which allows nested functions
15:22ivaraasenwhitaker: just found a small implementation of SGD in Clojure myself
15:22lnostdalok, thanks
15:22weavejestere.g. (context "/repl" [] (cemerick.drawbridge/ring-handler))
15:22whitakerivarassen: in the Incanter libs?
15:22ivaraasenwhitaker: no, it's this small repo on github
15:23whitakerurl pls?
15:23dnolen_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:25lnostdaldnolen_: hm, yeah .. just single dispatch would at least (jvm limitation i think)
15:26lnostdalbut even that would be good enough for many cases ..
15:28whitakerOK, 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:28ro_stis there a way to have ring force no-cache on all the stuff it serves?
15:29weavejesterro_st: Add some middleware to add a no-cache Cache-Control header?
15:29ro_stsimple as that?
15:29ro_stwill that work for static resources, too? i'm using noir
15:31Urthwhyteif your static resources are being served through ring there's no reason it wouldn't
15:35pandeiroweavejester: where is the drawbridge example you were referring to?
15:36weavejesterpandeiro: Oh, on it's README. When I Github-searched, I got technomancy's repo first, so I mistook who was maintaining it.
15:36weavejesterpandeiro: Github search could be better :/
15:37ro_stthis should do it, right? https://www.refheap.com/paste/4872
15:38pandeiroweavejester: np, found it; re: github i do like the repo filter box on individual users' pages tho
15:40ro_stthat middleware breaks static stuff
15:41cemerickweavejester: I would have used context, but I didn't want to require compojure.
15:42weavejestercemerick: I just meant on the example in the README, not in the library
15:42cemerickSure. s/require/presume, then
15:42pandeiroweavejester: 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:43ro_stpandeiro: what does multiple (context "/" …) do?
15:44ro_stif that allows all of them to operate, perhaps api/endpoints could do this internall
15:44ro_sty
15:44pandeiroro_st: i am still clunky with ring handlers at the rEPL, gonna try to see that though
15:45ro_stin api, (defroutes endpoints (context "/" (composed1/endpoints)) (context "/" (composed2/endpoints))
15:46ro_sti'm also a compojure noob so that could blow up
15:46weavejestercontext tables a set of bindings
15:46weavejestertables=takes
15:46pandeiroro_st: i'm wondering if i can just do (context "/api" [] auth/endpoints user/endpoints document/endpoints) or similar
15:46weavejesterAnd there's no point in doing (context "/" …) :)
15:47weavejesterpandeiro: That's valid, if all the endpoints are handlers
15:47pandeiroright i understood context is just to avoid having to retype an internal part of the path
15:47ro_sthow would pandeiro compose multiple defroutes into a single context, weavejester?
15:47ro_stah
15:47weavejesterRight
15:47pandeiroweavejester: all the endpoints are defroites
15:47SrPxAs 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:47pandeirodefroutes
15:47ro_stsuper!
15:48weavejesterro_st: It's routes all the way down. defroutes (or routes) just combines multiple routes into one.
15:48ro_stneat
15:48pandeiroit is a pleasure learning compojure
15:48SrPxro_st: ? ;s
15:49ro_stweavejester: using noir, why would https://www.refheap.com/paste/4872 cause all my static files to 404 instead?
15:49ro_stforgive my laziness in asking you this. been a long day :-(
15:49amalloySrPx: that syntax is not possible, and as an uninvited editorial it sounds like an awful thing to have if it were possible
15:49cemerickSrPx: No.
15:50SrPxamalloy: why?
15:50shaungilchristit does not really make sense why %a would refer to one application and %b to the next
15:51shaungilchristor is that what the single quote after b is meant to denote?
15:51weavejesterro_st: I can't see anything wrong with that middleware. Could it be something else? Perhaps where you apply it?
15:51amalloyit's an absurdly over-specialized syntax for a very rare thing to want to do
15:51SrPxshaungilchrist: %b would refer to the next because of the '. It could be anything else
15:51SrPxshaungilchrist: yes
15:51weavejester,(assoc-in nil [:headers "Foo"] "Bar")
15:51clojurebot{:headers {"Foo" "Bar"}}
15:51SrPx(%a %b'' %c') would get a, then c, then b, of hashes, in order of application
15:51weavejesterro_st: If (handler request) returns nil, then the assoc-in would change it into a map.
15:52SrPxSo bad it is not possible }:
15:52SrPxbut oaky
15:52shaungilchristwell such a thing could be done but with a normal macro e.g. (craziness [:a :b']) etc.
15:52SrPxthanks
15:52ro_stah, that's good to know
15:53amalloyentertainingly, ro_st, monads don't have anything to do with SrPx's problem, but a maybe monad would have avoided yours
15:54ro_stok i'm doing something basically wrong. the headers i'm adding aren't the issue
15:54ro_stamalloy: -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:54SrPxshaungilchrist: 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:55dnolen_SrPx: it's possible
15:56shaungilchristSrPx: 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:57SrPxshaungilchrist: yes. I was not sure people were saying it was not possible because of the syntax or because macros couldnt do the job
15:57SrPx(the problem is that my syntax was conflicting with clojures, right?)
15:58dnolen_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:58shaungilchristyes, you just need to examine the symbols
16:00ro_sthey dnolen_! how's the source map quest going?
16:01ro_stah. 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:02ro_stRaynes! help! :-)
16:02SrPxdnolen_: Nice!
16:02SrPxJust another question
16:03dnolen_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:03SrPxIs 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:03ro_styou mean from cljs compiler
16:03dnolen_ro_st: after that it'll be figuring what the best way to merge that info is.
16:04dnolen_SrPx: no
16:04ro_stSrPx: that's the clojure reader's job. rhickey has the keys to that.
16:04shaungilchristSrPx: "yes" but with the caveat that it would in fact be a preparser step
16:05shaungilchristso you'd be creating .clsrpx files
16:05ro_stgithub.com/lynaghk/cljx for a fun example of that
16:05kennethhey what happens if a thread throws an exception
16:06ro_styou wanna narrow that question down some, kenneth? some folks might get wordy on you
16:06ro_st-grin-
16:07solussdDoes anyone have any idea what this means? (clojurescript is throwing it: uncaught exception: No dispatch macro for m
16:07hiredmanyou have #m somewhere
16:07hiredman,#m
16:07clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
16:07hiredmanclojurebot: jerk
16:07clojurebotyou cut me deep, man.
16:08hiredman,#m foo
16:08clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag m>
16:08abalone~loop
16:08clojurebotLOOP is complect complected
16:08solussdoh geez.
16:09abaloneif i want to poll for a condition, is there something i should use instead of loop?
16:09TimMcabalone: Have you looked at while?
16:09amalloyhiredman, 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:09kennethalright, 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:09hiredmanamalloy: he is using clojurescript
16:09solussdhiredman: afaict i do not… :/ hmm… I'll keep looking I guess
16:09kennethwill the main thread catch them, will they crash the program, crash just the thread?
16:09TimMc,# m foo
16:09hiredmansolussd: don't worry, you do, you'll find it
16:09clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag m>
16:10amalloy$google java thread uncaughtexceptionhandler
16:10lazybot[Thread.UncaughtExceptionHandler (Java 2 Platform SE 5.0)] http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.UncaughtExceptionHandler.html
16:10TimMcsolussd: Look for /#\s+m/
16:10TimMcyou probably have whitespace between the two
16:10amalloyTimMc: no good; it's probably being generated by some code somewhere, and he's barfing when he reads it
16:11solussdoh, space after the #, got it..
16:11kennethoh, also, is there a way to pretty-print an exception from the object
16:11solussdsecond the "must be generated"..
16:12SrPxshaungilchrist: but wait. with that you mean it would not be a dynamic behaviour, right?
16:13SrPxshaungilchrist: 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:13solussd,#m blah
16:13clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag m>
16:13solussd,# m ldsfkj
16:13clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag m>
16:13abaloneTimMc: is there something like while which lets me refer to the result of the test?
16:13SrPxro_st: reading about that brb
16:13solussdyeah, that was it-- "serialized" record being fed to clojurescript
16:14solussdor, printed record, rather
16:14abaloneTimMc: 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:16whitakerdnolen_ technomancy & others: thanks for help earlier, looks like ring + compojure works fine for me.
16:19TimMcabalone: loop is probably better, then.
16:19TimMcMake a let-while or something.
16:19TimMc*while-let
16:20amalloyabalone: what condition are you polling?
16:30bergelmiris there something special i need to do to install :dev-dependencies?
16:31bergelmiri have "lein-conjure" in :dev-dependencies but it won't be installed by "lein deps"
16:31clojurebotlein deps is the equivalent of taking the cartridge out and blowing on it
16:31technomancybergelmir: :dev-dependencies are deprecated; they're only used in lein 1.x
16:31technomancyconjure, huh? is that still around?
16:32TimMctechnomancy: Oho, "deprecated". Is lein 2.x released?
16:32technomancyTimMc: it's released enough.
16:32TimMcheh
16:32bergelmiri have lein 2.0.0-p7 installed
16:32technomancybergelmir: yeah, whatever docs told you to put something in :dev-dependencies must be pretty old
16:33technomancyare you just getting started with clojure?
16:33bergelmiryep :)
16:33technomancyconjure might not be the best bet for that; it's pretty obscure
16:33technomancyI recommend reading up on compojure and ring
16:34technomancyclojurebot: google brehaut ring compojure
16:34clojurebotFirst, out of 19 results is:
16:34clojurebotA Lazy Sequence: A Brief Overview of the Clojure Web Stack - Brehaut
16:34clojurebothttp://brehaut.net/blog/2011/ring_introduction
16:34technomancy^ good place to start
16:34rbxbxtechnomancy 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:34amalloytechnomancy: ughhh, $google doesn't waste nearly as many newlines
16:34technomancyamalloy: heh; noted for next time =)
16:35uvtcI see Conjure listed at the Clojure Toolbox along with some others.
16:36technomancyuvtc: see, in my eyes that's an indictment of the manually-curated approach as a whole =)
16:36technomancycompare http://clojuresphere.herokuapp.com/conjure/conjure vs http://clojuresphere.herokuapp.com/compojure/compojure
16:36uvtctechnomancy: I think manually curated works when the community as a whole is doing the curating. Getting people involved is another problem though.
16:38technomancyuvtc: agreed
16:38technomancyit's possible if everyone's on board; it's just incredibly difficult to get there
16:39jkkramertechnomancy: FYI there's clojuresphere.com now. do you know if there's a way to redirect *.herokuapp.com?
16:39bergelmirokay, will have a look at compojure and ring and thanks for the link ;)
16:39cemerickcuration vs. bubbling are good at different things, of course
16:40uvtccemerick: By "bubbling" do you mean the clojuresphere approach?
16:40cemerickyes
16:40cemerickmaybe "statistical methods" is a better term
16:41technomancyjkkramer: 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:41amalloyjkkramer: is clojuresphere.com pointing to the heroku IP, or is it a different server?
16:41technomancyI'll look into it
16:41technomancybecause I really should know this =)
16:42jkkrameramalloy: pointing to heroku
16:42technomancyamalloy: CNAME usually
16:42SegFaultAX|work2ClojureSphere is pretty neat.
16:42amalloyjkkramer: 4clojure has a middleware for redirecting 4clojure.org to www.4clojure.com, if you're looking for something to steal
16:42jkkramerI figured it could be done in-app…wasn't sure if heroku had another way
16:43technomancyjkkramer: at least with SSL redirects they're done in userland
16:43jkkrameramalloy: I will do that. I already stole your gzip middleware fork
16:44amalloystart 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:45jkkrameramalloy: k will see, thanks
16:49SegFaultAX|work2amalloy: Did you know that /datatable/users 500's on 4clojure?
16:50abaloneamalloy: i'm polling the state of a windows service using sc.exe
16:50SegFaultAX|work2I'm assuming that's the end-point that drives the user listing. Should it return some default page?
16:52amalloypassing it no arguments is an error
16:52amalloyif 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:52SegFaultAX|work2amalloy: I'm working my way through the source now.
16:52bergelmirhttps://github.com/weavejester/compojure/wiki/Getting-Started --> lein compojure new hello-world --> "compojure is not a task"
16:53weavejesterbergelmir: Are you using Lein 2?
16:53bergelmirweavejester: Leiningen 2.0.0-preview7 on Java 1.7.0_05 Java HotSpot(TM) 64-Bit Server VM
16:53weavejesterbergelmir: Oh, you've just got the "new" and "compojure" the wrong way round
16:54weavejesterbergelmir: lein new compojure hello-world
16:54bergelmirhmpf :)
16:57bergelmirwhy 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:57uvtcbergelmir: lein always checks there first, before clojars.
16:58bergelmiruvtc: yeah but i am always getting "could not find artifact ..." for that repo. why don't they change the order?
16:59xeqibecause maven central was around first, and is the canonical place to looks for jars
17:00technomancythere's an open issue for decreasing the verbosity
17:00bergelmirlocalhost:3000 --> Hello World
17:00technomancyyou're just seeing the behaviour of the underlying libraries that we haven't figured out how to change yet
17:00bergelmiryay :)
17:01xeqi* spent time to
17:05uvtcMaybe 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:06amalloyuvtc: just switch your whole terminal to green on black. then everything looks successful! very soothing
17:07technomancypreferably with the glastty font
17:08amalloywhat is it you like about glasstty?
17:09uvtctechnomancy: I read that as "ghastly" font.
17:09amalloydoes 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:09tanzoniteblackuvtc: you might as well have read that correctly :)
17:09technomancyamalloy: 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:10uvtcWell, anyway, when a terminal-based program gives me colored output, color me pleasantly surprised.
17:11scriptortechnomancy: so…movieOS?
17:11amalloyuvtc: always withold your pleasant surprise until you check whether it produces reasonable output when you redirect it to a file as well
17:11technomancyscriptor: yes, precisely.
17:11amalloy(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:12uvtcamalloy: yup, it certainly should be careful to check if it's being used interactively.
17:24unlinkI'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:27amalloyno
17:30unlinkwhat's the idiomatic way of doing this, then: (let [... headers (update-in (:headers response) ["content-length"] #(Integer/parseInt %)) ...] ...)
17:32gfredericksI think that's it :(
17:32gfredericksI end up defining my own update function half the time
17:32gfredericksif I do that more than once in a file
17:32jeremyheiler&(update-in {:a {"b" 1}} [:a "b"] inc)
17:32lazybot⇒ {:a {"b" 2}}
17:33unlinkIt's very tempting to use ->, because then I wouldn't need to wrap Integer/parseInt in an anonymous function.
17:33gfrederickshow would you do it with ->?
17:33jeremyheilerInteger/parseInt isn't a function, so you still need to wrap it.
17:35hyPiRion,(update-in {"content-length" "1000"} ["content-length"] read-string)
17:35clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ?? in this context, compiling:(NO_SOURCE_PATH:0)>
17:35hyPiRion,(update-in {"content-length" "1000"} ["content-length"] read-string)
17:35clojurebot{"content-length" 1000}
17:36hyPiRionBut I'd go for #(Integer/parseInt %) if I were you.
17:36unlink(let [... headers (assoc (:headers response) "content-length" (-> response :headers (get "content-length") (Integer/parseInt))) ...] ...)
17:37amalloyunlink: baaaarrrrf. use update-in for sure
17:37unlinkright, naming response twice is not nice.
17:37gfredericksnot to mention "content-length"
17:37unlinkI have a slight allergic reaction to anonymous functions, though.
17:37gfredericksuse read-string then
17:38unlinkread-string is worse, though, because then I need to ensure *read-eval* is bound to false.
17:38hyPiRionunlink: Well, you could do (defn read-int [string] (Integer/parseInt string))
17:38hyPiRionthen it's not anonymous anymore.
17:38gfredericksdammit when can we get rid of read-eval
17:38gfredericksit's scaring everybody off
17:39unlinkheh, that's true, but I think #(Integer/parseInt %) is more idiomatic.
17:39unlink(with (-> ... (Integer/parseInt)) being the most idiomatic of all, when it's possible)
17:39unlink(that is to say, not here.)
17:40hyPiRionWell, it's more or less idiomatic because of java interop. You'd generally prefer some Clojure variant if that existed.
17:40amalloygfredericks: i wouldn't be astonished to see it gone in, say, clojure 1.6
17:40gfredericksamalloy: at the very least defaulted to false
17:40amalloymeh. defaulted to false isn't useful at all. nobody will ever turn it on
17:41hyPiRionStuff will break regardless, won't it?
17:41technomancywouldn't be the first time stuff was intentionally broken in a minor release
17:42technomancythough to be fair, breaking undocumented behaviour is less of a problem
17:43hyPiRion,(doc *read-eval*)
17:43clojurebot"; 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:44gtrakweavejester: 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:44weavejestergtrak: I managed to miss that one. Let me take a look.
17:45gtrakI just put it in a second ago
17:46weavejestergtrak: That would explain it :)
17:46gtrakI kinda just assumed that would work
17:46gtrakit didn't :-)
17:48weavejestergtrak: Let me think about it. It could be implemented in ring-server in a ring.server.webxml namespace… or perhaps ring.server.legacy :)
17:48weavejestergtrak: What custom stuff do you have in web.xml?
17:49weavejesterIn general I like to steer people away from Java web dev when possible :)
17:49gtrakwe 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:52gtrakfor 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:53gtrakmeanwhile, having the option in the first place let our UI guy get started immediately instead of having to wait
17:55weavejesterI think it's reasonable to have as a last resort… for when you really really need to stoop to using web.xml.
17:55gtrakyea, a .legacy ns should inform people they need to feel dirty while doing it
17:55weavejesterPerhaps the presence of a manual web.xml would trigger it.
17:58gtrakyea, I can imagine a scenario where you don't want a web.xml during development either, I'd be comfortable with a flag
18:03unlinkUsing read-string when you mean Integer/parseInt is simply less robust. It's much easier to do it wrong that way.
18:03unlinkread-string isn't going to throw a NumberFormatException on "abc123"
18:03unlinksorry, "abc"
18:03Frozenlock`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:04hiredmanFrozenlock`: are you sure you didn't forget the . in thr constructor?
18:04hiredman(goog.ui.DatePicker) vs. (goog.ui.DatePicker.)
18:05Frozenlock`Yes, I pasted exactly what I typed in my REPL.
18:06S11001001unlink: I've had a prod bug due to using Integer/parseInt instead of read-string, where read-string was the fix.
18:07auserhola
18:08unlinkS11001001: You probably didn't mean Integer/parseInt, then.
18:08S11001001unlink: I meant parse an integer
18:09unlinkHow was parseInt failing
18:09S11001001unlink: overflow
18:11Raynes&(Long. "123424354524657567457665")
18:11lazybotjava.lang.NumberFormatException: For input string: "123424354524657567457665"
18:11RaynesHeh
18:11gtraktooo long
18:11gtraklong is shorter
18:25Frozenlock`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:26Frozenlock`So I get an error buuuuut the object is added. o_O
18:26Frozenlock`I still don't see any in the browser, but in the dom explorer it's there.
18:33nDuffFrozenlock: Have you looked at the generated javascript (and the stack trace it throws) to figure out exactly where the error is?
18:33nDuffFrozenlock: ...generally speaking, that's where I've tended to start (without advanced-mode compilation, of course) when successfully debugging cljs.
18:36Frozenlock`Yes, but I don't see anything enlightening (keep in mind that I have but a very basic understanding of js)
18:37Frozenlock`https://www.refheap.com/paste/4875
18:37Frozenlock`(first 3 lines)
18:37nDuffThat's not very helpful without having the generated javascript next to it.
18:39Frozenlock`er... How do I get the generated javascript from the repl?
18:40nDuffUse a browser that shows it to you in the debugger? :)
18:40nDuffChrome does that out-of-the-box.
18:41nDuff(once you know where the break-on-exception button is, anyhow)
18:42Frozenlock`I'm sure I can find that, please don't go away :p
18:51Frozenlock`oh wow, that was long
18:54Frozenlock`https://www.refheap.com/paste/4876#L-10
18:54mdeboardAnyone here have overwhelmingly positive experience developing Clojure using an IDE instead of emacs/vim?
18:54nvymdeboard: *which* IDE?
18:54mdeboardnvy: Any.
18:55nvyI thought emacs was an IDE
18:55mdeboardNah, not IMO. Though to what degree it isn't an IDE depends on the mode I guess.
18:56nvygood point
18:56technomancypedantically, it's hard to come up with a definition of IDE that excludes Emacs
18:57kenneth(let [head-match #(.equals (String. %2 0 (min (.length %2) (count %1))) %1 )]
18:57kennethhey so i'm defining head-match as a function to that takes two args, a string and a byte array
18:58kennethright now it crashes on .length, i thought that byte arrays had a length function?
18:58hiredmantechnomancy: I think you could if you said "does X well" instead of just
18:58xeqi &(.length (byte-array 3))
18:58hiredmandoes X"
18:58mdeboardzing
18:58technomancyoh snap
18:58mdeboardtrue though
18:58xeqi ,(.length (byte-array 3))
18:58clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: length for class [B>
18:58mdeboardIt's hard to come up with a definition of "IRC client" that excludes emacs
18:59technomancy"An IDE is a thing that is designed to let you write Java."
18:59mdeboardlol
18:59hiredmanhahah
18:59mdeboardANYWAY
18:59brehauttechnomancy: Or compile a MS language project
18:59mdeboardMy original question was if anyone would recommend using Intellij/emacs/etc over emacs/vim for writing Clojure
19:00mdeboarder
19:00mdeboardIntelliJ/Emacs
19:00tanzoniteblacktechnomancy: 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:00mdeboardGOD DAMMIT
19:00mdeboardIntelliJ/eclipse
19:00mdeboardPardon my language.
19:00hiredmanI've explored a lot of java codebases using emacs, but written very little java in emacs
19:00kennethxeqi: right, so what's up with that?
19:00nDuffmdeboard: Personally, I've tried the available IDEs, and my answer is a resounding "no"
19:00nDuffmdeboard: ...that said, given the survey results, there certainly are people who disagree.
19:00nDuff~survey
19:00clojurebotsurvey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
19:00technomancytanzoniteblack: Emacs grudgingly allows you to write java
19:00xeqiit sounds like the eclipse w/ counterclockwise is the best of them
19:00mdeboardnDuff: Yeah but most people are very bad programmers.
19:01xeqihaving never used any
19:01mdeboardI ask because I've been using MonoDevelop with a C# application we have at work and it's been pretty nice.
19:01tanzoniteblackmdeboard: I use Eclipse for most Java projects at work, but couldn't stand using it for Clojure
19:01mdeboardAlso because I'm giving a "Why CLojure" talk at the local Scala meetup next week.
19:01mdeboardtanzoniteblack: Why is that
19:01nDuff...right tool for the right job and such.
19:03SegFaultAX|work2mdeboard: Are you going to subtitle it "... is better than Scala"?
19:03tanzoniteblackmdeboard: 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:04cemerickAny from #{emacs vim eclipse} will do. Use what you're comfortable with and what you know.
19:04nDufftanzoniteblack: Emacs Live does a pretty decent job of that too out-of-the-box (re: method/field completion)
19:04tanzoniteblackmdeboard: i.e. I might be a bit biased towards emacs anyways; especially since it's what I used for common lisp before hand
19:04technomancyit's a shame enclojure seems to have disappeared because it had a really great logo
19:05tanzoniteblacknDuff: I will go check that out now
19:05xeqikenneth: hmm, I read something that the bytecode to invoke it is different, wonder if thats the issue
19:05xeqi,(count (byte-array 3))
19:05clojurebot3
19:05mdeboardSegFaultAX|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:05xeqikenneth: could do something like ^, but its probably calling seq on it underneath
19:05mdeboardcemerick: I'll accept that as a response to my tweet at you earlier then
19:06cemerickmdeboard: oh, did I miss one?
19:06cemerickAh, right.
19:06mdeboard:D
19:06cemerickmdeboard: Not sure what you mean by 'inline REPL' though.
19:09tanzoniteblacknDuff: 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:10amalloyxeqi: it's not calling seq, it's using reflection to discover the type of the array
19:22dnolenkenneth: (.length foo) doesn't work on arrays. Just use count or alength.
19:42austinhReporting back: it took me about 8 hours to figure out how to implement virtual hosts.
19:42austinhThat was not fun, but it works, and I honed my interop chops a little.
19:44senethwhats the best IDE for clojure, I am thinking about using eclipse's plugin?
19:44anieroseneth: vim! :D
19:44seneth>_>
19:44nDuffemacs!
19:44nDuff(no, really, emacs)
19:44anieronDuff: thank you!
19:44nDuff~survey
19:44clojurebotsurvey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
19:44nDuffseneth: See the survey for numbers on what folks use re: environments
19:44seneththanks
19:45nDuffseneth: If you don't already have a preferred emacs setup for LISP, I'd suggest looking at Emacs Live, by the Overtone folks
19:45nDuffseneth: ...there's a nice video available showing off the features.
19:47nDuffseneth: 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:47technomancyuse what you already know; it's hard enough learning a new language without throwing in a bunch of unrelated crap.
19:48technomancyunless it's like textmate or something
19:48gfredericksthe 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:50amalloythere'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:51mdeboardKind 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:51mdeboards talk.
19:51mdeboardgoogle works, I'm an idiot.
19:52hiredmansubmarines are for poseurs, just grab a big rock and take a long walk off a short pier
19:52mdeboardnm, no I'm not.
19:52Urthwhytewhoa
19:53mdeboardMake like a tree and get outta here
19:54Urthwhytemdeboard: 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:54Urthwhytechannel
19:54mdeboardI see
19:57mdeboardI believe the third domain was math ops
19:57austinhHere is my code for setting up virtual hosts with Clojure/Ring/Jetty: https://gist.github.com/3628228
19:58senethI 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:59gfredericks~scala
19:59clojurebotUnfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala
19:59technomancyseneth: you mean suggestions on whether to choose Clojure or Scala?
19:59technomancythis might be the wrong channel for that
19:59weavejesteraustinh: Compojure should be able handle virtual hosts by setting routes with absolute URLs
19:59Urthwhytetechnomancy: Presumably he's asking the same thing in #scala
19:59senethyes
20:00Urthwhyte(and getting nothing in there, considering how dead it is)
20:00senethI am not
20:00hiredmanweavejester: interesting fact
20:00weavejestere.g. (GET "http://api.myproject.com/&quot; [] …)
20:00amalloyUrthwhyte: and in here we'll suggest clojure, while in there they'll suggest scala. which i think was technomancy's point
20:00technomancyhooray, we win by default then?
20:00weavejesterAnd if Clout 1.1.0 is explicitly included, you can also do:
20:00weavejester(GET "//api.myproject.com/" [] …)
20:00technomancyjkkramer: ^ possibly of interest for clojuresphere
20:01gfredericksmaybe he will forward the arguments back and forth and conduct an indirect fight
20:01Urthwhyteit'll be like the good ol' #ruby v. #python days
20:01Urthwhyteor #noun1 v. #noun2
20:02gfrederickswell this may surprise you but I would recommend clojure.
20:02senethLet me put it differently. Is clojure practical for every day projectS, like Building guis, db acess, etc..?
20:02austinhweavejester: Good to know! (But I'm not using compojure).
20:03weavejesteraustinh: You could also use middleware that dispatches off the "Host" header
20:04weavejesteraustinh: Because that's all there is to virtual hosts.
20:05austinhweavejester: 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:06weavejester(defn virtual-hosts [& {:as handlers}] (fn [req] ((handlers (get-in req [:headers "host"])) req)))
20:06austinhNow I hate you.
20:06weavejesteraustinh: :)
20:06austinh:)
20:07weavejesternginx is often a good choice if you want a webapp to be made of multiple processes
20:07gfredericksseneth: yes.
20:07weavejesterWhether you're using Clojure or Ruby or whatever
20:08weavejesteranyway goodnight :)
20:08austinhGood night!
20:09austinhI can't believe I didn't think of middleware. Middleware rules my world right now.
20:10mdeboardAnyone know what Akamai uses Clojure for?
20:12mdeboardAha. "mobile adaptation product"
20:13mdeboardOr 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:13mdeboardL's, parsers, and DOM query tools"
20:14technomancydefinitely couldn't pull that off with a single DSL; no sir =)
20:15casionso 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:16gfredericks&(float 0x7fffffff)
20:16lazybot⇒ 2.14748365E9
20:16gfrederickswhy not divide by that directly?
20:16hiredman,(* 1 1.0)
20:16clojurebot1.0
20:17casiongfredericks: I think I tried that… let me check again
20:17gfrederickscasion: it would sidestep ratios at least
20:18casionit's faster on its own, but not in this function
20:18casionwhich I guess means there's something else going on that I'm missing
20:18mdeboardtechnomancy: can't tell if serious
20:18casionlet me put it up, sec
20:19technomancymdeboard: I have a hard time taking the term "DSL" seriously.
20:19gfrederickstechnomancy: you wouldn't understand, it's too domain specific
20:19mdeboardYeah I always associate it with a much more crude acronym too
20:19technomancymdeboard: "Metaprogramming in Lisp is like Chinese food in China; they just call it food there."
20:19mdeboardoh
20:19mdeboardthat too
20:19whitakerok, 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:19technomancyclojurebot: Metaprogramming in Lisp is like Chinese food in China; they just call it food there.
20:19clojurebotAlles klar
20:20amalloyi've heard that what's served as chinese food in america isn't easily recognized in china
20:20jballancwhat's it take to add a task to lein 2.0?
20:20mdeboardwhitaker: Why so
20:20technomancyjballanc: typically write a plugin, though there are other ways too; what do you need?
20:21SgeoI should make an expr function
20:21whitakermdeboard: see the day's log :)
20:21jballancI'm trying to update ClojureScript One for lein 2.0
20:21jballancbut it has a "bootstrap" task defined in the project
20:21shaungilchristyou're-gonna-have-a-bad-time
20:21whitakerI had reloading issues which made my noir-async app untestable
20:21technomancyjballanc: if you just need to run application code, you can use a partial alias to the run task
20:21jballancnot strictly necessary to carry it over...but I got curious
20:21shaungilchristget lein1.6 for now
20:21casionhttps://www.refheap.com/paste/4877
20:21mdeboardwhitaker: 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:22casionto convert a collection of bytes (little-endian) to a 32-bit float in range -1.0/1.0
20:22jballancshaungilchrist: is there an effort to port to lein 2.0 underway?
20:22technomancyjballanc: if you're adapting a legacy codebase it's probably simplest to echo "tasks" > .lein-classpath and make tasks/leiningen/bootstrap.clj
20:22jballancI couldn't find anything
20:22jballanctechnomancy: ah, yeah...that might work :)
20:22casionmaybe I'm doing something else wrong that I'm not noticing in there
20:22shaungilchristI do not know - I was just in same boat a week ago
20:22whitakermdeboard: http://clojure-log.n01se.net/ - CTL-F/grep for 'whitaker', first instance of subthread on the matter starts from there
20:22technomancyI doubt clojurescript one is doing anything that actually justifies a custom task, but that would get you going the quickest
20:23gfredericksman #clojure hasn't been this noisy since they first announced they were adding parentheses
20:23jballancit isn't
20:23jballancbootstrap is just "deps + git-deps"
20:23technomancyoh man... git deps =(
20:23mdeboardwhitaker: huh
20:23technomancywelp
20:23jballancnot really worth it...like I said...was more curious than anything
20:23technomancyjballanc: :aliases {"bootstrap" ["do" "deps," "git-deps"]}
20:23mdeboardgfredericks:
20:23mdeboard\(。◕‿◕。)/
20:24jballancyeah, that's much simpler
20:24technomancyjballanc: it should probably be ported to lein-cljsbuild, but that would probably be pretty involved.
20:25jballanctechnomancy: well...I'm looking to build on this, so it might just be worth my effort
20:25technomancymdeboard: noir has weird top-level non-var forms
20:25whitakermdeboard: noir was my punishment as a Ruby/Rails guy trying to replicate the "give me an entire opinionated stack dammit" experience unnecessarily.
20:25jballanc(and by build, I mean organizationally, not just code-wise)
20:26mdeboardwhitaker: ah yeah, you have to unclench your fist
20:26mdeboardyou know, the fist of your mind.
20:27mdeboard(◎_◎)
20:27whitakerMaybe noir was a Gom Jabbar test for me.
20:28mdeboardI see
20:29whitakerI almost got pricked by the needle
20:30technomancyclojurebot: recite the litany against cons
20:30clojureboteventual consistency is for losers
20:30technomancy=(
20:30technomancyclojurebot: litany against cons
20:30clojurebotlitany 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:30gfredericks~conso
20:30clojurebotexcusez-moi
20:30jballancpoor clojurebot...the things you all make him remember
20:31hoover_dammseriously
20:31gfredericks~botsnack
20:31clojurebotThanks! Can I have chocolate next time
20:31technomancy~scoobysnack
20:31clojurebotTitim gan ?ir? ort.
20:32gfredericksclojurebot: scoobysnack is botsnack
20:32clojurebotRoger.
20:32gfredericks~scoobysnack
20:32clojurebotscoobysnack is botsnack
20:32gfredericks~scoobysnack
20:32clojurebotThanks! Can I have chocolate next time
20:32gfrederickswhat a smot bot
20:32whitaker~chocolate
20:32clojurebotexcusez-moi
20:32technomancygfredericks: have a scoobysnack
20:32whitaker~42
20:32clojurebot42 is forget (+ 2 3)
20:33gfrederickstechnomancy: Thanks! Can I have chocolate next time
20:33whitaker~cheezburger
20:33clojurebotIt's greek to me.
20:33whitaker~cheeseburger
20:33clojurebotIt's greek to me.
20:33whitakerI see clojurebot lacks felid lol mode
20:34whitakerbut has a canid mode
20:37whitakerIn 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:38gfredericks"Rich Hickey and Makeup"
20:38friowhitaker: link :)?
20:39whitakergfredericks: amusing Google result from that phrase: "How do I fake a hickey with makeup? | ChaCha"
20:40wmealing_i knew he was a robot
20:40whitakerfrio: lemme look… I was listening to it on my iPad as a car passenger yesterday
20:40rbarraudAny Wellington clojurists in here?
20:41rbarraudI am in town visiting family
20:41rbarraudWell, in Upper Hutt...
20:42whitakerWellington where? UK? Canada? Australia? NZ?
20:42mdeboardOne oughtn't find oneself in Lower Hutt after sundown
20:42rbarraudDefinitely ;-)
20:42friowhitaker: i just found it :)
20:43frioand im guessing NZ's wellington, if there's hutts in it
20:43rbarraudNZ
20:43frioim in auckland rbarraud :)
20:43rbarraudYup
20:43rbarraudHi frio ... That's my usual domicile... Greenhithe to be precise :-)
20:43friohaha
20:43friothe horrible horrible north shore :p
20:44whitakerfrio: cool, because I couldn't find it in the history on my iPhone or iPad. URL for others here (and The Historical Record)?
20:44mdeboardIs Korma looked upon with similar disdain as Noir
20:44mdeboard@ hiredman
20:44rbarraudAccording to some twisted views of the universe, perhaps so ;-)
20:44friowhitaker: http://www.infoq.com/presentations/Simple-Made-Easy
20:45whitakerWhile 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:45whitakerfrio: that's the one, thanks much
20:46whitakerAnyone else seen the 2011 "Skills Matter" talk by "Uncle Bob" on "The Last Programming Language"?
20:48SgeoHow does = on functions work?
20:48mdeboardwhitaker: Dude, Twitter is based in the bay area
20:48Sgeo,(= + +)
20:48clojurebottrue
20:49SgeoI take it it's identity-based?
20:49Sgeo,(= (fn [x] (+ x 1)) (fn [x] (+ x 1)))
20:49clojurebotfalse
20:49dnolen`Sgeo: identity
20:49mdeboard,(identity +)
20:49clojurebot#<core$_PLUS_ clojure.core$_PLUS_@72ab19c0>
20:50Sgeomdeboard, not what I meant >.>
20:50mdeboard(╯°□°)╯︵ ┻━┻
20:50whitakermdeboard: I know Twitter is based here. I meant clojurists _here and now_ on this channel
20:50mdeboardwhitaker: Oh, good god no
20:50whitaker?
20:50whitakerPlease be more cryptic.
20:51mdeboardI've said too much
20:51friohahahahaha
20:51whitakermdeboard: was that somehow addressed to the "clojurists in the Bay area" thing, or?
20:52whitakerGuys, did I just miss an inside joke by mdeboard, who exited?
20:52mdeboardno
20:52whitakerWhat was the "Oh, good god no" then?
20:52mdeboardPoor brain-mouth filter.
20:55whitakerAnyway, 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:56gfredericksain't it quittin time in the bay area at the moment?
20:58arohnerwhitaker: me
20:58phaoHi... 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:58arohnergfredericks: no, it's coding time, because all the emails have finally stopped!
20:58phaoI mean, won't it spend lots of memory, or cause huge network traffic... or ... ?
20:58gfredericksphao: also problematic to have a GC
20:58gfredericksphao: what specific case are you thinking of?
20:59phaothe networking thing looks huge...
20:59gfrederickssending JSON over the wire?
20:59whitakergfredericks: not at my office in San Francisco, where I'm waiting for dinner to be delivered
20:59whitakerarohner: do you attend any of the local Clojure meetups?
21:00phaogfredericks, tbh, I really don't quite know...
21:00gfredericksphao: I must not understand what you mean by "the networking thing"
21:00arohnerwhitaker: sometimes. I've probably been to 3-4 since January
21:01arohnerphao: the JVM is pretty good at GC'ing garbage that doesn't last one generation
21:01whitakermdeboard: 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:01whitakerhttp://sqlkorma.com/
21:02arohnerso if your problem can handle be written in Java, it can probably handle being value oriented
21:02mdeboardwhitaker: Chris Granger was inventor of Noir as well
21:02ibdknoxSomeone rang?
21:03mdeboardibdknox: I was asking about how people would rate Korma given the recent bad eperience with noir that was discussed at length earlier
21:03ibdknoxsay what?
21:03SgeoBad experience with Noir?
21:04ibdknoxWhat bad experience?
21:04whitaker_ibdknox: see log: http://clojure-log.n01se.net/
21:04whitaker_CTRL-F for 'whitaker', first occurrence, read from there
21:06ibdknoxto be very clear
21:06ibdknoxI have nothing to do with noir-async
21:06ibdknoxmoreover
21:07ibdknoxmeh, not worth it
21:08ibdknoxapparently people like speaking ill of my work while I'm away lol
21:10rbxbxibdknox I'm sure people speak positively of your work while you're away as well, just not so much today.
21:10shaungilchristwell to add balance to the force - I like noir. The examples actually work and the documentation is clear
21:13mdeboardI 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:13mdeboardScrooge McDuck-style
21:13whitakerI 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:14ibdknoxwhitaker: I know *nothin* about noir-async
21:14ibdknoxchances are if you just use aleph directly
21:14ibdknoxit would've been fine
21:14whitakerwho is ibdknox? I thought Light Table was Chris' project
21:14TimMc...
21:14ibdknoxI'm Chris Granger
21:14ibdknoxlol
21:14whitaker!
21:14whitakerheh
21:14whitakerhi Chris
21:15ibdknoxhola
21:15whitaker(we met in SF a few weeks ago at Climate Corp.)
21:15mdeboardlol
21:15whitakerLove Light Table, always talking it up to friends
21:15ibdknoxhaha that was a couple months ago ;)
21:15whitakertemps fugit and all that.
21:15whitakerarg
21:15ibdknoxSorry you had a bad experience with noir :(
21:15whitakerdamned autocorrect
21:15whitakerNot noir
21:16whitakernoir-async, sorry to conflate them
21:16whitakerwasn't noir's fault
21:16whitaker"tempus fugit"
21:16whitakerthere
21:16ibdknoxIf 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:16ibdknoxfwiw, LT actually uses noir on top aleph
21:17whitakerOh, I did go back to straight Aleph
21:17SgeoAleph?
21:17ibdknoxSgeo: https://github.com/ztellman/aleph
21:17TimMc$google aleph clojure
21:17lazybot[ztellman/aleph · GitHub] https://github.com/ztellman/aleph
21:17whitakerI, er, "decomplected" things a bit
21:17mdeboardEvery time I think I need a macro it turns out a function is fine.
21:18whitakeribdknox: makes since that LT sits on top of Aleph
21:18rbxbxmdeboard thankfully you're trying first instead of jumping straight to the macro like so many do ;_;
21:18whitakerI like Aleph the more I learn about it
21:18mdeboardrbxbx: I'm actually turning a macro into a function atm
21:18whitaker"makes sense"
21:18whitakerI really need to find the preference in my irc client that keeps doing that...
21:19mdeboardOh, wait, I remember now.
21:19ibdknoxfwiw here's a little gist I made for it: https://gist.github.com/1257857
21:19mdeboardI DO need a macro. I should document this.
21:19ibdknoxlol
21:20SgeoThe thing that used to be in clojure.contrib for monads uses a macro unnecessarily
21:20whitakeribdknox: thanks Chris
21:21Sgeo(You'd need a macro in Haskell, but Clojure is not Haskell)
21:21ibdknoxwhitaker: though to be honest, you're probably better off just using lib-noir with compojure or whatnot - depending on what you're doing
21:21ibdknoxwhitaker: lib-noir has most of the middleware for noir in it, and is designed to be used with any ring project
21:22ibdknoxso that the people who will never accept anything short of raw ring or maybe compojure can get some of the niceness too :)
21:23mdeboardWait, DO I need a macro here? https://gist.github.com/3628843 I didn't write enough documentation.
21:23whitakeribdknox: 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:23mdeboardI 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:24ibdknoxwhitaker: 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:25whitakeribdknox: thanks for making the distinction
21:27whitakerThanks guys! G'nite.
21:29mdeboardAh 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:30mdeboardNow that I mention it, why the heck doesn't that worK?
21:30emezeskemdeboard: Because proxy is a macro itself
21:31mdeboardAhhhhh right.
21:31rbxbx,(doc proxy)
21:31clojurebot"([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:31emezeskemdeboard: It looks at its arguments at compile time, so they have to be set then
21:31rbxbx:(
21:32emezeskemdeboard: That's IMHO the best reason to avoid macros if possible -- they sort of leak macro-ness to their users
21:32mdeboardemezeske: Indeed, I had gone through all this before but I failed to write it down.
21:33emezeskemdeboard: Heh, I know how that goes! :)
21:35technomancymdeboard: 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:36technomancynobody has found the right level of abstraction primitives for DB queries yet
21:42samratanyone here using noir-async?
21:42mdeboardsamrat: There was just a guy here
21:43mdeboardso, no
21:44arohnertechnomancy: because there isn't a right level of abstraction over SQL?
21:45arohnerthe problem is SQL, IMO
21:45hoover_dammarohner, I would argue the right solution is going to be opinionated
21:46arohnerhoover_damm: I have an opinionated solution. Don't use SQL :-p
21:46arohneror, don't expect an ORM to work 100% on top of SQL
21:46hoover_dammarohner, I was sold on that pattern back in 2008
21:46hoover_dammarohner, I tried explaining that to my peers (i'm an ops person) and the blank looks I got was amazing
21:47arohnerhttp://arohner.blogspot.com/2009/04/db-rant.html
21:47hoover_dammarohner, sometimes people know so little that they don't know how to work outside of their box
21:47hoover_dammand yet they will hold steadfast to their ignorance
21:49dysingerwhere did clojure.contrib.reflect run off to ? I've been out of the game for a while
21:50xeqi$seen kingtim
21:50lazybotkingtim was last seen quitting 1 hour and 42 minutes ago.
21:50xeqi~contrib
21:50clojurebotMonolithic 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:51xeqilooks like no one has moved it forward
21:51dysingerthanks lazybot!
21:52dysingerbummer I need that get-field fun
21:56SgeoI 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:57emezeskeSgeo: Well you can of course do that in clojure with eval
21:58SgeoIsn't eval generally discouraged?
21:58emezeskeWho cares if it's discouraged?
21:58emezeskeYou can still use it
21:59emezeskeThere are good reasons for it to be discouraged, anyway. They're the same reasons that evaling code in Tcl is painful
21:59amalloydysinger: clojure.java.reflect
22:00mindbender1an appeal to clojure lib writers. Please document your apis in the manner of elisp
22:00dysingeramalloy:
22:00dysingerthanks
22:00SgeoHmm, how is evaling code in Tcl painful? Tcl at least is an environment where eval (well, uplevel usually) is an ordinary practice
22:01emezeskeEfficiency is a decent reason. Making your code understandable is a better one.
22:03SgeoI wonder if a delay monad would make sense
22:03SgeoIt wouldn't make sense in Haskell because everything is lazy by default, but that's not the case in Clojure
22:03Sgeo*non-strict
22:05mindbender1imagine 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:10rbarraudUs antipodeanz iz pays teh attentions ;-) Whitaker
22:13dysingerargh. leiningen includes jars that are marked :scope "provided" in the uberjar
22:17xeqidysinger: yeah, they need to be in the :provided profile
22:20mpanI'm calling assoc on a hash-map and getting back a lazy sequence. How can I get a hash-map?
22:21dnolenmpan: that doesn't sound right.
22:21mpanin particular, I'm using reduce to assoc a bunch of stuff into an empty map
22:21dnolen,(assoc {} :foo 1)
22:21clojurebot{:foo 1}
22:21mpanand I'm... idk somehow I get back a lazy seq
22:22dnolenmpan: paste your example somewhere.
22:22mpan(reduce #(assoc %1 (%2 0) (%2 1)) listens (hash-map))
22:22mpanlistens is a seq of 2-length vectors
22:22mpanwhich I'm trying to convert into the key-val pairs of a map
22:22mpanand uh... I get something strange out
22:23xeqi(doc reduce)
22:23clojurebot"([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:23xeqithat passes listen as the initial value
22:23TimMcclojurebot, y u so verbose
22:23clojurebotbecause the parentheses grow lonely if their closing brackets are all kept separated and segregated.
22:23dnolenmpan: the problem is your initial value. generally the type of the intial value will be type of the final value.
22:23mpaneek
22:23mpanhow am I doing it backwards and getting seemingly sane results?
22:23mpanor at least, far less insane than doing something backwards usually gets
22:24mpanbut wow thanks guys
22:24dnolenmpan: assoc is polymorphic
22:24xeqi,(into {} [[:a 1] [:b 2] [:c 3]]
22:24clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
22:24xeqi,(into {} [[:a 1] [:b 2] [:c 3]])
22:24clojurebot{:a 1, :b 2, :c 3}
22:25xeqimpan: might consider into ^
22:25dnolen,(assoc [1 2 3] 1 :foo)
22:25clojurebot[1 :foo 3]
22:25mpan(doc into)
22:25clojurebot"([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
22:25dnolenmpan: ^, vectors support assoc
22:26mpanbtw, semi-related, why do a lot of the data types support (collection index) but lazy seqs don't?
22:27TimMcmpan: seqs are not associative data structures.
22:27TimMcvectors and maps are, so they are functions of their keys
22:28mpanall right, thanks!
22:29dnolenmpan: a lot of operations w/ the notable (an probably suprising) exception of nth & count are organized around computational complexity.
22:29technomancyarohner: insufficient data to make a conclusion =)
22:29technomancybut that's certainly a possibility
22:30arohnergiven the number of failed ORMs, and none of the active ones are 100%, I claim the evidence is on my side :-)
22:30mpandnolen: do you mean that they don't want people getting the nth of just an arbitrary seq if it can be avoided?
22:30technomancyI'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:31technomancyand monochrome code has serious usability concerns
22:31technomancybut maybe that's a tooling issue
22:31TimMcPart of the issue is certainly SQL's variability between DBs.
22:31dnolenmpan: yes
22:32arohnerI 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:33technomancyyes, I agree that an ORM is not the solution
22:34TimMccreate table kvstore (`key` text primary key, `value` text); -- done
22:35imereditharohner: in scala people have made typesafe query generators, but that only works if you dont have any bugs in the generators
22:35TimMcarohner, technomancy: Has either of you used datalog to any appreciable degree?
22:36arohnernot yet. I'm really interested in datomic, haven't had time yet
22:36technomancynot yet
22:37TimMcI'm eager to read up on it and see if it is something I can use instead of SQL. :-)
22:37arohnerit's supposed to be
22:37arohnerI've heard of people using it in production already
22:37mpanwhat does it mean to get a NullPointerException when compiling?
22:38arohnerprobably a syntax error
22:38mpanif I break the statement down, I get different errors
22:38TimMcand the syntax in error could be a macro usage
22:38dnolenmpan: also easily possible if you have executable stuff at the top level.
22:39mpanso I def something, and a line later, it says the symbol can't be resolved
22:39mpanand I dunno what I did wrong
22:39dnolenmpan: use a paste service - gist, refheap, lisppaste if you want people to help you w/ your problem.
22:40mpanas in, put the relevant source in a paste-bin service?
22:40dnolenmpan: yep
22:41mpanhttp://pastie.org/4665896 at the very bottom it tells me it can't resolve lines
22:41mpanwhich I def'd just right before
22:41mpannot sure if the rest of the file is any relevant
22:42TimMcDoing work at compile time isn't usually a great idea.
22:42mpanI only put it in for testing this part
22:42mpanand running it at the repl has the same issue
22:43TimMcmpan: If that get-lines call fails, then #'lines will be unbound.
22:45mpanI'm digging further into it and it does seem like another part had failed
22:45mpanIs there some way to get like a stack trace?
22:45dnolen`optimized printing landings in CLJS http://github.com/clojure/clojurescript/commit/c8bc05ca8e3c7e30a85148dd67398aa4d0e6b468
22:45dnolen`s/landings/lands
22:47dnolen`mpan: what dev environment are you using?
22:47mpaneclipse + counterclockwise
22:48mpanI've traced the error up to an error in my regex which caused me to feed something invalid to parseInt
22:48dnolen`mpan: hmm I would think CCW should show you the trace.
22:49dnolen`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:50mpanthanks
22:50rbarraudGrraarrrg.... Anyone recommend an iPad IRC client that doesn't lose conversation history on disconnect? :-(
22:51mpanIs (require '(clojure repl)) the statement I'm looking for?
22:52zerokarmaleftrbarraud: iSSH + screen/tmux + irssi?
22:53dnolen`mpan: (require '[clojure.repl])
22:53dnolen`mpan: or (require '[clojure.repl :as repl]), which make it less tedious
22:53dnolen`(repl/pst *e)
22:53rbarraudZerokarmaleft thanks
22:54rbarraudHeh
22:54zerokarmaleftrbarraud: it's a valid option :D
22:55mpandoes this require some special external jars?
22:55rbarraudYeah ... Given a suitable Linux host :-)
22:55rbarraudMight try It actually
22:55dnolen`mpan: not for clojure.repl
22:55mpanI'm still getting RuntimeException java.io.FileNotFoundException: Could not locate clojure/repl/pst__init.class or clojure/repl/pst.clj on classpath:
22:55dnolen`mpan: pst is a function, you want to require a library
22:56dnolen`mpan: what are you entering into the REPL?
22:56mpan(require '[clojure.repl]) which appears to succeed
22:56dnolen`mpan: and how are you trying to use it?
22:56mpanthen (clojure.repl/pst *e) which fails as above
22:57dnolen`mpan: hmm just tried that and it seems to work.
22:58mpanI 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:59emezeskednolen`: thanks for merging CLJS-340!
22:59mpanwhich gets me back to the earlier problem of, I'm definitely not doing my regexes correctly, but that's something different at least
22:59dnolen`emezeske: np!
23:18mrevili'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:25emezeskemrevil: 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:25mrevilhmmm
23:26emezeskemrevil: 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:27mrevilsometimes I wish I had shared_ptr or auto_ptr from c++
23:28emezeskeWell what you really want are scoped destructors from c++, but Java just doesn't have that.
23:28emezeskeThat's life in a garbage-collected world.
23:30mrevilbacking away from a rant, but i'm registering my annoyance and shaking my fist at the pedantic and arrogant java world view
23:32emezeskeNot allocating objects on the stack is pedantic?
23:33devthwhat'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:34emezeskedevth: Caveat: I have no idea how (in)efficient this is: (apply str (remove #(= % "z") "abczzzdef"))
23:34devthah, nice. thx
23:35mrevili 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:36emezeskemrevil: What? It's not like the Java authors took away your ability to write C or C++
23:36emezeskemrevil: You resent them for giving you another option that you may freely choose not to use?
23:37nsxtis clojurecheck the "definitive" quickcheck implementation for clojure?
23:37mreviljust 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:37xeqinsxt: theres also test.generative
23:40emezeskemrevil: 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:44iDesperadO,(def m {:hello 1, :world 2}) ,(map :hello m)
23:44clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
23:44mpanit doesn't want you to def :/
23:44mpanit's happy with let though
23:44mpan(or so I hope)
23:44emezeske,(let [m {:hello 1 :world 2}] (map :hello m))
23:44clojurebot(nil nil)
23:44mpan,(let [x 1] x)
23:44clojurebot1
23:44emezeskeiDesperadO: workaround ^
23:45iDesperadO(let [m {:hello 1 :world 2} (map :hello m))
23:45iDesperadO,(let [m {:hello 1 :world 2} (map :hello m))
23:45clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
23:45mpanum, close your ]
23:45iDesperadO,(let [m {:hello 1 :world 2}] (map :hello m))
23:45clojurebot(nil nil)
23:45iDesperadO,(let [m {:hello 1 :world 2}] (map :hello [m]))
23:45clojurebot(1)
23:45iDesperadOwhy's that?
23:46mpanmap expects certain arguments
23:46mpan(doc map)
23:46clojurebot"([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:46mpanspecifically, it wants something it can call and something that's a coll
23:47mpanI'm afraid to get the details wrong so I'll be quiet here :(
23:47iDesperadO: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:47iDesperadO,(:hello {:hello 1 :world 2})
23:47clojurebot1
23:48iDesperadO,(let [m {:hello 1 :world 2}] (map :hello m))
23:48clojurebot(nil nil)
23:48mpanit calls 1st arg to /each elem in/ 2nd arg
23:48mpannot to 2nd arg directly
23:49mpanso when you wrap it in vector, it calls it to each elem in the vector, namely, m
23:49mpanonce again, I'm new and afraid I might be giving you wrong details
23:50iDesperadOmpan: ah..it helps
23:50iDesperadO:)
23:52jparishyHi! Is there a best practice for wrapping a C library for use in Clojure?
23:55jparishyI found this library https://github.com/Chouser/clojure-jna but it's pretty old
23:57casionI've just used JNA directly
23:58uvtcI wonder if clojurebot has any wisdom to spread on this topic?
23:58uvtc~c
23:58clojurebotClojureBooks is http://clojure.org/books
23:58uvtcHm.
23:58casionusing C from java seems a bit counter to the purpose of using java in the first place though
23:58casionI'
23:59casionI've only used it to check my work against known working libraries that I"m familiar with
23:59jparishyYep, 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:59wmealing_casion: seen that clojureC work ?