#clojure log - Aug 16 2012

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

0:31 jlewis: amalloy: lo and behold, the guy who wrote clj-ds rewrote PersistentHashMap.iterator to make it iterative instead of recursive... and broke it!

0:31 can't reproduce the problem with the original iterator

0:31 really scary... it like *mostly* works, until you have hundreds of megabytes in your map, and suddenly it barfs

0:40 wmealing_1: sounds like fun

1:52 tomoj: anyone seen errors like this in cljs on node? https://www.refheap.com/paste/55b6635602282be89a3013d59

1:52 goog.global.goog.debug is set

1:53 (by goog.provide('goog.debug.Error'))

1:53 but 'goog' does not refer to the same thing as 'goog.global.goog'

1:53 so goog.debug.Error = ... fails

1:53 in whitespace mode

1:54 I have clojurescript head on a source-path

1:55 oh

1:55 http://dev.clojure.org/jira/browse/CLJS-101

1:56 ..first result for the obvious thing to google

2:18 ro_st: so, what do we all use for logging? :-)

2:29 zeromodulus: oy, I really want to use clojure, but I run into so many problems it's discouraging. :(

2:31 can't figure out how to install tagsoup with leiningen

2:33 I don't want to use ruby, but looks like I'll have to. v.v

2:33 ro_st: what do you want to do with tagsoup?

2:34 tomoj: http://search.maven.org/#search%7Cga%7C1%7Ctagsoup

2:34 [org.ccil.cowan.tagsoup/tagsoup 1.2.1]

2:35 er

2:35 Cr8: I really like Jsoup, which is in central, so you can pull it in with just [org.jsoup/jsoup "1.6.3"]

2:35 tomoj: [org.ccil.cowan.tagsoup/tagsoup "1.2.1"]

2:40 Cr8: (map #(.attr % "title") (.select (.get (org.jsoup.Jsoup/connect "http://en.wikipedia.org/")) "#mp-itn b a")) ; List of titles of wp news headlines

2:42 ro_st: ah, there's also enlive

2:43 Cr8: https://github.com/cgrand/enlive/ yes

2:44 ro_st: googling for clojure logging is giving me plenty of old hits (contrib comes up often).

2:44 anyone know of a newer clojurey approach to logging that's as awesome as the rest of the ecosystem?

2:45 found this, so far

2:45 https://github.com/malcolmsparks/clj-logging-config

2:46 Cr8: I think I saw this on the list recently: https://github.com/ptaoussanis/timbre

2:46 ro_st: ahh there we go

2:48 thanks Cr8!

2:48 Cr8: np :)

2:55 magopian: do you know any (very cool) company that uses clojure and who might recruit?

2:55 i'm thinking something like github for rails

2:58 hyPiRion: http://thinkrelevance.com/jobs

3:00 alexey: magopian: I work for such company; we are not recruiting at the moment but probably will be later in the autumn.

3:00 magopian: thanks hyPiRion

3:00 alexey: what's the name?

3:00 alexey: magopian: to avoid advertising, sent as private message

3:00 magopian: oh ok sure ;)

3:02 hyPiRion: alexey: That's a strange policy for a company.

3:02 "We do not like advertising!"

3:02 alexey: Nah, it's not the policy of the company

3:02 ro_st: he's respecting irc etiquette

3:02 alexey: I didn't want to spam the channel :)

3:03 wmealing_1: respect

3:03 which country ?

3:03 alexey: Finland

3:07 ro_st: South Africa, here

3:07 we just hired a guy

3:08 can't say we're like github, though. he's programmer #3 :-)

3:12 magopian: ro_st: it's not the number i was comparing to (the number of employees)

3:13 but more the "feeling"

3:21 ro_st: right

3:24 magopian: ro_st: proof: in 5 years, _none_ of the employees at github have left

3:24 that must mean something, right?

3:24 ro_st: i know

3:25 i saw Zach speak at scaleconf, and i spoke with at the github sponsored beers after the conf as well

3:25 we're trying to set ourselves up the same way

3:27 magopian: ro_st: excellent ;)

3:59 ro_st: how do i pprint to a string instead of to *out* ?

4:00 magopian: ro_st: there's a pr-str command

4:00 wait

4:00 ro_st: aha! with-out-str

4:01 magopian: http://clojuredocs.org/clojure_core/clojure.core/pr-str

4:01 there's quite a few different options actually ;)

4:02 ro_st: i'm after pretty printing at the moment

4:02 a content format we have is moving from xml to plain clojure

4:07 blackdog: trying to benchmark my noir hello-world app for sanity, and i'm getting apr_socket_recv: Connection reset by peer after 3-10 requests. any ideas what i might have wrong?

5:04 clgv: lpetit: ping?

5:34 noidi: what's a nice way to check if a collection contains every item in another collection?

5:35 (xxx [:foo :bar] [:foo :bar :baz]) => true, (xxx [:foo :bar] [:foo :baz]) => false

5:36 babilen: noidi: Convert both to sets and compare those comes to mind ... Or should do you want (not= [:a :a :b] [:a :b]) => true ?

5:37 s/not=/xxx/ :)

5:38 ro_st: ,(doc some)

5:38 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

5:38 noidi: babilen, yeah, maybe sets could do for this case

5:39 some returns true if, well, _some_ of the needles are found in the haystack. i want to know if _all_ needles were found :)

5:39 babilen: noidi: Bad approach though performance wise and you could terminate as soon as you find one element that is not in the other collection ...

5:41 mduerksen_: noidi: there is a clojure.set/subset? function for your use-case, but only if its ok that (clojure.set/subset? (set [1 2]) (set [1 2])) => true. this means that you have to turn your collections into sets, so you will have to decide if thats okay for you performancewise

5:41 babilen: ,(every? #{:a :b} [:a :b])

5:41 clojurebot: true

5:42 babilen: noidi: That ^^ still requires that you convert one coll into a set, but should be idiomatic.

5:42 noidi: huh? that works! :)

5:42 now I have to think for a bit WHY it works :)

5:42 thanks!

5:43 ah, that reads exactly how it needs to work

5:44 for every item that I'm looking for, make sure it's found in the given collection

