#clojure log - Feb 18 2013

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

0:00 smnirven: squiggly: are you just looking for how to get emacs, leiningen 2, and nrepl setup?

0:01 squiggly: smnirven: I was probably just looking for the keyword nrepl :D

0:01 smnirven: ahh, so you got it werkin?

0:02 squiggly: smnirven: No, I just wasn't sure what I was looking for - I found their Github though and that helps a lot

0:04 clj_newb_2345: https://github.com/hraberg/shen.clj looks good. Is the author here?

0:04 smnirven: so you've got "lein repl" running in your project, and you've nrepl.el installed?

0:07 sgarrett|afk: Anyone 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}.

0:07 squiggly: smnirven: I just installed nrepl.el and it's working, thanks - I just wasn't sure what I should be searching for...

0:08 smnirven: okay, cool

0:08 happy hacking

0:11 squiggly: smnirven: Thanks! :)

0:17 ucb: clj_newb_2345: thanks for pointing me to shen

0:18 clj_newb_2345: ucb: please return the favor by writing a good tutorial :-)

0:18 ucb: clj_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

0:19 well, hardly a tutorial, but yeah

0:19 clj_newb_2345: I feel like it's not very representative of it's claimed power.

0:19 ucb: I'd have to experience said power before I can write anything about it :)

0:21 oh, there's a book even

0:22 clj_newb_2345: unfortunately not available on kindle or pdf

0:41 ucb: indeed

0:46 stephenwan: ,*clojure-version*

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

1:43 clj_newb_234: The following code compiles and runs. What am I doing wrong?

1:43 (ann test1 (All [x y] [x y -> x])) (defn test1 [a b] "hello world") (println (test1 1 2))

1:43 (this is using core.typed)

1:43 I would be happier if I got an error somewhere.

3:13 nonuby: working 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?

5:18 using 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 ?

5:19 i suppose i could do (if (contains? "maybe" cookies) {:a 'always here' :b (cookies "maybe") } {:a 'always here' })

5:19 but i presume there is a dozen better shortcuts

5:28 AtKaaZ: ,(. (var for) alterRoot (fn [oldfn & the123args] (do (println oldfn the123args) (fn [callerForm someNil & restt] (println callerForm someNil restt)))) '(1 2 3))

5:28 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

5:28 AtKaaZ: nice

5:29 &(. (var for) alterRoot (fn [oldfn & the123args] (do (println oldfn the123args) (fn [callerForm someNil & restt] (println callerForm someNil restt)))) '(1 2 3))

5:29 lazybot: java.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!

5:30 clgv: AtKaaZ: trying to hack clojail?

5:30 AtKaaZ: clgv: i just stumbled upon this line in clojure.core (. (var defn) (setMacro)) and thought to test the bots:)

5:31 clgv: AtKaaZ: ah you have to do that locally ^^

5:31 AtKaaZ: yep, works on repl

7:42 hyperboreean: what's the idiomatic way of doing something like: if condition: return nil else: return computed_value ?

7:42 nonuby: (when condition computed_value) returns nil if not condition

7:43 if condition is dependent on computed_value then when_let

7:43 there is when-not

7:43 for inverse of when too

7:43 hyperboreean: nonuby: thanks, checking when/when-not right now

8:07 cmdrdats: hmm, 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))) ?

8:08 I'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))

8:36 ro_st: anyone using clj-webdriver and has any idea why using it with firefox is so slow?

8:41 ucb: ro_st: because firefox

8:42 ro_st: sending instructions down are fast, but checks against the dom are DOG slow

8:42 hash tag live with it? :-)

8:47 hcumberdale: Hi ;)

8:48 is there a bug in 4clojure.com, crashing when somebody klicks at "Top Users" > "All Users" ?

8:49 result nginx/0.7.65 - 504

9:23 clgv: hcumberdale: works here. but there is some AJAX happening there

9:24 hcumberdale: clgv: page crashed!?

9:24 clgv: hcumberdale: no

9:25 but the server seems to be pretty slow

9:26 hcumberdale: clgv: slows down

9:26 then dies

9:26 502 Bad Gateway

9:26 clgv: oh right. happened when I started a search ^^

9:26 takes forever and then died ^^

9:26 hcumberdale: ya! searching in 'all' users

9:26 that's it

9:27 clgv: uff 4clojure DOS...

9:27 Hodapp: DOS? Where?

9:27 clgv: hcumberdale: you want to write a ticket, right? ;)

9:27 * Hodapp stabs it

9:28 hcumberdale: @github?

9:28 clgv: yeah

9:28 hcumberdale: but it seems to recover at least

9:29 hcumberdale: clgv nope ;)

9:30 There is a restart after oom excpt.

9:30 clgv: yeah, that is what I meant with "recover" ^^

9:32 sh10151: A 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?

9:34 hcumberdale: clgv: most easy dos with curl

9:56 bbloom: Frozenlock: what i'm saying is that (-foo ...) is not special like (.foo ...) and (.-foo ...) are

9:56 Frozenlock: it's a bit confusing, i agree

10:10 arkx: Ok, 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:10 Changing the offending code to (dorun (for ...)) works just fine.

10:12 clgv: arkx: you wont get any help if you dont show the minimal viable code snipet that causes the error ;)

10:13 arkx: Yeah, I know. It's really hard to extract a minimal snippet from the codebase, since I have no idea how I broke doseq.

10:13 bbloom: worth noting: dorun is a function, doseq is a macro

10:13 arkx: It used to work just fine with doseq previously…

10:13 I expect if I created a sample project, doseq would work just fine there.

10:14 bbloom: isn't for still macro?

10:15 bbloom: arkx: i mention it b/c it's re-implemented in core.clj for clojurescript and does some stuff like directly access .nth

10:15 arkx: It's really hard to debug the Google Closure Compiler advanced mode output and the problem goes away if I switch to :whitespace mode

10:16 bbloom: arkx: oh, yeah, crazy hard

10:16 what about :simple mdoe?

10:16 mode*

10:16 try with :pretty-print true, as well

10:17 clgv: arkx: do you have that code in a version control system, by any chance?

10:17 arkx: clgv: yes, private git repo

10:17 clgv: arkx: in git you could use `bisect` to detect when it broke

10:17 dnolen: arkx: 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:18 arkx: I'm trying to cook one up, but so far all the minimal cases just work.. there's something pretty subtle at work here.

10:18 doseq works just fine with :simple mode as well.

10:18 I only see the problem with :advanced.

10:26 Ok, doseq is only broken in that one particular namespace.. what on earth is going on here. Some import fail?

10:27 bbloom: arkx: do you use aget or aset anywhere in your code?

10:28 arkx: No.

10:29 bbloom: arkx: can you delete code via a binary search down to a minimal repo?

