#clojure log - Dec 08 2011

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

0:29 jcrossley3: technomancy: any precedent for using lein on cloudbees jenkins service? is this still the best way? https://github.com/technomancy/leiningen/wiki/Using-Leiningen-with-the-Jenkins-CI-server

0:45 fhd: Does anybody know if I can add dependencies that are only included in an uberjar in Leiningen?

0:45 The thing is, I'm deploying my project both as a WAR (lein ring uberwar) and as a standalone JAR that includes Jetty (lein uberjar). I only want to include Jetty for the latter.

1:14 dnolen: anybody have opinions on the best Clojure WebSocket client?

1:22 technomancy: jcrossley3: that's quite a bit more complicated than necessary

1:22 you don't need to set up a job for leiningen itself

1:24 fhd: the uberwar task should be able to set up exclusions for its dependencies

1:25 by "should" I mean "it would be best if it did"

1:27 fhd: technomancy: But it doesn't? :)

1:27 technomancy: probably not, unfortunately

1:27 fhd: technomancy: Okay, I'll head over to ring and create an issue then, thanks

1:28 technomancy: fhd: we happen to be working on implementing profiles for leiningen that would support this exact scenario though

1:29 fhd: technomancy: Nice to hear, we've been wondering when/if lein will get profiles :)

1:29 technomancy: Any wiki page/post or something available on that?

1:30 technomancy: fhd: minor sketch on the VersionTwo page of the wiki, plus I just started a brief implementation on the profiles branch.

1:30 fhd: technomancy: I'll have a look, thanks. Hopefully should help us get rid of a few ugly custom plugins.

1:30 technomancy: I've only added it to the leiningen-core library though; the rest of Leiningen probably still needs to be adapted to work with it.

1:32 https://github.com/technomancy/leiningen/compare/master...profiles#L2R64 FWIW

1:36 fhd: technomancy: Hm, from a quick look it seems like profiles are implemented in Leiningen, not using the Maven mechanism, is that right?

1:36 technomancy: Not that I mind, I don't know if it makes sense (or is possible) to use Maven's mechanism in lein

1:36 technomancy: correct; they only affect project.clj maps

1:37 fhd: technomancy: Nice, looks friendlier than what Maven has already :)

1:37 technomancy: great! this is just a couple hours worth of coding from today so far.

1:37 though much more time than that spend on design.

1:37 fhd: technomancy: And this will be in lein 2.0? Any chance to get a rough release date estimation for that?

1:38 technomancy: probably on the order of six months

1:39 fhd: technomancy: And it will use Aether as planned?

1:39 technomancy: fhd: yeah, that part is actually already working great thanks to cemerick's pomegranate

1:39 Raynes: If he would just pay me, this stuff would be done by the end of the month.

1:40 fhd: technomancy: Great, 2.0 should solve a lot of our build troubles then :)

1:40 technomancy: fhd: if you're interested in using profiles I'd be glad to get some feedback on their design; there's a thread on the mailing list discussing them; I will try to update it to reflect what I implemented today.

1:41 fhd: technomancy: Sure, I'll play around with them later and give feedback.

1:48 dnolen: heh, had no idea that ^void worked

2:35 apetrescu: Does lein have an equivalent to Maven's "dependency:tree" command?

2:36 Ah, never mind, lein pom does the trick :)

4:23 AWizzArd: Moin moin.

4:30 y3di: how fast is clojure? does it rival python/ruby or java or is it somewhere in betweem

4:32 Wild_Cat: y3di: as with many things, the answer is "it depends on what you're doing with it, and how".

4:33 y3di: i was afraid of that

4:33 is there no good general approximation for that question

4:34 Scriptor: there's a lot of nuances to that question, but in general it's faster than python/ruby y3di

4:35 hoeck: y3di: my impression is that clojure cares more about avoiding useless dynamic overhead than python (after having used both)

4:35 Wild_Cat: hoeck: well, I'd more phrase that as "Clojure can use type hints to avoid dynamic overhead"

4:36 in the general case though, it's true that Clojure, by virtue of running on the JVM and its excellent JIT, is likely to run faster than Python or Ruby

4:36 (I wonder how it'd compare to PyPy, though)

4:37 hoeck: Wild_Cat: one point for me is that clojure doesn't have an index methods for lists, whereas in python the "x in list" idiom is totally fine

4:38 or the discussion about native ints vs BigNumber everywhere

4:38 Wild_Cat: Clojure also has the advantage of very good built-in support for concurrency and parallelism. If your program can be parallelized, it'll be easier to do in Clojure than in Python, Ruby or Java.

4:39 hoeck: isn't "contains?" the same thing?

4:39 hoeck: Wild: right, or that in clojure you can use the sophisticated, lockless queues from java.util.concurrent

4:39 Wild_Cat: no, contains? doesn't work for lists

4:39 Scriptor: only vectors?

4:40 well, vectors, hashes, and sets I'm guessing

4:40 Wild_Cat: hoeck: huh. You're right, it doesn't. And surprisingly, it returns false (not nil or an error) when used on a list.

4:40 that's ugly.

4:41 hoeck: it looks up keys in indexed collections (sets, hashmaps)

4:41 Scriptor: oh

4:41 contains? only looks for a key

4:41 not a value

4:41 clgv: hoeck: and vectors ;) ##(contains? [20 30 40 50] 2)

4:41 lazybot: ⇒ true

4:41 Scriptor: so it's not the same as in in python

4:41 Wild_Cat: Scriptor: oh!

4:42 hoeck: Scriptor: right, you have to use 'some' instead

4:42 Scriptor: yep

4:42 ##(some #(= % 2) '(1 2 3 4))

4:42 lazybot: ⇒ true

4:43 Wild_Cat: right. I see.

4:43 clgv: even shorter: ##(some #{2} '(1 2 3 4))

4:43 lazybot: ⇒ 2

4:43 Wild_Cat: okay, so for that use case, Python's syntax is more elegant/simpler ;)

4:43 clgv: and: ##(some #{10} '(1 2 3 4))

4:43 lazybot: ⇒ nil

4:43 Wild_Cat: clgv: won't that one simply return the 2nd element of the list?

4:43 Scriptor: ooh, right, collections as functions

4:44 Wild_Cat: ,(some #{2} '(1 3 4 2))

4:44 clojurebot: 2

4:44 Wild_Cat: that's not the same thing. clgv: your code is equivalent to contains? (except for the part where contains? doesn't work on lists)

4:44 clgv: Wild_Cat: no, the set is used as function which returns the value if found and some returns that value

4:45 wiseen_: ,(some nil? [1 2 3 4])

4:45 clojurebot: nil

4:45 wiseen_: ha

4:45 hoeck: Wild_Cat: but the python in is also confusing (for a clojurian), because for tuples, lists and sets, in checks the value, whereas for dicts it looks at the key

4:45 Scriptor: doesn't seem as idiomatic though, since some is better used with a predicate

4:45 and a collection-as-function isn't quote a predicate

4:46 Wild_Cat: hoeck: well, Python"s "in" is consistent with its iteration semantics. That is, for sets/tuples/lists/strings, "for i in c" iterates over values, but for a dict, "for k in d" iterates over keys.

