#clojure log - Apr 29 2012

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

0:00 lynaghk`: yoklov: you going to be at strange loop?

0:00 yoklov: no

0:00 sadly

0:00 lynaghk`: hmm. Conj 2012?

0:00 yoklov: that's in new york?

0:00 i will almost certainly be there

0:01 lynaghk`: yoklov: looks like it, from the webpage background.

0:01 yoklov: okay, rad. Make sure you track me down so I can buy you a beer and pick your brain about cljs =)

0:01 mmarczyk: http://jsperf.com/cljs-maps-access-16 http://jsperf.com/cljs-maps-conversion-16 http://jsperf.com/cljs-maps-assoc-12

0:01 yoklov: lynaghk`: sounds great

0:01 mmarczyk: ^- in case anybody cares to run some cljs perf tests, especially in non-V8 browsers :-)

0:03 xeqi: mmarczyk: I just go there and click run tests?

0:03 mmarczyk: xeqi: yeah

0:04 ivan: cool 3D animation on clojure-conj.org

0:05 mmarczyk: thanks! I see there are some less weird results on the conversion test, thankfully

0:11 yoklov: hm, odd, assocs on objmap are slower than on phm?

0:18 Drakeson: Is it possible to unload or garbage-collect a java class? (Using jdk7, of course)

0:18 mmarczyk: yoklov: see also earlier tests, e.g. http://jsperf.com/cljs-persistent-hash-map-tiny-assoc

0:19 yoklov: that's the result in all cases and it *is* weird and it does make me think about systematic error

0:20 yoklov: on the other hand, ObjMap assoc involves cloning an array, an object, pushing onto the array clone and adding an entry to the object clone

0:21 yoklov: whereas BitmapIndexedNode only does an array copy for assoc of new key at small population count

0:22 yoklov: so maybe not that weird after all

0:22 well, an array copy + very little bookkeeping

0:25 ok, must dash for now

0:27 johnfn: so i'm using vimclojure and i want to make a little game, so i run the thread so that i can keep editing while using vimclojure. that's great. but now when i have printlns, i can't grab the output anywhere. is there any way to both be able to run your game in a separate thread *and* get the output somewhere?

0:27 i guess i could just dump it to a file, but that seems kind of lame

0:27 yoklov: mmarczyk: hm, that does make sense

0:31 madsy: johnfn: Pretty sure you have to update the *out* dynamic var for the thread

0:33 johnfn: madsy: hmm, interesting!

0:39 madsy: johnfn: A more crazy thing you could try much later is to connect/talk to swank from within the game itself

0:40 johnfn: madsy: what advantage would that bring?

0:42 madsy: Not much compared to using a REPL from the outside, but still pretty cool ;-)

0:49 johnfn: Anyway, it must be possible to configure swank and tell it what to send where.

0:50 johnfn: If you started swank from a terminal for example, it should be possible to print stdout from the inferior program there.

0:50 johnfn: right, thats what i was thinking.

0:54 madsy: johnfn: If everything else fails, just redirect stdout to a local socket or pipe which you read somewhere

0:54 johnfn: ah, that's a nice idea too

0:55 this is incredibly dumb but does anyone have an idea why C-M-x wouldn't work on OSX

0:55 trying to do trivial things in slime and failing

0:55 Caomai: @technomancy: I have lein 2.0 on Fedora 16 at the moment and get an error when trying to simply launch the repl. gist: 2533098

0:55 meiji11: lx6wgywgy!$

0:56 tmciver: meiji11: better change that password now . . .

0:58 johnfn: haha.

0:59 Caomai: IllegalArgumentException Missing closing quote on line '"\e' (https://gist.github.com/2533098)

1:04 yoklov: johnfn: err, it works for me

1:05 johnfn: im hacking at getting some sort of graphical emacs going.

1:05 yoklov: oh, are you in iterm2?

1:05 actually i had to stop using it because i couldn't ever get C-M-anything working

1:06 so, yeah. no idea why but it doesnt go through.

1:06 ESC M-anything does work though, if you are willing to put up with that.

1:06 err

1:06 ESC C-anythign

1:20 johnfn: yeah, Esc was a huge pain.

1:31 lynaghk`: Is there a way to deal with different dependency versions in Leiningen? I'm trying to use X 1.1.0, but my project depends on Y, which depends on X 1.0.2 and I'm getting conflicts.

1:33 emezeske: lynaghk`: Maybe you could use :exclusions in your project.clj? https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L35

1:33 lynaghk`: I haven't had to do that before though, so I might be way off

1:35 lynaghk`: emezeske: ahh false alarm.

1:35 AOT compiling, how I loathe thee.

1:36 emezeske: lynaghk`: That's good... dependency conflicts are a bitch!

1:36 Hah, yeah, aot

1:36 lynaghk`: emezeske: yeah! Since I'd never run into them before now, I kind of assumed Leiningen was keeping me safe

1:36 emezeske: so what are you up to these days? I feel like its been a while since I ran into you on le Internets.

1:37 emezeske: lynaghk`: Mostly I've been working on a closed-source webapp, which is probably why I've been a little quiet :)

1:37 lynaghk`: How's portlandia?

1:38 lynaghk`: emezeske: eating pastries, drinking coffee, riding my fixed gear bicycle...the usual.

1:39 emezeske: lynaghk`: haha, livin' the good life :)

1:39 lynaghk`: emezeske: been thinking a lot about event handling / callbacks / reactive programming lately

1:39 emezeske: lynaghk`: Awesome, I'm glad someone is

1:40 lynaghk`: pushed out a project that was ended up having grosser code than I would have liked

1:40 much grosser.

1:40 emezeske: Heh

1:40 I'm sad that a lot of my browser cljs code is just basically javascript in disguise

1:40 lynaghk`: sorenmacbeth: you live up around NE 28th?

1:41 sorenmacbeth: yes indeed I do

1:41 lynaghk`: emezeske: yeah. Actually, I used to have decently architected coffeescript MVC stuff going on, and it seems that since I've gotten into CLJS I went straight back to the bottom w.r.t. callback hell

1:41 sorenmacbeth: I think I biked by you this afternoon wrestling a baby seat into a mini.

1:41 johnfn: hmm. seems like swank bugs out when you try to send multimethods in via c-m-x?

1:42 sorenmacbeth: lynaghk`: yup, that sounds like me

1:42 lynaghk`: sorenmacbeth: and now we're meeting on the INTERNET.

1:42 emezeske: lynaghk`: Yeah, I'm definitely writing callbackey code. And just... so much state in the dom... :(

1:42 lynaghk`: sorenmacbeth: damn, small world.

1:42 sorenmacbeth: lynaghk`: we live in amazing times

1:42 lynaghk`: emezeske: have you read "Depreciating the Observer Pattern"? It's about the Scala reactives library

1:43 kovasb: we just don't have the right abstractions yet..

1:43 sorenmacbeth: lynaghk`: love my 'hood

1:43 lynaghk`: emezeske: which draws heavily from FRTime, which was implemented on top of Scheme. I'm toying with trying to implement it in CLJ/CLJS

1:43 sorenmacbeth: <3 pdx.

1:44 sorenmacbeth: lynaghk`: mos def

1:44 emezeske: lynaghk`: I haven't, thanks for the pointer, though. I need all the resources I can get w.r.t. FRP if I'm ever gonna understand it :)

1:45 lynaghk`: emezeske: The FRTime thesis seems pretty good too: http://www.cs.brown.edu/~greg/

1:46 emezeske: the author is also behind FlapJax, the reactive JavaScript library/compiler.

1:46 emezeske: also, I've never used any of this stuff. I've just been digging into it for the past few months and am hoping it will be my rich-clientside-app-salvation =P

1:46 emezeske: lynaghk`: haha, understood :)

1:47 kovasb: I've done a ton of it.. it can be pretty nice

1:47 but, the catch is can u scale it to complex apps

1:47 with good performance

1:47 muhoo: is it really necessary that i wrap every call to anything in clojure jdbc in a (with-database db call?

1:48 lynaghk`: kovasb: yeah, I'm interested to hear more about your experience with reactives at wolfram.

1:48 muhoo: sorry with-connection

1:48 lynaghk`: It's funny that you mentioned wanted to do more MVC stuff---maybe it's a "grass is greener" kind of situation for both of us.

1:48 kovasb: yea :)

1:49 its true that 90% of the time u just wanna hook a variable up to a slider or something

1:49 muhoo: i want to keep the connection open for the life of the app

1:49 ibdknox: muhoo: korma ftw

1:49 kovasb: lemme find some links of u..

1:49 muhoo: ibdknox: ok ok, :-)

1:49 kovasb: this is the core construct http://reference.wolfram.com/mathematica/ref/Dynamic.html

1:50 and then there are a ton of widgets that integrate with it

1:50 like this guy is a megafunction build on top of it http://reference.wolfram.com/mathematica/ref/Manipulate.html

1:51 muhoo: ibdknox: hmm, beta. that's why i didn't use it :-(

1:51 lynaghk`: kovasb: I'll have to dig up the copy of Mathematica I had during my physics days. All I did with it then was solve integrals.

1:52 ibdknox: muhoo: its stable, if that's your reservation

1:52 kovasb: yeah, this stuff came out in version 6 around 2006

1:53 i think the home edition costs $250 these days

1:53 lynaghk`: kovasb: actually, I'd give it an integral, and it'd spit out insane math stuff that I could never understand. That's when I'd replace all of the symbolic constants with prime numbers and work backwards to figure out the multiples.

1:54 kovasb: can you compile mathematica notebooks to web pages with this reactive stuff embedded?

1:54 kovasb: lynaghk`: thats funny. You probably needed to specify the domain as being Reals or something

1:54 muhoo: ibdknox: no it's the word "beta". customer is already a bit nervous about me using clojure instead of java for this, so stuff that says "beta" might not go over well.

1:54 lynaghk`: kovasb: yeah, but I don't know how to do that =P

1:54 kovasb: lynaghk`: theres a reason I'm not a wolfram anymore...

1:54 muhoo: but it does look very nice though

1:55 lynaghk`: kovasb: what are you doing now? Is your background in mathematics/physics?

1:55 kovasb: lynaghk`: basically no you can't, they have a browser plugin they are pushing instead tho

1:55 lynaghk`: yeah, math. doing analytics at weebly.com

1:56 lynaghk` : i would have given my left arm to have their stuff compile to JS.. but fortunately now we have clojure

1:56 muhoo: nice, defdb does the c3po automatically. hmm.

1:57 well, it has to be a lot less beta than anything i'd roll myself to do that, so here goes.

1:58 lynaghk`: kovasb: no joke. I've been amazed at how much Clojure/ClojureScript has just worked and how easy it was to write C2.

1:58 (especially considering I have no idea wtf is going on)

1:59 ibdknox: is FRP just the idea of functions of streams?

1:59 over*

1:59 kovasb: lynaghk`: lol. I've definitely had my frustrations with clojurescript, but its getting better fast

1:59 ibdknox: i think the streams are sort of an accessory concept

2:00 ibdknox: i think the main idea is just that UI should be functions of data, and update accordingly

2:00 ibdknox: as opposed to reacting specifically to events

2:01 ibdknox: so databinding to the output of a function?

2:02 lynaghk`: ibdknox: I can't speak to FRP vs. streams, but there is a good motivational over in the Odersky paper about why you might want reactives or event streams over callbacks---basically, they list generally accepted good software engineering principles and show how callbacks violate all of them

2:02 *motivational overview

2:02 kovasb: ibdknox: or just on a piece of code that doesn't have a function around it

2:03 ibdknox: like in mathematica you would just do Dynamic[x^2]

2:03 ibdknox: lynaghk`: this one? http://lampwww.epfl.ch/~imaier/pub/DeprecatingObserversTR2010.pdf

2:03 kovasb: and wherever that is displayed in the ui, it will update when x changes

2:03 lynaghk`: ibdknox: yep.

2:04 ibdknox: kovasb: I see, kind of an implicit function

2:05 kovasb: ibdknox: yes you could think of it that way

2:06 johnfn: what can you do when you get something like "java.lang.NullPointerException (core.clj:0)" ?

2:06 :/

2:06 kovasb: ibdknox: though, you want your UI to be able to stuff values back into the variables as well

2:07 ibdknox: kovasb: does the work more like traditional data binding?

2:10 kovasb: ibdknox: AFAICT traditional data binding is sort of a direct linkage between components; here you do computation to in response to state change

2:10 felideon: ibdknox: hola

2:11 ibdknox: felideon: hey

2:11 lynaghk`: kovasb: the need to do intermediate computation is one of the reasons I want something more than that cljs-binding library you pointed out to me

2:11 felideon: ibdknox: did you ever successfully create a table with the schema stuff in korma.incubator?

2:11 ibdknox: yes

2:12 felideon: ibdknox: i.e. when running (create! users)

2:12 hmm

2:12 ibdknox: in post gres

2:12 er postgres

2:12 felideon: yeah i'm trying in postgres too

2:12 CREATE TABLE "users" ("name" varchar('256') unique)

2:12 ibdknox: I'm tired :( lol

2:12 felideon: note the '256' i assume is the error

2:12 ibdknox: felideon: hm

2:12 kovasb: lynaghk` : yeah, thats something you need for sure

2:12 felideon: i've been tracing all the way down to do-prepared*

2:12 lynaghk`: kovasb: For instance, I want to be able to get/set a dropdown with clojure data structures (including closures). Those aren't going to fit into the HTML value attr---I need to be able to map to/from the desired values between the atom-in-code and select-on-dom.

2:12 felideon: heh

2:12 kovasb: lynaghk` : mostly i just thought it was a neat little thing

2:13 lynaghk`: kovasb: yeah, for sure. Definitely in the right direction.

2:14 kovasb: lynaghk` : yeah I here you on that. Pretty typical use case

2:14 basically you want to write

2:15 (pop-menu current-selection-ref {:option-a f1 :option-b f2})

2:15 and have it render as the right thing

2:15 popup-menu, drop-down whatever :)

2:16 lynaghk`: kovasb: yeah. I'm considering adding that functionality to my cljs-chosen wrapper. I just haven't had time yet.

2:16 kovasb: well, you can provide the options in code like that. The values just can't be anything that won't fit in the html attr.

2:16 kovasb: lynaghk` : that library looks neat, i was checking it out. Want to use it for one of my dashboard

2:17 i see

2:18 ibdknox: felideon: the culprit looks like str-value

2:19 felideon: ibdknox: that was quick

2:19 :)

2:19 kovasb: lynaghk`: I would love to have some kind of general strategy / library for wrapping all these 3rd party widgets, including dojo

2:19 johnfn: anyone have tips on how to hunt down null pointer exceptions at an unknown line?

2:19 ibdknox: felideon: it's being parameterized, and it shouldn't

2:19 kovasb: build some composable UI abstractions

2:19 lynaghk`: kovasb: no guarentees that it'll work under advanced compilation. If you're feeling lucky, though, chosen is written in CoffeeScript and I have a fork of CoffeeScript that compiles to Closure-compatible JavaScript = )

2:20 ibdknox: felideon: though it *should* still work

2:20 kovasb: lynaghk` : cool. right now my stuff is all internal, so network is not a problem.

2:20 felideon: ibdknox: str-value called in column-clause

2:20 ?

2:20 lynaghk`: kovasb: what in particular would you like for wrapping 3rd party widgets in cljs?

2:21 felideon: ibdknox: what should still work?

2:21 kovasb: lynaghk` : expose standard protocols, standard ways of serialization, poking into the internal state, etc

2:21 ibdknox: felideon: just a sec

2:21 kovasb: standard event mapping

2:21 felideon: ibdknox: sure

2:22 lynaghk`: kovasb: expose the standard cljs protocols?

2:22 kovasb: basically, if there was a standard way of doing widgets generally in cljs, and then wrap all these guys to conform

2:22 standard widget protocols

2:22 something like IHiccup for example

2:22 and ILookup

2:22 some standard way to get the dom element

2:23 lynaghk`: ah, I see.

2:23 kovasb: i made some more progress on my ideas, but right now busy implementing more concrete stuff for my repl

2:23 lynaghk`: yeah. With cljs-chosen I just have ISelected and IOptions with multiarity implementations for getting/setting. There is no way to get the underlying DOM element though.

2:24 kovasb: you're making a repl?

2:24 kovasb: lynaghk` : yeah, thats what the session project is on my github

2:25 lynaghk` : its almost ready to go. hopefully tomorrow ill polish it off with some examples

2:25 lynaghk` : its pretty cool. cljs and clj repl side by side in the browser

2:25 lynaghk` : rendering output into the dom etc

2:25 lynaghk` : hence the desire for standard widgets :)

