#clojure log - Mar 07 2012

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

0:12 arohner: is there a better way to do this?

0:12 (while (dosync (+ (foo) (bar))) (baz))? foo and bar are pure fns that read refs, baz is a side-effect-y fn

0:14 amalloy: i kinda assume you've simplified here, because that never terminates

0:14 (and they're not pure if they read refs)

0:15 arohner: amalloy: yes, I over-simplified. it's (< (+ (foo) (bar)) max-count)

0:15 sorry, foo and bar are not pure, but they have no side effects

0:15 they only read refs

0:16 amalloy: if baz doesn't care about their refs, i suppose that's as good as anything else

0:17 arohner: baz doesn't care about the refs, but it does have side effects

0:17 though I guess if my dosync doesn't alter, it won't be retried

0:17 I was more worried about retries

0:18 amalloy: retries seem irrelevant

0:19 arohner: amalloy: why?

0:19 oh, and (baz) takes ~5 minutes

0:20 gorakhargosh: Which is the best place to report a bug with clojurescript?

0:21 the cljsc.bat windows batch file has executable permissions. accidentally executing it in a unix shell environment can trigger undefined behavior. i'd like to suggest removing unix executable permissions from the script.

0:23 when you have a clojurescript home path set up, bash completion suggests this script as one of the executable entries make it even easier to accidentally execute it.

0:23 making*

0:23 dnolen: gorakhargosh: please file a ticket in JIRA, ClojureScript doesn't take GitHub pull requests

0:24 http://dev.clojure.org/jira/browse/CLJS

0:24 gorakhargosh: dnolen: alright. I'll do that

0:32 dnolen: here it is for your reference: http://dev.clojure.org/jira/browse/CLJS-159

0:33 dnolen: gorakhargosh: thx!

0:34 gorakhargosh: dnolen: you're most welcome. :)

0:42 gtuckerkellogg: i think i'm not understanding the reduce function

0:43 Scriptor: gtuckerkellogg: what are you having trouble with?

0:43 gtuckerkellogg: i have a list of struct-maps, and I want to test if all the values of a certain key are the same length

0:43 If I use (map count (map :lhs test-rules))

0:43 I get (2 2 2 2 2 2 2 2 2 2 2 )

0:43 etc

0:43 Scriptor: what's :lhs?

0:43 Iceland_jack: Where is the `reduce' function?

0:43 dnolen: ,(reduce = [2 2 2 2 2 2])

0:43 clojurebot: false

0:44 gtuckerkellogg: ok, maybe it's not reduce i should be using

0:44 Iceland_jack: dnolen: true is not equal to 2 (:

0:44 gtuckerkellogg: very truthy

0:44 dnolen: Iceland_jack: oops duh

0:44 gtuckerkellogg: so if I try (map = (map count (map :lhs test-rules)))

0:45 i get a list of trues

0:45 Iceland_jack: gtuckerkellogg: Check out the Wikipedia page on: Fold (higher-order function)

0:45 http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29

0:45 gtuckerkellogg: and my expectation was that (reduce true? (map = (map count (map :lhs test-rules))))

0:45 woudl work

0:45 Iceland_jack: gtuckerkellogg: every?

0:45 Scriptor: alright, let's start from the beginning

0:45 Iceland_jack: I mean you *can* implement that with reduce

0:45 Scriptor: what's (map :lhs test-rules) supposed to do?

0:46 Iceland_jack: ,(every? = [45 45 45 45])

0:46 clojurebot: true

0:46 Iceland_jack: ,(every? = [45 4545 45 45])

0:46 clojurebot: true

0:46 Iceland_jack: eek, nvm me

0:46 dnolen: ,(partition 2 1 [2 2 2 2 2])

0:47 clojurebot: ((2 2) (2 2) (2 2) (2 2))

0:47 dnolen: ,(partition 2 1 [2 2 2 2])

0:47 clojurebot: ((2 2) (2 2) (2 2))

0:47 Iceland_jack: ,(apply = [45 45 45 45])

0:47 clojurebot: true

0:47 gtuckerkellogg: hey!

0:47 there we go

0:47 that makes sense

0:48 ,(println "thank you clojurebot")

0:48 clojurebot: thank you clojurebot

0:48 gtuckerkellogg: heh

0:48 and thank you Iceland_jack

0:48 Iceland_jack: haha, no don't take credit from clojurebot

0:48 gtuckerkellogg: jeez, this room is helpful

0:48 seancorfield`: is it just me or is clojuredocs.org not working properly?

0:49 gtuckerkellogg: works for me

0:49 seancorfield`: when i type in a function name, nothing happens

0:49 Iceland_jack: works for me

0:49 amalloy: &(reduce (partial list '+) (range 5))

0:49 lazybot: ⇒ (+ (+ (+ (+ 0 1) 2) 3) 4)

0:49 Scriptor: ,(every #(= % 2) [2 2 2 2])

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

0:49 amalloy: that's what reduce does internally: it calls + 4 times, once with each arg

0:49 seancorfield`: the site comes up but typing "read" into the search box doesn't return suggestions

0:49 Scriptor: ,(every? #(= % 2) [2 2 2 2])

0:49 clojurebot: true

0:50 Iceland_jack: ,(every? (partial = 4) [4 4 4])

0:50 clojurebot: true

0:50 seancorfield`: and, yes, gtuckerkellogg this room is very helpful :)

0:50 amalloy: &(every? #{4} [4 4 4])

0:50 lazybot: ⇒ true

0:51 amalloy: is a nicer way to write that

0:51 Scriptor: seancorfield: I'm getting status code 500's from it when I use chrome's search on it

0:51 gtuckerkellogg: perhaps amalloy, but I don't know the length in advance. I just want to check that they do not vary

0:51 seancorfield`: Scriptor: that matches what i'm seeing then.. static content comes up.. dynamic responses, not so much :)

0:51 amalloy: sure

0:52 dnolen: ,(let [[f & r] [4 4 4 4]] (every? #{f} r))

0:52 clojurebot: true

0:52 amalloy: dnolen: meh. just apply =

0:52 if we're solving a particular problem

0:52 dnolen: amalloy: definitely apply =

0:52 amalloy: using #{4} as a predicate is an improvement on Iceland_jack's suggestion, not on the actual problem

0:53 Iceland_jack: I'm still not used to using keywords and sets as functions

0:53 Coming from Common Lisp... sounds insane

0:53 dnolen: Iceland_jack: don't forget maps and vectors too :)

0:53 Iceland_jack: dnolen: Yes but why aren't numbers mapping functions as well?

0:54 ,([1 2 3] 1)

0:54 clojurebot: 2

0:54 Iceland_jack: but (1 [1 2 3]) doesn't work

0:54 even though the converse holds true for (<set> :keyword)

0:54 dnolen: Iceland_jack: less useful, plus it can't really be done, Clojure has Java numbers and literals are now primitive.

0:54 Scriptor: Iceland_jack: because a keyword is very often used as a key in a hash

0:55 dnolen: Iceland_jack: you can do it in CLJS, but modifying languages natives to that is very slow IME.

0:55 to do

0:56 Iceland_jack: Right, probably something like that

1:00 amalloy: also i suspect numbers have more "reasonable" meanings when called as functions than vectors do

1:01 so that even if we could do it we wouldn't know how

1:02 Iceland_jack: (DEFINE 1 CAR) (:

1:02 (I kid)

1:02 johnmn3: I think regexes should be functions on strings

1:03 Iceland_jack: johnmn3: I implemented that once

1:03 johnmn3: yea?

1:03 Iceland_jack: where I could define a function: c(a|d)*r

1:03 well +

1:03 where you could embed types into the function name

1:03 johnmn3: oh

1:03 Iceland_jack: as well as number of occurrences

1:04 long long time ago

1:04 johnmn3: I mean (#"thing" "something")

1:04 Iceland_jack: not too dissimilar I suppose

1:04 johnmn3: where, in the functions place, it just calls re-find, or something

1:04 Iceland_jack: hm, that would be interesting

1:04 amalloy: johnmn3: not feasible for the same reaon you can't do it for numbers

1:05 Iceland_jack: Define feasible

1:05 amalloy: it's a brilliant idea that's been had many times

1:05 johnmn3: amalloy: I know, but it could be builtin at a lower level, I'd imagine

1:06 technomancy: regexes absolutely should be functions

1:06 Iceland_jack: The lexical analyzer or reader could check for patterns for regular expressions or regexps

1:06 technomancy: you'd have to create a clojure.lang.Regex subclass rather than using java.util.Pattern

1:06 johnmn3: ah

1:06 technomancy: but it would be totally worth it, because regexes have never in the history of Clojure been used for interop

1:07 amalloy: haha what

1:07 technomancy: probably never going to happen sadly

1:07 amalloy: technomancy: i find your claim about interop pretty silly

1:07 technomancy: amalloy: java bends over backwards to not make you pass around regexes

1:08 see String's .split method

1:08 Iceland_jack: you're all about calling others silly amalloy

1:08 amalloy: and even if it were true clojure has always placed an emphasis on interop

1:08 dnolen: technomancy: isn't java.util.regex.Pattern final?

1:08 amalloy: yes. if it weren't, making regexes functions would be trivial

1:08 technomancy: dnolen: maybe. It wouldn't have to be a subclass.

1:08 the value of regexes as functions is several orders of magnitude higher than their interop value

1:10 johnmn3: here here

1:10 dnolen: technomancy: no way. Then you have to have a custom interface a wrapper class, and something that doesn't work where java Regexes do.

1:10 technomancy: I've never been in a situation where that would matter.

1:10 dnolen: that sounds like a major fail to me anyway.

1:11 technomancy: I've never seen a regex passed to anything but a clojure.core/re-* function, and 90% of the time it's simply used as a predicate

1:11 johnmn3: what about Iceland_jack's idea... something in the reader that detects regexes in the functions place?

1:12 technomancy: johnmn3: wouldn't work with higher-order functions

1:12 Iceland_jack: Are they still used? ;)

1:12 dnolen: johnmn3: nor will it work w/ regexes stored in vars

1:12 johnmn3: ah

1:13 technomancy: Iceland_jack: I'll overlook it since I know you come from CL =)

1:13 Iceland_jack: haha

1:14 johnmn3: I'll bet a pretty cool regex library could be built on core.logic...

1:14 Iceland_jack: Any idea why Clojure didn't go more all-out in implementing ideas from Haskell/OCaml/ML?

1:15 Mathematica, etc.

1:15 ADT, Pattern Matching,

1:15 amalloy: i think you may actually be right, technomancy, though i quibble on some of the details (like, i don't usually see regexes used as predicates, but instead as split/subgroup finders)

1:15 Iceland_jack: ...static type system /me ducks

1:16 technomancy: static types and pattern matching are both being worked on in libraries

1:16 Iceland_jack: I know about, what was it, clojure.match?

1:16 the best part of pattern matching is matching against ADT I've found

1:16 ymmv

1:17 dnolen: Iceland_jack: pattern matching has known problems. clojure.match goal is generalize pattern matching.

1:17 help wanted :)

1:17 Iceland_jack: ADT has plenty o weakness, I like William Cook's analysis

1:19 johnmn3: you could do something way cooler than regexes, Definite Clause Grammars - but some problems to solve first there too.

1:19 technomancy: I have two cond calls in leiningen that are just begging to be replaced with a match call, but I haven't quite pulled the trigger yet

1:20 Iceland_jack: dnolen: haha, that would be awesome

1:20 First-class CFG? (8

1:20 JorgeB: is aleph compatible with clojure 1.3 yet?

1:20 ztellman: JorgeB: 0.2.1 is nearing release

1:21 johnmn3: dnolen: would there be a short-hand syntax, much like current regexes? or would one build grammars/patterns first, and then use those?

1:21 ztellman: JorgeB: the alpha snapshots are stable, if you want to take them for a spin

1:21 JorgeB: ztellman: yeah, I think I would. Are they on clojars?

1:22 ztellman: JorgeB: yeah, 0.2.1-alpha1 is the latest non-snapshot, 0.2.1-alpha2-SNAPSHOT is the latest

1:22 JorgeB: ztellman: danke

1:24 ztellman: I still get warnings about dynamic bindings not being declared properly. Is that known?

1:25 ztellman: JorgeB: if it's only three, that's because prxml hasn't been updated to 1.3 compatibility yet

1:25 I'm waiting to see if there's any movement there; if not I'll just fork it and fix it before the formal release

1:25 until then, completely harmless

1:25 amalloy: ztellman: actually, data.xml finally has an official release, and it probably has all the prxml features you need

1:25 JorgeB: yeah just 3

1:25 Iceland_jack: ztellman: I have three arms!

1:25 ztellman: amalloy: didn't know that, thank you

1:26 amalloy: if it doesn't, let me know - i can maybe add them

1:26 ztellman: I'm sure it does, my needs are pretty simple

1:27 amalloy: (hint: the functions you'll want are: emit; sexp-as-element and/or sexps-as-fragment)

1:28 dnolen: johnmn3: Prolog DCG syntax is pretty terse (though of course not in the same realm as regexes), I haven't so gone so far as to consider something shorter :)

1:29 johnmn3: dnolen: rgr

1:30 * johnmn3 goes to read about DCGs

1:31 dnolen: johnmn3: what makes them cool (to me) is lexing / parsing are not separate things.

1:33 johnmn3: this parser for Lisp is awesomely small and clear http://web.student.tuwien.ac.at/~e0225855/lisprolog/lisprolog.pl

1:34 Iceland_jack: dnolen: Scanning and parsing aren't the same, maybe depending how you look at it

1:35 generally they're called lexical and syntactic analysis

1:36 Interesting tidbit, my first compiler's lexical analyzer was called: LEXANA.L

1:39 dnolen: Iceland_jack: yes they are treated separately in a lot of literature because it's tedious in most languages to do otherwise - but I enjoy how the pecularity of Prolog seems to let you deal with them uniformly.

1:40 Iceland_jack: Well Prolog is wonderful

1:40 it seems that logic programming is making a bit of a comeback which is fantastic

2:10 TEttinger: &(apply + (repeat 10 0.1))

2:10 lazybot: ⇒ 0.9999999999999999

2:10 TEttinger: &(apply + (repeat 10 1/10))

2:10 lazybot: ⇒ 1N

2:11 TEttinger: ,(apply + (repeat 10 0.1))

2:11 clojurebot: 0.9999999999999999

2:11 SirDinosaur: y3di: 11:18 < rhickey> SirDinosaur: There are no plans to open so

2:11 urce Datomic at this time

2:46 gtuckerkellogg: I have a list like (list '("foo" "bar") '("baz" "booo!"))

2:46 i'd like to get the string length of every second level member

2:46 like ,(.length "foo")

2:47 ,(.length "foo")

2:47 clojurebot: 3

2:47 gtuckerkellogg: so i'd like it to return '(3 3 3 5)

2:49 amalloy: &(let [lists (list '("foo" "bar") '("baz" "booo!"))] (for [list lists, item list] (.length item)))

2:49 lazybot: ⇒ (3 3 3 5)

2:50 gtuckerkellogg: wow

2:50 jeez, i have a lot to learn

2:50 thanks

2:52 Jetien: Hi, i'd like to read all the forms of file. If i do (take 2 (repeatedly read)) in a repl, two forms are read from *in* as expected. now, if i wrap this in a (clojure.contrib.duck-streams/with-in-reader "./somefile..clj") however the evaluation will block forever, even though there are multiple forms in "./somefile.clj" - what am i missing? is there a more elegant way to read the forms from a file?

2:58 raek: Jetien: clojure.contrib.duck-streams has been superceded by clojure.java.io since Clojure 1.2

3:00 you'd need to do something like (with-open [in (io/reader "./somefile..clj")] (doall (take 2 (repeatedly (partial read in)))))

3:02 Jetien: thanks!

3:08 raek: i had to switch io/reader for io/with-in-reader because read likes a pusbackreader. with with-in-reader from io everything works

3:09 raek: it was the (doall) that was missing

3:11 maacl: Looks like clojure.contrib.datalog has not been migrated to a new namespace or being maintained, is that correct?

3:20 raek: Jetien: then you need to modify it to (with-open [in (PushbackReader. (io/reader ...))] ...)

3:21 you also need (ns ... (:import java.io.PushbackReader))

3:22 Jetien: I don't recomment relying on the "old contrib". you cannot use it in clojure 1.3 and 1.4

3:24 maacl: raek: Would you know anything about the fate of clojure.contrib.datalog?

3:31 raek: maacl: nothing more than what this page says: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

3:32 which is that it is currently looking for a new maintainer, if i understand it correctly

3:43 maacl: raek: Thanks, kind of weird since it is an integral part of datomic. I suppose that they are maintaining a fork or something?

3:50 raek: indeed

4:50 tsdh: Aren't beta releases announced anymore? At least for 1.4.0-beta{2,3} I can't find any message on neither the clojure list nor the clojure-dev list...

4:54 talios: I guess people have been a bit busy with datomic to mention it :)

4:56 tsdh: ;-)

4:57 * lucian is unimpressed with not-open-source and reliance on dynamodb

4:57 tsdh: But at least someone found the time to roll the beta out.

4:59 callen: incidentally, I refuse to rely on datomic for the reasons I refuse to rely on dynamodb.

4:59 talios: lucian - the non-open source I could live with, but being in NZ - being reliant on servers in the US…. latency aside, I know a few government type clients that wouldn't want there data offshore, or normal clients wanting their data in American soil

4:59 callen: particularly, I find relying on dynamodb a bit fucking bizarre given that there are numerous dyanmo clones out there with various trade-offs...

5:00 I mean, it's about the farthest thing from 'unique' as it gets with distributed KV stores.

5:00 lucian: talios: also, vendor lock-in. it's why i don't use app engine, as nice as it is

5:00 callen: lucian: ditto.

5:00 talios: callen - given theres the local in-memory testing, and the vmware image store for more testing, I'm sure someone will write a generic store soon enough

5:00 lucian: dynamo is nice, i won't deny that

5:00 callen: the only things that get mimicked more than Dynamo are SQL databases with b-trees and Unix filesystems.

5:00 lucian: but yeah, cassandra and riak are good at replicating the ring design

5:00 and a ring FS isn't all that hard to do

5:00 talios: lucian - true, but isn't couchdb lock in, postgresql is also lockin for some things.

5:01 cassandra is VERY vendor lockin

5:01 lucian: talios: no, because you can run them on rackspace just fine

5:01 callen: talios: they're open source, you aren't forced to pay someone for it.

5:01 talios: if something goes wrong, you can fix it.

5:01 lucian: callen: that's not even as important

5:01 callen: talios: if it's slow for your use-case, you can patch it.

5:01 lucian: you can run oracle on both aws and rackspace

5:01 callen: talios: nobody can hike the price on you and keep you trapped.

5:01 lucian: dynamodb? if amazon hates you you're fucked

5:01 callen: ding ding ding ^^

5:02 talios: callen - true, but thats just PRICE lock-in. the fact that you're saying "we'll patch the server" means your still locked-in to technology-X, I suppose its not vendor lockin, but platform lockin I'm meaning

5:02 lucian: so if amazon also sold dynamodb, and then kept it also appliance-ised (like mysql), it'd be reasonable to use it

5:03 talios: right, but there is also provider lock-in, which is the worst

5:03 callen: talios: you're still locked in, Cassandra doesn't disappear on you just because some company decides to stop supporting it.

5:03 lucian: what you get with app engine and dynamodb

5:03 callen: talios: Amazon decides DynamoDB is no longer "strategic" like Google has with GAE, you're all kinds of fucked.

5:03 talios: have you SEEN GAE languishing?

5:04 talios: callen - i wouldn't say languishing, because uptake was dismal to start with :) heh

5:04 callen: Cassandra is no longer strategic to some vendor, fuck 'em, pay for a contractor to fix whatever you need or hire somebody who likes wide-column stores. Somebody like me.

5:04 lucian: not even that, they could just turn it off one day. or you might need servers in a particular area, or w/e

5:05 so yeah, if dynamodb was sold like oracle is, it'd be less silly

8:48 zamaterian: ,(+ 1 2 )

8:48 clojurebot: 3

8:51 maio: ,(println "Hello World!")

8:51 clojurebot: Hello World!

8:51 juhu_chapa: Hi!

8:52 dan_b: ,(println (str (char 38) "(println \"hello world\")")

8:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

8:52 dan_b: ,(println (str (char 38) "(println \"hello world\")"))

8:52 clojurebot: &(println "hello world")

8:52 lazybot: ⇒ hello world nil

8:53 dan_b: seems I need paren matching in irssi

9:04 sdpfn: hi, i am trying to learn clojure, i'm looking forward to learn about java interops ; any suggestion for good tutorials ?

9:06 any suggestion for learning java interops

9:07 maacl: sdpfn: I like these two http://www.infoq.com/presentations/Clojure-Java-Interop http://blog.jayfields.com/2011/12/clojure-java-interop.html

9:08 dan_b: http://clojure.org/java_interop is all I've looked at so far

9:08 babilen: sdpfn: http://clojure.org/java_interop is a short summary, but I would recommend buying a good Clojure book and reading it. (Joy of Clojure, Programming Clojure (once the 2nd edition is published), Practical Clojure, Clojure Programming, ... come to mind)

9:09 dan_b: that plus the experimental determination that you shoudl use the :import arg to (ns ...) to import java libs, not :use or :require

9:09 RickInGA: If you seach the spefic thing you want, there tend to be a lot of good tutorials you can stumble on that way. Stuart Halloway has a good one on swing

9:10 sdpfn: thanks

9:15 lucian: ok, watching Rich's video datomic looks very interesting

9:15 still closed source, still married to dynamodb, unfortunately

9:38 loops: Noob recursive function that merges two sorted vectors, takes twice as long as a python iterative version. Hit me with a clue stick.. http://pastebin.com/dSBjqHwz

9:48 raek: loops: twice as long for how many elements?

9:49 loops: 1 million

9:50 clgv: loops: how about a lazy-seq approach?

9:51 fliebel: Craziness! I have a -main that does (print (read)), which works on the repl, but just hangs with lein run.

9:51 raek: fliebel: hangs after printing?

9:51 fliebel: raek: No, nothing gets printed

9:52 loops: clgv, i _think_ it is using lazy-seq, i'm passing in two vectors created with (split-at (but i'm a total noob)

9:52 raek: hrm, perhaps you need to call shutdown-agents *shrug*

9:52 clgv: loops: your merge implementation is a recursion.

9:53 fliebel: raek: uh, ok...

9:53 loops: clgv, okay.. i'll figure out how to recode it as a lazy-seq and see how that goes

9:53 raek: loops: how do you construct the inputs in the python version?

9:53 loops: raek, is just two python lists

9:54 clgv: loops: or easier. you can use a transient as output

9:54 loops: raek, in both implementations they're just random #'s

9:54 raek: loops: you could try something like this: (let [s1 (doall (range 0 1e6)) s2 (doall (range 1e6 2e6))] (time merge s1 s2))

9:54 loops: raek, thanks.. will give it a go

9:54 raek: just to be sure that you are not measuring the performance of split-at

9:54 loops: raek, ah, k

9:55 fliebel: raek: I'm not using agents, but maybe Leiningen is just weird. I'm using a snapshot after all.

9:55 raek: fliebel: I vagely recall that clojure uses that thread pool internally or something

9:56 fliebel: raek: But it hangs before printing, so that should not have anything to do with shutting down, right?

9:56 raek: hrm

9:56 what about buffering?

9:56 tried calling (flush)?

9:56 fliebel: good one.. let me see

9:56 raek: I think println does that, but not print

9:57 loops: raek, blush... you're right.. i was blaming wrong function

9:57 clgv: loops: but your function can be faster with 'ret as a transient

9:58 fliebel: raek: nope, not that either. I'll try if stable leiningen makes any difference

9:58 loops: clgv, okay.. thanks.. looks like it's not the real problem anyway, but i'll look into how to make ret a transient

9:59 jonasen: Is there a mailing list for core.logic?

10:00 fliebel: nothing... Is lein run doing something weird with *in* or *out*?

10:01 clgv: fliebel: is your version of lein using nrepl already?

10:01 fliebel: clgv: I have both a 2 snapshot and the latest stable. But I think run should not be using nrepl regardless.

10:01 dan_b: fliebel: there was something on the mailing list abouit that the other day. lein trampoline run?

10:02 clgv: fliebel: ahk.

10:02 raek: loops: if you want to hide ret from the outside, you can write your function like (defn merge [a b] (loop [a a, b b, ret []] ...))

10:02 dan_b: http://groups.google.com/group/clojure/browse_thread/thread/a720fbb471edc040/09521c4b02c86f30?lnk=gst&q=trampoline#09521c4b02c86f30

10:03 fliebel: dan_b: Nice one, that gives a very tall exception. Exception in thread "main" java.lang.ClassCastException: clojure.core$promise$reify__5727 cannot be cast to java.lang.Number But thet might be my code...

10:04 raek: loops: using transients should be as simple as replacing [] with (transient []) and 'conj' in the recur call with 'conj!'

10:04 oh, and in the base cases, you need to call (persistent! ...) on the result

10:05 (persistent! (reduce conj! ret b))

10:05 clgv: raek: (persistent! (loop ...)) works as well ;)

10:06 raek: clgv: good point

10:07 fliebel: Nope, that's almost certainly not my code, because I have no code, ti does not use reify, and it's not mentioned in the stacktrace.

10:08 loops: raek,clgv i hadn't included in my pastebin, but i had actually hidden ret from the outside by including a 2 airty version of merge as well that called recalled merge with []

10:09 clgv: loops: the loop-recur is better if you never call merge from the outside with a 'ret value

10:09 loops: clgv, yeah, i can see that. and i don't ever call from outside with 'ret

10:09 fliebel: stacktrace: http://pastebin.com/Sw7F4SGV

10:10 ok, stable lein with trampoline works.

11:13 jsabeaudry: What is the proper way to synchronize access to a peripheral in clojure? Is it to use java semaphores?

11:15 Licenser: jsabeaudry I think agents would be good but I am not sure what you are talking about

11:15 mdeboard: lol

11:15 Licenser: I know that ins't a very reassuring sentence but I've been wrong the first time in years right now so I am a bit insecure at the moment

11:16 gtrak`: jsabeaudry, probably polling into an atom, you don't want an STM for side-effects

11:17 jsabeaudry: Licenser, agents are so powerful I have a hard time seeing all the ways they can be used

11:17 gtrak`: dhconnelly,

11:17 dhconnelly: yo

11:17 gtrak`: shouldn't you be doing homework?

11:17 dhconnelly: haha

11:18 i'm about to give a presentation actually, brb

11:18 Licenser: they are pretty much send them messages and they process them in the right order, but as i said I'm not sure if that is really what you want ^^

11:19 jsabeaudry: gtrak, It would seem atoms require functions free of side effects, and my device is all about side effects

11:19 Licenser, from that I could understand, sending multiple functions to an agent the functions might be retried is that right?

11:20 gtrak`: jsabeaudry, if it's single-threaded, it won't be retried

11:20 Licenser: js nope they just will be 'sorted' and porocessed in the order they arrive

11:20 so if I send long_running_fn and then quick_fn to a agent first long_running_fn would be processed and then once it is done quick_fn

11:21 jsabeaudry: gtrak`, How do I set it to be single-threaded?

11:21 gtrak`: if there's only a single thread writing to it,i mean

11:22 you don't set it... you just write to it from one thread

11:22 the code is very simple: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java

11:22 Licenser: jsabeaudry the idea is that a atom holds data this data can be modified by functions that you send to it

11:22 this functions won't ever be executed in a 'wrong' order

11:22 and they are stored in a queue (so to say) untill their time has come

11:24 gtrak`: jsabeaudry, if you look at the atom code, it spins in an infinite loop if compareAndSet fails... compareAndSet will only fail if the value changes from what's expected, which is if another thread beats you to it

11:24 Licenser: so when I get it right you want to do (write-to-peripheral rs232 "some text") and do that form multiple threads?

11:24 gtrak`: http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicReference.html#compareAndSet(V, V)

11:26 jsabeaudry: Licenser, That's pretty much the case except that I also need to wait for an answer

11:26 Licenser: I see I see so you'd want something like send and then wait for the return right now

11:27 there is await

11:27 jsabeaudry: gtrak`, In my case some other thread might beat me to it, so the Atom wouldn't be single threaded, which means the operation might be retried, which is bad because I have side effects, is my reasoning correct?

11:28 gtrak`: jsabeaudry, then you'd want to use two atoms I suppose? :-)

11:28 or a queue or something

11:29 Licenser: how about (await (send agent write_to_socket "text")) ?

11:29 gtrak`: I/O should be single-threaded or synchronized, there should be something in between that and your application banging on stuff

11:29 Licenser: so it is kind of tricky

11:30 gtrak`: i think this actually calls for standard locks

11:31 mdeboard: pop and lock

11:31 gtrak`: jsabeaudry, http://clojuredocs.org/clojure_core/clojure.core/locking

11:32 jsabeaudry: gtrak`, Ah nice, I wasn't aware that there was standard locking in clojure, so much emphasis is put on the STM

11:33 gtrak`: values don't care about side-effects :-)

11:33 there may be a better way, but I can't think of one

11:33 Licenser: oh locking

11:33 jsabeaudry: Licenser, So agents are basically a fancy event queue?

11:34 Licenser: hmm with a save state kind of yes

11:34 I think

11:34 also if you want to use locking for IO perhaps this is a nice pointer: https://github.com/Licenser/stupiddb

11:34 gtrak`: agents also use threadpools

11:34 clgv: shouldn that work? (doseq [[x y] data :when (and x y)] ...)

11:34 mdeboard: pytorll

11:35 Licenser: oh wiat no I didn't used locks any more

11:38 * Licenser waves out "later everyone."

11:39 clgv: (doseq [[x y] (map list (range 5) (range 5)) :when (and x y)] (print x y))

11:40 &(doseq [[x y] (map list (range 5) (range 5)) :when (and x y)] (print x y))

11:40 lazybot: ⇒ 0 01 12 23 34 4nil

11:40 gtrak`: jsabeaudry, yea, STM and functional programming is good for dealing with data and values, but Rich Hickey purposely decoupled values from time. When you do I/O, you have to conflate values and time again anyway.

11:43 jsabeaudry: gtrak`, I see

11:43 gtrak`: an atom in front of a device is really just a buffer, perhaps you could extend the peripheral object to implement swap! and deref?

11:43 or just use functions that lock

11:45 jsabeaudry: I think Licenser had a potentially good idea with agents, If I send a function (that does the work) to the unique peripheral agent, and that function is a closure on a promise that I wait on

11:45 Because there is only one peripheral agent, not two communication will be done at the same time

11:46 Now I just need to figure if functions sent to an agent can be retried and under what circumstances

11:46 gtrak`: you can add watches to a state change on agents, I would use that to separate the application state from the i/o

11:47 llasram: jsabeaudry: I'm kind of late to the party, but have you looked at lamina?

11:47 gtrak`: jsabeaudry, http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/add-watch

11:47 jsabeaudry: llasram, Yes I took a look at that

11:48 llasram, It is an option but I

11:48 'd love to keep my dependencies low

11:48 especially in what I consider to be a pretty simple case

11:48 llasram: But if what you're trying to do is exactly what lamina provides... eh?

11:49 gtrak`: i agree this is way too small for an event architecture :-)

11:51 * lucian disagrees with avoiding dependencies almost always

11:51 lucian: i've depended on Twisted on occasion just to get decent events in python

11:51 gtrak`: do the simplest thing that could possibly work?

11:52 lucian: yeah, that

12:13 clgv: whats the predicate related to 'seq - I mean I want to query whether something is seqable

12:15 tmciver: Is it just 'seq?'? ##(doc seq?)

12:15 lazybot: ⇒ "([x]); Return true if x implements ISeq"

12:15 clgv: nope

12:15 I tend to say it's 'coll?

12:16 'coll? tests (instance? clojure.lang.IPersistentCollection x) and IPersistentCollection contains a seq method

12:17 RickInGA: sequential?

12:17 &(sequential? [1 2 3])

12:17 lazybot: ⇒ true

12:18 clgv: (doc sequential?)

12:18 clojurebot: "([coll]); Returns true if coll implements Sequential"

12:19 raek: clgv: there isn't any predicate for determining whether calling seq on a thing won't fail

12:19 clgv: lol but clojure.lang.Sequential does not implement anything

12:19 raek: coll? works for clojure stuff

12:19 clgv: raek: I need it for clojure stuff only ^^

12:20 raek: clgv: what do you need to do?

12:20 is this for a macro?

12:20 clgv: yep

12:21 raek: seq? detects forms that look like (...), vector? those that look like [...], map? {...}, and coll? all three

12:22 clgv: I had the problem that I forgot that a macro can expand to a single atomic thing.

12:25 so always include an 'and in macro tests ^^

12:40 jonasen: dnolen: Have time for a core.logic question?

12:40 dnolen: jonasen: shoot

12:41 jonasen: Why is core.logic/prep private? Should I never need to use it?

12:42 loops: is there any way to do simple profiling in cl 1.3? the 1.2 contrib package doesn't seem to work any more. having hell of time finding performance problem.

12:43 jonasen: https://github.com/jonase/kibit/blob/master/src/jonase/kibit/core.clj#L22

12:43 dnolen: ^^ I'm using it here, but maybe there's a better way?

12:44 dnolen: jonasen: actually I'm not sure why it is private, probably an oversight.

12:45 jonasen: ok, I'll keep using it then.

12:46 jsabeaudry: of all the lein commands uberjar is by far my favorite, always makes me smile

12:47 technomancy: jsabeaudry: you're still using uberjar? I switched to "lein überjar"; it's so much better

12:50 jsabeaudry: technomancy, hehe, is ubejar officially deprecated in favor of überjar? ;)

12:50 technomancy: unofficially deprecated

12:50 überjar is the more precated of the two

12:51 mdeboard: precated

12:53 technomancy: nice; lein-precate is the #2 hit for precate on le goog

12:55 jsabeaudry: technomancy, Oh wow, not even a joke überjar does work! hahah great work

12:56 technomancy: jsabeaudry: next step is to upgrade to Leiningen to so "lein halp" works

12:57 *upgrade to Leiningen 2

12:59 mdeboard: Hm Weird.

12:59 Why does technomancy's umlaut U show up fine but I get an escape character with jsabeaudry

13:00 TimMc: technomancy: Clearly, I need to match that with uberjar-otf

13:01 raek: mdeboard: one of them uses utf-8 and one of them uses latin-1, probably

13:02 mdeboard: the IRC standard does not define which encoding should be used

13:02 mdeboard: ahh

13:02 ok

13:03 raek: good clients accept both and only output utf-8 :-)

13:03 mdeboard: Yeah, emacs sucks :-\

13:03 technomancy: I didn't expect it to be able to switch encodings on a per-line basis though; that's kinda cool

13:04 mdeboard: works for me here

13:04 llasram: ditto

13:04 mdeboard: obv I don't think emacs sucks.

13:04 12:55 <jsabeaudry> technomancy, Oh wow, not even a joke überjar does work! hahah great work

13:04 The umlaut u shows up at \374

13:04 s/at/as

13:04 technomancy: are you on a mac?

13:04 mdeboard: neg

13:05 ubuntu 11.10

13:05 technomancy: huh

13:05 mdeboard: emacs 24-something

13:05 I'm dumb.

13:05 jsabeaudry: It's funny cause I actually copy pasted from technomancy

13:05 mdeboard: Maybe you have latin-1 clipboard encoding or something.

13:07 TimMc: Your IRC client may do various curious things with the text on a per-message basis as well.

13:07 irssi has various charset munging options, for instance

13:08 mdeboard: Well, I'm using rcirc

13:08 jsabeaudry: mdeboard, Perhaps also Xchat, I'm using the encoding defines as : IRC(Latin&Unicode Hybrid)

13:38 doug: so i'm getting [{:id 20} ([1,2],[3,4],[5,6])]

13:38 but what i want is [{:id 20} [[1,2],[3,4],[5,6]]]

13:38 what's parens mean in that println output, anyways?

13:39 fliebel: doug: That it's a list instead of a vector?

13:39 &(map identity [1 2 3 4])

13:39 lazybot: ⇒ (1 2 3 4)

13:41 doug: totally

13:42 fliebel: PushbackReaders are weird. Why does Clojure use them?

13:43 AimHere: Isn't it a Javaism?

13:43 fliebel: &(type *in*)

13:43 lazybot: ⇒ clojure.lang.LineNumberingPushbackReader

13:43 doug: what's the best way to turn a list into a vector?

13:43 AimHere: vec?

13:43 fliebel: vec or vector, I'm confused

13:44 AimHere: vector, I think makes a vector of the arguments. vec makes a vector of the collection that's the argument

13:44 fliebel: AimHere: True, or the other way around, but I think you are right.

13:44 AimHere: ,(vec '(1 2 3))

13:44 clojurebot: [1 2 3]

13:45 tremolo: what's the accepted way to read a properties file in clojure 1.3? I can't seem to find any documentation on this.

13:45 fliebel: I just tried to unread a character, but it told me Pushback buffer overflow.

13:45 johnmn3: Is there a way in clj-webdriver to tell if the browser is currently loading or if it is finished loading?

13:46 fliebel: tremolo: Just a file with properties, or are you referring to a specific format?

13:46 joegallo: (doto (java.util.Properties.) (.load (input-stream XXX))) should work, yes?

13:46 tremolo: fliebel: the standard 'ole java properties file

13:47 there used to be clojure.contrib.java-utils/read-properties

13:47 fliebel: tremolo: What joegallo said.

13:47 tremolo: joegallo: cool, thanks

13:47 joegallo: np

13:48 TimMc: ~contrib

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

13:48 fliebel: How can I tell the size of the pushback buffer?

13:48 TimMc: Hmm, maybe I'll volunteer to maintain that lib.

13:50 technomancy: TimMc: java-utils got split up into a bunch of other libs

13:56 TimMc: technomancy: Ah, in that case I should poke the maintainer of that page. :-)

13:59 fliebel: $source *in*

13:59 lazybot: Source not found.

14:00 RickInGA: I am working through an example using noir, and I keep getting "unable to resulve symbol form-to"

14:01 I am using hiccup.core…

14:01 ibdknox: RickInGA: you need to do (:use [hiccup.form-helpers :only [form-to]])

14:02 RickInGA: haha, now I will need to find text-field, but that is progress, thanks

14:02 ibdknox: it's in the same namespace

14:02 just add it after form-to

14:03 RickInGA: ibdknox I tried using hiccup.form, has it always been form-helper?

14:03 bhenry: ibdknox: i'm having trouble with a defpartial line https://gist.github.com/35a6605d2b9e5c3fb8ea

14:03 ibdknox: RickInGA: yes

14:04 bhenry: RickInGA: it's changing to just form with the latest version

14:04 zamaterian: loops, I can recommend criterium for benchmarking functions

14:04 RickInGA: bhenry ah, that explains the documentation I found

14:05 ibdknox: bhenry: not sure I understand the issue?

14:05 bhenry: ibdknox: i don't know what the error means

14:05 ibdknox: it's not in noir

14:06 it's in whatever you're using for your models

14:06 but

14:06 the issue is likely that id is a string, not an integer

14:06 try doing (Integer. id)

14:06 bhenry: i've verified that (get-by-id id-string-from-noir) works.

14:07 ibdknox: I see

14:07 bhenry: i added a print statement and it prints the thing just fine. oh i might know!

14:07 brb

14:07 ibdknox: can you put the full stack up?

14:08 bhenry: ugh. i've been stuck on this way too long, but i got it.

14:08 ibdknox: what was the issue?

14:09 bhenry: i missed that get-by-id was returning a list of one thing not the one thing

14:09 ibdknox: ah

14:09 that'd do it :)

14:09 bhenry: yep. face palm for sure.

14:09 ibdknox: that stuff happens all the time

14:10 usually it's typo'd keywords lol

14:10 RickInGA: and I have a webpage…. thanks again for help

14:10 ibdknox: np :)

14:10 * TimMc strongly types ibdknox's keywords

14:10 TimMc: There. Fixed.

14:10 rafael: Is there a way to get fully expanded symbols and macros as an argument to a macro (or expand from within, but using the caller namespace) ?

14:10 ibdknox: sweet

14:11 Luke: I'm having an issue where i'm defining a function and then trying to call it on the next line down and it's saying source isn't available. I'm using slime to compile it and confirm it gets bound to a variable. any ideas why it'd bind correctly and then claim the source isn't available on the next line?

14:11 ibdknox: TimMc: could just make a map that blows up when you try to get a key that doesn't exist

14:11 raek: Luke: how did you load the code?

14:12 did you load the whole file with C-c C-k or just a single form with C-M-x?

14:12 TimMc: rafael: You already get the fully exapnded symbols.

14:12 raek: you only get line numbers in the first case...

14:13 TimMc: you do?

14:13 TimMc: rafael: Why do you need to expand the body of the macro inside the macro?

14:13 raek: Oooh, maybe not...

14:13 ibdknox: macros aren't expanded

14:13 raek: rafael: you can call resolve on the symbol

14:13 TimMc: I'm thinking of syntax-quote.

14:13 ibdknox: ~guards

14:13 clojurebot: SEIZE HIM!

14:13 rafael: TimMc, I'm writing a await style macro that rewrites code but it only works on special forms

14:14 I need the code in special forms so I can transform it

14:14 Luke: raek: single expression with C-x-e

14:14 raek: Luke: ok. reload the whole file using C-c C-k or (require '... :reload) in the repl to get line numbers

14:15 Luke: cool it's throwing an error now - thanks

14:15 rafael: raek, but in the caller namespace/context ?

14:16 ibdknox: rafael: if you rewrite the code to resolve it, yes

14:17 rafael: ibdknox, but how can I access the macro invocation context

14:17 ibdknox: not sure I understand the question.

14:17 Your macro will replace the current code in the current context

14:18 so if your replacement includes resolving the symbols there, they will be resolved in context

14:18 Noir unfortunately does this for url-for

14:18 though I intend to remove that

14:19 raek: rafael: why do you need to namespace qualify the symbols?

14:19 rafael: say I'm in namespace foo and I call macro from bar, when I call the macro it will get the symbols but I want the symbols to be qualified for namespace foo because I need to analyze a few special symbols in bar namespace and I need to know how that namespace is called in foo

14:19 raek: what do you mean by special forms?

14:19 rafael: clojure special forms, let/fn/do, etc. primitives I can analyze and not macros like doseq

14:21 raek: do you want to recognize if a symbol means something defined in bar?

14:21 rafael: for eg. I have following symbols defined in async namespace and in async I have a variable await-one, and a macro defasync, when I call defasync from namespace user I need to know when the defasync is. I also need to fully expand the macros that are passed to defasync and for that I need user namespace context

14:22 lol I confused my self with that ignore that

14:22 ibdknox: this discussion would benefit from code to look at :)

14:22 rafael: anyway I'll look around the code it's to hard to explain with my inglish :)

14:23 raek: I still don't understand why you need to expand the symbols

14:23 rafael: wait a sec till I mock up a snippet :)

14:23 raek: usually you do it the other way around: you macro generates code that is injected into an unknown context. therefore your generate code should only contain namespace qualified symbols

14:23 ibdknox: it takes some pretty hardcore code rewriting to do async

14:24 mdeboard: full penetration programming

14:24 raek: but you determine which symbols are in the lexical scope where the macro is expanded by looking at the keys of the map which the "magic" variable &env is bound too

14:25 (defmacro ... [...] ... (keys &env) ...)

14:26 and you can use resolve to lookup which var or class a symbols refers to (if it is not a local)

14:26 the macro body is evaluated in the namespace where the macro is expanded

14:26 rafael: raek, thank you very

14:26 very much &env is what I've been looking for

14:26 raek: now I still have no clue about what you are trying to do... :-)

14:27 ibdknox: he's trying to yield the thread I'm assuming

14:27 rafael: ibdknox, yeah, similar to C# async/await

14:27 ibdknox: took a lot of work in C# compiler to make that happen :) It *should* be easier in Clojure

14:27 it relied very heavily on the iterators stuff that came with LINQ

14:27 rafael: ibdknox, my thoughts exactly

14:28 ibdknox: the design meetings for that were interesting

14:28 some bad ideas got thrown around for how async should look in code lol

14:30 rafael: ibdknox, such as ?

14:31 raek: (defmacro ... [...] ... `(let [f# (fn [ctx#] (let [{:keys ~(vec (keys &env))} ctx&] ...), context# ~(zipmap (map keyword (keys &env)) (keys &env))] (f# context#)) ...)

14:31 seems like you can use &env to split a piece of code into multiple parts, and still retain the lexical context...

14:33 Luke: anyone here use Incanter and know how to put random labels in the legend of a chart? Specifically the R^2 value of a regression?

14:34 ibdknox: rafael: some pretty invasive changes that required walking the stack up to modify all callers, it was worse for VB

14:34 in the end it came out really well

14:34 gtrak`: oo, is someone making async for clojure?

14:35 mdeboard: what

14:35 ibdknox: unfortunately it came a bit late for us to do all the debugging stuff we wanted to do

14:36 I wonder if you could do such a thing client-side in JS with hackery around timers

14:39 rafael: I think in clojure I can get away by transforming special forms to continuation passing and leverage the closure/shadowing in the language - doesn't seem to require anything fancy - but I only started thinking about this a few days ago and just started writing it, here is a very early version of the event library - I've rewritten it since but it's still conceptually the same https://github.com/rubber-duck/miqpl/blob/master/clj/src/miqpl/observable/c

14:39 ore.clj

14:39 https://github.com/rubber-duck/miqpl/blob/master/clj/src/miqpl/observable/core.clj

14:40 osa1: is there a find function to search in arbitrary data structures with a custom test function?

14:42 something to use instead of (first (filter ...))

14:48 joegallo: (first (filter ...)) is a pretty common idiom

14:48 sometimes some is better, but often it's not

14:48 ibdknox: you could potentially use something in clojure.walk

14:49 depending on what you're doing

14:49 that's only useful if there's depth

14:51 osa1: ibdknox: hmm I think clojure.walk can help. I'm searching some keys in a xml data parsed with clojure.xml

14:51 ibdknox: oh

14:51 you should use the xml zipper stuff

14:51 dunno where that ended up though

14:53 osa1: ibdknox: do you mean this https://github.com/clojure/data.zip/blob/master/src/main/clojure/clojure/data/zip/xml.clj ?

14:53 ibdknox: yes

14:53 xml1-> is what you want

14:55 osa1: ibdknox: what should I add to my project.clj to use this?

14:55 ibdknox: not sure :)

14:56 there may not be an official release yet

14:56 osa1: http://mvnrepository.com/artifact/org.clojure/data.zip/0.1.0

14:57 org.clojure/data.zip 0.1.0

14:57 uvtc: Hi #clojure. For installing Clojure on your system for general use, which makes the most sense:

14:57 a. Download and put the clojure.jar file somewhere safe. Create a small script to give you a repl (with nice working command history and working arrow keys).

14:57 b. Use `lein new tinkering`, `cd tinkering`, `lein repl`

14:57 jsabeaudry: Anyone aware of a tool (in bash or something similar) that will prefix any command I type with something, for example I need to make a lot of "curl foo.bar/baz?cmd=[something]" And I would like to simply type [something][enter] [something][enter]

14:57 uvtc: c. or both of the above?

14:57 osa1: ibdknox: thanks

14:58 raek: uvtc: b will be easiest once you need libraries. also check out the "lein run" command and the lein-oneoff plugin

14:59 zamaterian: jsabeaudry, can't you make an alias ?

14:59 jsabeaudry: zamaterian, yes exactly, except I want the alias to be nameless

14:59 uvtc: Hi raek. Yes, I see that it certainly *would* be the easiest. When I first encountered Clojure, I went and did choice "a" above. Now that I've learned about choice "b", choice "a" seems not very necessary.

15:00 I thought I'd ask here though, in case I'm missing something.

15:00 raek: uvtc: you can run "lein repl" outside project too. then you get the version of clojure leiningen happens to use

15:00 technomancy: uvtc: jark is supposed to address that too, but it's still pretty immature

15:00 raek: if you need to control the version, or add dependencies, you need a project anyway

15:01 TimMc: technomancy: Yeah, last time I tried to use it, it just made "yo momma jokes" and exited.

15:01 ibdknox: technomancy, TimMc: wish it weren't ocaml.. I'd help then

15:01 technomancy: ibdknox: well if it were C it would keep me from helping

15:01 zamaterian: jsabeaudry, hmm I would probably make a bash script that takes a input from std-in and uses the value in calling curl and exits on ctrl-d

15:01 technomancy: so it's a wash =)

15:01 ibdknox: haha

15:02 uvtc: Ok then. Thanks. Will stick with just using lein with lein repl instead of going through the rigamarole of creating little scripts in my ~/bin. Thank you.

15:03 And will advise other newcomers to do the same.

15:03 jsabeaudry: zamaterian, Oh, didn't know that was possible, thanks for the pointer I'll read up on bash scripting!

15:05 zamaterian: jsabeaudry, http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_08_02.html

15:07 uvtc: Is this the correct spelling for adding a contrib lib to my project.clj (using algo.generic as an example): `[org.clojure/algo.generic "0.1.0"]`?

15:08 seancorfield: anyone else seeing problems with clojuredocs.org? the search box shows the busy / searching icon but no results are displayed

15:09 uvtc: I got the version string by clicking on the "Tags" link at the lib's github page. Is that the customary way of finding out that version string?

15:09 raek: uvtc: yes. you can use "lein search algo.generic" to find out these things

15:09 y3di: lazybot logs stuff???

15:09 lazybot: y3di: Yes, 100% for sure.

15:09 y3di: woahhh

15:09 raek: uvtc: no, usually this should be written clearly in the readmme

15:10 seancorfield: uvtc: this page has all the links http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

15:10 eggsby: why might a piece of code work fine in the lein repl but fail on 4clojure?

15:10 :(

15:10 raek: but some documentation for libraries forget to mention it

15:10 seancorfield: eggsby: define "fail" - 4clojure has restrictions on many tests

15:10 mdeboard: eggsby: A whole host of reasons. What is the error message you get

15:11 eggsby: You are either failing your tests, or using a forbidden function

15:11 eggsby: 'You failed the unit tests.' -- problem 41 -- my "solution" : http://hastebin.com/hofocotepo.clj

15:11 Raynes: 4Clojure is pretty heavily sandboxed for one. Sometimes there are things that fail for no good reason in the sandbox while they work in the REPL.

15:11 eggsby: http://www.4clojure.com/problem/41 works fine in the lein repl for the given examples

15:11 Raynes: Not much can be done about it though.

15:11 Wow, hastebin sure does put that code high up.

15:12 eggsby: Guess I'll just try to find a better method, mine felt hackish anyhow :p

15:12 uvtc: seancorfield, Thanks. I see that I can search for any of the contrib libs at http://search.maven.org and see not only their group id/name, but also their latest version.

15:13 raek: updating the search index used by lein search takes a looong time

15:13 took about half an hour last time I did it :(

15:13 uvtc: raek, hehe ... yes, mine's still running.

15:13 raek: but it is super-convenient once it's done

15:13 uvtc: raek, but I'm happy to use search.maven.org.

15:14 jsabeaudry: zamaterian, Awfully simple but so convenient for my needs right now: http://pastebin.com/ZJxdkYk7

15:14 uvtc: Why are the contrib libs listed at search.maven.org, yet, I'm not finding most of them listed at clojars?

15:14 Raynes: Because they aren't on clojars.

15:14 raek: uvtc: yeah, that one and clojars.org is the two most important places to look at

15:15 Raynes: Contrib libs are put in maven central -- not clojars.

15:15 uvtc: Hm. Somehow I got the idea that clojars was for libs written in Clojure, and search.maven.org for those written in Java...

15:15 Raynes: But Leiningen looks in both places for libraries.

15:15 uvtc: Raynes, ah, right. Thanks.

15:16 raek: uvtc: in general, that's the case. but the official clojure stuff uses maven and maven central for some reason

15:17 uvtc: raek, Got it. Thanks.

15:17 emezeske: raek: Probably because maven has code-signing, etc, while clojars does not (yet)

15:21 TimMc: That's a good reason.

15:21 * emezeske agrees.

15:23 raek: creepy! I used "lein repl" outside a project and when i did (ns foo) ... (ns bar (:use foo)) a line with the text "hello" appeared in the repl...

15:23 turned out I had a file called foo.clj with the contents (println "hello") in my home directory...

15:23 Licenser: raek sneaky ^^

15:23 raek: thought I was beining hacked for a while there...


15:24 </haskell>

15:24 Licenser: callen doesn't hasel have use?

15:25 callen: ...

15:25 . . .

15:25 uvtc: raek, http://xkcd.com/742/

15:26 Licenser: teehee

15:27 Chousuke: gah wtf

15:27 I got a message from github notifying me of an ssh key vulnerability and then managed to knock my keyboard down so that the message disappeared and is nowhere to be found

15:28 callen: Chousuke: they're whining about homakov. I wouldn't worry.

15:28 uvtc: Chousuke, they want you to visit https://github.com/settings/ssh/audit .

15:29 callen: lol, I have way too many.

15:29 Raynes: Chousuke: ^ Approve those keys and you should be good to go.

15:29 raek: I would have assumed haunted rather than hacked.

15:31 Chousuke: okay, thanks

15:31 zamaterian: jsabeaudry, nice :-)

15:36 jsabeaudry: Where is a safe place to shutdown-agents, is there a way to specify some kind of destructor on my :main ?

15:39 joegallo: just right there are the end of your main function

15:40 (hopefully after you've turned off all the things your application was going that are useful)

15:41 s/going/doing/

15:41 dgrnbrg: hello clojurians

15:41 I was wondering what the best way is to take an infinitive sequence and remove duplicates, but to have the duplicate cache only extend for 1 second

15:41 chouser: Hello!

15:42 jsabeaudry: joegallo, Will that still be executed if I Ctrl-C the application?

15:42 dgrnbrg: hello chouser!

15:43 chouser: so if the sequence is consumed more slowly than one element per second, the cache will never have more than one item in it?

15:43 dgrnbrg: I have a watch service on a filesystem

15:43 joegallo: no, it won't. but in that case you're terminating the jvm anyway, so what difference does it make if the agents are shutdown or not?

15:43 dgrnbrg: to know when to reindex files

15:43 but some editors (like vi) generate 100 FS events when you open a file

15:43 I only want one indexing event to show up

15:44 chouser: are there timestamps on the events?

15:44 dgrnbrg: System/currentTimeMillis

15:44 jsabeaudry: joegallo, Somehow the JVM is not terminated when I Ctrl-C my application

15:44 dgrnbrg: perhaps I could use a pair where one element is the timestamp, and then round that timestamp to the nearest unit, and just use distinct?

15:44 does that seem reasonable?

15:45 chouser: that might work, but the distinct cache will grow forever

15:45 dgrnbrg: That won't work, then

15:45 so, there are an unbounded number of timestamps

15:46 but the actual keys that I'm trying to reduce the frequency of are bounded to easily fit in memory

15:46 chouser: hm

15:46 cmiles74: I'm working on a webmachine-like framework for building REST APIs. Does anyone find that interesting? I'm wondering if it's worth talking to my employer about throwing it out on Github.

15:47 joegallo: jsabeaudry: maybe i'm wrong about that, then

15:47 dgrnbrg: cmiles74: I don't know what that means, but I think that open sourcing when possible is always good

15:47 cmiles74: dgrnbrg: :P

15:47 chouser: so if you have a map of keys to timestamps, you could easily tell if a new event for a key came enough later than what was in your map to let it through as a new event.

15:47 dnolen: cmiles74: I take it you looked at clotheline at one point?

15:47 clothesline I mean

15:47 cmiles74: dnolen: I did, but it really looks like it's been abandoned.

15:48 dgrnbrg: chouser: that gives me an idea

15:48 cmiles74: dnolen: It also looks... I don't want to sound picky, but maybe a little over-engineered.

15:48 dgrnbrg: i'll write a rate-limit function

15:48 which is like distinct, but it expires keys

15:48 perfect :)

15:48 dnolen: cmiles74: yeah I don't think KirinDave works on it actively.

15:48 cmiles74: did you avoid all of the stuff around building protocols and defaults?

15:49 cmiles74: dnolen: I did, that was one of my goals.

15:49 zamaterian: jsabeaudry, java has shutdownhooks : http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)

15:49 dnolen: cmiles74: cool, does it perform pretty well in comparison to clothesline?

15:49 cmiles74: I think KirinDave was really invested in working with Clothesline from regular Java code, I'm not so interested in that.

15:49 dnolen: cmiles74: ah yeah, and Scala I think.

15:49 cmiles74: Right now it works, performance is the next thing I have to tackle.

15:50 dnolen: I need to do some load testing and get some numbers together. I pretty much just have a working state machine and enough code around it to work with Ring.

15:51 dnolen: cmiles74: sounds cool, I haven't messed around with Webmachine or Clothesline enough to have much of opinion, but I'm sure there are people that will find it useful.

15:51 cmiles74: dnolen: That's my hope. :) It really does sound like Clothesline was the only thing out there.

15:51 Alright, sounds good. I'll finish it up and get it out there. :)

15:52 jsabeaudry: zamaterian, Thanks, I'll try that right away

15:53 cmiles74: Webmachine handles a lot of HTTP semantics that are easy to ignore when you just need to get a REST service out the door. I think it also makes it easier to do things in a relatively non-hacky way, like properly handle "accept" headers.

16:02 dgrnbrg: chouser--I wrote a nice little fn: https://gist.github.com/1996228

16:04 tmciver: cmiles74: I've been using

16:04 dgrnbrg: is there a macro like ->/->> that support sending a seq to 2 different piplelines?

16:04 tmciver: oop

16:05 rplevy: dgrnbrg: how would it work?

16:05 dgrnbrg: I have some infinite seqs of events happening in real time

16:05 and I want to route them down a few paths

16:05 tmciver: cmiles74: I've been using Clothesline in a project that I haven't been working on in a while, partly because Clothesline is tough to get my head around. I'd definitely be interested in what you've got.

16:05 dgrnbrg: I'm not sure what it'd look like, which is why I want to know if there's already a solution before I come up w/ my own

16:07 jsabeaudry: zamaterian, Unfortunately (.addShutdownHook (Runtime/getRuntime) (Thread. #(shutdown-agents))) does not seem to do the trick

16:10 Luke: anyone know how to select a point in incanter?

16:11 rplevy: say it was called -|> for example, maybe it would be (-|> something [(foo arg) (bar arg)] [baz quux] mary)

16:11 chouser: dgrnbrg: hm!

16:12 rplevy: We had some fun arrow macros we used at Akamai. I'm thinking of making a library with all possible creative arrows

16:12 I call it swiss-arrows

16:13 it's a quadruple subtle pun of some sort

16:13 chouser: how about (topic x (foo x) (bar a b x) (qux a x b))

16:15 dgrnbrg: I made one too. https://gist.github.com/1996279

16:15 aaelony: hi.... I'm using Incanter to read an excel file which normally works fine. A particular excel file however causes the read-xls function to throw a RuntimeException and stops. My attempts so far at try/catch-ing this exception, allowing it to continue don't seem to stick. https://refheap.com/paste/960 Any ideas welcome ...

16:15 rplevy: the diamond arrow is a useful one (-<> x (a <> b) (f2 a b <> c))

16:17 chouser: neat

16:27 chouser: dgrnbrg: using a mutable value inside a lazy seq like that is a bit scary.

16:27 your timestamps aren't assigned until something forces the lazy seq, of course

16:28 also if your input seq is chunked you might get dup keys close together in time from one chunk before the cache gets updated, therefore giving you incorrect results

16:28 it's a pity though, since your solution is so much more succinct.

16:30 amalloy: all those maps and filters with anonymous functions seem like they should be a `for` or two

16:32 something like https://gist.github.com/1996359 perhaps, dgrnbrg (though chouser is right about the mutable lazy stuff)

16:47 hiredman: reconn

17:01 dgrnbrg: chouser: sorry, I had a meeting…I am using this for filtering realtime seqs that are forced with a dorun at the end, so it works well :)

17:03 chouser: chunked seqs could still trip you up

17:06 amalloy: it's not very likely his input seqs are chunked though, if they're being generated in real time

17:06 uvtc: When someone mentions "array" wrt Clojure, they're probably referring to the fixed-size Java arrays, correct?

17:07 TimMc: yep

17:07 uvtc: Thanks, TimMc.

17:07 Scriptor: and clojure representations thereof

17:08 TimMc: Scriptor: ?

17:08 uvtc: Scriptor, can you tell me what you mean by a Clojure representation of a Java array?

17:09 Scriptor: uvtc: just how java arrays are used in clojure, didn't mean anything more than that

17:09 uvtc: Scriptor, Ah.

17:09 TimMc: Technically... they're JVM arrays :-P

17:12 napping: what did I break that in my project directory even lein help gives a java exception? A malformed project.clj?

17:13 technomancy: napping: with leiningen 1 sometimes sloppy dev-dependencies can cause that

17:13 try rm -rf lib

17:13 napping: looks like it really doesn't like a defproject with strings where symbols are expected

17:13 (defproject "my-project" ...) is bad

17:25 dgrnbrg: is there an idiomatic way to write (->> seqs interleave (partition (count seqs)))?

17:25 i.e. take N seqs and return a seq of vectors of N elts?

17:26 oh… is it (apply map vector seqs)?

17:27 napping: technomancy: is it time to switch to lein 2?

17:28 technomancy: napping: yes, but for unrelated reasons

17:28 napping: I noticed it was in the works a while ago, but it seemed to be marked experimental, and today I see 2.0.0-preview1

17:29 technomancy: I see you are paying close attention. =)

17:29 it's official now: https://groups.google.com/group/leiningen/browse_thread/thread/8d1451f49969a4d4

17:30 amalloy: dgrnbrg: yes, apply map vector (or list) is the best way to transpose

17:30 dgrnbrg: tahnks :)

17:32 technomancy: leiningen 2.0.0-preview1; give it a spin!

17:32 ibdknox: technomancy: congrats :)

17:33 technomancy: thanks

17:33 I'm excited

17:34 Raynes: I did most of the work.

17:34 technomancy: I thought you farmed that out to lazybot

17:34 ibdknox: http://i1.kym-cdn.com/photos/images/original/000/173/575/25810.jpg

17:35 lazybot is doing work for us now???

17:35 lazybot: ibdknox: How could that be wrong?

17:35 llasram: lein überalles

17:35 ibdknox: lol

17:36 Raynes: I wrote the javac task, the repl task, and the new task. That's like the whole thing!

17:36 ibdknox: I wrote some stuff

17:36 technomancy: oh crap, I forgot to mention javac in the NEWS file

17:38 Raynes: technomancy: NOOOOOO!

17:39 technomancy: I'm going to blame it on your trailing whitespace.

17:39 * technomancy assigns Raynes git precommit-hook homework

17:39 Raynes: Haha

17:39 Lajla: Raynes, my love

17:39 let us worship His Shadow together

17:39 Raynes: technomancy: Sometimes Vim seems to turn off my trailing whitespace stuff.

17:40 I don't know why, but I rarely notice when it does.

17:40 lucian: that sucks, it's worked for me for a long time

17:40 TimMc: ibdknox: Yeah, it's great -- I got lazybot to upgrade my leiningen plugin for me.

17:40 ibdknox: TimMc: sweet

17:41 Raynes: there's something in VIM for that?

17:41 napping: looks like the jack-in plugin now requires a hostname

17:41 task, rather

17:41 Raynes: ibdknox: Yes. janus has listchars set so that it highlights trailing whitespace.

17:41 ibdknox: ah

17:42 duck1123: is there a reason lein precate drops the artifactId from my project?

17:42 brehaut: technomancy: the new site looks great

17:43 duck1123: previously I had net.kronkltd/jiksnu and it just outputted net.kronkltd

17:43 technomancy: brehaut: thanks! it's the first web design I've done since 2008

17:43 Raynes: ArtifactIds are for wimps.

17:43 technomancy: duck1123: ouch; definitely a bug

17:43 duck1123: can you file an issue?

17:43 brehaut: technomancy: you avoided eye searing yellow, or low contrast - the nerds shouldnt get too angry ;)

17:44 technomancy: brehaut: I tried to make it not-too-obviously-twitter-bootstrapped =)

17:44 ibdknox: brehaut: are you saying people hate colors? ;)

17:44 brehaut: ibdknox: some people :P

17:44 ibdknox: some people like Raynes

17:44 ibdknox: dude

17:44 Raynes: Your blog. It burns me.

17:44 ibdknox: screw Raynes, he smells bad, I hear

17:45 Raynes: technomancy: Bootstrap has some cool stuff I've noticed. I'll probably steal some stuff for refheap.

17:45 ibdknox: You smelled like San Francisco sewage and earthquakes at the conj.

17:45 napping: Do I need to reinstall plugins?

17:45 brehaut: i havent looked at bootstrap yet

17:46 ibdknox: Raynes: what's wrong with that? ;) lol

17:46 Raynes: napping: You don't install plugins in the same way now.

17:46 duck1123: I love bootstrap, but you can really tell when a site is using it

17:47 Raynes: napping: https://github.com/technomancy/leiningen/wiki/Upgrading

17:47 napping: lein2 doesn't have a plugin task, so I'm not sure what to do besides having {:user {:plugins [[swank-clojure "1.4.0"]]}} as .lein/profiles.clj

17:47 Raynes: Yes, that's what you're supposed to do.

17:48 * brehaut quietly curses django magics

17:49 Raynes: brehaut: You should obviously be using FW/1

17:49 technomancy: napping: it's [lein-swank "1.4.3"] rather than swank-clojure

17:49 * ibdknox goes to the guards.

17:50 brehaut: Raynes: JSPs

17:50 ibdknox: fuck it. Do it in perl.

17:50 brehaut: CGIs in C++

17:50 ibdknox: real men use assembly to write websites.

17:50 amro: real men use netcat to run webservers in realtime

17:51 ibdknox: I have a telephone patch board that I use to connect routers to my server

17:51 TimMc: ibdknox: You're going to wear out those guards.

17:51 Raynes: I process HTTP responses in my mind and render HTML directly into my retinas.

17:52 ibdknox: TimMc: They were at lunch, didn't want to disturb them. Man's gotta eat.

17:52 brehaut: websites? gopher is the future

17:52 TimMc: wob...sits?

17:53 Raynes: If your project has three hyphens in it and one of them has 'clj' behind it, you need to be more creative.

17:53 napping: what about the emacs mode?

17:53 now the main error seems to be Wrong number of arguments to jack-in task.\nExpected ()

17:54 * brehaut starts renaming clj-library-of-functions

17:55 amalloy: brehaut: you're safe, that clj is in front of the hyphens

17:55 brehaut: oh, phew!

17:56 Scriptor: at least lein no longer throws an exception for staring a name with clo or ending with ure

17:56 TimMc: aw

17:58 napping: lein2 help jack-in has a line Arguments: ([port]), is that reasonable?

17:59 technomancy: napping: can't repro here; it takes one arg as it always has

17:59 stepping out but will be back to help debug in a few

17:59 napping: It's fixed now

18:00 duck1123: man, I have a bad feeling I'm going to end up forking and patching plugins tonight

18:00 napping: I'd left an extra hostname in clojure-swank-command from trying to use the swank-clojure that demanded a hostname

18:01 duck1123: So is the lein2 profile made available to the application in any way?

18:07 napping: I'm wondering why some errors end up as naked java stack traces

18:20 technomancy: duck1123: the profile name is not exposed, only the values in it

18:20 duck1123: IMO exposing the profile name would be a leaky abstraction

18:21 duck1123: I've already patched 7 or 8 plugins FWIW

18:21 picked the most popular ones according to clojuresphere

18:22 emezeske: technomancy: did you run a local copy of clojuresphere so that you could see some recent data on that?

18:23 technomancy: emezeske: I ran a local copy of clojuresphere for other reasons, but not for that

18:23 emezeske: heh

18:23 I still can't quite bring myself to run a local copy just for up-to-dateness

18:25 ibdknox: could put another version up on heroku and just make it update more often?

18:26 emezeske: s/often/ever

18:26 It's a manual job right now

18:27 ibdknox: manual in what sense?

18:27 emezeske: Oh, just in that someone needs to run a script I think

18:27 Just not cronified

18:27 ibdknox: mm

18:28 technomancy: next time you see jkkramer on here, bug him about it

18:28 or get him to collab you into the app

18:28 emezeske: I poked him a couple of times, and emailed

18:28 ibdknox: and nothing?

18:28 emezeske: Yeah

18:29 It's not a big deal to me, I just like complaining ^_^

18:29 technomancy: =(

18:29 emezeske: It would be less of a deal if github's search feature didn't suck

18:29 the-kenny: technomancy: Let's say I have lein-swank in profiles.clj. Is there a nice way of making clojure-jack-in work? It doesn't select the :user profile by default.

18:29 technomancy: emezeske: once I get a chance to revamp clojars we'll just move clojuresphere features over there anyway

18:29 emezeske: technomancy: I think that's gonna be so great

18:30 technomancy: the-kenny: I don't understand; the :user profile is active unless you select another profile using the with-profiles task

18:30 maybe you found a bug?

18:30 emezeske: technomancy: I might be interested in helping with that, depending on timing and other random factors

18:30 technomancy: emezeske: clojars is next up on my plate now that the lein2 preview is out

18:30 so once the dust settles I'll put a detailed plan out

18:30 emezeske: great!

18:31 * ibdknox goes to look at the clojars code

18:31 technomancy: my focus is going to be 0) make it easier for others to run their own clojars instances for hacking 1) add a releases-only repository and 2) adding other features in order of priority

18:31 ibdknox: it's pretty messy, and it's a fair bit of work to get a dev instance up

18:32 the-kenny: technomancy: Huh, strange. Works now without me changing anything.

18:32 technomancy: which is the #1 priority

18:32 emezeske: "releases-only" being a repo without all the random org.clojars.emezeske et al?

18:32 the-kenny: Sorry for bothering you :)

18:32 ibdknox: eww

18:32 lol

18:32 technomancy: emezeske: I haven't decided what the policy will be on forking

18:32 but it'll be less of a mosh pit

18:32 emezeske: nice

18:33 Before I had much of a handle on clojure stuff, the mosh pit was a bit overwhelming

18:33 Well, it still is

18:34 technomancy: it's amazing we've gone so long with what we have

18:34 https://github.com/ato/clojars-web/graphs/impact

18:35 callen: emezeske: I'm still waiting for my brain to unfuck itself. I find performing arbitrary transformations on data to be a cognitive overload yet.

18:35 technomancy: development basically ceased in November of 2010

18:35 emezeske: callen: ^_^

18:35 callen: technomancy: better than the constant flux and ADHD-churn of the Ruby community.

18:39 napping: I think I've asked this before, but there's no easy way to decide you don't like the state of some refs and block until they change, is there?

18:39 technomancy: you could do it with a watcher function

18:40 (let [block (promise)] (add-watch my-ref (partial deliver block)) @block)

18:40 need another arg to add-watch, but you get the idea

18:41 amalloy: technomancy: that doesn't look reliable

18:41 i guess if you don't mind re-blocking when your watcher goes off but someone else's watcher cancels the state-change

18:41 technomancy: amalloy: because it'd fire the watcher if a transaction committed the same value back to the ref?

18:41 tomoj: anybody else gotten this lein error on new install? https://gist.github.com/59bee42de1c93f340f50

18:42 napping: I'm missing retry and orElse from Haskell's STM

18:42 amalloy: technomancy: similar problem, yes

18:42 technomancy: tomoj: what's your profiles.clj look like?

18:42 callen: I'm missing reassignment :(

18:42 tomoj: technomancy: in ~?

18:42 technomancy: tomoj: ~/.lein/profiles.clj

18:43 tomoj: don't have one

18:43 napping: callen: maybe you haven't tried evilly enough

18:43 tomoj: brand new machine, just installed java, dropped lein on the path

18:43 technomancy: tomoj: ok, what's project.clj look like?

18:43 tomoj: heh.. don't have one

18:43 technomancy: wat

18:43 tomoj: maybe this is just what happens when you run `lein`?

18:44 napping: . o (defn badfun [y] (def acc y) (def acc (+ acc y)) acc)

18:44 technomancy: well bugger that

18:44 tomoj: yeah, seems to work fine when I actually try to use it

18:45 :)

18:45 napping: callen: expect that to break horribly, but I can't guarantee it actually will

18:45 technomancy: tomoj: looks like a bug when running outside a project dir

18:46 napping: technomancy: I'd worry about whether calling add-watch from within a transaction works properly

18:46 technomancy: napping: well don't trust my word on refs; I've basically never used them

18:48 napping: it seems to end up calling a synchronized method of ARef that tosses things on a list of watchers

18:49 callen: napping: I'm intentionally avoiding buttfucking myself with def or var.

18:49 napping: I'm forcing myself to stay within the constraints more or less outlined by immutability.

18:49 napping: var seems to be surprisingly well behaved, actually

18:50 callen: that's true of most aspects of Clojure though.

18:50 I expected it to be a lot more wild west when I first started using it...eh. No.

18:50 napping: I suppose you could abusing bindings or something, but in general vars don't seem to threaten purity

18:50 callen: more stable in a few years than nearly two decades of Ruby

18:51 in terms of language semantics, tooling, community, etc.

18:54 technomancy: tomoj: fixed; thanks for the heads-up

19:45 phil_: is there a way to somehow autoinclude macros in clojurescript?

19:47 i.e. say i have a namespace xxx and macros in xxx-macros, can i somehow require xxx-macros whenever i require just xxx?

19:53 ibdknox: phil_: no

19:53 at least not currently

19:54 aperiodic: i think i found a bug in await-for's docstring

19:54 phil_: ibdknox: thx

19:55 ibdknox: ,(doc await-for)

19:55 clojurebot: "([timeout-ms & agents]); Blocks the current thread until all actions dispatched thus far (from this thread or agent) to the agents have occurred, or the timeout (in milliseconds) has elapsed. Returns nil if returning due to timeout, non-nil otherwise."

19:55 aperiodic: it says it returns nil if it timed out, but it seems to return false in that situation

19:55 ibdknox: ,(source await-for)

19:55 clojurebot: Source not found

19:57 * zakwilson gets out his pitchfork. ibdknox, you around?

19:57 ibdknox: oh god

19:57 * ibdknox sprints

19:58 zakwilson: Hehe. It looks like Korma doesn't use prepare in calls to select and probably other stuff. It seems like that might be a good idea.

19:58 ibdknox: in calls to select?

19:59 zakwilson: e.g. (select thing (where {:created_at [< (clj-time.core/now)]}))

19:59 and then some prepare exists on thing that converts the jodatime object to the right type

20:00 ibdknox: it would be nice, but it would require an immense amount of work

20:01 the problem is that those get compiled down to strings of statements

20:01 * zakwilson lights a torch. You're not doing anything important for the next month, are you?

20:01 ibdknox: haha

20:01 muhoo: zakwilson: i'm sure he accepts patches :-)

20:01 ibdknox: it seems like in general, a coercion mechanism would be better

20:01 zakwilson: muhoo: but I AM doing important things for the next month!

20:01 I thought that's essentially what prepare and transform were intended to be.

20:02 ibdknox: basically, and they wouldn't go away

20:02 but I don't think anyone ever wants sql timestamps

20:02 as an example

20:02 or how often do you really want big decimals?

20:02 zakwilson: I'm not even using SQL time types. I have the time stored in miliseconds as a bigint.

20:03 ibdknox: ah

20:03 sure, but you could write a global coercion in your case from joda to bigint

20:03 zakwilson: In one project because I needed dates farther in the past than Postgres could handle, and in another because I had these nice prepare and transform functions from the other project.

20:04 ibdknox: haha

20:04 yeah

20:04 zakwilson: A global coercion? I'm... not sure I know what you mean.

20:04 ibdknox: basically anytime korma sees a jodatime it would transform it into blah

20:05 a bigint in your case

20:05 and you'd be able to say if you see this type, run this function

20:05 zakwilson: Well... yes, that would allow me to extinguish this torch. Where are the docs for that?

20:05 ibdknox: I didn't say it existed :p

20:06 * zakwilson starts heating a bucket of tar. I see.

20:06 ibdknox: it wouldn't be too hard to add though

20:06 aperiodic: so i don't really understand the await-for source, but https://refheap.com/paste/964 is why I think the docstring is mistaken

20:06 i get that behavior under both 1.2 and 1.3

20:06 zakwilson: And select *does* call my transform, so the other side is taken care of (I don't necessarily want every bigint to become a DateTime)

20:06 callen: well that's never comforting. I just installed something in homebrew and saw "geocities.jp" for one of the source tarballs.

20:07 ibdknox: zakwilson: yeah, like I said, both would have to exist

20:07 so that you can do the right thing selectively

20:07 muhoo: does geocities even exist? or is it still 1996?

20:07 zakwilson: Right. I understand. So, if I want to deliver code to my client in an hour (did I mention I'm using Korma in production?)... what would be the best approach?

20:07 ibdknox: seems like a good entry project for someone interested in Noir

20:08 zakwilson: convert it in-place

20:08 * zakwilson gathers some feathers. Right. Got it.

20:08 ibdknox: (select blah (where {:client-ts [> (->bigint stuff)]))

20:09 technomancy: heh; homebrew

20:09 tmciver: The bottom of the docstring for xml-> (https://github.com/clojure/data.zip/blob/master/src/main/clojure/clojure/data/zip/xml.clj#L56) mentions zip-query.clj. This file does not appear to be a part of data.xml. Anyone know what this is referring to?

20:09 amalloy: $javadoc java.util.concurrent.CountDownLatch await

20:09 lazybot: http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/CountDownLatch.html#await()

20:09 technomancy: amalloy: did you see my awesome juxt use on the mailing list?

20:09 ibdknox: tmciver: probably copied from the old contrib

20:10 zakwilson: So if I were to have a beer or five and write a contribution to Korma that does the global coercion you talked about, what do I need to know to get started?

20:10 amalloy: heh, i hadn't yet

20:10 technomancy: ,(apply = ((juxt read-string symbol) "symbol name"))

20:10 clojurebot: false

20:11 technomancy: to determine whether a given string is a round-trippable symbol name

20:11 tmciver: ibdknox: hmm, there is a zip.clj in data.xml but it doesn't appear to have any example code as the docstring suggests. I'll look at the original contrib lib. Thanks.

20:11 ibdknox: zakwilson: most of the work would revolve around exec, you'd need to walk the return for things to swap and walk the params of the query to swap

20:12 technomancy: "I don't often reply to Clojure mailing list threads, but when I do it's usually using juxt."

20:12 tmciver: ha!

20:12 technomancy: oh, I guess the other juxt was on the seajure list

20:12 brehaut: bets on how long until raynes posts the macro on twitter

20:12 technomancy: whatever

20:13 zakwilson: ibdknox: alright, that gives me a place to start looking. I'm going to finish up the client work, drink a bit and then attempt to contribute to your project. If it doesn't work out, I'm going to drink more and try again.

20:13 amalloy: ((juxt read reply-to) thread) - my reply doesn't depend on the content returned by read

20:13 ibdknox: haha

20:13 zakwilson: good luck ;)

20:15 technomancy: my other juxt used mapcat though: (def all-intervals (mapcat (juxt up down) base-intervals))

20:18 callen: production code using juxt?

20:19 technomancy: no, just a mailing list sample

20:19 though I've used it in production for sure

20:19 brehaut: these days geni's production code is probably 50% juxt

20:20 technomancy: brehaut: the parts that aren't fibonacci generation, sure

20:20 only two juxts in leiningen, and one of them is just separate =\

20:20 brehaut: technomancy: did you make up for it with judicious use of comp and partial?

20:21 rafael: OK so right after I did lein self-install with v2 preview (rm ~/.lein -rf and ~/bin/lein, download lein 2 to bin/lein do lein self-install that finishes OK) I get this exception : https://refheap.com/paste/965

20:21 technomancy: brehaut: 14 partials; only 2 comps

20:22 brehaut: respectable

20:22 you dont want to go wild with the comps

20:22 technomancy: rafael: yeah; just fixed that; in the mean time do echo "{:user {:profiles []}}" > .lein/profiles.clj

20:24 sorry; should be echo "{:user {:plugins []}}" > ~/.lein/profiles.clj

20:24 rafael: technomancy, yeah I figured out it works tnx :)

20:25 ibdknox: technomancy: I see you're a contributor to quil?

20:25 technomancy: ibdknox: I had some commits to clj-processing way back in the day

20:25 grandfathered in, I guess

20:25 ibdknox: ah

20:27 I assume sam is doing music + visualization?

20:27 or rather, that's the goal

20:28 technomancy: reasonable to asume

20:28 ibdknox: that could be fun :D

20:28 aperiodic: amalloy: seems to me from that javadoc that await-for returns true if the actions succeeded, and false if it timed out. if so, what's the process for getting that fixed? file a JIRA?

20:32 amalloy: probably

20:33 aperiodic: alrighty

20:37 heh, there's been a JIRA open for this issue since august

20:46 stirfoo: Why does (identical? 'x 'x) return false? More to the point, why do symbols with the same name *have* to be unique instances? Is it because of attached meta data?

20:47 technomancy: stirfoo: yeah, line/file metadata

20:47 dakrone: is there a trick to getting cheshire to encode persistentqueues?

20:48 dakrone: technomancy: I don't think it supports that yet, totally forgot about that, I'll add it (or you can use custom encoding)

20:48 technomancy: no worries; I'll take a look at the custom encoding

20:48 just got caught off guard porting this from clj-json

20:50 stirfoo: technomancy: Ok. Actually I've been trying to figure this out for 15 minutes, and meta data just occurred while I was typing that question.

20:51 I've been digging into Clojure's source. The reader is highly entertaining to look at.

20:51 technomancy: that wouldn't be my recommended starting point, but have fun =)

20:52 napping: ,(meta 'x)

20:52 clojurebot: nil

20:54 stirfoo: ,^"metadata":keyword

20:54 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>

20:55 napping: is there metadata on symbols?

20:55 stirfoo: and there is why (identical :foo :foo) => true

20:55 technomancy: dakrone: does this look reasonable? (cheshire.custom/add-encoder clojure.lang.PersistentQueue cheshire.custom/encode-seq) (cheshire.core/encode clojure.lang.PersistentQueue/EMPTY)

20:55 stirfoo: napping: yes

20:55 napping: the interned var has line/number metadata

20:55 stirfoo: but not keywords

20:55 ibdknox: stirfoo: keywords are interned

20:55 napping: it is possible to have metadata on symbols

20:55 technomancy: because it asplodes =(

20:55 napping: but again, (meta 'x) => nil

20:56 ,(do (def y) (meta #'y))

20:56 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

20:56 napping: identical? tests object identity, so just not interning symbols would be enough

20:57 dakrone: technomancy: that *seems* correct

20:57 technomancy: curious

20:57 dakrone: technomancy: I can't look at it at the moment (hackfest), but I will tonight

20:58 unless I pass out

20:58 technomancy: sure; I'll just fall back to clj-json for now

20:58 good luck

21:00 dakrone: technomancy: (╯°□°)╯︵ ┻━┻

21:00 technomancy: haha; that was not a guilt-trip attempt for the record =)

21:02 ibdknox: I need that ascii-art as a system wide abbreviation lol

21:04 technomancy: necessarily

21:17 mdeboard: Speaking of ascii art, I need a good ascii visualization of how zippers work.

21:17 As in clojure.zip

21:19 duck1123: So is lein2 not using the global exclusions list any longer?

21:21 seancorfield: clojuredocs.org still seems to be broken (search) for me...

21:29 TheBusby: dakrone: that's from this http://bit.ly/A7uYAI

21:47 * qbg just wrote a macro that creates a function that returns a function that returns a function.

21:48 Rekcuflluks: But does qbg worship His Shadow?

21:48 qbg: I had to define 4 manual gensyms

21:49 The macro is a factory factory

21:49 Rekcuflluks: qbg, but do you worship His Divine Shadow?

21:50 qbg: no comment

21:50 duck1123: no comment? donate your liver

21:50 amalloy: qbg: i just put on /ignore anyone who mentions worshipping shadows, on the assumption that it's Lajla with another new nick

21:51 Rekcuflluks: I agree

21:51 organ donation should be compulsory

21:51 It's kind of sad to spend your whole live on some machine because not enough organs are available.

21:51 If you can force people to pay taxes for the common good, you can force them to surrender their organs after death honestly.

21:52 TimMc: qbg: I hope you named it UntypedValueFactoryFactoryFactory

21:53 qbg: To be precise, a constructor factory

21:54 duck1123: But how do you get an instance of that? Better make a factory to be safe

21:54 qbg: It isn't for Java, so I'm safe

21:55 A factory isn't safe enough. You got to use config files

21:55 mdeboard: C C

21:55 qbg: xml config files, to be precise

21:56 emezeske: Better create a template for those XML files, to automate their creation

21:56 qbg: ... exposed as a SOAP service

21:56 The wsdl is generated using xslt

21:57 duck1123: I feel ashamed that I once wrote XQuery scripts to produce a XSLT document that would transform more XML into a XForms document that served as my page

21:58 qbg: duck1123: I was just joking, but that is just wrong.

21:59 duck1123: to be slightly less (or more) insane, that XForms document was then turned into HTML+JS

22:02 zakwilson: Let it be known that I hate Ring stacktraces.

22:03 Rekcuflluks: duck1123, my page is an RDF/XML document that gets XSLT't to an SVG+JS document?

22:03 Do I count?

22:03 * Rekcuflluks worships His Shadow.

22:04 TimMc: duck1123: I once tried to make an XSLT sheet to display XSLT files...

22:05 qbg: Oh, and this should all conform to... what's that standard that no one knows what it means?

22:05 qbg: I don't know, but it has to run on IBM WebSphere

22:06 duck1123: I had all of the HTML, RDFa, XForms, XSLT, etc all XSD validated and properly autocompleting with Oxygen. These days I'd just use emacs.

22:10 technomancy: duck1123: there should be global exclusions support, but I'm not sure it extends to plugins

22:11 duck1123: I have a dependency that uses slf4j-nop that I normally have excluded, but when I try to run with lein2 I get slf4j conflicts

22:12 technomancy: hm; can you open an issue

22:12 ?

22:13 duck1123: sure. I'm going to see if I can reproduce it on a minimal project. I'm having other issues building

22:13 technomancy: thanks

22:19 qbg: Thanks to my crazy macro, my code is ~100x faster!

22:20 This is why Java needs macros

22:22 duck1123: figures, the bad dependency comes from the library I use written by the guy I work with. I can bitch him out directly.

22:25 qbg: My persistent memory tables for core.logic are actually about twice as fast as the currently existing rels!

22:26 Actually, about the same

22:27 duck1123: technomancy, I can't seem to get it to reproduce, so I'll keep an eye on it and see if I can get it to happen in a simpler project

22:36 ztellman: qbg: if you're really trying to benchmark, use https://github.com/hugoduncan/criterium

22:36 otherwise it's pretty much guesswork

22:38 qbg: ztellman: Will do

22:39 Right now I'm just running the target function in a loop a ton of times to get a good average

22:41 ztellman: qbg: fwiw, I've found the quick-bench macro is just as accurate for micro-benchmarks and takes about 1/60th the time

22:42 qbg: The JVM is actually taking some time to warm up these loops

22:43 ztellman: well, I'm not sure exactly what you're testing

22:46 qbg: A small logic program

22:48 johnmn3: anybody have experience with clj-webdriver?

22:49 trying to find out if there's a way to detect whether the browser is still loading a page or not

22:51 also, I'm looking for something like (find-it b {:value "some text on the page"}), which returns the xpath of the enclosing attribute.

23:02 gtuckerkellogg: how can I count the number of truthy elements on the left side of a list

23:03 technomancy: what's the left side of a list?

23:04 gtuckerkellogg: what i want to do is something like (map true? '(true true true false false))

23:04 except I want to get a count of the number of true elements on the left

23:04 so if the list is '(true true false true) I'd like to return 2

23:05 johnmn3: (count (take-while true? '(true true true false false)))

23:05 I think

23:05 gtuckerkellogg: ,(count (take-while true? '(true true true false false)))

23:05 clojurebot: 3

23:06 gtuckerkellogg: ,(count (take-while true? '(true true true false false true)))

23:06 clojurebot: 3

23:06 gtuckerkellogg: dang

23:08 johnmn3: gtuckerkellogg: you just wanted the ones on the left, correct?

23:10 gtuckerkellogg: yeah, but i'll want to do something analogous on the right

23:10 what i'm trying to do is "pad" a list on both ends

23:10 every time I ask a question I realized what a noob I am :)

23:11 mdeboard: Isn't it glorious gtuckerkellogg

23:11 gtuckerkellogg: it is

23:11 mdeboard: ,(count (drop-while false? '(true true true false false false)))

23:11 clojurebot: 6

23:11 gtuckerkellogg: every answer is a bright light on my ignorace. It's fantastic!

23:12 mdeboard: weird

23:12 johnmn3: dropwhile true

23:12 xeqi: ,(false? 'false)

23:12 clojurebot: true

23:13 mdeboard: orite

23:13 johnmn3: ,(false? false)

23:13 mdeboard: sleep

23:13 clojurebot: true

23:13 mdeboard: ,(sleep forever)

23:13 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sleep in this context, compiling:(NO_SOURCE_PATH:0)>

23:13 johnmn3: ,(System/exit 0)

23:13 clojurebot: #<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)>

23:13 johnmn3: sorry :/

23:13 mdeboard: hahaha

23:48 tmciver: Is there a way to make swank-clojure aware of new libs that have been added to lib/ since it was started?

23:50 http://stackoverflow.com/questions/3383729/how-to-add-classpath-with-emacs-slime-conjure seems to say that if you started swank with 'lein swank' then you simply drop the new jars in lib. I 'clojure-jack-in' and this does not work for me.

23:51 technomancy: you have to restart

23:51 Raynes: tmciver: If you've added libraries, the JVM has to be restarted.

23:52 Unless you do crazy classpath hacks that just aren't worth it.

23:52 tmciver: Oh allright.

23:52 Thanks

23:52 Is it true that if you 'lein swank' you don't have to restart?

23:53 I figured 'clojure-jack-in' was starting swank in a similar fashion to 'lein swank'.

23:54 technomancy: no, you have to restart either way

23:55 dreampeppers99: hey you guys, I would like some help :)

23:55 I have a given sequence

23:55 '(1 2 51 44 66 77)

23:56 theconartist: and you want the highest value

23:56 dreampeppers99: and I would like to sum all the odd index elements

23:56 not, it's the odd index elements

23:57 I know i can filter a seq based on its elements using a predicate but to filter based on index i don't idea of the best way.

23:58 Do you guys have any idea how to do it? Am I clear in my explanation?

23:58 technomancy: ,(doc keep-indexed)

23:58 clojurebot: "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects."

23:59 dreampeppers99: cool, i'm gonna take a look!

23:59 thank you !

23:59 technomancy: ,(apply + (keep-indexed (comp odd? first list) [1 2 3 4]))

23:59 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number>

Logging service provided by n01se.net