#clojure log - Oct 15 2012

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

3:46 kral: namaste

4:06 * josteink solves all kinds of problems by apt-get remove'ing leiningen from his amazon EC2 machines

4:06 josteink: no wonder I was getting the wrong behaviour :)

4:07 tomoj: it seems like some ubuntu packages should have a warning label for developers

4:09 josteink: yeah

4:09 tomoj: rubygems too

4:18 clgv: since leiningen has a built-in upgrade these distribution packages have no additional benefit over installing leiningen directly, I'd say

4:20 josteink: yeah

4:20 but unless you -know- that

4:20 the default behaviour for most people is doing an apt-get install

4:21 and assume they have a reasonably standard working setup

4:21 with leiningen you dont :)

4:21 clgv: well, you know at least that a package of you linux distribution is very likely to not be uptodate ;)

4:22 josteink: heh

4:22 speaking of which .. lein --version lists java 1.6 :P

4:24 clgv: uff

4:24 go get that lein2-preview10 ;)

4:25 antares_: josteink: lein2 can use any JDK you want, just export LEIN_JAVA_CMD. I don't remember if lein1 can.

4:25 clgv: or at least 1.7.1 if you do not want to migrate to 2

4:25 tomoj: clgv: for developers, no additional benefit

4:26 for some ops people? dunno..

4:26 clgv: tomoj: is leiningen part of you software installation?

4:26 I am shipping uberjars ;)

4:26 josteink: antares_: oh I no. I was just replying to clgv's comment about going with a distro's defaults and not being up to date ;)

4:27 oh i know

4:27 tomoj: me too

4:27 maybe some hudson server though?

4:28 s/hudson/jenkins/

4:29 clgv: tomoj: ah well, I didn't setup something like that yet

4:30 tomoj: really I just imagine there are sysadmins who would get angry if they ever had to `lein upgrade`

4:31 I don't sympathize

4:31 clgv: probably. but then you'd need some ppa-package for ubuntu to get the latest leiningen ^^

4:31 tomoj: huh. https://launchpad.net/~technomancy/+archive/leiningen

4:32 clgv: hmm nothing in there yet

4:33 antares_: there is someone who helps us get Lein2 into next Ubuntu and Fedora releases

4:34 tomoj: quantal?

4:41 antares_: yes

4:57 frawr: Hello

4:58 Can anyone tell me what the idiomatic way to make ajax calls is in clojurescript?

5:07 tomoj: frawr: the only idiomatic thing I know of is to use closure

5:07 well, among some it is idiomatic to use jayq

5:10 frawr: I found some other examples using clojure. going to try these now. thanks.

5:11 And I thought using jQuery was discouraged. not jayq?

5:11 lpetit: clgv: hello

5:11 tomoj: I'm not sure it's discouraged

5:11 clgv: frawr: noir has some remote features.

5:11 tomoj: discouraged by whom?

5:11 clgv: lpetit: hello

5:11 tomoj: jayq just wraps jquery

5:11 lpetit: clgv: are you using Eclipse Juno ?

5:12 tomoj: I guess it might look like jquery was discouraged because of the discussion about it

5:13 but I _think_ that was mostly people getting angry because "closure", and the cljs team defending that choice

5:13 clgv: lpetit: no, not for production yet. I experimented with it at home. the REPL-issue happens with 3.7

5:14 tomoj: closure can't optimize jquery, but if you agree that using a cdn means jquery is free, no problem

5:15 clgv: tomoj: there was a statement by chris granger in his jayq lib

5:15 lpetit: clgv: ok, because I'm adding some trace statements using the Eclipse tracing facilities. Prior to Juno, activating the traces from the user side requires to start Eclipse with a -debug flag as well as specifying the location of a file containing debug options. Starting with Juno, it is possible to dynamically change the trace options from the Preferences.

5:15 tomoj: yeah

5:15 pretty convincing

5:16 my coworker thinks "if we don't use jquery we'll have to spend months rewriting it and its ecosystem"

5:16 I dunno if I agree but jayq makes him easier to convince

5:18 frawr: for this project i don't really care about optimization.

5:19 tomoj: just make sure you keep jquery's wrongness wrapped up tight :)

5:19 frawr: in a seperate ns?

5:20 tomoj: I mean, try not to let the nonfunctional parts of it infect everything

5:20 dunno how much jayq already helps with that

5:22 frawr: Aah, i see. Well I just need to make a simple ajax call and that's all. Could even do it the vanilla way but I wanted to learn the right way

5:22 tomoj: hmm

5:23 I don't think there is a very good way to deal with anything asynchronous in cljs yet anyway

5:23 you lose dynamic bindings for example (hopefully that doesn't matter for you..)

5:24 frawr: nope =)

5:26 clgv: tomoj: but you'd loose those bindings in clojure as well

5:27 tomoj: but clojure has bound-fn

5:27 frawr: hmm, how do they influence one another?

5:27 clgv: ah right. that on captures those explicitely?

5:27 tomoj: yeah

5:30 frawr: btw, does anyone know where to look for a clojure internship?

5:30 tomoj: where are you located?

5:30 frawr: The Netherlands, but I'd prefer an overseas internship

5:31 tomoj: does that mean you want to go somewhere or telecommute?

5:31 frawr: go somewhere

5:31 tomoj: mind if I PM you?

5:31 frawr: Go ahead

6:35 tomoj: I just realized you can type ";; foo" on the first line of a slime repl entry

6:35 then use that as a bookmark in history

6:44 Kototama: hi, if I have the string of a JS method, how can I invoke it on the object in ClojureScript ?

6:44 something like (.method obj) but where method is a variable

6:45 Bahman: Kototama: Convert it to symbol and then call it.

6:58 qRR7: Bahman, how does one do that?

6:58 * josteink notes that ec2 micro-instances may not be the best thing since sliced bread for clojure development

6:59 * josteink tries to get emacs24 onto a freebsd xeon machine he has access to

7:11 hyPiRion: josteink: Why not fire up tramp?

7:11 astrax: qrr7. I'm pretty much a newbie so might be way off but try ((str "." variable) obj)

7:12 qRR7: astrax, you mean ##((symbol ".method") obj)

7:12 lazybot: java.lang.RuntimeException: Unable to resolve symbol: obj in this context

7:12 qRR7: Well, let's give ##((symbol "+") 1 2 3)

7:12 lazybot: clojure.lang.ArityException: Wrong number of args (3) passed to: Symbol

7:13 hyPiRion: heh

7:13 symbol != function

7:13 qRR7: Indeed

7:13 I'm pretty sure if that was possible the entire scoping model of the langauge would be pretty fucked

7:14 clgv: &((resolve (symbol "+")) 1 2 3)

7:14 lazybot: java.lang.SecurityException: You tripped the alarm! resolve is bad!

7:14 hyPiRion: you'd have to run eval to get that working. Though

7:14 qRR7: eval is about as evil as republicans, don't use, don't vote, and don't let your daughter marry it.

7:14 clgv: well, lazybot doesnt like it but it works

7:15 qRR7: clgv, so like, resolve is a spcial form or a function

7:15 clgv: function.

7:15 hyPiRion: a function which maps symbols into functions

7:15 clgv: it resolves the symbol to a variable using the current scope

7:15 qRR7: As in, wha does (let [+ *] (resolve (symbol "+"))) evaluate to?

7:16 to addition or to multiplication?

7:16 clgv: (let [+ *] (resolve (symbol "+"))) => clojure.core/+ and (let [+ '*] (resolve +)) = clojure.core/*

7:17 qRR7: So it doesn't resolve to the current scope and rather it's a pure function?

7:17 Then there's honetly not a lot wrong with it.

7:17 It just maps symbols to functions, random pure function

7:17 clgv: it depends on the state of the namespace so it is not pure

7:18 if you excluded clojure.core/+ and used my.lib then it would resolve to my.lib/+ provided you define + there

7:20 qRR7: Hmm, well, you can define your own my-resolve with identical behaviour if you watn right?

7:54 clgv: qRR7: you want to redefine resolve? why?

8:02 bpr: is there a way to get nrepl to re-load the data_readers.clj file?

8:03 i'd rather not have to ensure i've got *data-readers* bound properly

8:05 tomoj: well there are some private functions in clojure.core that can work

8:09 bpr: yeah, i'm checking on that now

8:09 thanks

8:12 tomoj: seems problematic

8:13 I don't think you can do it straightforwardly in the repl

8:13 at least with swank, the second load-data-readers call does work, but you don't see the root value

8:13 so you still get the old readers

8:15 nrepl clone would probably preserve the old readers too?

8:15 maybe there's a way to start a new session that would work?

8:16 bpr: yeah, it might come down to that

8:18 Kototama: Bahman: (let [x (symbol "introduction")] (.x js/ich)) does not work

8:23 josteink: the bad thing about running lein on a core i7 or a xeon

8:23 is that you really have no idea how heavy it is ;)

8:29 clgv: Kototama: it wouldnt work in clojure as well like said before. you have to resolve the symbol

8:47 Kototama: clgv: but how do you invoke it with interop??

8:47 lazybot: Kototama: Definitely not.

8:47 Kototama: (.resolved-sym obj) ??

8:47 lazybot: Kototama: What are you, crazy? Of course not!

8:49 clgv: Kototama: not with the short cut interop but with the longer version: (. obj (resolved-sym))

8:52 Kototama: humm I get an error in clojurescript with (let [+ *] (resolve (symbol "+")))

8:52 whereas it works in clojure

8:52 ro_st: resolve isn't in cljs

8:52 none of the ns stuff is

8:54 Kototama: ok but then, sorry to ask again, but is there a way to invoke a JS method if I have its name as a string?

8:54 ro_st: anyone hosting datomic on heroku?

8:55 Kototama: i fought this battle and lost. i ended up manually populating an atom with string -> fn mappings

8:57 Kototama: hum ok maybe i'll just create a JS function that does that and invoke it from clojurescript but it's disapointing

9:05 ro_st: it's because the (ns) form in cljs is completely different to clj

9:05 it's just a wrapper on top of google closure's provide/require

9:06 Kototama: but it makes something common in JS impossible to do in ClojureScript, that's not good

9:07 ro_st: it's a moot point anyway because advanced compilation completely renames everything anyway

9:07 `fogus: ro_st: I don't think Heroku is officially targeted (yet)

9:07 ro_st: `fogus: right now the plan is two reserved micro ec2 instances (a HA pair) for the datomic transactor and then two hk web dynos with peers

9:07 tomoj: Kototama: ((aget js/console "log") "hello")

9:08 `fogus: ro_st, Kototama: Can externs not help you in this case?

9:09 ro_st: `fogus: no. he wants to store eg "my.app.name.space/fn" somewhere and then later find that fn in memory using that string. good old obj[ var ] won't work because adv compilation will munge those pretty names away

9:09 tomoj: not if you export :/

9:10 `fogus: Doh! I said the wrong thing. I meant export

9:10 Kototama: tomoj: this result in an illegal invokation

9:10 `fogus: (defn ^:export foo []...)

9:10 tomoj: oh right

9:10 `fogus: !!

9:10 Dang.

9:10 tomoj: (.call (aget js/console "log") js/console "hello") ?

9:11 ro_st: true. in my case, i don't like having internal fns exposed.

9:11 Kototama: actually i'm using the icanhaz library and templates are dynamically binded to to the ich object when loaded, so invokations take the form ich.templatename(arguments)

9:11 tomoj: (but if it's a cljs fun, don't need to do that)

9:14 Kototama: your last code works

9:14 thank you very much

9:28 Cheiron: Hi, I have an atom (a {:a [] :b [] :c []}) how to add an item to a collection under a key (for example :a) ?

9:29 clgv: Cheiron: (swap! a update-in [:a] conj item)

9:31 Cheiron: clgv: Thanks!

9:34 rhickey: results from Friday's cond-> name game are here: https://gist.github.com/3885504 - feedback welcome

9:38 `fogus: Oh man! I love #clojure name games. Sorry I missed it

9:48 TimMc: rhickey: It would be really nice to see an example with each of those.

9:49 OK, so when-> is a short-circuiting test-> ?

9:50 rhickey: TimMc: no, test has test expressions and when is conditional on the threaded value itself

9:50 TimMc: And let-> is like a -> with explicit stitching location?

9:50 rhickey: test-> when->

9:50 TimMc: Oh, I see it now.

9:51 rhickey: yes, let-> just binds and you have to thread using the bound name yourself

9:51 clgv: rhickey: nice. I currently need something like that to conditionally add to a sequence

9:52 that's similar to when-> but would need a predicate on the element to add

9:55 TimMc: let->'s naming is a little curious, since it can be used as -> or ->> or a "mix" of the two. I guess there's not much to do about that.

9:56 clgv: TimMc: mabye let=> ? ;)