2:27 i wouldn't look at it yet tho, the last push left things in a disastrous state..

2:27 felideon: ibdknox: everywhere i've slammed a prn statement it seemed fine. almost to the point where i thought the problem is in set-parameters

2:27 but dunno

2:28 lynaghk`: kovasb: ping me when it's ready to be looked at

2:29 kovasb: lynaghk` : yeah, will do. Pretty much just need to get this file upload thing to work, so that you can save/restore your sessions

2:29 lynaghk` : should be a pretty fun playground for trying out cljs UI ideas

2:30 lynaghk` : eventually i want to do all my work in it.. developing some visualization, and pushing it live

2:31 lynaghk`: kovasb: I'm too addicted to emacs/slime to do anything else

2:31 kovasb: but maybe if we can get paredit into ymacs, then we'll talk =P

2:31 kovasb: lynaghk` : thats understandable, though being able to script your own environment is a big win

2:32 lynaghk` : I am hoping ibdknox takes care of that ;)

2:32 get some paredit action in code mirror..

2:33 lynaghk`: kovasb: I definitely know it's a local maximum---kind of weird that I spend most of my time thinking about visualizations but I do it in an enviornment I have no idea how to draw a picture in.

2:34 kovasb: lynaghk` : text-based repl sucks if you are making non-textual artifacts

2:34 ibdknox: felideon: wow postgres's error messages are terrible :(

2:34 kovasb: lynaghk` : not to mention they totally punt on state

2:34 felideon: heh

2:35 ERROR: syntax error at or near "'256'"

2:35 LINE 1: CREATE TABLE "users" ("name" varchar('256') unique);


2:35 err

2:35 ibdknox: felideon: ok

2:35 kovasb: lynaghk` : I'm not an emacs god tho so I don't get a lot of the upside

2:35 lynaghk`: kovasb: three monitors, "lein cljsbuild auto", and livereload in the browser goes a long way.

2:35 ibdknox: felideon: figured it out

2:35 felideon: ibdknox: that error you mean?

2:35 ibdknox: ok

2:35 ibdknox: felideon: actually

2:36 felideon: it works for me with this

2:36 https://refheap.com/paste/2434

2:36 lynaghk`: kovasb: then again, most of the real work happens on paper, in the park near my office = )

2:36 ibdknox: with no modifications

2:36 kovasb: lynaghk` : yeah, but if you as messing with your function definitions, repl is still better

2:37 lynaghk`: kovasb: it's a really nice park.

2:37 ibdknox: lol

2:37 kovasb: haha

2:37 ibdknox: just wait and see what I come up with :)

2:37 felideon: ibdknox: i see no difference

2:37 ibdknox: felideon: version of postgres and the driver?

2:37 kovasb: lynaghk` : "hammock-driven development"

2:37 lynaghk`: right.

2:38 ibdknox: felideon: :dev-dependencies [[postgresql "9.0-801.jdbc4"]] is what I'm using

2:38 felideon: postgres 9.0.4

2:38 felideon: pg 9.1.3 and [postgresql "9.0-801.jdbc4"]

2:38 lynaghk`: kovasb: something I'm trying to get better at; every time I actually try and do it, shit is awesome.

2:38 felideon: ibdknox: ah

2:39 lynaghk`: kovasb: speaking of computer-distractions, it's late. I'm off to sleep = )

2:39 kovasb: lynaghk` : yeah, id say rhickey is onto something