5:46 babilen: ,(list (#{:a :b :c} :x) (#{:a :b :c} :c))

5:46 clojurebot: (nil :c)

5:46 babilen: noidi: That might help when you want to understand it ^^^ -- Another common idiom is &(#{:a :b :c} [:a :b :x :y :x])

5:46 DrPheltRight: cr

5:46 babilen: noidi: Err, make that % (remove #{:a :b :c} [:a :b :x :y :x])

5:47 noidi: yeah, I'm use (some #{...} ...) often

5:47 but it didn't occur to me to use every? that way :)

5:48 it's probably because I'm so used to using `some` that way

5:49 so it didn't occur to me to place the things that I'm looking for last, as a seq, and the collection in which to look first, as a set

5:50 babilen, thanks again, that's a useful trick to know!

6:04 hyPiRion: Another neat trick is the some-fn

6:04 ,(filter (some-fn integer? string?) [1 2 :foo 2.0 "string"])

6:05 clojurebot: (1 2 "string")

6:10 hyPiRion: hm. ##(filter #(<= 0 (.indexOf [1 5 "foo"] %)) [1 2 "foo" 3 4 5 "bar" "baz"])

6:10 lazybot: ⇒ (1 "foo" 5)

6:16 nbeloglazov: &(doc int?)

6:16 lazybot: java.lang.RuntimeException: Unable to resolve var: int? in this context

6:16 hyPiRion: integer

6:16 &(doc integer?)

6:16 lazybot: ⇒ "([n]); Returns true if n is an integer"

6:16 nbeloglazov: Just checked

6:20 $(source integer?)

6:20 &(source ingeter?)

6:20 lazybot: java.lang.RuntimeException: Unable to resolve symbol: source in this context

6:20 nbeloglazov: &source integer?

6:20 lazybot: java.lang.RuntimeException: Unable to resolve symbol: source in this context

6:20 nbeloglazov: :(

6:21 hyPiRion: ,(source integer?)

6:21 clojurebot: Source not found

6:21 hyPiRion: I think it's clojailed.

6:21 Either that, or jar'd, so that it's unavailable.

6:23 clgv: $source integer?

6:23 lazybot: integer? is http://is.gd/BopmnQ

6:24 clgv: but that task needs an update

6:38 is there already an equivalent for clojure.contrib.repl-utils/show? last time I checked there was not... :(

6:43 hyPiRion: clgv: What did it do?

6:43 clgv: hyPiRion: print all methods of a given object/class

6:43 with argument infos etc

6:47 well, I guess I port it to one of my tool libs

6:47 hyPiRion: Yeah, the source's available, so why not.

7:24 clgv: needs a bit of rework though. there is some weird code in there ;)

7:48 ludston: Is there a setting to kill the *SLIME Compilation* buffer after an errorless compile?

7:49 hyPiRion: C-b "*Sl" TAB C-x k RET ?

7:49 ludston: Good one.

7:49 lol

7:50 hyPiRion: You could probably just make a binding yourself, it seems easier.

7:50 ludston: I'll try that then

7:51 hyPiRion: It doesn't seem like the most standard way of working with Slime though. Is there any reason why you would like that feature?

7:53 ludston: Because it jumps up and takes over my repl if I have errors, and then doesn't go away again when I don't need it any more

7:54 s/repl/buffer

7:54 hyPiRion: oh

8:01 ivaraasen: anyone here read "Effective Java" by Joshua Bloch?

8:05 antifuchs: hugod: I'm just peeking at ritz again, and I notice you've changed the RPC code structure (:

8:05 nbeloglazov: ivaraasen: I have. What is the question?

8:05 antifuchs: hugod: is rpc.clj responsible for both swank and nrepl now?

8:44 ivaraasen: nbeloglazov: would you recommend the book to a CS student? I've only skimmed through a couple of chapters. seems to promote a semi-functional style, at least immutability.

9:05 Cheiron: Hi, I have a clojure application that uses Hector Cassandra library. I decided to extract Hector code into its own lein project. Clojure code still require subproject code but to make it possible?

9:07 nbeloglazov: ivaraasen: Yes, I would recommend it. Of course if you're using java. It has many nice advices and tricks

9:09 hugod: antifuchs: I haven't really changed rpc.clj at all - it is solely for the swank protocol

9:09 antifuchs: ah, great then (:

9:09 hugod: nrepl is handled by pulling in the nrepl lib

9:09 antifuchs: I'm currently hacking on the swank-clojure rpc, but should be straightforward to port anyway

9:10 hugod: they are essentially the same

9:11 antifuchs: ritz.nrepl provides a nrepl server that can run a debugger

9:11 antifuchs: cool

9:23 so, um. is there anything re. object identity I'm missing when my tests fail with:

9:23 actual: (not (= (:keyword "string") (:keyword "string")))

9:23 that looks the same to me, and the REPL returns false when I try to eval this (quoted)

9:26 Chouser: ,(= (:keyword "string") (:keyword "string"))

9:26 clojurebot: true

9:26 Chouser: what do you mean, "(quoted)"?

9:27 ,(:keyword "string")

9:27 clojurebot: nil

9:27 Chouser: ,'(:keyword "string")

9:27 clojurebot: (:keyword "string")

9:28 hyPiRion: The result should be false, no?

9:28 ,(not (= (:keyword "string") (:keyword "string")))

9:28 clojurebot: false

9:29 hyPiRion: ,(not (= nil nil))

9:29 clojurebot: false

9:31 magopian: ,(not= nil nil)

9:31 clojurebot: false

9:34 ludston: ,(def who-is-awesome 'ludston)

9:34 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

9:34 ludston: Sadface.

9:34 Sweden_jack: Ouch

9:37 augustl: got a Java object with a .getCount() and .getItemAtIndex() type API that I want to list in a clojure vector. What are good ways to do that?

9:37 I'm thinking something like making a lazy sequence that is capped at .getCount() and then map that lazy sequence

9:39 ro_st: you know you work for the right people when they love Rich Hickey's talks just as much as you do

9:41 augustl: (map fn... (range n)) seems good

9:45 hyPiRion: augustl: Could you use iterator-seq or enumerator-seq?

9:48 ludston: ,(loop [damn-your-insulting-ways true] (recur damn-your-insulting-ways))

9:48 clojurebot: Execution Timed Out

9:48 ludston: Mwhahahaha

9:48 hcastro: does anyone know how to prevent the return value of -main from printing to stdout?

9:48 hyPiRion: I can make you more awesome, ludston

9:48 (inc ludston)

9:48 lazybot: ⇒ 1

9:49 ludston: (def imnotsureibelieveyoubutokletstrythiscouldgetburnedbutwatchoutbois true)

9:49 ,(def imnotsureibelieveyoubutokletstrythiscouldgetburnedbutwatchoutbois true)

9:49 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

9:50 ludston: (inc ludston)

9:50 lazybot: You can't adjust your own karma.

9:50 ludston: Awwww

9:50 hyPiRion: &'(inc ludston)

9:50 lazybot: ⇒ (inc ludston)

9:50 hyPiRion: ,'(inc ludston)

9:50 clojurebot: (inc ludston)

9:50 lazybot: ⇒ 2

9:50 hyPiRion: loophole

9:50 ludston: This is the best day ever.

9:50 ,'(inc ludston)

9:50 clojurebot: (inc ludston)

9:50 lazybot: ⇒ 3

9:52 Fossi: yeah

9:52 the bots should ignore each other

9:53 i think one of them does

9:53 so you can't pingpong

9:53 hyPiRion: heh

9:53 ludston: It's probably impossible to get lazybot to put a comma down

9:53 Fossi: ah, lazybot also "escapes" by printing the arrow first

9:54 hyPiRion: &(prn "foo")

9:54 lazybot: ⇒ "foo" nil

9:54 ro_st: i want to sort a map by its keys. i have the keys in order in a vector. how would i do this?

9:54 ludston: ,(print ",(print 'blah')")

9:54 clojurebot: ,(print 'blah')

9:54 Chouser: &(prn (symbol ",") '(inc chouser))

9:54 lazybot: ⇒ , (inc chouser) nil

9:55 hyPiRion: heh.

9:55 nbeloglazov: ,(sort-by first {:b 1 :c 2 :a 3})

9:55 Fossi: foo ,(+ 1 1)

9:55 clojurebot: ([:a 3] [:b 1] [:c 2])

9:55 ludston: ,(print "&(print 'blah')")

9:55 clojurebot: &(print 'blah')

9:55 lazybot: ⇒ blah'nil

9:56 gfredericks: is it bad form for a library to (defmethod print-method <some common type> ...)?

9:56 hyPiRion: ro_st: You could do ##(sort-by #(.indexOf [:b :a :c] %) {:a 1 :b 5 :c 6})

9:56 lazybot: ⇒ ([:a 1] [:c 6] [:b 5])

9:56 ro_st: ahh indexOf

9:56 didn't realise i had to use a java call

9:56 thanks hyPiRion

9:57 trptcolin: :w

9:57 oops. sorry :)

9:57 hyPiRion: ,(println "&(prn :foo)")

9:57 clojurebot: &(prn :foo)

9:57 lazybot: ⇒ :foo nil

9:57 Chouser: that's going to search the vector many many times

9:58 hyPiRion: Yeah, it's O(n²)

9:58 multiplied by a log

9:58 Chouser: (map {:a 1 :b 5 :c 6} [:b :a :c])

9:59 You want vals or key/val pairs?

9:59 magopian: maybe you could build a new map

9:59 ludston: &(print (str '##' '(print "boo")')

9:59 lazybot: ⇒ (quote (print "boo"))

9:59 magopian: like Chouser said

9:59 gfredericks: ,(into {} (map-indexed list [:b :a :c]))

9:59 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>

9:59 magopian: well, nearly like he said ;)

9:59 ludston: &(print (str "##" '(print "boo")')

9:59 lazybot: java.lang.RuntimeException: Unmatched delimiter: )

9:59 Chouser: ,(map #(find {:a 1 :b 5 :c 6} %) [:b :a :c])

9:59 clojurebot: ([:b 5] [:a 1] [:c 6])

10:00 hyPiRion: Yeah, that's faster.

10:00 nbeloglazov: ,(doc find)

10:00 clojurebot: "([map key]); Returns the map entry for key, or nil if key not present."

10:00 Chouser: n log n instead of n^2 log n

10:00 magopian: nice ;)

10:00 hyPiRion: It would be better with keep though

10:01 ,(keep (partial find {:a 1 :b 5 :c 6}) [1 2 :b :a :c])

10:01 clojurebot: ([:b 5] [:a 1] [:c 6])

10:01 hyPiRion: ,(map (partial find {:a 1 :b 5 :c 6}) [1 2 :b :a :c])

10:01 clojurebot: (nil nil [:b 5] [:a 1] [:c 6])

10:02 Chouser: I guess it depends on whether or not you want to know about bad keys in your vector

10:02 gfredericks: ,(map-indexed (comp vec reverse list) [:b :a :c])

10:02 clojurebot: ([:b 0] [:a 1] [:c 2])

10:02 ro_st: not all keys in the vector are in the map

10:02 gfredericks: ,(into {} (map-indexed (comp vec reverse list) [:b :a :c]))

10:02 clojurebot: {:b 0, :a 1, :c 2}

10:02 ro_st: i just want the keys that _are_ in the map to be in the proscribed order

10:02 gfredericks: ,(zipmap [:b :a :c] (range))

10:02 clojurebot: {:c 2, :a 1, :b 0}

10:02 Chouser: ah, then hyPiRion's got it exactly right

10:03 cshell: sorted map?

10:08 Chouser: cshell: interesting idea.

10:08 robermann: In order to use the last ccw Eclipse plugin do I need to intall lein2 too, or lein1 is enough?

10:08 Chouser: ,(let [vec-order (zipmap [:b :a :c] (range))] (into (sorted-map-by #(< (vec-order %1) (vec-order %2))) {:a 1 :b 5 :c 6}))

10:08 clojurebot: {:b 5, :a 1, :c 6}

10:09 hyPiRion: It really depends on the vector and the map though.

10:10 Then again, all of these solutions are.

10:13 ro_st: if i have ([:a 1] [:b 2]) and i want {:a 1 :b 2}, it's (apply hash-map seq) right?

10:13 but that'll probably tear the sort up again

10:13 hyPiRion: try out the ordered-map

10:13 ro_st: will do

10:13 hyPiRion: It's not in core though.

10:14 Chouser: ro_st: not apply hash-map. You'd want (into {} the-seq), but yes that will lose any order you gave it.

10:14 ro_st: sorted-map-by? it is

10:14 trying that..

10:14 Chouser: apply hash-map is for when you have interleaved key/vals like [:a 1 :b 2]

10:15 hyPiRion: Oh, the anonymous fn is kind of bothersome.

10:15 Chouser: then name it? :-)

10:15 hyPiRion: ,(let [vec-order (zipmap [:b :a :c] (range))] (into (sorted-map-by (comparator vec-order)) {:a 1 :b 5 :c 6}))

10:15 clojurebot: {:b 5, :c 6, :a 1}

10:16 Chouser: hyperboreean: ah, nice.

10:16 wait, that's not what I thought comparator did

10:17 hyPiRion: $source comparator

10:17 lazybot: comparator is http://is.gd/dalGK8

10:18 Chouser: pred is called with two args

10:18 to compare

10:18 hyPiRion: It's more or less your anonymous function.

10:18 Chouser: you're supplying vec-order as the pred, but vec-order doesn't compare two args

10:19 but the return value of your example looks right. I'm trying to figure out why

10:19 hyPiRion: Oh, I see

10:20 ro_st: i'm trying to use [:a :b :c] as my vec-order

10:20 hyPiRion: ({:a 1 :b 5} 1 :b}

10:20 It's the optional argument at work.

10:20 ro_st: ah i need to zipmap

10:21 Chouser: at work hiding the mistake, yes.

10:21 ,(let [vec-order (zipmap [:b :c :a] (range))] (into (sorted-map-by (comparator vec-order)) {:a 1 :b 5 :c 6}))

10:21 clojurebot: {:b 5, :c 6, :a 1}

10:22 Chouser: wait, that still looks right

10:22 hyPiRion: try with [:c :a :b]

10:23 Chouser: oh, actually you original example returned the wrong order but I didn't catch it. *sigh*

10:23 [:b :a :c] returned {:b 5, :c 6, :a 1}

10:23 ok, so comparator isn't quite what is wanted here

10:24 hyPiRion: to put it mildly

10:24 Chouser: in fact I think comparator is never needed because fns do that automatically

10:24 TimMc: &(map (comp :added meta) [#'*' #'*])

10:24 lazybot: ⇒ ("1.0" "1.2")

10:25 antifuchs: yayy, almost got the most recent slime to connect

10:25 hyPiRion: Chouser: Oh, I think it's needed for java interop

10:25 Chouser: ,(.compare (fn [a b] (> a b)) 2 1)

10:26 clojurebot: -1

10:26 hyPiRion: ,(.compare > 2 1)

10:26 clojurebot: -1

10:26 hyPiRion: even

10:27 ro_st: so that works (sorted-map-by #(< (vec-order %1) (vec-order %2)))

10:27 Chouser: fn's implement java.util.Comparator and do something sensible when the fn returns boolean.

10:27 fbru02: i have a datomic question, simple one, let's say you got 2 peers and one value , peer one updates the value and keeps that cached in the machine, how does peer2 know that the value changed ?? is there a notification kinda thing ?

10:27 ro_st: now i'm trying to walk a nested graph of maps

10:27 (clojure.walk/prewalk (fn [x] (if (map? x) (sorter x) x)) mm)

10:28 would using sorted-map-by cause complications in doing this?

10:28 if i don't use the sorter fn in the postwalk (not a prewalk) it comes out just fine

10:29 hyPiRion: Chouser: So comparator isn't needed at all anymore, then?

10:29 ro_st: but as soon as i use sorter, i get Evaluation aborted. which is super helpful

10:30 fbru02: i believe the transactor is notified and the value only actually becomes available to everyone (including the source) process once the transactor commits

10:30 don't quote me on that, though :-)

10:31 fbru02: ro_st: oh i see , interesting that the source has to "wait" on the transactor , I guess that the transactor also has a list on which peers to notify on an update

10:32 Chouser: hyPiRion: I can't think why it would be, but maybe I'm missing something.

10:32 ro_st: i could be dead wrong. but based on my understanding of the talks and reading i've seen and done, the transactor is the only thing that does writes

10:32 which means that the only way to see new values is for the transactor to write it first

10:33 Chouser: hyPiRion: But it's been this way a long time: https://github.com/clojure/clojure/commit/67975cdedfa8a2f7780062cb67182aff32e7679e

10:33 ro_st: i don't think the transactor notifies peers; i think your app would write and forget about it, or continue to use the value it already has a reference to post-write, or write, and then requery, causing the data to be retrieved again

10:34 do visit #datomic, anyhow

10:36 robermann: any counterclockwise user here? I followed the installation instructions but the leiningen project created by the plugin is empty (no src folder). Is it correct?

10:37 fbru02: ro_st: thanks !

10:39 antifuchs: ok, so I have some local changes to swank-clojure that I want to try out. "lein run" doesn't work, and "lein swank" loads the mainline swank clj jar. how can I run my locally patched copy?

10:41 hyPiRion: Chouser: Well, thank you for clearing up what it does. I always though it was implemented as (fn [f] (fn [x y] (.compare (f x) (f y))))

10:43 dnolen: once again Yegge reveals that he never actually bothered to learn anything about Clojure ...

10:43 ro_st: dnolen: oh that is SOOOOOooo 24 hours ago -grin-

10:43 Chouser: hyPiRion: That would be a useful function, but I don't think it's in core.

10:44 zerokarmaleft: dnolen: again? what was the first time?

10:44 dnolen: ro_st: ? you mean 7 hours ago right.

10:45 ro_st: oh, has something new happened?

10:46 chouser and cemerick discussed it in the podcast, and they definitely didn't record and release it less than 7 hrs ago :-)

10:46 ivaraasen: dnolen: have you seen the survey based on part 1 of Yegge's essay?

10:46 dnolen: ivaraasen: yes

10:46 ro_st: https://plus.google.com/u/0/110981030061712822816/posts

10:49 ro_st: so he doesn't want to ask for 'permission'. i guess he should be using windows 98 then, where any app can use any app's memory

10:50 dnolen: ro_st: Clojure has atoms - his point makes no sense.

10:50 magopian: is yegge saying anything bad about clojure?

10:50 dnolen: ro_st: it even has unsynchronized mutables

10:50 magopian: sorry, i missed the beginning of the discussion (or the context ;)

10:51 dnolen: magopian: no he's not saying anything bad - he's just not saying anything that makes any sense.

10:51 magopian: haha ;)

10:51 wmealing_1: going senile ?

10:51 magopian: i like his talk on "how to market yourself" or something like that

10:51 s/like/liked

10:51 hyPiRion: dnolen: I thought his argument was that the language was liberal, but the community was not.

10:52 dnolen: hyPiRion: in some alternative universe where his points make sense ... maybe.

10:52 magopian: i still didn't find time to watch rich's last video

10:53 hyPiRion: dnolen: Yeah, it's a pretty confusing line of arguments.

10:53 ro_st: magopian: watch it. it's great

10:55 magopian: ro_st: i will, definitely

10:55 just need to carve out some time :/

10:55 ro_st: can do it audio-only

10:55 clojurebot: excusez-moi

10:55 magopian: hey, clojurebot is french speaking, nice :)

11:00 Chouser: Ah, here's where comparator was introduced, almost a year before AFn gained the ability itself: https://github.com/clojure/clojure/commit/ad7a155a4950c93dfdc8c7168b77e8f73dba7e1e

11:04 ro_st: hyPiRion, Chouser: thanks for the sort advice. i got it going with postwalk - the error was that the map had keys not in the sort vector

11:05 Chouser: ah! yeah, that could do it.

11:06 ro_st: clojure amazes me every day

11:06 i wonder what on earth i would have done with out it

11:06 and i don't understand why everyone isn't using it :-)

11:07 borkdude: ro_st enjoy a walk outside? reading a newspaper?

11:07 Chouser: borkdude: no, probably coding in Java.

11:07 ro_st: news?

11:07 Chouser: :-P

11:07 ro_st: ruby, probably. we were going to use rails for the backend but i just couldn't bring my self to 'rails new'

11:08 scriptor: borkdude: just implement your news reader in clojure

11:08 ro_st: then clojurebook came out and that was that #relief

11:09 Wild_Cat: Rails isn't so bad, from what I've seen.

11:09 (and on the Python side, Pyramid rocks)

11:09 blackdog: Wild_Cat: it very much depends on where you're standing:)

11:10 ro_st: too much magic. not composable.

11:10 Wild_Cat: I can't say much, though, I've never used Rails myself.

11:10 scriptor: I definitely got into django much faster than I did with rails

11:10 Wild_Cat: I suppose it has the same flaws as Django, though

11:10 blackdog: ro_st: also, not enough immutability. or types.

11:10 Wild_Cat: (seeing that Django started as a Rails clone)

11:10 scriptor: wasn't a fan of every tutorial starting with scaffolding

11:10 ro_st: blackdog: or any immutability :-)

11:11 scriptor: Wild_Cat: it did? they're very different

11:11 blackdog: ro_st: alter your type structure at runtime? Yessir, you're the boss...

11:11 ro_st: -grin-

11:11 Wild_Cat: scriptor: my history is kinda fuzzy, but I think so, yeah. Both are tightly-integrated and couple frameworks, heavily optimized for the use case of SQL-backed CRUD webapps

11:12 ...and both get more painful the more you deviate from that use case.

11:12 scriptor: Wild_Cat: true, but that also describes a lot of frameworks

11:12 Wild_Cat: fair enough :p

11:13 that's the thing I really like about Pyramid, to be fair: you can change the templating engine or the ORM with no effort.

11:13 ivaraasen: I went from Django to Flask myself. far more pleasant

11:13 blackdog: there is a real benefit to imposed standards, though

11:13 even if a particular approach is not the best thing from a technical perspective, it means that everyone's working the same vein

11:13 Wild_Cat: blackdog: oh, sure. And the important part is, Pyramid *does* provide sensible defaults that work out of the box.

11:14 but since I don't use a SQL database (I use DynamoDB with a custom mapper; another project here uses Mongo), I'm extremely glad I'm not forced into those defaults.

11:15 blackdog: sure, you need a variety of frameworks

11:16 Wild_Cat: I suppose my point is, sensible defaults are essential, but locking the user into them even when it makes sense is bad.

11:17 which, apparently, is also the approach taken by Noir, which is why I need to try it soon.

11:18 Chouser: Haha! The survey mentioned in the comments to Yegge's last post has a "favorite language" question, but Clojure is not an option.

11:18 clojurebot: Ack. Ack.

11:18 blackdog: really depends on what you're trying to do. you could make Rails general enough to handle the Mars rover, but it would probably not be a net win

11:18 Chouser: that post was almost uniquely annoying

11:21 magopian: nice to see there's also quite a few python coders around here ;)

11:21 ivaraasen: Chouser: notice how Yegge's supposed "liberal programmers" dominate every age group in the survey, with no linear relationship

11:21 magopian: blackdog: you were talking about the mars rover, do you mean it's programmed using clojure?

11:21 clojurebot: package.el is part of Emacs now: http://repo.or.cz/w/emacs.git/blob_plain/HEAD:/lisp/emacs-lisp/package.el

11:22 blackdog: magopian: nah, making a more general point about frameworks :)

11:22 magopian: ok ;)

11:22 i wonder what it's programmed with

11:22 blackdog: mars rover is all C

11:22 magopian: oh ok

11:22 blackdog: in a particularly punishing dialect

11:22 magopian: rootz ;)

11:23 jcromartie: ivaraasen: where's the survey?

11:23 weavejester: Are any Clojar admins around?

11:23 blackdog: magopian: there's a fascinating document on the style they programmed it in - it looks a lot like a simple messaging system like erlang, but without dynamic memory allocation

11:23 http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf

11:23 magopian: well, i can see why there would be no dynamic memory allocation ;)

11:24 thanks for the link

11:24 blackdog: really embarrassing to get an out-of-memory exception on mars:)

11:24 ivaraasen: jcromartie: http://sweaxis.org/

11:24 Chouser: ivaraasen: hm, sure enough.

11:24 ivaraasen: summary of the survey: http://sweaxis.org/stats/age

11:28 applying American political metaphors to software engineering sounds like a horrible idea right from the get-go

11:28 blackdog: ivaraasen: it's massively oversimplified

11:29 as is the political spectrum, which i suppose means it's quite a good analogy

11:29 antifuchs: yayyyyy, got a connection with latest slime from quicklisp and swank-clojure (:

11:29 scriptor: ivaraasen: how many people is that survey based on?

11:29 antifuchs: ivaraasen: applying them to anything including american politics is a horrible idea (:

11:30 ivaraasen: scriptor: based on 750 data points a couple of hours ago I think

11:30 scriptor: they don't completley fit american politics either

11:33 zerokarmaleft: http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf <= good grief, no malloc

11:34 blackdog: zerokarmaleft: a good idea, if you're restricted in ram and the cost of failure is high... :)

11:35 zerokarmaleft: blackdog: true, fascinating link

11:35 ivaraasen: zerokarmaleft: can't you just declare buffer sizes at compile time?

11:35 Chouser: maybe NASA didn't think of that. :-)

11:35 blackdog: ivaraasen: yes. they separate initialisation and runloop phases.

11:35 ivaraasen: interesting

11:36 blackdog: but for that, you don't need malloc anyway - if you know it statically, you can declare it as a stack variable

11:36 scriptor: I heard a lot of the C was generated as well

11:36 magopian: has anybody done the problem 82 on 4clojure ? it's a tough one, i believe i'm nearly there \o/

11:36 scriptor: anyone know with what?

11:37 ivaraasen: scriptor: Python I've heard

11:37 probably just a rumour though

11:38 Chouser: magopian: that's a relatively tough one. I enjoyed it.

11:45 magopian: Chouser: i am enjoyng it ;)

11:46 i'm just missing the "find all possible combinations of words" now ;) (and i know how to program it, just need to ;)

11:46 Chouser: did you solve all the problems?

11:46 Chouser: on 4clojure? Yes, but then they added more.

11:46 magopian: 147 it seems, out of the 151, excellent ;)

11:47 82 is my 131'th

11:47 still some work left :)

11:48 gtrak: anyone ever fixed a XSS issue with compojure? I have a jetty servlet cross-origin-filter, but the browser is choking because an OPTIONS request (part of the XSS handshake) returns 404.

11:52 TimMc: "XSS handshake"?

11:52 You're trying to enable CORS?

11:54 clojure-newcomer: hi guys… is it possible/easy to dispatch on regular expression matching with multimethods ? currently dispatch on string value, but would like more flexibility

11:54 gtrak: TimMc: yes

11:54 llasram: clojure-newcomer: With multimethods, you can dispatch on anything computationally possible :-)

11:55 gtrak: TimMc: it's really only for development at the moment... server running in a VM, JS on the windows host

11:55 clojure-newcomer: llasram: col

11:55 llasram: *cool even

11:58 zerokarmaleft: blackdog: someone needs to add Rule 32. Enjoy the Little Things to that document :D

11:58 dnolen: clojure-newcomer: that is not possible in a nice way.

11:59 clojure-newcomer: multimethods lets you match on values generated by the dispatch fns, but you can't really do any kind of general predicate matching.

12:00 llasram: dnolen, clojure-newcomer: Oh yeah, I may have misunderstood the question. I was envisioning the dispatch function applying a regex to the arguments and then using the match to emit a concrete dispatch value

12:02 clojure-newcomer: hmmm…. ok, will have to think of a way round this

12:03 llasram: clojure-newcomer: What are you trying to do?

12:04 clojure-newcomer: llasram: I'm dispatching originally based on a function passed in, but then switched to a request uri

12:04 llasram: wondering, can I get the symbolic name of a function as a string ?

12:04 llasram: then I will not need regular expressions etc

12:04 nelson-: hi, Anyone here using emacs-prelude with ac-slime?

12:05 I cannot get them to work properly, some completions throw Class not found exception

12:06 llasram: clojure-newcomer: Can you provide a concrete example? I'm not quite following :-)

12:06 clojure-newcomer: llasram: just wondering whether I can get the name of a function (or multi method) as a string ?

12:07 llasram: using meta or something

12:07 llasram: clojure-newcomer: Kind of, but it's almost certainly a bad idea

12:07 clojure-newcomer: llasram: oh… why ?

12:08 gtrak: looks like compojure isn't responding to OPTIONS requests, and there's no OPTIONS macro... so my 404 handler is catching it

12:09 llasram: clojure-newcomer: Makes your code harder to reason about while winding implementation-naming details together with external interface. There's cleaner ways of getting similar effects

12:09 At a higher level, do you have a concrete example of what you're trying to do?

12:10 clojure-newcomer: llasram: I see, increases complexity

12:10 llasram: I'm dispatching to negotiate API version, and content-type of response based on 'accept'

12:13 llasram: Accept defines a strict preference-priority, doesn't it? Is there a reason not to just have a map of content-type to response-function, then dispatch to the highest-priority type present in the map?

12:14 clojure-newcomer: llasram: yes, although I will need to ensure the version is correct for the response type I choose

12:15 llasram: Ok, so a map per API version, which just has the allowed types in it?

12:15 gtrak: .... how do I make compojure handle OPTIONS?

12:16 clojure-newcomer: llasram: I see… simplify down to simpler building blocks

12:17 llasram: clojure-newcomer: Yeah, hopefully :-). multimethods are very powerful, but not necessarily the best fit for all dispatch problems

12:39 antifuchs: is there a built-in thing in 1.2.1 that splits strings at a particular delimiter? I'd love to use clojure.string/split, but that name doesn't exist in 1.2.1 ):