4:46 hoeck: Wild_Cat: in clojure, sets/hashmaps/vectors use all the same interface, ILookup

4:46 Wild_Cat: (iterating over values is done with .itervalues(), and if you want both, it's "for (k, v) in d.iteritems()"

4:46 Scriptor: do you have to use .iteritems()?

4:47 Wild_Cat: Scriptor: only if you want both keys and values.

4:47 wiseen_: (not-any nil? [1 2 3 4 5 6]) seems more like "in" than some

4:47 hoeck: Wild_Cat: right, I came from clojure to python, and that was confusing to me at first, i expected 'for k,v in dictionary' to work :)

4:49 Wild_Cat: hoeck: yeah, I don't have the entire history of Python on my mind, but I suspect it was determined at some point during Python 2's design that it'd be more useful to have "in" work on keys and that the iteration semantics were designed to match this

4:50 coming from Clojure to Python, I do find it surprising that lists don't implement ILookup, even though it'd be O(n)

4:52 hoeck: Wild_Cat: I think ILookup explicitly states that its .get method must perform better than O(n)

4:52 Wild_Cat: I'm not sure how I feel about that.

4:52 Scriptor: what exactly is ILookup? Docs just say it's keyword-based lookup

4:53 Wild_Cat: I've always been of the school of thought that crap performance is still better than no performance at all ;)

4:53 hoeck: Scriptor: an interface in clojure, full name is clojure.lang.ILookup

4:54 Scriptor: right, I'm looking at the relevant section in http://www.assembla.com/spaces/clojure/wiki/Datatypes

4:54 lazybot: Assembla is deprecated. Use http://dev.clojure.org

4:54 Scriptor: why thank you lazybot

4:54 now please tell google that

4:55 Wild_Cat: while we're on that topic, what's the point of using get/nth when collections are all callable for retrieval?

4:58 hoeck: Wild_Cat: you may want to create an object that Implements ILookup but implements IFn differently

4:58 kzar: How do you break out of a doseq loop?

5:00 clgv: kzar: I think you dont. you'll have to choose a different organization if you want to stop at an arbitrary point

5:01 kzar: clgv: Oh I just realised how to do it

5:01 clgv: take the first of a filter instead of using doseq.. duh sorry

5:01 hoeck: Wild_Cat: sometimes you want to pass get or nth as a parameter to a function, thats more readable than passing #(%1 %2)

5:02 Wild_Cat: yeah, I can see that last point.