9:57 oh I misread test-> - that seems what I want right now ;)

9:57 pjstadig: i've got clojure emitting invokedynamic callsites for instance method reflection

9:59 clgv: rhickey: so when-> and when->> are the new names for -?> and -?>>

9:59 rhickey: clgv: sort of, they use ordinary when logic, not nil? test

9:59 but ? was dubious in those names as implies boolean

10:00 clgv: ok :)

10:06 djanatyn: :)))

10:06 ebaxt: Hi! Anyone know if the template support (https://github.com/brentonashworth/one/wiki/Design-and-templating) in ClojureScript One is available in a standalone lib?

10:07 djanatyn: the teacher of my java class just told us that instead of submitting java source code, we can just send her a class file

10:07 dnolen: cemerick: do you have a :scope example? - core.logic users won't all get datomic since project.clj isn't really used by anyone but core.logic devs ... yet.

10:07 `fogus: ebaxt: No

10:07 djanatyn: so, if she's got some sort of testing code that runs the main method of a class, what do I need to do for her to be able to run my code?

10:07 Gosh: How do you do for(coll){if(cond) break} ? My current solution is (not (nil? (seq (filter #(< % 0) '(1 2 3 4 -1)))))

10:07 ebaxt: `fogus: OK, thanks

10:07 djanatyn: do I just put (:gen-class) in the namespace declaration, and create a function named "main"?

10:08 cemerick: dnolen: oh, I forgot it was a contrib -> mvn :-)

10:08 djanatyn: or do I need to bundle clojure with everything?

10:08 cemerick: dnolen: just [com.datomic/datomic-free "0.8.3551" :provided "true"] should do it

10:08 wait, sorry

10:08 dnolen: [com.datomic/datomic-free "0.8.3551" :scope "provided"]

10:09 copy/paste error

10:09 dnolen: cemerick: thx

10:11 clgv: djanatyn: (:gen-class) and (defn -main ...)

10:11 Gosh: you want the shortened seq as result?

10:11 pjstadig: still very much a work in progress https://github.com/pjstadig/clojure/commit/8e42c823d3703c8fd4265a1d54caf9f5a68e7ec1

10:12 2x faster than plain reflection, an order of magnitude slower than type hinting

10:12 i think there's still some performance to be eeked out, though

10:12 djanatyn: clgv: where will that class file generate?

10:12 can I just send her a class file, or do I need to send a jarfile after I do lein's uberjar

10:13 clgv: well if you develop in clojure and AOT you better send a jar since you will get a lot of classes

10:13 djanatyn: heh, okay

10:15 clgv: djanatyn: but ask yourself what will she do if your sent in application does not work? with no sourcecode it's either 100% points or 0 points ;)

10:15 pjstadig: there's a whole calculus of MethodHandles that i known next to nothing about (but I'm learning)

10:20 `fogus: pjstadig: Thanks for helping to make Clojure relevant again! https://twitter.com/headius/status/251336909333348353

10:25 pjstadig: hehe

10:25 clgv: `fogus: haha :D

10:31 zerokarmaleft: Gosh: perhaps you want take-while?

10:32 clgv: $karma zerokarmaleft

10:32 lazybot: zerokarmaleft has karma 1.

10:32 zerokarmaleft: clgv: now i have to change my registered nick

10:33 clgv: well, I just wanted to check ;)

10:34 zerokarmaleft: curious how I even got a single point, since I rarely pipe up in here

10:44 TimMc: `fogus: Is Clojure a "new JVM language"? :-)

10:45 pjstadig: https://twitter.com/headius/status/251474597633998849

10:46 `fogus: I don't know. But I've talked to Charlie about this topic and I think he'd have no qualms making an exception for Clojure in that case. :-o

10:49 uvtc: Strings seem to act like they're sequential, ex. `(doseq [i "hello"] (println i))`. But then why does ##(sequential? "hello") return false?

10:49 lazybot: ⇒ false

10:49 S11001001: uvtc: try seqable? from core.incubator

10:51 uvtc: Mm. https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L77

10:52 TimMc: uvtc: They're not sequential?, but they're seq'able.

10:52 clgv: &(seq "hello")

10:52 lazybot: ⇒ (\h \e \l \l \o)

10:52 uvtc: So there's ISeq, Sequence, and now I see there's a Sequable.

10:52 clgv: &(type (seq "hello"))

10:52 TimMc: You can do ##(first "hello") because it calls 'seq on the arg

10:52 lazybot: ⇒ \h

10:52 ⇒ clojure.lang.StringSeq

10:53 TimMc: seq special-cases strings.

10:53 uvtc: Right --- I'm familiar with each type having its own seq type.

10:53 TimMc: Oh, interesting.

10:53 TimMc: You can't use an interface test because Java doesn't allow post-hoc interface implementation.

10:54 goracio: hi is there alternative to curl in clojure ? i found slurp but if i want to get image then how to convert string to file ?

10:54 TimMc: uvtc: Same deal with arrays.

10:55 uvtc: TimMc: I see. Haven't had to touch arrays from Clojure yet.

10:55 TimMc: goracio: You mean, get the image data?

10:55 uvtc: Thanks all.

10:55 goracio: yep when i use slurp i get string of bytes i guess

10:56 TimMc: yep when i use slurp i get string of bytes i guess

10:57 TimMc: You'll have to find a lib that can parse image formats.

10:57 Java standard library might provide that...

10:57 goracio: hmm maybe there is alternative to slurp ?

10:58 something like curl

10:59 TimMc: goracio: Are you just trying to write it all to file on disk?

10:59 uvtc: goracio: https://clojars.org/clj-http ?

10:59 goracio: yes - what i need to get file and write it to local directory

11:00 already looked at that

11:00 it gets all the session

11:00 TimMc: I could come up with a solution, but I suspect others already know a better answer.

11:01 rhickey: pjstadig: that's cool - too bad it took them until Java 7 to get it in and probably 8+ to make it fast.

11:01 pjstadig: rhickey: yeah

11:01 i ran it on a java8 build

11:02 no dramatic performance improvement yet

11:02 rhickey: right

11:02 pjstadig: i wonder if i could be setting up the MethodHandles differently though to get better performance

11:02 looking around at the JSR292 cookbook and such

11:03 rhickey: pjstadig: one problem you'll have is that the underpinnings of that stuff is all going to change, and with it the perf profile

11:03 pjstadig: rhickey: not sure what you mean by "underpinnings"? you mean on the JVM site?

11:03 side*

11:04 rhickey: yes, John Rose presented a whole new plan for that at JVM language summit

11:04 pjstadig: i see

11:04 rhickey: essentially when the optimizer doesn't, it falls to an interpreter

11:05 so he's making the intepreter something the JVM can optimize, vs now which is a lot of native code

11:06 The whole thing is full of promise, but I disagree with Charlie that this is something people should be using now for langs they intend for people to use now on JVMs they are using now.

11:06 pjstadig: rhickey: the "Lambda Forms" talk from 2012?

11:06 rhickey: pjstadig: I think so

11:06 goracio: TimMc: https://github.com/gorsuch/clojure-curl-spike/blob/master/src/clojure_curl_spike/core.clj

11:07 pjstadig: rhickey: sure agreed, but sun keeps trying to deprecate java6...eventually the "JVM they are using now" will support invokedynamic :)

11:07 goracio: TimMc: :use [clojure.java.shell :only (sh)] and then (apply sh (curl-command url)) maybe that will work :)

11:07 rhickey: yes, but 7 doesn't well at this point, then we wait for 8 and oracle to pressure them into that

11:08 clgv: pjstadig: not used to oracle owning java now? ;)

11:08 pjstadig: haha

11:08 oops

11:08 TimMc: goracio: I'm sure you could do something less hacky with inputstreams and outputstreams.

11:08 pjstadig: yeah i meant oracle

11:09 rhickey: the most interesting applications of invokedynamic for Clojure are not reflection sites, but dynamism in vars and protocol dispatch

11:09 and keyword dispatch

11:10 pjstadig: rhickey: yeah reflection seems like an easy first target, but type hinting is probably always going to be faster

11:10 rhickey: pjstadig: exactly

11:10 pjstadig: though it would be nice to have a faster default than reflection

11:10 maybe i'll experiment with vars or protocol fns next

11:11 i was thinking of trying to tackle multimethods, but you think it would be better to start with vars and/or protocol fns?

11:11 chronno: goracio: http://stackoverflow.com/questions/11321264/saving-an-image-form-clj-http-request-to-file

11:12 rhickey: pjstadig: multimethods are likely to remain dominated by the fact that you must call the dispatch function

11:12 since you don't know what aspect of the args matter to it, and thus can't setup a guard

11:13 vs say known binary dispatch on class

11:13 TimMc: Can you do something with the knowledge that a lot of multimethods dispatch on :type? :-)

11:14 rhickey: TimMc: possibly, but :type is broader than class

11:15 goracio: chronno: thanks will look at that

11:40 antoineB: hello is it possible to access a var given a string? (in clojurescript)

11:42 i can use (js* "the.complete.name"), but i don't know how to get the current namespace

11:44 Chousuke: doesn't clojurescript have 'resolve?

11:44 clgv: seems not. that was discussed earlier today

11:50 rhickey: now with examples: https://gist.github.com/3885504

11:50 anyone opposed to/confused by names etc?

11:57 clgv: rhickey: oh, test-> can't refer to the expr threaded through in its tests?

11:58 rhickey: clgv: no

11:59 I had a version that could, not sure how often it would get used

12:00 clgv: rhicky: a version that can should probably have predicate like (fn [threaded, form-result] ...) to be general

