#clojure logs

2013-02-18

00:00smnirvensquiggly: are you just looking for how to get emacs, leiningen 2, and nrepl setup?
00:01squigglysmnirven: I was probably just looking for the keyword nrepl :D
00:01smnirvenahh, so you got it werkin?
00:02squigglysmnirven: No, I just wasn't sure what I was looking for - I found their Github though and that helps a lot
00:04clj_newb_2345https://github.com/hraberg/shen.clj looks good. Is the author here?
00:04smnirvenso you've got "lein repl" running in your project, and you've nrepl.el installed?
00:07sgarrett|afkAnyone tried to use Compojure to handle OAuth redirect_uri callbacks? Facebook is adding the access token like "?method=login#access_token=asdb1235". When I print out the params I just get {:method "login}.
00:07squigglysmnirven: I just installed nrepl.el and it's working, thanks - I just wasn't sure what I should be searching for...
00:08smnirvenokay, cool
00:08smnirvenhappy hacking
00:11squigglysmnirven: Thanks! :)
00:17ucbclj_newb_2345: thanks for pointing me to shen
00:18clj_newb_2345ucb: please return the favor by writing a good tutorial :-)
00:18ucbclj_newb_2345: for shen? there's one I'm reading here http://www.shenlanguage.org/learn-shen/tutorials/shen_in_15mins.html#shen-in-15mins
00:19ucbwell, hardly a tutorial, but yeah
00:19clj_newb_2345I feel like it's not very representative of it's claimed power.
00:19ucbI'd have to experience said power before I can write anything about it :)
00:21ucboh, there's a book even
00:22clj_newb_2345unfortunately not available on kindle or pdf
00:41ucbindeed
00:46stephenwan,*clojure-version*
00:46clojurebot{:major 1, :minor 5, :incremental 0, :qualifier "RC6"}
01:43clj_newb_234The following code compiles and runs. What am I doing wrong?
01:43clj_newb_234(ann test1 (All [x y] [x y -> x])) (defn test1 [a b] "hello world") (println (test1 1 2))
01:43clj_newb_234(this is using core.typed)
01:43clj_newb_234I would be happier if I got an error somewhere.
03:13nonubyworking with compojure got something like this (GET /search [check-in check-out] ..) where they check in/out may or may not be specified I want to set them to a default value if nil, should I do this with a let and cond?
05:18nonubyusing compojure, if I produce a map { :a 'always here' :b (cookies "maybe") }, if :b is nil i dont want the key in there, whats the most idomatic way of handling this ?
05:19nonubyi suppose i could do (if (contains? "maybe" cookies) {:a 'always here' :b (cookies "maybe") } {:a 'always here' })
05:19nonubybut i presume there is a dozen better shortcuts
05:28AtKaaZ,(. (var for) alterRoot (fn [oldfn & the123args] (do (println oldfn the123args) (fn [callerForm someNil & restt] (println callerForm someNil restt)))) '(1 2 3))
05:28clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
05:28AtKaaZnice
05:29AtKaaZ&(. (var for) alterRoot (fn [oldfn & the123args] (do (println oldfn the123args) (fn [callerForm someNil & restt] (println callerForm someNil restt)))) '(1 2 3))
05:29lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!
05:30clgvAtKaaZ: trying to hack clojail?
05:30AtKaaZclgv: i just stumbled upon this line in clojure.core (. (var defn) (setMacro)) and thought to test the bots:)
05:31clgvAtKaaZ: ah you have to do that locally ^^
05:31AtKaaZyep, works on repl
07:42hyperboreeanwhat's the idiomatic way of doing something like: if condition: return nil else: return computed_value ?
07:42nonuby(when condition computed_value) returns nil if not condition
07:43nonubyif condition is dependent on computed_value then when_let
07:43nonubythere is when-not
07:43nonubyfor inverse of when too
07:43hyperboreeannonuby: thanks, checking when/when-not right now
08:07cmdrdatshmm, trying to figure out what I'd name a macro that changes (def…. f [x] [y] (+ x y)) to (defn f [x] (fn [y] (+ x y))) ?
08:08cmdrdatsI'd say currying, but there's a subtle difference, in that (def… f [x & xs] [y & ys] ~body) would be legal and transform to (defn f [x & xs] (fn [y & ys] ~body))
08:36ro_stanyone using clj-webdriver and has any idea why using it with firefox is so slow?
08:41ucbro_st: because firefox
08:42ro_stsending instructions down are fast, but checks against the dom are DOG slow
08:42ro_sthash tag live with it? :-)
08:47hcumberdaleHi ;)
08:48hcumberdaleis there a bug in 4clojure.com, crashing when somebody klicks at "Top Users" > "All Users" ?
08:49hcumberdaleresult nginx/0.7.65 - 504
09:23clgvhcumberdale: works here. but there is some AJAX happening there
09:24hcumberdaleclgv: page crashed!?
09:24clgvhcumberdale: no
09:25clgvbut the server seems to be pretty slow
09:26hcumberdaleclgv: slows down
09:26hcumberdalethen dies
09:26hcumberdale502 Bad Gateway
09:26clgvoh right. happened when I started a search ^^
09:26clgvtakes forever and then died ^^
09:26hcumberdaleya! searching in 'all' users
09:26hcumberdalethat's it
09:27clgvuff 4clojure DOS...
09:27HodappDOS? Where?
09:27clgvhcumberdale: you want to write a ticket, right? ;)
09:28hcumberdale@github?
09:28clgvyeah
09:28clgvhcumberdale: but it seems to recover at least
09:29hcumberdaleclgv nope ;)
09:30hcumberdaleThere is a restart after oom excpt.
09:30clgvyeah, that is what I meant with "recover" ^^
09:32sh10151A quick browse of the Leiningen docs doesn't reveal anything about Maven-style filters -- if a library's XML config needs a value specified at runtime to be substituted in, can this be done with Leiningen?
09:34hcumberdaleclgv: most easy dos with curl
09:56bbloomFrozenlock: what i'm saying is that (-foo ...) is not special like (.foo ...) and (.-foo ...) are
09:56bbloomFrozenlock: it's a bit confusing, i agree
10:10arkxOk, this is weird. I've managed to break ClojureScript's doseq somehow. "Uncaught TypeError: Property 's' of object [object Object] is not a function". Only happens in :advanced mode.
10:10arkxChanging the offending code to (dorun (for ...)) works just fine.
10:12clgvarkx: you wont get any help if you dont show the minimal viable code snipet that causes the error ;)
10:13arkxYeah, I know. It's really hard to extract a minimal snippet from the codebase, since I have no idea how I broke doseq.
10:13bbloomworth noting: dorun is a function, doseq is a macro
10:13arkxIt used to work just fine with doseq previously…
10:13arkxI expect if I created a sample project, doseq would work just fine there.
10:14arkxbbloom: isn't for still macro?
10:15bbloomarkx: i mention it b/c it's re-implemented in core.clj for clojurescript and does some stuff like directly access .nth
10:15arkxIt's really hard to debug the Google Closure Compiler advanced mode output and the problem goes away if I switch to :whitespace mode
10:16bbloomarkx: oh, yeah, crazy hard
10:16bbloomwhat about :simple mdoe?
10:16bbloommode*
10:16bbloomtry with :pretty-print true, as well
10:17clgvarkx: do you have that code in a version control system, by any chance?
10:17arkxclgv: yes, private git repo
10:17clgvarkx: in git you could use `bisect` to detect when it broke
10:17dnolenarkx: minimal case would be helpful - we'd like to address the issue if there's a bug in doseq we haven't seen yet.
10:18arkxI'm trying to cook one up, but so far all the minimal cases just work.. there's something pretty subtle at work here.
10:18arkxdoseq works just fine with :simple mode as well.
10:18arkxI only see the problem with :advanced.
10:26arkxOk, doseq is only broken in that one particular namespace.. what on earth is going on here. Some import fail?
10:27bbloomarkx: do you use aget or aset anywhere in your code?
10:28arkxNo.
10:29bbloomarkx: can you delete code via a binary search down to a minimal repo?
10:30arkxhttps://gist.github.com/arkx/11e6788fdbc807e79b8b
10:30arkxI've cut some irrelevant stuff out, hopefully retaining enough
10:30bbloomarkx: can you eliminate the dependencies?
10:30arkxI'll try.
10:40antares_arkx: you are shadowing empty
10:40antares_which may be used by into and similar core functions
10:41augustldoes clojure.java.jdbc have a method of creating IN queries from sequences? for example, (jdbc/update-values :my-table ["`id` IN ?" my-seq-here] values)
10:41augustlI've tried a few different sequence types, I get exceptions from all of them though
10:44arkxantares_: still happens without empty
10:44arkxupdated the gist
10:44bbloomantares_: shaddowing shouldn't be an issue, since macros resolve namespaces
10:44bbloomarkx: keep narrowing it down, you're getting closer :-)
10:44antares_bbloom: but is doseq a macro?
10:44arkxdoseq is a macro, but so is for
10:45arkxand (dorun (for ...)) works
10:45arkxalso, just switching from :advanced to :simple or :whitespace works
10:45bbloomantares_: it is, so it's possible that doseq has a bug where it uses an unqualified name that is resolved incorrectly
10:45arkxand doseq is only broken in this one namespace
10:45bbloomantares_: but let's wait to see how much further he can narrow it down
10:45arkxIt's used elsewhere in the codebase without issues
10:45ToBeReplacedaugustl: not that i know of; i think you need to create the string yourself... not sure if it's possible to write a parametrized query with an IN
10:45bbloomarkx: can you eliminate the dependency on vision.ui.model ? or inline the code that's necessary
10:46arkxSure.
10:46ToBeReplacedaugustl: also update-values is deprecated iirc; i think update-or-insert-values is preferred
10:47augustlToBeReplaced: I'm using the old 0.2.3 versoin of clojure.java.jdbc so I'll do the deprecation dance when 0.2.4 is out :)
10:50augustlanwer here: https://groups.google.com/d/topic/clojure/W8vkESoIgeU/discussion
10:50augustlanswer*
10:51clgvis there a pr-str version that uses pretty-printing? I want to write a config file with it
10:53ToBeReplacedin core.logic, how do you map a constraint across a seq? ex. (all (map constraint seq))
10:54clgvToBeReplaced: something like "everyo"
10:55ToBeReplacedclgv: "everyg"... thanks
10:59arkxbbloom: eliminated that dependency and bunch of other stuff, still failing. I'll try to extract this to a standalone project.
11:00arkxThis code used to work before a colleague rebased our topic branch, but adding this namespace is the commit that fails. doseq also works just fine elsewhere as far as I can tell.
11:47h0bbitHi All, Is there any way I can jump to Java code from inside the repl?
11:48h0bbitFor example, if I wanted to see the java code behind a low level function, how do I do that?
11:48llasramh0bbit: I believe ritz provides access to Java sources if you have source JARs on your classpath
11:48jro_how do I set an extra entry to classpath, when using leiningen 2?
11:49h0bbitllasram, cool. let me look into that. will be back in a bit.
11:49llasramjro_: (1) You don't. (2) Still don't. (3) Ok, fine, if you really really need to, add it to :resource-paths
11:50h0bbitjro_, You can use :resource-paths for pre-compiled class files and :java-source-paths for java code.
11:50jro_I'm just trying to configure log4j for lein run
11:50h0bbitjro_, If you just want to add a local JAR to your project, consider using lein localrepo
11:56llasramjro_: Oh, you want to add the path containing log4j.properties to your classpath? Ok, then actually :resource-paths is the correct approach :-)
11:58joegallojro_: also, i believe that "resources" is (shockingly!) already included in the resources-path automatically by leiningen, so you can just create that directory and pur log4j.properties into that. (i think.)
11:58joegallos/pur/put/
11:59jro_yes, thanks! did not understand the convention
12:00antares_jro_: use :resource-paths, take a look at https://github.com/michaelklishin/quartzite if you need an example (it relies on quartz.properties in tests)
12:01jro_I was using resources unconsiosly, since (route/resources were routed to resources/public
12:02technomancyI wonder if we should have `lein new` create a resources dir so it's more obvious that it's on the classpath by default
12:03winkhm
12:03antares_technomancy: good idea
12:03winkrandom brainfart: `lein wtf` will show an errata of defined project dirs?
12:04winklike.. an annotated explanation what the current state is
12:04antares_a task that displays dir layout is also a good idea
12:04winkyeah, basically that
12:06antares_technomancy: I also think we should change lein new to fail when project name is "clojure"
12:06winkblacklist all the things!
12:09antares_filed an issue for the task
12:09wink./cheer
12:17TimMcI actually got to use LEIN_IRONIC_JURE=y recently. :-)
12:18hyPiRionTimMc: whoah.
12:18hyPiRionswearjure+
12:18hyPiRion*?
12:18clojurebot* is just for when you are lazy and sloppy
12:22hcumberdalelein new new
12:23hcumberdalelein new hibernate :)
12:27TimMchyPiRion: Yeah.
12:27TimMcI should work on that some more today.
12:29TimMcMaybe I should extort Rich into vetting or applying patches. "For each day CLJ-827 isn't merged, I'll spend 1 hour working on Swearjure."
12:29cheekeeI am trying to find the dependency that runs sine, cosine and log
12:30TimMccheekee: You mean java.lang.Math?
12:31TimMc,(Math/sin 3.14)
12:31clojurebot0.0015926529164868282
12:31tgoossensI'm looking for an example with seesaw that involves forms (buttons espcecially)
12:33cheekeeTimMc: No I meant the clojure dep that took the place of clojure.contrib
12:34TimMc~contrib
12:34clojurebotMonolithic 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
12:34cheekeeor how do I do Sin(pi) in clojure
12:34cheekeeI know but what lib is Sine in?
12:37ohpauleezcheekee: You can use Java's core Math lib
12:37ohpauleezMath/sin
12:37ohpauleezhttp://docs.oracle.com/javase/6/docs/api/java/lang/Math.html
12:38antares_forgive me, father, for I've Math/sinned
12:38ohpauleezohh nvm, I didn't look at scrollback
12:38ohpauleezantares_: haha
12:39ohpauleezcheekee: other than that, there's some stuff worth checking in https://github.com/clojure/math.numeric-tower/
12:39thorwili have a file here where i get a NullPointerException at line 9, if i use nrepl-load-current-buffer, but everything works if i paste the code into the repl: https://www.refheap.com/paste/11408 0.o
12:42tgoossensa bit stupid perhaps
12:42tgoossensbut
12:42tgoossensin emacs using paredit
12:42tgoossensi'm failing to put [x]
12:42tgoossensaround an existing expresssion x
12:43tgoossens(x) is ok
12:43tgoossensM-(
12:44thorwiltgoossens: select x, hit [ turns x into [x] here
12:44antares_tgoossens: works for me. I select x, hit [
12:44tgoossenshmm
12:44cheekeeohpauleez: It is not in Numeric-tower
12:45tgoossensayhes
12:45tgoossensseems to work
12:45tgoossenslol
12:45tgoossensand now for something completely different (not so)
12:45ohpauleezI totally realize that, I think the best bet is to use Math/sin. I was just pointing out numeric-tower for future reference
12:45tgoossens(]
12:45tgoossensi can't get it away :p
12:46cheekeeohpauleez: But thanks I got Math/sin to work
12:46tgoossenskilling does the trick
12:46hyPiRiontgoossens: mark it and do C-w
12:46tgoossensdjeez i'm so unexperienced :p
13:09seangroveI don't know anything about maven, but I'd like to use a package hosted on the cloudbees maven server - how do I set this up with lein2?
13:17AdamCHi, does anyone have any ideas about loading and evaluating code in new classloaders, pulling in dependencies using pomegranate?
13:17dnolenok, just added experimental support for a ^not-native type hint in ClojureScript
13:18dnolenin the presence of this type hint not protocol dispatch overhead on non-higher order protocol fn usage.
13:18dnolenhttp://github.com/clojure/clojurescript/commit/bf4c85c1f17c3f2a26ba57fef896350a7651d8cf
13:23gf3AtKaaZ, gfredericks: Ack, my logs are gone, did I miss something?
13:29gf3Ohp I see
13:36pochoSay you have a map within a map within a map and so on, and you want to edit one of the deeply nested maps and return the entire thing.
13:36pochoWhat's the easiest way to do such a thing.
13:36jeremyheilerpocho, update-in
13:36pochothanks
13:37jeremyheiler,(update-in {:a {:b {:c 1}}} [:a :b :c] inc)
13:37clojurebot{:a {:b {:c 2}}}
13:37mknoszligpocho: assoc-in might also be an option, depending on context
13:45seangroveAh, nevermind, I've got it. :repositories key in project.clj and then just refer to the dependency like a normal clojure dep
13:49cheekeeI have written a program that converts Fahrenheit to Celsius. It works but I am curious as to why N is appended to the output, as in 0N or 100N
13:52cheekee(defn F-convert [temp] (*( - temp 32)(/ 5 9)))
13:53cheekeewhy is N appended to the output?
13:53mknoszligcheekee: (class (F-convert 32))
13:56cheekeemknoszlig: ok thanks
13:58mknoszligcheekee: (/ 5 9) gives a ratio
13:59mknoszligcheekee: let me rephrase: what return type are you looking for?
14:00seangroveI'm not sure how to track this down - just including a reference to ring.adapter.jetty in my (ns ..) form causes: Exception in thread "main" java.lang.VerifyError: class org.eclipse.jetty.http.HttpBuffers$1 overrides final method newBuffer.(I)Lorg/eclipse/jetty/io/Buffer;
14:00seangroveIs there some grizzled clojure expert who can tell me what to look for in tracking down this problem?
14:00seangroveThere's nothing else in the namespace
14:01mknoszligseangrove: what version?
14:02seangroveClojure 1.5.0-beta2, ring-jetty-adapter 1.2.0-beta1
14:02cheekeemknoszlig: I solved the problem by using 5.0 instead of 5
14:06mknoszligseangrove: hmm, maybe you want to try a stable combination?
14:07mknoszligcheekee: :)
14:08pochosay I have some extra information that is needed by the function I'm calling reduce on, that is the same for all the calls reduce makes
14:08pochohow do i pass it down?
14:11antares_pocho: closure locals capture should be sufficient?
14:12abppocho: Yea, you could use an #() or fn to wrap the function reduce is calling if it's not already anonymous or use partial
14:14mknoszligseangrove: seems to work for me... can you provide more detail?
14:15pochoThis functional programming thinking is blowing my mind.
14:16AtKaaZis it necessary to :import any classes that are used for typehints only?
14:17dnolenupdate-in unrolled in ClojureScript, much faster (probably a good idea for Clojure too), apply also now much faster when passing in arg list as vector
14:18mknoszligAtKaaZ: if you write the full name including the package, it should work without :import iirc
14:18AtKaaZmknoszlig: that's what I was thinking but I want to be sure
14:21mknoszligAtKaaZ: my repl confirms.
14:21AtKaaZdid you try including random non-imported class?
14:22AtKaaZi mean type-hinting on that
14:22mknoszligAtKaaZ: trying on an imported class wouldn't make a lot of sense, no? :) - but no, it wasn't random
14:23AtKaaZmknoszlig: true but I mean, I can never tell if it's imported already or not by ie. clojure
14:24ohpauleezis there a Himera-like service with jailed Clojure? I'm basically looking for lazybot-as-a-service
14:24mknoszligAtKaaZ: https://gist.github.com/mknoszlig/e0c987e0e9e4e96aeaf5
14:25AtKaaZmknoszlig: thanks
14:26abpohpauleez: http://tryclj.com/
14:26AtKaaZso I take it the compiler tries to load any referenced class
14:26AtKaaZif it's not already loaded
14:26ohpauleezabp: I want to hit it with RESTful requests
14:26borkdudeI've collected some links of clojurescript canvas games. If you know some other, send them to me. https://www.evernote.com/shard/s96/sh/27537b24-5584-4738-ab2e-7a5545416ac6/7eabfa9335008b66e308011bf0ecb09b
14:26AtKaaZand import does that + also allow you to not fully qualify
14:27abpohpauleez: Oh, yea just got the as-a-service part
14:27augustlI'm writing a stand-alone app that sits between ZeroMQ (my system) and a SOAP API (3rd party). The rest of my system is in Clojure, but perhaps it's not the best fit? I've never really written code against SOAP before, but I guess doing this part of the system in plain old Java is better, with xsd-friendlyness etc. Suggestions? :)
14:28AtKaaZmknoszlig: i guess my only concern is, will the class be loaded automatically if not already loaded, and it would seem that's the case; and import only allows me to not fq
14:28Bodilohpauleez: Well, lazybot is built on Clojail, wrapping it in a web service should be pretty trivial.
14:28ohpauleezBodil: You'd think haha
14:29mknoszligAtKaaZ: i would assume that the compiler just makes sure the class is on the classpath...
14:30citizenparkerborkdude: it's rather unfinished but you're welcome to add https://github.com/citizenparker/inquizitors to that list if you like
14:31borkdudecitizenparker cool, have you hosted it somewhere
14:31AtKaaZmknoszlig: makes sense, thanks again
14:32Bodilohpauleez: I did something like it for an interactive slide deck once, if that's any help: https://github.com/bodil/thefutureisclojure/blob/master/src/server.clj
14:32citizenparkerborkdude: nope, unfortunately. Websocket requirement keeps it off Heroku, never found another free alternative
14:33ohpauleezBodil: ah word, thanks!
14:33lynaghkweavejester: ping
14:37FrozenlockAny breakthrough for making clojure application accept 'plugins'?
14:37tgoossensseesaw is great for gui development. I think i might just create the gui in clojure and then use it as a library in my java project
14:37augustlFrozenlock: the security contexts in Java could probably be used
14:39Frozenlockaugustl: I don't follow...
14:39borkdudecitizenparker I tried building it with lein2 and lein1 but I get an error on retrieving org.clojure.contrib:prxml:jar:1.3.0-alpha4
14:41mknoszligAtKaaZ: np - if you're interested in the details, it's probably worth to take a look at how import* does it's magic
14:42AtKaaZmknoszlig: it would take me ages to understand that code :)
14:43jballancquestion: (into {} (map my-func [2 3 4 5])); and (my-func 2) returns a map --> result is only the last element gets inserted...why?
14:43jballanci.e. (into {} (map my-func [2 3 4 5])) == (into {} (map my-func [5]))
14:44citizenparkerborkdude: Hmm, that's odd. Trying to track down which dep has a requirement for that
14:45mknoszligAtKaaZ: you won't know until you try ;)
14:45mknoszligAtKaaZ: sorry, g2g :/
14:45AtKaaZlaterz
14:48FrozenlockBodil: running your presentation. Are the code slides supposed to be interactive? If so... what's the magic button?
14:48augustlFrozenlock: not sure what you mean with plugins. But if you mean arbitrary clj code running in a sandbox, there's security stuff for that on the JVM
14:49AtKaaZjballanc: (into {} (map #(do [% %]) [2 3 4 5]))
14:49AtKaaZ,(map #(do [% %]) [2 3 4 5])
14:49clojurebot([2 2] [3 3] [4 4] [5 5])
14:49augustlAtKaaZ: using do inside #() was a nice trick :)
14:50citizenparkerborkdude: fixed. The aleph version I was using had a stale dependency
14:50citizenparkerI should eventually switch that out to webbit
14:50Frozenlockaugustl: Ah I see. No I'm not really checking into that for now. It's really a case of 'how can I make it easy for the user to drop a jar file in the directory and automagically have a new plugin activated'
14:52BodilFrozenlock: Oh, good question... I think it's Alt-R?
14:52BodilFrozenlock: They're very old slides. :)
14:52FrozenlockBodil: That did the trick, thanks :)
14:54jballancAtKaaZ: but this works -- &(into {} '({:a 1 :b 2} {:c 3 :d 4}))
14:55jballanc,(into {} '({:a 1 :b 2} {:c 3 :d 4}))
14:55clojurebot{:a 1, :b 2, :c 3, :d 4}
14:55AtKaaZjballanc: is myfunc returning something like: {:a 1 :b 2} ?
14:55AtKaaZ,(into {} '({:a 1 :b 2} {:a 3 :d 4}))
14:55clojurebot{:a 3, :b 2, :d 4}
14:55jballancyeah
14:55AtKaaZthat might explain it
14:55AtKaaZusing the same key
14:56AtKaaZ,(into {} '({:a 1 :a 2} {:a 3 :a 4}))
14:56clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException>
14:56AtKaaZ,(into {} '({:a 1 :b 2} {:a 3 :b 4}))
14:56clojurebot{:a 3, :b 4}
14:56jballancoh gosh darn it...
14:56jballancyou're absolutely right
14:56jballanc:(
14:57jballancI'm repeating keys
14:57jballancthanks...knew it was something stupid
15:08mefistoanyone else at dev nexus?
15:35pepijndevosare there any other IRC clients/servers/libs than subrosa and irclj? Thinking about building a bouncer of sorts.
15:38abpHow do I best organize multiple projects that share the same groupid? Should I keep the directories flat? ie publish as groupId/artifactId but make artifactId-dirs?
15:39gfredericksI see an ML question from ejackson from April about bulk import in datomic, and stuarthalloway seemed to say there isn't any such thing at the moment. Does anybody know any up-to-date info on that?
15:39pepijndevosabp, seem okay to me.
15:40Raynespepijndevos: I don't know of any.
15:40dnolenso it's looking like ObjectMap really doesn't offer much over PersistentArrayMaps - http://jsperf.com/objectmap-vs-persistentarraymap/2
15:40Raynespepijndevos: I think irclj would potentially work for writing a bouncer.
15:40RaynesI'm not sure though.
15:40RaynesMight need something more low-level.
15:40pepijndevosRaynes, what about the server part?
15:41RaynesYou'd still need to write a server.
15:42brehautim blanking on name of the lib that tells you what you are doing wrong stylistically
15:43gfrederickskibit?
15:43brehautyes!
15:43pepijndevosRaynes, are commands from the server the same in format as the other way around? I mean, obvisously irclj isn't a server, but it can send stuff right?
15:43Wild_Catquick design question: I'm writing a game where some, but not all, characters' attacks have special effects, represented by different functions. Do I stick these functions in the maps I'm using to represent the characters, or do I define attack as a multimethod?
15:43Raynespepijndevos: Yes, the part of Irclj that parses messages should be general for both a server and client.
15:44amalloybrehaut: also eastwood, although i don't think that ever really took off
15:44brehautamalloy: thanks
15:44pepijndevosRaynes, cool, i'll look into it more later.
15:45pepijndevosdnolen, oh, does that mean you get to throw away code? I love doing that.
15:45dnolenpepijndevos: eventually
15:46pepijndevosdnolen, but, "56% slower" than what?
15:47dnolenpepijndevos: what do you mean?
15:47yogthosI've got a question, is there a way for a namespace to expose functions from a different namespace it refers to?
15:48pepijndevosdnolen, when I run the test, to the right it says for every test "so-and-so many percent slower/faster"
15:48brehautamalloy: waitaminute, eastwood and kibit are both by the same guy?
15:48amalloyare they? i didn't notice
15:48brehautentirely possibly ive stumbled across a fork
15:48dnolenpepijndevos: js perf isn't really ideal for this kind of test, it assumes they are all of the same kind
15:49pepijndevosah
15:49abpyogthos: Yeah but amalloy is around, so better stop talking about it. ;P
15:49yogthoslol
15:49amalloyhaha
15:49dnolenpepijndevos: but you can see that we're comparing ops on ObjectMap & PeristentArrayMap
15:50pepijndevosyea, it makes sense if you ignore the relative bits
15:50amalloyfind a way to do it with juxt, that'll mollify that crazy amalloy
15:50brehauthmm. kibit is complaining about not having a reader function for ordered/map
15:52abpyogthos: https://github.com/ztellman/potemkin that's one possibility
15:53yogthosabp: ah yes I've seen potemkin before, it does some serious black magic :P
16:01amalloyyogthos: you have black goals, so...
16:01dnolenpepijndevos: the take away is that with an optimized PAM, OM seems a lot less necessary.
16:01yogthosamalloy: haha mayhaps :P
16:03aduPAM? OM?
16:04yogthosmainly what I was thinking is if you have a lot of different libraries you're using, such is with web apps, it gets a pain to do all the imports every time
16:04dnolenPAM=PersistentArrayMap, OM=ObjectMap
16:04yogthosit seems like it would make sense to make something you can refer to once that would expose all the useful bits
16:05bbloomdnolen: running those benchmarks now. if we can get rid of OM, that would be huge & make the Keyword type much easier :-)
16:06dnolenbbloom: yeah, it seems to there's not really an interesting difference now between OM & PAM on all the major browsers
16:07dnolenbbloom: PAM is faster on V8 than OM, and only slightly slower on the other browsers than OM
16:07bbloomdnolen: can you gist the benchmark source? i wanna verify
16:07dnolenbbloom: http://github.com/swannodette/cljs-perf
16:07bbloomdnolen: sounds good!
16:07gfredericks,(with-redefs [first second] (first [1 2 3 4]))
16:07clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException>
16:08bbloomdnolen: ok cool, with array-map you're always looking up the last entry
16:08dnolenbbloom: yep
16:09bbloomdnolen: i vote to nuke ObjectMap from orbit :-)
16:09dnolenbbloom: hehe, I'd like to do a little more testing and post the results on the clojure-dev ML
16:09dnolenfirst
16:09bbloomi see you set the threshold to 8, what is the threshold in clojure proper? how did you arrive at 8?
16:10dnolenbbloom: 8
16:10dnolensame threshold as Clojure
16:11bbloomany chance we can plot performance for thresholds from 4 to 32 or so
16:11dnolenbbloom: I don't really see the point, after 8 the cost of copying becoming quite large
16:11dnolenOM & PAM are only about small maps
16:12dnolenOM is hack to get JS Obj perf, and PAMs now demonstrate it's not a big win.
16:12bbloomdnolen: i'm just curious what "small" means considering a lot of file systems and the like use absurdly large branch factors
16:12dnolensmall is 2-4 keys, which is very common
16:13bbloomsmall defined by what metric? common usage or by efficiency? vectors use a array of what? 30 entries? where did that value come from? seems like we need to measure
16:13bbloomwe might find that PAM out performs PHM until 30 or so
16:13bbloomdon't know unless we try
16:13dnolen32, numbers comes from cache size
16:13dnolenbbloom: we have tried
16:13dnolenbbloom: like a year ago
16:14bbloomin clojurescript?
16:14dnolenyes
16:14bbloomor just clojure?
16:14bbloombut what about now with the improvements to PAM?
16:15dnolenbbloom: it's going to be a tradeoff between update/lookup
16:15bbloomof course
16:15dnolenbbloom: I agree it would be nice to have more information about precisely what that tradeoff is
16:15bbloomdnolen: i'll give it a shot over here, you mail the list :-)
16:17dnolenbbloom: cool, I think the new ^not-native type-hint is pretty useful
16:17dnolen(unrelated to PAM/OM of course)
16:17bbloomdnolen: i saw that, but didn't think too hard about it yet
16:18dnolenbbloom: it just eliminates protocol dispatch overhead
16:18bbloomdnolen: makes sense
16:41TheComradeHola! I'm looking for recommendations for screencasts of Clojure used with Emacs, beginner or advanced.
16:54andres-vTheComrade: ¡Hola! Are you familiar with Emacs? (This is an old one: http://vimeo.com/8356990) I think a lot of people use nrepl now: https://github.com/kingtim/nrepl.el) but maybe it will help you to get a feeling about Clojure+Emacs
16:55andres-vTheComrade: http://vimeo.com/9770382 (2010), and some other Clojure video links here: http://learn-clojure.com/clojure_videos.html (I am sure there's more... somewhere :-) )
17:16craigbrohaving a brainfart
17:16craigbroI am trying to add a custom encoder to cheshre for byte arrays
17:16craigbroand can't figure out how to represent the [B class in clojure
17:16craigbrohmmm
17:17craigbrobut since add-encoder uses (extend...
17:17craigbrois it even possibly?
17:17brehautyes
17:17craigbropossible I mean
17:17brehautjust a moment
17:17brehaut,(Class/forName "[B")
17:17clojurebot[B
17:18brehautcraigbro: ^ extend accepts that as its first argument
17:21craigbrohmm, still no dice at the cheshire level
17:22craigbroah, method sig issue on my part
17:24tcrawleyhugod: here you go: https://github.com/pallet/ritz/pull/77
17:24tcrawleythanks!
17:25hugodtcrawley: thank you for sorting it out
17:25tcrawleyhugod: heh, it's the least I can do, since I caused it :)
17:27hugodtcrawley: that sort of issue is all to easy to hit - is pomegranate using the newer dynapath?
17:28tcrawleyhugod: pomegranate isn't yet using dynapath, the PR is still pending. but when it is merged, it will use 0.2.1
17:33craigbrohmm
17:33craigbrocan't seem to get cheshire to handle byte arrays
17:35craigbrosure it's a user error
17:37hugodanybody successfully using dir-locals.el for customising nrepl.el nrepl-history-file?
17:38seangroveHrm, how can I generate a jar file for lein2? I need it apparently to use it with Jenkins
17:39seangroveAh, nevermind, I see it downloads itself
17:40FrozenlockRaynes: When you change your picture when I'm looking at one of your repo, I feel observed.
17:40RaynesHaha
17:41RaynesFrozenlock: Especially when I change it to one this creepy.
17:41RaynesI wish I had captioned it with "I see you looking at my repos, boy."
18:00callenbotRaynes: I'm going to need a cigarette after having your github profile image look at me like that.
18:00Rayneslol
18:02cemericktcrawley|away: damn, sorry. :-( I'll try to get that in this week. Bother me incessantly on all channels if I continue to drop the ball
18:02Foxboronhey, cemerick i think i might have found a fault in Clojure Programming, on page 190. (i did tweet at you also)
18:05tgoossensi'm going to give it a go. Just because I can. I've learned working with emacs for clojure, but wan't to try out java development with it
18:05tgoossensany tips on useful plugins?
18:10Bodiltgoossens: No, and if it turns out there are some, I'd very much like to hear about them. I've tried in vain so many times to make Emacs an acceptable Java editor...
18:10tgoossensi heard it is not ideal. But i just want to try it
18:10tgoossensand someone here in the irc spoke about a plugin that somehow uses eclipse
18:10Foxborontgoossens: didnt ljos mention a plugin?
18:10tgoossensbut for the love of god, i cannot remember the name of the project
18:11BodilOh, Eclim. Yes, tried that. Horrible experience.
18:11tgoossenseclim
18:11tgoossensthat was it!
18:11tgoossensstill not sure what it is exactly
18:13Bodiltgoossens: The closest I got to a working environment was with malabar-mode. But it's basically unfinished and not seeing any development.
18:13Bodiltgoossens: Though apparently CEDET is coming along on the Java front. Last time I tried it it was a mess, but it might have gotten better by now.
18:14tgoossenslol
18:14tgoossenscedet even has UML diagrams o.O
18:14Bodil...yeah...
18:15tgoossensbodil: I didn't say it was really useful :p
18:15tgoossensits just.. uml in terminal
18:15tgoossensits a bit fancy :p
18:16BodilWell, at least it proves Emacs can do anything... though one hopes it was intended as irony or something.
18:16tgoossenshaha
18:16tgoossensmalabar mode seems pretty extensive to me
18:17BodilMalabar was really nice, except it just kept crashing and crashing.
18:17tgoossenshmm
18:17tgoossenshow long ago?
18:18BodilAbout two years. Doesn't look like there's been any serious commits to it since, sadly...
18:19tgoossensbah
18:19tgoossensi'll give it a try nevertheless
18:19tgoossensi'm obligated to work on a project in java for a few months. and i just learned emacs (which i'm starting to like)
18:19tgoossensso I'm trying to combine it :p
18:19tgoossenslike many other before my i guess
18:20BodilI know that exact feeling, yes. :)
18:20BodilI'd say CEDET is your best bet. Just too bad it's such a giant project.
18:20tgoossensalso
18:21tgoossensI have not really a clojure project running (though this project would be perfectly suitable for clojure, my teammates don't agree with me :))
18:21tgoossensall i'm doing is small experiments most of the time
18:22hyPiRiontgoossens: You could try out JDEE, as it depends upon CEDET.
18:22tgoossenshmm
18:23hyPiRionThough I've not tried either, but will do so in the (hopefully (?) distant) future.
18:23BodilhyPiRion: Yeah, that's what I had in mind. It's a part of CEDET proper, iirc.
18:24hyPiRionBodil: Oh, I thought they were separate projects, but JDEE depending heavily on CEDET.
18:25BodilhyPiRion: I got the impression it was moved into CEDET. But with the size of that thing it's hard to tell. :)
18:26callenbotBodil: there are better options, like using that daemon that harnesses IntelliJ or something and exposes an API to vim and Emacs.
18:26callenbotI've seen people use such things for scala.
18:26Bodilcallenbot: You mean Eclim? That didn't really work out for me - especially since I still had to use Eclipse to manage projects etc.
18:29craigbrooi
18:29tgoossensbodil: i'm going to try it out, but apparently you can run a eclim session WITHIN eclipse
18:30Bodiltgoossens: Yeah, you can. I guess it's at least better than having to use Eclipse all the time. :)
18:31tgoossensBodil: I remember the time I was trying to use eclipse for everything: python, eclipse, java, c++, javascript, php
18:31tgoossensand it worked
18:31tgoossensthat's true
18:32BodilYeah, I used Eclipse for everything too... I feel much better now after switching to Emacs, I'm happy to report. :)
18:32tgoossensit seems that it is a vimplugin
18:33tgoossensi've been using emacs for over a week now
18:33gf3sjl: Have you considered (in Badwolf) changing the cursor color to reflect the current mode (much like you do with the status bar)?
18:33Bodiltgoossens: You want https://github.com/senny/emacs-eclim
18:37pochoHey guys, I need help figuring out how to express something that's probably in clojure.core
18:37pochohttp://pastebin.com/raw.php?i=ian8f6hZ
18:38pochoIm not used to all this functional business
18:41callenbotBodil: nothing of the sort is ideal, generally. I avoid that stuff when I can.
18:42RaynesBodil: You should have called catnip katniss.
18:43BodilRaynes: As if enough people don't already make that connection and assume I'm a Hunger Games fangirl? :)
18:44RaynesYou aren't? :(
18:45BodilI don't know, I guess there's a chance I might become one if I actually read the books some day. :)
18:45RaynesThe movie is pretty good too.
18:46BodilYeah, it wasn't horrible. I think I'm sticking to my MLP fandom, though. :)
18:46RaynesHaha.
18:47seangroveWhat's likely the problem if ring never responds to a request?
18:47seangroveThe browser is just hanging waiting for a response
18:47hiredmanseangrove: if your handler never returns
18:47hyPiRiondoes ring print out anything in the console
18:48hyPiRion?
18:48seangrovehttps://www.refheap.com/paste/11435
18:48hiredmanaleph's ring adapter used to do that, and swallow the exception
18:48hiredmanwhich ring adapter are you using?
18:48seangroveI'm starting it with `lein ring server`
18:48seangrovehyPiRion: Nothing comes out after "2013-02-18 15:47:14.324:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:3000"
18:49hiredmanseangrove: when happens when you hit it with curl?
18:49seangroveHangs
18:49seangrovehttps://www.refheap.com/paste/11436
18:50seangroveLet me see if I can start it from the repl...
18:51jballancanyone have a favorite Ring logging middleware?
18:52seangroveHrm, same problem from the repl
18:53seangroveAh, it might be because of com.saucelabs/sauce-connect
18:58bloopI'm using counter clockwise for Eclipse and playing around with namespaces. I wrote (ns clojure.set) and then def'd a few things. Now even if I totally clear the file and run it again, there are still these extra things in clojure.set. Am I not understanding how definitions work or how "running a program" works or what? It seems like clojure.set should be blank at the start regardless of what I've run in the past...
18:59bloopwell not blank but also not having the things I def'd
19:00bloopI guess I can get a brand new REPL by running the program with the lpay button at the top, never mind
19:01RaynesBodil: You asked what my favorite pony is… https://dl.dropbox.com/u/23745600/bodilshy.jpg
19:02BodilRaynes: What? Not Bodil Dash? :)
19:06craigbroVICTORY!
19:06craigbro8^)
19:06FrozenlockYou 6 pooled?
19:58lynaghkoctagon: todoFRP pull request please!
20:06octagonlynaghk: my pleasure!
20:09zerokarmalefthiredman: trying to fire up clojurebot for a private irc channel, seems i've misconfigured the security policy somewhere https://www.refheap.com/paste/11439
20:10zerokarmaleftdoesn't it use the default permissive example policy if you don't specify one as a parameter?
20:18tcrawleycemerick: heh, no worries. I may update the bug-you frequency to monthly though :)
20:19cemericktcrawley: I have the issue open in a browser tab, so it won't be long now ;-)
20:21hiredmanzerokarmaleft: my guess is you don't have a clojure.jar setup for it
20:21hiredmanzerokarmaleft: https://github.com/hiredman/clojurebot/blob/master/clojurebot-eval/resources/config.clj is the default config
20:22hiredmanzerokarmaleft: it uses https://github.com/sonian/carica for configuration so you can override the default with a config file on the classpath
20:22hiredmanor just use the default
20:22zerokarmalefthiredman: ah ok...thanks
20:23hiredmanbut it is hard to tell without the whole stacktrace
20:25ppppauli'm trying to do something interesting with compojure routes. but running into a bit of trouble https://gist.github.com/boxxxie/4982312
20:25ppppauli want to have a context that matches a plural
20:25zerokarmalefthiredman: fixed the clojure.jar config, progressed to a RT security exception: https://www.refheap.com/paste/11440
20:28hiredmanzerokarmaleft: how you deploying clojurebot-eval?
20:28hiredmanif you are doing it inside some kind of container it might set its own policy or something
20:28zerokarmaleftjava -Djava.security.manager -Djava.security.policy="file:///Users/zerokarmaleft/Projects/clojurebot/resources/example.policy" -Xmx100m -jar target/clojurebot-eval-1.1.0-SNAPSHOT-standalone.jar
20:29hiredmantry without the -Djava.security.policy=...
20:30hiredmant should just load the example.policy from the jar
20:31zerokarmaleftdisco!
20:32zerokarmaleftthanks for the help :D
20:32hiredmansure, good luck running clojurebot
20:54TimMcWell, that's unfortunate:
20:54TimMcjava -Dclojure.read.eval=unknown -jar ~/.m2/repository/org/clojure/clojure/1.5.0-beta11/clojure-1.5.0-beta11.jar -e "(+ 1 2)"
20:54TimMcException in thread "main" java.lang.RuntimeException: Reading disallowed - *read-eval* bound to :unknown
20:54TELawrenceTimMc, hi
20:54TELawrenceI'm the beloved mascott of this channel.
20:54gfredericksTimMc: why beta11?
20:54TELawrenceLoved by all, My Shadow is Worshipped
20:54TimMcOh, is that old?
20:54gfredericksRC-16 is last I heard
20:55warznot sure if there's a ring-specific channel, but im trying to figure out how to use multiple middleware in the correct order. i just want to read a key out of the :params map in one of my middleware functions. the params map is not there in the middleware function though, but eventually during the route handler the params map is in the request. so i think i'm applying the middleware functions
20:55warzin the wrong order, or something.
20:56warzand i don't think i can put the main `handler/api` at the end
20:56TimMcgfredericks: Well, still fails.
20:56warzmy code is here, if anybody knows why this might be the case: https://github.com/ryancole/localshop/blob/master/src/localshop/handler.clj
20:57gfredericksTimMc: hmm...so this is an issue with the command line evaller?
20:57TimMcYeah.
20:57TimMcI'll post to the ML.
20:57warzxeqi suggested rearranging them, earlier today, and i messed around with that but i think i have to have the `handler/api` portion first?
20:58gfrederickswarz: well if you put the whole (handler/api app) part lower down that would definitely fail
20:58gfrederickss/app/app-routes)
20:58gfrederickss/)//
20:58warzyea thats what i tried, but then the middlewares arent passed the handler
20:58gfrederickspull app-routes out and put it at the top
20:59gfredericks(def app (-> app-routes (handler/api) ...))
20:59gfredericksthen you'll be free to rearrange them
21:00yedihow can i do session handling with compojure?
21:00ravsterhello all
21:00gfredericksyedi: there are libs for it; I think sandbar is one but I haven't kept up
21:00warzgfredericks, ah ok that does the trick.
21:01gfrederickswarz: sweets
21:03warzwhat order do those middleware functions work, with the main handler being at the end of that? is it like in order of first to last?
21:03warzim confused as to why the main handler being last gives the params to the ones before it
21:03gfredericksthe last middleware is the outermost
21:03gfredericksdo you know how -> works?
21:04warznot entirely. i know what it does but not how it does it
21:04gfredericksit's all syntax
21:04warzi knew it passed that first item through the remaining functions
21:04gfredericks(-> app-routes (a) (b) (c)) is just (c (b (a app-routes)))
21:04warzah ok
21:05gfredericksthat combined with the way middlewares work (function wrappers) gives you the behavior you see
21:08TimMcgfredericks: All it took to uncover that bug was adding :jvm-opts ["-Dclojure.read.eval=unknown"] to a lein project.
21:08gfrederickso_O
21:08TimMc(A lein project with RC16 as a dep, mind you.)
21:09gfredericksI wonder how it was tested...
21:09TimMc*whether
21:10gfredericksI swear abedra was tweeting about having fun figuring out where read was used by setting it to unknown
21:10TimMcYeah, so how did that work? :-/
21:11TimMcWell, maybe abedra didn't use the lein repl task?
21:12TimMc...no, other tasks fail as well.
21:14gfredericksI don't suppose unknown wasn't meant to be used with the system property?
21:14TimMcNo, it is.
21:17gfredericksI imagine clojure ought to be setting it to true, eh?
21:17Fatalnixis there any official clean documentation on annotations (maybe I missed it? ) because the software I am trying to integrate with uses them to interface my classes.
21:17TimMcYeah, since it just turns around and evals it.
21:18Fatalnixfound a few things here and there but they looked old and dirty
21:20TimMcFatalnix: Looks like you just list them in the metadata: https://gist.github.com/richhickey/377213
21:21Fatalnixhmm, that's what I just found, and these are the same annotations java uses?
21:25TimMcYep, JVM annotations.
21:26Fatalnixcool
21:31dnolenbbloom: ping
21:31bbloomdnolen: pong
21:32dnolenbbloom: so it looks the do block change http://dev.clojure.org/jira/secure/attachment/11760/CLJS-441-v001.patch
21:32dnolenbroke type inference
21:32dnolenbbloom: we used to rely on :ret to determine the type of a let expression
21:32bbloomdnolen: bah. i can't win, can i? :-P
21:32dnolenwas looking through the output and was suprised to see cljs.core._truth on critical paths
21:33dnolencompilers are hard
21:33dnolenbbloom: what was the rationale for removing :ret?
21:34bbloomdnolen: it would be nice to have a pretty-printted bit of compiler output checked in so that we can visually diff to catch these sorts of errors earlier
21:34bbloomdnolen: let me look/think/recall
21:34dnolendefinitely - we sould have a compiler.test namespace
21:34dnolenshould
21:35bbloomdnolen: ok, the reason :ret was removed was because it relied on non-do forms understanding statements
21:36bbloomdnolen: basically, type inference can happen more generally, so we really shouldn't check :ret, we should check :tag or whatever generally... only analyzing 'do should look at :ret b/c it knows about that and :statements
21:36bbloomjust an oversight on my part, should be pretty easy to get :let, :letfn, :try, etc to look at their body node for :ret and infer the type
21:37yedii'm getting a dependency error when running lein ring server for libs that i don't even include in my project.clj, is this expected?
21:37yedispecifically it says hiccup can't be found and i'm not even using hiccup
21:37yedithis only started happening when i added sandbar to the project
21:38bbloomdnolen: RE: compiler.test namespace. i think the easiest thing is just to just check in some pretty printed code. maybe core.test
21:39bbloomdnolen: gold file tests are great for things that may change and need a human to inspect to confirm/accept
21:40dnolen`bbloom: sorry spotty internet
21:40dnolen`bbloom: did I miss something you said?
21:40bbloomhttps://gist.github.com/brandonbloom/4982655
21:40bbloomdnolen`: ^
21:41bbloomdnolen`: i was doing that a little bit with the twitterbuzz thing: recompiling and diffing
21:41bbloomparticularly helpful for validating changes to optimization applicability in realistic code
21:41dnolen`bbloom: I don't see why type inference needs to hard coded into the analyzer
21:42bbloomdnolen`: wasn't it before?
21:42dnolen`bbloom: no type inference happens in the compiler
21:42bbloomdnolen`: inference happens during emission? that seems odd
21:42bbloomisn't it also applicable to other backends?
21:43dnolen`bbloom: that's possible though at the moment the boolean inference is really only relevant to JS
21:43bbloomdnolen`: so look at the :infer-tag function
21:43bbloomdnolen`: my oversight was not adding cases there
21:44bbloomdnolen`: basically :let should look at infer-tag of :body, not :ret
21:44dnolen`bbloom: what cases?
21:44bbloomsimilar for :try, :letfn
21:44dnolen`oh ok
21:44bbloombut in reality, just :let will get back what i broke
21:44bbloomdnolen`: quick fix
21:44bbloomwant a patch?
21:45bbloomprobably quicker for you to just try it
21:45dnolen`bbloom: so just switch :ret -> :body?
21:45bbloomdnolen`: actually, it's :expr
21:45bbloomnot :body
21:45bbloomthat should do the trick
21:47FatalnixSo I think I'm doing this right.. having something like, @Initialize and then public void initialize() {} in Java is the same as the folloowing in clojure?: (defn initialize [] (with-meta (:Initialize))) ?
21:47Fatalnixfollowing*
21:47dnolen`bbloom: hmm doesn't work
21:48gfredericksFatalnix: I've never done annotations in clojure and I'm almost certain that's wrong
21:48Fatalnixit feels wrong haha
21:48bbloomdnolen`: hmm let me think
21:48Fatalnixdefn wouldn't let me do defn ^{ blah }
21:49amalloyyou cannot set annotations except via your gen-class clause
21:49amalloyother than that, i don't know the details, but gfredericks is right that any fiddling you're doing with defn is nonsense
21:51bbloomdnolen`: still thinking, but you can probably add inference cases for meta, letfn, and try* as well: https://gist.github.com/brandonbloom/4982699
21:52dnolen`bbloom: sure, I just want to solve the immediate problem tho
21:52bbloomdnolen`: of course, i'm looking
21:52Fatalnixhmm.. See, I'm trying to test something to see if it's possible, and if this were done in Java, it would look prety much like this: http://nopaste.info/65a0d49be3.html - Trying to see if I can do this without using a java wrapper. But if it's not pssible, it's not a big deal.
21:53bbloomdnolen`: oh, duh, need to add a :do case
21:53bbloomdnolen`: :do (infer-tag (:ret e))
21:54bbloomdnolen`: right?
21:54dnolen`bbloom: trying
21:56bbloomdnolen`: updated gist with all the cases including :do https://gist.github.com/brandonbloom/4982699
21:58dnolen`bbloom: yeah still not working with :do case looking at :ret
21:58bbloomdnolen`: damn :-/
21:59Sgeobrainproxy, you here?
21:59bbloomdnolen`: you've got both the :let and the :do, right?
21:59dnolen`bbloom: yeah
21:59brainproxySgeo: i am
21:59clojurebottransients is not mutable data structures: http://technomancy.us/132 or at least as far as you're concerned.
22:00bbloomdnolen`: ok let me investigate myself
22:00dnolen`bbloom: I'm testing with this
22:00dnolen`bbloom: (ana/analyze '{:ns {:name cljs.user}} '(and true false))
22:00Sgeobrainproxy, so a "monadic value" in the reader monad is just a function waiting for an argument
22:00dnolen`inferring (if true false false), (do true false true), true all work
22:00SgeoSo (fn [n] (+ n 1)) could be considered a monadic value
22:00dnolen`and (let [] true)
22:01dnolen`but '(and true false) does not
22:01SgeoRunning it is just passing a value to the function
22:01SgeoThis function can be considered to have a globally readable value
22:02dnolen`bbloom: (c/infer-tag (:ret (:expr (ana/analyze '{:ns {:name cljs.user}} '(and true false))))) returns nil
22:02SgeoSo while you're in the reader monad, there's a value that you can read from at any time
22:02Sgeo(Well, only in the same way as doing things in other monads)
22:02SgeoYou're still building up a function that is waiting for an argument
22:02brainproxySgeo: what do you mean by considered to have a globally readable value
22:03bbloomdnolen`: yeah, i just evaluated exactly that. i need a minute to explore
22:03brainproxyoh i see
22:03Sgeoreturn (I forget what it's called in the common Clojure libraries) just gives a function that ignores its argument and returns the value
22:04Sgeo(defn m-result [v] (fn [x] v))
22:04brainproxyah
22:04SgeoBecause the argument is the value that you can read
22:05SgeoLet's look at bind
22:06Sgeo(defn bind [mv f] (fn [r] (f (mv r))))
22:06SgeoI think
22:07SgeoWait, no
22:07Sgeo(defn bind [mv f] (f (mv r)))
22:07SgeoWait, that makes no sense either
22:07brainproxyright, bind needs to return a monadic value of the same type
22:08brainproxythat is, a reader monad value
22:08bbloomdnolen`: i figured out wh6y
22:08bbloomdnolen`: that's generating an 'if with a nil else
22:08bbloomthe :constant case boolean has a nil case with no tag type
22:09bbloomthen-tag is 'boolean, but else-tag is nil
22:09dnolen`bbloom: yeah I just now saw that too - hmm, weird this worked before
22:09Sgeo(defn bind [mv f] (fn [r] ((f (mv r)) r)))
22:09SgeoThat should do the trick I think
22:09bbloomdnolen`: so i definitely broke it, but i think something else ALSO broke :-P
22:09brainproxySgeo: I bet I could work backwards from the laws, and knowing what bind return looks like, to come up with bind
22:10SgeoGo ahead :)
22:10SgeoOr I could try to explain what I wrote
22:10brainproxywell maybe the one you gave is correct, studying it
22:11SgeoBasically: Bind is returning a monadic value: A function. So first, our function takes its argument and passes it to mv, to get a result. It then passes that to f, to get another monadic value (a function). Since we are already inside the monadic value we want to create, we need to run this function with the r that we have.
22:12SgeoI just looked at a definition in Haskell, looks like I got it write
22:12Sgeoh >>= f = \w -> f (h w) w
22:16dnolen`bbloom: actually I'm mistaken, (and true false) is not a good example
22:16dnolen`(and (true? true) (false? false)) is better
22:16brainproxySgeo: makes sense to me; what I need to do next is try and write a protocol-monad that has these characteristics, write tests for it, and play with it a bit in the context of the do macro
22:16dnolen`bbloom: I don't think we can actually infer (and true false) at the moment
22:17Sgeobrainproxy, want an example in Haskell's do notation?
22:17brainproxySgeo: sure!
22:18bbloomdnolen`: seems like the same problem occurs: the :else form is a symbol because of the 'and macro introducing a 'let
22:18Sgeohttp://codepad.org/ddrHSU7u
22:18bbloomdnolen`: let needs to copy the tag over for each binding
22:18SgeoNote that do notation in Haskell works different from the do macros in Clojure libraries
22:19SgeoWhich is why there's an explicit return at the end
22:19brainproxyright
22:19dnolen`bbloom: yes what I'm saying is (and true false) is a bad example
22:19bbloomdnolen`: but i think the same problem affects that new form you showed me
22:19dnolen`I only made inference work for the fn cases and hinted symbols
22:20dnolen`bbloom: no because there we have a tag for the expression
22:20Sgeobrainproxy, in Haskell (*2) is the same as (\x -> x * 2), which in Clojure terms is #(* %1 2)
22:20dnolen`bbloom: or at least we used to
22:20dnolen`bbloom: oh hrm
22:20SgeoSo, when you pass an argument to addStuff, a will take on the value of 2 times the argument, and b will take on the value of 10 plus the argument
22:20dnolen`bbloom: ok you're right, we've lost a tag from the let
22:20brainproxySgeo: although I bet I could use a dynamic binding so that inside a p-m do macro, you would use m/return explicitly and it would be bound to the correct return
22:21SgeoImagine if instead of (*2), I used id (the identity function)
22:21SgeoThen a would take the value of the argument to addStuff
22:21bbloomdnolen`: yeah, no tag on this: (-> (ana/analyze '{:ns {:name cljs.user}} '(and (true? true) (false? false))) :bindings (get 0) :init)
22:22SgeoSo I can effectively ask for the argument of the whole, that is, the value of this readable thing, as an action within the monad
22:22bbloomdnolen`: er no i'm wrong
22:22SgeoIt is the primary action that I can do in the reader monad.
22:22bbloom(-> (ana/analyze '{:ns {:name cljs.user}} '(and (true? true) (false? false))) :bindings (get 0) :tag) ;; boolean
22:22dnolen`bbloom: ok that's what I get too
22:23brainproxySgeo: so, just to make sure I understand, you've essentially built a function that takes one argument, addStuff
22:23brainproxyand its implementation is per the do notation
22:23SgeoYes.
22:23SgeoAnd (*2) is a function that takes one argument, as is (+10)
22:24bbloomdnolen`: we need a case for :var
22:24bbloomdnolen`: although the base get-tag case should handle that
22:25brainproxySgeo: okay, I think I got it!
22:25Sgeobrainproxy, yay!
22:28bbloomdnolen`: yeah, i think this works for me with the :do and :let changes i proposed
22:29dnolen`bbloom: so add a :var case?
22:29bbloomdnolen`: no, no var case
22:29dnolen`bbloom: oh, you think works, ok lemme check compilation of core
22:29dnolen`think this works I mean
22:31bbloomdnolen`: i just tested the :try* in my gist, that won't work because of the fact that it re-throws if no exception types match
22:32bbloomdnolen`: and meta doesn't matter because booleans can't have meta data... but letfn does work
22:32bbloomdnolen`: use this: https://gist.github.com/brandonbloom/4982699 it seems to work for me
22:33bbloomdnolen`: the oversight on my part was simply missing that one :ret case
22:34amrohm, suddenly I can't use backspace/arrowkeys etc in cljs repl
22:34amroI get ^H etc instead
22:35dnolen`bbloom: awesome seems to work!
22:35dnolen`bbloom: really it's not the introduction of truth that is killer but the generation of anonymous functions because of complex tests to an if in the presence of the truth test
22:37RaynesYou're all good peoples.
22:37bbloomdnolen`: i see....
22:37bbloomdnolen`: type systems: turns out they are sometimes useful. heh
22:37dnolen`bbloom: awesome, more perf boosts around array-maps on other JS engines because of this chnage
22:39bbloomdnolen`: cool
22:39bbloomsorry i missed that the first time!
22:40bbloomdnolen`: we should definitely do a gold file test suite
22:40dnolen`bbloom: yes, the next on my list of todos, testing the output of the compiler
22:40dnolen`and adding the basic inference cases
22:41bbloomdnolen`: i think gold files are faster/easier/better than unit tests here
22:41dnolen`bbloom: oh, not familiar w/ gold files
22:42bbloomdnolen`: i think the term might be a Microsoft-ism
22:42bbloomdnolen`: essentially, we just check in the simple/pretty-printed compiled test code
22:43bbloomdnolen`: so whenever we make a change, if it changes the output, you can skim the diff and see how it changes
22:43bbloomdnolen`: it's not automated like a regular unit test, but they are far more comprehensive
22:43bbloomand `git add` is basically all you need to do when you say "oh yeah, ok this looks fine"
22:44dnolen`bbloom: hmm, interesting idea, probably worth running by the dev ML
22:45dnolen`bbloom: I like the idea of it
22:45bbloomdnolen`: at minimum, we can create an external repo for it
22:46bbloomit won't be 100% integrated into your work flow that way, but it will give us a way to track it anyway & if it's useful, we can fold it in to the main source tree
22:46dnolen`bbloom: I'm actually not against - it's a good way to sanity check compiler work
22:46dnolen`bbloom: just would like to see what others think
22:47dnolen`in particular it would have caught this inference regresion
22:47dnolen`but I think moving forward there will be more things like this
22:47dnolen`and it nice to know exactly when critical compiler changes happened
22:47bbloomdnolen`: the xbox compiler guys swore by their gold files for debugging optimization tweaks
22:48bbloomdnolen`: particularly when you have crazy vectorized powerpc isntructions
22:48bbloomheh
22:48dnolen`bbloom: I can imagine
22:48dnolen`bbloom: thx for the help & fix, done for now
22:49bbloomdnolen`: anytime