5:02 (although OTOH, get and nth don't always work)

5:02 clgv: Wild_Cat: nth fot list and seqs has a use as well (although you have to remember its O(n))

5:02 Wild_Cat: that is, get doesn't work on lists and nth doesn't work on maps/sets

5:02 AWizzArd: y3di: the thing is: a language can not be fast. A language is just a specification.

5:02 clgv: *for

5:02 hoeck: or you want to make sure to get a value from a collection and not calling an arbitrary function

5:03 clgv: Wild_Cat: get is also good for documenting that you want to access something associative there

5:14 ordnungswidrig: ,(-> [:a :b :c] (#(concat % [:x :y])) (#(concat [:f :g] %)))

5:14 clojurebot: (:f :g :a :b :c ...)

5:14 ordnungswidrig: Is there another way to use threading à la -> and ->> with arbitrary positions?

5:16 clgv: ordnungswidrig: fogus defined something similar: http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/

5:16 AWizzArd: Hi Ord.

5:17 ordnungswidrig: AWizzArd: hi!

5:18 clgv: thrush is nice, but I want it to work on forms, like in (-%> 5 (+ % 3) (* % 2))

5:19 clgv: ordnungswidrig: ah well, there as someone blogging about something like this as well - but I guess you'll have to define it yourself. should be easy with replace and if you restrict it to not have another '% with different meaning

5:24 ordnungswidrig: clgv: well, then (-$> 5 (+ $ 3) (* $ 2)) or like that :-)

5:25 clgv: ordnungswidrig: with usage of walk/postwalk-replace you should be able to do it easily

5:36 ordnungswidrig: clgv: (letfn [(thrush [x & args] ((apply comp (reverse args)) x))] (thrush 4 #(* 3 %) #(/ % 2)))

5:36 ,(letfn [(thrush [x & args] ((apply comp (reverse args)) x))] (thrush 4 #(* 3 %) #(/ % 2)))

5:36 clojurebot: 6

5:36 ordnungswidrig: works with #() as expected and no need to duplicate the tree walk to replace "%"

6:56 clgv: ordnungswidrig: yeah, that was the previous thrush suggestion ;)

7:11 kzar: With enlive is there a way to append to or transform an attribute? Only thing I can see is set-attr which doesn't give me the current value of the attribute to play with

7:27 raek: kzar: maybe enlive doesn't give you it, but it's very easy to make one yourself

7:28 kzar: raek: Oh yea, set-attr is just a function that takes the node anyway

7:29 raek: Sorry a function that returns a function that returns the node

7:29 takes* well you know what I mean

7:30 raek: (defn update-attr [key f] (fn [node] (update-in node [:attrs key] f)))

7:30 yep

7:31 set-attr is not a transformation, but a transformation builder

7:42 kzar: raek: Cool I wrote it independently, was basically the same as yours except specific for appending, worked first time too

8:30 cemerick: LOL @ "once people figure out that Clojure is not that great after all, they draw wrong conclusions about other Lisp dialects and start spreading prejudices about them"

8:30 Clojure is gonna give CL a bad name! :-P

8:33 lucian: cemerick: Clojure already makes CL look flawed (as if it didn't anyway)

8:33 i guess most people don't realise

8:33 raek: how can a language that has macros (i.e. infinite super powers) be "not that great after all"?

8:34 lucian: raek: common complaints are jvm and no reader macros

8:35 Wild_Cat: lucian: doesn't Clojure have macros?

8:35 pyr: cemerick: where is that from ?

8:35 * Wild_Cat probably doesn't understand something about the difference between reader macros and macros period

8:35 lucian: Wild_Cat: it doesn't have reader macros (ones that are executed on strings before the reader, not clojure data structures)

8:36 Wild_Cat: lucian: ah!

8:36 lucian: Wild_Cat: with a reader macro you could make &&**#a transform into (bla a) or something

8:36 Wild_Cat: I'm not certain how that's a bad thing, seeing as those are the only form of macros C/C++ has and I hate them with a passion

8:36 especially considering that the main use I could see for them (dict literals) is already taken care of

8:36 lucian: Wild_Cat: the ones in C aren't quite reader macros, they happen after lexing

8:37 Wild_Cat: one could add things like a url literal, or date literal with reader macros, but they are indeed confusing and error-prone

8:37 cemerick: pyr: you can google the phrase, I'm already off the page and would rather not link to it anyway

8:37 Wild_Cat: thanks for the explanation. With that, afk useless meeting.

8:38 pyr: cemerick: ah, i did see that article

8:38 yeah well

8:38 cemerick: it's in the comments

8:38 By my favorite lisper of all time! :-P

8:39 ejackson: haters gonna hate.

8:40 pyr: yup

8:41 AWizzArd: cemerick: I just found the comment you posted. This was (again) total BS from PC.

8:41 cemerick: The One True Lisp will rise again, much like the Great Pumpkin.

8:42 pyr: am I a bad lisper for having no idea who this guy is ?

8:42 will I get my clojure coding rights revoked ?

8:42 AWizzArd: lucian: reader macros don't operate on Strings, but on trees. It is just that the reader evals them during read time (not before).

8:42 pyr: i think i'm having FP recognition anxiety

8:43 lucian: AWizzArd: oh, they do? so it's also after lexing. thanks

8:43 cemerick: pyr: not missing anything

8:43 pyr: phew

8:43 AWizzArd: pyr: Pascal once wrote the "highly opinionated guide to lisp" and was and is very active in the CL community. He is an expert on oop and has invested much into CL, and to not lose this investment he stays away from all competition for CL.

8:44 http://www.p-cos.net/lisp/guide.html

8:44 Very experienced and nice. But I totally disagree with him about his opinions about Clojure.

8:45 He developed great tools for Aspect Oriented Programming (for CL).

8:45 cemerick: nice?

9:02 michael_campbell: yeah, through my years of reading c.l.cl, I don't recall him being "nice" in any sense of the word.

9:03 ollim: hello, am i missing something or is clojure missing a search of sorted-{maps,sets}? it seems i can only check if a key is in the set/map (returns nil otherwise). using filter to find stuff is sub-optimal (ie linear-time vs. log-time). are there good implementations of search structures around that i could switch to? sorry if this topic is a dead horse.

9:03 michael_campbell: Naggum was smart too, but also never "nice". You loved him or hated him, but I don't think many didn't respect him.

9:03 AWizzArd: cemerick: a friendly person. I met him several times at Lisp conferences, here in Germany, and emailed with him many times.

9:04 Fossi: yeah, i'd say so too

9:05 cemerick: ollim: what do you mean by "search"?

9:05 ollim: oh, perhaps you mean subseq and rsubseq?

9:06 ollim: cemerick: the usual. find an element or index in the data structure closest to the given key.

9:07 cemerick: Yup, you want subseq/rsubseq. You obviously need to know the nature of your key space in order to use them.

9:07 ollim: ok, thanks

9:10 AWizzArd: michael_campbell: Naggum was extremly unfriendly ;)

9:11 When he emailed people he serveral times suggested others to get psychological help, because of strong brain disabilities.

9:18 lucian: the guy you were speaking well of earlier, he's just so wrong http://lisp-univ-etc.blogspot.com/2011/11/clojure-complexity.html

9:21 kzar: What's the naming convention for a function that has a corresponding macro again?

9:21 cemerick: macro-name*, usually

9:21 kzar: OK

9:22 cemerick: I've also seen -macro-name lately, which I think might be a ClojureScript influence.

9:30 AWizzArd: lucian: yes, it is indeed wrong. To me it sounds like an "argument from bitterness".

9:31 When I hear someone criticizing Clojure for not having TCO the talk is basically over for me.

9:31 fdaoud: if anyone has read this book: Real-World Functional Programming (http://www.amazon.ca/gp/product/1933988924), I'd like to hear about whether it's good for learning more about FP even if you don't care for F# and C#, but also from a practical point of view rather than theoretical/mathematical.

9:31 lucian: AWizzArd: he makes some good points, but seems to bitter to put them across clearly

9:31 AWizzArd: well, kawa has it. that's valid criticism. but for most cases, recure is indeed clearer

9:32 Borkdude: I sometimes mistype it as "recurse"

9:32 lucian: AWizzArd: and for kawa, the performance hit is tiny, apparently

9:33 AWizzArd: lucian: it is valid that the current JVM does not support TCO. But Clojure nearly does, for most practical cases (and trampolines help for the few exotic cases, though they are not as efficient).

9:33 lucian: AWizzArd: but look here http://per.bothner.com/blog/2010/Kawa-in-shootout/. implicit trampolines

9:33 AWizzArd: recur is explicit tco for most cases, and Clojure can even check for us that it is indeed in the tail position.

9:34 lucian: sure. and i think that's nice

9:34 and it's not a big deal that it doesn't have TCO

9:34 AWizzArd: I am not aware that CL compilers warn you when you don't put your call in the tail position.

9:34 lucian: but it's a valid point that it could do full TCO with enough compiler effort

9:34 AWizzArd: one could have metadata to annotate as TCO, and warn if not

9:35 AWizzArd: Since years I use Clojure professionally and not once had a problem with missing tco. It is mostly an academic argument.

9:35 pdk: i dunno about warning them by default but as a compiler flag it wouldnt surprise me

9:35 AWizzArd: pdk: it is doable and detectable, I am just not aware that the compilers support it today.

9:35 lucian: pdk: or that. i like the idea of having both per-function annotation and compiler (like scala does)

9:35 Borkdude: a Common Lisper who criticizes Clojure for not being Common Lisp totally misses the point. Just use Common Lisp when you want Common Lisp and are not bound to the JVM?

9:36 lucian: Borkdude: i'd rather use clojure without the jvm too :)

9:36 * lucian doesn't particularly like CL

9:36 AWizzArd: Most people who criticize Clojure know it from hearing/reading about it, without actually ever trying to do something with it.

9:36 Borkdude: I have the feeling such a person doesn't feel the pain of having to live in a Java-oriented software company

9:37 Wild_Cat: lucian: yeah, being able to use Clojure without the JVM would be nice. IMO, what's really good about the language is that it's not crazy, not that it's JVM-bound.

9:37 lucian: Wild_Cat: sure. but it's better than JVM-bound, it's JVM-integrated

9:37 Wild_Cat: jython and kawa aren't as well integrated

9:37 pdk: that's better when you're sure you're always going to want to work on the jvm :p

9:37 Wild_Cat: that it *does* work on the JVM is a great thing (and it works very well). That it *only* works on the JVM is sad.

9:38 lucian: Wild_Cat: well, .net too :)

9:38 thing is, it requires a runtime

9:38 Wild_Cat: a not-insane Lisp that compiles to native code on Linux, OSX and Windows, with a decent stdlib and parallelism/concurrency features as nice as Clojure's would be awesome.

9:38 lucian: yep

9:39 Borkdude: Clojure is a virus which started breeding on the JVM, but spreads to other platforms and infects those too. Hope this continues for a while :P.

9:39 Wild_Cat: lucian: I thought the .net port was unmaintained and/or didn't work?

9:41 lucian: Wild_Cat: it's been revived and does work, apparently. google clojureclr

9:42 pdk: not seein how cl is insane but hey

9:42 Wild_Cat: pdk: I don't like the fact that it's a lisp-2 and doesn't have literals for anything.

9:42 lucian: Wild_Cat: you might like racket/chicken/icarus

9:42 Wild_Cat: (and no, "but you can do it yourself with macros!" isn't, and never was, a receivable argument)

9:42 Borkdude: (setf (cons some-list) 1) reads really weird now after some Clojure time

9:42 lucian: the latter compile to native code

9:43 Wild_Cat: lucian: I'll take a look, cheers.

9:44 lucian: Wild_Cat: they're all schemes, btw

9:44 racket is particularly vibrant

9:45 Wild_Cat: noted.

9:45 eddayyy: hi, I'm trying to get ClojureScript browser repl working but have no luck at all, it seems to hang whilst posting application/json data to the server

9:46 anyone else got an error like this before?

9:47 Borkdude: I meant (setf (car some-list) 1)

9:47 pandeiro: eddayyy: try refreshing the browser after you instantiate the repl

9:48 eddayyy: pandeiro: doesn't seem to help

9:49 its weird because it posts to the server initially and gets back status 200 OK, but when doing a second post it just gets stuck on 'pending'

9:49 Borkdude: I overheard something about using clojure.core.logic as a type system-ish thing. Has someone written about this?

9:49 pandeiro: eddayyy: are you working from a terminal emulator or from inside emacs or something?

9:50 eddayyy: pandeiro: I'm on windows and have clojure & clojurescript running in a virtual box vm

9:50 pandeiro: eddayyy: what guest OS?

9:51 eddayyy: pandeiro: ubuntu oneiric

9:51 pandeiro: and the clojure REPL itself works fine?

9:51 eddayyy: the clojurescript repl hangs indefinitely

9:51 i thought that was intended though

9:53 pandeiro: in fact the clojurescript repl hangs from the start, i can type numbers etc but no output

9:53 pandeiro: eddayyy: when did you last pull from the clojurescript repo?

9:54 eddayyy: pandeiro: about 30 mins ago

9:54 also, i don't get any message that a server is running on port 9000

9:54 pandeiro: eddayyy: that line got removed recently i believe

9:54 the browser is open, of course?

9:54 eddayyy: pandeiro: yep

9:55 pandeiro: i usually call the repl from inside my application code, after it has been compiled, is that how you're doing it?

9:55 eddayyy: pandeiro: it posts successfully the first time around and gets a success response, its just when it posts a second time with www-urlencoded data that it fails.

9:55 (from looking at the javascript console in chrome)

9:56 pandeiro: ok but what is the address that is loaded in the browser, out of curiosity?

9:57 is it linking to JS you've already compiled?

9:57 eddayyy: pandeiro: yeah the resources all load fine, the address is:

9:57 on the VM I have port forwarding on host set to 3000 and guest to 8080 (where the noir webserver is running)

9:58 I also have port forwarding on host set to 3010 and guest 9000 for the repl

9:59 so it loads the clojurescript resources adequately without error, then posts to :3010 and gets back 200OK, with text/javascript

9:59 pandeiro: eddayyy: i'm a little bit out of my league with the internals of the REPL server, admittedly... but it is working for me...

10:00 eddayyy: pandeiro: so no POST requests are stuck on pending?

10:01 pandeiro: eddayyy: nope, just checked and it's working fine

10:02 thing is, i am using it from inside emacs, as the inferior lisp mode, and invoking the repl from the resource i am loading in the browser

10:03 sorry, i mean invoking the repl in emacs and then calling repl.connect() in a script on the page i am loading

10:05 eddayyy: hmm

10:11 pandeiro: whats weird is that accessing directly looks like it works

10:16 pandeiro: it seems to be POSTing to but not to

10:16 is that normal?

10:19 pandeiro: eddayyy: i am hesitant to say, since i forward any ports in my setup, but on mine it connects to localhost:9000, not /repl

10:19 *dont forward

10:19 eddayyy: okay, so thats expected

10:19 pandeiro: eddayyy: can you pastebin the cljs code that is calling clojure.browser.repl/connect ?

10:20 eddayyy: sure

10:21 pandeiro: http://pastebin.com/2Qzpk5EL

10:22 pandeiro: looks fine, yeah...

10:23 eddayyy: pandeiro: what args can be passed to browser/repl-env ?

10:24 pandeiro: i don't think repl-env gets called directly

10:24 http://sprunge.us/HVMd

10:27 or yeah, gets called but without any args

10:27 sorry i couldn't help more, i admit i haven't really looked at the internals more than i needed to

10:42 jcromartie: I'm writing a library to give (var) names to unicode characters

10:43 eddayyy: pandeiro: it seems that there is no option in the code to specify the bind inet address of the server

10:43 AWizzArd: OT question regarding Jenkins: is there a way/plugin to tell Jenkins that if it finds a version tag in my source repo, it then should upload the artifacts to a Maven repo, such as Artifactory?

10:44 eddayyy: pandeiro: its possible that by default it binds to localhost which would be wrong

10:46 pandeiro: eddayyy: interesting yeah i use localhost because i just copied it from the wiki documentation

10:48 TimMc: jcromartie: So I could do net.jcromartie.uni/COMBINING_SEAGULL_BELOW to get the char?

10:48 jweiss: technomancy: i can't get syntax highlighting to work in the slime repl with emacs24+starter kit. there's a line from the swank-clojure README to add a hook for 'clojure-mode-font-lock-setup. I tried that hook, and tried calling clojure-mode-font-lock-setup manually in the repl, but it doesn't change the highlighting. Any suggestion?

10:48 jcromartie: TimMc: that's it exactly

10:48 I'm just wondering: should I go with code generation, or just a macro?

10:49 the macro is easy because it works at load time

10:49 TimMc: same thing :-)

10:49 jcromartie: there should be some kind of search util

10:49 like, to find character names

10:49 I don't know how you'd explore them

10:49 TimMc: But why do you think this is at all a good idea?

10:51 jcromartie: well I have a personal use for it :)

10:51 for roguelikes :)

10:58 TimMc: haha

10:58 Seems like overkill to me, though.

11:01 jcromartie: perhaps

11:01 TimMc: how about this...

11:02 jcromartie: What if your library instead provided a macro like this: (defchars [SEAGULL COMBINING_SEAGULL_BELOW] COMMA [LATIN_A LATIN_CAPITAL_LETTER_A]) --> (do (def SEAGULL \u033C) (def COMMA \u002C) (def LATIN_A \u0041))

11:03 jcromartie: that would work

11:03 TimMc: You just want a few names, not *all* of them.

11:05 jcromartie: typically, yes

11:07 TimMc: I would probably find such a macro useful for the times when I can't embed unicode directly.

11:08 jcromartie: yeah, that's true

11:08 licenser: morning

11:09 TimMc: e.g. if we ever use Clojure here at work, where the code style policy is to only use ASCII in text files.

11:09 (well, in source text files)

11:20 kzar: `lein deps` seems to be timing out for me

11:24 jcromartie: TimMc: I'm liking this

11:26 ambrosebs: can clojurescript macros be defined in a cljs file?

11:28 dnolen: ambrosebs: ping

11:28 ambrosebs: dnolen: pong

11:29 licenser: ambrosebs: I don't think they can, only via include macro

11:29 dnolen: ambrosebs: I about :require/use-macros, seems like yet another case where CLJ needs to align with CLJS

11:29 ambrosebs: that is :require/use-macros should really be an alternative form of :require, :use

11:30 ambrosebs: dnolen: as in CLJ should be modified? or are you just talking about the analyzer?

11:31 dnolen: ambrosebs: yes CLJ should be modified.

11:31 ambrosebs: any place where CLJ and CLJS can be aligned should be.

11:32 licenser: where can I gell cljsc to look for additional dependencies? like hey please also load this other files

11:33 ambrosebs: dnolen: I don't see why you'd need use-macros in CLJ?

11:34 dnolen: ambrosebs: you don't, just like you don't need (.-property foo)

11:35 ambrosebs: dnolen: what is (.-property foo) ?

11:40 dnolen: ambrosebs: you cannot different methods and fields in JavaScript, it's a proposal that removes the ambiguity

11:40 differentiate

11:41 ambrosebs: dnolen: you mean in ClojureScript?

11:41 dnolen: ambrosebs: yes

11:41 ambrosebs: because of JavaScript

11:41 ambrosebs: right

11:42 dnolen: so why would use-macros be useful in Clojure?

11:43 dnolen: speaking of which, getting sexpr by sexpr step debugging in ClojureScript should not only be possible, but pretty easy with the WebKit Remote Debugging Protocol

11:43 ambrosebs: it's not, just like (.-property foo) isn't, the point is to not have hack around the difference.

11:44 ambrosebs: :) I think I've confused myself. Should use-macros be removed in ClojureScript?

11:45 *from

11:45 dnolen: ambrosebs: no, :require/use-macros should just work in Clojure

11:45 ambrosebs: right :)

11:45 that seems reasonable

11:47 choffstein: Anyone familiar with resque-clojure

11:48 And by familiar, I mean: have an example project that uses it that I can see?

11:49 ambrosebs: dnolen: AFAICT the analyzer doesn't define macros, which makes sense if CLJS files can't define macros

11:49 which is a problem if parsing clojure code

11:50 I was thinking maybe `require` the clojure file before analyzing it?

11:50 dnolen: any ideas?

11:51 dnolen: ambrosebs: are you saying that the analyzer doesn't expand Clojure macros?

11:51 ambrosebs: dnolen: If the analyzer comes across a defmacro when parsing a file, it doesn't define a macro

11:53 i think :)