12:40 technomancy: antifuchs: it was added in 1.2.0

12:40 antifuchs: odd!

12:40 I think I may have to experiment further

12:47 sooo, Caused by: java.lang.ClassNotFoundException: clojure.string

12:47 what does that mean? Do I have to include something special in project.clj?

12:48 raek_: antifuchs: I think you are doing something like (require clojure.string) instead of (require 'clojure.string)

12:48 antifuchs: ooh, it's not on the require list

12:48 raek_: unlike 'ns', 'require' is a function and not a macro

12:49 antifuchs: hanging it on the ns declaration did it.

12:49 thanks, raek ((:

13:03 rplevy: is anyone else getting an error when lein goes to fetch dependencies right now?

13:04 "Caused by: org.sonatype.aether.resolution.VersionRangeResolutionException: No versions available for org.clojure:clojure:jar:[1.2.1,1.3.0] within specified range"

13:05 llasram: rplevy: I saw on the mailing list that some maven central metadata seems to have gotten b0rked again

13:06 rplevy: booo

13:06 technomancy: huh, looks fine here

13:06 maybe a problem with a local mirror?

13:07 also: maybe it's time to host Clojure on clojars, because this is starting to become a regular occurrence. =\

13:08 rplevy: maybe it's been fixed and your cache has the busted metadata? can you try `lein -U deps`?

13:12 rplevy: hrrmm lein -U deps doesn't seem to help

13:14 technomancy: huh, just ran it on a fresh m2 here; works fine

13:14 does http://repo.maven.apache.org/maven2/org/clojure/clojure/maven-metadata.xml list all the correct versions for you?

13:14 (to rule out geographic mirror issues)

13:15 TimMc: gtrak: I think I remember someone asking about this in the past. Check the logs.

13:15 rplevy: I deleted my .m2 too...

13:15 gtrak: ok

13:15 I'm currently trying to hack it

13:16 but I don't quite understand how clout works, it's choking on the :options method

13:16 rplevy: technomancy: that file only lists version 1.2

13:17 technomancy: rplevy: looks like others on the mailing list are seeing it

13:18 rplevy: can you paste traceroute to repo.maven.apache.org along with a curl of the affected page?

13:20 redinger: We had a problem this morning with lein2 (not in lein1). Had to add sonatype back into our project.clj

13:20 technomancy: I'm going to publish it to clojars

13:20 this is just silly

13:25 rplevy: technomancy: https://gist.github.com/3371828

13:25 technomancy: http://clojars.org/repo/org/clojure/clojure/

13:25 rplevy: awesome

13:26 gtrak: TimMc: OK, got it, turns out you can put regular functions in under defroutes... and compojure calls 'some' to find the first one that returns a truthy response, so, just a standard ring-handler does the trick

13:35 technomancy: so I don't feel like following through with Central now that the workaround is on clojars, but if someone else wants to follow up you can do so here: https://issues.sonatype.org/browse/MVNCENTRAL

13:36 redinger: technomancy: great! Any chance you want to put alphas out there as well? :)

13:37 technomancy: redinger: ok

13:38 redinger: I'm more than happy to push them up when released if that would help

13:38 technomancy: actually I don't have them on my box, just the poms

13:38 I can pull them in via a dummy project

13:39 rplevy: I wonder what the root cause of this mvn central screwiness is

13:39 since it happened before too

13:41 TimMc: gtrak: Yay for composability!

13:41 rplevy: I guess that's for them to figure out, hence the issue being created.

13:42 technomancy: redinger: ok, 1.5 alphas are up

13:42 redinger: technomancy: Thanks!

13:43 technomancy: redinger: is it usually stuart sierra who handles the releases? would it make sense to add him to the clojars group?

13:43 redinger: Yeah, he's been doing the 1.5 releases

13:44 technomancy: hm; if he has a clojars account, it's not obvious what it is

13:44 I'll wait to see if he responds to the mailing list thread I guess

14:06 jweiss: https://www.refheap.com/paste/4415 <- what if i sometimes run on eclipse and swank isn't loaded? is there a way to write this middleware so it will always compile and just do nothing if swank isn't there?

14:07 i'm not sure how to call binding with a symbol it might not be able to resolve.

14:07 maybe i should just let it fail, and catch the error.

14:09 nah i can't do that because it won't even compile.

14:09 technomancy: you could look at how binding is implemented and make a version that works with dynamically-resolved vars

14:09 S11001001: progv supremacy :)

14:09 technomancy: if you don't mind being hugely sketchy

14:10 jweiss: it's probably better to just add swank as a dep. even though eclipse won't use it.

14:10 a dev dep

14:11 S11001001: jweiss: if you're loading from source you could just have a macro expand differently depending on whether swank is present

14:15 jweiss: S11001001: i'll try that thanks

14:16 dnolen: even Groovy gets to have the fun! http://blog.bloidonia.com/post/29552846202/using-clojure-and-core-logic-from-groovy

14:18 nz-: gtrak: compojure has OPTIONS macro, so it should work just like with other http methods.

14:19 gtrak: huh...

14:19 maybe my version just doesn't

14:19 1.0.4

14:20 yep...

14:20 well, at least I learned something by digging :-)