12:01 mpenet: rhickey: test-> sounds like something that would be part of a testing library, it could be confusing.

12:02 lpetit: rhickey: let-> does not have the same symmetry as the others. Would let->> mean something?

12:04 clgv: I'd change the 'name in let-> to first position as it would be in (let [x 10] ..)

12:05 duck11231: does let-> support destructuring?

12:05 lpetit: duck11231: seems so, but you'd need the restructuring to work for each step

12:06 duck11231: right, that's still better than nothing

12:06 yazirian: i agree with clgv, let-> has its args backwards

12:06 lpetit: duck11231: hmm, no

12:07 Sgeo: Oh hey, the ordering of let-> does mean that it could be used within -> as far as I can tell

12:07 lpetit: duck11231: name must be a symbol, it's the returned value in the body of the macro-expanded let

12:08 I see little value in let->, anyway

12:09 * Sgeo loves it, it's like a -> that allows using arbitrary arguments that doesn't require everything to be a function

12:10 rhickey: Sgeo: yes, that's a big objective of let->

12:11 Sgeo: rhickey, is being comfortably usable from within -> also an objective, because it seems to do that too

12:11 rhickey: lpetit: let-> solves the problem of all threaded forms not first or last

12:11 lpetit: rhickey: I see it now

12:12 rhickey: gets rid of libs like this: https://github.com/pallet/thread-expr/blob/develop/src/pallet/thread_expr.clj#L40

12:12 erm, https://github.com/pallet/thread-expr/blob/develop/src/pallet/thread_expr.clj

12:13 Sgeo: Hmm, what's letfn?

12:13 duck11231: so, when-> is meant to replace -?>

12:13 rhickey: duck11231: well, -?> is not in core, but covers same ground yes

12:14 the ? stuff is a mismatch with anypred?

12:14 all of which are boolean

12:14 Sgeo: How about a monad->

12:14 Replace Enlive's do-> (I think)

12:16 rhickey: Sgeo: link?

12:16 antares_: Clojure docs project progress report, week 1: http://blog.clojurewerkz.org/blog/2012/10/15/clojure-documentation-project-progress-report-the-week-of-october-14th/

12:16 Sgeo: Erm, I don't know of anyone who's defined a monad->, but do-> is defined https://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj#L653

12:17 I _think_ that do-> expresses the Reader monad, but I'm not sure, I haven't looked at it closely enough

12:18 lpetit: clojure.core.incubator/-?> stops threading when threaded value becomes nil, not falsy. Beware semantic regressions when time comes to migrate

12:18 zerokarmaleft: rhickey: nitpick, it seems inconsistent to have the binding order in let-> as expr name instead of name expr

12:18 rhickey: zerokarmaleft: that's to facilitate its use within ->, and the reason it doesn't take a vector of pairs

12:19 lpetit: understood, but who threads booleans?

12:20 zerokarmaleft: ah, i see

12:22 sorry, should've read scrollback

12:24 lpetit: rhickey: -?> was initially introduced to help threading interop calls, who know what does guys do with it ;)

12:24 s/does/those/

12:25 rhickey: lpetit: they don't have to switch. wehn-> does what it says on the tin

12:25 when->

12:25 duck11231: I can see a potential use with threading boolean values. Less of a use for nil-sfe threading of those values

12:27 rhickey: lpetit: but we don't yet have an alternative universe of not-nil boolean logic. I've thought about is? == not nil?, and things like is->, brings up when-is, if-is etc

12:27 lpetit: sure, I just wanted to highlight the corner case, 'cause of course once it's out the door, there will first be a word spread on when-> supersedes -?>, and then later "work for bloggers" explaining the pitfalls of looking not closely enough at what one does with respect to the other :) (and in the end, I'll be all for deprecating -?>)

12:29 rhickey: lpetit: an alternative is that wehn-> would be nil?-based, but will that cause it's own confusion?

12:29 its

12:30 duck11231: considering that difference. I can see the need for both of them. It's like how keep doesn't replace (comp filter identity)

12:30 lpetit: rhickey: yes, probably, since when works for falsy values.

12:31 rhickey: my guess is, given when->, no one will ever need the other

12:31 jlongster: dnolen: is :import supported in `ns` in ClojureScript?

12:31 lpetit: rhickey: the ? in -?> had not this confusion, since it was intended to be a reminder of what is found in object oriented languages such as groovy with foo?.bar?. etc.

12:31 dnolen: jlongster: it is

12:32 lpetit: rhickey: I bet on it also

12:32 lispnik: hello. could someone enable me on clojure-dev and the dev.clojure.org jira? my CA was received a few weeks ago

12:32 jlongster: dnolen: ok, the "differences" wiki page doesn't mention and differences but I'm getting the error "Only lib.Ctor specs supported in :import" for a simple line: (:import [ctco.expr.simple Simple])

12:33 I can continue to hack on it if the error isn't immediately obvious

12:33 dnolen: jlongster: did you try [ctco.expr.simple.Simple] ?

12:34 gfredericks: so I guess test-> won the cond-> battle?

12:34 rhickey: gfredericks: that's what's being discussed, yes

12:34 jlongster: dnolen: I did not, still not very familiar with all of the different forms for namespaces

12:34 same error

12:35 gfredericks: these macros look quite useful

12:35 dnolen: jlongster: heh, it takes some time to figure out - tho really that's unnecessary if you want to use Simple in ClojureScript.

12:36 jlongster: we added :import mostly for making GClosure ctors more pleasant to work w/.

12:37 jlongster: dnolen: ok, I'll keep playing around with it. What do you mean that it's unnecessary though? Simple is a local, user-defined record in a difference file

12:37 *different

12:38 dnolen: jlongster: :import is about foreign ctors (read ... not Clojure)

12:38 jlongster: ah, ok

12:38 dnolen: jlongster: so just :require foo and you can write foo/Simple in your file.

12:40 jlongster: yeah, it seemed that :import was used so that you could just write (Simple. foo) instead of (foo/Simple. foo)

12:40 https://github.com/cjfrisz/clojure-tco/blob/master/src/ctco/util.clj#L29

12:40 anyway, I'm learning by assumptions here so I'll go read the real docs.

12:41 dnolen: jlongster: you can :use foo and Simple will work.

12:41 jlongster: if it doesn't that's a bug.

12:41 jlongster: ok, I'll try that

12:41 dnolen: jlongster: :use :only to be precise

12:41 jlongster: how come Chris uses :import there?

12:42 dnolen: jlongster: because Clojure JVM types/records are backed by Java classes.

12:42 jlongster: aah, ok. thanks!

12:42 dnolen: jlongster: doing that is a bit of antipattern - better for Chris to provide fns and not import types/records like that.

12:43 jlongster: ok

12:44 hugod: rhickey: pallet-thread will continue to exist. As far as I can tell the new macros don't cover the same use case.

12:46 rhickey: hugod: I don't see it - most of those are covered (better) by let->

12:46 that lib special cases a bunch of constructs for use in ->

12:46 let-> supports all constructs

12:47 hugod: It's fine if it still exists of course :)

12:51 jcrossley3: weavejester: quick sanity check, please: the :context key in the ring request should return an empty string "" for an app mounted at the root context, right?

12:51 weavejester: jcrossley3: I believe it's nil

12:52 jcrossley3: But nil and "" should be treated the same in this case, since a blank path prefix is the same as no path prefix.

12:53 jcrossley3: weavejester: so consider redirecting to a context-relative path: (redirect (str (:context request) "/some/path"))

12:53 that should work for "" or nil

12:53 weavejester: jcrossley3: Right

12:53 jcrossley3: weavejester: is there some helper somewhere that does that or is that just a known convention?

12:54 weavejester: jcrossley3: Hiccup has a *base-url* binding, but there isn't any helper because :context is currently just a Compojure convention.

12:54 * Sgeo thinks that swiss-arrows <<- is awesome, even if the rest of swiss-arrows (particularly -<>) is problematic

12:55 weavejester: jcrossley3: However, I'm planning on adding it to Ring for version 1.2 since it's worked well as a de-facto standard.

12:55 jcrossley3: weavejester: good :)

12:55 weavejester: jcrossley3: I'm toying with the idea of setting a *context* binding, but I'm not certain yet.

12:57 dnolen: rhickey: in the codeq podcast you mentioned there were some features in the CLJS analyzer that that you would like to see worked into codeq, anything specific?

12:57 jcrossley3: weavejester: how would that be more convenient than just having :context as a standard request key?

12:57 amalloy: i have to say i like let-> now that i've thought about it a bit. it's not that useful on its own (right?), but it's a great way to introduce some steps into a -> pipeline using some construct that doesn't ordinarily fit into the ->, like a for-comprehension: (-> x (blah) (let-> ys (for [y ys] (foo y))))

12:58 which i think is what hugod's stuff in pallet-thread is for?

12:59 Sgeo: It could be useful on its own I think, if the place to thread through varies a lot

12:59 I could be wrong

13:01 rhickey: amalloy: right

13:01 weavejester: jcrossley3: You wouldn't need to pass the request map or context explicitly when creating a resource with URIs

13:01 rhickey: dnolen: I think we need to factor analysis a bit more, breaking out the js-isms

13:01 amalloy: Sgeo: certainly possible. i don't think that's nearly as common, especially because let-> means the name would have to stay the same: how often will it make sense to call something "xs" three or four times, and thread it through at a different spot?

13:02 weavejester: jcrossley3: If you think about all the links on a HTML page and how often you'd need to pass the context to them

13:02 rhickey: dnolen: in particular for codeq, we want an interpreter for ns forms that works completely i nthe analysis/environment space, not by affecting namespaces

13:02 weavejester: jcrossley3: Also, just to clarify, the :context and :path-info keys wouldn't be part of the base Ring SPEC, but would be added by Ring middleware.

13:03 jcrossley3: Like :params is added by wrap-params, but isn't in the Ring SPEC

13:03 TimMc: amalloy: That's an argument for keeping the initial-value arg in the first position in let->

13:03 rhickey: then we could e.g. figure out the aliases created by ns, and attempt to resolve names in usages cases via a walk

13:03 TimMc: (Earlier someone was proposing having the binding name go first, which makes a different sort of sense.)

13:03 amalloy: TimMc: of course; that's where rich put it. is there some movement to change it? i don't think that's a good idea

13:03 rhickey: the ultimate target is to add uses to definitions

13:03 usages

13:04 this fn calls these others

13:04 jcrossley3: weavejester: that's cool. i guess i'm just equating the :request key to the servlet spec's getContextPath, which is kind of a punt, forcing the dev to dictate when it's used.

13:04 rhickey: macroexpansion aside

13:04 pooya72: So I feel like I walked into a room full of clojure celebrities ;) rhickey, dnolen, weavejester... me >:)

13:04 hugod: rhickey: the pallet-thread macros thread through the body of each of the forms - I'll have to try using the new macros, but I don't see how let-> replaces them (yet)

13:04 technomancy: I wonder if you could define a print-method for namespaces

13:04 rhickey: hugod: let-> binds the name, it's use in the forms is transparent and requires no work

13:05 its, darn fingers

13:05 dnolen: rhickey: gotcha

