#clojure log - Jun 13 2010

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

0:54 scottj: Did the compojure switch to strings for keywords on form-params etc mess up anyone else's apps that use congomongo or other things that use keywords for keywords on maps? There's no destructing that handles either :keys or :strs is there?

0:55 KirinDave: http://queue.acm.org/detail.cfm?id=1814327

0:55 Really interestng.

2:13 Blackfoot: can i use drop-while to find the number in a sequence such that it the sum of the preceding numbers is above N

9:09 bkpattison: Is it possible to change the directory that clojure looks for .clj files? Instead of "src" I would like for it to look in a path that I specify.

9:13 hoeck: bkpattison: only by setting the classpath

9:16 bkpattison: hoeck: okay, thanks. i was hope for something programmatic (set-path ...)

9:17 hoeck: bkpattison: yeah, thats what the jvm requires, but ideally your IDE or dependency tool should take care of managing the classpath

9:21 bkpattison: hoeck: make sense, i'll just have make sure i have all my needed directories on the classpath prior starting java instead of trying to do it programmatically after the fact

9:26 hoeck: bkpattison: there is also add-classpath, but its marked as deprecated and its use is strongly discouraged

9:27 bkpattison: hoeck: ah. i'll avoid that. i just need to be smarter about how i invoke cloure with appropriate classpath

11:49 quotemstr: Why is Clojure under the Eclipse license of all things? Is the GPL incompatibility deliberate?

11:52 LauJensen: quotemstr: I dont think so. The EPL was chosen for maximum freedom and to avoid clashes with other licenses

11:52 quotemstr: Wouldn't the BSD/X11 license have been the appropriate choice in that csae?

11:52 Chousuke: with the constraint of reciprocality, so BSD-style licences were out

11:53 LauJensen: Chousuke: Could you elaborate on that please

11:53 quotemstr: Chousuke: So the Clojure people *did* want a copyleft license --- why not the LGPL?

11:54 Chousuke: quotemstr: I don't know. I think it has some trouble with macros etc.

11:54 quotemstr: I don't suppose there's any chance Clojure would be dual-licensed under the LGPL as well then.

11:55 Chousuke: Well it's technically possible but you'd have to convince rhickey, not me :)

11:57 datka: are any of you using lazytest in a 1.2 project? If so, what branch are you using? I tried the v4 branch, but am getting the error that it can't find the 'it' macro

12:02 Chousuke: LauJensen: Hm, I think the idea behind choosing EPL is to disallow people from making their own version of Clojure and not sharing the changes with the community

12:03 you can embed clojure itself in a closed-source offering but if you make any modifications, those need to be distributed.

12:13 OForero: hi

12:13 is there a name convention for protocols?

12:14 Licenser: coookies

12:14 Chousuke: hmm

12:14 OForero: IMyProtocol ?

12:14 Chousuke: not I

12:14 I is for interfaces

12:14 OForero: but the I looks not great

12:14 Chousuke: I think they're usually without a prefix at all

12:15 OForero: but there are no Interfaces in clj

12:15 Chousuke: just Sequential or Foo or whatever.

12:15 OForero: ok

12:15 Chousuke: OForero: there's definterface :)

12:15 but it's java interop, of course

12:15 OForero: and if a protocol and a record have kind of the same name

12:15 Chousuke: I think generally they shouldn't

12:17 OForero: definterface?

12:17 Chousuke: yeah

12:17 generates a java interface

12:17 OForero: where is it?

12:17 is not in core is it?

12:18 if it is I probably need a pause and an spresso

12:22 mmh is probably new in 1.2 ... is not even in the GH docu from RH

12:27 what would be the difference between a protocol and an interface?

12:27 datka: protocols are cooler

12:29 if I remember right, you can add new protocols in a way that you can't do with interfaces

12:41 chouser: datka: right

12:42 OForero: that's the main difference -- you can create a new protocol and extend it to an existing class, even a final class.

12:43 also, protocol functions are namespaced independently of the class you extend them to, unlike monkey patching.

12:43 OForero: thanks

13:01 dsantiago: chouser: How exactly does that extending work?

13:04 chouser: dsantiago: the protocol functions are regular Clojure functions, but they know which protocol they belong to

13:05 the protocol itself keeps track of the classes it's extending

13:05 datka: doesn't it work similar to a multimethod, but faster

13:05 dsantiago: Ah. So is that still done with the same performance as if the functions are defined in the deftype?

13:06 chouser: Last I checked it was still somewhat faster to define the methods inside the deftype or defrecord form