14:20 nz-: latest is 1.1.1

14:21 https://github.com/weavejester/compojure/blob/master/src/compojure/core.clj#L140

14:21 gtrak: yea... I only wasted a couple hours on that ;-), thanks for letting me know though

14:21 nz-: and it works at least in 1.1.0

14:24 gtrak: it seems to be one of the latest additions to compojure

14:25 gtrak: the *one* time I forget to pull the latest version for something :-)

14:27 SegFault1X|work2: I really enjoy Rich Hickey's tech talks. He's a really entertaining and informative speaker.

14:28 Iceland_jack: SegFault1X|work2: Definitely

14:28 SegFault1X|work2: Whether or not I agree with some of his conclusions, I consistently enjoy watching them.

14:28 nz-: is it possible some how to manipulate compojure routes as data

14:29 Basically I'd like to automatically generate api documentation from the routes

14:29 gtrak: nz-: you can learn from what I just figured out :-)... compojure macros generate ring handlers, then it runs the 'some' function to select the first that matches

14:29 SegFault1X|work2: gtrak: That's surprisingly straight forward.

14:30 gtrak: if you wanted to generate more detailed api documentation, you could possibly wrap the macros

14:32 this is how I reinvented OPTIONS actually: https://gist.github.com/3372429

14:33 SegFault1X|work2: It would be neat if you could just incorporate metadata into the routes, then generate the documentation from the route metadata.

14:33 gtrak: note I used a function instead of a macro

14:34 SegFault1X|work2: That way the documentation still lives in code, but it's not necessarily tied to the route structure.

14:35 _fogus_: self-quotation is the only way to fly

14:36 emezeske: _fogus_: Is that something you said yourself?

14:36 _fogus_: "Self-quotation is the only way to fly" --me

14:37 SegFault1X|work2: I like recursive quotes. :)

14:37 _fogus_: (Me 2012)

14:37 emezeske: ""Self-quotation is the only way to fly" --me" --fogus