13:06 Sgeo: How is let-> significantl better than pallet-thread's arg-> ?

13:06 rhickey: arg-> requires a []

13:07 thus not composable

13:08 or, I guess it is , just ugly

13:08 very surprising to me that given its presence, the rest of the lib exists

13:09 that lib gives me a headache

13:11 Sgeo: I think the idea is that in the body of the other macros, the -> form still acts like it's in effect

13:11 rhickey: Sgeo: It's too complicated for me

13:12 Sgeo: I think binding-> is the easiest to understand

13:12 Example-wise

13:12 rhickey: pallet-thread aside, looking for final feedback before I push this into core

13:13 for latecomers, this being: https://gist.github.com/3885504

13:17 amalloy: rhickey: the docstring for test-> could maybe use something clarifying that the tests are not threaded into

13:21 `fogus: rhickey: I apologize for arriving late to the party and potentially repeating someone else, but I'd love to see an example use in each docstring.

13:21 rhickey: amalloy: what would you guess otherwise? thread-firsting into predicates?

13:21 amalloy: rhickey: that's something i might guess, yes

13:22 gfredericks: I remember TimMc having that sort of impression initially the other day

13:25 rhickey: `fogus: we don't do that elsewhere. Perhaps one day we'll have an :example entry per fn

13:25 `fogus: rhickey: Fair enough. I only ask because the examples are much easier for me to understand than the words. :-(

13:26 rhickey: there are examples at the bottom of the gist

13:26 `fogus: Yep, those are the examples that I mean

13:26 rhickey: else wait, codeq will show you examples in the wild soon enough :)

13:28 hyPiRion: Documentation is the semantics of a function or macro, examples explain the documentation.

13:28 `fogus: rhickey: Speaking of, it seems that every time the Datomic team releases something you solve some massive issue that I was encountering the week before. Thanks for that.

13:29 rhickey: `fogus: that's good!

13:29 `fogus: You're helping me to fool my co-workers into thinking I'm some kind of genius! ;-)

13:29 rhickey: amalloy: is this enough? (refresh) https://gist.github.com/3885504

13:30 amalloy: looks good to me

13:31 `fogus: RIP Phil Bagwell. http://blog.typesafe.com/rip-phil-bagwell

13:31 Sad

13:32 pjstadig: wut?

13:32 that *is* sad

13:32 uvtc: I just read about luriel on HN. Too many of these lately. :(

13:33 pjstadig: i had a good time talking to phil at the conj

13:34 `fogus: Same here

13:35 yazirian: same here, had lunch with him, he was cool

13:39 Raynes: R.I.P. He gave me good advice and excellent conversation

13:40 rhickey: We all owe Phil

13:40 pjstadig: is there information about a cause of death?

13:52 olabini: Raynes: yeah, me too.

14:08 iwillig: is there an easy way to go from a structs.Map to a clojure map ? js->clj seems to return the stucts.Map

14:25 XPherior: Does anyone have a few minutes to help me review a read-me I wrote for a project? I want to make sure it makes sense.

14:25 nDuff: XPherior: You'd have a better chance of volunteers if you posted a link -- easier to decide whether to do an in-depth review of something when one can skim it first.

14:26 XPherior: Okay, nDuff. https://github.com/MichaelDrogalis/zombie

14:28 nDuff: ...so, some small quibbles: - assuming that everyone uses lein (it's sad, but not everybody can; see: projects w/ Maven dependencies, shops standardized on other build tools, &c); - assuming familiarity w/ QuickCheck (a line or two describing _how_ it's similar might be helpful).

14:28 ...the actual library usage and examples seem clear.

14:29 XPherior: I did kind of gloss over those things, yeah.

14:29 oskarth: when I pull down a new dep with lein deps, my nrepl says it can't locate class on classpath, but when I restart nrepl process it works. How do I tell nrepl to update without me restarting it manually?

14:29 XPherior: That's good to hear that. It's kind of a different concept. Wanted to make sure the examples conveyed what the library is about.

14:30 oskarth: I don't think you can. You need to restart the JVM, IIRC.

14:30 hiredman: oskarth: you cannot, unless you add a dependency on pomegranate

14:30 oskarth: I see. And what's the easiest way to do that from emacs?

14:31 feels like I'm doing something wrong everytime I force quit it

14:31 XPherior: I think you just jack-in again? Maybe?

14:32 oskarth: hm, that bugs if I have the same buffer name, but it works if I rename my current one

14:32 works well enough though. Thanks :)

14:34 hiredman: nrepl.el is not as pleasant to work with as slime+swank-clojure for all technomancy has deprecated swank-clojure

14:34 XPherior: Sure thing, oskarth

14:34 hiredman: it is very rough

14:37 djanatyn: how can I get a keyword to evaluate to, uhh, a value that is bound?

14:37 (let [foo 10] (frobify :foo)) ;=> 10

14:37 TimMc: Keywords aren't used to refer to values.

14:37 amalloy: djanatyn: don't do it, man

14:37 djanatyn: haha, I was thinking I might be doing it wrong

14:38 Sgeo: That foo doesn't really exist, I think

14:38 TimMc: There may technically be a way, but I might technically have to throw things at you.

14:38 XPherior: This is not the foo you were looking for.

14:38 arrdem: ah the joyous cries of "you're doing it wrong"...

14:38 ghadishayban: rhickey: any advice for taking a first whack at CLJ-1082, reducing over subvecs of primitive vectors?

14:38 Sgeo: I think all instances of it in the let (including in the expansion of macros) could be replaced with bar with no effect

14:38 TimMc: djanatyn: What are you trying to work around?

14:39 amalloy: *shrug* it's totally possible, if you only want it to work for literal keywords; but in that case it's not very useful

14:39 Sgeo: I guess you could make a macro to scan for let and make those available in a dynamic var

14:39 amalloy: Sgeo: madness

14:39 djanatyn: TimMc: I'm trying to build a tiny object oriented system in clojure to have fun with macros

14:39 amalloy: (defmacro frobify [k] (symbol k))

14:40 XPherior: Eeek, objects. Run.

14:40 arrdem: XPherior: ppft. they're not so scary.. just overgrown k->v maps

14:40 XPherior: Objects put me in fostercare.

14:41 djanatyn: I think I'm going to give up on this for now anyway

14:41 closures are fun

14:41 Sgeo: Why am I now reading Scala documentation?

14:41 TimMc: XPherior: :foo is an object. :-)

14:41 XPherior: I choose to ignore hat, TimMc :)

14:41 That*

14:41 Sgeo: Scala has macros these days, doesn't it?

14:53 ebaxt: How can I "refresh" the class path so that nrepl sees newly added dependencies?

14:54 TimMc: I'm starting to think that sould be added to the top of the README, if it isn't already...

15:04 ebaxt: Restarting nrepl, or using pomegranate.

15:05 ebaxt: TimMc: Thx :)

15:07 Raynes: <shamelessplug> http://blog.raynes.me/blog/2012/10/12/help-fund-my-trip-to-the-conj/ </shamelessplug>

15:19 Sgeo: Uh

15:19 Apparently I am utterly confused about &env

15:21 djanatyn, hi

15:21 I might actually be able to write frobify

15:24 mindbender1: djanatyn: http://www.infoq.com/presentations/Mixin-based-Inheritance on the difference between a programming language and a programming system

15:24 TimMc: Sgeo: It would be pointless, since the keyword would have to be specified as a literal.

15:24 You couldn't do (let [foo 5 x :foo] (frobify x))

15:24 amalloy: Sgeo: i already showed how to do it the pointless way TimMc is talking about, and a non-pointless way is not possible

15:24 or, i guess maybe that's not true

15:24 Sgeo: TimMc, by making a macro that does stuff with &env, I should be able to get both keys and values in a data structure

15:25 amalloy: Sgeo: the values won't be useful to you, because they're compile-time values

15:25 but you could expand to (case kw :foo foo, :bar bar), for all locals known to be in scope

15:25 TimMc: Haha, nice.

15:25 Sgeo: amalloy, I accidentally expanded to the values in my experimentation

15:26 Dangit I just closed my command prompt

15:26 amalloy: (defmacro frobify [k] `(case ~k ~@(for [sym (keys &env), clause [(keyword sym) sym]] clause)))?

15:27 yes, that works

15:28 Sgeo: Should be able to return a map with some fooling around, I think

15:28 (Expand to a map)

15:28 amalloy: Sgeo: http://stackoverflow.com/questions/12502933/expression-that-returns-all-currently-scoped-symbols-in-clojure/12504032#12504032

15:29 Sgeo: Ahh, I was going to work it out myself

15:29 *Aww

15:30 amalloy: feel free to not read the implementation, mate

15:30 Sgeo: Too late.

15:30 But it does some extra stuff that I'm not looking at, so

15:31 `fogus: Sgeo: It's great fun to work this stuff out. I occasionally add little nuggets to my Evalive project as they dawn on me (or when I understand what the heck is happening)

15:31 Sgeo: Evalive?

15:32 `fogus: https://github.com/fogus/evalive

15:33 Raynes: `fogus: wtfn

15:34 `fogus: You're my hero.

15:34 `fogus: That was Alan Dipert's idea, I only named it ... he deserves all praise and/or hate

15:35 Sgeo: https://www.refheap.com/paste/5885

15:35 ^^my solution

15:36 amalloy: Sgeo: (into {} (for...))

15:36 Sgeo: Oh, that would probably be better

15:36 Thanks

15:36 WTF is Persona?

15:37 Some sort of proprietary OpenID-like thing?

15:39 https://www.refheap.com/paste/5886

15:44 djanatyn, ^^

15:45 lpetit: Raynes: ping

15:46 Raynes: lpetit: Howdy partner.

15:46 lpetit: Raynes: howdy. I just filled my modest contribution to your fundraiser. Just wanted to let you know.

15:47 Raynes: I see! Thank you very much, kind sir!

15:47 lpetit: You deserve it.

15:47 Raynes: Hardly modest!

15:48 lpetit: Raynes: compared to what I should have invested to go myself, it is. Everything's relative :)

15:48 Raynes: Haha

15:49 lpetit: Was just a quick hello, now's time to go to bed for me, see ya

15:52 Raynes: Night!

15:53 TimMc: Raynes: Persona still doesn't support Firefox password manager.

15:53 Raynes: Evil.

15:55 jlongster: TimMc: the ultimate goal is to have Persona integrated into Firefox itself. Also, the idea is to get rid of passwords, so password manager is kind of a different thing anyway

15:56 Sgeo: And no integration with OpenID?

15:56 TimMc: As long as I don't have to remember the damn ID, whatever.

15:57 s/ID/password/

15:57 Raynes: I used personas because it's easy and I'm lazy. Not much else to say there.

15:57 jlongster: Sgeo: no, it's a much different (and not broken) tool

15:57 Raynes: :p

15:57 Sgeo: How is OpenID broken?

15:57 jlongster: TimMc: you very rarely do, if ever

15:57 Raynes: I think I'll just defer any criticism to this jlongster fellow from now on. He seems hip on the matter.

15:58 TimMc: jlongster: ?

15:58 jlongster: Raynes: hah, well, disclaimer: I work for Mozilla

15:58 TimMc: Are you saying that I'd have another password to remember, but would only be prompted to enter it very rarely?

15:58 amalloy: more of a disclosure than a disclaimer

15:58 Raynes: Awesome. I'll definitely defer criticism to you.

15:58 TimMc: Because in that case I'd definitely forget it.

16:00 jlongster: On a more important note, do you know of any work being done to establish automatic, behind-the-scenes credentials generation between browser and server?

16:00 jlongster: TimMc: I'm not involved in Persona, so I can't really argue in details right now. You shouldn't ever have to "log in" unless you use a different computer, where you can either enter a password or get a link in your email you just click on.

16:01 TimMc: what kind of credentials?

16:02 TimMc: User: Yeah, sign me up on this site with username JRH. Browser: Hi google.com, I'd like to register with username JRH and password o9anyc2ocnh29y5c9h8265. Server: Okey-doke.

16:03 And then the password is automatically saved off, and the user can login with the click of a browser button.

16:03 jlongster: No, I don't know of anything like that. Persona is the architecture Mozilla is investing in.

16:04 TimMc: Hmm, OK.

16:04 jlongster: There'd have be a standard for that (outside of Mozilla), and I haven't even heard of a standard protocol

16:07 TimMc: Throw in another protocol for automatic email verification and you'd take almost all the pain out of registration.

16:19 jakov: what is the opposite of (eval)

16:19 you give it an expression and it changes it into a string representingit

16:21 brehaut: ,(doc prn-str)

16:21 clojurebot: "([& xs]); prn to a string, returning it"

16:21 Iceland_jack: prn-str: porn star?

16:21 emezeske: ,(pr '(some forms here))

16:21 clojurebot: (some forms here)

16:22 `fogus|away: The opposite of eval would be Byrd and Friedman's interpretter that plays expressions in reverse

