#clojure log - Apr 25 2011

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

0:34 kwertii: Hello. I'm trying to hook up Analemma and Compojure by copying and pasting the Analemma examples. However, when I load one of these pages in my browser, it only displays 2 data points (in all of the examples I've tried.) Everything else looks normal. Any idea what's causing this?

0:46 amalloy: Raynes: i love /about/version. i can see whether dbyrne deployed changes yet

0:51 kwertii: http://pastebin.com/1cty5hFm only 2 "circle" elements appear in the output, rather than 25 as I would expect. Almost verbatim cut and paste from the Analemma docs.

1:05 seancorfield__: finally clubbed #53 into submission... makes your solution look positively elegant tho' amalloy :)

1:06 most of my solutions were fairly brute force :(

1:38 so amalloy why was it 4clojure.com not 4clojure.org ? :)

1:38 amalloy: seancorfield__: don't ask me. dbyrne founded the site and registered the domain

1:39 maybe he really was hoping to cash in on mortgage hunters with bad spelling

1:40 seancorfield__: LOL

1:44 amalloy: seancorfield__: i'll float the suggestion that we register 4clojure.org as well

2:02 ambrosebs: ,(println "test")

2:02 clojurebot: test

2:02 ambrosebs: I'm trying to create a multimethod that dispatches on class of the first and second argument

2:02 ,(defmulti basic (fn [a b] [(class a) (class b)]))

2:02 clojurebot: DENIED

2:03 ambrosebs: oh

2:03 (defmethod basic [clojure.lang.Keyword clojure.lang.Keyword] [a b]

2:03 "yay")

2:03 i'm getting an arity error

2:03 I want (basic :foo :bar) to return "yay"

2:04 amalloy: ambrosebs: your code looks fine. defmulti has defonce-semantics, so you probably need to (def basic nil) to flush the old dispatch function out of your namespace

2:04 ambrosebs: ah

2:05 "yay!"

2:05 thanks amolloy

2:05 amalloy

2:05 amalloy: *chuckle*

2:05 ambrosebs: haha

2:35 fliebel: When I consume a lazy seq on 2 threads, where does the computation happen?

2:36 Raynes: fliebel: How many licks does it take to get to the center of a tootsie roll pop?

2:37 fliebel: 42

2:37 Raynes: Really? The damned owl lied to me.,

2:37 fliebel: Or just as much roads as a man walks down

2:38 or 9*7

2:38 Raynes: But I guess what I really meant to ask is how the work is coordinated, if at all.

2:50 kwertii: was there some subtle change in the semantics of (reduce) in 1.2?

2:50 amalloy: kwertii: not afaik; what's the problem?

2:52 kwertii: amalloy: tracking down what seems to be a bug in the Analemma library. this code http://pastebin.com/DES9YWmS should/used to return a 25 element vector; now it just returns 2

2:54 fliebel: Raynes: I figured it out I think. Lazy seq just seems to lock itself up, so when I have 2 consumers, only one does the actual work.

2:55 amalloy: kwertii: i don't really believe that. reduce would never call your accumulator function more than twice if you pass it a two-element vector to reduce

2:55 kwertii: amalloy: that's what I don't get, this should never have worked

2:56 amalloy: do you have evidence that it did? maybe someone included it as a code example, or a feature that never wound up being used or something

2:57 kwertii: amalloy: it's (points->xy) from line 124 of https://github.com/liebke/analemma/blob/master/src/analemma/charts.clj. The "Labeling Data Points" example at http://liebke.github.com/analemma/ only plots 2 points for me.

3:14 ah. nm. the project documentation had a typo.

3:54 fliebel: Can anyone help me break things? It passes the tests 1000 times in a row, but that does not mean it is perfect. https://gist.github.com/934781

3:56 * fliebel is happy

4:08 markoman: I have (for [division form-coll] ...) how do I get auto increment index number working on this scenario? I mean I have tried let n and (inc n) but cant get it working...

4:10 ambrosebs: ,(map (range) ["first" "second"])

4:10 clojurebot: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn

4:11 ambrosebs: is it zipmap or something

4:11 ,(doc zipmap)

4:11 clojurebot: "([keys vals]); Returns a map with the keys mapped to the corresponding vals."

4:11 ambrosebs: hmm