11:53 dnolen: ambrosebs: I see, OK, the analyzer itself does not understand macros. Yes that's a problem. You should definite put that in the design doc.

11:54 ambrosebs: dnolen: ok

11:57 dnolen: ambrosebs: no good ideas are coming to mind to me, but I'm sure someone will have thoughts on that. in Clojure analysis and compilation are interleaved - presents a problem if you just want analysis.

11:57 ambrosebs: definitely a case where macros as rewrite rules instead of fns simplify the issue.

11:58 ambrosebs: dnolen: do other Lisps work like that?

11:59 dnolen: ambrosebs: I imagine Common Lisp poses the same challenge. Seems avoidable in Scheme if you just have syntax-rules. Not sure about syntax-case.

12:04 ambrosebs: working with `symbol`, `namespace`, `resolve`, `intern`, `name` and the like is driving me nuts

12:05 cannot cast a sting to a symbol

12:05 vice versa

12:06 jcromartie_desk: ambrosebs: I think you might need some coercion functions

12:06 or do you just mean the function signatures themselves

12:06 ambrosebs: just nesting them, expecting them to compose well. rarely the case

12:07 (on the first try)

12:07 jcromartie_desk: hm, yeah

12:07 it would be nice if there was such a thing as a first-class namespace

12:07 like, not just names