16:22 jakov: pr sends it to stdout im fairly sure

16:23 is there a way to make it a string

16:23 justin`: marcellus

16:23 woops

16:23 emezeske: ,(pr-str '(some forms here))

16:23 clojurebot: "(some forms here)"

16:23 jakov: ok

16:23 oh wait somebody said

16:23 but i didnt understand

16:24 TimMc: jakov: THe opposite of pr-str is read-string; I'm pretty sure the "opposite of eval" is not well defined.

16:24 brehaut: jakov: do you want the opposite of read or eval?

16:24 jakov: TimMc iv just realised i asked the wrong question

16:25 i wanted the opposite of read-string

16:25 but people answered anyway... strange, they knew what i meant

16:25 TimMc: :-D

16:26 justin`: I'm having a brain fart. I have a vector that looks like ["a" 1 2 3 "b" 5 5 6 "c" 4] and I need to turn it into a map that looks like {"a" [1 2 3] "b" [5 5 6] "c" [4]}. I basically need to use recursion to solve this, correct?

16:26 Sgeo: ,(doc eval)

16:26 clojurebot: "([form]); Evaluates the form data structure (not text!) and returns the result."

16:26 Sgeo: What lexical environment does eval run in?

16:27 The empty one I guess

16:28 user=> (let [a 1] (eval '(get-lexical-env)))

16:28 {}

16:28 brehaut: justin`: start with ##(partition-by string? ["a" 1 2 3 "b" 5 5 6 "c" 4])

16:28 lazybot: ⇒ (("a") (1 2 3) ("b") (5 5 6) ("c") (4))

16:28 amalloy: justin`: step 1 is a clearer spec. what do you do if any of the values need to be strings?

16:37 justin`: amalloy: good point! actually the values will all be strings but the "keys" will be of predictable value so partition-by is what I was looking for, thanks brehaut. I had a feeling I was forgetting something

16:38 nDuff: If I'm manually creating a Thread object -- is there a way to copy the current set of thread-local bindings over to it?

16:38 AtKaaZ: hi, how do you call this feature of clojure that it doesn't require explicit typing(types) ie. for functions params and stuff like that

16:38 hyPiRion: AtKaaZ: Dynamic?

16:39 Sgeo: I would call it dynamic typing

16:39 brehaut: nDuff: bound-fn?

16:39 AtKaaZ: ok, I'm making a list of bad side-effects of that :))

16:39 * Sgeo isn't particularly a fan, but nice macros override that qualm

16:39 nDuff: AtKaaZ: We already know.

16:39 AtKaaZ: I mean, it's good, but it can be evil

16:40 nDuff: AtKaaZ: ...People who see that as a serious problem that are already not using Clojure.

16:40 AtKaaZ: nDuff, I'd agree, but you have to have some experience in clojure to be able to track down errors due to that

16:40 Sgeo: Stack traces in Clojure are annoying :(

16:40 AtKaaZ: especially since they are not explicitly taken care of

16:42 nDuff: Sgeo: There are some libraries that prettify them.

16:42 amalloy: nDuff: i don't agree. dynamic typing causes serious problems, and yet here i am. static typing causes serious problems too

16:42 * brehaut has high hopes for typed-clojure

16:43 nDuff: amalloy: Fair point. "A sufficiently serious problem to justify using another language" would have been more clear.

16:43 AtKaaZ: like this one: https://groups.google.com/d/msg/datomic/uIhKawJWL7o/gJ4doDknYfkJ

16:43 * Sgeo has a habit of bouncing between languages

16:43 AtKaaZ: no definitely no use another languange, none is that good (didn't try haskell tho)

16:44 amalloy: just as wrong, though. you don't need any justification to use another language. if you wanted to say that, you would say "sufficiently serious problems to preclude using clojure", but then it's a useless sentence: people who hate clojure's features enough to not use it, are not using it

16:44 * Sgeo has been with Haskell for a while

16:44 AtKaaZ: Sgeo, cool, which do you like most?

16:44 * Sgeo still has yet to write a "real" program with Clojure

16:44 technomancy: amalloy: isn't that what nDuff said though?

16:44 Sgeo: AtKaaZ, at the moment, Clojure, but my whims are subject to change at a moment's notice.

16:45 * nDuff thinks that he and amalloy are in violent agreement. :)

16:45 hyPiRion: So what's the normal argument against dynamic typing? That it causes more bugs because you don't know the type of a value you're receiving or passing?

16:45 ystael: When I type the name of a class in my code, where in Clojure is the code that decides what Class object becomes the value of this symbol?

16:45 technomancy: hyPiRion: certain classes of error are invisible until runtime

16:46 Sgeo: hyPiRion, the idea is that static typing will catch classes of bugs for you sooner.

16:46 AtKaaZ: Sgeo, haha, well for me clojure(+datomic) seems to be the lang I so dearly needed to do what I wanted to do before but failed in langs like cpp,js,php+sql,java+bdb

16:47 hyPiRion: Sgeo: So the idea is that having the overhead of static typing is better because you'll have less bugs.

16:47 technomancy: My personal opinion is that those errors are the hard ones, and that errors that have to do with types are more like small "fuckups".

16:47 brehaut: hyPiRion: the overhead of static typing is always a tradeoff, and whether it is better or not depends where the code in question falls on that scale

16:48 hyPiRion: /s/errors/bugs

16:48 nlew: Not the "overhead". Static typing is an additional tool to model your problem.

16:48 technomancy: hyPiRion: yeah, nobody really makes that argument for languages like Java that don't have type inference, but in languages like Haskell and OCaml, the cost is much, much lower

16:48 Sgeo: hyPiRion, not "less" bugs, but you'll find out about the bugs sooner. It's like turning a logic error into a syntax error.

16:48 technomancy: hyPiRion: if you don't have experience in a type system, then you won't know how to structure your programs in a way that the type system can catch larger-scale bugs

16:49 hyPiRion: technomancy: Ahh, gotcha.

16:49 technomancy: *if you don't have experience in a good type system

16:49 Java doesn't count

16:49 brehaut: hyPiRion: http://matt.might.net/articles/intro-static-analysis/

16:49 hyPiRion: Sgeo: Okay, so that's the rationale.

16:49 AtKaaZ: not sure if it's just dynamic typing at work, but this is the list of issues encountered so far: https://gist.github.com/3895312

16:50 brehaut: AtKaaZ: nothing about that would be solved with static types

16:50 AtKaaZ: do you mean the hash-map part? brainproxy

16:51 oops, brehaut

16:53 Sgeo: ,(hash-map {:a 1 :a 2})

16:53 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: :a>

16:53 AtKaaZ: ,(source hash-map)

16:53 clojurebot: Source not found

16:53 Sgeo: What is meant by (hash-map {:a 1 :a 2}) works?

16:53 hyPiRion: ,(hash-map :a 1 :a 2)

16:53 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>

16:54 hyPiRion: *shrugs*

16:54 AtKaaZ: ,(. clojure.lang.PersistentHashMap (create {:a 1 :a 2}))

16:54 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: :a>

16:54 AtKaaZ: Sgeo, on 1.5.0 alpha6

16:54 as in, it doesn't except

16:55 Sgeo: I don't see how that last one would be solved in a statically-typed environment

16:55 nlew: It seems to for me

16:55 nDuff: AtKaaZ: ...can't say I see how that's a static typing problem.

16:55 hyPiRion: Hah, it's this discussion again

16:55 http://dev.clojure.org/display/design/Allow+duplicate+map+keys+and+set+elements

16:56 AtKaaZ: Sgeo, nDuff, you're probably right, let me recheck and see why I added it

16:56 emezeske: What does that have to do with static/dynamic typing?

16:56 AtKaaZ: nlew, it throw now for me too, wonder why it worked yesterday hmm

16:57 amalloy: the newest 1.5 release is more lenient on calls to hash-map, hash-set, array-map, array-set, and probably the sorted maps/sets as well

16:57 as specifically requested by many users

17:01 TimMc: \o/

17:02 emezeske: /o\

17:02 AtKaaZ: I can't believe it, I can't get it to work (anymore) on either Clojure 1.5.0-alpha6 or 1.5.0-master-SNAPSHOT

17:03 which means, it always shows duplicate key

17:04 amalloy: AtKaaZ: what you got working before was (hash-map :a 1 :a 2), not (hash-map {:a 1 :a 2})

17:04 AtKaaZ: oh right

17:04 thanks so much amalloy

17:05 does that make it dynamic typing issue? possibly?

17:06 amalloy: no, so far just you being excited about the word dynamic

17:06 hyPiRion: AtKaaZ: Reverse it: How would static typing help?

17:07 TimMc: ,{:a 1 :a 2}

17:07 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: :a>

17:07 TimMc: ^ That's a compile error, i.e., static.

17:07 AtKaaZ: maybe I didn't ask the right question at first, this type of coding is somewhat specific to clojure, and it's like relaxed coding, not caring to make sure the params are right or all conditions met

17:07 S11001001: AtKaaZ: you can't make sure all conditions are met anyway

17:07 AtKaaZ: so I should've asked, what's that called?

17:08 TimMc: Program proof of correctness? :-)

17:08 AtKaaZ: S11001001, maybe at least as much as I'd do in java

17:08 TimMc: Or lack thereof.

17:08 nlew: AtKaaZ: What would you prefer Clojure did in this case? I'm confused what you think the issue is.

17:08 AtKaaZ: timmc, sounds relevant, I feel that it's a little less in clojure than it was in java though

17:08 nlew, check for duplicate keys I guess, and throw

17:09 nlew: Isn't that exactly what it's doing?

17:09 S11001001: AtKaaZ: does java prevent you from initializing a HashMap with duplicate keys, at compile time?

17:09 AtKaaZ: nlew, in 1.5.0 alpha 6 (hash-map :a 1 :a 2) doesn't throw

17:09 S11001001, probably not?

17:09 S11001001: AtKaaZ: i.e., what happens when you Map<String,String> x= new Map<>(); x.add("hi", "42"); x.add("hi", "84");

17:09 AtKaaZ: didn't check

17:10 overwrites?

17:10 S11001001: AtKaaZ: I know what happens, but how about trying it out in javac and seeing what happens

17:10 new HashMap, whatever

17:10 AtKaaZ: but I mean, in clojure since {:a 1 :a 2} is not allowed, it would be inconsistent(?) to allow (hash-map :a 1 :a 2)

17:11 S11001001: AtKaaZ: no, hash-map is a function, {} is syntax

17:11 brehaut: (let [a :a b :a] (hash-map a 1 b 2))

17:11 what should happen there?

17:11 AtKaaZ: so I felt like that check was ommited simply as a side-effect of clojure-style coding

17:12 ,(macroexpand (let [a :a b :a] (hash-map a 1 b 2)))

17:12 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>

17:12 AtKaaZ: ,(let [a :a b :a] (hash-map a 1 b 2))

17:12 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>

17:12 AtKaaZ: ,(macroexpand '(let [a :a b :a] (hash-map a 1 b 2)))

17:12 clojurebot: (let* [a :a b :a] (hash-map a 1 b 2))

17:12 brehaut: AtKaaZ: dont evaluate it; i could obviously have done that myself. think about it

17:13 if that became (let [a :a b (complex-expression-that-evaluates-to-:a)] …) would you still expect the same result?

17:13 AtKaaZ: ok I'm failing :)

17:13 yes

17:13 the throw i mean

17:13 brehaut: and what about in a literal

17:13 AtKaaZ: what's that?

17:14 brehaut: {a 1 b 2}

17:14 AtKaaZ: same I guess, doesn't the literal call something like put behind the scenes?

17:14 jamii: is there a way to test if something is a record?

17:15 AtKaaZ: brehaut, that literal still throws in clojure 1.5.0 master

17:16 brehaut: i personally dont give a rats arse what an alpha does. unfinished things are by definition unfinished

17:17 AtKaaZ: brehaut, ok, maybe it's a temporary bug, since it threw in earlier version, but I feel it's meant as a feature

17:17 brehaut: it can well be a feature

17:17 dnolen: jamii: clojure.lang.IRecord

17:17 jamii: dnolen: thanks

17:18 AtKaaZ: ,(alength {:a 1 :b 2})

17:18 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: alength>

17:18 AtKaaZ: ,(.size {:a 1 :b 2})

17:18 clojurebot: 2

17:19 mindbender1: In the beginning was a list of things

17:20 S11001001: mindbender1: did it contain all things?

17:21 hyPiRion: Well, if it was a list of things in Clojure, then the list didn't contain itself.

17:21 mindbender1: S11001001: an operation was defined that allowed that to happen

17:21 AtKaaZ: he probably means all things in the subsystem, so not the list itself (assuming it resides in the parent system)

17:22 S11001001: hyPiRion: speak for yourself. ##(let [xs (to-array [42]) xs' (vec xs)] (aset xs 0 xs') xs')

17:22 lazybot: java.lang.StackOverflowError

17:23 S11001001: hyPiRion: (xs' is a vector whose only element is itself)

17:23 AtKaaZ: the list is in the same subsystem

17:23 oskarth: I have a macro that defines functions that takes an arg maps. What would be an idiomatic way to access these keys?

17:23 amalloy: jamii: that's only as of a very new version of clojure, though

17:23 oskarth: outside of the function that is

17:24 arohner: what is the preferred vim plugin for clojure these days?

17:24 hyPiRion: S11001001: Neat. Doesn't look like an intended feature though

17:24 dnolen: amalloy: wasn't in 1.4.0?

17:24 amalloy: &clojure.lang.IRecord

17:24 lazybot: ⇒ clojure.lang.IRecord

17:24 jamii: amalloy: thats ok, I'm targetting 1.4 anyway

17:24 hyPiRion: Have you some hacks for maps or sets too? I've been unable to do that.

17:24 S11001001: hyPiRion: it was intentionally not fixed

17:24 amalloy: oh, apparently it was. my mistake

17:24 S11001001: so in that sense, it's intentional

17:24 hyPiRion: S11001001: Ah.

17:25 AtKaaZ: ,((fn [ & all] {:pre (= 1 2 ) } 0 ) 'a)

17:25 clojurebot: 0

17:25 AtKaaZ: can't have :pre ?

17:25 dnolen: oskarth: not sure what you mean

17:27 jkkramer: ,((fn [& all] {:pre [(= 1 2 )]} 0 ) 'a) ;see http://clojure.org/special_forms#fn

17:27 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.AssertionError: Assert failed: (= 1 2)>

17:28 AtKaaZ: jkkramer, much appreciated thanks

17:28 oskarth: dnolen: trying to write a mock HDL, and I've a defchip macro that takes a map of pins on the chip. I want to be able to do (get-args mychipfn) and have it return a list of the keys I used to define that chip, but not sure about how to approach it

17:29 Sgeo: It suddenly occurs to me that that form of pre and post condition bothers me

17:29 Suppose I have a macro that puts arbitrary maps at the beginning of function definitions for some reason

17:30 Suddenly, it's asked to place a map with keys :pre and :post

17:30 Boom, things break

17:30 AtKaaZ: they do?

17:30 emezeske: oskarth: Couldn't your macro do two defs -- one for the function itself, and one for the arg map?

17:30 dnolen: oskarth: neat you should chat with dgrnbrg :)

17:30 oskarth: another option I like if you can bear giving up various fn arg sugar - reify IFn,

17:31 oskarth: emezeske: yeah, that's one approach indeed

17:31 AtKaaZ: that map with :pre is it part of the function code ?

17:31 TimMc: &((fn [] {:pre false})) ;; no problemo

17:31 lazybot: ⇒ {:pre false}

17:31 dnolen: oskarth: fn metadata as well

17:31 dgrnbrg: oskarth: hello!

17:31 oskarth: hi dgrnbrg!

17:31 AtKaaZ: TimMc, I take that as a yes? :)

17:31 dgrnbrg: oskarth: I've been writing an HDL in clojure for the past 10 months

17:32 oskarth: dnolen: how does reify IFn work?

17:32 I like the metadata idea

17:32 TimMc: AtKaaZ: Nope. "part of the function code" doesn't mean anything to me.

17:32 oskarth: dgrnbrg: oh, cool!

17:32 dgrnbrg: https://github.com/dgrnbrg/piplin is the project

17:32 AtKaaZ: TimMc, it means pretty much like Sgeo implied

17:32 dgrnbrg: It allows you to essentially write normal clojure code, but it generates special structures that can be simulated or synthesized to verilog

17:33 oskarth: neat

17:33 dgrnbrg: it also adds a flow-typing system, so that you can encode type compatibility and promotion rules, and control the bit representation of types

17:33 AtKaaZ: TimMc, actually I take that back, seems harmless

17:33 oskarth: sounds quite advanced - I started doing this as an exercise in writing a DSL as I'm working through elements of computing systems

17:34 dgrnbrg: it has pattern matching for union types, allows you to use destructuring for composite datatypes

17:34 it's got tons of extension points as it's an open system, so that you can implement things like complex fixed point arithmetic as a library

17:35 jcromartie: hiya everybody

17:35 I'm doing some trivial game dev stuff in Clojure, and trying to work out a sensible foundation

17:35 AtKaaZ: Sgeo, now I get what you mean, like if your function returns a map with :pre ... let me test

17:35 dgrnbrg: and it's designed to use as a base for HDL synthesis, so that you could write a higher level hdl and compile/eval as piplin, which would give you cycle simulation and synthesis to verilog

17:36 oskarth: ah

17:36 AtKaaZ: ok not returns:)

17:38 oskarth: dgrnbrg: is there a write-up or so of it somewhere? looking through the code some but have a hard time grokking it all (esp not coming from a hardware background)

17:38 Sgeo: AtKaaZ, if I make a macro that expands to (fn [stuff] <some map here> more stuff)

17:38 dgrnbrg: oskarth: I have made some work in that direction, but I haven't finished the fully writeups. There's a lot of mostly correct information on the wiki

17:38 oskarth: ok, will have a look :)

17:38 dgrnbrg: although I refactored the namespaces so they aren't accurate

17:39 also, if you look at the examples/ folder, that has simple examples

17:39 the basic structure is this:

17:39 types.clj has the type/promotion system hooks in it, and types/*.clj are all the type implemenatitons

17:39 AtKaaZ: Sgeo, I see that if I make it a function , probably due to laziness, the return value is ignored so no map is returned ie. ((fn [] (evilprint) 1 ) )

17:39 dgrnbrg: sim.clj has a simulation engine, modules.clj has a way to make verilog-style modules

17:40 verilog.clj is the verilog output backend

17:40 emezeske: Sgeo: Ever hear the story about the patient that complained to her doctor that her arm hurt when she twisted it backwards ackwardly? The doctor said, "don't do that."

17:40 AtKaaZ: Sgeo, even as a macro looks like, ie. (defmacro evilprint [] `{:pre [false] }) ((fn [] (evilprint) 1 ) )

17:40 dgrnbrg: vcd.clj has a vcd file outputter

17:40 Sgeo: I just don't like the special casing

17:40 dgrnbrg: if you look at the tests, they exercise most of the functionality of most of the parts, so that you can see how specific features can and cannot be used

17:41 and oskarth--i respond very quickly to email about piplin :)