10:30 arkx: https://gist.github.com/arkx/11e6788fdbc807e79b8b

10:30 I've cut some irrelevant stuff out, hopefully retaining enough

10:30 bbloom: arkx: can you eliminate the dependencies?

10:30 arkx: I'll try.

10:40 antares_: arkx: you are shadowing empty

10:40 which may be used by into and similar core functions

10:41 augustl: does 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:41 I've tried a few different sequence types, I get exceptions from all of them though

10:44 arkx: antares_: still happens without empty

10:44 updated the gist

10:44 bbloom: antares_: shaddowing shouldn't be an issue, since macros resolve namespaces

10:44 arkx: keep narrowing it down, you're getting closer :-)

10:44 antares_: bbloom: but is doseq a macro?

10:44 arkx: doseq is a macro, but so is for

10:45 and (dorun (for ...)) works

10:45 also, just switching from :advanced to :simple or :whitespace works

10:45 bbloom: antares_: it is, so it's possible that doseq has a bug where it uses an unqualified name that is resolved incorrectly

10:45 arkx: and doseq is only broken in this one namespace

10:45 bbloom: antares_: but let's wait to see how much further he can narrow it down

10:45 arkx: It's used elsewhere in the codebase without issues

10:45 ToBeReplaced: augustl: 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:45 bbloom: arkx: can you eliminate the dependency on vision.ui.model ? or inline the code that's necessary

10:46 arkx: Sure.

10:46 ToBeReplaced: augustl: also update-values is deprecated iirc; i think update-or-insert-values is preferred

10:47 augustl: ToBeReplaced: 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:50 anwer here: https://groups.google.com/d/topic/clojure/W8vkESoIgeU/discussion

10:50 answer*

10:51 clgv: is there a pr-str version that uses pretty-printing? I want to write a config file with it

10:53 ToBeReplaced: in core.logic, how do you map a constraint across a seq? ex. (all (map constraint seq))

10:54 clgv: ToBeReplaced: something like "everyo"

10:55 ToBeReplaced: clgv: "everyg"... thanks

10:59 arkx: bbloom: eliminated that dependency and bunch of other stuff, still failing. I'll try to extract this to a standalone project.

11:00 This 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:47 h0bbit: Hi All, Is there any way I can jump to Java code from inside the repl?

11:48 For example, if I wanted to see the java code behind a low level function, how do I do that?

11:48 llasram: h0bbit: I believe ritz provides access to Java sources if you have source JARs on your classpath

11:48 jro_: how do I set an extra entry to classpath, when using leiningen 2?

11:49 h0bbit: llasram, cool. let me look into that. will be back in a bit.

11:49 llasram: jro_: (1) You don't. (2) Still don't. (3) Ok, fine, if you really really need to, add it to :resource-paths

11:50 h0bbit: jro_, You can use :resource-paths for pre-compiled class files and :java-source-paths for java code.

11:50 jro_: I'm just trying to configure log4j for lein run

11:50 h0bbit: jro_, If you just want to add a local JAR to your project, consider using lein localrepo

11:56 llasram: jro_: Oh, you want to add the path containing log4j.properties to your classpath? Ok, then actually :resource-paths is the correct approach :-)

11:58 joegallo: jro_: 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:58 s/pur/put/

11:59 jro_: yes, thanks! did not understand the convention

12:00 antares_: 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:01 jro_: I was using resources unconsiosly, since (route/resources were routed to resources/public

12:02 technomancy: I 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:03 wink: hm

12:03 antares_: technomancy: good idea

12:03 wink: random brainfart: `lein wtf` will show an errata of defined project dirs?

12:04 like.. an annotated explanation what the current state is

12:04 antares_: a task that displays dir layout is also a good idea

12:04 wink: yeah, basically that

12:06 antares_: technomancy: I also think we should change lein new to fail when project name is "clojure"

12:06 wink: blacklist all the things!

12:09 antares_: filed an issue for the task

12:09 wink: ./cheer

12:17 TimMc: I actually got to use LEIN_IRONIC_JURE=y recently. :-)

12:18 hyPiRion: TimMc: whoah.

12:18 swearjure+

12:18 *?

12:18 clojurebot: * is just for when you are lazy and sloppy

12:22 hcumberdale: lein new new

12:23 lein new hibernate :)

12:27 TimMc: hyPiRion: Yeah.

12:27 I should work on that some more today.

12:29 Maybe 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:29 cheekee: I am trying to find the dependency that runs sine, cosine and log

12:30 TimMc: cheekee: You mean java.lang.Math?

12:31 ,(Math/sin 3.14)

12:31 clojurebot: 0.0015926529164868282

12:31 tgoossens: I'm looking for an example with seesaw that involves forms (buttons espcecially)

12:33 cheekee: TimMc: No I meant the clojure dep that took the place of clojure.contrib

12:34 TimMc: ~contrib

12:34 clojurebot: Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

12:34 cheekee: or how do I do Sin(pi) in clojure

12:34 I know but what lib is Sine in?

12:37 ohpauleez: cheekee: You can use Java's core Math lib

12:37 Math/sin

12:37 http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html

12:38 antares_: forgive me, father, for I've Math/sinned

12:38 ohpauleez: ohh nvm, I didn't look at scrollback

12:38 antares_: haha

12:39 cheekee: other than that, there's some stuff worth checking in https://github.com/clojure/math.numeric-tower/

12:39 thorwil: i 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:42 tgoossens: a bit stupid perhaps

12:42 but

12:42 in emacs using paredit

12:42 i'm failing to put [x]

12:42 around an existing expresssion x

12:43 (x) is ok