2:39 lynaghk` : cool, ttyl!

2:39 felideon: ibdknox: when you run it, the SQL is the same though? it includes the '' ?

2:40 ibdknox: felideon: no

2:40 CREATE TABLE "users2" ("name" varchar(256) unique) :: []

2:41 felideon: nm, I lied.

2:41 felideon: Y U LIE

2:41 ibdknox: felideon: the parameterization *is* what's screwing it up

2:41 felideon: line 85, do-wrapper

2:43 felideon: basically you need it not to str-value it

2:43 felideon: ibdknox: but why, when I print the param it doesnt print quoted anywhere?

2:43 ibdknox: felideon: simple hack:

2:43 (vector? type) (str (name (first type)) "(" (second type) ")")

2:44 felideon: looks like the driver is fucking up and quoting an int

2:44 :(

2:44 it's well out of our hands when that happens

2:44 I hate jdbc

2:44 muhoo: hahahah quoted ints. i've seen that in lots of mysql database drivers

2:45 felideon: ibdknox: this is the problem with non-turtles-all-the-way-down lisps!

2:45 muahah

2:45 ibdknox: lol

2:45 muhoo: write a turtles database connection handler in pure clojure?

2:45 ibdknox: anyway, if you replace line 85 with that line I pasted above it should work

2:45 muhoo: call it "turtle"

2:45 felideon: muhoo: that would be nice

2:46 ibdknox: and now I shall sleep

2:46 good night guys

2:46 muhoo: night

2:46 felideon: nn, thx ibdknox

2:47 kovasb: later!

2:50 johnfn: it seems like instead of a zip function a la python, the idiomatic thing to do is to map with some sort of join function over multiple lists. is that reasonable?

2:57 kovasb: johnfn: what is the transformation you want to achieve?

2:57 emezeske: johnfn: Do know you about map being able to operate on multiple sequences? &&(map + [1 2 3 4] [2 3 4 5])

2:57 johnfn: yeah

2:57 emezeske: &(map + [1 2 3 4] [2 3 4 5])

2:57 lazybot: ⇒ (3 5 7 9)

2:58 johnfn: so i have [1 2 3 4] and [2 3 4 5], and i want [[1 2] [2 3] [3 4] [4 5]]

2:58 emezeske: &(partition 2 1 [1 2 3 4])

2:58 lazybot: ⇒ ((1 2) (2 3) (3 4))

2:58 johnfn: what i did was (map #(vector %1 %2) list1 list2)

2:58 emezeske: johnfn: Oh I see what you did

2:58 &(map vector [1 2 3 4] [2 3 4 5])

2:58 lazybot: ⇒ ([1 2] [2 3] [3 4] [4 5])

2:58 kovasb: &(map vector [1 2 3 4] [2 3 4 5])

2:58 lazybot: ⇒ ([1 2] [2 3] [3 4] [4 5])

2:58 kovasb: haha

2:58 emezeske: ^_^

2:59 johnfn: that works too :-)

2:59 emezeske: johnfn: You are doing the right thing

2:59 kovasb: i wish there was a decent transpose function tho

2:59 johnfn: that partition thing is neat, i'll keep it in the back of my mind for later puzzles :)

3:00 from coding today i'm starting to feel like people do fp just because fitting all these functions together is fun like a big puzzle

3:01 emezeske: johnfn: Heh, it is true that it's fun that way

3:01 kovasb: johnfn: yes that is exactly how it is

3:01 emezeske: johnfn: I always enjoy discovering new functions that let me trim down my old code

3:01 johnfn: hehe. yeah

3:02 its funny because i tried to understand clojure awhile ago and it was pretty impenetrable but now it makes more sense.

3:02 kovasb: hard to do unless u have pure functions

3:03 meiji11: it is gratifying to implement a fairly complex algorithm in about a dozen lines of code.

3:03 try doing that in an imperative language.

3:03 johnfn: heheh.

3:05 kovasb: meiji11 : i think i just had a PTSD flashback..

3:05 meiji11: haha.

3:06 welp, good night folks.

3:07 kovasb: night

3:31 muhoo: algorithm question, if i wanted to turn [1 2 3] into [[1] [1 2] [1 2 3]], what would i use? map? for? loop? reduce?

3:33 i need some hammock time, i think

3:34 i know how to do it imperatively, it's easy, but functionally, i have no idea

3:37 ivan: user=> ((fn [x] (map #(take % x) (range 1 (inc (count x))))) [1 2 3])

3:37 ((1) (1 2) (1 2 3))

3:38 emezeske: &(let [v [1 2 3]] (for [n (range (count v))] (take (inc n) v)))

3:38 lazybot: ⇒ ((1) (1 2) (1 2 3))

3:39 ivan: #clojure: you've got vectors, we've got sequences

3:40 babilen: muhoo: https://refheap.com/paste/2435 is another nice approach -- It was unfortunately not accepted into flatlands useful lib

3:41 emezeske: Ooh, I like this approach:

3:41 &(reductions (fn [acc x] (conj acc x)) [] [1 2 3])

3:41 lazybot: ⇒ ([] [1] [1 2] [1 2 3])

3:42 emezeske: I keep meaning to use reductions more

3:42 Hah, I can simplify that a lot

3:43 &(reductions conj [] [1 2 3])

3:43 lazybot: ⇒ ([] [1] [1 2] [1 2 3])

3:43 emezeske: muhoo: That's my final solution: (reductions conj [] [1 2 3])

3:43 sandaemc: Hello guys, is there a way I can get the current location of my application in Clojure? Thanks.

3:44 emezeske: sandaemc: You might need to explain what you mean by "current location of my application"

3:45 sandaemc: emezeske, well I found this on stackoverflow, but is not resolve: MyClass.class.getProtectionDomain().getCodeSource().getLocation().getPath(), I don't know how it is done in Clojure

3:46 _KY_: I want to move the files from a Lein project to a single directory and then run it without Lein, can someone guide me through that?

3:46 emezeske: _KY_: Why do you want to do that?

3:46 _KY_: I want to upload it to a repo

3:47 And the single directory is easier to look at

3:47 Also I don't want to assume that everyone has to use Lein to use Clojure

3:48 emezeske: _KY_: Is lein uberjar what you want? I'm not sure.

3:48 sandaemc: You are probably better off asking in #java

3:48 sandaemc: Once you find out how to do it there, it's a simple matter of a little interop

3:48 _KY_: Let me check out uberjar...

3:49 sandaemc: Thanks emezeske

3:50 _KY_: But the uberjar is already executable...

3:50 I'll just put the dependencies in a /lib directory

3:50 emezeske: _KY_: Okay I think I don't know what you want to do then

3:51 _KY_: I want to re-structure the source directory structure to make it simpler

3:51 And make it possible to run from the source, without using Lein

3:52 Right now I have to use "lein run" to run the project, right?

3:52 emezeske: What's complex about your existing directory structure?

3:52 muhoo: emezeske: holy crap that is elegant. i was doing stuff with loop recur. wow, thanks

3:52 emezeske: muhoo: heh, thanks for the interesting question :)

3:53 _KY_: Oh... reductions seems useful for my latest code as well... =)

3:53 emezeske: ^_^

3:54 _KY_: emezeske: the current dir structure has <project>/src/<project>

3:54 It could have been <project>/src

3:54 And I'd even prefer just <project>/

3:54 emezeske: Are you sure? Keep in mind that with Java, the directory hierarchy has to match the namespace layout

3:55 E.g. (ns a.b.c) has to be in /a/b/c.clj

3:55 _KY_: Oh I see...

3:55 So there is no easy way to change the dir structure without modifying the code

3:56 emezeske: Correct, AFAIK

3:56 _KY_: Then my project must be run using Lein from now on...?

3:57 emezeske: You *could* come up with a java command that would run your project

3:57 It's entirely possible, but... but why?

3:58 That's the point of Lein, is that it makes things not suck really hard

3:58 _KY_: I don't want to force other people to use lein

3:58 emezeske: I suggest looking at any of the official clojure repos, then, they do not use Lein

3:58 Example: https://github.com/clojure/clojurescript

3:59 No lein anywhere, and to execute it you use a shell script in bin/

4:00 They typically use script/bootstrap to download all the deps into a lib/ folder

4:00 _KY_: Is that developed using lein?

4:01 emezeske: 00:49 < emezeske> I suggest looking at any of the official clojure repos, then, they do not use Lein

4:01 _KY_: From the source point of view, you can't tell whether lein was present, right?

4:03 ivan: maybe you want to ship a project.clj for everyone who uses lein

4:05 _KY_: How do I find out how to run my project without lein?

4:06 If I include that as a .bat or something then people can try the project without install lein, and then they can decide to do so when they get serious

4:06 ivan: _KY_: set a CLASSPATH that includes every dependency you use, then java [...]

4:08 see java clojure.main --help

4:09 muhoo: ok one more brain teaser: how would i interpolate strings?

4:09 as in ["foo" "bar" "baz" ] => "foo/bar/baz" ?

4:09 i'm sure it's done all over the place in clojure.core, for ns resolution, etc

4:10 ivan: &(clojure.string/join "/" ["a" "b" "c"])

4:10 lazybot: ⇒ "a/b/c"

4:11 muhoo: auugh! join! thanks

4:32 doh, "interpose", not "interpolate", no wonder i couldn't find it in my notes

4:57 _KY_: What if I use lein to create my project and another guy uses emacs, can he run and contribute to my project easily?

4:59 babilen: _KY_: lein and emacs are most commonly used together (e.g. with lein-swank), so I don't quite understand your question

5:00 _KY_: What about netbeans?

5:01 I'm just thinking to allow the most people to work on the project using different stacks

5:04 gavilan: The Netbeans plugin for clojure won't work in 7.0+, but you can still edit files. Netbeans and Intellij work well with Maven pom.xml files, lein can generate one of those with "lein pom"

5:14 _KY_: So maven is an alternative to lein?

5:16 gavilan: lein is built with clojure in mind, is compatible with Maven repositories and uses parts of Maven under the hood.

5:27 _KY_: I see...

7:11 faust45: how i can make code reload in runtime?

7:13 fliebel: faust45: (require blah :reload)

7:13 faust45: (require 'blah :reload)

7:13 ?

7:13 you mean?

7:13 AimHere: There's also things like '(load-file ...)' and '(load-string ...)' and whatnot

7:14 ,(load-string "(+ 3 4)")

7:14 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

7:14 AimHere: Worth a try

7:15 faust45: fliebel: this (require 'blah :reload) not working for me

7:15 ivan: did it fail to load at all last time?

7:16 faust45: ivan: don't get question

7:17 ivan: :reload didn't work for me when the code failed to load the first time (wasn't in classpath yet), but maybe I misunderstood what was going on

7:18 how's it not working for you?

7:18 faust45: ivan: i make changes in code save file and new behavior not appear

7:21 i found this lib https://github.com/slagyr/fresh/

7:21 couldn't figure out how he reload code

8:02 fliebel: Any low-budget euroclojurians? Where do you sleep?

8:17 webben: clojure newb here

8:18 i'm running the repl directly with java

8:18 i call (set-break-handler!)

8:18 (clojure 1.4)

8:18 but when i try to interrupt a long-running command with CTRL-C, I'm dumped back to the terminal instead of the command being cancelled

8:19 s/cancelled/interrupted/

8:19 am i misunderstanding how this is supposed to work

10:11 mengu: hi.

10:11 is leiningen standart tool for clojure?

10:11 raek: mengu: yes.

10:14 mengu: alright then, let's install it

10:23 felideon: I've already installed it, thanks.

11:10 wkmanire: Howdy folks.

11:22 Does -main take args?

11:23 antares_: wkmanire: yes, command line arguments

11:23 wkmanire: antares_: What is the signature? -main [args]?

11:24 raek: wkmanire: no, more like [& args]

11:25 wkmanire: raek: Yeah, that's what I ended up using. thanks.

11:25 raek: (unlike the java main)

11:25 wkmanire: Now I have to figure out where the NPE is coming from.

11:26 raek: the stacktrace should contain that information

11:38 rhc: hrm, why does this not evaluate?:

11:38 ,(drop-while nil? '(({} :nonexist), 1))

11:38 clojurebot: (({} :nonexist) 1)

11:39 rhc: but this does:

11:39 ,(drop-while nil? [({} :nonexist), 1])

11:39 clojurebot: (1)

11:49 tmciver: rhc: it does evaluate; ({} :nonexist) is a function call; it's called in the second form, but not in the first and therefore is not nil in the first.

11:50 such are the problems with quoted lists.

12:07 antares_: Just launched a site listing my OSS Clojure projects: http://clojurewerkz.org. Would love to hear what people think. Individual project doc sites are in the works, too.

12:08 zakwilson: antares_: that's an impressive list of projects. Why have I never heard of any of them?

12:09 antares_: zakwilson: not all of them are ready to be announced

12:09 zakwilson: I try to announce those that ready once they have some decent amount of documentation

12:09 on the clojure mailing list, that is

12:09 a couple will be announced soon

12:09 zakwilson: antares_: so I shouldn't necessarily read the site and stick "there's a library for that" in the back of my mind for future reference?

12:09 antares_: others are not yet documented up to my standards

12:10 zakwilson: you should, almost all of those libraries are solid and actively used :) but I try to announce things when they have docs

12:10 wkmanire: antares_: Looks like a lot of good stuff.

12:10 antares_: OSS project without documentation = sucks and barely useful

12:10 (that's my opinion)

12:10 zakwilson: antares_: cool. I like it when there's a library for that.

12:11 wkmanire: antares_: Urly looks particularly useful, for me at least.

12:12 antares_: wkmanire: if you work with HTML content, also check out Crawlista

12:13 it is still in alpha stages and I break APIs from time to time but it has a lot of useful features

12:19 wkmanire: antares_: Are some of these libs interdependant?

12:19 I imagine Route One uses Urly.

12:20 antares_: wkmanire: yes and no. Route One does not use Urly but Crawlista does use Urly and Pantomime. Monger uses Validateur and so on. But we are very careful about not introducing hard dependencies.

12:21 so you absolutely can use most them separately

12:21 wkmanire: Cool

12:22 antares_: wkmanire: Mailer uses Route One, or rather, that's the idea. But you can use any other way of generating URLs, too.

12:24 wkmanire: antares_: To be honest, I'm not very familiar with some of the servers these client libraries target.

12:24 I think some of these are long standing java technologies right?

12:24 RabbitMQ?

12:25 antares_: wkmanire: that's fine. When the time comes to use something like elasticsearch or neo4j, you will have a nice way to work with them from Clojure

12:25 wkmanire: RabbitMQ is language agnostic. It is implemented in Erlang, if that matters.

12:25 wkmanire: No, not really.

12:25 antares_: those libraries use Java ecosystem libs heavily when it makes sense

12:25 wkmanire: It's been so long since I've worked with Java that I'm practically learning it from scratch again. Interestingly, using clojure to learn it.

12:26 antares_: monger uses official mongodb java driver (because why reinvent serialization & networking parts), langohr uses RabbitMQ Java client, Money uses Joda Money

12:27 I wonder if it's time to announce this site on Clojure mailing list

12:27 wkmanire: antares_: Money is just arbitrary precision floating point calculations?

12:27 antares_: wkmanire: currency convertions and manipulation. Not all currencies have floating parts ;)

12:27 wkmanire: Such as horses.

12:28 he he he

12:28 antares_: wkmanire: horses or JPY :)

12:31 Miko2: Hello, I just started out with Clojure and now I'm having a bit of a performance problem. It seems that the bottleneck is printing using println as it takes almost 20 seconds for 20 000 lines. Is there more efficient ways to print large amounts of text?

12:34 cshell: writing to console is slow in any language

12:34 wkmanire: Miko2: Do you really need to print 20k lines?

12:35 Chousuke: Miko2: are you sure the bottleneck isn't your terminal?

12:35 Miko2: I'm piping the output to a file.

12:35 cshell: Disk access is expensive too :)

12:36 Chousuke: it shouldn't take that long

12:36 cshell: You could leverage a logging framework that did the writing on a separate thread

12:36 Miko2: Python equivalent prints it in 2 seconds.

12:36 cshell: Depends on the disk and how long the lines are ;)

12:36 wkmanire: I need some style help. https://refheap.com/paste/2440

12:37 Are there any macros that can help me make this more readable?

12:38 rlb: Miko2: hmm, I get 2s here for time clojure -e '(doseq [x (take 20000 (repeat "..."))])

12:39 ... time clojure -e '(doseq [x (take 20000 (repeat "..."))] (println x))

12:39 > /dev/null

12:39 Miko2: https://gist.github.com/2551701 <- that's what I have

12:40 rlb: Miko2: hmm, still 1.3s for time clojure -e '(dotimes [n 20000] (println n))' > /dev/null

12:40 wkmanire: I guess I can always just break it down into smaller functions.

12:40 rlb: Try that on your system.

12:40 wkmanire: I was kind of hoping to layout the whole frame in one function.

12:40 mebaran151: whenever I try to play with the template features of lein2, I get an error: No Implementation of :make-reader for IOFactory nil

12:41 alexyakushev: Could someone please tell a correct method of creating a subprocess in Java that will also die when Java is killed?

12:41 rlb: (redirecting to /dev/null will help determine if it's an IO limit)

12:41 Miko2: rlb: That seems to be fast.

12:41 rlb: Miko2: sounds like a weak IO subsystem...

12:42 i.e. here I get 1.3s for "> blarg".

12:42 Miko2: but try that too if you haven't.

12:43 And of course if that's fast too, then examine how you're actually writing the data (if it's not just redirection).

12:44 Miko2: rlb: Hmmmm, with clojure -e it is fast, but with lein run it's slow. :/

12:46 time lein run -m porter-stemmer.test > /dev/null gives real 15.710s

12:46 And time clj -e '(dotimes [n 20000] (println n))' > /dev/null gives real 2.369s

12:47 raek: Miko2: what are you trying to optimize? startup time or printing time?

12:50 Miko2: Printing time. It seems startup takes about 5 seconds.

12:50 raek: then it

12:50 's probably best to perform the measurements within a running clojure instance

12:50 creese: What is idiomatic clojure for reading the lines of a text file?

12:51 raek: using 'time', for instance

12:51 rlb: creese: line-seq?

12:52 (line-seq (clojure.java.io/reader "blarg"))

12:52 creese: thanks

12:52 rlb: as long as you don't care when the file is closed...

12:52 creese: because its lazy?

12:52 rlb: right

12:53 creese: otherwise, perhaps something like (with-open [r (clojure.java.io/reader "blarg")] ...use r here...)

12:53 creese: what does x/y mean?

12:54 rlb: creese: that's namespace scoping

12:54 raek: creese: the io functions provided by clojure should not be considered a complete set. you may need to use the clojure.java.Reader methods.

12:54 rlb: i.e. y within namespace x

12:55 raek: rlb: you need to put something like (:require [clojure.java.io :as io]) in your ns form

12:55 then you can refer to the function as io/reader

12:55 wkmanire: https://refheap.com/paste/2444 I don't understand how this could blow the stack?

12:55 Where is the infinite recursion happening?

12:55 rlb: raek: sure

12:56 creese: thanks

12:56 raek: rlb: sorry, I meant to say that to creese :-)

12:57 to expand on your answer

12:57 rlb: right

12:58 Miko2: raek: I'm just wondering why there's still 8 seconds difference after the startup time when I use lein run

13:00 raek: Miko2: lein needs to start two clojure processs. so clojure.core ends up being compiled twice

13:00 Miko2: So, that explains it. :)

13:01 raek: if you write a -main function, compile everything using lein uberjar and aot, and then run the resulting jar using the java -jar command, then it should be a lot faster

13:04 Miko2: Okay. Have to read about it in leiningen's documentation. :)

13:05 Thanks.

13:06 mk: if I have an xy point, and want to add a speed vector to it, what's the correct way to think of that?

13:07 in java, a subclass called MovingPoint might work, but I'm not sure if that's right

13:07 wkmanire: Ok, if this is not a bug in seesaw, it is at least very misleading.

13:08 Miko2: raek: Yeah, now it takes only 2 seconds. :)

13:08 wkmanire: (seesaw.core/menubar :text "Menu") ;; -> stack overflow

13:08 menubar doesn't have a text property.

13:08 but stackoverflow is a bad way to tell me that.

13:09 raek: wkmanire: where does the stack overflow come from? csaw? the clojure printer?

13:09 wkmanire: I'll post the stack trace, just a sec.

13:10 rlb: mk: it'd really depend on the broader context IMO. i.e. [x y dx dy] might be just fine, or {:pos [x y] :v [x, y]}...

13:10 ...or maybe you need something more complex

13:10 wkmanire: raek: https://refheap.com/paste/2445

13:10 raek: wkmanire: (.printStackTrace *e)

13:11 wkmanire: raek: Processing....

13:12 mk: rlb: well, I want suitable polymorphism. It's clear enough that a point is a value different from a moving point, and different from a point that you display in a certain way (perhaps you give it a label)

13:12 mebaran151: actually, since upgrading to lein2 my new task always mysteriously fails trying to call IOFactory.reader on nil

13:12 mk: another thing to do is have a map that maps the point value to a position value

13:13 wkmanire: raek: https://refheap.com/paste/2446

13:14 raek: ok, it's a seesaw thing... then I don't have nay advice :-)

13:14 *any

13:14 mk: I want to be able to add extra (polymorphic) functionality to a certain value, but I'm not sure what the idiomatic way to do this is

13:14 wkmanire: It should throw an exception similar to "Hey, menubars don't have :text. What are you thinking?"

13:18 rlb: mk: http://clojure.org/datatypes, perhaps (assuming you haven't already seen it).

13:19 mebaran151: mk is the value a specific class of object or is it based on its value?

13:20 mk: mebaran151: is what based on its value?

13:20 rlb: thanks, I'll have another look

13:20 rlb: mebaran151: I was guessing the former given "...in java, a subclass called MovingPoint might work..." above.

13:21 mebaran151: what you're dispatching? e.g. are you dispatching on all Integers or the specific number 3?

13:21 rlb: ah that sounds like a good use case for defprotocol and defrecord

13:21 rlb: mk: I think mebaran151's probably talking about CLOS-style dispatch all the way down to "=="-like matching.

13:21 mebaran151: rlb: yeah exactly

13:22 rlb: i.e. something like (defmethod foo [(x 10)] ...) which is only selected if x == 10.

13:23 * rlb forgets the exact CLOS syntax...

13:23 mk: I was thinking of dispatching based on type (class)

13:24 the other sort seems strange and wrong, and only suited for optimizations...

13:25 rlb: mk: of course, also allows singleton selection, i.e. dispatch based on a particular instance of a class...

13:28 dnolen: mmarczyk: ping, so what's the summary on ObjMap? ObjMap -> PAM -> PHM?

13:28 mebaran151: mk: while it might be an aggressive optimization at the moment, you should checkout defprotocol and defrecord, both of which are custom built for your exact use case

13:32 mk: mebaran151: I've been thinking of protocols and records as similar to haskell's types and typeclasses

13:32 wkmanire: Ok, next newb question. I've been using lein, should I start using lein 2?

13:32 I'm not doing any serious work. Just learning clojure.

13:33 dnolen: lynaghk: I might look at some of those perf things today.

13:34 lynaghk: in particular str perf. are you using str higher order or just (str ...) ?

13:35 mk: I think I can define a point, and then a movingpoint, and have them both match the xy protocol, and have only the movingpoint match the vector protocol

13:37 if I want to have the movingpoint contain a point, and have its point methods defer to the point methods, is there an easy way of doing this?

13:50 mebaran151: mk: just define movingpoint's pointprotocol to defer to its internal point

13:50 it'll look a little like a recursive call, but it isn't :)

13:51 jonasen: dnolen: I've got the children multimethod implemented

13:52 mk: mebaran151: can I make the entire protocol defer? I don't want to make each method in the protocol defer

13:54 mebaran151: mk: there is probably a way finagle extend-type to do that (which just essentially implements the interface with a map functions)

13:55 mk: this begins to look a lot like extending (potentially multiple) classes

13:56 mebaran151: you'd create some function that generated the map automatically created

13:56 functions in t*** nathanmarz (~nathanmar@ has joined

13:56 channel #clojure [10:47]


13:56 */me is sorry erc fail

13:57 you'd create some function that would generate the function maps according to your specification for a specific protocol

13:57 or you could probably whip together a macro; I'm not sure which is easier

13:59 neither seems too idiomatic to tell you the truth

14:03 mk: mebaran151: thanks, I'll see how that works out for now

14:25 wkmanire: These ratios are really cool.

14:25 (seesaw.core/listbox :divider-location 1/3)

14:25 That is such a natural way to express the desired effect.

14:26 dnolen: jonasen: cool! make a JIRA patch

14:26 wkmanire: oops

14:27 not listbox

14:27 he he he

14:27 left-right-split

14:27 but anyway, very cool.

14:27 jonasen: dnolen: is it ok to use pre and post conditions? They were really helpful when developing..

14:29 dnolen: also, should the multimethod be in cljs.compiler or should I create a new ns?

14:32 dnolen: jonasen: keep in cljs.compiler for now. I don't really see a problem with pre/post but I'll let you know when I see the patch.

14:35 faust45: can any one point me, how i can fore code reload at runtime?

14:35 force code reloading i mean

14:35 LauJensen: Evening gents

14:36 wkmanire: LauJensen: Good eeeeeeeev'ning

14:36 faust45: (require 'ma.code :reload)?

14:36 _KY_: "lein search combinatorics" returns nothing... any idea why?

14:37 faust45: wkmanire: i try it, but after i make change in file and save nothing new happen

14:37 shadowh511: hello all, I have a quick question for you

14:38 I am trying to make a clojure wrapper to the java google voice libraries to help me learn clojure, and I cannot get the java google voice libraries into the build path

14:38 any suggestions?

15:04 jonasen: dnolen: http://dev.clojure.org/jira/browse/CLJS-214

15:10 dnolen: jonasen: thx

15:17 CLJS str is now a compiler macro that emits [...].join("")

15:17 still tracking rest fn slowness ...

15:18 mebaran151: anybody here have lein2 new working on Windows 7? I'm getting a mysterious no IOFactory implementation for nil that I can't seem to track down

15:20 jonasen: dnolen: is it possible to do (apply str ...) is str is a macro?

15:21 dnolen: jonasen: yeah I'm not sure I like :pre & :post here. seems like a lot of overhead especially if people are going to do multiple passes.

15:21 jonasen: speeding apply is whole other problem I'm looking into.

15:21 rest fn and apply

15:22 jonasen: dnolen: np, I'll remove them

15:24 dnolen: jonasen: thx

15:28 tmciver: shadowh511: do you have the google voice lib in hand? If so, just drop it into your lib/ directory.

15:29 jonasen: dnolen: done.

15:33 dnolen: jonasen: applied to master! thanks much.

15:35 jonasen: dnolen: nice!

15:36 dnolen: will you also consider http://dev.clojure.org/jira/browse/CLJS-212 if I update the patch against the new master?

15:37 or maybe it'll still merge without problem

15:48 shadowh511: tmciver: I do and I did, still did not work

15:52 tmciver: shadowh511: what is the error that you're getting?

15:52 shadowh511: tmciver: eclipse says it cannot find the stuff on the java build path

15:54 tmciver: shadowh511: Eclipse, huh? I'm afraid I won't be much help. Have you restarted Eclipse since putting the jar in lib? The lib directory is a lein thing - I don't know where Eclipse is looking for dependencies.

15:55 shadowh511: I'll try using lein

15:56 how do you mark a namespace as the main?

15:56 tmciver: shadowh511: there are plenty of people who use Eclipse so it's doable, I just don't know how.

15:57 shadowh511: key :main in defproject

15:59 shadowh511: if you want to run with 'lein run' you need a namespace for :main in project.clj and you need a function called -main in that namespace.

16:00 shadowh511: tmciver: I made a function called -main, and it's getting a compiler error

16:00 EOF while reading

16:01 tmciver: shadowh511: that usually means you left out a )

16:01 dnolen: jonasen: CLJS-212 looks good but you need to update the patch

16:02 shadowh511: oh, found the missing bugger

16:02 now it can't find the jars

16:02 jonasen: dnolen: I updated it a minute ago

16:02 dnolen: jonasen: doesn't apply here.

16:03 jonasen: dnolen: I'll take a look

16:03 tmciver: shadowh511: what error do you get now?

16:04 shadowh511: Exception in thread "main" java.lang.ClassNotFoundException: com.techventus.server.voice.Voice, compiling:(core.clj:1)

16:04 sam@rarity:~/Code/GoogleVoiceClojure$ lein classpath

16:04 /home/sam/Code/GoogleVoiceClojure/test:/home/sam/Code/GoogleVoiceClojure/test-resources:/home/sam/Code/GoogleVoiceClojure/src:/home/sam/Code/GoogleVoiceClojure/classes:/home/sam/Code/GoogleVoiceClojure/resources:/home/sam/Code/GoogleVoiceClojure/lib/clojure-1.3.0.jar:/home/sam/.lein/plugins/lein-noir-1.2.1.jar

16:04 (sorry for the spam)

16:05 tmciver: shadowh511: I don't see a google-voice jar there...

16:06 shadowh511: that would expalin it ;_;

16:09 added the jars to the classpath, let's see if it works now

16:09 how many arguments should the -main function take?

16:10 tmciver: I think it should be (defn -main [& args] ...)

16:10 shadowh511: added the & args, running

16:11 \o/

16:11 the basic SMS test passed

16:17 mebaran151: how do I make plugins override included libraries with lein: the newnew plugin has a bugfix that is useful, but I had to manually delete the new folder from the jar to get it recognized. Anything less hacky?

16:19 And now subsequently loaded plugins do not find the sanitize function inside newnew

16:23 wkmanire: I'm having trouble understanding these selectors for seesaw.

16:24 I have a listbox in a frame I want to select. It's the only listbox so I expected this to work. (csaw/select the-frame [:listbox]).

16:24 but I only get an empty seq.

16:25 hcumberdale: Hi ;)

16:25 wkmanire: hcumberdale: Hello :)

16:26 hcumberdale: Do you happen to have experience using seesaw.core/select?

16:26 hcumberdale: hi wkmanire, no never seen it

16:27 wkmanire: bummer

16:30 jonasen: dnolen: could you try with patch3?

16:31 hcumberdale: wHAT IS SEESAW?

16:33 mebaran151: wkmanire: I'm not sure you can just use :listbox; when I've worked with seesaw I tend to give everything an id use that to reference my objects (i.e. :#listbox)

16:41 dnolen: jonasen: applied to master

16:41 jonasen: thanks much, these patches tidy up the compiler quite a bit.

16:43 jonasen: dnolen: thanks! I think the analyzer is in good shape now :D

16:46 samaaron: howdy

16:48 wkmanire: mebaran151: Thank you, I'll give that a try

16:48 Sorry for the long delay in responding.

16:51 Yep, mebaran151 was right. Much easier with IDs.

16:52 hcumberdale: Is there a function to guess a content type from a file name?

16:52 wkmanire: hcumberdale: Like based on an extension?

16:53 dnolen: jonasen: agreed. Should simplify things for everyone.

17:15 erewhon: dnolen: hey, glad I made it to the clojure meeting the other week. was cool hearing about the latest in cljs. (alas, I only seem to keep up to date on clojure at meetups.) hope to make it to another meetup next time I'm in NY.

17:15 * erewhon is the guy from Houston

17:24 TimMc: hcumberdale: Haha, no -- and it's a really hard task.

17:26 hcumberdale: At work I was dealing with a file that contained a news article, but Apache Tika guessed it as an SGI Video file. >_>

17:28 The first line of the file started with "MOVIE" (the beginning of the headline), and MOVI is the magic string for that file type.

17:28 kovasb: anyone use js-obj in clojurescript?

17:28 bbloom: kovasb: what about it?

17:28 kovasb: (.-a (js-obj "a" "1"))

17:29 should that give "1" as the result?

17:29 bbloom: evaluate it with a # in front

17:29 function () {

17:29 return {"a":"1"}.a;

17:29 }

17:29 so yes :-)

17:29 what problem are you having?

17:29 kovasb: I'm not getting anything

17:30 like, the repl returns a blank line

17:30 bbloom: evaluate this: #(.-a (js-obj "a" "1"))

17:30 what do you get?

17:30 kovasb: #<function (){

17:30 return cljs.core.js_obj.call(null,"a","1").a;

17:30 }>

17:30 bbloom: hmmm

17:31 doesn't look right

17:31 1 sec

17:31 kovasb: I'm gonna try going to a different namespace

17:31 yeah same problem

17:31 bbloom: so js-obj is both a fn and a macro

17:32 you're getting the fn version of it

17:32 i'm getting the macro version

17:32 kovasb: ok

17:32 that would be fine if the fn version did something :)

17:32 bbloom: it appears to be bugged

17:32 hcumberdale: TimMc found something in ring

17:32 bbloom: ClojureScript:cljs.user> (goog.object/getKeys (apply js-obj "a" ["1"]))

17:32 #<Array ["k1"]>

17:32 ClojureScript:cljs.user> (goog.object/getKeys (js-obj "a" ["1"]))

17:32 #<Array ["a"]>

17:33 kovasb: yeah, i tried js-keys, it was returning the an empty array

17:33 so i figured my understanding of what js-obj did was broken

17:33 bbloom: nope

17:33 it looks bugged to me :-P

17:33 let me look a bit closer

17:33 kovasb: cool

17:33 good to know

17:34 will move to plan b

17:34 bbloom: kovasb: you can simply import the js-obj macro

17:34 kovasb: bloom: what namespace is it in?

17:34 bbloom: cljs.core

17:34 use refer-macro

17:35 kovasb: ok

17:35 i though that stuff gets imported automatically

17:35 bbloom: ok i found the bug

17:35 #(let [k1 "a" v1 "1"](js* "{~{}:~{}}" k1 v1))

17:35 #<

17:35 function () {

17:35 var k1__6467 = "a";

17:35 var v1__6468 = "1";

17:35 return {k1__6467:v1__6468};

17:35 }

17:35 >

17:35 the keys are bad :-/

17:35 i'll see about fixing it

17:36 kovasb: nice

17:36 thanks for the help.. back to hacking

17:39 bbloom: kovasb: you can also just use goog.object/create directly

17:39 * ivan looks at people's hideous <jarjar> rules and wonders how long until we have CljClj

17:40 kovasb: bbloom: yeah I will just do that.

17:40 bbloom: i used to just to .str-obj, but now I'm afraid with all the changes to the hash maps

17:41 ivan: is there an HTTP server written in Clojure?

17:42 hcumberdale: is there a library for clojure to generate thumbnails from imagesß

17:46 kovasb: ivan: http://github.com/ztellman/aleph

17:46 brehaut: hcumberdale: java2d would be a low level answer

17:46 ivan: kovasb: yeah, I'm trying to build netty and 5 levels deep in building deps manually :)

17:47 hamcrest -> qdox -> ???

17:47 lazybot: ivan: Oh, absolutely.

17:47 kovasb: ivan: ouch

17:49 ivan: for some reason Java people like to include jars and exes in their source repo, but not the generated code needed to build

17:54 y3di: any updates on when the clojure west vids might go up?

17:55 dnolen: kovasb: bbloom: that works in master

17:55 kovasb: bbloom: js-obj did not take any arguments until recently

17:56 bbloom: dnolen: i have a fix

17:56 sending you a patch now

17:56 kovasb: dnolen: got it

17:56 riddochc: Heya. I'm finally getting around to trying out 1.4.0, and the preview of lein 2, and lein2 seems confused.

17:56 bbloom: dnolen: do you want it via jira? or i can just paste you a patch gist

17:56 riddochc: It says: Could not find artifact clojure:clojure:pom:1.3.0 in central (http://repo1.maven.org/maven2)

17:57 dnolen: bbloom: which part? (.-a (js-obj "a" "1")) works.

17:57 riddochc: Also claims the same for clojars, and for the jar in central and clojars, too.

17:57 bbloom: apply js-obj

17:57 the macro works, not the function

17:57 dnolen: bbloom: ah right, yes please do.

17:57 xeqi: riddochc: you want [org.clojure/clojure "1.3.0"]

17:58 bbloom: dnolen: kovasb: http://dev.clojure.org/jira/browse/CLJS-215

17:58 antares_: riddochc: it is org.clojure/clojure: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22clojure%22

17:59 bbloom: dnolen: while i got you here, can i ask you some stuff about IFn, variadic functions, lazy apply, etc

17:59 ?

18:00 riddochc: xeqi: Ah, good, thanks.

18:00 dnolen: bbloom: go ahead

18:01 bbloom: dnolen: so I noticed that IFn is already special/magic in some ways with respect to extend-type — as is expected for such a core concept… I'm wondering if it should also be special with how it treats variadic functions

18:01 dnolen: bbloom: ?

18:01 bbloom: dnolen: In particular, when I was implementing a Var type, I had to create this ugly pyramid of -invoke implementations

18:02 dnolen: anyone who wants to implement a function wrapper of some kind needs to do a bunch of ugliness to get invoke/call/apply working correctly

18:03 muhoo: is it clojure-ish to conditionally require :as namespaces based on some app config env value?

18:03 dnolen: bbloom: IFn is not for handling variadic cases.

18:04 muhoo: in other words, i have two different back-ends, each defined in different namespaces and files, but with the same protocol. i want to be able to switch them out at app start time

18:04 bbloom: dnolen: ok…. did you look at my Var patch?

18:04 dnolen: what should I have done? especially to make (apply #'+ (range 100)) work :-)

18:04 dnolen: bbloom: sorry, not yet. deep in some other stuff.

18:05 bbloom: if you want your code to work on various hosts - you have to implement all the arities.

18:06 bbloom: dnolen: could you elaborate? why? i'm wondering if there needs to be an IVariadicFn which has an -apply method, or something

18:07 dnolen: bbloom: how would we know to call that?

18:08 bbloom: dnolen: not sure, haven't thought super deeply about this. mainly my "this is kludgey" spider sense is tingling

18:09 dnolen: seems like extend-type could auto-implement -invoke in terms of -apply and vice-versa

18:09 xeqi: muhoo: I'm use to seeing things like https://github.com/ibdknox/noir/blob/master/src/noir/server.clj#L72 for runtime dependecies

18:10 *optional dependencies

18:10 dnolen: bbloom: possibly. but don't forget that we may want to optimize -invoke - direct dispatch.

18:12 bbloom: dnolen: of course, but I'm thinking about function-like objects where perf is not top priority. extend-type could provide sensible default implementations, but only if explicit optimized implementations aren't present

18:13 dnolen: bbloom: all the current fn-like objects that people use today could really use that optimization

18:14 bbloom: I agree that generating all the cases stinks, but we have macros. That's what I did in core.logic.

18:15 muhoo: xeqi: thanks. i'd seen that, but since this is a bit more of a special case -- runtime requirement of a choice of two different ns's with the same protocol -- i figured i'd ask before doing anything i might regret.

18:17 dnolen: bbloom: js-obj patch applied to master, thanks.

18:18 bbloom: dnolen: well it's not just the ugliness of all the -invoke overloads. it's also the broken-ness that occurs around the edge case with apply, laziness, etc…. I haven't fully groked it yet, but something is broken in apply or extend-type which is preventing me from making this work: (apply #'+ (range 100)) — doubly so if I wanted an unbounded range with side effects evaluated lazily

18:18 dnolen: bbloom: btw, about delimc - I'm pretty excited about cjfrisz's work on Clojure TCO

18:18 bbloom: dnolen: yeah, just watched the ctco talk. good stuff!

18:18 dnolen: I'm working on the level *above* that. I'm assuming that someone somewhere will make a solid CPS transformer

18:18 dnolen: bbloom: I think cjfrisz work a much better foundation for shift/reset - minimal thunkification

18:19 bbloom: dnolen: for now, i'm putzing with the higher level api design

18:19 dnolen: bbloom: cool

18:19 bbloom: dnolen: I have a sorta working implementation of defasync and await in the style of C# 5 — i'd really like to flesh it out more

18:20 dnolen: bbloom: I'm still grokking apply in CLJS myself.

18:20 bbloom: dnolen: also, various higher order interface adaptation functions, like async/node->clj and async/jquery->clj or whatnot to take a particular calling convention

18:20 cjfrisz: dnolen bbloom: It's become apparent that I need to separate the CPS parts into a separate module

18:21 dnolen: cjfrisz: yes, I think if we can get clj-tco into contrib it should probably be clojure.tool.cps

18:21 bbloom: cjfrisz: would be greatly appreciated :-)

18:21 cjfrisz: And hopefully I'll have more time after this week to add more interesting language forms than what's in there now

18:21 dnolen: cjfrisz: clojure.tools.cps, I mean.

18:21 cjfrisz: and you have clojure.tools.cps.tco, clojure.tools.cps.callcc etc

18:22 as the modules w/in

18:22 cjfrisz: dnolen: That sounds like a good plan

18:22 yoklov: is a full cps transformer even possible for clojure? I remember hearing/reading somewhere that it was not possible for common lisp

18:23 bbloom: cjfrisz: dnolen: have you seen C# 5's async/await stuff?

18:24 dnolen: bbloom: I've seen examples - cool stuff.

18:24 cjfrisz: bbloom: I haven't, actually

18:24 bbloom: cjfrisz: http://www.microsoft.com/en-us/download/dlx/default.aspx?id=23753

18:25 brehaut: bbloom: that stuff has been in F# for a long while too. perhaps as early as F# 1

18:26 (it is implemented monadically there)

18:26 bbloom: cjfrisz: dnolen: the C# version generates a state machine with a switch statement. basically it takes functions annotated as "async" which return Task objects (generalized promises) and rewrites them in a continuation-like manner at every call to "await". basically, the "await" keyword takes a Task promise and realizes it

18:26 brehaut: I figured. Will go dig into it

18:26 dnolen: bbloom: re: (apply #'+ (range 100)). Like I said I'm in no rush to sort that out yet :)

18:27 cjfrisz: bbloom: That sounds like a Haskell paper from a few years ago

18:27 Combining Events And Threads For Scalable Network Services: http://repository.upenn.edu/cgi/viewcontent.cgi?article=1391&context=cis_papers

18:28 bbloom: cjfrisz: probably is. the managed language folks at microsoft take pride in the fact that they don't invent anything new, they simply package it up for mere mortal windows developers :-P

18:28 cjfrisz: bbloom: Oddly that's the second time today I've pointed someone to that paper

18:28 bbloom: cjfrisz: although I haven't used C# in 2+ years since leaving microsoft, I consider C# 3's Linq to be my gateway drug into functional programming :-)

18:29 cjfrisz: bbloom: I've been increasingly curious about F# but have never actually looked into it

18:30 bbloom: cjfrisz: I haven't worked with it heavily, but it seemed like a pretty nice OCaml-family language. I'm firmly in the dynamic typing camp these days, so I never really dug that deeply into it

18:31 cjfrisz: bbloom: I've been Lisp-ing for quite a few years now, but I do find myself suddenly drawn to a good static type system.

18:31 brehaut: last time i looked at F# there were two things that counted against it (from the perspective of a clojure programmer): no equivalent to typeclasses or protocols, and a lot of mutable .net types

18:31 arrays being the most pernicious

18:32 dnolen: cjfrisz: from your post, sounds like IU is mostly Scheme & Haskell

18:32 cjfrisz: do you do much Haskell?

18:32 ivan: the really cool part about MS's Task/await is that you can use it as many event loops as you want (afaik), it doesn't confine you to one like Twisted's Deferreds

18:32 cjfrisz: dnolen: I've dabbled in it, but I don't think I was ready to commit the last time I tried

18:32 bbloom: ivan: In general, the entire stack leading up to the Reactive Extensions (aka RX) is pretty damn good

18:32 cjfrisz: I think I might give it another shot

18:32 bbloom: ivan: that includes the Parallel Extensions (aka PX)

18:33 ivan: cool, haven't looked at those yet

18:33 dnolen: cjfrisz: my main reservation these days is you can't really do miniKanren properly in it ;)

18:33 cjfrisz: I used to be a shameless OO programmer, and it wasn't until recently that I realized how much of that knowledge is the start into using a good Haskell-style type system

18:33 dnolen: One of my friends is actually working on a miniKanren-like language in Haskell

18:34 dnolen: cjfrisz: the repo on GitHub or something new?

18:35 cjfrisz: and by miniKanren-like I mean something which can be easily applied back on the source language. That's the killer aspect IMO.

18:35 cjfrisz: dnolen: I haven't heard about progress on it in a while and I can't seem to find it on his Github

18:35 bbloom: cjfrisz: just skimming the ctco code. you mentioned in your talk the use of records and protocols. seems a little overkill compared to something like the multimethod used in the cljs compiler.

18:35 brehaut: dnolen: haskell already has a logical language that can be applied to the source language: the type system ;)

18:36 (caveat: that joke is out of date)

18:36 cjfrisz: bbloom: I'm a compiler performance junkie, and records+protocols were billed as having the best performance

18:36 bbloom: cjfrisz: have you profiled it? ;-)

18:36 dnolen: brehaut: yes, but lacks the nice meta-circularity ;)

18:36 brehaut: dnolen: im not going to let reality get in the way of a joke!

18:36 cjfrisz: bbloom: not yet :-)

18:36 dnolen: bbloom: cut cjfrisz some slack, he's new to this Clojure thing and he's working on cool stuff :)

18:37 clojurebot: ClojureScript is https://github.com/clojure/clojurescript

18:37 bbloom: cjfrisz: I've found the dispatch on :op pattern in the cljs compiler to be really pleasant to work with

18:37 dnolen: of course. very cool stuff! I'm new to it too and I jumped right into the compiler :-) we need to all push each other to be even more awesom

18:37 cjfrisz: bbloom dnolen: I certainly need to look into it, though I've heard a couple people remark on multimethods being slow

18:38 bbloom: cjfrisz: luckily, the cost of compilation is generally amortized over many very small little functions defined one at a time during development :-)

18:38 dnolen: cjfrisz: they are slower, but probably not in an intersting way for macro stuff like this.

18:38 bbloom: cjfrisz: unlike C++......

18:39 cjfrisz: bbloom dnolen: I've actually got plans for a stand-alone compiler at some point, and it'll probably have to do quite a bit more work. So having the extra speed may end up helping.

18:39 bbloom: dnolen: one last thought on variadic functions. do protocols simply not support them across the board? it appears that way. is that a JVM limitation?

18:39 cjfrisz: But only time will tell

18:40 dnolen: bbloom: protocols do not support them at all - limitation of the JVM but probably other hosts as well.

18:41 bbloom: dnolen: ok, thanks

18:41 dnolen: definitely not a problem for javascript. heh. but I understand the value of cross-platform heh

18:41 dnolen: bbloom: only semi-"not a problem " for JS

18:42 bbloom: removing arguments object access is a big perf win.

18:42 bbloom: dnolen: hm, didn't realize that, but i could see it making sense.

18:42 dnolen: bbloom: for non-higher order variadic calls under advanced opts we can emit (foo 1 2 (array 3 4))

18:43 hcumberdale: lost the chat log due disconnect

18:43 dnolen: bbloom: so you get the expressiveness, but don't pay for arguments.

18:43 bbloom: dnolen: except when you've got laziness

18:43 hcumberdale: is there a clojure framework to generate thumbnails from images?

18:43 bbloom: (apply (fn f [& args] (take 3 args)) (range))

18:43 ,(apply (fn f [& args] (take 3 args)) (range))

18:43 clojurebot: (0 1 2)

18:43 dnolen: bbloom: apply is a different case, yes

18:44 bbloom: dnolen: OK, we'll I'll think on it & probably update my Var patch. Would really appreciate your feedback on that ticket when you get some spare brain cycles. no rush.

18:45 dnolen: bbloom: will do

18:45 bbloom: dnolen: thanks

18:45 yoklov: hcumberdale: you could do (java.awt.Image/getScaledInstance new-width new-height java.awt.Image/SCALE_SMOOTH) or something like that

18:46 kovasb: bbloom: ILookup in clojurescript is variadic

18:47 bbloom: kovasb: will take a peek at that 1 a few min

18:47 kovasb: unless u mean taking unlimited args

18:47 bbloom: ah yeah

18:47 i mean the '& case

18:47 and the lazy case

18:47 kovasb: ok nevermind :)

18:47 bbloom: not just multiple arity overloads

18:48 powrtoc: What's the best way to console log/dir objects from within clojurescript? They simply display as #<[object Object]>

18:49 yoklov: powrtoc: probably your best option is to use a newer version of the compiler

18:50 emezeske: powrtoc: The two logging functions I use are as follows: (defn log-js-object [o] (.log (js* "console") o)) (defn log-form [o] (.log (js* "console") (pr-str o)))

18:50 powrtoc: For JS objects and CLJS forms, respectively

18:51 yoklov: emezeske: don't cljs forms get serialized right without pr-str?

18:51 serialized/logged

18:51 powrtoc: yoklov, Ok... I'm using cljs-template ... can I update the compiler with that?

18:51 emezeske, yes I have similar functions already

18:51 emezeske: yoklov: Depends on the type of object I think

18:51 powrtoc: but they don't log other objects very well

18:52 yoklov: powrtoc: I'm not sure. I think it uses lein-cljsbuild as its backend so you should be able to, but it might break some things.

18:52 emezeske: powrtoc: Other objects?

18:53 yoklov: ibdknox: do you know if cljs-template should work with newer versions of the cljs compiler?

18:55 powrtoc: emezeske, sorry I'm being silly... both of my functions were calling pr-str... which is why they weren't displaying properly

18:55 it's fixed now :-)

18:55 thanks for that

18:56 emezeske: powrtoc: ^_^

18:58 ibdknox: yoklov: as far as I know it should be fine unless I missed a serious breaking change somewhere

18:58 yoklov: okay, that's good to know.

19:00 riddochc: Cool, now I've ggot vimclojure set up and talking to clojure 1.4.0, run by the latest beta of lein 2. Yay.

19:00 powrtoc: has anyone managed to get the cljs browser repl working with cljs-template & emacs?

19:01 preferably slime :-)

19:03 hcumberdale: no better way then using awt

19:04 yoklov: hcumberdale: probably not. you could make one though

19:19 how can I check if something implements an optional part of a protocol

19:46 dgrnbrg: Can I use a project symlinked in the checkouts folder in lein 1 without having that project visible in any maven repos?

19:47 samaaron: dgrnbrg: i believe so

19:47 tmciver: dgrnbrg: but you have to 'lein install' that checked out project.

19:47 dgrnbrg: how do you lein install a projecT?

19:47 i've never heard of that command

19:48 tmciver: dgrnbrg: you just run 'lein install' in the checked out projectj's directory.

19:48 yeah, I discovered that recently the hard way.

19:48 samaaron: so what does `lein install` actually do?

19:49 tmciver: dgrnbrg: that puts the checked out project's jar and pom in your ~/.m2, I think

19:49 dgrnbrg: oh, i see

19:49 that's good to know

19:49 samaaron: oh weird - it's a shame you have to do that

19:49 hopefully that's not the case in lein2

19:51 tmciver: samaaron: well, I think you have to do it at least for projects that are not at all public. Otherwise there's no way for the main project to get the transitive deps.

19:52 samaaron: ah, makes sense

19:59 powrtoc: I'm having some trouble with clojurescript, and cljs-template not reporting errors... are there any work arounds?

19:59 I don't even know where it's supposed to be reporting compiler errors

20:03 ahh it's ok, clojure-jack-in masks them... if I do lein swank at a terminal they're reported to stderr

20:12 hcumberdale: weavejester, thank you very much!

20:12 weavejester: hcumberdale: No problem. Does it work for you?

20:13 hcumberdale: It works now with the content-length and content-type settings in a "meta" map

20:13 very very good

20:14 Successful transfer of hundreds mb with only ~28mb ram assigned

20:16 dgrnbrg: do you use clojuredocs? is there a better documentation source? (more up-to-date + cross-referenced?)

20:42 yoklov: so, callbacks aren't really that idiomatic in cljs, what have people been doing to ease the pain of running in the browser?

20:45 ibdknox: yoklov: there was some talk about FRP last night

20:45 yoklov: I don't think anyone's got something yet

20:46 yoklov: hm

20:46 FRP would work for some stuff, but unless I'm understanding it wrong, not really for something like loading assets asynchronously for a game

20:47 ibdknox: I would think that's just part of the stream

20:47 yoklov: maybe, it seems very discrete to me though

20:48 or maybe i'm just not thinking about this reactively enough

20:48 ibdknox: I haven't really tried to do anything down that road yet, so I have no idea :)

20:48 yoklov: when I wrote racket i used frtime once but it was… bizarre

20:48 i didn't understand it and went back to their normal gui

20:49 ibdknox: there's some abstraction we're missing I think

20:49 yoklov: yeah, definitely

20:49 ibdknox: FRP is cool, but damn is it complicated

20:49 yoklov: yup

20:49 ibdknox: I think there are handful of people who actually understand what the hell is going on there

20:49 and they're not building "real" software ;)

20:49 yoklov: haha

20:50 ibdknox: do you have any thoughts?

20:50 I'm in the gathering knowledge phase of this problem lol

20:51 yoklov: hm, a couple that are probably not worth a whole lot, but for the sake of your knowledge gathering i'll share them

20:53 for one its a real shame that clojure handles the pain of threads so well, but when writing cljs you don't have any of that. even something like futures would be nice, though the semantics would obviously differ

20:53 ibdknox: futures or promises?

20:53 yoklov: err

20:53 promises

20:54 or maybe something along the lines of what iced coffeescript offers (caveat: i know nothing about it, just that it's a language extension meant for dealing with async crap. Seems like it could be doable as a library in cljs due to macros)

20:55 * ibdknox goes to look

20:56 tmciver: ibdknox: where was this FRP talk? Is there a vid?

20:56 ibdknox: tmciver: I meant here in IRC :)

20:56 tmciver: This is functional-relational programming?

20:56 Ah

20:56 ibdknox: functional reactive programming

20:57 yoklov: yeah, this is like C#'s async

20:57 yoklov: ibdknox: ah, yeah I saw people talking about that

20:57 ibdknox: it took some crazy compiler-level code rewriting to make that happen

20:57 tmciver: Oh. I've been reading 'Out of the Tar Pit' and they talk about Functional Relational programming.

20:58 yoklov: ibdknox: i can imagine. I wasn't aware c# had to deal with asynchronicity much

20:58 ibdknox: yoklov: everything makes web requests these days :)

20:58 yoklov: ibdknox: ah, yeah, that is true.

20:59 Looking a bit more at iced coffeescript, it does look like something which would benefit cljs

21:00 ibdknox: yeah

21:00 not sure how hard it would be to implement

21:01 yoklov: me neither, it talks about a cps transformation which i always thought needed more information about the code than macros usually offered

21:02 ibdknox: I was under that impression as well

21:02 yoklov: but that might not be true for clojure

21:02 there are things like &env which are... weird

21:04 ibdknox: yoklov: looking at the implementation of iced, it's more along the lines of the C# implementation

21:04 lot of work there

21:07 yoklov: hm. honestly it seems like the sort of thing which should be language level if that's the only way to do it and nobody comes up with any better ideas. right now writing cljs is just about as painful as writing js at times

21:07 ibdknox: definitely

21:08 it takes away some nuisances, but the fundamental issues are there just as strong as ever

21:09 yoklov: yeah. it's tragic.

21:10 dgrnbrg: how can a leiningen plugin call another leiningen plugin given on the command like in lein1?

21:10 technomancy: dgrnbrg: leiningen tasks are just functions; just require and call them with a project map argument

21:11 dgrnbrg: I have the function as a string passed into the args

21:11 and I tried (apply (ns-resolve 'leiningen (symbol (first args))) (rest args)

21:11 but that didn't work, because it said "no such namespace: leiningen"

21:12 technomancy: is there another api to trampoline to a subtask that you only have a string representing?

21:13 oh, i see

21:13 I have the namespace wrong

21:14 But I don't know how leiningen resolves a function to a given leiningen.* namespace, or does it search them all?

21:27 kovasb: what is the best clojure way to trigger a "file" download in a web app?

21:27 the data i have is in memory, not really a file

21:27 from what i can tell the only way to do it is to create an actual specific url associated with the file

21:28 is there a ring handler for this or something?

21:28 weavejester: kovasb: The content-disposition header tells a browser to download a file rather than display it.

21:29 kovasb: weavejester: I've been trying to use that..

21:29 weavejester: but it doesn't seem to work in the context of an ajax request

21:29 weavejester: i don't want to make the page they are on go away

21:29 weavejester: kovasb: Well, it wouldn't...

21:30 kovasb: weavejester: so if i just do a normal "post" it should just work?

21:30 weavejester: ill give it a shot..

21:30 weavejester: kovasb: Yes, although a "GET" would probably be better.

21:30 kovasb: The browser should just pop up a download window instead of going to the next page.

21:30 kovasb: weavejester: the situation is I have data in the browser, and I want to download it

21:31 weavejester: so a GET will have a lot of data in it

21:31 weavejester: i looked at data uri but it doesn't let you specify the filename

21:31 gonna go try now..

21:31 weavejester: kovasb: Content-Disposition: attachment; filename="your-filename.blah"

21:32 kovasb: weavejester: yup, had that set, just getting thwarted by the ajax

21:32 weavejester: kovasb: AJAX is really just for sending stuff to JS rather than to the user.

21:32 kovasb: weavejester: yeah makes sense

21:33 weavejester: Bye folks

21:33 kovasb: weavejester: see ya

21:59 http200: Hi, I was looking to start learning Clojure again, and found this guide: http://blackstag.com/blog.posting?id=6 .. As I was reading through, I noticed that they mentioned clojure-contrib, which as I understand is outdated. It's also using Clojure 1.20. Is there a better, more recent guide you all can point to?

21:59 derrida: http200: what is your background?

22:01 tmciver: http200: I recommend picking up a copy of the new "Clojure Programming"

22:02 derrida: http200: http://java.ociweb.com/mark/clojure/article.html

22:02 books are long ;P

22:05 (kidding)

22:23 yoklov: derrida: that's sorta dated too

22:23 … not that I have better advice

22:23 derrida: i hoped that the "updated on 4/20/12" meant up-to-date :\

22:24 that's what i get for linking something i haven't read

22:26 yoklov: hm, he could have updated it. Either way its not terrible, but iirc it doesn't recommend using leiningen which makes using clojure seem more painful than it is

22:26 * derrida nods

22:27 lnostdal: is there some way of getting hold of a private dynamic variable in some namespace?

22:28 yoklov: lnostdal: probably via the var

22:29 lnostdal: try @(var some-ns/private-var)

22:29 brehaut: ,(meta clojure.core/sigs) ;; inostdal

22:29 clojurebot: #<CompilerException java.lang.IllegalStateException: var: clojure.core/sigs is not public, compiling:(NO_SOURCE_PATH:0)>

22:29 brehaut: ,(meta #'clojure.core/sigs)

22:29 clojurebot: {:ns #<Namespace clojure.core>, :name sigs, :private true, :line 216, :file "clojure/core.clj"}

22:30 lnostdal: yoklov, thanks! :) ..

22:30 brehaut: #' is short hand for the (var …) yoklov mentioned

22:30 yoklov: ,@#'clojure.core/sigs

22:30 clojurebot: #<core$sigs clojure.core$sigs@116555b>

22:31 lnostdal: is it possible to rebind it?

22:31 yoklov: the real quesion is how much punctuation can go before a symbol

22:31 lnostdal: i don't know, try?

22:32 ibdknox: yoklov: an infinite number of commas ;)

22:32 lnostdal: well, the obvious way didn't work

22:32 yoklov: ,'@#'clojure.core/sigs

22:32 clojurebot: (clojure.core/deref (var clojure.core/sigs))

22:32 yoklov: ,~`~`~`@#'clojure.core/sigs