17:41 if something's unclear, i'll be happy to write up a wiki page on it for you (and everyone else); it's hard to know what to document and work on w/o guidance from users/potential users

17:41 oskarth: ok nice :)

17:42 Sgeo: (fn [] {:blah foo} (comment Im just a normal function))

17:42 (fn [] {:post foo} (comment oops))

17:42 dnolen: dgrnbrg: so I notice you have some tests where it looks like you benchmark piplin against Icarus?

17:43 dgrnbrg: dnolen: actually, those tests run piplin & run piplin's synthesized output in icarus, to confirm they're cycle-accurate

17:43 that my simulation model and verilog's simulation model haven't diverged in the ways that I want to guarentee :)

17:43 dnolen: dgrnbrg: gotcha

17:44 dgrnbrg: there's a much faster simulator in the pipeline (compiles directly to jvm bytecode), but that's not ready yet

17:44 dnolen: dgrnbrg: so remind, is the goal to make an language more expressive / easier to use than verilog ?

17:44 dgrnbrg: wow

17:45 AtKaaZ: Sgeo, that :pre it seems harmless even if as macro, am I missing something maybe?

17:46 dgrnbrg: Verilog is terrible for expressiveness and for typing. VHDL is terrible for expressiveness, too (but has a decent type system). I want to use the power of a real programming language to generate the hardwar estructures