14:38 gtrak: let's all start speaking in quines please

14:38 emezeske: haha

14:38 SegFault1X|work2: Oh you mean turn #clojure into reddit? Got it. :)

14:38 nz-: http://jng.imagine27.com/index.php/2009-09-18-203946_clojure_quine.html

14:38 gtrak: ha

14:40 SegFault1X|work2: I have no idea how that works.

14:42 scriptor: huh, it's actually pretty simple

14:44 SegFault1X|work2: it creates an anonymous function and calls it with the second half of that expression

14:44 if you replace it with '2' or something like that

14:44 nz-: rather verbose way to do it

14:44 scriptor: ,((fn [x] (list x (list (quote quote) x))) 2)

14:44 clojurebot: (2 (quote 2))

14:45 Gnosis-: when working with a vector or array, does drop do any processing per element skipped, like it would with a list, or is it a constant time operation?

14:45 scriptor: so if instead of 2 you feed it the anonymous function, you get ((fn …) (quote (fn …)))

14:45 hiredman: ,(doc drop)

14:45 clojurebot: "([n coll]); Returns a lazy sequence of all but the first n items in coll."

14:46 SegFault1X|work2: scriptor: Yup, I'm playing with it now.

14:46 scriptor: You're right, it is pretty easy.

14:46 scriptor: SegFault1X|work2: yea, sorry if I just stated the obvious, just wanted to explain it to make sure I got it myself

14:46 joly: scriptor: that's a whole lot nicer than the character-based quines I've seen for other languages

14:47 Gnosis-: hiredman: how does it skip those first n items, though? does it get them and throw them away, even for collections that support random addressing?

14:48 random access*

14:48 nz-: http://asiajin.com/blog/2009/09/22/uroboros-programming-with-11-programming-languages/

14:48 scriptor: Gnosis-: I think it does

14:48 Gnosis-: oh

14:50 scriptor: Gnosis-: essentially, it keeps a counter and calls rest until the counter reaches 0

14:50 SegFault1X|work2: Gnosis-: Clojuredocs.org has the source if you want to see what's /actually/ happening.

14:51 Gnosis-: http://clojuredocs.org/clojure_core/clojure.core/drop just scroll to the bottom and click Source

14:51 Gnosis-: okay, thanks

14:56 aaelony: struggling to get in incremental counter i using for. How can I get i to increment in something like the following? (for [x [:x1 :x2 :x3 :x4 :x5 :x6] :let [i 0] ] (assoc {} x (inc i))) => ({:x1 1} {:x2 1} {:x3 1} {:x4 1} {:x5 1} {:x6 1}) ... I'd like to see ({:x1 1} {:x2 2} {:x3 3} {:x4 4} {:x5 5} {:x6 6})

14:58 emezeske: ,(into {} (map vector [:x1 :x2 :x3 :x4 :x5 :x6] (range)))

14:58 clojurebot: {:x1 0, :x2 1, :x3 2, :x4 3, :x5 4, ...}

14:59 emezeske: ,(into {} (map vector [:x1 :x2 :x3 :x4 :x5 :x6] (range 1)))

14:59 clojurebot: {:x1 0}

14:59 aaelony: is it possible using for ?

14:59 Bronsa: ,(into {} (map vector [:x1 :x2 :x3 :x4 :x5 :x6] (rest (range))))

14:59 clojurebot: {:x1 1, :x2 2, :x3 3, :x4 4, :x5 5, ...}

14:59 emezeske: Bronsa: hah, thanks :)

14:59 Bronsa: :)

14:59 raek: aaelony: for assumes you want to calculate each value independently from the others

15:00 emezeske: aaelony: In your "for", "i" is not a variable, it is just the value 0 being bound to the name "i"

15:00 aaelony: So on each iteration of the for body, "i" evaluates to 0 again

15:01 aaelony: If you really want a mutable variable, you'll need to use an atom or something like that

15:02 ,(let [i 0] [(inc i) (inc i) (inc i) (inc i)])

15:02 clojurebot: [1 1 1 1]

15:02 emezeske: aaelony: ^ i is always zero, it is not ever modified.

15:02 aaelony: maybe I'm going about this wrongly. I have a for statement that is doing a lot of things, mostly creating an aggregate output mapping. I want to keep track of what's contributing to the aggregates, so I'd like an iteration i that I can stuff into a vector that goes into the map. is there a better way?

15:02 perhaps an atom or var is the way to go...

15:03 emezeske: aaelony: I would do something like (for [[x i] (map vector xs (range))] ...)

15:03 aaelony: emezeske: that looks good, thanks!