22:32 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>

22:32 yoklov: :(

22:32 brehaut: thats what happens when you try to get poor clojurebot to eval perl

22:32 yoklov: ,`~`~`@#'clojure.core/sigs

22:32 clojurebot: (clojure.core/deref (var clojure.core/sigs))

22:32 yoklov: hahah

22:32 http200: hey derrida, yoklov

22:33 sorry, I was away. yeah, I know lein's pretty important for using clojure properly, I've dabbled a bit before, not sure where I got started though

22:33 lnostdal: wait, it did work .. weird .. hm

22:33 http200: clojure programming book looks very promising

22:34 and up to date, thanks all

22:34 yoklov: http200: it's quite good.

22:34 derrida: http200: if you haven't been exposed to lisp before, "the little schemer" is great.

22:34 yoklov: or SICP

22:34 http200: yeah, i read a few pages of the little schemer, I liked how straight forward it was

22:35 derrida: sicp is excellent but a lot heavier

22:35 http200: and read the first 2 chapters of the Practical Guide to Common Lisp yesterday, also some of land oflisp

22:35 yoklov: yeah. sicp sort of knocks you upside the head with a brick made of lisp

22:35 http200: SICP looked too academic and obtuse for me to approach on a rainy day :/

22:35 derrida: it's a mindbender!

22:36 tmciver: hurts so good!

22:37 yoklov: i don't think it's obtuse, academic is a maybe. depends on how you approach it, i guess

22:38 technomancy: dgrnbrg: sorry, I'm heading out; try reading PLUGINS.md which covers this stuffl

22:38 dgrnbrg: ok, thanks

22:40 yoklov: http200: you can take what I say on the matter with a grain of salt though. I used to TA a course on it so naturally I think it's the hottest shit around.

22:40 it won't teach you clojure though.

23:14 * Raynes writes an awesome new lein plugin for everyone to croon over.

23:27 yoklov: do it

23:29 wmealing: i've got excess croon here, spare.

23:49 ibdknox: Raynes: what is this new plugin?

23:49 Raynes: ibdknox: Not as interesting as I'm making it sound.

23:49 ibdknox: Raynes: I'll take care of the lein-noir thing tomorrow morning

23:50 Raynes: ibdknox: Yeah, it needs to be renamed too.

23:50 ibdknox: yeah

23:50 Raynes: ibdknox: It should be noir/lein-template

23:50 That's our new convention thingy.

23:50 ibdknox: kidoke

23:50 I'll make sure that happens too

23:50 Raynes: It's so that you don't have to install the template.

23:50 ibdknox: yeah

23:50 I did it for cljs-template the other day

23:51 Raynes: It's pretty sexy.

23:51 ibdknox: very neat :)

23:51 Raynes: technomancy gets the credit for that stuff.

23:51 ibdknox: I've been futzing around with python ASTs

23:52 Raynes: Sounds like fun.

23:53 ibdknox: the AST stuff for python is actually surprisingly straightforward

23:53 compare that to ruby where I couldn't even find something remotely reliable...

23:54 arohner: ibdknox: you mean the 6k LoC yacc file wasn't good enough for you?

23:54 ibdknox: heh

23:54 I laughed when I read the arguments for why a ruby ast lib didn't exist

23:55 arohner: it's a sad state of affairs over there ;)

23:55 arohner: in other news, ruby's yacc file is longer than LispReader.java

23:55 Raynes: My cat's tail is longer than LispReader.java.

23:56 logaan: idbknox: do you have a link to the reasons a ruby ast lib doesn't exist?

23:56 arohner: ibdknox: oh, I'm aware. Unfortunately, they aren't ;)

23:57 Raynes: We're obviously much better people than they are.

23:57 We should, perhaps, have a separate bathroom for the Ruby people at conferences from now on. Our kind shouldn't mix.

23:57 ibdknox: logaan: sorry didn't keep the tabs open. Basically it has a lot to do with the 6kloc yacc file ;)

23:58 even with the AST it'd be so irregular I'm not sure I could do much of anything meaningful :(

Logging service provided by n01se.net