12:43 M-(

12:44 thorwil: tgoossens: select x, hit [ turns x into [x] here

12:44 antares_: tgoossens: works for me. I select x, hit [

12:44 tgoossens: hmm

12:44 cheekee: ohpauleez: It is not in Numeric-tower

12:45 tgoossens: ayhes

12:45 seems to work

12:45 lol

12:45 and now for something completely different (not so)

12:45 ohpauleez: I totally realize that, I think the best bet is to use Math/sin. I was just pointing out numeric-tower for future reference

12:45 tgoossens: (]

12:45 i can't get it away :p

12:46 cheekee: ohpauleez: But thanks I got Math/sin to work

12:46 tgoossens: killing does the trick

12:46 hyPiRion: tgoossens: mark it and do C-w

12:46 tgoossens: djeez i'm so unexperienced :p

13:09 seangrove: I 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:17 AdamC: Hi, does anyone have any ideas about loading and evaluating code in new classloaders, pulling in dependencies using pomegranate?

13:17 dnolen: ok, just added experimental support for a ^not-native type hint in ClojureScript

13:18 in the presence of this type hint not protocol dispatch overhead on non-higher order protocol fn usage.

13:18 http://github.com/clojure/clojurescript/commit/bf4c85c1f17c3f2a26ba57fef896350a7651d8cf

13:23 gf3: AtKaaZ, gfredericks: Ack, my logs are gone, did I miss something?

13:29 Ohp I see

13:36 pocho: Say 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:36 What's the easiest way to do such a thing.

13:36 jeremyheiler: pocho, update-in

13:36 pocho: thanks

13:37 jeremyheiler: ,(update-in {:a {:b {:c 1}}} [:a :b :c] inc)

13:37 clojurebot: {:a {:b {:c 2}}}

13:37 mknoszlig: pocho: assoc-in might also be an option, depending on context

13:45 seangrove: Ah, nevermind, I've got it. :repositories key in project.clj and then just refer to the dependency like a normal clojure dep

13:49 cheekee: I 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:52 (defn F-convert [temp] (*( - temp 32)(/ 5 9)))

13:53 why is N appended to the output?

13:53 mknoszlig: cheekee: (class (F-convert 32))

13:56 cheekee: mknoszlig: ok thanks

13:58 mknoszlig: cheekee: (/ 5 9) gives a ratio

13:59 cheekee: let me rephrase: what return type are you looking for?

14:00 seangrove: I'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:00 Is there some grizzled clojure expert who can tell me what to look for in tracking down this problem?

14:00 There's nothing else in the namespace

14:01 mknoszlig: seangrove: what version?

14:02 seangrove: Clojure 1.5.0-beta2, ring-jetty-adapter 1.2.0-beta1

14:02 cheekee: mknoszlig: I solved the problem by using 5.0 instead of 5

14:06 mknoszlig: seangrove: hmm, maybe you want to try a stable combination?

14:07 cheekee: :)

14:08 pocho: say 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:08 how do i pass it down?

14:11 antares_: pocho: closure locals capture should be sufficient?

14:12 abp: pocho: Yea, you could use an #() or fn to wrap the function reduce is calling if it's not already anonymous or use partial

14:14 mknoszlig: seangrove: seems to work for me... can you provide more detail?

14:15 pocho: This functional programming thinking is blowing my mind.

14:16 AtKaaZ: is it necessary to :import any classes that are used for typehints only?

14:17 dnolen: update-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:18 mknoszlig: AtKaaZ: if you write the full name including the package, it should work without :import iirc

14:18 AtKaaZ: mknoszlig: that's what I was thinking but I want to be sure

14:21 mknoszlig: AtKaaZ: my repl confirms.

14:21 AtKaaZ: did you try including random non-imported class?

14:22 i mean type-hinting on that

14:22 mknoszlig: AtKaaZ: trying on an imported class wouldn't make a lot of sense, no? :) - but no, it wasn't random

14:23 AtKaaZ: mknoszlig: true but I mean, I can never tell if it's imported already or not by ie. clojure

14:24 ohpauleez: is there a Himera-like service with jailed Clojure? I'm basically looking for lazybot-as-a-service

14:24 mknoszlig: AtKaaZ: https://gist.github.com/mknoszlig/e0c987e0e9e4e96aeaf5

14:25 AtKaaZ: mknoszlig: thanks

14:26 abp: ohpauleez: http://tryclj.com/

14:26 AtKaaZ: so I take it the compiler tries to load any referenced class

14:26 if it's not already loaded

14:26 ohpauleez: abp: I want to hit it with RESTful requests

14:26 borkdude: I'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:26 AtKaaZ: and import does that + also allow you to not fully qualify

14:27 abp: ohpauleez: Oh, yea just got the as-a-service part

14:27 augustl: I'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:28 AtKaaZ: mknoszlig: 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:28 Bodil: ohpauleez: Well, lazybot is built on Clojail, wrapping it in a web service should be pretty trivial.

14:28 ohpauleez: Bodil: You'd think haha

14:29 mknoszlig: AtKaaZ: i would assume that the compiler just makes sure the class is on the classpath...

14:30 citizenparker: borkdude: it's rather unfinished but you're welcome to add https://github.com/citizenparker/inquizitors to that list if you like

14:31 borkdude: citizenparker cool, have you hosted it somewhere

14:31 AtKaaZ: mknoszlig: makes sense, thanks again

14:32 Bodil: ohpauleez: 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:32 citizenparker: borkdude: nope, unfortunately. Websocket requirement keeps it off Heroku, never found another free alternative

14:33 ohpauleez: Bodil: ah word, thanks!

14:33 lynaghk: weavejester: ping

14:37 Frozenlock: Any breakthrough for making clojure application accept 'plugins'?

14:37 tgoossens: seesaw 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:37 augustl: Frozenlock: the security contexts in Java could probably be used

14:39 Frozenlock: augustl: I don't follow...

14:39 borkdude: citizenparker 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:41 mknoszlig: AtKaaZ: np - if you're interested in the details, it's probably worth to take a look at how import* does it's magic

14:42 AtKaaZ: mknoszlig: it would take me ages to understand that code :)

14:43 jballanc: question: (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:43 i.e. (into {} (map my-func [2 3 4 5])) == (into {} (map my-func [5]))

14:44 citizenparker: borkdude: Hmm, that's odd. Trying to track down which dep has a requirement for that

14:45 mknoszlig: AtKaaZ: you won't know until you try ;)

14:45 AtKaaZ: sorry, g2g :/

14:45 AtKaaZ: laterz

14:48 Frozenlock: Bodil: running your presentation. Are the code slides supposed to be interactive? If so... what's the magic button?

14:48 augustl: Frozenlock: 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:49 AtKaaZ: jballanc: (into {} (map #(do [% %]) [2 3 4 5]))

14:49 ,(map #(do [% %]) [2 3 4 5])

14:49 clojurebot: ([2 2] [3 3] [4 4] [5 5])

14:49 augustl: AtKaaZ: using do inside #() was a nice trick :)

14:50 citizenparker: borkdude: fixed. The aleph version I was using had a stale dependency

14:50 I should eventually switch that out to webbit

14:50 Frozenlock: augustl: 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:52 Bodil: Frozenlock: Oh, good question... I think it's Alt-R?

14:52 Frozenlock: They're very old slides. :)

14:52 Frozenlock: Bodil: That did the trick, thanks :)

14:54 jballanc: AtKaaZ: but this works -- &(into {} '({:a 1 :b 2} {:c 3 :d 4}))

14:55 ,(into {} '({:a 1 :b 2} {:c 3 :d 4}))

14:55 clojurebot: {:a 1, :b 2, :c 3, :d 4}

14:55 AtKaaZ: jballanc: is myfunc returning something like: {:a 1 :b 2} ?

14:55 ,(into {} '({:a 1 :b 2} {:a 3 :d 4}))

14:55 clojurebot: {:a 3, :b 2, :d 4}

14:55 jballanc: yeah

14:55 AtKaaZ: that might explain it

14:55 using the same key

14:56 ,(into {} '({:a 1 :a 2} {:a 3 :a 4}))

14:56 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException>

14:56 AtKaaZ: ,(into {} '({:a 1 :b 2} {:a 3 :b 4}))

14:56 clojurebot: {:a 3, :b 4}

14:56 jballanc: oh gosh darn it...

14:56 you're absolutely right

14:56 :(

14:57 I'm repeating keys

14:57 thanks...knew it was something stupid

15:08 mefisto: anyone else at dev nexus?

15:35 pepijndevos: are there any other IRC clients/servers/libs than subrosa and irclj? Thinking about building a bouncer of sorts.

15:38 abp: How 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:39 gfredericks: I 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:39 pepijndevos: abp, seem okay to me.

15:40 Raynes: pepijndevos: I don't know of any.

15:40 dnolen: so it's looking like ObjectMap really doesn't offer much over PersistentArrayMaps - http://jsperf.com/objectmap-vs-persistentarraymap/2

15:40 Raynes: pepijndevos: I think irclj would potentially work for writing a bouncer.

15:40 I'm not sure though.

15:40 Might need something more low-level.

15:40 pepijndevos: Raynes, what about the server part?

15:41 Raynes: You'd still need to write a server.

15:42 brehaut: im blanking on name of the lib that tells you what you are doing wrong stylistically

15:43 gfredericks: kibit?

15:43 brehaut: yes!

15:43 pepijndevos: Raynes, 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:43 Wild_Cat: quick 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:43 Raynes: pepijndevos: Yes, the part of Irclj that parses messages should be general for both a server and client.

15:44 amalloy: brehaut: also eastwood, although i don't think that ever really took off

15:44 brehaut: amalloy: thanks

15:44 pepijndevos: Raynes, cool, i'll look into it more later.

15:45 dnolen, oh, does that mean you get to throw away code? I love doing that.

15:45 dnolen: pepijndevos: eventually

15:46 pepijndevos: dnolen, but, "56% slower" than what?

15:47 dnolen: pepijndevos: what do you mean?

15:47 yogthos: I've got a question, is there a way for a namespace to expose functions from a different namespace it refers to?

15:48 pepijndevos: dnolen, when I run the test, to the right it says for every test "so-and-so many percent slower/faster"

15:48 brehaut: amalloy: waitaminute, eastwood and kibit are both by the same guy?

15:48 amalloy: are they? i didn't notice

15:48 brehaut: entirely possibly ive stumbled across a fork

15:48 dnolen: pepijndevos: js perf isn't really ideal for this kind of test, it assumes they are all of the same kind

15:49 pepijndevos: ah

15:49 abp: yogthos: Yeah but amalloy is around, so better stop talking about it. ;P

15:49 yogthos: lol

15:49 amalloy: haha

15:49 dnolen: pepijndevos: but you can see that we're comparing ops on ObjectMap & PeristentArrayMap

15:50 pepijndevos: yea, it makes sense if you ignore the relative bits

15:50 amalloy: find a way to do it with juxt, that'll mollify that crazy amalloy

15:50 brehaut: hmm. kibit is complaining about not having a reader function for ordered/map

15:52 abp: yogthos: https://github.com/ztellman/potemkin that's one possibility

15:53 yogthos: abp: ah yes I've seen potemkin before, it does some serious black magic :P

16:01 amalloy: yogthos: you have black goals, so...

16:01 dnolen: pepijndevos: the take away is that with an optimized PAM, OM seems a lot less necessary.

16:01 yogthos: amalloy: haha mayhaps :P

16:03 adu: PAM? OM?

16:04 yogthos: mainly 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:04 dnolen: PAM=PersistentArrayMap, OM=ObjectMap

16:04 yogthos: it seems like it would make sense to make something you can refer to once that would expose all the useful bits

16:05 bbloom: dnolen: running those benchmarks now. if we can get rid of OM, that would be huge & make the Keyword type much easier :-)

16:06 dnolen: bbloom: yeah, it seems to there's not really an interesting difference now between OM & PAM on all the major browsers

16:07 bbloom: PAM is faster on V8 than OM, and only slightly slower on the other browsers than OM

16:07 bbloom: dnolen: can you gist the benchmark source? i wanna verify

16:07 dnolen: bbloom: http://github.com/swannodette/cljs-perf

16:07 bbloom: dnolen: sounds good!

16:07 gfredericks: ,(with-redefs [first second] (first [1 2 3 4]))

16:07 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException>

16:08 bbloom: dnolen: ok cool, with array-map you're always looking up the last entry

16:08 dnolen: bbloom: yep

16:09 bbloom: dnolen: i vote to nuke ObjectMap from orbit :-)

16:09 dnolen: bbloom: hehe, I'd like to do a little more testing and post the results on the clojure-dev ML

16:09 first

16:09 bbloom: i see you set the threshold to 8, what is the threshold in clojure proper? how did you arrive at 8?

16:10 dnolen: bbloom: 8

16:10 same threshold as Clojure

16:11 bbloom: any chance we can plot performance for thresholds from 4 to 32 or so

16:11 dnolen: bbloom: I don't really see the point, after 8 the cost of copying becoming quite large

16:11 OM & PAM are only about small maps

16:12 OM is hack to get JS Obj perf, and PAMs now demonstrate it's not a big win.

16:12 bbloom: dnolen: i'm just curious what "small" means considering a lot of file systems and the like use absurdly large branch factors

16:12 dnolen: small is 2-4 keys, which is very common

16:13 bbloom: small 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:13 we might find that PAM out performs PHM until 30 or so

16:13 don't know unless we try

16:13 dnolen: 32, numbers comes from cache size

16:13 bbloom: we have tried

16:13 bbloom: like a year ago

16:14 bbloom: in clojurescript?

16:14 dnolen: yes

16:14 bbloom: or just clojure?

16:14 but what about now with the improvements to PAM?

16:15 dnolen: bbloom: it's going to be a tradeoff between update/lookup

16:15 bbloom: of course

16:15 dnolen: bbloom: I agree it would be nice to have more information about precisely what that tradeoff is

16:15 bbloom: dnolen: i'll give it a shot over here, you mail the list :-)

16:17 dnolen: bbloom: cool, I think the new ^not-native type-hint is pretty useful

16:17 (unrelated to PAM/OM of course)

16:17 bbloom: dnolen: i saw that, but didn't think too hard about it yet

16:18 dnolen: bbloom: it just eliminates protocol dispatch overhead

16:18 bbloom: dnolen: makes sense

16:41 TheComrade: Hola! I'm looking for recommendations for screencasts of Clojure used with Emacs, beginner or advanced.

16:49 * Frozenlock really is annoyed by articles with 'java' in the title when they are talking about 'javascript'.

16:54 andres-v: TheComrade: ¡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:55 TheComrade: 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:16 craigbro: having a brainfart

17:16 I am trying to add a custom encoder to cheshre for byte arrays

17:16 and can't figure out how to represent the [B class in clojure

17:16 hmmm

17:17 but since add-encoder uses (extend...

17:17 is it even possibly?

17:17 brehaut: yes

17:17 craigbro: possible I mean

17:17 brehaut: just a moment

17:17 ,(Class/forName "[B")

17:17 clojurebot: [B

17:18 brehaut: craigbro: ^ extend accepts that as its first argument

17:21 craigbro: hmm, still no dice at the cheshire level

17:22 ah, method sig issue on my part

17:24 tcrawley: hugod: here you go: https://github.com/pallet/ritz/pull/77

17:24 thanks!

17:25 hugod: tcrawley: thank you for sorting it out

17:25 tcrawley: hugod: heh, it's the least I can do, since I caused it :)

17:27 hugod: tcrawley: that sort of issue is all to easy to hit - is pomegranate using the newer dynapath?

17:28 tcrawley: hugod: pomegranate isn't yet using dynapath, the PR is still pending. but when it is merged, it will use 0.2.1

17:28 * tcrawley glances at cemerick

17:33 craigbro: hmm

17:33 can't seem to get cheshire to handle byte arrays

17:35 sure it's a user error

17:37 hugod: anybody successfully using dir-locals.el for customising nrepl.el nrepl-history-file?

17:38 seangrove: Hrm, how can I generate a jar file for lein2? I need it apparently to use it with Jenkins

17:39 Ah, nevermind, I see it downloads itself

17:40 Frozenlock: Raynes: When you change your picture when I'm looking at one of your repo, I feel observed.

17:40 * Frozenlock locks the door.

17:40 Raynes: Haha

17:41 Frozenlock: Especially when I change it to one this creepy.

17:41 I wish I had captioned it with "I see you looking at my repos, boy."

18:00 callenbot: Raynes: I'm going to need a cigarette after having your github profile image look at me like that.

18:00 Raynes: lol

18:02 cemerick: tcrawley|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:02 Foxboron: hey, cemerick i think i might have found a fault in Clojure Programming, on page 190. (i did tweet at you also)

18:05 tgoossens: i'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:05 any tips on useful plugins?

18:10 Bodil: tgoossens: 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:10 tgoossens: i heard it is not ideal. But i just want to try it

18:10 and someone here in the irc spoke about a plugin that somehow uses eclipse

18:10 Foxboron: tgoossens: didnt ljos mention a plugin?

18:10 tgoossens: but for the love of god, i cannot remember the name of the project

18:11 Bodil: Oh, Eclim. Yes, tried that. Horrible experience.

18:11 tgoossens: eclim

18:11 that was it!

18:11 still not sure what it is exactly

18:13 Bodil: tgoossens: The closest I got to a working environment was with malabar-mode. But it's basically unfinished and not seeing any development.

18:13 tgoossens: 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:14 tgoossens: lol

18:14 cedet even has UML diagrams o.O

18:14 Bodil: ...yeah...

18:15 tgoossens: bodil: I didn't say it was really useful :p

18:15 its just.. uml in terminal

18:15 its a bit fancy :p

18:16 Bodil: Well, at least it proves Emacs can do anything... though one hopes it was intended as irony or something.

18:16 tgoossens: haha

18:16 malabar mode seems pretty extensive to me

18:17 Bodil: Malabar was really nice, except it just kept crashing and crashing.

18:17 tgoossens: hmm

18:17 how long ago?

18:18 Bodil: About two years. Doesn't look like there's been any serious commits to it since, sadly...

18:19 tgoossens: bah

18:19 i'll give it a try nevertheless

18:19 i'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:19 so I'm trying to combine it :p

18:19 like many other before my i guess

18:20 Bodil: I know that exact feeling, yes. :)

18:20 I'd say CEDET is your best bet. Just too bad it's such a giant project.

18:20 tgoossens: also

18:21 I have not really a clojure project running (though this project would be perfectly suitable for clojure, my teammates don't agree with me :))

18:21 all i'm doing is small experiments most of the time

18:22 hyPiRion: tgoossens: You could try out JDEE, as it depends upon CEDET.

18:22 tgoossens: hmm

18:23 hyPiRion: Though I've not tried either, but will do so in the (hopefully (?) distant) future.

18:23 Bodil: hyPiRion: Yeah, that's what I had in mind. It's a part of CEDET proper, iirc.

18:24 hyPiRion: Bodil: Oh, I thought they were separate projects, but JDEE depending heavily on CEDET.

18:25 Bodil: hyPiRion: I got the impression it was moved into CEDET. But with the size of that thing it's hard to tell. :)

18:26 callenbot: Bodil: there are better options, like using that daemon that harnesses IntelliJ or something and exposes an API to vim and Emacs.

18:26 I've seen people use such things for scala.

18:26 Bodil: callenbot: You mean Eclim? That didn't really work out for me - especially since I still had to use Eclipse to manage projects etc.

18:29 craigbro: oi

18:29 tgoossens: bodil: i'm going to try it out, but apparently you can run a eclim session WITHIN eclipse

18:30 Bodil: tgoossens: Yeah, you can. I guess it's at least better than having to use Eclipse all the time. :)

18:31 tgoossens: Bodil: I remember the time I was trying to use eclipse for everything: python, eclipse, java, c++, javascript, php

18:31 and it worked

18:31 that's true

18:32 Bodil: Yeah, I used Eclipse for everything too... I feel much better now after switching to Emacs, I'm happy to report. :)

18:32 tgoossens: it seems that it is a vimplugin

18:33 i've been using emacs for over a week now

18:33 gf3: sjl: Have you considered (in Badwolf) changing the cursor color to reflect the current mode (much like you do with the status bar)?

18:33 Bodil: tgoossens: You want https://github.com/senny/emacs-eclim

18:37 pocho: Hey guys, I need help figuring out how to express something that's probably in clojure.core

18:37 http://pastebin.com/raw.php?i=ian8f6hZ

18:38 Im not used to all this functional business

18:41 callenbot: Bodil: nothing of the sort is ideal, generally. I avoid that stuff when I can.

18:42 Raynes: Bodil: You should have called catnip katniss.

18:43 Bodil: Raynes: As if enough people don't already make that connection and assume I'm a Hunger Games fangirl? :)

18:44 Raynes: You aren't? :(

18:45 Bodil: I don't know, I guess there's a chance I might become one if I actually read the books some day. :)

18:45 Raynes: The movie is pretty good too.

18:46 Bodil: Yeah, it wasn't horrible. I think I'm sticking to my MLP fandom, though. :)

18:46 Raynes: Haha.

18:47 seangrove: What's likely the problem if ring never responds to a request?

18:47 The browser is just hanging waiting for a response

18:47 hiredman: seangrove: if your handler never returns

18:47 hyPiRion: does ring print out anything in the console

18:48 ?

18:48 seangrove: https://www.refheap.com/paste/11435

18:48 hiredman: aleph's ring adapter used to do that, and swallow the exception

18:48 which ring adapter are you using?

18:48 seangrove: I'm starting it with `lein ring server`

18:48 hyPiRion: Nothing comes out after "2013-02-18 15:47:14.324:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:3000"

18:49 hiredman: seangrove: when happens when you hit it with curl?

18:49 seangrove: Hangs

18:49 https://www.refheap.com/paste/11436

18:50 Let me see if I can start it from the repl...

18:51 jballanc: anyone have a favorite Ring logging middleware?

18:52 seangrove: Hrm, same problem from the repl

18:53 Ah, it might be because of com.saucelabs/sauce-connect

18:58 bloop: I'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:59 well not blank but also not having the things I def'd

19:00 I guess I can get a brand new REPL by running the program with the lpay button at the top, never mind

19:01 Raynes: Bodil: You asked what my favorite pony is… https://dl.dropbox.com/u/23745600/bodilshy.jpg

19:02 Bodil: Raynes: What? Not Bodil Dash? :)

19:06 craigbro: VICTORY!

19:06 8^)

19:06 Frozenlock: You 6 pooled?

19:58 lynaghk: octagon: todoFRP pull request please!

20:06 octagon: lynaghk: my pleasure!

20:09 zerokarmaleft: hiredman: 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:10 doesn't it use the default permissive example policy if you don't specify one as a parameter?

20:18 tcrawley: cemerick: heh, no worries. I may update the bug-you frequency to monthly though :)

20:19 cemerick: tcrawley: I have the issue open in a browser tab, so it won't be long now ;-)

20:21 hiredman: zerokarmaleft: my guess is you don't have a clojure.jar setup for it

20:21 zerokarmaleft: https://github.com/hiredman/clojurebot/blob/master/clojurebot-eval/resources/config.clj is the default config

20:22 zerokarmaleft: it uses https://github.com/sonian/carica for configuration so you can override the default with a config file on the classpath

20:22 or just use the default

20:22 zerokarmaleft: hiredman: ah ok...thanks

20:23 hiredman: but it is hard to tell without the whole stacktrace

20:25 ppppaul: i'm trying to do something interesting with compojure routes. but running into a bit of trouble https://gist.github.com/boxxxie/4982312

20:25 i want to have a context that matches a plural

20:25 zerokarmaleft: hiredman: fixed the clojure.jar config, progressed to a RT security exception: https://www.refheap.com/paste/11440

20:28 hiredman: zerokarmaleft: how you deploying clojurebot-eval?

20:28 if you are doing it inside some kind of container it might set its own policy or something

20:28 zerokarmaleft: java -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:29 hiredman: try without the -Djava.security.policy=...

20:30 t should just load the example.policy from the jar

20:31 zerokarmaleft: disco!

20:32 thanks for the help :D

20:32 hiredman: sure, good luck running clojurebot

20:54 TimMc: Well, that's unfortunate:

20:54 java -Dclojure.read.eval=unknown -jar ~/.m2/repository/org/clojure/clojure/1.5.0-beta11/clojure-1.5.0-beta11.jar -e "(+ 1 2)"

20:54 Exception in thread "main" java.lang.RuntimeException: Reading disallowed - *read-eval* bound to :unknown

20:54 TELawrence: TimMc, hi

20:54 I'm the beloved mascott of this channel.

20:54 gfredericks: TimMc: why beta11?

20:54 TELawrence: Loved by all, My Shadow is Worshipped

20:54 TimMc: Oh, is that old?

20:54 gfredericks: RC-16 is last I heard

20:55 warz: not 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:55 in the wrong order, or something.

20:56 and i don't think i can put the main `handler/api` at the end

20:56 TimMc: gfredericks: Well, still fails.

20:56 warz: my code is here, if anybody knows why this might be the case: https://github.com/ryancole/localshop/blob/master/src/localshop/handler.clj

20:57 gfredericks: TimMc: hmm...so this is an issue with the command line evaller?

20:57 TimMc: Yeah.

20:57 I'll post to the ML.

20:57 warz: xeqi suggested rearranging them, earlier today, and i messed around with that but i think i have to have the `handler/api` portion first?

20:58 gfredericks: warz: well if you put the whole (handler/api app) part lower down that would definitely fail

20:58 s/app/app-routes)

20:58 s/)//

20:58 warz: yea thats what i tried, but then the middlewares arent passed the handler

20:58 gfredericks: pull app-routes out and put it at the top

20:59 (def app (-> app-routes (handler/api) ...))

20:59 then you'll be free to rearrange them

21:00 yedi: how can i do session handling with compojure?

21:00 ravster: hello all

21:00 gfredericks: yedi: there are libs for it; I think sandbar is one but I haven't kept up

21:00 warz: gfredericks, ah ok that does the trick.

21:01 gfredericks: warz: sweets

21:03 warz: what 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:03 im confused as to why the main handler being last gives the params to the ones before it

21:03 gfredericks: the last middleware is the outermost

21:03 do you know how -> works?

21:04 warz: not entirely. i know what it does but not how it does it

21:04 gfredericks: it's all syntax

21:04 warz: i knew it passed that first item through the remaining functions

21:04 gfredericks: (-> app-routes (a) (b) (c)) is just (c (b (a app-routes)))

21:04 warz: ah ok

21:05 gfredericks: that combined with the way middlewares work (function wrappers) gives you the behavior you see

21:08 TimMc: gfredericks: All it took to uncover that bug was adding :jvm-opts ["-Dclojure.read.eval=unknown"] to a lein project.

21:08 gfredericks: o_O

21:08 TimMc: (A lein project with RC16 as a dep, mind you.)

21:09 gfredericks: I wonder how it was tested...

21:09 TimMc: *whether

21:10 gfredericks: I swear abedra was tweeting about having fun figuring out where read was used by setting it to unknown

21:10 TimMc: Yeah, so how did that work? :-/

21:11 Well, maybe abedra didn't use the lein repl task?

21:12 ...no, other tasks fail as well.

21:14 gfredericks: I don't suppose unknown wasn't meant to be used with the system property?

21:14 TimMc: No, it is.

21:17 gfredericks: I imagine clojure ought to be setting it to true, eh?

21:17 Fatalnix: is 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:17 TimMc: Yeah, since it just turns around and evals it.

21:18 Fatalnix: found a few things here and there but they looked old and dirty

21:20 TimMc: Fatalnix: Looks like you just list them in the metadata: https://gist.github.com/richhickey/377213

21:21 Fatalnix: hmm, that's what I just found, and these are the same annotations java uses?

21:25 TimMc: Yep, JVM annotations.

21:26 Fatalnix: cool

21:31 dnolen: bbloom: ping

21:31 bbloom: dnolen: pong

21:32 dnolen: bbloom: so it looks the do block change http://dev.clojure.org/jira/secure/attachment/11760/CLJS-441-v001.patch

21:32 broke type inference

21:32 bbloom: we used to rely on :ret to determine the type of a let expression

21:32 bbloom: dnolen: bah. i can't win, can i? :-P

21:32 dnolen: was looking through the output and was suprised to see cljs.core._truth on critical paths

21:33 compilers are hard

21:33 bbloom: what was the rationale for removing :ret?

21:34 bbloom: dnolen: 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:34 dnolen: let me look/think/recall

21:34 dnolen: definitely - we sould have a compiler.test namespace

21:34 should

21:35 bbloom: dnolen: ok, the reason :ret was removed was because it relied on non-do forms understanding statements

21:36 dnolen: 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:36 just 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:37 yedi: i'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:37 specifically it says hiccup can't be found and i'm not even using hiccup

21:37 this only started happening when i added sandbar to the project

21:38 bbloom: dnolen: RE: compiler.test namespace. i think the easiest thing is just to just check in some pretty printed code. maybe core.test

21:39 dnolen: gold file tests are great for things that may change and need a human to inspect to confirm/accept

21:40 dnolen`: bbloom: sorry spotty internet

21:40 bbloom: did I miss something you said?

21:40 bbloom: https://gist.github.com/brandonbloom/4982655

21:40 dnolen`: ^

21:41 dnolen`: i was doing that a little bit with the twitterbuzz thing: recompiling and diffing

21:41 particularly helpful for validating changes to optimization applicability in realistic code

21:41 dnolen`: bbloom: I don't see why type inference needs to hard coded into the analyzer

21:42 bbloom: dnolen`: wasn't it before?

21:42 dnolen`: bbloom: no type inference happens in the compiler

21:42 bbloom: dnolen`: inference happens during emission? that seems odd

21:42 isn't it also applicable to other backends?

21:43 dnolen`: bbloom: that's possible though at the moment the boolean inference is really only relevant to JS

21:43 bbloom: dnolen`: so look at the :infer-tag function

21:43 dnolen`: my oversight was not adding cases there

21:44 dnolen`: basically :let should look at infer-tag of :body, not :ret

21:44 dnolen`: bbloom: what cases?

21:44 bbloom: similar for :try, :letfn

21:44 dnolen`: oh ok

21:44 bbloom: but in reality, just :let will get back what i broke

21:44 dnolen`: quick fix

21:44 want a patch?

21:45 probably quicker for you to just try it

21:45 dnolen`: bbloom: so just switch :ret -> :body?

21:45 bbloom: dnolen`: actually, it's :expr

21:45 not :body

21:45 that should do the trick

21:47 Fatalnix: So 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:47 following*

21:47 dnolen`: bbloom: hmm doesn't work

21:48 gfredericks: Fatalnix: I've never done annotations in clojure and I'm almost certain that's wrong

21:48 Fatalnix: it feels wrong haha

21:48 bbloom: dnolen`: hmm let me think

21:48 Fatalnix: defn wouldn't let me do defn ^{ blah }

21:49 amalloy: you cannot set annotations except via your gen-class clause

21:49 other than that, i don't know the details, but gfredericks is right that any fiddling you're doing with defn is nonsense

21:51 bbloom: dnolen`: still thinking, but you can probably add inference cases for meta, letfn, and try* as well: https://gist.github.com/brandonbloom/4982699

21:52 dnolen`: bbloom: sure, I just want to solve the immediate problem tho

21:52 bbloom: dnolen`: of course, i'm looking

21:52 Fatalnix: hmm.. 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:53 bbloom: dnolen`: oh, duh, need to add a :do case

21:53 dnolen`: :do (infer-tag (:ret e))

21:54 dnolen`: right?

21:54 dnolen`: bbloom: trying

21:56 bbloom: dnolen`: updated gist with all the cases including :do https://gist.github.com/brandonbloom/4982699

21:58 dnolen`: bbloom: yeah still not working with :do case looking at :ret

21:58 bbloom: dnolen`: damn :-/

21:59 Sgeo: brainproxy, you here?

21:59 bbloom: dnolen`: you've got both the :let and the :do, right?

21:59 dnolen`: bbloom: yeah

21:59 brainproxy: Sgeo: i am

21:59 clojurebot: transients is not mutable data structures: http://technomancy.us/132 or at least as far as you're concerned.

22:00 bbloom: dnolen`: ok let me investigate myself

22:00 dnolen`: bbloom: I'm testing with this

22:00 bbloom: (ana/analyze '{:ns {:name cljs.user}} '(and true false))

22:00 Sgeo: brainproxy, so a "monadic value" in the reader monad is just a function waiting for an argument

22:00 dnolen`: inferring (if true false false), (do true false true), true all work

22:00 Sgeo: So (fn [n] (+ n 1)) could be considered a monadic value

22:00 dnolen`: and (let [] true)

22:01 but '(and true false) does not

22:01 Sgeo: Running it is just passing a value to the function

22:01 This function can be considered to have a globally readable value

22:02 dnolen`: bbloom: (c/infer-tag (:ret (:expr (ana/analyze '{:ns {:name cljs.user}} '(and true false))))) returns nil

22:02 Sgeo: So while you're in the reader monad, there's a value that you can read from at any time

22:02 (Well, only in the same way as doing things in other monads)

22:02 You're still building up a function that is waiting for an argument

22:02 brainproxy: Sgeo: what do you mean by considered to have a globally readable value

22:03 bbloom: dnolen`: yeah, i just evaluated exactly that. i need a minute to explore

22:03 brainproxy: oh i see

22:03 Sgeo: return (I forget what it's called in the common Clojure libraries) just gives a function that ignores its argument and returns the value

22:04 (defn m-result [v] (fn [x] v))

22:04 brainproxy: ah

22:04 Sgeo: Because the argument is the value that you can read

22:05 Let's look at bind

22:06 (defn bind [mv f] (fn [r] (f (mv r))))

22:06 I think

22:07 Wait, no

22:07 (defn bind [mv f] (f (mv r)))

22:07 Wait, that makes no sense either

22:07 brainproxy: right, bind needs to return a monadic value of the same type

22:08 that is, a reader monad value

22:08 bbloom: dnolen`: i figured out wh6y

22:08 dnolen`: that's generating an 'if with a nil else

22:08 the :constant case boolean has a nil case with no tag type

22:09 then-tag is 'boolean, but else-tag is nil

22:09 dnolen`: bbloom: yeah I just now saw that too - hmm, weird this worked before

22:09 Sgeo: (defn bind [mv f] (fn [r] ((f (mv r)) r)))

22:09 That should do the trick I think

22:09 bbloom: dnolen`: so i definitely broke it, but i think something else ALSO broke :-P

22:09 brainproxy: Sgeo: I bet I could work backwards from the laws, and knowing what bind return looks like, to come up with bind

22:10 Sgeo: Go ahead :)

22:10 Or I could try to explain what I wrote

22:10 brainproxy: well maybe the one you gave is correct, studying it

22:11 Sgeo: Basically: 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:12 I just looked at a definition in Haskell, looks like I got it write

22:12 h >>= f = \w -> f (h w) w

22:16 dnolen`: bbloom: actually I'm mistaken, (and true false) is not a good example

22:16 (and (true? true) (false? false)) is better

22:16 brainproxy: Sgeo: 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:16 dnolen`: bbloom: I don't think we can actually infer (and true false) at the moment

22:17 Sgeo: brainproxy, want an example in Haskell's do notation?

22:17 brainproxy: Sgeo: sure!

22:18 bbloom: dnolen`: seems like the same problem occurs: the :else form is a symbol because of the 'and macro introducing a 'let

22:18 Sgeo: http://codepad.org/ddrHSU7u

22:18 bbloom: dnolen`: let needs to copy the tag over for each binding

22:18 Sgeo: Note that do notation in Haskell works different from the do macros in Clojure libraries

22:19 Which is why there's an explicit return at the end

22:19 brainproxy: right

22:19 dnolen`: bbloom: yes what I'm saying is (and true false) is a bad example

22:19 bbloom: dnolen`: but i think the same problem affects that new form you showed me

22:19 dnolen`: I only made inference work for the fn cases and hinted symbols

22:20 bbloom: no because there we have a tag for the expression

22:20 Sgeo: brainproxy, in Haskell (*2) is the same as (\x -> x * 2), which in Clojure terms is #(* %1 2)

22:20 dnolen`: bbloom: or at least we used to

22:20 bbloom: oh hrm

22:20 Sgeo: So, 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:20 dnolen`: bbloom: ok you're right, we've lost a tag from the let

22:20 brainproxy: Sgeo: 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:21 Sgeo: Imagine if instead of (*2), I used id (the identity function)

22:21 Then a would take the value of the argument to addStuff

22:21 bbloom: dnolen`: yeah, no tag on this: (-> (ana/analyze '{:ns {:name cljs.user}} '(and (true? true) (false? false))) :bindings (get 0) :init)

22:22 Sgeo: So 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:22 bbloom: dnolen`: er no i'm wrong

22:22 Sgeo: It is the primary action that I can do in the reader monad.

22:22 bbloom: (-> (ana/analyze '{:ns {:name cljs.user}} '(and (true? true) (false? false))) :bindings (get 0) :tag) ;; boolean

22:22 dnolen`: bbloom: ok that's what I get too

22:23 brainproxy: Sgeo: so, just to make sure I understand, you've essentially built a function that takes one argument, addStuff

22:23 and its implementation is per the do notation

22:23 Sgeo: Yes.

22:23 And (*2) is a function that takes one argument, as is (+10)

22:24 bbloom: dnolen`: we need a case for :var

22:24 dnolen`: although the base get-tag case should handle that

22:25 brainproxy: Sgeo: okay, I think I got it!

22:25 Sgeo: brainproxy, yay!

22:28 bbloom: dnolen`: yeah, i think this works for me with the :do and :let changes i proposed

22:29 dnolen`: bbloom: so add a :var case?

22:29 bbloom: dnolen`: no, no var case

22:29 dnolen`: bbloom: oh, you think works, ok lemme check compilation of core

22:29 think this works I mean

22:31 bbloom: dnolen`: 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:32 dnolen`: and meta doesn't matter because booleans can't have meta data... but letfn does work

22:32 dnolen`: use this: https://gist.github.com/brandonbloom/4982699 it seems to work for me

22:33 dnolen`: the oversight on my part was simply missing that one :ret case

22:34 amro: hm, suddenly I can't use backspace/arrowkeys etc in cljs repl

22:34 I get ^H etc instead

22:35 dnolen`: bbloom: awesome seems to work!

22:35 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:37 Raynes: You're all good peoples.

22:37 bbloom: dnolen`: i see....

22:37 dnolen`: type systems: turns out they are sometimes useful. heh

22:37 dnolen`: bbloom: awesome, more perf boosts around array-maps on other JS engines because of this chnage

22:39 bbloom: dnolen`: cool

22:39 sorry i missed that the first time!

22:40 dnolen`: we should definitely do a gold file test suite

22:40 dnolen`: bbloom: yes, the next on my list of todos, testing the output of the compiler

22:40 and adding the basic inference cases

22:41 bbloom: dnolen`: i think gold files are faster/easier/better than unit tests here

22:41 dnolen`: bbloom: oh, not familiar w/ gold files

22:42 bbloom: dnolen`: i think the term might be a Microsoft-ism

22:42 dnolen`: essentially, we just check in the simple/pretty-printed compiled test code

22:43 dnolen`: so whenever we make a change, if it changes the output, you can skim the diff and see how it changes

22:43 dnolen`: it's not automated like a regular unit test, but they are far more comprehensive

22:43 and `git add` is basically all you need to do when you say "oh yeah, ok this looks fine"

22:44 dnolen`: bbloom: hmm, interesting idea, probably worth running by the dev ML

22:45 bbloom: I like the idea of it

22:45 bbloom: dnolen`: at minimum, we can create an external repo for it

22:46 it 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:46 dnolen`: bbloom: I'm actually not against - it's a good way to sanity check compiler work

22:46 bbloom: just would like to see what others think

22:47 in particular it would have caught this inference regresion

22:47 but I think moving forward there will be more things like this

22:47 and it nice to know exactly when critical compiler changes happened

22:47 bbloom: dnolen`: the xbox compiler guys swore by their gold files for debugging optimization tweaks

22:48 dnolen`: particularly when you have crazy vectorized powerpc isntructions

22:48 heh

22:48 dnolen`: bbloom: I can imagine

22:48 bbloom: thx for the help & fix, done for now

22:49 bbloom: dnolen`: anytime

22:50 * gfredericks can't figure out why his advanced code was ever working without a jquery externs

Logging service provided by n01se.net