4:15 ,(map #(vector %1 %2) (range) ["first" "second"])

4:15 clojurebot: ([0 "first"] [1 "second"])

4:15 ambrosebs: is that what you meant markoman?

4:15 then you can use destructuring in the for loop

4:23 markoman: im not sure how it could work in case I have (for [div [{:k 1} {:l 1} {:m 1}] ...)

4:29 ambrosebs: just tripped over my internet.. did you get a solution markoman?

4:31 ,(map #(vector %1 %2) (range) [{:k 1} {:l 1} {:m 1}])

4:31 clojurebot: ([0 {:k 1}] [1 {:l 1}] [2 {:m 1}])

4:31 markoman: Im still struggling: I have this kind of map: (for [div [{:k 1} {:l 1} {:m 1}]] ...)

4:31 ambrosebs: is that similar to the output you need?

4:32 markoman: i suppose i cant use div same way now, I need to get both index and {:k 1} from loop, lets see

4:33 ambrosebs: ,(for [[inx div] (map #(vector %1 %2) (range) [{:k 1} {:l 1} {:m 1}])] (println "index is " inx) (println "div is " div))

4:33 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (5) passed to: core$for

4:33 markoman: ,(for [divs (map #(vector %1 %2) (range) [{:k 1} {:l 1} {:m 1}]) :let [ind (divs 0) div (divs 1)]] (println ind))

4:33 clojurebot: 0

4:33 1

4:33 2

4:33 (nil nil nil)

4:36 markoman: so yes, It could work either way

4:36 btw, it seems its possible to make infinite loop for clojurebot?

4:37 ambrosebs: (range) is lazy

4:37 raek: ,(map-indexed (fn [ind divs] (println ind)) [{:k 1} {:l 1} {:m 1}])

4:37 clojurebot: 0

4:37 1

4:37 2

4:37 (nil nil nil)

4:38 ambrosebs: nice

4:38 markoman: ambrosebs: not in this case but in theory :)

4:39 map-indexed looks nice too

4:39 ambrosebs: how far does it get? :)

4:41 markoman: hmh... it may cause lot of changes to my original code thou

4:41 thorwil: i had a working handler (views/journal models/paginated-articles-converted). but paginated-articles-converted actually has to take an argument. after changing the signature, (views/journal (models/paginated-articles-converted 1)) fails with "clojure.lang.LazySeq cannot be cast to clojure.lang.IFn"

4:44 raek: thorwil: is models/paginated-articles-converted a function?

4:45 thorwil: yes

4:46 http://paste.pocoo.org/show/377742/

4:47 raek: if the exception originates from the line you showed us, then either views/journal or models/paginated-articles-converted most be a lazy-seq and not a function

4:47 ambrosebs: markoman: probably best to stick with the for loop. You don't need a :let at the end, just use destructuring to extract first and second element in vector

4:47 thorwil: raek: paginated-articles-converted does return a lazyseq, but i i change it to use it without argument, the handler works

4:49 raek: thorwil: are you aware of what happens if you have a (def ...) in a function body?

4:49 ambrosebs: markoman: also a bit map: (map vector (range) div)

4:49 *bit shorter

4:50 raek: thorwil: it seems that in the first case, you send the function to views/journal, but in the second case you call the function, and then return the result to views/journal

4:50 thorwil: raek: the fact you ask makes me think no :)

4:50 raek: thorwil: I think #(models/paginated-articles-converted 1) could be what you are looking for

4:51 thorwil: def is only for global variables. even though the call is inside a function, it will have global scope and not local scope

4:51 so, use a let

4:51 or move the def out to the top level

4:51 thorwil: #(models/paginated-articles-converted 1) does the trick

4:51 thank you, raek

4:53 best part of this is that even understand what's going on. i really have to get my mind off of the simple text replacement model that i started with

5:04 markoman: ambrosebs: thanks, I got it working. the context I already have :let statements so it was natural to use it in this case

5:04 ambrosebs: great

5:06 markoman: has anyone used clojure on android 2.2 tabs? im thinking to buy samsung galaxy for a trip

5:07 just to have fun and learning more clojure. I wonder if its full feature clojure and jvm working there...

5:18 fliebel: $google android clojure

5:18 sexpbot: First out of 20500 results is: Android Adverse To Dynamic Languages - Stack Overflow

5:18 http://stackoverflow.com/questions/973386/android-adverse-to-dynamic-languages

5:23 fliebel: markoman: ^^

5:27 markoman: nice talk there

5:31 this is also what I found and thinking: http://www.appbrain.com/app/clojure-repl/com.sattvik.clojure_repl

6:55 Lajla: So

6:55 you guys seen any good shadows to worship lately?

6:59 ttmrichter: I only worship His Divine Shadow.

7:00 http://goo.gl/9WNsg to be specific, Lajla.

7:01 Lajla: Finally

7:01 some one gets it.

7:01 I've been making that reference here for months and no one got it.

7:01 ttmrichter: First time I saw it. :)

7:06 ilyak: hi *

7:06 in ccw eclipse plugin, how do I tune JVM parameters of VM that starts when I open current file in REPL?

7:11 cemerick: ilyak: See the run configurations associated with the project/file you're starting the REPL from.

7:11 Menu item @ Run -> Run Configurations

7:15 ilyak: Yeah, thanks

7:15 found it

7:16 What's the best way to find the cause of stackoverflowerror?

7:16 I can't find where it originates from

7:17 cemerick: If you print the stack trace, one of the mentioned repeated lines will be where you're performing unbounded recursion.

7:25 ilyak: In fact it's not because there are not enough lines by default

7:27 cemerick: The line that's shown is where you're making the bad recursive call, no? Otherwise, you wouldn't blow stack.

7:28 ilyak: After slashing stack size I've found that the problem seems to be the accumulation of drop-whiles in split-with

7:28 I.e. I do (split-with foo lazy-seq)

7:28 markoman: is there some easy way to make "unique" shortened strings from any string like: "what ever long phrase" -> "9WNsg" ?

7:28 ilyak: lazy-seq is [_ lazy-seq] (split-with foo lazy-seq) itself

7:29 and therefore sometimes on unlucky data this chain can become too long

7:29 cemerick: markoman: that's hashing?

7:30 ilyak: that must be a *huge* chain

7:30 ilyak: (I think it frees when drop-while finds something to drop and therefore returns a new clean head

7:30 markoman: yes, I think so.

7:30 ilyak: cemerick: The whole sequence is like 2 mln records

7:30 but the problem only happens after 1 mln are processed

7:31 Still I don't understand yet how to fix that problem

7:31 raek: ilyak: you can add a (doall ...) around each split-with call

7:32 ilyak: raek: Would it unwind all 2 mln records? If it would, it's unfeasible

7:32 markoman: i was guessing 22 chars * 2 (small and capitals) + 10 numbers = 54 with 5 long string would give enough combination for my use

7:32 raek: ...that will cause the steps to be forced incrementally, instead of building up a huge chunk of work

7:33 ilyak: this can be a solution if you have something that becomes (map f (map f (map f (map f .... (map f some-small-coll) ...))))

7:34 cemerick: markoman: you could just base-36-encode the hashCode of the string in question

7:34 raek: i.e. when the resulting sequence is not very long, but when the number of copmutations is very large

7:34 ilyak: can I force finding the next record of a lazy sequence and using it as "head" so it would drop all the chain it needed to get to that "head"?

7:34 cemerick: That's certainly easy. It depends on what characteristics you want out of your hash function.

7:35 raek: ilyak: sure, that's what this "losing your head" thing is about

7:35 markoman: i see

7:36 raek: ilyak: but holding on to the head does not cause a stack overflow, it will cause an out of memory error

7:36 ilyak: I don't hold head

7:37 Rather I pass a drop-while sequence around instead of head of sequence found with drop-while

7:37 cemerick: so you're just doing a ton of filtering, essentially?

7:37 ilyak: i.e. immediate drop-while would return a new head

7:37 cemerick: I'm reading three sorted files and then applying a function of rec1 [recs2] [recs3]

7:38 where rec1, recs2, recs3 are records with same id from different files

7:38 therefore I have three tails which I compute by split-with

7:39 markoman: i found this said on web: base 62 makes a distinction between upper and lower-case letters

7:39 ilyak: is there a way to eagerly call drop-while, i.e. assign the lazy sequence that drop-while would find to variable instead of asssigning a lazy drop-while to it?

7:39 cemerick: The data and semantics are irrelevant, I think. The point is that you're not consuming the seq, you're lazily building up a series of drop-* results?

7:41 raek: if what cemerick said is true, the perhaps you can do something like (do (first the-old-lazy-seq) (drop-while ... the-old-lazy-seq)) instead of just (drop-while ... the-old-lazy-seq)

7:41 to "shake out" the laziness up to the first element

7:41 cemerick: raek: if what I said is true, then just (seq (drop-while …)) should do it << ilyak

7:41 ilyak: Would that help? I think that the-old-lazy-seq would not mutate and would still be lazy

7:42 isn't it?

7:42 raek: oh. that's better. :)

7:42 cemerick: ilyak: lazy seqs are always lazy; it's not like a bit flips and they're not lazy anymore. :-) You can certainly have a partially-realized lazy seq.

7:43 hrm, I didn't say that quite right :-P

7:43 ilyak: I've tried wrapping recur parameters with do

7:43 ...and it didn't work

7:43 cemerick: `do` doesn't do anything

7:43 raek: (didn't think of the fact that 'seq' actually forces the first element)

7:45 cemerick: ilyak: try (seq (drop-* …))

7:45 ilyak: Added two (first rest-foo)

7:45 raek: ilyak: do has nothing to do with laziness. it's just a way to evaluate multiple expressions in the place of one (the result of the last one is returned). this is usually done for side-effects

7:45 ilyak: raek: (first)ing those seems to do the trick

7:46 it's ugly tho because it now depends on that side-effect of first\

7:46 I'll try with (seq)

7:46 cemerick: first and seq are not side-effecting

7:48 ilyak: cemerick: In this case (first) is

7:48 it de-lazies seq preventing SOE, isn't it

7:49 cemerick: ilyak: materializing a lazy seq is not a side effect, unless the head's value causes IO and such in order to be determined -- but that's application-dependent, not a characteristic of first/seq

7:51 raek: I guess it depends on what you consider a side-effect. one way of defining side-effects is as anything a function does except for producing a value.

7:52 cemerick: You can pass slurp and some args to apply; that doesn't make apply side-effecting.

7:53 raek: ...but I guess Haskell guys wouldn't say that `seq` performs a side-effect

7:53 (the Haskell `seq`)

8:03 ilyak: cemerick: I think that side-effect is anything that affects program execution not thru return value

8:03 This one affects (no SOE)

8:06 cemerick: ilyak: it's an interesting case

8:08 the seq call is affecting program execution via return value, but I can see how the SOE could be seen as a side effect

8:09 I think it might be more accurate to say that the unwinding of lazy seqs are potentially side-effecting given the potential of SOEs in the context of specific sets of seq transformations.

8:26 TimMc: "SOE"?

8:27 raek: StackOverflowError

8:28 TimMc: ah

8:49 fliebel: Does anyone know a nice language that lets you do pointers and memory management, but still do high level functional stuff?

8:50 Remotely related: What was the lisp used by that old game company?

8:59 TimMc: fliebel: Rust, in maybe 5 years.

9:04 ilyak: fliebel: haskell

9:04 also, afaik, ocaml

9:06 cemerick: factor, perhaps

9:22 manutter: haskell lets you manipulate pointers and do your own memory management?

10:05 jweiss: does leiningen support setting properties, like in a pom with <property>?

10:07 manutter: hmm, http://clojuredocs.org/leiningen/lancet/set-properties!

10:07 only it's an empty page template

10:13 bennylu: hi all, is there a way to get the source of a function after it is writen to the repl? rep-utils/source can do it only if the source script is available but i want to get the source for a function writen directly to the repl

10:14 raek: bennylu: no :)

10:15 when a (fn ...) is evaluated it will be compiled into bytecode and loaded. the source code is not stored with it

10:16 I would recommend using an editor that supports a "eval expression" feature

10:17 I have only used Emacs and Eclipse for that so far

10:17 bennylu: anyone?

10:17 clojurebot: Please do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.

10:17 raek: (and they can both do it)

10:18 clojurebot: hush. his question was fine.

10:18 clojurebot: Huh?

10:21 bennylu: raek, thanks i guess i will have to redefine defn to include the source in the metadata of the var ..

10:23 raek: bennylu: so you need to programmatically get the sourcecode of a function at runtime?

10:24 fliebel: bennylu: Are you aware of he *1*2 and *3 vars?

10:24 oh, noe… stupid thinking

10:25 bennylu: raek, yep..

10:25 fliebel: rlwrap/readline seems to know what I wrote though :)

10:26 raek: most repl wrappers (Emacs, leiningen, directly or indirectly via JLine or rlwrap) have command line history, but I don't think that was the problem here

10:26 bennylu: fliebel, but i cant know when the function was writen - what i need is a command to store the newly created function into a script file - after someone writen it in the repl

10:26 raek: bennylu: what problem are you solving with this approach?

10:27 ah

10:27 I think this is more easily achieved by storing the user's input instead

10:27 fliebel: Who wrote that gist for a printable fn?

10:28 raek: either in text form (before form) or in datastructure form (after reader)

10:34 bennylu: raek, this is also a possability but it forcing the user of my program to create a function twice - once via defn and after (or before) adding it source to a datastracture- i was hoping to eliminate this behaviour .. and let the user program with (as close as i can) native clojure then call (save fn) ..

10:40 raek: bennylu: my idea was that your code would sit between the user and the clojure repl. this can be done by making a new Reader and Writer (e.g. with proxy) and using http://clojuredocs.org/clojure_core/clojure.main/repl

10:41 bennylu: also: https://github.com/technomancy/serializable-fn

10:41 with this, your original approach might indeed be possible

10:58 bennylu: is there a way to backup a macro - i want to override the defn macro but saving the old defenition of defn as other macro

10:58 gfrlog: that sounds like a totally normal thing to do

10:59 dammit I can't be in here for one minute without saying something sarcastic...

11:00 fliebel: bennylu: Look at refer-clojure. You can have your own, and still use the clojure.core one with its full name.

11:02 gfrlog: are the clojure-cucumber tools well integrated with compojure?

11:12 bennylu: raek, if you interested - this is what i writen, any better solution?(defmacro defn+

11:12 [& params]

11:12 `(do

11:12 (defn ~@params)

11:12 (def ~(first params)

11:12 (with-meta

11:12 ~(first params)

11:12 {:source (str

11:12 "(defn "

11:12 ~@(interleave (map str params) (repeat " "))

11:12 ")"

11:12 )}))))

11:12 raek: bennylu: gist.github.com

11:13 bennylu: you could simply add the metadata to (first params) instead of defining it twice

11:14 bennylu: https://gist.github.com/940651

11:14 raek, i tried but for some reason it hasnt got the same effect ..

11:15 gfrlog: would the source be nicer as an s-expression than a string?

11:15 (I'm not sure why I thought of that...)

11:16 raek: bennylu: also, str won't give the correct result. you probably want pr-str on the whole thing

11:16 bennylu: gfrlog, it can be nice but for my project i need to save the source to file - so it is one less function call

11:16 gfrlog: if nothing else I think (pr-str (cons 'defn params)) would be shorter

11:16 right, what raek was saying

11:17 raek: bennylu: I still think that storing what is passed to the evaluator before it is evaluated is a more general and simpler approach

11:17 bennylu: gfrlog, raek, didnt know about pr-str - i will read about it now ..

11:17 gfrlog: it's a handy thing

11:18 raek: but I still don't know enough about the big picture idea of what you are trying to solve

11:18 so it's hard to know what's best

11:18 bennylu: raek, but how can i know without reparsing the strings that was given to the terminal where was the function decleration

11:21 gfrlog: is anybody using cucumber with clojure? the lein-cuke project doesn't seem to be up-to-date :-/

11:21 bennylu: raek, i adding clojure repl to an existing program and transforming it to somting similer to emacs (where clojure functions can be submited as events listeners at run time ) and if a user want to persist the behaviour that he just added he would write (save function-name) and this function will be registered automaticly at program startup

11:23 gfrlog: oh this reminds me of an idea I had to make lazy seqs printable...

11:26 raek: gfrlog: but lazy-seqs are printable: ##(pr-str (range 10))

11:26 sexpbot: ⟹ "(0 1 2 3 4 5 6 7 8 9)"

11:26 gfrlog: raek: ##(pr-str (iterate inc 0))

11:26 raek: (but maybe that was the point)

11:26 gfrlog: raek: what I want is...

11:26 sexpbot: Execution Timed Out!

11:27 raek: ah, that kind... :)

11:27 gfrlog: (pr-str (drop 20 (iterate inc 0))) => (iterate inc 20)

11:27 raek: thought you were referring to ##(str (range 10))

11:27 sexpbot: ⟹ "clojure.lang.LazySeq@9ebadac6"

11:27 gfrlog: oh right

11:27 raek: which might give one the impression that they cant be printed...

11:28 gfrlog: yeah it would

11:29 raek: bennylu: I know little about how these things are usually done. it could be worth to investigate how other lisps do such things (if they do it), for example emacs lisp

11:30 I have to go now, but I don't see any reason that your alternative defn macro wouldn't work

11:31 bennylu: gfrlog, raek, https://gist.github.com/940669 this is the implementation using pr-str - neat function.. but still have to do double defining - i guess that if i want to remove this behaviour i will have to use def and not defn but this will make me have to rewrite defn and if it will get changed i will have to rewrite it again every time .. (or am i missing somthing? )

11:32 raek: no, you should be able to add metadata on the name symbol

11:32 bennylu: i will try again ..

11:32 raek: perhaps you could look at the sourcecode for clojure.contrib.def

11:33 when you are still developing the macro, it might be best to not call it defn

11:34 to make it simpler to not mess up things

11:34 oh, you already did that... :)

11:34 my bad

11:35 bennylu: raek, (defn (with-meta x {:bla 'bli}) [] (print "hi")) => java.lang.Exception: First argument to def must be a Symbol (repl-1:49)

11:36 gfrlog: this sounds like the kind of situation where quining skills could be applicable...

11:36 * gfrlog didn't think he'd ever be able to say such a thing and mean it

11:36 raek: (defmacro defn+ [name & params] `(defn ~(with-meta name {:source (list* 'defn name params)}) ~@params))

11:40 bennylu: raek, (defn+ hello [] (print "hello")) => java.lang.LinkageError: loader (instance of clojure/lang/DynamicClassLoader): attempted duplicate class definition for name: "learned$hello"

11:41 raek: hrm, saw that too...

11:42 thorwil: is there a shortcut to define things like {:adam adam :eve eve :snarf snarf}, working from def's or let bindings for adam ...?

11:43 gfrlog: ,(into {} (for [x ["adam" "eve" "snarf"]] [(keyword x) (symbol x)]))

11:43 clojurebot: {:adam adam, :eve eve, :snarf snarf}

11:43 gfrlog: beyond that I have no idea

11:43 raek: thorwil: you can make a macro for that, but here is nothing like this in core

11:44 thorwil: ok, i was already trying to write a function for it

11:45 raek: it isn't possible to make this as a function, since you need to know the names of the local variables

11:46 (defmacro map-shortcut [& syms] (zipmap (map (comp keyword name) syms) syms))

11:47 user=> (let [a 1, b 2] (map-shortcut a b))

11:47 {:b 2, :a 1}

11:47 thorwil: ty

11:48 gfrlog: oh hmmm

11:48 thorwil: oh boy, this is the second time i run into the you-don't-actually-have-the-names-at-that-point thing. maybe i will learn it, after all :}

11:49 gfrlog: oh the joy of macros. They never backfire.

11:50 thorwil: gfrlog: ? my admittedly very limited experience suggests that they do backfire sometimes, making it harder to compose on top of them

11:50 raek: bennylu: (defmacro defn+ [name & params] `(defn ~(vary-meta name assoc :source-form (list 'quote (list* 'defn name params))) ~@params))

11:50 gfrlog: I agree. I have a bad habit of using too much irony in IRC.

11:50 raek: I forgot that the metadata is evaluated too

11:51 thorwil: gfrlog: i see. i never use any irony in any place

11:52 gfrlog: thorwil: I think the normal approach is to create a function that does what you need using ugly syntax, and a macro that does just the syntax-sugar part. In this case though there's no corresponding function

11:52 and probably little danger

11:56 hmmm

12:02 does leingingen let you specify a git repo for a dependency, or is there no way to accomplish that besides sticking something on clojars?

12:09 technomancy: gfrlog: you probably want either a private archiva/nexus instance or checkout dependencies

12:10 gfrlog: technomancy: is "checkout dependencies" a noun or an imperative?

12:11 technomancy: oh heh; it's a noun. should be covered in lein help faq.

12:11 gfrlog: okay thanks

12:11 technomancy: or rather lein help readme, under the fqa

12:11 faq

12:12 * gfrlog is ashamed he didn't find it himself

12:12 technomancy: it's hard to make a feautre like that discoverable

12:13 gfrlog: hmm, maybe "Leiningen is a build tool for Clojure designed to not set your hair on fire, and it has a nice checkout-dependencies feature."

12:14 technomancy: it's friendly.

12:14 gfrlog: :)

12:21 technomancy: so do I leave the project out of the 'project.clj' file?

12:22 * gfrlog noticed that "document checkout dependencies" is listed in technomancy's todo file and so doesn't feel bad asking

12:22 ilyak: How do I run clojure tests in ccw?

12:24 technomancy: gfrlog: no, checkout dependencies supplement dependencies in project.clj

12:25 gfrlog: technomancy: I think I'm using it wrong...doesn't leiningen have to know not to download the dep from clojars?

12:26 ilyak: I run test file in repl, nothing happens, I press ctrl-t, my eclipse hangs

12:34 Okay, figured that out

12:34 Now when I press ctrl-t, nothing happens

12:34 where does the test result go?

12:39 cemerick: ilyak: The run tests feature in CCW is ancient, ill-conceived, and from a prior regime. :-)

12:40 I think Laurent is going to simply rip it out in the next patch release.

12:40 ilyak: cemerick: sad

12:40 doing (run-tests) by hand

12:40 cemerick: ilyak: it's not at all clear what a "Run Tests" command should do.

12:40 ilyak: cemerick: It should run tests!

12:41 And display results

12:41 ieure: Haha.

12:41 cemerick: ilyak: For what? clojure.test, lazytest, midje?

12:41 ilyak: cemerick: clojure-test

12:41 cemerick: ilyak: all well and good, except for those that don't use it. :-P

12:42 ilyak: Why? I already see it's pretty basic tho

12:42 cemerick: Right, lots of people like having various bells and whistles that clojure.test doesn't provide.

12:42 In any case, test-ns (or whatever) from the REPL is hard to beat in terms of usability.

12:45 ilyak: It's two step

12:45 Run REPL, type in

12:45 technomancy: replaca: does clojure.pprint have any mechanism for pprinting clojure code?

12:46 or is it planned?

12:47 amalloy: technomancy: i'm a bit puzzled how it could work. it would have to be psychic to guess where to put the newlines, no?

12:49 technomancy: amalloy: well, it could know the basics for common stuff like if

12:49 ieure: Ugly code goes in, pretty code comes out. You can’t explain that.

12:51 dnolen: technomancy: clojure.pprint has a code mode, that's how macroexpand works in swank-clojure

12:51 technomancy: dnolen: aha; I missed that somehow. thanks.

13:04 ilyak: What would (= a b c) return?

13:05 amalloy: true iff a==b==c

13:05 ilyak: cool

13:05 I hope you don't mean c == (a == b) which is boolean

13:05 amalloy: lol

13:05 no, this isn't java

13:05 &(= 10 10 10)

13:05 sexpbot: ⟹ true

13:05 amalloy: &(= false false false)

13:05 sexpbot: ⟹ true

13:07 gfrlog: ,(= 7)

13:07 clojurebot: true

13:07 gfrlog: ,(=)

13:07 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$-EQ-

13:10 gfrlog: &(let [x 15] ((binding [x 10] (fn [] x))))

13:11 sexpbot: java.lang.Exception: Unable to resolve var: x in this context

13:11 gfrlog: oh nm

13:12 &((binding [+ (constantly 20)] +))

13:12 sexpbot: ⟹ 20

13:12 gfrlog: &((binding [+ (constantly 20)] (fn [] (+))))

13:12 sexpbot: ⟹ 0

13:12 gfrlog: something I hadn't considered before...

13:16 &(take 10 (binding [+ (constantly 20)] (let [ret (repeatedly (fn [] (+)))] (doall (take 5 ret)) ret)))

13:16 sexpbot: ⟹ (20 20 20 20 20 0 0 0 0 0)

13:16 gfrlog: binding + laziness == weird

13:32 amalloy: i need to attend a Juxt Abusers Anonymous meeting. writing an email and slipped in juxt instead of just

13:34 gfrlog: that'd probably be a fn meeting

13:34 amalloy: augh

13:45 clizzin: is there anything required besides a :gen-class in ns and a -main function in order to make something work via jar? i'm getting an error message about not being able to find the class that is my ns

13:51 ilyak: clojure doesn't have binary literals does it?

13:52 seancorfield: amalloy: i just tried the RSS feed on 4clojure.com and RockMelt rejected it as not being valid - just FYI

13:52 gfrlog: ilyak: nope

13:52 ,0b0110110

13:52 clojurebot: Invalid number: 0b0110110

13:52 seancorfield: also it looks like you don't have the right RSS autodiscovery metadata in place... since my browser isn't showing the feed as available when i visit the page

13:53 ,0x36

13:53 clojurebot: 54

13:53 seancorfield: ,2r0110110

13:53 clojurebot: 54

13:53 seancorfield: so, yes, it has binary literals but using the {base}r{number} format

13:54 gfrlog: I'm a disgusting liar

13:54 seancorfield: i didn't know until i tried it :)

13:54 gfrlog: ,3r0112012

13:54 clojurebot: 383

13:54 ilyak: ,(+ 1 nil 2)

13:54 clojurebot: java.lang.NullPointerException

13:55 Raynes: seancorfield: Duly noted. Feel like making an issue on the github page?

13:55 gfrlog: the cantor set is the set of all numbers in the unit interval that can be expressed in ternary with just 0's and 2's

13:55 I think

13:55 seancorfield: Raynes: remind me of the 4clojure github URL? is it /dbyrne/4clojure ?

13:55 Raynes: http://github.com/dbyrne/4clojure

13:56 seancorfield: yay, i guessed right!

13:56 Raynes: :)

13:57 amalloy: &#b1010

13:57 sexpbot: java.lang.Exception: No dispatch macro for: b

13:57 amalloy: oh well

13:58 seancorfield: yeah, having <link rel> stuff for the rss feed would be nice

13:59 seancorfield: added issue with metadata that i think is correct

14:00 8r66

14:00 ,8r66

14:00 clojurebot: 54

14:00 gfrlog: ,66r8

14:00 clojurebot: Radix out of range

14:00 amalloy: seancorfield: chrome doesn't like it either, fwiw. firefox is happy with it

14:00 seancorfield: ,13r42

14:00 clojurebot: 54

14:00 seancorfield: 6 * 9 = 42 in base 13 (HHGTTG)

14:01 ataggart: radix is limited to what could be supported with [0-9a-z]

14:01 seancorfield: yeah, i just tested in chrome and that's what rockmelt is based on

14:01 gfrlog: seancorfield: my personal interpretation is that that was not the intention

14:01 seancorfield: gfrlog: possibly - but it is funny :)

14:02 amalloy: we probably need to wrap links/descriptions in CDATA sections or something

14:02 gfrlog: I think it's funnier to think that the ultimate question is meaningless and the ultimate answer is wrong

14:08 seancorfield: amalloy: i opened two separate issues - one for auto-detect, one for chrome/rockmelt compatibility

14:08 rockmelt serves as my RSS reader (and main browser)

14:09 amalloy: does 4clojure save all the solutions? will users be able to review their submissions and update them with cleaner solutions later?

14:10 i know if you share your solution, it gists it...

14:11 amalloy: seancorfield: we'd like to eventually. currently we persist hardly anything

14:12 seancorfield: you only save which problems they've solved? (looking at the code - nice, clean code)

14:12 amalloy: seancorfield: yes, though i'm working on a branch to track how many characters the solutions are, to start a code-golf league

14:14 seancorfield: heh, what about folks who've already solved them (and didn't gist any of them)? :)

14:14 i have a few of mine in files locally - when i struggled to solve them... and man, are some of them fugly!

14:15 it was a great fun project to work on over the weekend - thoroughly enjoyed the problems so far!

14:16 unfortunately it completely distracted me from working on a talk i'm giving at a conference in three weeks :(

14:25 amalloy: seancorfield: good news: three weeks is a long time

14:27 ilyak: How do I make a lazy function call

14:27 Or whatever

14:28 I want some expression only execute when its value is used somewhere\

14:29 hiredman: (doc delay)

14:29 clojurebot: "([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls."

14:31 ilyak: It isn't transparent :((

14:35 ataggart: (defn dfn [f & args] (let [d (delay (apply f args))] #(deref d)))

14:35 ilyak: how do I destructure a seq into head tail?

14:36 ataggart: you can't destructure for the tail

14:37 but you can name the whole seq, e.g., (let [[head :as whole] aseq] [head (rest whole)])

14:38 technomancy: ilyak: it's not transparent, but you can call force on any value, not just delays.

14:39 ataggart: ,(deref 5)

14:39 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IDeref

14:39 amalloy: ataggart: huh? you can't destructure the tail? ##(let [[head & tail] (range 4)] [head tail])

14:39 sexpbot: ⟹ [0 (1 2 3)]

14:39 ataggart: ,(force 5)

14:39 clojurebot: 5

14:40 ataggart: amalloy: wow am I an idiot

14:40 the coffee, it does nothing!

14:41 ilyak: technomancy: The problem is: I do let [foo (bar)]

14:41 and (bar) immediately gets called :(

14:41 ataggart: ilyak, did you see the dfn example I gave above?

14:41 ilyak: even if I don't use foo

14:41 ataggart: ilyak: what do you mean by "use foo"?

14:41 ilyak: ataggart: I did

14:42 ataggart: is foo a fn that you plan on calling?

14:42 amalloy: clojure has laziness all over, but you can't really sprinkle magic lazy-dust over it and get haskell out

14:42 ilyak: ataggart: It's a variable. I use it in if's predicate

14:42 Sometimes it can't be calculated, then I won't use it

14:44 ataggart: an example usage might help clarify things

14:44 ilyak: However it tries to compute immediately

14:44 (if (> new-weight best-weight) new-right)

14:45 there, new-weight and best-weight are declared in let and might be not computable

14:45 If they aren't, this if won't be executed

14:45 but they are computed anyway, it seems

14:45 ataggart: then don't call them in the let binding

14:46 and you're omitting the important part, namely the boundary between calling and not-calling

14:48 ilyak: ataggart: The boundary is another if

14:48 ataggart: an example usage might help clarify things

14:50 ilyak: Oops, it seems that I had a logical problem

14:52 ataggart: http://pastebin.com/mNURgYRr

14:52 Please ignore the fact that it's a half-assed fold

14:53 if remaining-rights is empty, nothing would be executed

14:53 which doesn't prevent calculation of new-weight, which would then fail on nil input

14:53 please disregard the thing

14:54 I think it shouldn't happen on my input, so my problem lies somewhere else

14:54 I'll try to confirm

14:58 ataggart: Can you look at my example? I've figured that it's still the case.

15:00 amalloy: ilyak: when you ask to call a function, it gets called

15:00 if you want to not call it sometimes, then wait until you've decided whether to call it or not, and then either call it or don't

15:01 or do as hiredman and technomancy suggested: wrap it in a delay, and force it if you decide you need it

15:02 ataggart: https://gist.github.com/941012

15:02 ilyak: ^

15:11 ilyak: ,(cond false "a" "b")

15:11 clojurebot: java.lang.RuntimeException: java.lang.IllegalArgumentException: cond requires an even number of forms

15:11 ilyak: sad

15:11 why doesn't it have else on last odd

15:11 jweiss: for core fn's that take predicates, do those preds need to return true/false, or just does it behave just the same with non-nil/nil?

15:12 ataggart: for the same reason 'if doesn't, they default to returning nil

15:12 mec: jweiss: truthy and falsy

15:12 jweiss: mec - so it's idiomatic to make preds (fns with ? at the end) that return truthy and falsey rather than true/false?

15:13 eg, i can call "some" in my pred and just return whatever it returns

15:14 mec: jweiss: ah I believe pred? should return true and false/nil, and pred should return something useful and false/nil

15:14 ataggart: pred-taking fns use logical truth, fns ending in ? return booleans

15:14 jweiss: ataggart: ok, so my next question is, is there a core fn that converts truthy/falsey to true/false

15:14 (not (nil? x)) does it but that's 2 calls :)

15:14 amalloy: boolean

15:15 &(map boolean [1 true false nil])

15:15 sexpbot: ⟹ (true true false false)

15:15 jweiss: sweet thx

15:15 amalloy: jweiss: (complement nil?) is also wrong, since it would convert false to true

15:16 mec: Is there a non-imperative way to do this: (let [x (if (pred-a x) (b x) (c x)) x (if (pred-d x) (e x) (f x))] ...)

15:16 jweiss: ah right

15:17 mec: jweiss: (comp not not)

15:17 jweiss: mec - fun but i can imagine scratching my head when i read that code later :)

15:17 mec: Although I don't think that should be used, exactly

15:18 amalloy: mec: you could use https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/transform.clj#L4 and (comp) together two calls to it

15:18 (let [decider-fn (comp (transform-if pred-a b c) (transform-if pred-d e x)), x (decider-fn x)]...)

15:19 though i guess you'd want to reverse the other of the two comp'd functions

15:20 mec: ya

15:20 I like that you dont have to repeat yourself, but I'm not sure thats any clearer for me

15:25 ilyak: I've rewrote it into fold

15:43 stuarthalloway: cemerick: you around?

15:44 cemerick: stuarthalloway: for the moment :-)

15:44 stuarthalloway: quick rummage question for you

15:44 would you be open to having build-attrs and delete-attrs call as-set instead of as-collection?

15:45 as it works right now, all Clojure collection types get shoehorned into SDB's set-valued semantics

15:47 cemerick: if rummage made parameters with as-set, then https://gist.github.com/941069 would be a great encoding map (IMO)

15:48 cemerick: stuarthalloway: I was going to say, that change wouldn't matter unless you were collection-type-dependent in an encoding

15:48 stuarthalloway: cemerick: just wondering when you would want ordered collections to magically become sets in SDB

15:49 if there are use cases for it then I will find another way to get pure Clojure encoding

15:50 cemerick: stuarthalloway: I don't think I considered it explicitly. I've been assuming that values are scalars or sets.

15:50 stuarthalloway: got to run; I'll mull it over

15:50 maybe it's time to have a rummage GGroup :-P

15:50 stuarthalloway: cemerick: thanks. Cheers!

16:05 malkomalko: is there a quick way to pull out certain columns from a vector? I know about nth, but that works on one col.. possibly juxt? I know I can probably do it with map, but was looking for another way

16:07 mrBliss`: ,(select-keys '[a b c d] [1 2])

16:07 clojurebot: {2 c, 1 b}

16:08 malkomalko: guess (map #(nth v %) [1 3 5]) works just as well

16:09 TimMc: (map (partial get v) indices)

16:11 amalloy: &(map '[a b c d] [1 2])?

16:11 sexpbot: ⟹ (b c)

16:12 amalloy: malkomalko: ^

16:12 no_mind: do function calls with a bang in the end represent something special in clojure ?

16:13 pdk: example?

16:13 clojurebot: examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples

16:13 TimMc: no_mind: They are a note to the programmer that mutation will occur.

16:13 malkomalko: amalloy: how does that work? :)

16:13 pdk: ah yeah

16:13 if the function is named with !

16:14 TimMc: amalloy: Ack! Of course.

16:14 pdk: that's basically a warning "this may clobber stuff"

16:14 amalloy: &('[a b c d] 2)

16:14 sexpbot: ⟹ c

16:14 amalloy: &('[a b c d] 1)

16:14 sexpbot: ⟹ b

16:14 amalloy: it works like that

16:14 TimMc: malkomalko: Vectors are functions of indices to values. :-)

16:14 malkomalko: ahhhh hah

16:14 right!

16:15 thanks... always forget

16:24 TimMc: no_mind: Specifically, bang is often used to mark a function that may not *obviously* have side effects, or is an alternative version that uses side effects.

16:25 no_mind: k

16:26 raek: more specifically, it signifies that the side-effects are not safe in a transaction

16:26 (compare 'alter' for refs and 'swap!' for atoms)

16:29 S11001001: b

16:32 TimMc: raek: Ah! Nice distinction.

16:54 mec: Is there any way to create 2 maps that contain eachother?

16:56 _gfrlog: mec: nope

16:56 mec: I think that would violate some of the assumptions that you can make about immutable data

16:57 and maybe one of the axioms of set theory

17:14 mec: Is there anyway to delay a value in a map until its key is accessed? (:a {:a (delay ...)}) without needing @(:a {:a (delay ...)})

17:15 TimMc: _gfrlog: There might be some Haskelly way of doing it.

17:17 amalloy: mec: you don't need @ - you can use force, which will also be safe on non-delay objects

17:17 mec: amalloy: no way to do it transparently?

17:18 amalloy: mec: no. if there were, there would be no way to refer to delays *without* forcing them

17:18 mec: true

17:18 _gfrlog: TimMc: yeah?

17:19 mec: a curried function has a similar functionaly

17:19 s/functionaly/functionality

17:19 sexpbot: <_gfrlog> mec: a curried function has a similar functionality

17:29 gfrlog_: TimMc: what happens if I create a map of all maps that do not contain themselves?

17:30 ataggart: ,(long 10000000000000000000/3)

17:30 clojurebot: 3333333333333333333

17:30 mec: you blow the stack?

17:30 ataggart: ,(double 10000000000000000000/3)

17:30 clojurebot: 3.333333333333333E18

17:30 amalloy: the heap, probably

17:30 gfrlog_: but will it contain itself!!??!1

17:31 amalloy: gfrlog_: you'll never know. you'll run out of heap before you get to calculating all its elements

17:31 ataggart: ,(long *1)

17:31 clojurebot: java.lang.IllegalStateException: Var clojure.core/*1 is unbound.

17:31 gfrlog_: amalloy: okay, what if I did it on a clojure turing machine?

17:32 mec: Heat death of the universe?

17:32 gfrlog_: new project: cluring machine

17:33 turing majine?

17:34 hiredman: clasical turing machines are both single threaded and mutation based

17:35 gfrlog_: hiredman: we can simulate both

17:37 hugod_: is this expected behaviour? ##(let [f (fn [x] x)] (= f (vary-meta f assoc :b 1)))

17:37 sexpbot: ⟹ false

17:38 amalloy: yes. functions don't have "values"

17:38 they're compared with identical?, and if you assoc in some new meta you get a new pointer

17:40 hugod_: ok. hw annoying…

17:46 ataggart: can someone else please double check my thinking that the float->long conversion test is wrong: https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/numbers.clj#L109

17:46 brehaut: TimMc, gfrlog_ the haskelly way is http://www.haskell.org/haskellwiki/Tying_the_Knot

17:47 TimMc, gfrlog_ though im dubious that it would work with a strict datatype

17:49 gfrlog_: TimMc: man now I gotta read haskell syntax...

17:51 brehaut: gfrlog_: maps are strict, so perhaps you shouldnt worry about it

17:51 TimMc: I don't suppose the Clojure reader supports sharp variables, like Mozilla's JS does?

17:52 gfrlog_: brehaut: what's a strict datatype?

17:53 TimMc: letrec in Scheme can do recursive lists, I think.

17:53 amalloy: TimMc: it doesn't

17:53 gfrlog_: any mutable datatypes can do recursion like that

17:54 brehaut: gfrlog_: one with strict (rather than non-strict) evaluation semantics. the opposite of lazy. in clojure all the builts are strict except seqs; in haskell the majority of datatypes are non-strict by default (not quite the same as lazy, but close enough)

17:54 gfrlog_: brehaut: gotcha

17:54 come to think of it, I think that means a clojure list can contain itself, doesn't it?

17:55 brehaut: a clojure sequence can, not sure about a list

17:55 gfrlog_: ah right

17:55 brehaut: ,(take 10 (cycle [1 2 3]))

17:55 clojurebot: (1 2 3 1 2 3 1 2 3 1)

17:55 gfrlog_: uh

17:55 I don't think that's at all what I meant

17:56 brehaut: its implementation dependant on cycle i guess, but its easy to conceive of an imp that does exactly what you suggest

17:56 raek: gfrlog_: yes: (def ones (lazy-seq (cons 1 ones)))

17:57 gfrlog_: I new there'd be a short way to do it

17:57 raek: don't forget your (set! *print-length* <finite number here>) when playing around with these things :-)

17:57 gfrlog_: of course

17:58 man this is like finding out that santa clause doesn't exist

17:59 laziness doesn't necessitate self-reference though, does it?

17:59 just laziness with mutability?

17:59 raek: the expression in (lazy-seq ...) can be anything seqable

18:00 gfrlog_: but could you do the same thing in haskell?

18:00 brehaut: gfrlog_: you dont need mutability for self reference and laziness

18:00 gfrlog_: trivially. the haskell version is ones = 1: ones

18:00 raek: (also, my example was an example of a sequence that has itself as its rest, not a list)

18:01 gfrlog_: brehaut: that's valid haskell?

18:01 brehaut: yes

18:01 gfrlog_: brehaut: I am surprised

18:01 brehaut: modulo any type errors i might have made

18:01 raek: if clojure would be non-strict, it would be (def ones (cons 1 ones))

18:02 brehaut: gfrlog_: haskells lists are its seqs; they dont have a seperation

18:02 gfrlog_ and : is cons in haskell, its simply defining a constant sequence

18:03 gfrlog_: brehaut: yeah, I understand that much

18:03 brehaut: I just would expect that using a variable in its own definition would be disallowed

18:03 brehaut: gfrlog_: not in a non-strict language

18:03 gfrlog_: its exactly like raeks definition of ones above

18:04 gfrlog_: the most common example of it in haskell is sadly the very nerdy fib definition

18:04 gfrlog_: brehaut: what would it harm if you did disallow it?

18:04 brehaut: well cyclic data structures would be out

18:05 (cyclic by reference anyway)

18:05 gfrlog_: brehaut: right, that's what I'm trying to remove :)

18:05 raek: and recursive functions?

18:05 brehaut: raek: yeah i think you are right

18:05 gfrlog_: raek: no you can do recursion indirectly

18:05 * brehaut is not experienced enough with haskell to answer any better

18:05 raek: Y combinator?

18:05 gfrlog_: brehaut: I feel like erlang would be what I'm describing

18:06 brehaut: if it were lazy

18:06 brehaut: my experience with erlang is even more limited than haskell

18:06 gfrlog_: maybe a succinct way of saying what I'm thinking is that I can imagine a lazy (=? non-strict) language that doesn't permit self-reference

18:08 brehaut: you can call it lazy, only wadler will correct you

18:09 im sure its possible to create such a language but it seems like you'd be going out of your way to make life harder

18:09 gfrlog_: brehaut: what useful features would be lacking?

18:10 brehaut: what useful features are lacking from assembly? you can tarpit yourself to death if you really want to

18:10 gfrlog_: so...you're saying that all features would be lacking?

18:10 I just can't think of any and assumed you had one in mind

18:10 brehaut: only self reference would be lacking

18:11 it doesnt make things impossible, just a bit harder

18:11 gfrlog_: and how often do you use that?

18:11 brehaut: not too often (excepting funs)

18:11 but implementation wise (especially for a dynamic language) its harder to make it disallow that than to allow it

18:12 gfrlog_: syntactic sugar could take care of the recursive functions

18:14 brehaut: gfrlog_ this is going too far down a hypothetical rabbit hole and i have actual work to do sorry

18:14 gfrlog_: brehaut: okay

18:39 milkpost: technomancy: the graph-api looks kinda shabby, can't figure otu how the hell to use it

18:40 technomancy: I'm sorry, what graph api?

18:40 milkpost: http://richhickey.github.com/clojure-contrib/graph-api.html

18:41 technomancy: yeah, I don't think that's maintained these days.

18:41 milkpost: i may be barking up the wrong tree, but i am sick of coding in python and I want something faster. the only nice thing about python is it has a pretty good library for network stuff. looks like haskell does pretty well there too ...

18:41 technomancy: there's a neo4j wrapper that seems to be hot stuff

18:42 milkpost: ahh cool

18:45 not sure what this neo4j thing is though, but i'll give it a shot

19:35 chrissbx: Is it possible to get a backtrace of the clojure function calls?

19:35 All I'm always seeing are backtraces of java code, with no frames of my clojure code.

19:36 (At least when I enter code at the slime repl)

19:37 brehaut: yes its definately possible. but dont know how to do it with slime though

19:37 chrissbx: Hm maybe I was wront, there are frames from my code further down the trace.

19:37 But they don't show locals.

19:37 brehaut: chrissbx: yeah they are pretty huge

19:38 chrissbx: What do I have to do to get locals?

19:38 brehaut: i have no idea actually

19:38 amalloy: chrissbx: it's not easy to get locals

19:39 you can get them with the latest version of swank, which integrates the cdtr

19:39 cdt

19:39 but you still have to set a breakpoint explicitly, i think - i don't think you can get locals when stepping in to save an arbitrary exception

19:40 chrissbx: exception?

19:40 clojurebot: http://www.mindview.net/Etc/Discussions/CheckedExceptions

19:40 chrissbx: do you mean frame?

19:41 Well I just want to know what's going on... so I'll have to find out what cdt is and install that?

19:42 * chrissbx found swank-cdt and is going to give it a try.

19:43 amalloy: chrissbx: i think that's out of date; last i heard the cdt was being bundled as part of swank (as of like yesterda)

20:04 dnolen: what's the best way to go from var to namespaced symbol - look at the var's meta?

20:05 hiredman: ,(.getName #'+)

20:05 clojurebot: java.lang.IllegalArgumentException: No matching field found: getName for class clojure.lang.Var

20:05 hiredman: bleh

20:05 ,(.ns #'+)

20:05 clojurebot: #<Namespace clojure.core>

20:05 hiredman: ,(.sym #'+)

20:05 clojurebot: +

20:06 dnolen: hiredman: thx

20:57 technomancy: duuuuuuude: https://github.com/technomancy/slamhound

20:57 hiredman: woa!

20:58 technomancy: hiredman: it's a sight to behold, innit?

20:58 right after pushing it I hit random-play, and it queued up protomen act 2.

20:58 hiredman: nice

20:58 technomancy: IT"S A SIGN.

20:58 hiredman: it's a good one

20:58 technomancy: [sic]

20:59 hiredman: (now I really want a picture of a road sign with the text replaced with 'IT"S A SIGN')

21:00 technomancy: yessss

21:01 joshua__: technomancy, what have you done!?!?! Literally.

21:05 technomancy: excellent question

21:22 dnolen: technomancy: that is pretty cool.

21:27 technomancy: dnolen: thanks

21:28 benreesman: great name too

21:28 TimMc: technomancy: What does it *do*?

21:29 technomancy: TimMc: http://wondermark.com/190/

21:29 TimMc: maybe this is clearer: http://groups.google.com/group/clojure/browse_thread/thread/20d314bc0a23b574

21:29 I should put before/after in the readme

21:31 ataggart: so, the "organize Imports" feature in most IDEs

21:32 TimMc: I actually don't understand the examples.

21:32 Does the "before" have hidden requires and uses?

21:33 technomancy: TimMc: no, the idea is you wrote the -main function but haven't bothered to change the ns form yet.

21:33 yeah, I guess it's sometimes a feature of IDEs?

21:33 TimMc: How does it know that io/foo is foo from clojure.java.io?

21:33 Magic?

21:34 technomancy: classpath search

21:34 TimMc: k

21:34 fancy

21:34 technomancy: it has a pluggable disambiguator for matches.

21:34 by default it takes the first non-swank namespace.

21:34 TimMc: Aw, that's my favorite kind of disambiguator!

21:34 ataggart: where is the classpath searching code?

21:35 I figure asplode, but doesn't look like it

21:35 benreesman: technomancy: just tried it out, got 'prefix cannot be nil'. any hints?

21:35 technomancy: ataggart: slam.hound.regrow/candidates

21:35 benreesman: hmm... go ahead and open a github issue I guess

21:36 I haven't tried it on much yet

21:36 benreesman: i'll mess around with a bit first, it looks rad

21:36 ataggart: ah, the part I was looking for is apparently buried inside swank.util.class-browse

21:37 technomancy: ataggart: yeah, I need to factor that out

21:38 my favourite part is there are only 2 impure calls

21:44 ataggart: how long did it take to put that all together?

21:45 trying to guage how sucky I am

21:45 technomancy: couple hours saturday and then maybe half of today

21:45 or maybe most of today

21:45 ataggart: nice

21:46 technomancy: got some pairing time on it for a few hours today though; that helps

21:46 it can come together a lot more quickly when it's mostly pure like that

21:55 brehaut: ugt?

21:55 clojurebot: ugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html

21:55 brehaut: almost a win

21:55 dont know why he thinks his name is clojurebot

21:56 oh. wrong channel. duh

21:58 cemerick: technomancy: Slamhound looks nice, well done :-)

22:10 weavejester: Just saw it. Slamhound looks very cool :)

22:25 technomancy: thanks. it was a lot of fun to write.

22:50 seancorfield: question about maps and keys / vals - are the keys / vals pair of functions guaranteed to bring things back in the same order (as each other)

22:50 it looks that way but i wasn't sure if it was guaranteed by the language

22:51 cemerick: no

22:52 I think they do, for all of Clojure's map impls right now, but that's not written in stone.

22:52 If you need both, in the same order, just use `entries`.

22:58 ataggart: It's guaranteed in as much as vals and keys are dependent on seq, so as long as seq is consistent, so will keys and vals

23:00 drewr: rhickey has stated before that you can depends on keys/vals being commensurate

23:03 commensurate isn't really the correct adjective there but you know what I'm' sayin'

23:08 ataggart: coordinated?

23:10 Miguel_Inz: Hello, I've been having troubles to install enclojure, so I am decided to test clojure directly but i don't know the way to get integrated to netbeans. I'm interested to do some 'rapid' guis to test with clojure and lisp that's why I choosed Enclojure to do some examples.

23:11 .

23:11 cemerick: Miguel_Inz: Enclojure isn't yet compatible with NetBeans 7, if that's what you're using.

23:11 Miguel_Inz: Sorry for the english, isn't my native language : )

23:12 Is any version available of netbeans compatible? like 6.7?

23:12 cemerick: Miguel_Inz: Last I knew, it was compatible with 6.8

23:13 The Counterclockwise plugin for Eclipse is pretty good as well, if you're not wedded to NetBeans.

23:13 Miguel_Inz: Thats the unique that works for me

23:14 just interested in netbeans to do some exercises of books implemented with a little GUI 'the netbeans way'

23:15 ataggart: I agree with cemerick. Eclipse + Counterclockwise is good.

23:15 Miguel_Inz: well has been like 1 week of research with the netbeans i suppouse i have to do it with Ecplipse

23:16 Yes, i've been tested Counterclockwise it really works fine :)

23:16 cemerick: Miguel_Inz: FYI, Google has made windowbuilder pro free: http://code.google.com/javadevtools/wbpro/

23:16 I don't do a ton of thick-client UI stuff, but I've been impressed with it compared to NetBeans' Matisse layout tools.

23:17 Miguel_Inz: :0

23:17 wow didn't know it

23:18 the thing for why I was atached to netbeans was WYSIWYG :P, you know I want to apply clojure to school projects

23:18 well I think this resolves the problem :D

23:19 cemerick: Yeah, windowbuilder is certainly reasonable for that :-)

23:19 Build up your form, make all the controls public, and then you can create it and wire everything up from Clojure.

23:22 Miguel_Inz: thank you cemerick, I'll try windowbuilder sounds pretty good :)

23:22 thanks for the attention

23:40 mec: If I want to implement ISeq on a defrecord I have to make it a deftype right?

23:44 Or is there any other way to make a custom seq?

23:45 dnolen: mec: records are seqable.

23:46 chrissbx: How would you install newest swank (like "as of yesterday"), and still have it work with the slime part?

23:47 My previous installation attempts were pretty difficult to make both parts match up.

23:50 technomancy: chrissbx: the swank-clojure readme covers it pretty well

23:51 chrissbx: Ok; technomancy, should I take your branch at https://github.com/technomancy/swank-clojure for the cdt work?

23:52 technomancy: yeah

23:52 chrissbx: ok

23:53 Hm, the readme says how to install using leiningen; but how to build from git?

23:53 (I'm a clojure and java newbie)

23:54 technomancy: if you're new to things it's best not to go from scratch

23:54 chrissbx: Hm. Problem is the code I'm writing right now is really asking for a debugger.

23:55 I'm used to debuggers in Scheme, which tell me exactly where the error happens, and let me inspect the environment.

23:56 tomoj: mec: seems you can override the record implementations

23:57 (do (defrecord Foo [bar baz] clojure.lang.ISeq (first [_] 21)) (first (Foo. 1 2))) returns 21

23:57 chrissbx: Here I just got "Wrong number of args (1) passed to: state$-GT--GT--EQ-$fn" without any location information whatsoever.

23:57 mec: chrissbx: you can use swank.core/break and in the break go to the repl and type (swank.core/local-bindings) to see the environment map, or just eval expressions as normal to see whats what

23:57 chrissbx: thanks, trying

23:58 mec: tomoj: I thought you couldnt implement ISeq on a record because its already builtin?

Logging service provided by n01se.net