13:07 but extending is still quite fast compared to other options, like doing something similar yourself without clojure compiler support, or using multimethods.

13:07 dsantiago: OK, thanks.

13:07 Been wondering that.

13:09 mebaran151: if I was wondering

13:10 *I was wondering if extend was AOT compiled

13:10 I'm thinking about doing some android experiments, and I would like to try to strip out all the compiler stuff that won't work anyway

13:14 LauJensen: Chousuke: Okay, thanks for educating

13:21 anonymouse89: is it possible to define default values for keys in defstruct?

13:34 LauJensen: anonymouse89: Not sure if there's a way already, but if not a macro with a wrapping 'binding' should do the trick

13:45 anonymouse89: LauJensen: thanks for the tip, that makes sense.

13:56 is there a range fn that returns a list of floats instead of integers?

13:57 LauJensen: (defn frange [x] (map float (range x))) ?

13:58 defn: :)

13:58 * defn likes 'frange'

13:59 defn: LauJensen: do you need to edit the arity of frange to make range work in all cases?

13:59 LauJensen: yes

14:01 anonymouse89: LauJensen: okay, sorry for the silly questions, I just never know if those kind of things are already built-in or not

14:01 LauJensen: np thats what we're here for

14:02 anonymouse89: LauJensen: do most clojurians (?) save all these little fns and macros in a toolbox(.clj)?

14:02 defn: anonymouse89: you can have a user.clj

14:02 anonymouse89: or is that kind of looked down on for decreasing readability

14:02 LauJensen: anonymouse89: I dont think so. Most of it goes into contrib eventually, and eventually the really useful stuff makes it into core

14:02 I dont think user.clj is the best way to handle it

14:03 defn: i agree it's not the best way, but it's not "bad", IMO

14:03 you just need to be careful you're not using something home-baked which may be done much better in contrib

14:03 anonymouse89: is there some sort of magic that happens by naming it "user.clj" specifically or is that just convention?

14:03 defn: anonymouse89: if it's on your classpath it will be autoloaded

14:04 'user.clj' that is

14:04 anonymouse89: defn: right, I don't mean anything too crazy or even with that much logic, just convenience functions

14:04 ok

14:06 LauJensen: anonymouse89: I dont think Ive never needed anything like frange, and the project you're working on might be the last one in 6 months for you as well :) However, if you're the first guy to come up with 'partition' or 'take-while', then you should try to get it in Contrib :)

14:06 anonymouse89: actually I'm trying to do this:

14:06 defn: LauJensen: i've never used the user.clj thing myself, but i do often end up opening other projects ive started to take a look at a function i wrote

14:06 anonymouse89: '(take 10 (cycle '(0)))

14:07 ,(take 10 (cycle '(0)))

14:07 clojurebot: (0 0 0 0 0 0 0 0 0 0)

14:07 defn: ive also seen stuart halloway has a "code pad" in his emacs where he keeps snippets

14:07 anonymouse89: is there a better way?

14:07 LauJensen: defn: you mean *scratch* ? :)

14:07 defn: as long as user.clj is confined in a namespace i dont see any issue

14:07 LauJensen: well, yeah :)

14:07 anonymouse89: defn: that's a good idea

14:07 LauJensen: $(take 10 (repeat 0))

14:07 sexpbot: => (0 0 0 0 0 0 0 0 0 0)

14:07 anonymouse89: ah, repeat

14:08 defn: anonymouse89: there is also repeatedly, but that's more heavy lifting than you need

14:08 anonymouse89: $(take 10 (repeat 0.0))

14:08 sexpbot: => (0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)

14:09 LauJensen: $(take 10 (repeatedly (fn [] 0.0)))

14:09 sexpbot: => (0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)

14:09 LauJensen: one is for values, the other for fns

14:09 anonymouse89: just looked at the api entry for repeatedly, seems cool

14:10 so I could 'take' from a repeatedly?

14:11 LauJensen: I just did

14:11 defn: :)

14:11 anonymouse89: right, I should just be learning by doing

14:12 defn: $(take 10 (iterate + 0.0))

14:12 sexpbot: java.lang.ClassNotFoundException: clojure.core$iterate$fn__3752

14:12 LauJensen: anonymouse89: no you should just read what im writing :)

14:13 $(take 10 (iterate (partial + 0.1) 0))

14:13 sexpbot: java.lang.NoClassDefFoundError: clojure/core$iterate$fn__3752

14:13 LauJensen: ,(take 10 (iterate (partial + 0.1) 0))