17:46 for instance, it's not that hard to write a software version of a CLOS network, but it's quite hard to implement it in hardware

17:46 I want to unify those descriptions, but still generate the same circuit as if you'd hand-optimized it

17:46 dnolen: dgrnbrg: crazy stuff ;)

17:47 dgrnbrg: plus, as ola bini talked about @ strange loop, macro languages are more powerful than non macro languages

17:47 and by embedding an HDL in clojure, you get macros, so the world becomes your oyster

17:48 amalloy: Sgeo: yes, if you do something crazy like put maps inside the body of functions you know nothing about, then sometimes for certain maps you will get behavior you didn't want

17:48 but there is no reason to ever do the former, so why worry?

17:49 AtKaaZ: amalloy, but I can't reproduce that

17:50 help?:)

17:55 TimMc: Sgeo: I share your concern in quality but not in quantity, if that makes any sense.

17:55 (comment ...) is a problem anyway -- it should be preceded by a #_

17:57 AtKaaZ: it's not possible to pass the arguments as they are inside a function in clojure right? ie. (func 1 2 3) and inside func they are passed to someotherfunc as 1 2 3 not '(1 2 3) or seq

17:57 but with macros is possible

17:58 Sgeo: AtKaaZ, hmm?

17:58 AtKaaZ: ok let me rephrase, sec

17:58 AdmiralBumbleBee: AtKaaZ: you could just use apply

17:58 Sgeo: Not sure _exactly_ what you're asking, but it sounds possible.

17:58 AtKaaZ: ,((fn [& all] (hash-map all)) :a 1 :a 2 :b 3)

17:58 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: (:a 1 :a 2 :b ...)>

17:58 AtKaaZ: that should show what I mean

17:59 ,(hash-map :a 1 :a 2 :b 3)

17:59 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>

17:59 AtKaaZ: that is needed

17:59 AdmiralBumbleBee: ,((fn [& all] (apply hash-map all)) :a 1 :b 2 :c 3)

17:59 clojurebot: {:a 1, :c 3, :b 2}

17:59 AdmiralBumbleBee: that is what you want correct?

18:00 AtKaaZ: no way, lol, that's exactly right

18:00 why did I think that's not possible?

18:00 Sgeo: Too used to Haskell?

18:00 :p

18:00 AdmiralBumbleBee: because clojure does that sometimes :)

18:00 AtKaaZ: i didn't use it at all, but I remember I once wanted this few days back, and didn't find the solution

18:01 thanks for the eye opener, AdmiralBumbleBee

18:01 AdmiralBumbleBee: sure :)

18:01 AtKaaZ: (inc AdmiralBumbleBee)

18:01 lazybot: ⇒ 1

18:02 AdmiralBumbleBee: I lost all my inc's from switching nicks, how sad

18:03 AtKaaZ: now if only I could find out what I tried back then... which would benefit from this knowledge that I got now (should be something within last 5 days)

18:04 does ccw permanently save repl history ? or does anyone know of a repl logger?

18:06 mindbender1: ,(partition 0 [:i :am :cruel])

18:06 clojurebot: (() () () () () ...)

18:07 Sgeo: ,(partition-all 0 [:i :am :cruel])

18:07 clojurebot: (() () () () () ...)

18:08 Sgeo: ,(partition-all 0.5 [:i :am :cruel])

18:08 clojurebot: ((:i) (:am) (:cruel))

18:08 mindbender1: ,(> 0.5 0)

18:08 clojurebot: true

18:22 gtrak: what do I do if I want something like the agent's 'await' but more recursive. I want something that would also wait for jobs dispatched by the awaited jobs. Is that possible/stupid?

18:23 AtKaaZ: I hate me, but let's move on :)

18:24 agent within an agent?

18:24 gtrak: obviously there can be no cycles

18:24 yea

18:24 a single agent

18:25 but a 'send' within a job running on the agent pool

18:26 if i can figure out what the last thing will be, that's a good fit for promise/deliver, but i think it could be more generalized, and I hope the answer isn't 'write something custom around countdownlatch'

18:28 but now that I'm thinking through it, I think the dependency-graph needs to be defined outside of the agent

18:28 hrmph

18:29 AtKaaZ: sounds good to me

18:30 gtrak: so I will find the leaves... but how do I know if they will be realized?

18:30 or... I guess I can't. my head hurts

18:32 AtKaaZ: so you have a parentjob which calls other jobs ? but you don't know which jobs until you execute the parentjob?

18:51 gtrak: AtKaaZ: yea

18:51 It might just be an impossible problem..

18:52 there's no way to find out which one's going to run last, I can either guess, or know which ones are going to run and use a latch on them.

18:53 Sgeo: You can't run them all and use whichever returns the latest?

18:53 * Sgeo isn't really looking at context

18:53 gtrak: Sgeo: how do I know there are no later ones at the point that I'm at?

18:53 you identify the data-dependency... and wait for that, I think that's the right answer

18:53 Sgeo: Oh, I thought you knew all the ones that would run when you start them

18:53 AFK

18:54 gtrak: Sgeo: almost

18:55 you can't know on message level, but you can bind it to a particular message with a promise, which is what I did naturally anyway, but the only way to know that all of those kinds of things are done, is to additionally keep some state around keeping track of initial jobs and if they've finished or not

18:56 assuming the kinds of job of interest all start from the same thread, that would work

18:57 I can make that map thread-local or global

18:59 AtKaaZ: sounds like functional programming? each job is a function which contains some elemental code mixed in with calls to other jobs(optionally); all running on a single thread, serially

19:01 gtrak: a stack's a lot like a queue, yea

19:01 but the point of async is the controlled decoupling

19:01 which is a requirement here

19:02 hmm... the key difference is the queue has multiple entry points and it multiplexes its execution, that's what makes it non-deterministic

19:03 AtKaaZ: like a pmap?

19:03 gtrak: sure, but pmap is all parallel, they run on a thread-pool but there's no data dependencies

19:04 element 2 doesn't depend on the answer for element 1

19:04 AtKaaZ: ok so you have like a root queue of jobs, which are likely to be executed by multiple threads, cause I imagined they executed sequentially so far

19:04 gtrak: right

19:04 they're popped off sequentially at any rate

19:05 and in terms of the queue they're sequential with respect to each other

19:06 AtKaaZ: so like one thread pops job1 and executes; thread2 pops jobs2 and executes but if job2 depends on job1 then you want it to wait for it? still unsure that I got it

19:06 gtrak: yea

19:07 rather... thread1 pushes job1, job1 pushes job2, I want thread1 to wait for job2, without having to explicitly pass in a promise somewhere

19:07 AtKaaZ: can it just skip job2 until thread1 is done with job1 and instad do next job3?

19:07 oh i see

19:08 gtrak: if thread1 pushes 2 jobs, the order might be job1 job2 job1.1 or job1 job1.1 job2

19:08 I want it to wait for whatever the last one happens to be

19:08 if I do await in the first case and time it wrong, job 1.1 happens afterwards

19:09 where job 1.1 is a job pushed by job1 :-)

19:10 AtKaaZ: right, but you say that thread2 can take the next job while thread1 is busy waiting for job1 to finish?

19:10 gtrak: yes

19:11 the problem I'm trying to solve is how to notify thread1 that job2 and job1.1 have both run, without requiring that they both run in the first place :-). I think the answer is, at the conditional that decides to push job 1.1, I need to push up the latch

19:11 AtKaaZ: ok so in that case thread2 can take job2 because job1 didn't yet push job1.1 even if it pushes it after job2 or before job2, which would mean thread2 should probably know if job2 depends on job1 else it would take it

19:11 gtrak: if I know it's going to run..

19:12 yea, but there's a race condition

19:12 hmmm.

19:12 the answer is... do everything that affects the queue with continuation-passing style

19:13 maybe..

19:13 haha

19:13 AtKaaZ: what does that mean?

19:13 gtrak: thread1 should only dispatch a single job, but pass it a continuation to dispatch another at its leisure

19:13 that would serialize the order of the jobs once again

19:15 instead of agents, I would use futures, basically

19:15 futures within the single agent

19:15 top-level agent

19:15 AtKaaZ: I think I lost it, lol, but job1.1 depends on the previous code executed prior to it inside job1 ? ie. has to wait for that code to execute before it being launched?

19:15 gtrak: yea

19:16 haha, I will think about this some more, but it is very helpful to talk through it :-)

19:17 AtKaaZ: ok so basically each job in the queue should be executed serially until completion, even if it launches subjobs they are to be executed serially too(ie. likely by the same thread executting the parent job no?)

19:17 gtrak: yea

19:17 AtKaaZ: but jobs in queue may depend on each other

19:18 ok i think i got it so far

19:18 gtrak: it can be asynchronous from the perspective of the top-level thread, but I can hide the details and serialize its execution

19:18 de-multiplexing

19:19 i think that's the right answer, sorry to confuse you and run :-)

19:19 AtKaaZ: it's all good afaic;)

19:20 gtrak: thx

19:46 timsgardner: anyone know good ways to constrain printing in clojurescript, ala *print-level*, *print-length*?

19:48 emezeske: timsgardner: Unfortunately I think the answer to your question is "add such a feature to clojurescript's printer"

19:49 holo: hi

19:49 emezeske: holo: hallo

19:52 timsgardner: emezeske: yeeeah, thought it might be… ho hum

20:22 mattmoss: I'd appreciate some eyes on this: https://gist.github.com/3896521

20:22 Don't know what's going on there.

20:27 xeqi: mattmoss: add a second set of parens around the (fn ..)

20:29 mattmoss: xeqi: Ahhh...! Thanks... I need a brain update.

20:54 nsxt: any guides for putting nginx in front of a clojure app?

20:55 hiredman: just do it?

20:55 nsxt: hahaha

20:55 emezeske: nsxt: I don't think there's anything clojure-specific about it; just proxy_pass (or whatever) to the port your clojure app is listening on

20:56 nsxt: i ask because i came across this http://wiki.nginx.org/JavaServers and was wondering if i had to deploy it in a certain fashion

20:57 but i'm guessing it's just a matter of "lein ring server" (in the case of compojure) and then config nginx to proxy_pass it over

20:59 hiredman: I like lein ring uberwar + jetty-runner, but it seems like a lot of people get by with lein ring server and similar

21:02 brehaut: apparently im behind the times. theres lein ring support? and a jetty runner

21:02 ;

21:02 * brehaut googles

21:07 nsxt: emezeske, hiredman: thanks, that was too easy and now i am slightly ashamed of myself

21:36 lynaghk`: dnolen, ohpauleez: do you know of anyone who has had luck doing ClojureScript with IE8?

21:37 technomancy: hiredman: why uberwar rather than uberjar?

21:38 ohpauleez: lynaghk: What sorts of things? We have ran an IE-compat on some of our stuff and it seemed fine. Internally we do WebKit specific stuff for one app. Are you seeing weird issues

21:38 technomancy: brehaut: I just use ring-jetty-adapter's run-jetty in -main

21:38 brehaut: technomancy: likewise

21:38 with a horrible bash script in init.d

21:38 amalloy: technomancy: war+jetty lets you use jetty's container-based features, like running multiple apps in a single jvm

21:38 brehaut: (really i should look at supervisord or something)

21:39 amalloy: for personal use i just lein run; at work we deploy wars into the jetty container

21:39 lynaghk`: ohpauleez: we've got a fully completed app that is blowing up IE8 and I didn't know if it was some of our libs or something in cljs itself. Sounds like core should be fine then, eh?