15:04 emezeske: aaelony: Yep! For the record, an atom would definitely work, but something like the above is just more idiomatic (it's more in the functional style)

15:05 gfredericks: yegge doesn't know about atoms does he?

15:05 aaelony: emezeske: that's exactly what I was after! :)

15:06 Gnosis-: what's a good way to profile?

15:12 ivaraasen: Gnosis-: I mostly use the time function. jvisualvm is nice too

15:16 hiredman: profiling and benchmarking are different

15:16 jvisualvm is good for profiling, criterium is a neat benchmarking library

15:28 Gnosis-: ah, those are some good ideas. thanks!

15:34 michaelr525: hello

15:36 jmolet: test

15:46 muhoo_: hmm, lein preview8 doesn't include nrepl anymore

15:48 hiredman: muhoo: seems unlikely

15:48 muhoo: https://www.refheap.com/paste/4418

15:48 that's with preview8.

15:48 with preview7, works just fine

15:50 lein deps :tree are identical for both.

15:51 DanBell: anyone want to explain to me why (re-find #"[a-z][0-9]" "a1b2c3") returns a match but (re-match #"[a-z][0-9]" "a1b2c3") doesn't?

15:52 Chousuke: DanBell: re-find finds a substring that matches the regexp, and re-match tests if the whole string matches the regexp?

15:53 DanBell: first one should find "a1", but the regexp won't match the whole thing

15:53 DanBell: oh, so "matches" is a verb in the singular, not a plural noun?

15:53 it *seemed* to have duplicate functionality with re-sew, ha

15:54 *re-seq

15:55 muhoo: hiredman: it's something in my profiles.clj causing grief, apparently.

15:55 DanBell: ty houser

15:57 muhoo: hiredman: hmm, apparently not. with no profiles.clj at all, still happens. FileNotFoundException, for clojure/tools/nrepl/server.clj

16:05 only in trampoline mode, works without trampoline

16:15 technomancy: muhoo: huh, trampoline repl works here

16:16 can you repro on a fresh project?

16:17 xeqi: technomancy: I can repoduce on a fresh project

16:17 technomancy: I do see that it's using reply beta6 for some reason

16:18 xeqi: https://www.refheap.com/paste/4421

16:18 technomancy: oh never mind, I was using a snapshot

16:22 ok, this is the same problem as https://github.com/technomancy/leiningen/issues/695

16:24 muhoo: technomancy: thanks, makes sense.

16:25 is there a workaround?

16:25 technomancy: for the time being, probably just an explicit nrepl dependency in defproject =\

16:25 profiles are getting ignored by the trampoline task

16:25 muhoo: i tried that, but then it complained about not being able to find complete/core.clj

16:25 and i wondered how deep that rabbit hole went

16:26 i_s: if I have to make a change to a library, and then want to use that changed library in my project, whats the best way to do it?

16:26 technomancy: muhoo: ok, this should do it: [reply "0.1.0-beta10" :exclusions [org.clojure/clojure]]

16:26 muhoo: trying now

16:27 technomancy: works, thanks!

16:29 scriptor: hmm, playing with time, it looks like (map (partial * 2) (range 1000)) can be anywhere from 3-4 times as fast as the equivalent with an anonymous function

16:31 S11001001: scriptor: did you dorun?

16:31 scriptor: S11001001: nope

16:32 probably should?

16:32 S11001001: (fn ...) implies the first-time construction of a newly created class

16:32 hugod: antifuchs: how is rpc.clj hacking going?

16:32 muhoo: (do (dorun run run) (do (dorun run))

16:32 * muhoo ducks

16:32 S11001001: if you want to time function call time, calls to the relevant function must overwhelm that consing

16:33 scriptor: ah

16:33 S11001001: this is one of the very, very, very few times I would encourage use of loop :)

16:34 dnolen: scriptor: partial is nearly always slower - you need to pick a larger n and force w/ doall or dorun to see.

16:35 rplevy: also, if you have a nested structure, the forcing of evaluation is not automatically recursive, you need to make sure you force the laziness in those sub structures

16:36 scriptor: yep, after binding the function before calling map and calling dorun the partial one is slower

16:39 muhoo: i_s: the easiest i've found is to use the checkouts dir in the project

16:40 i_s: i.e. if i'm working on foo, and also a library bar, then "cd foo; mkdir checkouts; ln -s ../bar checkouts/bar"

16:42 i_s: ill try that muhoo, thanks!

16:45 jml: I feel a bit silly for not being able to figure this out from the docs, but say I have a clojure program (e.g '(println "foo")'), how do I turn that into something I can run from the command-line

16:46 hyPiRion: jml: What kind of operative system do you use?

16:46 jml: hyPiRion: linux

16:47 nz-: jml: make a main method (defn -main [] <code goes here> )

16:47 technomancy: running Clojure from the command line is currently kinda crap compared to most non-java languages

16:47 muhoo: jml: "lein new foo", then have a look at foo/src/foo/core.clj -main.

16:47 nz-: jml: then lein run -m name-of-your-namespace

16:48 hyPiRion: If you want to have some scripting-like way of executing it, you can do "clojure filename"

16:50 jml: thanks all

16:50 hyPiRion: And if you want to omit the "clojure" part, you can add a "#!/usr/bin/clojure" on top of the file, then make it executable

16:51 jml: lein seems pretty important.

16:52 technomancy: I wonder if you can do a shebang with lein

16:53 jml: so packages are often shipped as binaries

16:53 hyPiRion: hm

16:53 jml: as scripts, rather?

16:55 hyPiRion: Clojure starts up pretty slow, so scripts aren't that widespread, I suppose.

16:56 In addition, Clojure is simple, not easy. Usually you would sacrifice for simplicity for some easiness in small programs.

16:56 dnolen: jml: by packages do you mean libraries?

16:56 jml: dnolen: I mean things like Debian packages

16:57 technomancy: jml: libraries for dependency management are nearly always shipped as source, inside jar files

16:59 jml: what about client-side programs?

16:59 dnolen: jml: no convention as far as I know because platforms differ greatly

17:00 S11001001: I would ship an uberjar and hope everyone can figure out how to run them :)

17:00 hyPiRion: I would uberjar leiningen projects if I would ship client-side though.

17:00 jml: ah hah, I see.

17:00 technomancy: jml: `lein help tutorial` covers some of the common distribution methods

17:00 near the end

17:01 nz-: jml: with uberjar you can just execute the thing like this: java -jar my-uber.jar

17:01 S11001001: double-click works pretty often

17:04 Cr8: for scripty type things, just for personal use, I've used nailgun

17:09 nz-: http://www.martiansoftware.com/nailgun/

17:09 that?

17:10 Cr8: yes

17:11 i'd have a nail in my misc namespace that would do dispatch

17:11 technomancy: muhoo: I think your issue is fixed in master; can you confirm the patch works for you?

17:14 antifuchs: hugod: great! I started hacking on swank-clojure, and am currently able to connect with this month's quicklisp's slime

17:15 the P and L parts of slime-repl don't work currently

17:15 but it's coming together - reading and evaling works (;

17:18 l1x: hey guys what is the datatype if is see #<some strings> when I println the variable? I thought it is a vector

17:19 scriptor: what variable and what does it contain?

17:19 S11001001: l1x: you can tell based on what's in those strings

17:20 l1x: it is coming from the JMX library and it looks like this #<ObjectName hadoop:service=DataNode,name=DataNodeInfo>

17:20 antifuchs: hugod: I think it should be pretty trivial to port over to ritz; also, my stuff seems to clean up&simplify a lot of things (:

17:21 nDuff: l1x: Easiest way to tell the type is to look at (type your-variable). That said, in this context, it would presumably be a javax.management.ObjectName

17:22 l1x: nDuff: amazing! this is what i was looking for!

17:31 hugod: antifuchs: so you're porting swank-clojure to a recent slime? ritz was working against a more recent slime than swank-clojure. Are you finding many changes required in swank-clojure?

17:31 antifuchs: just stuff to support the updated net code, and then a few arglists that changed, so far

17:32 hugod: one thing was the support for swank::%cursor-marker%

17:32 jml: are there API / reference docs for clojure.test

17:32 antifuchs: I'm not really done yet - there's some confusion with how returned values are formatted, so can't really judge how much work is left (:

17:32 hugod: slime changed the net encoding recently?

17:34 jml: oh hey, google is great.

17:34 symuyn: Getting frustrated at partition: hey, what's a good way to turn (0 1 2 3 4 5) into ((0 1 2) (1 2 3) (2 3 4) (3 4 5) (4 5) (5))?

17:34 Which partition can't do, as far as I can tell, heh

17:34 antifuchs: hugod: not really recently

17:34 it was 1.5 years ago

17:35 just, both ritz and swank-clojure still require a 2010 slime (:

17:35 metellus: ,(partition 3 1 '(0 1 2 3 4 5))

17:35 clojurebot: ((0 1 2) (1 2 3) (2 3 4) (3 4 5))

17:35 metellus: ,(partition-all 3 1 '(0 1 2 3 4 5))

17:35 clojurebot: ((0 1 2) (1 2 3) (2 3 4) (3 4 5) (4 5) ...)

17:35 symuyn: Oh, wow

17:35 i_s: muhoo: i'm getting a FileNotFoundException with the checkouts directory approach. Is there something special I have to do if the project name is multipart? In this case, the directory is called "friend", and the artifact (or whatever its called) is com.cemerick/friend

17:35 hugod: antifuchs: you have a pointer to the change?

17:35 symuyn: Thanks a lot

17:35 antifuchs: hugod: I think you participated in the discussion of that announcement

17:36 that was when Helmut introduced binary prefixes

17:36 hugod: antifuchs: the last I heard Helmut decided not to go ahead with it

17:36 antifuchs: but that seems to have changed to 6 hex digits counting chars

17:36 technomancy: i_s: that shouldn't matter for checkouts. do you have it in project.clj though?

17:36 antifuchs: erm

17:36 I meant, 6 hex digits indicating number of bytes to read

17:37 and I believe it mandates utf-8 now

17:37 which is just such a huge relief, I can't even tell you (:

17:37 i_s: technomancy: i took it out of project.clj

17:37 hugod: I think utf-8 is the only change - it was always a six hex digit length encoding iirc

17:37 technomancy: i_s: why?

17:38 antifuchs: hugod: anyway, that's what rpc.lisp does now, and also what rpc.clj does (:

17:38 it used to indicate number of chars though, and it's bytes now

17:38 subtle change, and imperceptible if you operate on ascii only

17:38 i_s: technomancy: someone on the internet told me to. but I will see what happens if i include it.

17:38 hugod: ah, gotcha

17:38 technomancy: i_s: go smack 'em for me =)

17:39 i_s: haha

17:39 antifuchs: but it makes everything way easier to handle, I think

17:39 technomancy: for some reason that's a widespread misconception

17:40 antifuchs: oh crap

17:40 I hadn't reloaded emacs, and it had broken state it seems.

17:41 just restarted, and the REPL works now, connected to swank-clojure.

17:41 <3 <3 <3

17:41 hugod: yeah!

17:41 antifuchs: backtraces in the debugger, check

17:41 ah, restarts seem to not like getting invoked

17:42 hugod: is that using cdt?

17:42 antifuchs: not sure! I think it might be

17:42 well, it's the emacs side beeping

17:42 must be some argument list that changed

17:42 hugod: if it has frame locals, then it's cdt

17:44 antifuchs: [No Locals]

17:44 so, probably not cdt

17:45 interesting! "java.lang.Integer cannot be cast to clojure.lang.IFn"

17:46 scriptor: what code are you running?

17:48 antifuchs: (nth (keys *sldb-restarts*) n) (with n being an integer, and *sldb-restarts* a map

17:49 i_s: technomancy: just tried that, but now i get the old and busted version. running lein classpath also doesn't show the one that i'd expect from checkouts. any tips?

18:02 antifuchs: amazing, just passing back the Throwable as a string makes the abort restart work, too

18:02 so nice.

18:04 michaelr525: hello

18:04 technomancy: i_s: `lein classpath` should show both, with the src/ dir of the checkout version before the jar

18:11 l1x: is there a way to add the output of this (which is strings) to a hash? in ruby I would ().each {|a| target_hash <<a }

18:11 (doseq [s (jmx/mbean-names "hadoop:*")] (prn (. s getCanonicalName)))

18:14 aperiodic: l1x: check out 'with-out-str'

18:18 l1x: cool, i dont get it :)

18:19 antifuchs: hugod: https://github.com/antifuchs/swank-clojure/tree/quicklisp-swank has my changes - it's not a ton of stuff that needed updating! (:

18:21 emezeske: l1x: What are they keys and what are the values in this hash?

18:21 gtrak: l1x: (into {} (for [[k] (jmx/mbean-names "hadoop:*")] [k (.getCanonicalName k)])) ?

18:22 emezeske: l1x: In Ruby it doesn't even seem like the << operator is defined for Hash

18:22 l1x: emezeske: rite i was thinking about an array :)

18:22 gtrak: thx!

18:23 emezeske: l1x: Oh, if you want an array, just do (for [s (jmx/mbean-names "hadoop:*")] (. s getCanonicalName))

18:23 l1x: "for" returns a lazy seq of its the results, unlike doseq which returns nil

18:23 gtrak: or you can just use map at that point

18:23 amalloy: (map (memfn getCanonicalName) (whatever))?

18:24 emezeske: amalloy: Wow, memfn sure beats #(. x y), I didn't know about that

18:24 gtrak: huh

18:25 l1x: ok, thanks guys i try to work out the details based on these ^^ ( #second_day_with_clojure )

18:25 antifuchs: oh my. sooo nice. <3

18:25 gtrak: l1x: have more days!

18:25 * antifuchs glee-s at swank-clojure in recent slime (:

18:26 l1x: :))

18:26 amalloy: emezeske: well, memfn's actually kinda limited as it is

18:26 eg, you can't typehint it

18:27 http://dev.clojure.org/jira/browse/CLJ-910 would be nice

18:28 emezeske: amalloy: Ah, it still looks handy for those quick use cases

18:28 Seems like a no-brainer change to add that!

18:29 amalloy: nothing is ever a no-brainer on jira

18:29 emezeske: There is waay too much truth to that statement. :(

18:30 technomancy: I had to resist from chiming in on the "what about people who fix multiple bugs in a single issue" thread

18:30 amalloy: although the past week has been unusually productive in terms of accepting patches, so i should bridle my venom

18:30 technomancy: I really wanted to say "maybe if jira didn't suck so much, people wouldn't mind opening a separate issue for it"

18:30 michaelr525: why would (count (macro-with-binding (doall (lazy-seq-func)))) behave differently from (count (doall (macro-with-binding (lazy-seq-func))))?

18:31 Raynes: technomancy: That's all a little ridiculous anyways.

18:31 amalloy: technomancy: a couple days ago rich asked me to take my patch from may and split it up into about five different jira tickets

18:31 Raynes: It isn't as black and white as they're making it out to be.

18:31 I wouldn't have the patience to do that. I'd just give up and deal with it. :\

18:32 amalloy: Raynes: to do what?

18:32 (or, deal with what?)

18:33 Raynes: Split up a patch like that. I mean, if it was all completely unrelated than it shouldn't have been the same patch anyways, but if it was all related to one problem...

18:42 michaelr525: jkhdkjgdh

18:43 jml: The tutorial at <http://java.ociweb.com/mark/clojure/article.html> says 'To create a new _application_ project, do "lein new app my-app"'. What's an application project and how is it different from a non-application project?

18:43 technomancy: jml: an application is just something that's not a library

18:44 michaelr525: jml: what is a non-application project? :)

18:44 jml: michaelr525: I don't know!

18:45 technomancy: In which case, I don't get the significance of the two arguments to 'lein new'.

18:46 technomancy: jml: does `lein help new` make it clearer?

18:47 jml: technomancy: if I hadn't read that comment in the tutorial, it would seem very clear.

18:47 hyPiRion: Unread the comment.

18:48 Raynes: technomancy: Told you that differentiating would be confusing and annoying.

18:48 nDuff: jml: Non-application projects are things like leiningen plugins

18:48 Raynes: No.

18:48 nDuff: jml: ...ie. based on a different, special-purpose template

18:49 No?

18:49 * nDuff is surprised, then.

18:49 Raynes: There is a template for that too.

18:49 technomancy: if you have a :main, you're an application

18:49 jml: technomancy: if I read 'lein help new', I would interpret it as "make a project, but put it under a differently named directory to the default"

18:49 technomancy: if you push to clojars, you're a library

18:49 Raynes: There are built in templates for 'apps', libraries, plugins, and templates.

18:50 jml: but to go from that to whether something is an application or not seems a stretch

18:51 Raynes: I have no idea what you just said.

18:51 technomancy: part of the problem is that we had to put the optional argument first for compatibility's sake

18:51 jml: Raynes: sorry. I'm confused. That makes it harder to make sense.

18:52 Raynes: It seems like you might be overthinking things.

18:52 Slightly.

18:53 technomancy: We should really rewrite things so that a name argument isn't required and all args (save for :show, I guessed) are passed directly to templates.

18:54 jml: OK. Seems most sensible to pretend that that particular instruction in the tutorial is wrong.

18:54 Raynes: And by we I mean me at some point.

19:00 gtrak: anyone have an IOFactory implementation for hadoop they'd like to share xD

19:00 antifuchs: heh, funny that I added a :main to swank-clojure then (:

19:00 technomancy: antifuchs: not at all; swank-clojure is end-user-facing

19:00 antifuchs: cool cool (:

19:01 technomancy: btw, set up a branch for latest quicklisp compat at https://github.com/antifuchs/swank-clojure/tree/quicklisp-swank

19:01 technomancy: antifuchs: are you planning on getting it into ritz?

19:01 antifuchs: might be interesting soon, once I figure out instructions to install quicklisped slime

19:02 yes, definitely

19:02 that's tomorrow's hack project

19:02 technomancy: ok, I would rather point people there rather than to swank

19:02 antifuchs: understandable

19:03 gtrak: or rather I guess I need to add a URL-handler for the hdfs-prefix

19:08 haspaker: I have made two solutions for the 4clojure problem 106

19:08 http://pastebin.com/eE9rHUgM

19:08 One in Python and one in Clojure, and both of them use the exact same method

19:08 * nDuff grumbles at the pastebin.com link

19:08 haspaker: But I like pastebin!

19:09 nDuff: haspaker: it's full of ads and basically featureless compared to its competitors.

19:09 haspaker: Anyway, the Clojure version is extremely slow compared to the python one

19:09 nDuff: haspaker: If you were using gist, for instance, you could have the two files as separate pastes, each syntax-highlighted accordingly, and we could check it out and run it using git if we wanted to.

19:09 (separate pastes within the same gist, that is)

19:10 ...and we could fork the gist, and have revision-controlled history

19:10 jml: figured out the confusion

19:10 lein 1.x vs lein 2

19:10 haspaker: Hmm

19:10 I'll look into it, nDuff

19:10 l1x: could somebody have a look what I am doing wrong in this? (for [mbean (doseq [s (jmx/mbean-names "hadoop:*")] (. s getCanonicalName))] (jmx/mbean mbean))

19:10 jml: time to go to bed. thanks for the help.

19:10 l1x: basically i get the hadoop mbean names and i would like to iterate over it and get the actual attributes

19:11 nDuff: haspaker: ...there are also "pastebin" services specific to Clojure that run pasted code inside a sandboxed VM, so we can see what it does straight off the web...

19:11 haspaker: ...whereas pastebin.com gives you no interesting features whatsoever, but lots and lots of ads.

19:11 * nDuff <- done ranting, for now.

19:13 patchwork: Anyone using swank-clojure ever get errors that never get displayed in slime, even though they are shown in the repl?

19:13 is swank-clojure swallowing errors?

19:14 The simplest case I have for this is simply (+ nil nil)

19:14 haspaker: nDuff: You made me see the error of my sinful ways, so at least it wasn't a worthless rant :>

19:14 patchwork: it shows the error in > lein repl

19:14 haspaker: https://gist.github.com/3374386

19:14 patchwork: but in slime it just says "Evaluation aborted;"

19:14 amalloy: patchwork: it usually displays errors, but sometimes it doesn't and i don't know why

19:14 eg, (+ nil nil) works fine for me (i get a trace)

19:14 patchwork: amalloy: sometimes if I do that twice, the second time it fails

19:15 really weird

19:15 Bronsa: patchwork: same here

19:15 patchwork: Any clues? It can be really annoying to have kick up the repl in terminal

19:16 amalloy: patchwork: are you closing the error buffer correctly?

19:16 patchwork: I just hit '0' in emacs

19:16 is there a better way to close it?

19:16 amalloy: 0 or q should both be fine. just don't like C-x 0 to hide the buffer

19:16 patchwork: I wonder if swank swallows jvm errors because it generates certain ones and wants to hide it

19:17 xeqi: haspaker: changing (flatten (map ...)) to (mapcat ...) causes a decrease from 850ms to 110ms on my box

19:17 technomancy: patchwork: there's a bug in clj-stacktrace where it can occasionally happen

19:17 check *e

19:17 amalloy: flatten is atrocious in so many ways

19:17 xeqi: (inc amalloy)

19:17 lazybot: ⇒ 27

19:18 amalloy: oh man, i can get karma for complaining about flatten? i could do that all day

19:18 patchwork: technomancy: So you think this is a clj-stacktrace problem, not a swank-clojure problem? Hmm...

19:18 amalloy: what is wrong with flatten?

19:18 xeqi: ~flatten

19:18 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

19:22 michaelr525: damn

19:23 haspaker: xeql: Your solution makes it about as fast as the python file for small numbers, but Clojure still has a memory problem for the larger calculations

19:23 For example, try (find-path 3 12912)

19:23 Python spits out an answer in about 5 seconds

19:23 Clojure chews for two minutes until it throws an OutOfMemoryError

19:24 It seems like Clojure can't juggle with large lists the same way Python can

19:24 emezeske: haspaker: It looks like your recursion is in the tail position

19:24 haspaker: Have you tried using recur?

19:25 haspaker: Wait a sec

19:25 emezeske: haspaker: I'm guessing that if you changed the Python version to use recursion that you'd have the same problem

19:26 haspaker: Recur seems to have the same problem

19:26 emezeske: Yeah, but is it even possible to do it in Clojure without recursion?

19:27 emezeske: haspaker: Of course it is. Anyway, if you use recur, it will basically be just looping anyway.

19:27 amalloy: of course. but too much recusion is never going to lead to an OOME

19:27 emezeske: amalloy: It will always hit a stack overflow before oom?

19:27 amalloy: no

19:28 but recursion will contribute to SOE, not to OOME. if you're hitting OOME, reducing recursion won't make a difference

19:28 emezeske: Huh

19:28 I guess the stack space in the JVM is a separate thing from the heap space

19:29 -Xss as opposed to -Xms or whatever

19:29 amalloy: yes

19:29 michaelr525: why would (count (macro-with-binding (doall (lazy-seq-func)))) behave differently from (count (doall (macro-with-binding (lazy-seq-func))))?

19:30 amalloy: haspaker: fwiw, my solution to that problem solves (f 3 12912) in 5s

19:31 haspaker: Cool. Could you upload it?

19:31 michaelr525: i don't get it gggg

19:31 it drives me crazy

19:31 emezeske: michaelr525: What is macro-with-binding?

19:32 amalloy: god, 4clojure is so slow now. i thought i rolled back to a faster version

19:32 haspaker: https://gist.github.com/349eb71c83e9bd98d04c

19:32 michaelr525: it's a macro with just (binding [...] @body)

19:32 emezeske: michaelr525: Could your problem have to do with the fact that bindings and lazy-seqs don't get along well?

19:33 michaelr525: In your second example, the binding would not affect the lazy-seq stuff when doall realized the lazy-seq, I think

19:34 michaelr525: emezeske: the funny thing is that the second example behaves in a way it

19:34 's supposed to

19:34 emezeske: michaelr525: So does the first

19:34 michaelr525: while the first one returns strange results

19:34 i mean returns the expected results

19:34 emezeske: michaelr525: In your first example, the binding is not in effect when the lazy-seq is realized

19:35 michaelr525: how so?

19:35 emezeske: michaelr525: http://kotka.de/blog/2009/11/Taming_the_Bound_Seq.html

19:35 michaelr525: http://cemerick.com/2009/11/03/be-mindful-of-clojures-binding/

19:35 michaelr525: Maybe those will be helpful

19:36 michaelr525: maybe..

19:36 thanks

19:36 i'll read it

19:36 sometimes clojure just drives me nuts

19:37 is there reallly a good reason to write something in cps?

19:37 i'm talking about clj-http

19:46 emezeske: actually according to cemerick's article the first example should produce the correct result

19:46 emezeske: in the first example i realize the lazy sequence inside the binding

19:47 emezeske: michaelr525: Oh, whichever way, I guess I had the order mixed up

19:47 michaelr525: I don't know what you mean by "correct result", though, they both work correctly

19:47 michaelr525: They just do different things

19:48 haspaker: I rewrote my Python code so that it relies purely on recursion

19:48 It still takes only 15 seconds to spit out the correct answer

19:49 emezeske: haspaker: Did you see what amalloy said earlier? I was wrong about it being stack-space-related

19:53 haspaker: emezeske: Hmm. That only makes the error seem even more strange to me

19:53 Now the Python code and the Clojure code performs almost exactly the same task

19:54 But Python seems to soldier on just fine while Clojure gives up and dies

19:55 *give up and die, of course

19:57 eggsby: hmm, why is the classic double tail recursive so slow in clojure (as compared to something like scala)

19:57 like fib, for example

19:57 emezeske: haspaker: How big does the branches list get with the goal of 12912?

19:57 eggsby: Is it just because it has to do the type checks?

19:57 haspaker: Extremely big

19:57 emezeske: haspaker: Java has a fixed max heap size that you can set with command-line args

19:58 haspaker: If it's bigger than the default max heap size, you'll hit OOM

19:59 haspaker: You can set the Java max heap size with something like -Xmx500M or -Xmx2G

19:59 haspaker: emezeske: That could very well be the solution

19:59 The size of the final list lies somewhere between 2^12912 and 3^12912

19:59 emezeske: Heh, that's a big number :)

20:05 haspaker: emezeske: I realized now that I lied

20:05 I meant to say 2^17 and 3^17 :>

20:07 emezeske: haspaker: Yeah, I was thinking about how ridiculously unimaginably big 2^12912 was just now :)

20:13 haspaker: emezeske: Yeah. 3^12912 is more than six thousand digits long

20:14 emezeske: haspaker: You might have to buy an extra stick of RAM for that

20:24 tomoj: djanatyn: see also http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

20:25 djanatyn: thanks

20:26 tomoj: also http://search.maven.org/#search%7Cga%7C1%7Cclojure.math.combinatorics

20:28 (which won't find stuff on clojars, but the core clojure libs are in maven central not clojars)

20:52 scizo_: noob here trying to add something to the front of a vector and can't seem to find a function for it.

20:52 maybe better said to the front of any collection?

20:54 amalloy: scizo_: not every collection is optimized for adding to any particular spot. if you don't mind turning it into a seq, you can just use cons

20:55 scizo_: amalloy: so with sequences cons and conj always add to the front?

20:55 amalloy: yes

20:56 scizo_: amalloy: alright, thanks.

21:22 This might not be directly clojure related, maybe. I'm currently going through the clojure-koans and I am trying to write a recursive factorial function. I currently have this. https://gist.github.com/3375107

21:23 This doesn't work because the recursion has to be at the tail, which I understand, but I am unable to come up with an alternative.

21:27 casion: scizo_: a clue would be that you would need more than 1 loop binding

21:28 adamvh: Hello all.

21:28 scizo_: casion: Yeah, I just started playing around with that idea. I think I am almost there.

21:29 casion: It worked. Thanks.

21:29 casion: sure, not often I know an answer to anything asked in here, haha

21:29 adamvh: Does anyone know of good places to look for how to use core.logic with user-defined types?

21:29 Scriptor: the good ole' iterative recursive factorial

21:31 aperiodic: ~anyone

21:31 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

21:31 adamvh: Well, then.

21:32 Where is there documentation on using user-defined types with core.logic?

21:32 What kinds of data can a logic engine work with?

21:34 Scriptor: aperiodic: not really relevant, he's looking for places to find documentation, not asking if anyone knows about a topic

21:34 aperiodic: Scriptor: I thought he might have been running into a specific issue in trying to get that to work

21:35 scizo_: I updated my factorial function (https://gist.github.com/3375107) and it works with the exception of a base case of zero. I want to ask if I can do an early return before the loop, but that doesn't seem to feel like the clojure way of doing it.

21:35 muhoo: factorials are the "hello world" of lisp

21:36 casion: scizo_: you dont need to test for a case of 1

21:36 Scriptor: scizo_: if (fact 0) => 1

21:36 er, ignore the 'if' in that

21:37 scizo_: Scriptor casion: yes I see that now. Thanks. :)

21:40 dnolen: adamvh: you can extend unification to your own data types if that's what you mean.

21:40 adamvh: the wiki has a Datomic example - you don't need to understand anything about Datomic to get it.

21:40 adamvh: dnolen: I'm sorry, I'm not entirely sure what unification means

21:40 I'm rather new to logic programming in general

21:41 dnolen: adamvh: it means you can use your own data types.

21:44 adamvh: unification is the process by which two pieces of data are attempted to be made equal.

21:46 adamvh: out of the box, core.logic works the the standard Clojure data structures - I would stick with them until you feel a little more comfortable with how core.logic works.

21:52 barryTheIdiot: I'm having trouble evaluating a list with a parameter as a function. For example, (def example (list '+ 'x 1). then what I would love to do is (let [x 5] (eval example)), but running into scope issues i think

21:52 what's the easiest way to do that kind of thing?

21:54 brehaut: barryTheIdiot: back up a bbit; what are you trying to achieve? eval is not common in real clojure code

21:54 adamvh: dnolen: The eventual goal is a program that will automatically validate army lists for a tabletop wargame

21:54 brehaut: barryTheIdiot: also, i think you idea of vars, symbols and scoping is wackadoodle

21:54 barryTheIdiot: probably :(

21:54 adamvh: dnolen: the idea being that you chose a collection of units, some of which can only be present in certain quantities, some of which are allowed to be present only if others are

21:55 barryTheIdiot: I have a list, that is literally (+ x 5). how can I evaluate it?

21:55 amalloy: clojurebot: your idea of vars, symbols, and scoping is wackadoodle

21:55 clojurebot: Ok.

21:55 Scriptor: barryTheIdiot: why do you want to evaluate it as a list?

21:55 you can simply do (+ x 5)

21:56 brehaut: ,(let [x 1] (apply + x 5))

21:56 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

21:56 brehaut: crap

21:56 ,(let [x 1] (apply + x [5]))

21:56 clojurebot: 6

21:56 adamvh: dnolen: is that a good problem domain for core.logic?

21:57 brehaut: barryTheIdiot: (im assuming you want to know how to apply a function to a list?)

21:57 barryTheIdiot: yes, but I have it as a literal list bound to variable. I don't know how to "treat" it as a function

21:57 Scriptor: so you have '(+ x 5)

21:57 barryTheIdiot: yes

21:57 brehaut: barryTheIdiot: why do you have that list then?

21:58 adamvh: ,(eval '(+ x 5))

21:58 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

21:58 brehaut: ,'x

21:58 clojurebot: x

21:58 frio: i think brehaut's initial question is the main thing here: what are you actually trying to achieve?

21:58 brehaut: ,(read-string "x")

21:58 clojurebot: x

21:58 brehaut: i have no idea what im doing

21:59 barryTheIdiot: I want to be able to temporarily bind x to a number, let's say 19, and then using the previously bound list '(+ x 5), to do the function

21:59 sorry if I'm not making sense, not had much sleep lately.

21:59 frio: no, i get that

21:59 but why

22:00 what is the overall purpose of that design :)

22:00 brehaut: barryTheIdiot: i think you want partial application

22:00 Scriptor: there might be a better way to do what you want

22:00 barryTheIdiot: it's for a program to find the next number in a sequence of numbers

22:00 Scriptor: ah

22:00 barryTheIdiot: do you know how to make a function?

22:00 muhoo: ,(read-string "eval")

22:00 clojurebot: eval

22:00 brehaut: (let [f (partial + 1) x 5] (f x))

22:00 ,(let [f (partial + 1) x 5] (f x))

22:00 clojurebot: 6

22:01 brehaut: barryTheIdiot: capture the expression as a function, and apply that function later on, rahter than trying to capture it as a list and then inject values

22:01 barryTheIdiot: alright, thanks, i'll try that

22:02 brehaut: btw, that particular case is 'inc ;)

22:02 adamvh: ,(let [f (partial + 1)] (take 5 (iterate f 5)))

22:02 clojurebot: (5 6 7 8 9)

22:02 adamvh: barryTheIdiot: that's more or less what you want, right?

22:03 brehaut: barryTheIdiot: if the functions arguments arent in the order you want, then #(…) is idiomatic to capture that sort of out of order partial application

22:03 Scriptor: barryTheIdiot: #(...) is shorthand for an anonymous function, which is like a regular clojure function but you don't supply it a name

22:04 sorry if I'm stating the obvious, just making sure we're covering the bases

22:04 dnolen: adamvh: static analysis of all kinds, scheduling, planning, in memory dbs, test generation, configuration - Prolog style programming is well suited to many problem domains.

22:05 adamvh: dnolen: Guess I'm just gonna have to put in some work to understand what it's all about :p

22:06 dnolen: adamvh: that you will - it's a big subject. I hardly know anything myself ...

22:19 XRR_Stanislav: Hmm, if you use (eval '(defn foo [] "I worship his shadow")) or something like that, does that alter the global scope?

22:22 brehaut: im pretty sure it alters the namespace it is run in (globally)

22:37 semperos: compiling a simple "hello world" for ClojureScript targeting Node.js; using lein-cljsbuild 0.2.5 which uses ClojureScript 0.0-1450

22:38 all goes well until I try to add a second ClojureScript file and namespace to my build, at which point I get the following error: https://gist.github.com/3375417

22:38 the second namespace is just contains the ns form, nothing else

22:38 compilation success, but running "node main.js" results in the error seen in that gist

22:38 anybody experience anything similar or have thoughts?

22:39 amalloy: semperos: ask Raynes and dnolen. known bug

22:40 semperos: amalloy: great, thanks

22:40 did a quick google for keywords in the error but didn't see anything obvious surface

22:41 muhoo: has anyone got nrepl + piggieback + cljsbuild running with the browser (not rhino)?

22:43 tomoj: semperos: is the second namespace name single-segment and the same as a local somewhere else?

22:43 actually I guess it doesn't matter if it's single-segment, just if the first segment matches a local

22:44 semperos: a local where?

22:44 tomoj: well, since it's not in the second namespace, the other one, I guess

22:45 semperos: tomoj: the two namespaces are platform.core and platform.util, the util being the second one that creates the error at runtime

22:45 platform.core has only a `start` fn and the (set! *main-cli-fn* start) form

22:45 Raynes: semperos: Yeah, it's completely nuts.

22:45 semperos: :)

22:45 that's ok, I just wanted to make sure I wasn't completely nuts

22:46 tomoj: that doesn't sound like the problem I was thinking of

22:46 xeqi: muhoo: I got them to where I could use the browser repl

22:46 Raynes: It's baffling that the target was written, but apparently not tested at all.

22:46 :p

22:49 tomoj: the node target?

22:53 muhoo: xeqi: what did you supply as :eval argument to cemerick.piggieback/cljs-repl ?

22:53 xeqi: muhoo: https://www.refheap.com/paste/4239

22:55 though doing that now it seems to be ignoring the first input I give it after starting the cljs-repl

22:56 muhoo: xeqi: you are a god

22:56 thank you so much!

22:59 xeqi: its functional, but still in its infancy

22:59 can't wait for nrepl.el to work well with it

23:00 muhoo: xeqi: that's what i'm using

23:08 and it works. amazing.

23:10 xeqi: hmm, I didn't realize C-c C-k worked if I forced clojure-nrepl-mode for a cljs file

23:10 neat

23:11 though losing M-. is annoying

23:16 muhoo: i lost that years ago as my window manager binds it :-)

23:16 or do you mean dabbrev?

23:17 xeqi: nrepl-jump

23:20 muhoo: hmm, a bigger problem than that for me now is that if cljs gets hung up, any reconections to the process via nrepl.el or lein repl :connect lock up too

23:21 xeqi: refresh the browser ?

23:22 muhoo: tried. it's in the main jvm process itself, it seems to me. i get "user>", but anything after that hangs

23:23 wait, no, not hangs, throws an exception (in a terminal i didn't see)

23:25 https://www.refheap.com/paste/4438

23:26 anwyay, this is very cool stuff, but, sadly, i can't propose delivering a customer project with this stuff yet. so back to java hell i go for the next 3 months. *sigh*

23:38 grettke: Hi folks. What is the definitive source on what version of SLIME should be used for Clojure in Emacs?

23:40 semperos: grettke: unless things have changed recently, the Emacs clojure-mode should handle pulling down what you need, including SLIME

23:42 it requires that you have lein-swank installed as well, but if you look through the clojure-mode and swank-clojure docs on their respective Github repo's, it says *not* to have other versions of SLIME loaded yourself

23:42 grettke: semperos: Thanks. Who is the official maintainer of clojure-mode, I see more than a couple branches out there. Yea I noticed that it pukes on my existing SLIME... great lol.

23:43 semperos: grettke: technomancy_ is the maintainer

23:43 his Github user is the same, minus the final underscore

23:43 grettke: I've ended up "delaying" my various Lisp configs in Emacs, so I can use different versions of everything as needed

23:43 including slime, etc.

23:44 grettke: semperos: I see. Did you cut over to v24 yet? Do folks grab clojure-mode using ELPA these days?

23:44 semperos: I do use v24, have for a while, no issues

23:45 I personally pull in clojure-mode from its Github repo in my .emacs.d, but it gets updated via ELPA/Marmalade frequently enough

23:46 xeqi: I used it from elpa

23:47 grettke: Right now I've got everything in my .emacs.d in vcs but wondering if that manual management can go away since ELPA is here?

Logging service provided by n01se.net