14:13 clojurebot: (0 0.1 0.2 0.30000000000000004 0.4 0.5 0.6 0.7 0.7999999999999999 0.8999999999999999)

14:14 defn: $(take 10 (iterate #(+ %) 0.0)) ;;?

14:14 sexpbot: java.lang.NoClassDefFoundError: clojure/core$iterate$fn__3752

14:14 LauJensen: defn: sexpbot doesnt have iterate for some reason

14:14 defn: ah

14:14 ,(take 10 (iterate + 0.0))

14:14 clojurebot: (0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)

14:19 defn: ooo, even better..

14:19 $(repeat 10 0.0)

14:19 sexpbot: => (0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)

14:26 Licenser: lies!

14:27 LauJensen: well, the simplest way is still

14:27 ,(-> 9 inc (repeat 0.0))

14:27 clojurebot: (0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)

14:27 tomoj: :D

14:28 LauJensen: sorry, no, I overcomplicated

14:28 ,(-> \tab int inc (repeat 0.0))

14:28 clojurebot: (0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)

14:44 anonymouse89: defn: nice, I'll be using (repeat 10 0.0)

15:02 LauJensen: $mail Raynes Your bot does not support 'iterate'

15:02 sexpbot: Message saved.

15:02 anonymouse89: would logbitp ever be something that would make it into contrib?

15:07 Twey: ,(let [is (iterate #(+ 1 %) 0)] (take 5 is))

15:07 clojurebot: (0 1 2 3 4)

15:07 Twey: ,(iterate #(+ 1 %) 0)

15:07 ,(let [is (iterate #(+ 1 %) 0)] (take 5 is))

15:07 clojurebot: (0 1 2 3 4)

15:08 Execution Timed Out

15:08 Twey: Huh.

15:14 anonymouse89: iterate returns a lazy sequence (i think?)

15:14 LauJensen: yep

15:16 anonymouse89: is there any way to override functional style and have mutable structs?

15:17 LauJensen: anonymouse89: There are a few ways, but are you sure you dont want to be functional ?

15:17 anonymouse89: no I'm not sure

15:17 LauJensen: Whats the challenge?

15:17 anonymouse89: but at the moment I'm translating a lisp program that uses the CLOS to clojure

15:18 qbg: You could wrap the mutable items in an atom or ref, but eww...

15:18 tomoj: why bother unless you're going to make it functional?

15:18 anonymouse89: so it'd be easiest to do a more "direct" translation (if that makes sense) and then convert to functional later

15:18 LauJensen: anonymouse89: Not necessarily - If I were you I would try to grasp the functional concepts and apply them directly

15:18 In most cases you can make it 99.9% functional without any headaches

15:19 qbg: Instead of fighting the language and then doing some nasty refactoring, just do it right the first time.

15:20 datka: does anyone know what happened with the latest rc of leiningen that made it so that lein-run is no longer working?

15:20 anonymouse89: qbg: thanks, I know that's the right thing to do, just needed to have someone else confirm

15:22 on a related note, is there a way to return a struct with all values the same except one?

15:22 qbg: You should be able to use assoc

15:22 LauJensen: 'dissoc' you mean

15:22 dakrone: yep, use assoc

15:22 LauJensen: ,(dissoc :two {:one 1 :two 2 :three 3})

15:22 clojurebot: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IPersistentMap

15:23 LauJensen: ,(dissoc {:one 1 :two 2 :three 3} :two)

15:23 clojurebot: {:one 1, :three 3}

15:23 dakrone: anonymouse89: did you mean leaving 1 value out, or changing just 1 value?

15:24 anonymouse89: dakrone: changing just 1 value (or however many)

15:24 dakrone: use assoc then

15:24 ,(assoc {:name "foo" :age 10} :age 20)

15:24 clojurebot: {:name "foo", :age 20}

15:26 anonymouse89: dakrone: perfect, thanks!

15:26 dakrone: anonymouse89: you're welcome, good luck with the translation

15:26 dnolen: ,(update-in {:name "foo" :age 10} [:age] #(+ % 10))

15:26 clojurebot: {:name "foo", :age 20}

15:28 anonymouse89: dnolen: not helpful in my case, but good to know

15:33 tomoj: I sometimes wonder why we have assoc/assoc-in but not update/update-in

15:34 qbg: update would only save you two characters...

15:38 tomoj: I guess the variadic case for update would be uncommon

16:03 silveen: can anyone help me figure out what(doseq [entity @collection :when

16:04 what's wrong with my* (doseq [entity @collection :when (contains? (entity :key) avalue)] ?

16:05 naeu: hey there, I have a Java question if anyone's interested in helping out: what does the ... signify in lines such as: static public IPersistentVector createOwning(Object... items){

16:05 silveen: naeu: it means you can send a variable number of arguments

16:05 naeu: silveen: wow, Java has that feature?

16:05 silveen: like createOwning( a, b, c)

16:05 yes

16:05 you get it as an array and can loop thru them like normal

16:05 naeu: nice

16:06 silveen: thanks

16:06 silveen: be sure to check for lengt > 0 (as passing zero arguments is pefectly valid)

16:06 naeu: you're welcome :)

16:07 naeu: silveen: I'll not be checking anything right now, I'm currently just reading the Clojure source

16:07 and treating it as immutable ;-)

16:07 silveen: aah

16:18 tomoj: silveen: what do you think contains? does?

16:18 silveen: it check if the first argument, which is a list, contains the second argument

16:18 it worked before, but I can't figure out what's diffrent

16:19 tomoj: ,(contains? '[foo bar baz] 1)

16:19 clojurebot: true

16:19 tomoj: ,(contains? '[foo bar baz] 'bar)

16:19 clojurebot: false

16:19 silveen: ,(contains? ([15 2] [15 3]) [15 2])

16:19 clojurebot: java.lang.IllegalArgumentException: Key must be integer

16:19 tomoj: maybe you're looking for (doseq [entity @collection :when (some #{avalue} (:key entity))] ...) ?

16:20 ,(doc contains?)

16:20 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

16:22 silveen: hmm, yeah that works if I do it like ... (entity :key)

16:22 ,(contains? [foo bar] 1)

16:22 clojurebot: java.lang.Exception: Unable to resolve symbol: foo in this context

16:23 silveen: ,(contains? [10 20] 1)

16:23 clojurebot: true

16:23 silveen: ,(contains? [10 20] 3)

16:23 clojurebot: false

16:23 silveen: hmm, now I see how that works

16:24 tomoj: silveen: (entity :key) works but (:key entity) doesn't?

16:24 what kind of thing is entity?

16:24 silveen: yupp

16:24 it's a struct

16:25 or, whatever it's called (only been doing clojure, or "lisp" for about a week)

16:25 tomoj: ,(:foo (struct (create-struct :foo) 3))

16:25 clojurebot: 3

16:25 tomoj: ,((struct (create-struct :foo) 3) :foo)

16:25 clojurebot: 3

16:26 tomoj: (:key struct) is the idiomatic way

16:27 silveen: ,(some? #{3} (struct (create-struct :foo) [1 2 3] :foo))

16:27 clojurebot: java.lang.Exception: Unable to resolve symbol: some? in this context

16:27 silveen: ,(some #{3} (struct (create-struct :foo) [1 2 3] :foo))

16:27 clojurebot: java.lang.IllegalArgumentException: Too many arguments to struct constructor

16:28 tomoj: ,(some #{3} (:foo (struct (create-struct :foo) [1 2 3])))

16:28 clojurebot: 3

16:28 silveen: baah, really is it? I've never done it like that, I think because it didn't work out for me in the begining

16:28 tomoj: (:key foo) when foo is something like an object (e.g. structs)

16:29 (foo :key) when foo is a collection

16:29 as in, not a fixed set of keys

16:30 silveen: okey, kinda confusing but okey

16:32 tomoj: (:key foo) is also faster on certain kinds of things, and won't blow up if foo is nil

16:33 silveen: hmm'kay, will try to think of that from now on :

16:34 but it's really strange that it doens't work here

16:36 ah, because it was a ref

16:36 (:key @entity) works

16:37 that might explain why that way of typing didn't work for me earlier

16:37 Twey: .ue coi .tomoj.

16:38 silveen: thanks tomoj

16:41 tomoj: coi .tuein.

16:41 Twey: ba ma do pilno la .klojyr.

16:57 Lajla: ,(+)

16:57 clojurebot: 0

16:57 Lajla: ,(/)

16:57 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$-SLASH-

16:57 Lajla: ,(/ 1 2 3 4 5)

16:57 clojurebot: 1/120

16:58 rhall: hi all

16:58 anyone up for a newbie question? :)

16:58 qbg: Sure

16:59 rhall: thx... I'm playing around with counterclockwise

16:59 Lajla: rhall, yes, but if I can't answer it, I will assasinate you.

16:59 rhall: earlier I could run things like "(show show)"

16:59 Lajla: I work best under pressure

17:00 but now in response to (show show)... I get... 1:11 user=> (show show)

17:00 java.lang.Exception: Unable to resolve symbol: show in this context (repl-1:11)

17:01 is "show" part of clojure core, or do I need to load something else? I don't remember doing anything earlier

17:01 it just worked

17:02 qbg: You need to use clojure.contrib.repl-utils

17:02 (use 'clojure.contrib.repl-utils)

17:02 rhall: qbg: thx... I suspected something like that... wonder if I screwed up my eclipse launcher somehow and knocked that out

17:03 hmm... no go...

17:03 1:12 user=> (use 'clojure.contrib.repl-utils)

17:03 java.lang.IllegalStateException: source already refers to: #'clojure.repl/source in namespace: user (repl-1:12)

17:03 1:13 user=> (show show)

17:03 1:14 user=> java.lang.Exception: Unable to resolve symbol: show in this context (repl-1:13)

17:04 qbg: I would just do (require '[clojure.contrib.repl-utils :as repl])

17:04 and then you can do (repl/show repl/show)

17:06 rhall: that works

17:06 so I guess my namespace is polluted somehow?

17:06 but then restarting should fix it, I'd assume

17:06 qbg: Yes, clojure.repl defines source and so does clojure.contrib.repl-utils, so they conflict

17:07 rhall: ah, ok, I see

17:07 thx for that

18:15 dnolen: rhickey: another prim bug? http://gist.github.com/437046

18:16 rhickey_: dnolen: no, limitation, right now static can't be protocol call sites

18:55 vin: why does this give a nullpointerexception, i dont see it... http://sprunge.us/ZPYa

18:57 qbg: vin: Instead of ((print ...) ...) you want (do (print ...) ...)

18:58 vin: (do you have a link that explains) why

18:58 Ankou: hi, I think I found a bug in dgraph but maybe someone who actually used this library can tell me if it I missunderstand something and if it behaves like it should. Here are some lines I entered in the the REPL: http://ankou.pastebin.com/gRHjgCUg

18:58 qbg: Because (print ...) will return nil, and you are trying to call nil

19:00 Also, do to your use of recursion, the code will fail on long input

19:00 *due

19:02 I think a solution using doseq would be better.

19:03 Twey: Has Clojure tail recursion optimisation?

19:03 quotemstr: Twey: No.

19:03 But it does have RECUR.

19:03 Twey: Damn :-\

19:03 Oh?

19:03 qbg: You also have trampoline

19:06 Twey: Hm

19:06 qbg: Blame java

20:26 vIkSiT: hmm quick lein question.

20:26 in project.clj - the :main option - does that refer to the filename, or the namespace?

20:28 tomoj: namespace

20:28 vIkSiT: for instance, I've got project.clj with :main myproject.core, and my src dir looks like src/myproject/core.clj, with the ns as myproject.core

20:28 now, this doesn't work.

20:29 oh. maybe gen-class.

20:31 ah taht was the problem

20:31 tomoj, do you connect to a lein swank instance through slime?

20:31 tomoj: no, I use maven

20:32 vIkSiT: ah

20:32 but that brings up a swank instance that you connect to through slime?

20:33 tomoj: yep

20:33 vIkSiT: my issue was - when I connect to a swank instance, how do I "load" all the code into that session?

20:33 tomoj: C-c C-k a file

20:33 vIkSiT: oh i see. there's no way to load all the files in in one go?

20:33 tomoj: I don't know of a way to load all the files, no

20:33 but it's not really necessary imo

20:33 vIkSiT: hmm

20:33 tomoj: when you C-c C-k a file, all the files it depends on will be loaded

20:34 vIkSiT: ah gotcha. so I can always use a :require or something in the main file

20:34 tomoj: yep

20:35 vIkSiT: so, how is it different from just firing up a normal slime instance and then doing stuff manually?

20:35 I figured that doing it from within a project dir would atleast load all the ns's that exist within the project

20:36 tomoj: it's different just because lein is creating the swank server instead of emacs

20:39 vIkSiT: ah i see

20:40 oh brilliant.

20:41 looks like swank-clojure from ELPA isn't compatible with slime201004

20:41 aaargh.

20:41 this is like red hat's dependency hell from 1996

20:45 tomoj: you use other lisps?

20:46 vIkSiT: sbcl for some stuff

20:47 lein swank is increasingly looking like a good option

20:47 all i need is slime-connect on the emacs side

21:52 defn: lein swank was deprecated in favor of swank-clojure i thought

21:52 you can use swank-clojure-project, or lein swank in the project dir + slime-connect

21:54 tomoj: swank-clojure provides lein swank, doesn't it?

22:10 defn: yes

22:10 it does now

22:10 as of 1.2.1

22:20 TimMc: A curiosity:

22:20 ,((fn [&] 4))

22:20 clojurebot: 4

22:21 TimMc: .((fn [&] 4) 5 6 7)

22:22 ,((fn [&] 4) 5 6 7)

22:22 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--9669$fn

22:26 tomoj: would you expect it to be variadic but ignore its arguments?

22:39 jrp: is there a particularly good clojure introduction that people here would recommend?

22:45 TimMc: tomoj: I wasn't sure what to expect, really. :-P

22:46 jrp: I have really been enjoying Stuart Halloway's book "Programing Clojure" -- I pirated it, then bought it. :-)

22:46 bmason: this is a good page: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips

22:46 TimMc: You can buy the eBook online in an open format.

22:47 jrp: cool, thank you

22:53 mabes: jrp: this is another good overview of clojure: http://java.ociweb.com/mark/clojure/article.html

22:54 oh, I guess that is linked to on the wiki page. :) nm

22:54 jrp: will these cover the function programming aspect? Ive been programming for 10 years more or less, but mostly in C style languages

22:58 mabes: jrp: yeah, most of the articles assume you're coming from a java-like background.. so you should be okay.

22:58 jrp: fantastic, thanks. This channel is quite helpful

23:22 TimMc: tomoj: What do you make of it? Syntactic corner-case, or potentially meaningful form?

23:27 tomoj: isn't it equivalent to the shorter and less curious (fn [] ..)?

23:28 TimMc: Presumably.

23:28 I can't think of any way it could differ in behavior.

23:29 tomoj: so.. why use it? :)

23:32 TimMc: Ah, the compiler treats them the say way:

23:32 ,(fn ([] 4) ([&] 5))

23:32 clojurebot: java.lang.Exception: Can't have 2 overloads with same arity

23:32 TimMc: *same

23:32 I suppose it would only be good for Obfuscated Clojure contests. :-P

23:34 tomoj: I wonder why assert-args in core.clj isn't public, it seems like it would be useful

23:35 quotemstr: TimMc: Wouldn't Obfuscated $LISP_DIALECT contests be too easy? :-)

23:35 tomoj: I imagine submitting a 200 line -> form or something

23:36 quotemstr: tomoj: Use the Y combinator. For everything.

23:36 tomoj: You can write unlambda is any functional language. :-)

23:38 rbarraud: ,

23:38 clojurebot: EOF while reading

23:38 rbarraud: ,

23:38 clojurebot: EOF while reading

23:38 rbarraud: foo

23:38 TeXnomancy: doto with non-java-interop forms is always a nice obfuscation technique

23:38 quotemstr: ,(+ 1 2)

23:38 clojurebot: 3

23:39 TeXnomancy: defn: lein swank + slime-connect is actually the recommended way to go now.

23:39 oh, lein-swank the dependency got merged into swank-clojure, if that's what you meant.

23:41 quotemstr: ,(macroexpand '(-> (a) (b) (c)))

23:41 clojurebot: (c (clojure.core/-> (a) (b)))

23:41 quotemstr: ,macroexpand-all

23:41 clojurebot: #<walk$macroexpand_all__6949 clojure.walk$macroexpand_all__6949@1636d54>

23:41 quotemstr: ,(macroexpand-all '(-> (a) (b) (c)))

23:41 clojurebot: (c (b (a)))

23:41 quotemstr: Ah.

23:54 LuminousMonkey: Anyone know if it's possible to step through two sequences at once? For example, you have something like (cycle [1 2]) as one sequence, and just a normal finite sequence, and they step together?

23:55 rdsr: luminousMonkey: a map won't do?

23:56 TeXnomancy: ,(map identity [1 2 3] [:a :b :c])

23:56 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$identity

23:57 TeXnomancy: ,(map + [1 2 3] [4 5 6])

23:57 clojurebot: (5 7 9)

23:57 LuminousMonkey: I'm doing some PDF work, and making a PDF table. I've written up a function to process the tables, and I pass the info like ([{:name "Header 1" :align :left} {:name "Header 2" :align :right}] ["Data1" "Data2"] ["Data3" "Data4"])

23:58 I need to get the correct :align for the column, so I know if I need to set the alignment for the cell.

Logging service provided by n01se.net