21:40 brehaut: amalloy: thats good to know

21:40 technomancy: brehaut: upstart makes daemonization pretty easy

21:40 clojars has a good example of a simple setup for that with a fallback JVM

21:41 amalloy: hm cool; makes sense for more complicated deploys

21:42 ohpauleez: lynaghk: I'm almost certain core is fine. email detail errors if you want me to look into it. I know some people have IE compat issues with certain functionality (browser repl) and libraries (enfocus)

21:42 amalloy: technomancy: also makes for more complicated deploys

21:42 technomancy: heh; yeah

21:42 amalloy: jesus god i spent all day today helping lance debug our deploy script as part of upgrading from cake to lein

21:43 but, i think we successfully deployed our first lein-built artifact

21:44 technomancy: nice

21:44 lynaghk`: ohpauleez: thanks. More of a hypothetical at this point; I'm happy with my current IE strategies: "Chrome Frame" or "HELL NO".

21:45 dnolen: lynaghk: I've never heard of any problems recently.

21:45 I haven't I mean.

21:45 lynaghk`: dnolen: yeah, I got the sense it was more issues with DOM stuff that we're doing.

21:46 dnolen: lynaghk`: I know there a couple of users have posted IE bugs - but it's been a while since we've seen those.

21:46 brehaut: technomancy: im struggling to find the upstart config. SYSADMIN.md suggests im looking for clojars.conf somewhere?

21:47 technomancy: however, i cant seem to find that file

21:59 * Sgeo has an idea for an evil 4clojure question

21:59 Sgeo: The only way to win is to cheat >:D

22:02 tomoj: is there a better way than (q '[:find ?v :in $ [?e ...] :where [?e :attr ?v]] db (index-range db ...)) ?

22:02 Sgeo: Can anyone submit 4clojure questions?

22:02 ,(count (range 5))

22:02 clojurebot: 5

22:02 Sgeo: Hmm

22:03 Best way to do an infinite seq of numbers?

22:03 brehaut: it depends what you want the seq of numbers to be

22:04 ,(repeat 1)

22:04 clojurebot: (1 1 1 1 1 ...)

22:04 brehaut: ,(range)

22:04 clojurebot: (0 1 2 3 4 ...)

22:04 xeqi: ,(range)

22:04 clojurebot: (0 1 2 3 4 ...)

22:04 xeqi: ,(iterate identity 1)

22:04 clojurebot: (1 1 1 1 1 ...)

22:04 Sgeo: How would I do range where it starts at a different number, besides ##(map (partial + 1) (range))

22:04 lazybot: java.lang.OutOfMemoryError: Java heap space

22:05 Sgeo: :(

22:05 dnolen: tomoj: what are you trying to do? I'm just now finally digging into Datomic ...

22:05 brehaut: ,(doc range)

22:05 clojurebot: "([] [end] [start end] [start end step]); Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0, step to 1, and end to infinity."

22:05 tomoj: use index-range to restrict to a date range (domain date, not transaction date)

22:05 brehaut: ,(iterate inc 3)

22:05 clojurebot: (3 4 5 6 7 ...)

22:05 tomoj: then run a query on just those

22:05 gfredericks: ,(drop 2 (range))

22:05 clojurebot: (2 3 4 5 6 ...)

22:05 shachaf: ,(range 3 (/ 1.0 0.0))

22:05 clojurebot: (3 4 5 6 7 ...)

22:05 Sgeo: ,(doc iterate)

22:05 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

22:06 Sgeo: brehaut, awesomme

22:06 shachaf: (Note: Don't do that.)

22:06 dnolen: tomoj: hmm, it's not my impression that's what index-range is for - don't you just want to use a db function?

22:07 tomoj: my understanding is that a db function would not take advantage of indexes

22:07 i.e. if you want today's docs, you have to pull in every doc and check the timestamp

22:08 Sgeo: ,(let [s (range 5)] (for [i s j s] [i j]))

22:08 clojurebot: ([0 0] [0 1] [0 2] [0 3] [0 4] ...)

22:08 Sgeo: ,(let [s (range 2)] (for [i s j s] [i j]))

22:08 clojurebot: ([0 0] [0 1] [1 0] [1 1])

22:08 Sgeo: Perfect.

22:08 ,(** 2 3)

22:08 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ** in this context, compiling:(NO_SOURCE_PATH:0)>

22:08 Sgeo: ,(Math/pow 2 3)

22:08 clojurebot: 8.0

22:10 Sgeo: Would it be too much of a giveaway that cheating is expected if the function the user has to write would need to determine the truth or falsity of Fermet's Last Theorem?

22:10 Although I'd need to make it obvious that that's what it would need to do

22:10 hiredman: tomoj: transaction functions get passed the db value, I don't see why you couldn't query it

22:11 Sgeo: How do I submit problems to 4clojure?

22:12 tomoj: hiredman: no transaction involved, this is query

22:12 dnolen: tomoj: from the docs I don't see how index-range could do what you want. it's just going to give you slice of an index of datoms. those datoms are organized in any that you have any control over as far as I know.

22:14 are not organized

22:15 brehaut: Sgeo: you make a pull request on github i think

22:15 Sgeo: brehaut, and are problems where the only solution is cheating acceptable?

22:15 brehaut: i have no idea

22:16 i presume not

22:16 Sgeo: Aww, darn

22:16 brehaut: i have no idea though

22:19 dnolen: tomoj: actually I think you're right. I see a thread on the ML about this.

22:21 tomoj: people were making :avet indexes of :db.type/instant and asking for index-range to determine a start point

22:21 tomoj: how do you know what n to start at?

22:22 Sgeo: Oh hey I found the listing of all 4cloure problems

22:27 technomancy: brehaut: I think the upstart config is just on the clojars-maintainers mailing list

22:27 tomoj: dnolen: n being the start time?

22:27 brehaut: technomancy: ah, thanks

22:27 tomoj: just whatever I want - e.g. 1 day ago

22:27 technomancy: oversight probably

22:27 tomoj: I wish you could get a reverse range

22:29 dnolen: tomoj: seems like you are right, so is that you're problem with that query ... that you't can't get a reverse range?

22:31 amalloy: Sgeo: once you have solved 50 problems, a link appears in the header allowing you to submit a problem

22:32 Sgeo: amalloy, ah

22:32 Awesome

22:33 tomoj: well the query seems to work fine, would be nice to get a reverse range so I don't have to e.g. do a range 1 day ago -> today, then if I want more 2 days ago -> 1 day ago, etc

22:34 but was just wondering if there was a, uh, more idiomatic (?) way to write the query

22:39 JvJ: hey, anyone good with java interop here?

22:40 I'm getting a class not found exception when loading an ns with :gen-class

22:42 jcromartie: JvJ: can you paste anything relevant?

22:42 JvJ: Here's my NS : (ns enjine.core.EnjineDebug

22:42 (:gen-class)

22:42 )

22:42

22:43 hiredman: JvJ: you need to use the full class name in your :extends

22:43 JvJ: (defn -toString

22:43 [this]

22:43 jcromartie: not paste like that :)

22:43 JvJ: "An enjine debug unit.")

22:43 jcromartie: ...

22:43 JvJ: sry bout that

22:43 jcromartie: https://www.refheap.com/ is a Clojure-flavored paste site

22:44 hiredman: JvJ: you need docstring for gen-class

22:44 to read the

22:44 JvJ: I was looking at a tutorial for it

22:45 hiredman: http://clojure.org/compilation is a good place to start

22:45 gert: do I need a clojure 1.5.0 alpha for the reducers library? Or can I use it with 1.4 as well?

22:46 JvJ: thanks hiredman

22:46 hiredman: gert: the code is not present in 1.4

22:46 gert: hiredman: I vaguely remember it being available as a separate jar, but maybe I'm dreaming?

22:47 hiredman: you are

22:47 gert: is there a release schedule for 1.5? I would love to use the reducers for our application, but I'm slightly hesitant to use 1.5 before it's out of alpha...

22:48 although it seems pretty stable in my experience....

22:51 tomoj: reducers still need work imo, I'm hoping 1.5 is still a ways out :(

22:54 dnolen: tomoj: it doesn't sound like that.

22:54 gert: hmmm... interesting dilemma. I'm a couple of months away from releasing our application... and reducers would be awesome for our use case. I think I'm going to use it.

22:55 living on the edge :)

23:00 tomoj: reduce-kv seems hobbled :(

23:00 the extra transforms would not be too badly missed, maybe

23:28 jlongster: dnolen: is node.js support still working in latest cljs? I have a stupid simple test project and the main function doesn't seem to run: https://github.com/jlongster/cljs-node-fun/blob/master/src/test/core.cljs

23:29 dnolen: jlongster: it should as far as I know - ohpauleez uses it

23:29 jlongster: I don't so I can't saw much about it.

23:31 jlongster: dnolen: ok, thanks. I'm not sure why but I always have trouble getting started! I'll hack on it some more.

23:33 dnolen: jlongster: you try stuff that not enough people work on ;)

23:34 jlongster: nearly all the interest in ClojureScript is web centric

23:35 jlongster: yeah, that makes sense, since most people are probably using Clojure on the server

23:35 I'll try to wrangle in some node though! Could be helpful in certain cases.

23:35 dnolen: jlongster: yeah

23:35 jlongster: a lot of people are interestd in node.js, but it takes a special kind of person to dig into poorly documented code and actually help out :)

23:36 jlongster: dnolen: so you think it's worth digging into? I could be that kind of weird person that finds that a fun challenge.

23:36 dnolen: jlongster: I haven't looked at that stuff because there's just a ton of other stuff to do that's not node related at all.

23:36 jlongster: definitely worth digging into.

23:37 jlongster: sweet

23:37 I'm used to node, so it may just be the gateway drug to Clojure, we'll see!

23:38 dnolen: jlongster: it would be nice, if somebody actually spent some time on it we'd have a compelling scriptingsolution.

23:38 jlongster: I spent a little time in the early days on a Node.js based CLJS REPL

23:38 jlongster: knocked the socks off of Rhino, but I just don't have time to polish it off.

23:39 jlongster: dnolen: nice, I like the sound of that. It does sound promising to remove the JVM for that kind of stuff.

23:39 (in terms of "precompiling" scripts)

23:39 dnolen: jlongster: well you still need the JVM to compile the forms, but once the REPL is fired up it's just zippier than Rhino.

23:40 jlongster: yeah, V8's definitely faster

23:40 dnolen: like 1000X

23:40 jlongster: haha

23:40 I'm not sure Mozilla even supports Rhino anymore

23:53 doomlord_: is clojure good at implementing erlang style actors

23:53 dnolen: gfredericks: hmm, I just applied your patch for CLJS-383 and I have not run into any issues with advanced compilation.

Logging service provided by n01se.net