12:08 well there is

12:08 but nothing expects it

12:08 ambrosebs: right

12:08 ,(resolve *ns* '+)

12:08 clojurebot: #'clojure.core/+

12:08 ambrosebs: amazing

12:09 ,(resolve "clojure.core" '+)

12:09 clojurebot: #'clojure.core/+

12:09 ambrosebs: :)

12:09 jcromartie_desk: ,(resolve nil '+)

12:09 clojurebot: #'clojure.core/+

12:09 jcromartie_desk: I guess resolve is just nice and friendly

12:10 ambrosebs: I find `symbol` the most annoying

12:10 ,(symbol 'clojure.core '+)

12:10 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String>

12:11 hiredman: ambrosebs: actually there was just a thread on clojure-dev about that

12:12 http://dev.clojure.org/jira/browse/CLJ-891

12:13 ambrosebs: hiredman: cheers

12:25 licenser: I keep getting this error when I try to compile my cljs code: SEVERE: /Volumes/Secondary/heinz/Projects/dividedspace/ds_web/out/evil/core.js:3: ERROR - required "goog.dom.query" namespace never provided :(

12:25 any idea what causes poor cljs not to find the goog libraries?

12:29 wow this is storage, the answer is it happened because I called ./cljs/bin/cljsc cljs-src instead of ./bin/cljsc ../cljs-src

12:39 dnolen: notes on ClojureScript debugging evolving - http://dev.clojure.org/display/design/ClojureScript+Debugger

13:00 gtrak`: technomancy_, are you using some ec2 stuff for irc? :-)

13:00 technomancy_: gtrak`: I have my bouncer hosted on Heroku

13:01 still working out the quirks =)

13:01 gtrak`: ah, what's that do for you?

13:05 technomancy_: gtrak`: it just keeps logs for me even when I'm not connected

13:05 so when I reconnect it just catches me up

13:05 Raynes: It does so much more.

13:05 gtrak`: ah, neat, I could imagine that being really useful

13:21 jcromartie: why should I write a macro that uses "def" when I can just intern a value?

13:23 Borkdude: How does one get the class object from a class, or interface, like for example IFn

13:23 in java: IFn.class

13:24 Raynes: &(type clojure.lang.IFn)

13:24 lazybot: ⇒ java.lang.Class

13:25 Borkdude: (I tried using Classname/class but it didn't work)

13:25 ,IFn/class

13:25 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: IFn, compiling:(NO_SOURCE_PATH:0)>

13:25 Borkdude: ,clojure.lang.IFn/class

13:25 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: class in interface clojure.lang.IFn, compiling:(NO_SOURCE_PATH:0)>

13:26 Borkdude: ,Object/class

13:26 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: class in class java.lang.Object, compiling:(NO_SOURCE_PATH:0)>

13:27 Raynes: Borkdude: Are you talking about an instance of java.lang.Class?

13:27 jcromartie_desk: Borkdude: the value of the class name expression is the class

13:27 as Raynes illustrated

13:27 Borkdude: Raynes: no, as in using it for reflection

13:27 jcromartie_desk: &(type Object)

13:27 lazybot: ⇒ java.lang.Class

13:28 Raynes: &(.getCanonicalName clojure.lang.IFn)

13:28 lazybot: ⇒ "clojure.lang.IFn"

13:28 jcromartie_desk: &(type (type 1))

13:28 lazybot: ⇒ java.lang.Class

13:28 Borkdude: ,(.getDeclaredMethods clojure.lang.IFn)

13:28 clojurebot: #<Method[] [Ljava.lang.reflect.Method;@452d4d>

13:28 Borkdude: ah right

13:28 tnx

13:28 jcromartie_desk: :) you think too much

13:28 Raynes: "That's too easy. Can't be right. Must ignore what they say for 10 minutes."

13:28 ;p

13:29 Borkdude: haha ;)

13:29 djKianoosh: to be fair it was only 5 minutes :)

13:29 Borkdude: :)

13:29 jcromartie_desk: yes, let's not exaggerate

13:33 Borkdude: ok, credits to #clojure : http://stackoverflow.com/questions/8435555/introspection-in-clojure/8435650#8435650 ;-)

13:34 Raynes: Oh man.

13:34 You are awesome.

13:35 You asked that question for the sole purpose of answering before any of us who actually know how to get a class object did. :P

13:35 Borkdude: haha :P

13:37 Raynes: next time I ask something, just check the newest Clojure question on SO

13:37 Raynes: so you can beat me to it

13:37 Raynes: Will do. :)

13:38 Chousuke: what about clojure.reflect :P

13:41 Borkdude: Chousuke: what about answering on SO, would like to read about it

13:42 but now I gtg

14:11 ambrosebs: what is the naming scheme for vars in ClojureScript? is a slash used to separate ns from name, or a dot?

14:12 cgray: slash

14:13 ambrosebs: In Clojure, a dot is a class, a slash is var. What is a dot in ClojureScript?

14:14 Raynes: Small and round.

14:14 ambrosebs: :D

14:15 cgray: ambrosebs: I'm curious: what do you mean that a dot is a class in clojure?

14:16 wink: wtf, SO blocks EC2 proxies o_O

14:16 ambrosebs: cgray: (deftype MyType ...) will make a class at my-ns.MyType

14:16 it will also make a constructor: my-ns/->MyType

14:16 that is my understanding at least

14:16 hiredman: (which is a bug, because '-' is not allowed in jvm type names)

14:17 ambrosebs: :)

14:17 licenser: ambrosebs: do you roun cljs as part of a clojure project or stand alone?

14:17 ambrosebs: licenser: say again?

14:17 licenser: I mean do you use something like cljs-noir or call the cljsc yourself :)

14:18 ambrosebs: I'm taking a copy of the ClojureScript compiler and trying to convert it to analyze clojure code

14:18 while knowing nothing about CLJS

14:18 licenser: oi sneaky

14:19 ambrosebs: so far it's been very successful

14:19 licenser: cool cool :)

14:19 * licenser had the hope he could copy your knowledge on running cljs :P

14:19 ohpauleez: Given a seq like [[:one 1] [:one 2] [:two 2]] - how do I get something like [[:one 1] [:two 2]]

14:19 fbru02: ambrosebs: wow !! want to see that ! :)

14:19 ohpauleez: I've been juggling `distinct` a bunch

14:20 ambrosebs: for those wanting to follow along: http://dev.clojure.org/display/design/Make+the+ClojureScript+analyzer+independently+callable+a+la+carte

14:20 and https://github.com/frenchy64/typed-clojure

14:20 licenser: ,(find-fn [[:one 1] [:one 2] [:two 2]] [[:one 1] [:two 2]])

14:20 ohpauleez: but nothing is panning out - right now I doing an exhausting filter using count

14:20 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: find-fn in this context, compiling:(NO_SOURCE_PATH:0)>

14:21 licenser: &(find-fn [[:one 1] [:one 2] [:two 2]] [[:one 1] [:two 2]])

14:21 lazybot: java.lang.RuntimeException: Unable to resolve symbol: find-fn in this context

14:21 licenser: &(findfn [[:one 1] [:one 2] [:two 2]] [[:one 1] [:two 2]])

14:21 lazybot: java.lang.RuntimeException: Unable to resolve symbol: findfn in this context

14:21 licenser: I suck o.o

14:21 ohpauleez: haha, yeah, what happened to find-fn? that was a cool thing in the bot

14:22 licenser: &(find-fn [[:one 1] [:two 2]] [[:one 1] [:one 2] [:two 2]])

14:22 lazybot: java.lang.RuntimeException: Unable to resolve symbol: find-fn in this context

14:22 licenser: there that is how it should work

14:22 &(use 'find-fn.core)

14:22 lazybot: java.io.FileNotFoundException: Could not locate find_fn/core__init.class or find_fn/core.clj on classpath:

14:22 licenser: &(use 'findfn.core)

14:22 lazybot: java.io.FileNotFoundException: Could not locate findfn/core__init.class or findfn/core.clj on classpath:

14:23 Raynes: $findfn [[:one 1] [:one 2] [:two 2]] [[:one 1] [:two 2]]

14:23 lazybot: []

14:23 ohpauleez: it's like I need a distinct-by

14:23 thanks Raynes

14:23 licenser: ambrosebs: very cool

14:24 Raynes: thanks :) that was too easy

14:25 ohpauleez: It's humbling you hit these alleyways in Clojure… when you think you REALLY need something like `distinct-by` but you know it doesn't exist for a reason, and you haven't hit the line-of-reasoning for why it doesn't exist

14:28 I suppose I can keep the filter call I currently have, just looks a little scary - thanks everyone

14:30 Raynes: &(group-by first [[:one 1] [:one 2] [:two 2]])

14:30 lazybot: ⇒ {:one [[:one 1] [:one 2]], :two [[:two 2]]}

14:30 licenser: has anyone ever ran a cljs project without something like noir and can help me? cljsc keeps failing to find the good libraries ;(

14:30 I always get - ERROR ... required "goog.dom.query" namespace never provided

14:31 ohpauleez: That's a good start Raynes, I also pushing it to a map, and pulling the map back with vec

14:31 terom: p

14:34 ohpauleez: Raynes: I like (map #(first (val %1)) …) on that group-by, thanks. Reads better than the filter I have

14:34 thanks a ton

14:35 Raynes: You're welcome. Now send me gifts.

14:36 ohpauleez: Raynes: They're already in the mail… no worries

14:40 licenser: Raynes: you are collecting gifts now :)

14:45 amalloy: you can't really use group-by there because you want to preserve order

14:46 ohpauleez: amalloy: Order of the small vectors doesn't matter to me

14:46 just that they are indeed uniq

14:46 amalloy: oh. then yeah, group-by is what i would do, i guess

14:46 ohpauleez: cool

14:46 Raynes: ohpauleez: It's okay to use the solution now, amalloy has declared it viable. Load off of my mind.

14:47 ohpauleez: haha :)

14:47 amalloy: just to be clear, you mean you don't care if you get back [[:one 1] [:two 2]] or [[:two 2] [:one 1]]?

14:48 ohpauleez: correct

15:17 aaelony: hey - do I need anything special in my project.clj to use jdbc in clojure 1.3 ? is it sufficient to use [clojure.java.jdbc :as jdbc] ? thanks

15:17 I'm just doing a use in my namespace currently...

15:18 choffstein: Is there a way to get lein to interpret a single file in your project? Sort of like lein run -m … but without needing -main?

15:21 aaelony: ah - found it! project.clj needed [org.clojure/java.jdbc "0.1.1"]

15:21 thanks

15:38 licenser: hmm how can I turn a json data into something clojurescript can eat?

15:40 dnolen: licenser: I'm assuming you don't control the data? otherwise you can just use the builtin reader to consume Clojure forms.

15:40 licenser: dnolen: I do control the data but the code that controls it isn't written in clojure ;)

15:41 I know it works great when both sides are clojure but my server is written in erlang

15:42 dnolen: writing something to serialize to sexprs seems pretty simple no? otherwise you're going to have to parse the JSON and do the conversion manually on the JSON.

15:43 licenser: which also isn't that hard if you want to do the latter.

15:44 licenser: I hoped to be able to convert the json but I am not sure how to interact with JS objects

15:45 and google seems to be not helpful with that

15:48 oh js->clj

15:50 dnolen: licenser: yes

15:50 licenser: you can also interact w/ them w/o the conversion with aget and/or property access.

15:51 licenser: :) sneaky sneaky

16:00 _ulises: ahoy

16:04 tolstoy: Oooo, cyclic load dependency!

16:10 When you create a macro (defmacro name [param] …) do you have to do anything special with that param, like `(let [p# param]) or something like that?

16:11 hiredman: for what purpose?

16:11 amalloy: you...you have to do whatever you have to do

16:11 tolstoy: Well, hm.

16:12 I think you only have to protect vars you introduce within the syntax-quote itself. I guess that makes sense.

16:13 Sorry, just a hangover from half-remembered common lisp, under the pressure to get this thing done. Sorry to have bothered you!

16:33 Raynes: tolstoy: Macros are just things you beat with a keyboard until they work.

16:34 amalloy: ~'~' ftw, dude

16:34 clojurebot: Cool story bro.

16:34 tolstoy: Raynes: Alas, that seems to be my method. It runs up the hours much more effectively that writing a small test program.

16:41 reiddraper: if any of you use clojure + riak, ping me. I'm working on a new client

16:44 hiredman: we don't use riak any more, but when we did a port of https://github.com/mochi/statebox would have been nice I think

16:45 reiddraper: hiredman: https://github.com/reiddraper/knockbox

16:45 brand new though

16:47 hiredman: seems datatype heavy

16:47 reiddraper: hiredman: yes, perhaps "port" isn't the right word. it solves the same problem as statebox

16:47 i'm new to clojure, but deftype seemed like the right solution

16:48 hiredman: I guess, but it makes the resolution strategy part of a type, instead of just a function you send into the state box

16:48 #9

16:48 clojurebot: #9

16:48 clojurebot: 9. It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures. -- Alan J. Perlis

16:49 reiddraper: hiredman: that's true, but the data is stored in such as way that it only makes sense to be consistent in how you modify it

16:50 and i want the datatypes to be able to be used like normal clojure sets, etc.

16:51 hiredman: it seems like with what you have you need to wrap and unwrap the set in a resolution strategy

16:52 before doing riak stuff with #{:foo} you need to (lww #{:foo}) at wich point the set operations don't work, unless you unwrap it, or provide a mechanism to lift the set functions into the datatype lww returns

16:52 the last is more or less what statebox does

16:53 (from my understanding, we did riak stuff in clojure, so I've used statebox)

16:53 er

16:53 so I've never used statebox

16:55 reiddraper: hiredman: creating a set with (lww) returns a type that *does* work as a set

17:01 cemerick: This is absolutely evil: ##(instance? String)

17:01 lazybot: ⇒ false

17:01 cemerick: *way* too friggin clever in InvokeExpr. :-(

17:02 hiredman: ,(instance? String)

17:02 clojurebot: false

17:02 dnolen: ,(instance? clojure.lang.IPersistentVector)

17:02 clojurebot: false

17:02 hiredman: interesting, is that the inline stuff?

17:02 cemerick: Nope.

17:02 hiredman: ,(meta instance?)

17:02 clojurebot: nil

17:02 hiredman: ,(meta #'instance?)

17:02 clojurebot: {:ns #<Namespace clojure.core>, :name instance?, :arglists ([c x]), :added "1.0", :doc "Evaluates x and tests if it is an instance of the class\n c. Returns true or false", ...}

17:03 cemerick: Check the Compiler.

17:03 InvokeExpr.parse

17:04 amalloy: oh yeah, it has a special-case for instance?, doesn't it?

17:04 cemerick: yup

17:05 amalloy: and i guess it winds up being the same as (instance? String nil)

17:05 TimMc: wtf

17:05 hiredman: cute

17:05 TimMc: &(instance? String "hi" "hello" 4)

17:05 lazybot: ⇒ true

17:05 hiredman: should be an inline+intrinsic

17:05 cemerick: I'm not sure if a prospective patch would fix the special-casing to fail on a single-arg form, or re-define instance? after the :inline stuff is available for defn.

17:06 amalloy: hiredman: what should i read to understand what intrinsics are?

17:06 hiredman: amalloy: the compiler can inline certains methods as bytecode directly

17:06 Intrinsics.java

17:06 a map of method names to the bytecode they can be inlined as

17:07 cemerick: well, you could just stick the right inline keys in the metadata

17:07 cemerick: yeah

17:08 We'll roll the ML dice and see if this slips in as a quickie-fix.

17:08 amalloy: oh, interesting. so the call to Numbers/add (for example) winds up being: push the doubles onto the stack as if you were calling a function, then emit the bytecode in this map instead of the function call?

17:08 daniel__3: using korma, do i have to manually create all the database tables/fields?

17:08 i can only find methods to query the database in the docs, no way of actually creating an entity user with a password field

17:08 hiredman: amalloy: if everything inlines right

17:09 amalloy: right

17:09 and is typehinted/tagged appropriately

17:10 haha longCast(long) => NOP

17:15 devinus: is there a way to set JAVA_HOME for swank to see in .emacs?

17:18 (setenv "JAVA_HOME" "foo")

17:18 nice

17:19 jcromartie: my command line tip of the day: cat some_file.csv | columns -ts , | less -S

17:20 CSV viewer

17:20 amalloy: seems kinda pointless to get cat involved

17:20 jcromartie: just to illustrate that you can pipe to columns

17:21 as I usually do

17:21 amalloy: columns -ts , < some_file.csv

17:21 jcromartie: sure

17:26 TimMc: amalloy: Presumably the cat command is here standing in for something that is generating CSV.

17:28 amalloy: i enjoy being the channel's misguided pedant, TimMc

17:30 technomancy: sooooo... apparently blip.tv has stopped letting you download videos unless you have a facebook account?

17:30 time to find a new video host

17:38 TimMc: technomancy: Oh, yuck.

17:52 devinus: so, any good free online clojure books?

17:52 something to sink my teeth into until i'm comfortable shelling out for a really good print book?

17:53 amalloy: stylistically, does anyone have an opinion about (let [foo (let [foo* whatever] (something using foo*))] (body)), to keep foo* out of the scope of body (eg to avoid shadowing or to make it clear where foo* is used)?

17:56 accel: +filetype:pdf

18:09 Somelauw: I am playing 4clojure, but for some reason I keep on writing ugly code for example, I use the following for example for getting the intersection of 2 sets: (disj (set (map #{1 2 3} #{2 3 4})) nil)

18:11 cgray: Somelauw: I think not being able to define functions is pretty hampering stylistically.

18:18 tolstoy: devinus: I don't know of any online Clojure books, outside of various blogs.

18:18 devinus: tolstoy: that's unfortunate

18:19 trying to learn from clojure.org, even coming from a background in scheme and erlang, is a bit…daunting

18:20 tolstoy: devinus: Maybe this? http://thinkrelevance.com/blog/2008/09/16/pcl-clojure.html

18:25 amalloy: cgray: that's why god gave you 'let

18:27 cgray: amalloy: oh i realize, let and fn both help out in 4clojure, but they don't make things look very pretty :)

18:27 amalloy: cgray: i actually really like it. it reminds you that your whole program could be written as a bunch of nested lets and so on, as one big tree: multiple top-level forms aren't actually necessary

18:29 cgray: amalloy: M-x butterfly

20:01 jodaro: if i had a nickel for every time i did (deftest "foo" instead of (deftest foo and then spent 5 minutes trying to figure out where the hell the exception was coming from ...

20:01 i'd have a shitload of nickels

20:03 chessguy: hey if i have 2 functions defined in terms of each other, what's that special way of saying "hey i know about this symbol, i'll define it in a minute"

20:04 ohpauleez: chessguy: (declare ..)

20:04 jodaro: declare

20:04 chessguy: ah, that's it

20:04 thank you

20:04 ohpauleez: np

20:04 jodaro: me too np

20:04 chessguy: it was on the tip of my brain, but it's been a couple years since i fiddled with clojure

20:34 amalloy: chessguy: also letfn

20:50 alexbaranosky: anyone read The Art of Prolog?

20:52 jacobsen: Hi all, quick question. I'm a long-time Lisp fan and a new hobbyist in Clojure (Python being my main current lingua-franca). Been playing w/ clojure for a month or so now on off hours. Is anything being done w/ the brutal slowness of small apps to run under e.g. Leinginen? E.g. http://pastebin.com/7i5mNLSZ . It's much faster with Cake (the second time around, reusing the JVM). I understand Ruby-based Cake is going to merge

20:53 alexbaranosky: jacobsen, `lein int` helps, by running leiningen with a persistent JVM

20:54 jacobsen: Ah, yes indeed.

20:54 But is there any (pre-packaged) way to connect to existing JVM process a la Cake?

20:55 amalloy: $google clojure jark

20:55 lazybot: [jark -] http://icylisper.in/jark/scripting.html

20:56 amalloy: i haven't used it, but it's an interesting idea

20:56 leo2007: why haven't I seen Richie speak in the mailing list?

20:56 jacobsen: @amalloy - thanks, that looks interesting

20:56 alexbaranosky: leo2007, who's Richie?

21:00 leo2007: alexbaranosky: I mean rich hickey.

21:03 alexbaranosky: leo2007, I wonder, don't know, sorry

21:30 tmountain: can anyone advise on the best way to transform [ [ [:a :b] [:c :d] ] [ [:e :f ] ] ] to [[:a :b] [:c :d] [:e :f]] ?

21:30 alexbaranosky: (map flatten x)

21:31 amalloy: ~flatten

21:31 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.

21:31 amalloy: &(apply concat [ [ [:a :b] [:c :d] ] [ [:e :f ] ] ])

21:31 lazybot: ⇒ ([:a :b] [:c :d] [:e :f])

21:31 brehaut: no mapcat identity?

21:31 alexbaranosky: it's three words that work

21:31 mapcat identity works too :)

21:32 tmountain: ahh, thanks so much!

21:32 brehaut: alexbaranosky: thats because mapcat identity _is_ apply concat done awkwardly ;)

21:32 tmountain: mind explosion was commencing

21:32 amalloy: brehaut: awkwardly? more like with style and grace

21:33 tmountain: so the apply concat is better than mapcat identity?

21:33 brehaut: amalloy: haha ok :)

21:33 alexbaranosky: tmountain, the decision whether to use flatten depends on whether you want to remove all nesting from each of the subvectors, or if you just want to remove one level of nesting

21:33 amalloy: yeah, mapcat identity is mostly a joke

21:34 brehaut: ,(source mapcat)

21:34 clojurebot: Source not found

21:34 brehaut: thanks clojurebot

21:34 amalloy: ~source mapcat

21:34 brehaut: ~botsnack

21:34 clojurebot: thanks; that was delicious. (nom nom nom)

21:36 tmountain: is there something less barbaric than (apply concat (apply concat grossly-nested)) when it's desired to remove two levels of nesting?

21:50 alexbaranosky: tmountain, if you want to drop all levels of nesting you can use flatten, if you specifically want to go 2 levels deep, you have to do the apply concat thing, or use some other way of structuring your code/data to eliminate the need for it

21:50 tmountain: thanks for the help guys

21:52 one other question

21:52 what's the easiest way to go from [:a :b :c] to {:a 1, :b 1, :c 1}

21:53 ohpauleez: zipmap [:a :b :c] (repeat 1))

21:54 tmountain: beautiful, thanks

21:54 ohpauleez: tmountain: This is a bad suggestion: but you might be able to work some magic recur'ing (make it a transient if you need to squeeze it some more)

21:57 (defn down-it [v] (if (< (count v) 2) (recur (apply concat v)) v))

21:57 oh, he's gone

22:24 replore_: made a sample noir website http://sharp-warrior-4964.herokuapp.com/sample

22:32 y3di: has any of you guys used google's closure templating system?

23:07 duck1123: y3di: I do

23:14 y3di: how is duck1123? is it MVC ish?

23:27 semperos: using :gen-class, say I have a :main namespace defined in my project.clj of foo.core

23:27 I have a requirement to use Maven, so I've taken the default pom.xml Leininge produces and have added the necessary entry for the maven assembly plugin to generate an executable jar

23:28 how can I set the mainClass element appropriately within the maven-assembly-plugin's config?

23:28 I've tried using the :name option with :gen-class to define a custom class name, but I've not been able to get it working

23:29 tried something like (:gen-class :name foo.core.Main) and then added foo.core.Main to the mainClass element in my pom.xml...feel like I'm missing something obvious

23:30 kumarshantanu: semperos: are you using maven shade plugin? or the assembly plugin?

23:30 semperos: assembly

23:31 so it's not an "uberjar" in Maven-speak, but rather a "jar-with-dependencies", but you can define mainClass as the entry point

23:31 done it before with pure-Java projects, just can't seem to get the class generation right on the Clojure side in this one instance

23:32 kumarshantanu: are you AOT-compiling the Clojure file? Are you using Clojure-Maven-plugin to do that?

23:33 semperos: had the :aot flag set in project.clj, wasn't using hte clojure-maven-plugin, worth a try...

23:33 kumarshantanu: Maven doesn't have the Clojure-compile option by default; you will likely need a plugin to do that

23:36 semperos: this is what I get for trying this at the *end* of my day :)

23:36 clojurebot: 'Sea, mhuise.

23:41 semperos: from readme, clojure-maven-plugin depends on clojure 1.2

23:47 duck1123: y3di: very much so. The ammount of operations you can perform on the data are very limited, so you have pre-format the data

23:47 kumarshantanu: semperos: i am using clojure-maven-plugin with Clojure 1.3.0

23:47 semperos: k

23:48 some of the tasks still depend on 1.2, but not all

23:49 duck1123: semperos: really, I never had any (version-related) problems using maven with 1.3

23:49 semperos: tried `mvn clojure:gendoc`, seemed to require the old contrib

23:49 just as an example, not critical

23:50 kumarshantanu: semperos: all of the documentation tasks currently suck as of clojure-maven-plugin 1.3.8

23:50 semperos: gotcha

23:57 devn: is this for specific integration with another system? leiningen doesn't do the job? I plead ignorance here. I've never done Java for a living, not really even a hobby unless you count clojure->java interaction.

23:57 :gen-class?

Logging service provided by n01se.net