#clojure logs

2011-12-08

00:29jcrossley3technomancy: 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
00:45fhdDoes anybody know if I can add dependencies that are only included in an uberjar in Leiningen?
00:45fhdThe 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.
01:14dnolenanybody have opinions on the best Clojure WebSocket client?
01:22technomancyjcrossley3: that's quite a bit more complicated than necessary
01:22technomancyyou don't need to set up a job for leiningen itself
01:24technomancyfhd: the uberwar task should be able to set up exclusions for its dependencies
01:25technomancyby "should" I mean "it would be best if it did"
01:27fhdtechnomancy: But it doesn't? :)
01:27technomancyprobably not, unfortunately
01:27fhdtechnomancy: Okay, I'll head over to ring and create an issue then, thanks
01:28technomancyfhd: we happen to be working on implementing profiles for leiningen that would support this exact scenario though
01:29fhdtechnomancy: Nice to hear, we've been wondering when/if lein will get profiles :)
01:29fhdtechnomancy: Any wiki page/post or something available on that?
01:30technomancyfhd: minor sketch on the VersionTwo page of the wiki, plus I just started a brief implementation on the profiles branch.
01:30fhdtechnomancy: I'll have a look, thanks. Hopefully should help us get rid of a few ugly custom plugins.
01:30technomancyI've only added it to the leiningen-core library though; the rest of Leiningen probably still needs to be adapted to work with it.
01:32technomancyhttps://github.com/technomancy/leiningen/compare/master...profiles#L2R64 FWIW
01:36fhdtechnomancy: Hm, from a quick look it seems like profiles are implemented in Leiningen, not using the Maven mechanism, is that right?
01:36fhdtechnomancy: Not that I mind, I don't know if it makes sense (or is possible) to use Maven's mechanism in lein
01:36technomancycorrect; they only affect project.clj maps
01:37fhdtechnomancy: Nice, looks friendlier than what Maven has already :)
01:37technomancygreat! this is just a couple hours worth of coding from today so far.
01:37technomancythough much more time than that spend on design.
01:37fhdtechnomancy: And this will be in lein 2.0? Any chance to get a rough release date estimation for that?
01:38technomancyprobably on the order of six months
01:39fhdtechnomancy: And it will use Aether as planned?
01:39technomancyfhd: yeah, that part is actually already working great thanks to cemerick's pomegranate
01:39RaynesIf he would just pay me, this stuff would be done by the end of the month.
01:40fhdtechnomancy: Great, 2.0 should solve a lot of our build troubles then :)
01:40technomancyfhd: 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.
01:41fhdtechnomancy: Sure, I'll play around with them later and give feedback.
01:48dnolenheh, had no idea that ^void worked
02:35apetrescuDoes lein have an equivalent to Maven's "dependency:tree" command?
02:36apetrescuAh, never mind, lein pom does the trick :)
04:23AWizzArdMoin moin.
04:30y3dihow fast is clojure? does it rival python/ruby or java or is it somewhere in betweem
04:32Wild_Caty3di: as with many things, the answer is "it depends on what you're doing with it, and how".
04:33y3dii was afraid of that
04:33y3diis there no good general approximation for that question
04:34Scriptorthere's a lot of nuances to that question, but in general it's faster than python/ruby y3di
04:35hoecky3di: my impression is that clojure cares more about avoiding useless dynamic overhead than python (after having used both)
04:35Wild_Cathoeck: well, I'd more phrase that as "Clojure can use type hints to avoid dynamic overhead"
04:36Wild_Catin 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
04:36Wild_Cat(I wonder how it'd compare to PyPy, though)
04:37hoeckWild_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
04:38hoeckor the discussion about native ints vs BigNumber everywhere
04:38Wild_CatClojure 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.
04:39Wild_Cathoeck: isn't "contains?" the same thing?
04:39hoeckWild: right, or that in clojure you can use the sophisticated, lockless queues from java.util.concurrent
04:39hoeckWild_Cat: no, contains? doesn't work for lists
04:39Scriptoronly vectors?
04:40Scriptorwell, vectors, hashes, and sets I'm guessing
04:40Wild_Cathoeck: huh. You're right, it doesn't. And surprisingly, it returns false (not nil or an error) when used on a list.
04:40Wild_Catthat's ugly.
04:41hoeckit looks up keys in indexed collections (sets, hashmaps)
04:41Scriptoroh
04:41Scriptorcontains? only looks for a key
04:41Scriptornot a value
04:41clgvhoeck: and vectors ;) ##(contains? [20 30 40 50] 2)
04:41lazybot⇒ true
04:41Scriptorso it's not the same as in in python
04:41Wild_CatScriptor: oh!
04:42hoeckScriptor: right, you have to use 'some' instead
04:42Scriptoryep
04:42Scriptor##(some #(= % 2) '(1 2 3 4))
04:42lazybot⇒ true
04:43Wild_Catright. I see.
04:43clgveven shorter: ##(some #{2} '(1 2 3 4))
04:43lazybot⇒ 2
04:43Wild_Catokay, so for that use case, Python's syntax is more elegant/simpler ;)
04:43clgvand: ##(some #{10} '(1 2 3 4))
04:43lazybot⇒ nil
04:43Wild_Catclgv: won't that one simply return the 2nd element of the list?
04:43Scriptorooh, right, collections as functions
04:44Wild_Cat,(some #{2} '(1 3 4 2))
04:44clojurebot2
04:44Wild_Catthat's not the same thing. clgv: your code is equivalent to contains? (except for the part where contains? doesn't work on lists)
04:44clgvWild_Cat: no, the set is used as function which returns the value if found and some returns that value
04:45wiseen_,(some nil? [1 2 3 4])
04:45clojurebotnil
04:45wiseen_ha
04:45hoeckWild_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
04:45Scriptordoesn't seem as idiomatic though, since some is better used with a predicate
04:45Scriptorand a collection-as-function isn't quote a predicate
04:46Wild_Cathoeck: 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.
04:46hoeckWild_Cat: in clojure, sets/hashmaps/vectors use all the same interface, ILookup
04:46Wild_Cat(iterating over values is done with .itervalues(), and if you want both, it's "for (k, v) in d.iteritems()"
04:46Scriptordo you have to use .iteritems()?
04:47Wild_CatScriptor: only if you want both keys and values.
04:47wiseen_(not-any nil? [1 2 3 4 5 6]) seems more like "in" than some
04:47hoeckWild_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 :)
04:49Wild_Cathoeck: 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
04:50Wild_Catcoming from Clojure to Python, I do find it surprising that lists don't implement ILookup, even though it'd be O(n)
04:52hoeckWild_Cat: I think ILookup explicitly states that its .get method must perform better than O(n)
04:52Wild_CatI'm not sure how I feel about that.
04:52Scriptorwhat exactly is ILookup? Docs just say it's keyword-based lookup
04:53Wild_CatI've always been of the school of thought that crap performance is still better than no performance at all ;)
04:53hoeckScriptor: an interface in clojure, full name is clojure.lang.ILookup
04:54Scriptorright, I'm looking at the relevant section in http://www.assembla.com/spaces/clojure/wiki/Datatypes
04:54lazybotAssembla is deprecated. Use http://dev.clojure.org
04:54Scriptorwhy thank you lazybot
04:54Scriptornow please tell google that
04:55Wild_Catwhile we're on that topic, what's the point of using get/nth when collections are all callable for retrieval?
04:58hoeckWild_Cat: you may want to create an object that Implements ILookup but implements IFn differently
04:58kzarHow do you break out of a doseq loop?
05:00clgvkzar: I think you dont. you'll have to choose a different organization if you want to stop at an arbitrary point
05:01kzarclgv: Oh I just realised how to do it
05:01kzarclgv: take the first of a filter instead of using doseq.. duh sorry
05:01hoeckWild_Cat: sometimes you want to pass get or nth as a parameter to a function, thats more readable than passing #(%1 %2)
05:02Wild_Catyeah, I can see that last point.
05:02Wild_Cat(although OTOH, get and nth don't always work)
05:02clgvWild_Cat: nth fot list and seqs has a use as well (although you have to remember its O(n))
05:02Wild_Catthat is, get doesn't work on lists and nth doesn't work on maps/sets
05:02AWizzArdy3di: the thing is: a language can not be fast. A language is just a specification.
05:02clgv*for
05:02hoeckor you want to make sure to get a value from a collection and not calling an arbitrary function
05:03clgvWild_Cat: get is also good for documenting that you want to access something associative there
05:14ordnungswidrig,(-> [:a :b :c] (#(concat % [:x :y])) (#(concat [:f :g] %)))
05:14clojurebot(:f :g :a :b :c ...)
05:14ordnungswidrigIs there another way to use threading à la -> and ->> with arbitrary positions?
05:16clgvordnungswidrig: fogus defined something similar: http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/
05:16AWizzArdHi Ord.
05:17ordnungswidrigAWizzArd: hi!
05:18ordnungswidrigclgv: thrush is nice, but I want it to work on forms, like in (-%> 5 (+ % 3) (* % 2))
05:19clgvordnungswidrig: 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
05:24ordnungswidrigclgv: well, then (-$> 5 (+ $ 3) (* $ 2)) or like that :-)
05:25clgvordnungswidrig: with usage of walk/postwalk-replace you should be able to do it easily
05:36ordnungswidrigclgv: (letfn [(thrush [x & args] ((apply comp (reverse args)) x))] (thrush 4 #(* 3 %) #(/ % 2)))
05:36ordnungswidrig,(letfn [(thrush [x & args] ((apply comp (reverse args)) x))] (thrush 4 #(* 3 %) #(/ % 2)))
05:36clojurebot6
05:36ordnungswidrigworks with #() as expected and no need to duplicate the tree walk to replace "%"
06:56clgvordnungswidrig: yeah, that was the previous thrush suggestion ;)
07:11kzarWith 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
07:27raekkzar: maybe enlive doesn't give you it, but it's very easy to make one yourself
07:28kzarraek: Oh yea, set-attr is just a function that takes the node anyway
07:29kzarraek: Sorry a function that returns a function that returns the node
07:29kzartakes* well you know what I mean
07:30raek(defn update-attr [key f] (fn [node] (update-in node [:attrs key] f)))
07:30raekyep
07:31raekset-attr is not a transformation, but a transformation builder
07:42kzarraek: Cool I wrote it independently, was basically the same as yours except specific for appending, worked first time too
08:30cemerickLOL @ "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"
08:30cemerickClojure is gonna give CL a bad name! :-P
08:33luciancemerick: Clojure already makes CL look flawed (as if it didn't anyway)
08:33luciani guess most people don't realise
08:33raekhow can a language that has macros (i.e. infinite super powers) be "not that great after all"?
08:34lucianraek: common complaints are jvm and no reader macros
08:35Wild_Catlucian: doesn't Clojure have macros?
08:35pyrcemerick: where is that from ?
08:35lucianWild_Cat: it doesn't have reader macros (ones that are executed on strings before the reader, not clojure data structures)
08:36Wild_Catlucian: ah!
08:36lucianWild_Cat: with a reader macro you could make &&**#a transform into (bla a) or something
08:36Wild_CatI'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
08:36Wild_Catespecially considering that the main use I could see for them (dict literals) is already taken care of
08:36lucianWild_Cat: the ones in C aren't quite reader macros, they happen after lexing
08:37lucianWild_Cat: one could add things like a url literal, or date literal with reader macros, but they are indeed confusing and error-prone
08:37cemerickpyr: you can google the phrase, I'm already off the page and would rather not link to it anyway
08:37Wild_Catthanks for the explanation. With that, afk useless meeting.
08:38pyrcemerick: ah, i did see that article
08:38pyryeah well
08:38cemerickit's in the comments
08:38cemerickBy my favorite lisper of all time! :-P
08:39ejacksonhaters gonna hate.
08:40pyryup
08:41AWizzArdcemerick: I just found the comment you posted. This was (again) total BS from PC.
08:41cemerickThe One True Lisp will rise again, much like the Great Pumpkin.
08:42pyram I a bad lisper for having no idea who this guy is ?
08:42pyrwill I get my clojure coding rights revoked ?
08:42AWizzArdlucian: reader macros don't operate on Strings, but on trees. It is just that the reader evals them during read time (not before).
08:42pyri think i'm having FP recognition anxiety
08:43lucianAWizzArd: oh, they do? so it's also after lexing. thanks
08:43cemerickpyr: not missing anything
08:43pyrphew
08:43AWizzArdpyr: 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.
08:44AWizzArdhttp://www.p-cos.net/lisp/guide.html
08:44AWizzArdVery experienced and nice. But I totally disagree with him about his opinions about Clojure.
08:45AWizzArdHe developed great tools for Aspect Oriented Programming (for CL).
08:45cemericknice?
09:02michael_campbellyeah, through my years of reading c.l.cl, I don't recall him being "nice" in any sense of the word.
09:03ollimhello, 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.
09:03michael_campbellNaggum was smart too, but also never "nice". You loved him or hated him, but I don't think many didn't respect him.
09:03AWizzArdcemerick: a friendly person. I met him several times at Lisp conferences, here in Germany, and emailed with him many times.
09:04Fossiyeah, i'd say so too
09:05cemerickollim: what do you mean by "search"?
09:05cemerickollim: oh, perhaps you mean subseq and rsubseq?
09:06ollimcemerick: the usual. find an element or index in the data structure closest to the given key.
09:07cemerickYup, you want subseq/rsubseq. You obviously need to know the nature of your key space in order to use them.
09:07ollimok, thanks
09:10AWizzArdmichael_campbell: Naggum was extremly unfriendly ;)
09:11AWizzArdWhen he emailed people he serveral times suggested others to get psychological help, because of strong brain disabilities.
09:18lucianthe guy you were speaking well of earlier, he's just so wrong http://lisp-univ-etc.blogspot.com/2011/11/clojure-complexity.html
09:21kzarWhat's the naming convention for a function that has a corresponding macro again?
09:21cemerickmacro-name*, usually
09:21kzarOK
09:22cemerickI've also seen -macro-name lately, which I think might be a ClojureScript influence.
09:30AWizzArdlucian: yes, it is indeed wrong. To me it sounds like an "argument from bitterness".
09:31AWizzArdWhen I hear someone criticizing Clojure for not having TCO the talk is basically over for me.
09:31fdaoudif 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.
09:31lucianAWizzArd: he makes some good points, but seems to bitter to put them across clearly
09:31lucianAWizzArd: well, kawa has it. that's valid criticism. but for most cases, recure is indeed clearer
09:32BorkdudeI sometimes mistype it as "recurse"
09:32lucianAWizzArd: and for kawa, the performance hit is tiny, apparently
09:33AWizzArdlucian: 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).
09:33lucianAWizzArd: but look here http://per.bothner.com/blog/2010/Kawa-in-shootout/. implicit trampolines
09:33AWizzArdrecur is explicit tco for most cases, and Clojure can even check for us that it is indeed in the tail position.
09:34luciansure. and i think that's nice
09:34lucianand it's not a big deal that it doesn't have TCO
09:34AWizzArdI am not aware that CL compilers warn you when you don't put your call in the tail position.
09:34lucianbut it's a valid point that it could do full TCO with enough compiler effort
09:34lucianAWizzArd: one could have metadata to annotate as TCO, and warn if not
09:35AWizzArdSince years I use Clojure professionally and not once had a problem with missing tco. It is mostly an academic argument.
09:35pdki dunno about warning them by default but as a compiler flag it wouldnt surprise me
09:35AWizzArdpdk: it is doable and detectable, I am just not aware that the compilers support it today.
09:35lucianpdk: or that. i like the idea of having both per-function annotation and compiler (like scala does)
09:35Borkdudea 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?
09:36lucianBorkdude: i'd rather use clojure without the jvm too :)
09:36AWizzArdMost people who criticize Clojure know it from hearing/reading about it, without actually ever trying to do something with it.
09:36BorkdudeI have the feeling such a person doesn't feel the pain of having to live in a Java-oriented software company
09:37Wild_Catlucian: 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.
09:37lucianWild_Cat: sure. but it's better than JVM-bound, it's JVM-integrated
09:37lucianWild_Cat: jython and kawa aren't as well integrated
09:37pdkthat's better when you're sure you're always going to want to work on the jvm :p
09:37Wild_Catthat it *does* work on the JVM is a great thing (and it works very well). That it *only* works on the JVM is sad.
09:38lucianWild_Cat: well, .net too :)
09:38lucianthing is, it requires a runtime
09:38Wild_Cata 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.
09:38lucianyep
09:39BorkdudeClojure 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.
09:39Wild_Catlucian: I thought the .net port was unmaintained and/or didn't work?
09:41lucianWild_Cat: it's been revived and does work, apparently. google clojureclr
09:42pdknot seein how cl is insane but hey
09:42Wild_Catpdk: I don't like the fact that it's a lisp-2 and doesn't have literals for anything.
09:42lucianWild_Cat: you might like racket/chicken/icarus
09:42Wild_Cat(and no, "but you can do it yourself with macros!" isn't, and never was, a receivable argument)
09:42Borkdude(setf (cons some-list) 1) reads really weird now after some Clojure time
09:42lucianthe latter compile to native code
09:43Wild_Catlucian: I'll take a look, cheers.
09:44lucianWild_Cat: they're all schemes, btw
09:44lucianracket is particularly vibrant
09:45Wild_Catnoted.
09:45eddayyyhi, 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
09:46eddayyyanyone else got an error like this before?
09:47BorkdudeI meant (setf (car some-list) 1)
09:47pandeiroeddayyy: try refreshing the browser after you instantiate the repl
09:48eddayyypandeiro: doesn't seem to help
09:49eddayyyits 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'
09:49BorkdudeI overheard something about using clojure.core.logic as a type system-ish thing. Has someone written about this?
09:49pandeiroeddayyy: are you working from a terminal emulator or from inside emacs or something?
09:50eddayyypandeiro: I'm on windows and have clojure & clojurescript running in a virtual box vm
09:50pandeiroeddayyy: what guest OS?
09:51eddayyypandeiro: ubuntu oneiric
09:51pandeiroand the clojure REPL itself works fine?
09:51eddayyythe clojurescript repl hangs indefinitely
09:51eddayyyi thought that was intended though
09:53eddayyypandeiro: in fact the clojurescript repl hangs from the start, i can type numbers etc but no output
09:53pandeiroeddayyy: when did you last pull from the clojurescript repo?
09:54eddayyypandeiro: about 30 mins ago
09:54eddayyyalso, i don't get any message that a server is running on port 9000
09:54pandeiroeddayyy: that line got removed recently i believe
09:54pandeirothe browser is open, of course?
09:54eddayyypandeiro: yep
09:55pandeiroi usually call the repl from inside my application code, after it has been compiled, is that how you're doing it?
09:55eddayyypandeiro: 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.
09:55eddayyy(from looking at the javascript console in chrome)
09:56pandeirook but what is the address that is loaded in the browser, out of curiosity?
09:57pandeirois it linking to JS you've already compiled?
09:57eddayyypandeiro: yeah the resources all load fine, the address is: 127.0.0.1:3000/welcome
09:57eddayyyon the VM I have port forwarding on host set to 3000 and guest to 8080 (where the noir webserver is running)
09:58eddayyyI also have port forwarding on host set to 3010 and guest 9000 for the repl
09:59eddayyyso it loads the clojurescript resources adequately without error, then posts to :3010 and gets back 200OK, with text/javascript
09:59pandeiroeddayyy: i'm a little bit out of my league with the internals of the REPL server, admittedly... but it is working for me...
10:00eddayyypandeiro: so no POST requests are stuck on pending?
10:01pandeiroeddayyy: nope, just checked and it's working fine
10:02pandeirothing 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:03pandeirosorry, i mean invoking the repl in emacs and then calling repl.connect() in a script on the page i am loading
10:05eddayyyhmm
10:11eddayyypandeiro: whats weird is that accessing 127.0.0.1:3010/repl directly looks like it works
10:16eddayyypandeiro: it seems to be POSTing to 127.0.0.1:3010 but not to 127.0.0.1:3010/repl
10:16eddayyyis that normal?
10:19pandeiroeddayyy: i am hesitant to say, since i forward any ports in my setup, but on mine it connects to localhost:9000, not /repl
10:19pandeiro*dont forward
10:19eddayyyokay, so thats expected
10:19pandeiroeddayyy: can you pastebin the cljs code that is calling clojure.browser.repl/connect ?
10:20eddayyysure
10:21eddayyypandeiro: http://pastebin.com/2Qzpk5EL
10:22pandeirolooks fine, yeah...
10:23eddayyypandeiro: what args can be passed to browser/repl-env ?
10:24pandeiroi don't think repl-env gets called directly
10:24pandeirohttp://sprunge.us/HVMd
10:27pandeiroor yeah, gets called but without any args
10:27pandeirosorry i couldn't help more, i admit i haven't really looked at the internals more than i needed to
10:42jcromartieI'm writing a library to give (var) names to unicode characters
10:43eddayyypandeiro: it seems that there is no option in the code to specify the bind inet address of the server
10:43AWizzArdOT 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:44eddayyypandeiro: its possible that by default it binds to localhost which would be wrong
10:46pandeiroeddayyy: interesting yeah i use localhost because i just copied it from the wiki documentation
10:48TimMcjcromartie: So I could do net.jcromartie.uni/COMBINING_SEAGULL_BELOW to get the char?
10:48jweisstechnomancy: 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:48jcromartieTimMc: that's it exactly
10:48jcromartieI'm just wondering: should I go with code generation, or just a macro?
10:49jcromartiethe macro is easy because it works at load time
10:49TimMcsame thing :-)
10:49jcromartiethere should be some kind of search util
10:49jcromartielike, to find character names
10:49jcromartieI don't know how you'd explore them
10:49TimMcBut why do you think this is at all a good idea?
10:51jcromartiewell I have a personal use for it :)
10:51jcromartiefor roguelikes :)
10:58TimMchaha
10:58TimMcSeems like overkill to me, though.
11:01jcromartieperhaps
11:01TimMchow about this...
11:02TimMcjcromartie: 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:03jcromartiethat would work
11:03TimMcYou just want a few names, not *all* of them.
11:05jcromartietypically, yes
11:07TimMcI would probably find such a macro useful for the times when I can't embed unicode directly.
11:08jcromartieyeah, that's true
11:08licensermorning
11:09TimMce.g. if we ever use Clojure here at work, where the code style policy is to only use ASCII in text files.
11:09TimMc(well, in source text files)
11:20kzar`lein deps` seems to be timing out for me
11:24jcromartieTimMc: I'm liking this
11:26ambrosebscan clojurescript macros be defined in a cljs file?
11:28dnolenambrosebs: ping
11:28ambrosebsdnolen: pong
11:29licenserambrosebs: I don't think they can, only via include macro
11:29dnolenambrosebs: I about :require/use-macros, seems like yet another case where CLJ needs to align with CLJS
11:29dnolenambrosebs: that is :require/use-macros should really be an alternative form of :require, :use
11:30ambrosebsdnolen: as in CLJ should be modified? or are you just talking about the analyzer?
11:31dnolenambrosebs: yes CLJ should be modified.
11:31dnolenambrosebs: any place where CLJ and CLJS can be aligned should be.
11:32licenserwhere can I gell cljsc to look for additional dependencies? like hey please also load this other files
11:33ambrosebsdnolen: I don't see why you'd need use-macros in CLJ?
11:34dnolenambrosebs: you don't, just like you don't need (.-property foo)
11:35ambrosebsdnolen: what is (.-property foo) ?
11:40dnolenambrosebs: you cannot different methods and fields in JavaScript, it's a proposal that removes the ambiguity
11:40dnolendifferentiate
11:41ambrosebsdnolen: you mean in ClojureScript?
11:41dnolenambrosebs: yes
11:41dnolenambrosebs: because of JavaScript
11:41ambrosebsright
11:42ambrosebsdnolen: so why would use-macros be useful in Clojure?
11:43dnolenspeaking 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:43dnolenambrosebs: it's not, just like (.-property foo) isn't, the point is to not have hack around the difference.
11:44ambrosebs:) I think I've confused myself. Should use-macros be removed in ClojureScript?
11:45ambrosebs*from
11:45dnolenambrosebs: no, :require/use-macros should just work in Clojure
11:45ambrosebsright :)
11:45ambrosebsthat seems reasonable
11:47choffsteinAnyone familiar with resque-clojure
11:48choffsteinAnd by familiar, I mean: have an example project that uses it that I can see?
11:49ambrosebsdnolen: AFAICT the analyzer doesn't define macros, which makes sense if CLJS files can't define macros
11:49ambrosebswhich is a problem if parsing clojure code
11:50ambrosebsI was thinking maybe `require` the clojure file before analyzing it?
11:50ambrosebsdnolen: any ideas?
11:51dnolenambrosebs: are you saying that the analyzer doesn't expand Clojure macros?
11:51ambrosebsdnolen: If the analyzer comes across a defmacro when parsing a file, it doesn't define a macro
11:53ambrosebsi think :)
11:53dnolenambrosebs: 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:54ambrosebsdnolen: ok
11:57dnolenambrosebs: 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:57dnolenambrosebs: definitely a case where macros as rewrite rules instead of fns simplify the issue.
11:58ambrosebsdnolen: do other Lisps work like that?
11:59dnolenambrosebs: I imagine Common Lisp poses the same challenge. Seems avoidable in Scheme if you just have syntax-rules. Not sure about syntax-case.
12:04ambrosebsworking with `symbol`, `namespace`, `resolve`, `intern`, `name` and the like is driving me nuts
12:05ambrosebscannot cast a sting to a symbol
12:05ambrosebsvice versa
12:06jcromartie_deskambrosebs: I think you might need some coercion functions
12:06jcromartie_deskor do you just mean the function signatures themselves
12:06ambrosebsjust nesting them, expecting them to compose well. rarely the case
12:07ambrosebs(on the first try)
12:07jcromartie_deskhm, yeah
12:07jcromartie_deskit would be nice if there was such a thing as a first-class namespace
12:07jcromartie_desklike, not just names
12:08jcromartie_deskwell there is
12:08jcromartie_deskbut nothing expects it
12:08ambrosebsright
12:08ambrosebs,(resolve *ns* '+)
12:08clojurebot#'clojure.core/+
12:08ambrosebsamazing
12:09ambrosebs,(resolve "clojure.core" '+)
12:09clojurebot#'clojure.core/+
12:09ambrosebs:)
12:09jcromartie_desk,(resolve nil '+)
12:09clojurebot#'clojure.core/+
12:09jcromartie_deskI guess resolve is just nice and friendly
12:10ambrosebsI find `symbol` the most annoying
12:10ambrosebs,(symbol 'clojure.core '+)
12:10clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String>
12:11hiredmanambrosebs: actually there was just a thread on clojure-dev about that
12:12hiredmanhttp://dev.clojure.org/jira/browse/CLJ-891
12:13ambrosebshiredman: cheers
12:25licenserI 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:25licenserany idea what causes poor cljs not to find the goog libraries?
12:29licenserwow this is storage, the answer is it happened because I called ./cljs/bin/cljsc cljs-src instead of ./bin/cljsc ../cljs-src
12:39dnolennotes on ClojureScript debugging evolving - http://dev.clojure.org/display/design/ClojureScript+Debugger
13:00gtrak`technomancy_, are you using some ec2 stuff for irc? :-)
13:00technomancy_gtrak`: I have my bouncer hosted on Heroku
13:01technomancy_still working out the quirks =)
13:01gtrak`ah, what's that do for you?
13:05technomancy_gtrak`: it just keeps logs for me even when I'm not connected
13:05technomancy_so when I reconnect it just catches me up
13:05RaynesIt does so much more.
13:05gtrak`ah, neat, I could imagine that being really useful
13:21jcromartiewhy should I write a macro that uses "def" when I can just intern a value?
13:23BorkdudeHow does one get the class object from a class, or interface, like for example IFn
13:23Borkdudein java: IFn.class
13:24Raynes&(type clojure.lang.IFn)
13:24lazybot⇒ java.lang.Class
13:25Borkdude(I tried using Classname/class but it didn't work)
13:25Borkdude,IFn/class
13:25clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: IFn, compiling:(NO_SOURCE_PATH:0)>
13:25Borkdude,clojure.lang.IFn/class
13:25clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: class in interface clojure.lang.IFn, compiling:(NO_SOURCE_PATH:0)>
13:26Borkdude,Object/class
13:26clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: class in class java.lang.Object, compiling:(NO_SOURCE_PATH:0)>
13:27RaynesBorkdude: Are you talking about an instance of java.lang.Class?
13:27jcromartie_deskBorkdude: the value of the class name expression is the class
13:27jcromartie_deskas Raynes illustrated
13:27BorkdudeRaynes: no, as in using it for reflection
13:27jcromartie_desk&(type Object)
13:27lazybot⇒ java.lang.Class
13:28Raynes&(.getCanonicalName clojure.lang.IFn)
13:28lazybot⇒ "clojure.lang.IFn"
13:28jcromartie_desk&(type (type 1))
13:28lazybot⇒ java.lang.Class
13:28Borkdude,(.getDeclaredMethods clojure.lang.IFn)
13:28clojurebot#<Method[] [Ljava.lang.reflect.Method;@452d4d>
13:28Borkdudeah right
13:28Borkdudetnx
13:28jcromartie_desk:) you think too much
13:28Raynes"That's too easy. Can't be right. Must ignore what they say for 10 minutes."
13:28Raynes;p
13:29Borkdudehaha ;)
13:29djKianooshto be fair it was only 5 minutes :)
13:29Borkdude:)
13:29jcromartie_deskyes, let's not exaggerate
13:33Borkdudeok, credits to #clojure : http://stackoverflow.com/questions/8435555/introspection-in-clojure/8435650#8435650 ;-)
13:34RaynesOh man.
13:34RaynesYou are awesome.
13:35RaynesYou 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:35Borkdudehaha :P
13:37BorkdudeRaynes: next time I ask something, just check the newest Clojure question on SO
13:37BorkdudeRaynes: so you can beat me to it
13:37RaynesWill do. :)
13:38Chousukewhat about clojure.reflect :P
13:41BorkdudeChousuke: what about answering on SO, would like to read about it
13:42Borkdudebut now I gtg
14:11ambrosebswhat is the naming scheme for vars in ClojureScript? is a slash used to separate ns from name, or a dot?
14:12cgrayslash
14:13ambrosebsIn Clojure, a dot is a class, a slash is var. What is a dot in ClojureScript?
14:14RaynesSmall and round.
14:14ambrosebs:D
14:15cgrayambrosebs: I'm curious: what do you mean that a dot is a class in clojure?
14:16winkwtf, SO blocks EC2 proxies o_O
14:16ambrosebscgray: (deftype MyType ...) will make a class at my-ns.MyType
14:16ambrosebsit will also make a constructor: my-ns/->MyType
14:16ambrosebsthat is my understanding at least
14:16hiredman(which is a bug, because '-' is not allowed in jvm type names)
14:17ambrosebs:)
14:17licenserambrosebs: do you roun cljs as part of a clojure project or stand alone?
14:17ambrosebslicenser: say again?
14:17licenserI mean do you use something like cljs-noir or call the cljsc yourself :)
14:18ambrosebsI'm taking a copy of the ClojureScript compiler and trying to convert it to analyze clojure code
14:18ambrosebswhile knowing nothing about CLJS
14:18licenseroi sneaky
14:19ambrosebsso far it's been very successful
14:19licensercool cool :)
14:19ohpauleezGiven a seq like [[:one 1] [:one 2] [:two 2]] - how do I get something like [[:one 1] [:two 2]]
14:19fbru02ambrosebs: wow !! want to see that ! :)
14:19ohpauleezI've been juggling `distinct` a bunch
14:20ambrosebsfor those wanting to follow along: http://dev.clojure.org/display/design/Make+the+ClojureScript+analyzer+independently+callable+a+la+carte
14:20ambrosebsand https://github.com/frenchy64/typed-clojure
14:20licenser,(find-fn [[:one 1] [:one 2] [:two 2]] [[:one 1] [:two 2]])
14:20ohpauleezbut nothing is panning out - right now I doing an exhausting filter using count
14:20clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: find-fn in this context, compiling:(NO_SOURCE_PATH:0)>
14:21licenser&(find-fn [[:one 1] [:one 2] [:two 2]] [[:one 1] [:two 2]])
14:21lazybotjava.lang.RuntimeException: Unable to resolve symbol: find-fn in this context
14:21licenser&(findfn [[:one 1] [:one 2] [:two 2]] [[:one 1] [:two 2]])
14:21lazybotjava.lang.RuntimeException: Unable to resolve symbol: findfn in this context
14:21licenserI suck o.o
14:21ohpauleezhaha, yeah, what happened to find-fn? that was a cool thing in the bot
14:22licenser&(find-fn [[:one 1] [:two 2]] [[:one 1] [:one 2] [:two 2]])
14:22lazybotjava.lang.RuntimeException: Unable to resolve symbol: find-fn in this context
14:22licenserthere that is how it should work
14:22licenser&(use 'find-fn.core)
14:22lazybotjava.io.FileNotFoundException: Could not locate find_fn/core__init.class or find_fn/core.clj on classpath:
14:22licenser&(use 'findfn.core)
14:22lazybotjava.io.FileNotFoundException: Could not locate findfn/core__init.class or findfn/core.clj on classpath:
14:23Raynes$findfn [[:one 1] [:one 2] [:two 2]] [[:one 1] [:two 2]]
14:23lazybot[]
14:23ohpauleezit's like I need a distinct-by
14:23ohpauleezthanks Raynes
14:23licenserambrosebs: very cool
14:24licenserRaynes: thanks :) that was too easy
14:25ohpauleezIt'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:28ohpauleezI suppose I can keep the filter call I currently have, just looks a little scary - thanks everyone
14:30Raynes&(group-by first [[:one 1] [:one 2] [:two 2]])
14:30lazybot⇒ {:one [[:one 1] [:one 2]], :two [[:two 2]]}
14:30licenserhas anyone ever ran a cljs project without something like noir and can help me? cljsc keeps failing to find the good libraries ;(
14:30licenserI always get - ERROR ... required "goog.dom.query" namespace never provided
14:31ohpauleezThat's a good start Raynes, I also pushing it to a map, and pulling the map back with vec
14:31terom p
14:34ohpauleezRaynes: I like (map #(first (val %1)) …) on that group-by, thanks. Reads better than the filter I have
14:34ohpauleezthanks a ton
14:35RaynesYou're welcome. Now send me gifts.
14:36ohpauleezRaynes: They're already in the mail… no worries
14:40licenserRaynes: you are collecting gifts now :)
14:45amalloyyou can't really use group-by there because you want to preserve order
14:46ohpauleezamalloy: Order of the small vectors doesn't matter to me
14:46ohpauleezjust that they are indeed uniq
14:46amalloyoh. then yeah, group-by is what i would do, i guess
14:46ohpauleezcool
14:46Raynesohpauleez: It's okay to use the solution now, amalloy has declared it viable. Load off of my mind.
14:47ohpauleezhaha :)
14:47amalloyjust to be clear, you mean you don't care if you get back [[:one 1] [:two 2]] or [[:two 2] [:one 1]]?
14:48ohpauleezcorrect
15:17aaelonyhey - 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:17aaelonyI'm just doing a use in my namespace currently...
15:18choffsteinIs 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:21aaelonyah - found it! project.clj needed [org.clojure/java.jdbc "0.1.1"]
15:21aaelonythanks
15:38licenserhmm how can I turn a json data into something clojurescript can eat?
15:40dnolenlicenser: I'm assuming you don't control the data? otherwise you can just use the builtin reader to consume Clojure forms.
15:40licenserdnolen: I do control the data but the code that controls it isn't written in clojure ;)
15:41licenserI know it works great when both sides are clojure but my server is written in erlang
15:42dnolenwriting 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:43dnolenlicenser: which also isn't that hard if you want to do the latter.
15:44licenserI hoped to be able to convert the json but I am not sure how to interact with JS objects
15:45licenserand google seems to be not helpful with that
15:48licenseroh js->clj
15:50dnolenlicenser: yes
15:50dnolenlicenser: you can also interact w/ them w/o the conversion with aget and/or property access.
15:51licenser:) sneaky sneaky
16:00_ulisesahoy
16:04tolstoyOooo, cyclic load dependency!
16:10tolstoyWhen 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:11hiredmanfor what purpose?
16:11amalloyyou...you have to do whatever you have to do
16:11tolstoyWell, hm.
16:12tolstoyI think you only have to protect vars you introduce within the syntax-quote itself. I guess that makes sense.
16:13tolstoySorry, just a hangover from half-remembered common lisp, under the pressure to get this thing done. Sorry to have bothered you!
16:33Raynestolstoy: Macros are just things you beat with a keyboard until they work.
16:34amalloy~'~' ftw, dude
16:34clojurebotCool story bro.
16:34tolstoyRaynes: Alas, that seems to be my method. It runs up the hours much more effectively that writing a small test program.
16:41reiddraperif any of you use clojure + riak, ping me. I'm working on a new client
16:44hiredmanwe 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:45reiddraperhiredman: https://github.com/reiddraper/knockbox
16:45reiddraperbrand new though
16:47hiredmanseems datatype heavy
16:47reiddraperhiredman: yes, perhaps "port" isn't the right word. it solves the same problem as statebox
16:47reiddraperi'm new to clojure, but deftype seemed like the right solution
16:48hiredmanI guess, but it makes the resolution strategy part of a type, instead of just a function you send into the state box
16:48hiredman#9
16:48hiredmanclojurebot: #9
16:48clojurebot9. It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures. -- Alan J. Perlis
16:49reiddraperhiredman: 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:50reiddraperand i want the datatypes to be able to be used like normal clojure sets, etc.
16:51hiredmanit seems like with what you have you need to wrap and unwrap the set in a resolution strategy
16:52hiredmanbefore 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:52hiredmanthe last is more or less what statebox does
16:53hiredman(from my understanding, we did riak stuff in clojure, so I've used statebox)
16:53hiredmaner
16:53hiredmanso I've never used statebox
16:55reiddraperhiredman: creating a set with (lww) returns a type that *does* work as a set
17:01cemerickThis is absolutely evil: ##(instance? String)
17:01lazybot⇒ false
17:01cemerick*way* too friggin clever in InvokeExpr. :-(
17:02hiredman,(instance? String)
17:02clojurebotfalse
17:02dnolen,(instance? clojure.lang.IPersistentVector)
17:02clojurebotfalse
17:02hiredmaninteresting, is that the inline stuff?
17:02cemerickNope.
17:02hiredman,(meta instance?)
17:02clojurebotnil
17:02hiredman,(meta #'instance?)
17:02clojurebot{: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:03cemerickCheck the Compiler.
17:03cemerickInvokeExpr.parse
17:04amalloyoh yeah, it has a special-case for instance?, doesn't it?
17:04cemerickyup
17:05amalloyand i guess it winds up being the same as (instance? String nil)
17:05TimMcwtf
17:05hiredmancute
17:05TimMc&(instance? String "hi" "hello" 4)
17:05lazybot⇒ true
17:05hiredmanshould be an inline+intrinsic
17:05cemerickI'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:06amalloyhiredman: what should i read to understand what intrinsics are?
17:06hiredmanamalloy: the compiler can inline certains methods as bytecode directly
17:06hiredmanIntrinsics.java
17:06hiredmana map of method names to the bytecode they can be inlined as
17:07hiredmancemerick: well, you could just stick the right inline keys in the metadata
17:07cemerickyeah
17:08cemerickWe'll roll the ML dice and see if this slips in as a quickie-fix.
17:08amalloyoh, 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:08daniel__3using korma, do i have to manually create all the database tables/fields?
17:08daniel__3i can only find methods to query the database in the docs, no way of actually creating an entity user with a password field
17:08hiredmanamalloy: if everything inlines right
17:09amalloyright
17:09amalloyand is typehinted/tagged appropriately
17:10amalloyhaha longCast(long) => NOP
17:15devinusis there a way to set JAVA_HOME for swank to see in .emacs?
17:18devinus(setenv "JAVA_HOME" "foo")
17:18devinusnice
17:19jcromartiemy command line tip of the day: cat some_file.csv | columns -ts , | less -S
17:20jcromartieCSV viewer
17:20amalloyseems kinda pointless to get cat involved
17:20jcromartiejust to illustrate that you can pipe to columns
17:21jcromartieas I usually do
17:21amalloycolumns -ts , < some_file.csv
17:21jcromartiesure
17:26TimMcamalloy: Presumably the cat command is here standing in for something that is generating CSV.
17:28amalloyi enjoy being the channel's misguided pedant, TimMc
17:30technomancysooooo... apparently blip.tv has stopped letting you download videos unless you have a facebook account?
17:30technomancytime to find a new video host
17:38TimMctechnomancy: Oh, yuck.
17:52devinusso, any good free online clojure books?
17:52devinussomething to sink my teeth into until i'm comfortable shelling out for a really good print book?
17:53amalloystylistically, 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:56accel+filetype:pdf
18:09SomelauwI 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:11cgraySomelauw: I think not being able to define functions is pretty hampering stylistically.
18:18tolstoydevinus: I don't know of any online Clojure books, outside of various blogs.
18:18devinustolstoy: that's unfortunate
18:19devinustrying to learn from clojure.org, even coming from a background in scheme and erlang, is a bit…daunting
18:20tolstoydevinus: Maybe this? http://thinkrelevance.com/blog/2008/09/16/pcl-clojure.html
18:25amalloycgray: that's why god gave you 'let
18:27cgrayamalloy: oh i realize, let and fn both help out in 4clojure, but they don't make things look very pretty :)
18:27amalloycgray: 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:29cgrayamalloy: M-x butterfly
20:01jodaroif 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:01jodaroi'd have a shitload of nickels
20:03chessguyhey 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:04ohpauleezchessguy: (declare ..)
20:04jodarodeclare
20:04chessguyah, that's it
20:04chessguythank you
20:04ohpauleeznp
20:04jodarome too np
20:04chessguyit was on the tip of my brain, but it's been a couple years since i fiddled with clojure
20:34amalloychessguy: also letfn
20:50alexbaranoskyanyone read The Art of Prolog?
20:52jacobsenHi 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:53alexbaranoskyjacobsen, `lein int` helps, by running leiningen with a persistent JVM
20:54jacobsenAh, yes indeed.
20:54jacobsenBut is there any (pre-packaged) way to connect to existing JVM process a la Cake?
20:55amalloy$google clojure jark
20:55lazybot[jark -] http://icylisper.in/jark/scripting.html
20:56amalloyi haven't used it, but it's an interesting idea
20:56leo2007why haven't I seen Richie speak in the mailing list?
20:56jacobsen@amalloy - thanks, that looks interesting
20:56alexbaranoskyleo2007, who's Richie?
21:00leo2007alexbaranosky: I mean rich hickey.
21:03alexbaranoskyleo2007, I wonder, don't know, sorry
21:30tmountaincan anyone advise on the best way to transform [ [ [:a :b] [:c :d] ] [ [:e :f ] ] ] to [[:a :b] [:c :d] [:e :f]] ?
21:30alexbaranosky(map flatten x)
21:31amalloy~flatten
21:31clojurebotflatten 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:31amalloy&(apply concat [ [ [:a :b] [:c :d] ] [ [:e :f ] ] ])
21:31lazybot⇒ ([:a :b] [:c :d] [:e :f])
21:31brehautno mapcat identity?
21:31alexbaranoskyit's three words that work
21:31alexbaranoskymapcat identity works too :)
21:32tmountainahh, thanks so much!
21:32brehautalexbaranosky: thats because mapcat identity _is_ apply concat done awkwardly ;)
21:32tmountainmind explosion was commencing
21:32amalloybrehaut: awkwardly? more like with style and grace
21:33tmountainso the apply concat is better than mapcat identity?
21:33brehautamalloy: haha ok :)
21:33alexbaranoskytmountain, 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:33amalloyyeah, mapcat identity is mostly a joke
21:34brehaut,(source mapcat)
21:34clojurebotSource not found
21:34brehautthanks clojurebot
21:34amalloy~source mapcat
21:34brehaut~botsnack
21:34clojurebotthanks; that was delicious. (nom nom nom)
21:36tmountainis there something less barbaric than (apply concat (apply concat grossly-nested)) when it's desired to remove two levels of nesting?
21:50alexbaranoskytmountain, 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:50tmountainthanks for the help guys
21:52tmountainone other question
21:52tmountainwhat's the easiest way to go from [:a :b :c] to {:a 1, :b 1, :c 1}
21:53ohpauleezzipmap [:a :b :c] (repeat 1))
21:54tmountainbeautiful, thanks
21:54ohpauleeztmountain: 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:57ohpauleez(defn down-it [v] (if (< (count v) 2) (recur (apply concat v)) v))
21:57ohpauleezoh, he's gone
22:24replore_made a sample noir website http://sharp-warrior-4964.herokuapp.com/sample
22:32y3dihas any of you guys used google's closure templating system?
23:07duck1123y3di: I do
23:14y3dihow is duck1123? is it MVC ish?
23:27semperosusing :gen-class, say I have a :main namespace defined in my project.clj of foo.core
23:27semperosI 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:28semperoshow can I set the mainClass element appropriately within the maven-assembly-plugin's config?
23:28semperosI'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:29semperostried 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:30kumarshantanusemperos: are you using maven shade plugin? or the assembly plugin?
23:30semperosassembly
23:31semperosso it's not an "uberjar" in Maven-speak, but rather a "jar-with-dependencies", but you can define mainClass as the entry point
23:31semperosdone 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:32kumarshantanuare you AOT-compiling the Clojure file? Are you using Clojure-Maven-plugin to do that?
23:33semperoshad the :aot flag set in project.clj, wasn't using hte clojure-maven-plugin, worth a try...
23:33kumarshantanuMaven doesn't have the Clojure-compile option by default; you will likely need a plugin to do that
23:36semperosthis is what I get for trying this at the *end* of my day :)
23:36clojurebot'Sea, mhuise.
23:41semperosfrom readme, clojure-maven-plugin depends on clojure 1.2
23:47duck1123y3di: very much so. The ammount of operations you can perform on the data are very limited, so you have pre-format the data
23:47kumarshantanusemperos: i am using clojure-maven-plugin with Clojure 1.3.0
23:47semperosk
23:48semperossome of the tasks still depend on 1.2, but not all
23:49duck1123semperos: really, I never had any (version-related) problems using maven with 1.3
23:49semperostried `mvn clojure:gendoc`, seemed to require the old contrib
23:49semperosjust as an example, not critical
23:50kumarshantanusemperos: all of the documentation tasks currently suck as of clojure-maven-plugin 1.3.8
23:50semperosgotcha
23:57devnis 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:57devn:gen-class?