#clojure logs

2012-05-26

00:00scottjemezeske: ro_st was his name. if you have the logs from yesterday
00:01emezeskescottj: I don't :(
00:01scottjemezeske: btw it looks like you were talking to him right before he mentioned that
00:01scottj,logs?
00:01emezeskescottj: Anyway, the way to do that is to have (for instance) three source dirs
00:01clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: logs? in this context, compiling:(NO_SOURCE_PATH:0)>
00:02xeqi~logs
00:02clojurebotlogs is http://clojure-log.n01se.net/
00:02emezeskescottj: "common", "mobile", "desktop"
00:02emezeskescottj: Put common stuff in common, and then the platform-specific namespaces in their respective dirs
00:02scottjand then the :build options in project.clj?
00:03emezeskescottj: Two :build options, one for "mobile" and one for "desktop"
00:03emezeskescottj: And then just make sure "common" gets on the classpath
00:03emezeskescottj: They way to do that differs for lein1/lein2, either :extra-classpath-dirs or :source-paths
00:08scottjemezeske: thanks, why do you think its not a good idea (if I'm understanding you correctly) to allow the user to specify which .cljs file to start the compile from like the cljsc tool?
00:08emezeskescottj: No, I don't think that's bad, I misunderstood because I thought we were talking about the same discussion from yesterday but we weren't
00:08scottjok
00:09emezeskeI don't necessarily think it's worth supporting that in lein-cljsbuild, though
00:09scottjso yeah what this guy wanted was to pass the main namespace kind of like some of the clojure build tools do
00:10emezeskeWhat's the overall goal? Just to trim a few bytes out of the resultant JS for the other platform?
00:11scottjidk, I think he had functionality like dealing with touch that he didn't want in the desktop version
00:11emezeskeSo, don't call that code?
00:13scottjyeah if you split it out into separate src dirs like you described, I think maybe that and the :source-paths was what he was missing
00:13emezeskeThat makes the most sense to me
00:37_KY_There are some special keywords that can be used in "let", but I can't find it in the docs
00:38_KY_Oh, it was "let" inside "for"
00:38_KY_Nevermind...
00:40scottj_KY_: there's also :when and :while and maybe others
02:14jhultenAnyone willing to look at a gist of a udp server using aleph? I have no idea how to test it yet, so I don't know if it works.
02:14jhultenhttps://gist.github.com/2792517
02:58alexyakushevI'm good too, thank you. Sorry, I passed out early yesterday.
02:58alexyakushevDo you have a moment?
03:00alexyakushevSorry, mistyped the private chat:)
04:31lypanovfinally after a very strong coffee and an early morning hack have third-party working.
04:38_KY_How can I change a list of numbers, so that -one is changed to X, and at the same time I want to count the number of -one's?
04:38_KY_How can I change a list of numbers, so that -1 is changed to X, and at the same time I want to count the number of -1's?
04:39_KY_I'm tempted to use a def variable to count it...
04:40lypanovwrite a recursive loop.
04:41_KY_lypanov: so there would be an extra argument?
04:42lypanovright.
04:42_KY_Thanks=)
04:42lypanovrest. and count.
04:42lypanovyw
04:43aperiodicwhy write a recursive loop? you can just do [(count (filter #(= -1 %) list)) (replace {-1 X} list)]
04:44aperiodic(where list is an argument of the function that snippet is implicitly in the body of)
04:45AimHereIf performance is an issue, that would likely be slower, since it takes 2 passes
04:45aperiodicsure, but that sounds premature to me.
04:46AimHereI think your core choice of algorithm isn't 'premature optimization'
04:46aperiodicif the list is small, it won't matter; if the list is large, then i'd write the reduce and compare
04:46aperiodici'll take n^2 if n is always less than 10!
04:47aperiodics/reduce/loop/
04:49AimHereIt'd be doable with reduce too
04:49aperiodicyeah, but reduce recurses, so if your motivation is performance, it'd be a poor choice
04:50lypanovhuh
04:50AimHereI think it's more iterative than recursive
04:50AimHereI don't see any stack growing
04:53aperiodicup until recently, it was implemented recursively (see: https://github.com/clojure/clojure/blob/87fa6c793592b7a3e99fcf9fb7cc08986889846a/src/clj/clojure/core.clj)
04:53aperiodicnow, it uses the new reducers; i'm not sure if those consume stack or not
04:54aperiodicsorry, here's a link to the actual definition: https://github.com/clojure/clojure/blob/87fa6c793592b7a3e99fcf9fb7cc08986889846a/src/clj/clojure/core.clj#L6012
04:56lypanovaperiodic: you shouldn't read code without knowing the turtles all the way down.
04:56lypanovhttp://clojure.org/special_forms#recur
04:57lypanovthe fact that recur is tail recursive is core clojure knowledge.
04:57lypanovthe fact that its efficient is the reason that clojure can function at all.
04:57aperiodicthere's no recur statement in the definition of reduce
04:58lypanovagain, you shouldn't read code without knowing the turtles all the way down.
04:59lypanovyou assume this but you don't read internal reduce definition.
05:00aperiodicthe two-argument form doesn't appear to use that
05:00lypanov:/
05:00aperiodicam i missing something obvious?
05:01philandstuffhello. is there a core function which will do (xxx 5 f n) => (f (f (f (f (f n))))) or something similar?
05:01lypanovaperiodic: the 2 arg form is calling the 3 arg form.
05:01aperiodicherp
05:01philandstuffi suppose I can do (apply comp (repeat 5 f)) but is there anything more idiomatic?
05:01Iceland_jackphilandstuff: repeatedly?
05:02AimHereWell there's one non-tail recursive call then
05:02Iceland_jackhm no nvm
05:02aperiodicyeah, i was full of crap, though
05:02Iceland_jackoh, ,(doc iterate)
05:02AimHerephilandstuff, maybe nth and iterate?
05:02aperiodici think iterate is what you want
05:02aperiodic,(doc iterate)
05:03clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
05:03lypanovaperiodic: thats lazy though.
05:03lypanovbut yes, if you need in lazy situation its cute.
05:03philandstuffi suppose. feels a bit odd to introduce a sequence when I only want a particular value, but it definitely works
05:04aperiodicwell, you have to do the intermediate steps anyways. nth will force evaluation, so you don't have to worry about laziness after that.
05:04lypanovaperiodic: btw i'm just having a bad morning so wanted to do my turtle rant.
05:04aperiodiclypanov: no worries, thanks for calling me on my bull
05:04philandstuff,(nth (iterate #(* 2 %) 1) 5)
05:04clojurebot32
05:05philandstuff,((apply comp (repeat 5 #(* 2 %))) 1)
05:05clojurebot32
05:05philandstuffyeah iterate reads better
05:05philandstuffthanks aperiodic
05:06aperiodichah, i was the third person to suggest it, but you're welcome
05:07lypanovaperiodic: naah, i'm full of bull too. my position comes from assuming hickey wouldn't do that not knowledge.
05:08lypanovaperiodic: better to read core.clj and know it well than get lost like i do in the turtles.
05:08lypanovon that note, gonna go back to reading about the new AMD architecture :P
05:09aperiodici should spend an afternoon reading through core.clj one of these days
05:10lypanovi need to get off my ass and make a .clj -> mobi convertor that doesn't blow
05:10lypanovnamely one that uses prop fonts but doesn't loose indent
05:11aperiodici can never stand proportional fonts for code. i usually just print that i'm studying out, but i don't have a kindle
05:11aperiodics/print/print code/
05:12dsantiagoweavejester, you around?
05:12weavejesterdsantiago: Yup
05:12dsantiagoweavejester: Hey, question about hiccup. It seems like there isn't really a way to hold a series of sibling nodes, is that correct?
05:13weavejesterdsantiago: A list
05:13weavejesterdsantiago: (html (list [:p "foo"] [:p "bar])) => "<p>foo</p><p>bar</p>"
05:13weavejesterdsantiago: Or any seq
05:14dsantiagoweavejester: Ah, OK. I wasn't aware of that part of the syntax. Didn't see it on the wiki.
05:15weavejesterdsantiago: It's under "Expanding seqs" but perhaps I need to reword it.
05:16dsantiagoweavejester: Ah, so it is. Didn't process it that way, since I saw the for example and thought that it was executing the code in the list.
05:16weavejesterdsantiago: Feel free to add a better example to the wiki page :)
05:20dsantiagoweavejester: Thanks.
05:52Borkdudeibdknox people are questioning why you already closed the poll: https://kodowa.wufoo.com/forms/light-table-oss/
05:53lypanov"On FREE accounts, forms will be deactivated once they have exceeded the maximum number of entries allowed for a given month."
05:53RaynesAnd I'm certain they'll conclude that he is, indeed, the devil.
05:54kab3wmwith the sorcery that is light table, I do believe he is the devil. ;)
05:56Borkdudelight table: become a code alchemist
05:57Borkdudelol, 100 entries a month?
06:00Borkdudefor a free account
06:55lypanovfinally!!!
06:58lypanovibdknox: possible noir-cljs bug: rm -rf resources/public/cljs is required after doing a clojurescript upgrade.
07:02AeroNotixTo me, Light Table looks like an emacs plugin. Is it actually an emacs plugin?
07:03lypanov?
07:04lypanovwhat do you base that on?
07:04lypanovif its magic it must be emacs? :)
07:04AeroNotixlypanov: "It's magic" on what do you base *that* on?
07:05lypanovAeroNotix: huh?
07:05lypanovman i remember why i never use irc.
07:05AeroNotixlol
07:06ivanno, it is not an Emacs plugin
07:07AeroNotixivan: that's all I wanted to know
07:07AeroNotixivan: looks pretty meh to me
07:08kilon_alioshey i am getting an error on Lion when I try to build clojure latest with ant
07:08kilon_alios[java] Exception in thread "main" java.lang.ClassNotFoundException: jsr166y.ForkJoinPool, compiling:(clojure/core/reducers.clj:56)
07:09ivandid you read readme.txt?
07:09kilon_aliosoh boy
07:09kilon_aliossorry i missed one
07:14kilon_aliossucess
07:15kilon_aliosthanks ivan for reminding me what i should have done in the first place
07:15kilon_aliosquestion, does it also setup pathos so i can call clojure from anywhere ?
07:15ivannp :)
07:15kilon_alios*paths
07:15ivanno
07:15ivanyou just get a jar
07:16ivanyou might be looking for leiningen
07:17kilon_aliosok leiningen was my next step anyway
07:17kilon_aliosthansk will look into that now
07:18kilon_alioshow I exit the REPL ?
07:19ivanctrl-c or ctrl-d
07:21the-kennyI want Light Table as an Emacs plugin :)
07:22kilon_aliosnice
07:22kilon_aliosok leiningen here i come
07:22the-kennyI'd suggest starting directly with leiningen 2
07:24kilon_aliosanother stupid question, will someone need to install clojure or anything else to run a clojure application ?
07:26kilon_aliosi am only asking since clojure apps are just java bytecode
07:26AimHereWell you should be able to package up your clojure app into a jar that could be run with just a java runtime
07:26kilon_aliosah ok, what i wanted to here
07:27kilon_aliosi would hate my users need to install dependencies , thanks AimHere
07:27kilon_aliosthe-kenny: how i get 2, i am following instructions here -> https://github.com/technomancy/leiningen
07:28borkdudeSome leiningen install instruction for (newbie dummy) Windows users: http://dl.dropbox.com/u/3914693/leiningen.org/public/install.html
07:28philandstuffaperiodic, Iceland_jack: thanks for your suggestion of iterate earlier. here's where I used it: http://rhebus.posterous.com/pitch-and-frequency
07:29Iceland_jackYou're welcome philandstuff, looks like cool stuff
07:29Iceland_jackOvertone is way interesting
07:30bordatouecan anyone tell me how to create an interface in clojure
07:32kilon_aliosbordatoue: anything for us macos users ?
07:32bordatouehello
07:33bordatoueis it possible to create an interface in clojure
07:34bordatoueca anyone see my messages
07:35bordatouecan anyone see my messages
07:36borkdudebordatoue yes we read you
07:37bordatouethanks
07:37bordatoueWell any ideas on intefaces with clojure
07:37borkdudebordatoue do you need to implement an interface?
07:38bordatouejust to define a interface
07:38p_lthere's proxy and gen-class stuff if you want to implement an interface... not sure if defining an interface makes much sense on the clojure side
07:39bordatouethanks, I will have a look at it
07:39borkdudebordatoue this is a very handy chart: https://github.com/cemerick/clojure-type-selection-flowchart/blob/master/choosingtypeforms.png
07:40bordatouethanks borkdude
07:41kilon_aliosok leiningen installed, is there a way to make it tell me where its installed ?
07:43borkdudekilon_alios the windows instructions I provided are almost the same for mac osx
07:43borkdudekilon_alios only different script and no http client installation
07:43borkdudekilon_alios look inside ~/.lein/self-installs
07:44borkdudewhat minimum requirements does leiningen/clojure assume, 1.5, 1.6?
07:44borkdudejava I mean
07:44kilon_aliosthank you
07:44kilon_aliosactually i was already sucessful installing it , that is why i ignored your link
07:45kilon_aliosyes it was very easy , too easy :D
07:45kilon_aliosah thanks for the path too
07:45kilon_aliosyou are my hero
07:46kilon_aliosyou all are
07:46kilon_aliosvery friendly community
07:46xeqiborkdude: clojure 1.4 supports 1.5, leiningen requires 1.6 (though most tasks should work in 1.5)
07:47borkdudexeqi ok added "assuming java runtime 1.6 or higher"
07:48kilon_aliosok all seem to work fine
07:48kilon_aliosthanks guy i am ready to rock with clojure now
07:49kilon_aliosnext phase emacs and slime
07:50kilon_alioswhat else do i need beside clojure and leiningen to make my life easier ?
07:51jonhmillions of dollars and a maid staff
07:51kilon_alioshaha
07:52vosovichparedit might be nice if you're spending a lot of time writing clojure
07:52bordatoueIs there any tutorial on installing clojure with acquamac
07:55kilon_aliosgo ask emacs :D
07:55kilon_aliosthey love aquamacs
07:55kilon_aliosvosovich: thanks googling it
07:56bordatouewhat do you guys use to program in clojure, is there any perticular IDE
07:56bordatouei thought aquamacs was good
07:57kilon_aliosbordatoue: well it is considered by some a somewhate limited implementation of emacs, gnu emacs seems to be the popular choice, and slime for clojure
07:57kilon_aliosemacs is not an ide is a text editor, a sophisticated one but still a text editor, but slime has a lot of ide functionality
07:58bordatoueis there any ide apart from emacs derivatives that would be good for clojure
07:58kilon_aliosbordatoue: if you are afraid of emacs steep learning curver there is also Eclipse plugin
07:58bordatouei use acquamac, on mac. Gnu emacs seems to give me problems with mac
07:58kilon_aliosjust google eclispe and clojure and you should get you some tutorials
07:59borkdudebordatoue eclipse
07:59vosovichI second eclipse with counterclockwise
07:59kilon_aliosbordatoue: no problem with my mac and LION , i got an imac of 2007
07:59vosovichit's pretty good
07:59bordatoueis eclipse counterclockwise good for clojure
07:59borkdudebordatoue yes
07:59kilon_alioslooks that way
08:00borkdudebordatoue also, there is a leiningen plugin
08:00borkdudebordatoue so it will download dependencies based on project.clj and put them on the classpath for your eclipse project
08:00bordatouewhat exctaly does leiningen plugin do , is it anlternative to the make
08:00vosovichit integrates lein in eclipse
08:00bordatouelike maven
08:01bordatoueis it similar to maven
08:01borkdudebordatoue like maven, but easier
08:01bordatouecool
08:01borkdudebordatoue it uses maven under the hood
08:01kilon_aliosi assume cw and lien like each other
08:02bordatoueAnd onemore thing , what tool do you use to view the documentation
08:02borkdudebordatoue &&(doc +)
08:02bordatoueis there anything similar to javadoc with winstyle
08:02borkdude,(doc +)
08:02clojurebot"([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'"
08:03borkdudebordatoue or clojuredocs.org
08:03bordatoueis there any winhelp style doc for clojure
08:03kilon_alioshmm nice i assume also that it will be possible to customise Eclipse with clojure
08:05bordatouewhen running emacs on Lion (pressing alt+x) is not entering meta mode
08:05kilon_aliosthats strange
08:05kilon_aliosit works for me
08:05bordatouewhere as on acquamac it works
08:05bordatouethats the problem i have with gnu emacs, as with all linux based utility something needs fixing
08:05kilon_aliosyou got american keyboard ?
08:06bordatoueno UK keyboard
08:06kilon_aliosmaybe its the keyboard
08:06bordatoueGNU Emacs 22.1.1
08:06bordatoueCopyright (C) 2007 Free Software Foundation, Inc.
08:06bordatoueGNU Emacs comes with ABSOLUTELY NO WARRANTY.
08:06bordatoueYou may redistribute copies of Emacs
08:06bordatoueunder the terms of the GNU General Public License.
08:06bordatoueFor more information about these matters, see the file named COPYING.
08:06bordatouethats the version I am running
08:06kilon_aliosthats old
08:06kilon_aliosmine is emacs 24
08:07bordatoueold, i got it from mac port
08:07kilon_aliosand i have not bothered to get the newest version for some time
08:07kilon_alioseeewww macports
08:07kilon_aliosno need
08:08kilon_aliosbordatoue: http://emacsformacosx.com/
08:08bordatouethanks, I will try that
08:08bordatoueacquamac seems to be alrite
08:09bordatouewhat did you say the problem with acquamac was
08:09bordatouei have seen people using acquamac with inferiorlisp when working with clojure
08:10bordatouethanks for the link
08:10kilon_aliosbordatoue: and this is my emacs setup folder containing all sort of useful tools that will make life a lot easier with emacs ---> http://www.mediafire.com/?6b3i3bu13mh2zpw
08:11kilon_aliosbordatoue: i am not so sure, I dont think its a full emacs implementation and not supported by emacs community as well, so i went gnu emacs and call it a day
08:11borkdudeI'm using normal emacs as well
08:11bordatouethanks very much , i shall start playing with emacs
08:12borkdudebordatoue about alt+x, are you sure, you didn't press cmd-x? I made that mistake a couple of times
08:12bordatoueofcourse
08:12bordatouei will try with this version
08:12kilon_aliosbordatoue: it has the added advantage that once you go gnu, you can visit #emacs and ask them for fixs to your problems
08:12bordatoueyeah, i don't know why all gnu application requires fixing before using it
08:13kilon_aliosto be fair, i had zero issues with emacs
08:13bordatoueluckly with mac there is no problem , i can't imagine doing a majore project on linux system
08:13kilon_alioseven making it type in greek after some directions from #emacs has been a breeze
08:13kilon_aliosnot that I type greek a lot in emacs even though I am greek
08:14borkdudekilon_alios have you tried a right to left language?
08:14kilon_aliosbut generally macports are not the best place to get stable builds
08:14bordatouearabic
08:14kilon_aliosno
08:14kilon_aliosnot really
08:14kilon_aliosi am working 99.9% in english
08:14kilon_aliosbecause i do only coding and some chating in irc
08:15kilon_aliosif my code is commented in english, i rarely use greek :D
08:15kilon_alios*even my code...
08:15borkdudekilon_alios hmm, I guess for variable names greek symbols could be nice
08:16kilon_aliosi guess so
08:16kilon_aliosthe problem with eclispe is that it can get very slow
08:16borkdude,(let [add (fn [α β] (+ α β))] (add 1 2)
08:16kilon_aliostrying to setup now cw and its slow as hell dont know why
08:17clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
08:17kilon_aliosi would not use a greek letter for a variable to tell you the truth
08:17kilon_aliosthe only greek i use is names for my projects
08:17vosovichI would, as a physicist
08:17kilon_alioslike my latest one, a GUI and visual programming language called Ephestos
08:17vosovichit beats awkward naming at times
08:18kilon_alioshttps://github.com/kilon/Ephestos
08:18borkdude, ,(let [add (fn [α β] (+ α β))] (add 1 2))
08:18clojurebot3
08:18borkdudeit works! :){
08:18kilon_alioswhich hopefully will port to clojurescript and maybe clojure as well
08:19borkdudemaybe we can make an alias for fn, called λ ?
08:19vosovichborkdude, try starter-kit-lisp
08:19vosovichit has that alias and some more
08:20borkdudemy iterm2 can't handle these greek cars
08:20borkdudeif I start an nrepl
08:20borkdudecan emacs connect to it, how?
08:22bordatoueversion 23.4 downloaded from the link you gave is working
08:32borkdudeshould this work? https://gist.github.com/2793775
08:33borkdudeprovided there is an nrepl running on that port
08:36borkdudeit works… a little
08:49borkdudewell, it works with inferior-lisp.. although at the inferior-lisp buffer it prints weird characters when I send input
08:50borkdude[17G[8G[18G
08:50borkdudewhat about this?
08:54kilon_aliosborkdude: inferior lisp is not slime, you better use slime for clojure
08:54borkdudekilon_alios slime doesn't support nrepl
08:55kilon_alioswhat is nrepl ?
08:56kilon_aliosah ok found it
09:01borkdudeI guess this is basically enough: https://gist.github.com/2793775
09:02kilon_aliosslime uses the repls of implementations
09:04kilon_aliosit should be realitive easy to customise to call another repl
09:04kilon_aliosor maybe not :D
09:04borkdudekilon_alios nrepl is a different protocol than slime
09:09kilon_aliosoh boy
09:55otfromanyone from EuroClojure out there?
10:36kilon_aliosis JDK included with macos ?
10:36kilon_aliosI have Xcode installed
11:15zaisteI cannot get my head around middlewares in Ring, why does show-params print info as if it was the last function being invoked ?
11:16zaisteaccording to -> macro definition it should be invoked as a first one
11:16zaistecode is here: https://gist.github.com/2794258
11:20tmciverzaiste: the way I understand it all middleware are given a handler which is a function of the Ring request. At some point they call this handler on the request as well as doing additional work. In the case of 'show-params' it's printing the request using println.
11:21tmciverzaiste: Also, all middleware return a function of the request object so that they may be passed as handlers to other middleware.
11:22tmciverzaiste: I admit it is a little difficult to get your head around at first.
11:22zaistetmciver: yes, but show-params is supposed to be executed as first one, other middleware should add info "later"...
11:24zaistenot sure if I put it clearly ;)
11:24tmciverzaiste: because of the way the threading macro (->) works show-params is actually called *last* because it is being nested inside all the middleware that comes after it.
11:25tmciverzaiste: but it actually shouldn't matter in what order it is - in this case it's only printing data, it's not doing and data manipulation required by other middleware or your handler function.
11:25zaisteok, it's called last, but it already carries info from other middleware
11:25zaistes
11:25zaistemiddlewares&
11:26tmciverzaiste: Yes, I believe so. You should be able to see the effects of the other middleware - namely in their manipulation of the request data - in the output printed by show-params.
11:28borkdudeare there any recent audio podcasts/lectures I should listen to while vacuum cleaning (about clojure)?
11:28borkdude(have listend to all Mostly Lazy ones
11:28borkdude)
11:40beffbernardborkdude: Have you listened to the ThinkRelevance: The Postcast episodes?
11:41borkdudebeffbernard any one in particular you recommend?
11:41beffbernardNot off the top of my head but they are all well done
11:41tmciverzaiste: I take back what I said about the order not mattering in this case. Since show-params is printing the request, what it shows will depend on what middlware has run already. But since show-params is only printing data, it won't affect your handling of the request.
11:42zaistetmciver: thanks, I think I got it, req is updated from "bottom-up" with -> macro
11:43zaistetmciver: I corrected Ring wiki, http://bit.ly/LqPW9f
11:44zaistetmciver: wrap-params is last, it's invoced as first, update req before "recursion"
11:52tmciverzaiste: keep in mind that show-params is called last here not actually because of ->, it's really because Ring middlewares are returning functions to be called by the next wrapping middleware. In 'normal' cases, -> does execute from top to bottom.
11:53zaistetmciver: thank you !
12:03alexyakushevHave anyone seen Chas Emerick lately?
12:05gfredericks$seen cemerick
12:05lazybotcemerick was last seen quitting 5 hours and 34 minutes ago.
12:08alexyakushevThanks
12:43otfromalexyakushev: cemerick is in London atm and mostly afk. He was at EuroClojure yesterday
12:43alexyakushevotfrom: Thank you for this information!
12:43otfromnp
13:46lynaghkping: technomancy
15:13xeqiI get 'cljs.core.logic.Set is undefined' when trying to use cljs, core.logic, and :optimizations :simple
15:13xeqianyone else used core.logic w/ cljs?
15:16dnolenxeqi: sorry been busy with stuff, there's a core.logic branch called cljs-head
15:17dnolenxeqi: there's one outstanding bug I need to track before I can merge to mater and cut another release.
15:17dnolenmater -> master
15:17xeqidnolen: ah, thanks
15:17borkdudemater = the mother release
15:18borkdudebranch
15:19lynaghkdnolen: I ran into an interesting behavior with cljs yesterday, wonder if it's a bug or a design decision---JavaScript "class" instances don't implement IHash, so things blow up when you try to put them in sets
15:19dnolenlynaghk: probably a bug, there's a default hash method that should be called I believe.
15:19dnolenlynaghk: feel free to open a ticket
15:20lynaghkdnolen: yeah, I'm looking at core.cljs now, looks like you guys extend-type most of the natives to work properly
15:20lynaghkdnolen: cool. I'll get a ticket+patch in sometime in the next few days.
15:24dnolenlynaghk: fixing it now, extend-type default will call goog.getUid
15:24KIMAvcrphey #clojure
15:24lynaghkdnolen: awesome, thanks!
15:25KIMAvcrpI try to use org-babel with clojure using this setup http://nakkaya.com/2010/12/12/using-clojure-with-org-babel-and-inferior-lisp/
15:25dnolenlynaghk: in master now
15:25KIMAvcrpbut I get the following error when i try to evaluate clojure code: function definition is void (lisp-eval-string)
15:25lynaghkdnolen: xoxoxoxo
15:26KIMAvcrpdoes anyone know where the function is defined wich file I an missing to require ?
15:33uvtcWhen using Emacs 24 with the newest clojure-mode from Marmalade, what's the difference between M-x run-lisp and M-x inferior-lisp?
15:34uvtcThey both seem to work...
15:47borkdudeuvtc C-h f <run-lisp or inferior-lisp> both seem to print the same text
15:47borkdude-both
15:48uvtcborkdude, Doh. Should've tried that first! Thanks, borkdude. :)
15:57acaglejoin #leiningen
15:58mittchelWhat's the difference between if and when? And when should you use when instead of if
15:59uvtcmittchel, `when` has an implicit `do`.
15:59mittchelahhh
15:59mittchelAnd do is needed for side effects right?
16:00borkdudealso when doesn't take an "else" expression
16:00uvtcmittchel, no, `do` is not needed for side-effects.
16:00uvtc,(if true (println "side-effect!"))
16:00clojurebotside-effect!
16:01mittchelHm
16:02mittchelborkdude: In the documentation of our course the following is described: Do is often used to present side-effects. So when you use when, you don't need to surround it with a do?
16:02VinzentSome say, `if` should be used even if there is no else clause, and `when` should be used only when there is some side effects; on the other hand, static code analysis tools (like, for example, kibit (https://github.com/jonase/kibit)) report the `(if condition something nil)` as incorrect. Thus, it's a hard question.
16:03borkdudemittchel: do evaluates possibly more than one expression, but only the result of the last expression is "returned"
16:03borkdude,(do 1 2 3)
16:03clojurebot3
16:03borkdudemittchel but side effects of the other expressions do occur:
16:03borkdude,(do (println "foo") 4)
16:03clojurebotfoo
16:03clojurebot4
16:04mittchelAlright, thanks borkdude. I'm going to study more:P Probably report back in a few mins haha
16:04VinzentBut it doesn't make any sense to put non-side-effecty expressions in the middle of the `do` block.
16:04borkdudeVinzent that's right
16:04VinzentSo side effects is exactly the thing `do` is used for.
16:07borkdudeVinzent it's a matter of style, when is just a macro which expands into if
16:08borkdude,(macroexpand '(when true :foo))
16:08clojurebot(if true (do :foo))
16:08Vinzentborkdude, yeah, I know.
16:08uvtcThings with "do" in the name tend to be side-effecty. doseq dotimes
16:10Vinzentuvtc, exactly! And `when` doesn't have any do, but considered side-effecty (by some people (author of kibit)). I think I should file a ticket.
16:11borkdudeVinzent when has an implicit do?
16:12borkdude,(when true (println "dude") 3)
16:12clojurebotdude
16:12clojurebot3
16:12TimMc(if test consequent alternative)
16:12TimMc(when test body...)
16:12borkdudeI think the if/when discussion isn't really important though
16:12Vinzentborkdude, yes, but the key word here is "implicit".
16:13VinzentSure.
16:13TimMcI often use "when" when I want to return nil if the test fails.
16:15borkdudeor if-let
16:16borkdudeah there's also when-let
16:17borkdudeall these shortcurts ;)
16:17arohnerIMO, strongly prefer 'when', when there is no 'else'
16:18arohner(if test true-expr) shouldn't exist
16:18mittchelSince do only returns the last value.. for what practical use does this come in handy?
16:18TimMcmittchel: Side effects.
16:18arohner(do (side-effect1) (side-effect2) return-value)
16:19mittchelYep, I understand it's useful for side-effects.. but an practical example when this comes in handy? :P
16:19hyPiRionRun up threads.
16:20hyPiRion(do (.start thread) 0) or something.
16:20borkdudemittchel or just printing things
16:21borkdudemittchel or doing things with atoms, databases, or other mutable things
16:21arohner(if test (do (println "it was true") true-result) false-expr)
16:22mittchelhmm sounds clear to me now ;) thanks!
16:23hyPiRionIf you're still in doubt, check out the implementation of memoize. It computes the value of an expression and saves it into a local, does a swap! on an atom, and then return the local afterwards.
16:29TimMcmittchel: I mostly use 'do' when debugging.
16:29VinzentThis actually signalize that clojure has poor tool support.
16:30TimMcAlthough... the (doto ... (println)) approach is pretty sweet if that's what you want/
16:30mittchelTimMc: debugging? To print values for example?
16:30TimMcmittchel: Yep.
16:30TimMcI haven't gotten Swank set up yet.
17:02coventryIn http://pastebin.com/EZWCg3Tk, I modified the example at clojure.org/agents to try to log order in which the agents are called, but it is deadlocking. I don't have much experience with concurrent programming, and can't figure out why. Is it clear to anyone else?
17:29ghengishmm, there doesn't seem to be an is-array? function
17:29coventryDo you mean "vector?"?
17:29ghengisno java array
17:30coventrySlightly cleaned up version of the code in my question: http://pastebin.com/Ba3bEhGe
17:31coventryghengis: What are you trying to do with the test?
17:31ghengischeck if an argument is an array before trying to convert it to one
17:34coventryWhy not just try to do the conversion, and handle the exception if it's not?
17:35amalloy&(map (fn [x] (.isArray (class x))) [1 '[a vector] (into-array '(an actual array))])?
17:35lazybot⇒ (false false true)
17:36amalloythough i have to say, an API that accepts "either an array or not an array" is probably wrong
17:36ghengiscool, thanks!
17:37ghengiswell, i agree, but i'm implementing heap-sort as an array, but i want to take seq's
17:38ghengisbut then i might as well allow arrays
17:39amalloyso...why are you implementing a sort algorithm?
17:39ghengisstudying for job interviews :)
17:40coventryOh, I figured out the answer to my question: send expects the function it calls to return a persistent data structure, which it then assigns to the agent. I was returning another agent.
17:40amalloymmm. well if it's sorta "for fun", it seems silly to work with arrays. the exact same algorithm will apply to vectors
17:41ghengisyeah, i might test the performance difference of vecs vs arrays once i'm done with this
17:51goodieboynested destructuring... i have a map like {:params {:id 1}} -- how can i destructure so that id is bound to "id" ?
17:52Vinzent{{:keys [id]} :params} or something like that
17:52goodieboyVinzent: awesome thanks!
17:55coventryWhat's clojure's equivalent to let*?
17:56Vinzentcoventry, let
17:56ghengisit already behaves like let*
17:58coventryCool. How do I get this example to work? "(let [[x y][2 (* x x)]] y)" It gives me "Unable to resolve symbol: x in this context"
17:59Vinzentcoventry, (let [x 2 y (* x x)] ...)
18:00coventryGreat, thanks.
18:01Vinzentcoventry, by the way, [x y] syntax is used for destructing: ##(let [[x y] [1 2 3 4]] [x y]) It's used a lot in idiomatic clojure code
18:01lazybot⇒ [1 2]
18:02coventryThanks, that clears up my confusion
18:05dsantiagoweavejester: Hickory now has zippers for hiccup forms.
18:07weavejesterdsantiago: Ah, okay
18:07weavejesterdsantiago: I might be tempted to use the xml zippers in data.zip though
18:08weavejesterdsantiago: If a Hiccup data structure were first converted into a clojure.xml dom, then clojure.data.zip.xml could be used to transverse it.
18:08dsantiagoweavejester: Oh yes. Well, hickory now also parses HTML into a simliar format to clojure.xml, and provides zippers for that too.
18:09dsantiagoHickory drops fewer document parts than clojure.xml.
18:09weavejesterdsantiago: I was just about to mention that :)
18:10weavejesterdsantiago: There is a fair bit of loss when converting to clojure.xml...
18:10dsantiagoYeah. Hickory should be round-trippable.
18:10dsantiagoBut doesn't do XML (yet?)
18:10weavejesterdsantiago: Yes… I can see that being useful.
18:11weavejesterdsantiago: I was planning on writing a small HTML parsing library based off of JSoup that would create a clojure.xml DOM from a HTML file.
18:12dsantiagoweavejester: Hm, yeah, sounds like we had similar thoughts.
18:12dsantiagoMaybe I should add a function to strip out comments and doctypes, so it will really match up with clojure.xml.
18:12weavejesterdsantiago: I guess my needs are a little different to Hickory, so I'm looking at it in slightly the wrong way. I can see how not losing data such as comments and doctypes would be useful.
18:12dsantiagoNot sure why that'd be useful.
18:13weavejesterdsantiago: It sounds like a separate library… Hickory seems useful on its own without trying to work on two formats, Hiccup and clojure.xml.
18:13weavejesterBut then I've always been a fan of small libraries that do one thing :)
18:15Raynesdsantiago: How are things?
18:16dsantiagoWell, sure. There's some management overhead for me removed by just having them both in the same library. And I am going to make the two formats convert into each other as well, which will suit my needs.
18:16dsantiagoAt 200 lines, it's hardly piggish.
18:16dsantiagoHey Raynes.
18:16dsantiagoWhen you moving out here?
18:17Raynesdsantiago: I don't know yet.
18:18dsantiagoAh well.
18:19coventryGoing back to the question I started with, why would (send target-agent f) cause clojure to hang if f returns an agent?
18:20coventry(Or maybe, why could it, since it might be something to do with the structure of the agents in this example.
18:29hiredman,(doc send)
18:29clojurebot"([a f & args]); Dispatch an action to an agent. Returns the agent immediately. Subsequently, in a thread from a thread pool, the state of the agent will be set to the value of: (apply action-fn state-of-agent args)"
18:29hiredmanwhat a crappy doc string
18:29hiredman,(doc agent)
18:29clojurebot"([state & options]); Creates and returns an agent with an initial value of state and zero or more options (in any order): :meta metadata-map :validator validate-fn :error-handler handler-fn :error-mode mode-keyword If metadata-map is supplied, it will be come the metadata on the agent. validate-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on...
18:31coventryHmm, I read those before, but they didn't clarify the question for me. Could you explain a bit more?
18:34gfrederickscoventry: I don't know why send would ever hang, so I don't think the answer is obvious
18:34gfredericksunless I have a major gap in my agent-knowledge
18:38coventryIt's understandable that clojure wouldn't be as idiot-proof as python (which is the level of error reporting I'm used to. :-)
18:44amalloygfredericks: send itself doesn't hang, but there are some ways you can trick yourself into doing it
18:45amalloyeg: (send agent-1 (fn [a1] (await (doto agent-2 (send identity)))))
18:48`rand`Is there a Clojure library that performs multivariate polynomial arithmetic?
19:11arohneramalloy: I thought await'ing in an agent action threw? How would that hang?
19:13amalloyarohner: does it? perhaps i oversimplified; i do know that if you try to use seque from within an agent action it hangs
19:13amalloyi suppose that's because seque doesn't actually use await, it manually blocks on a LinkedBlockingQueue that an agent is responsible for filling
19:14fil512http://pastebin.com/qNaVAYVT
19:14fil512line 14 is the (def results line
19:14fil512why can't it compile my (def results) line?
19:15arohner,(-> (agent nil) (send (fn [a] (await a))) (agent-errors)
19:15clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
19:16fil512Any idea why it would tell me "key must be integer" when all I'm doing is defining a var to the return value of a function?
19:16amalloy&(-> (agent nil) (doto (send await)) (agent-errors))
19:16lazybotjava.lang.SecurityException: You tripped the alarm! send is bad!
19:16amalloy,(-> (agent nil) (doto (send await)) (agent-errors))
19:16clojurebotnil
19:16arohneranyways, something similar to that throws for me locally
19:16arohner" Can't await in agent action"
19:16amalloyarohner: i believe you
19:18fil512When I call (def results (get-results "../monitor/monitor_log.txt")) it gives me a compile error, saying "Key must be integer".
19:18hiredman,(assoc [] :a 1)
19:18clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>
19:19fil512hmmmm
19:19fil512http://pastebin.com/qNaVAYVT
19:19fil512is there something in my definition of get-records that is trippy?
19:20fil512do I need to use (vector instead of [host ...?
19:23emezeskefil512: No, the vector literal there is fine.
19:23emezeske&(into {} (for [x (range 0 10)] [x (inc x)]))
19:23lazybot⇒ {0 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10}
19:32gfredericksemezeske: ##(= (range 0 10) (range 10))
19:32lazybot⇒ true
19:33emezeskegfredericks: thanks!
20:07zuzuncinkclojurebot: whats up? i feel so lonely.
20:07clojurebotI don't understand.
20:07zuzuncinki said i am alone.
20:08zuzuncinkclojurebot: ok you should talk to fsbot
20:08clojurebotbookshelf is http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH
20:31devneuroclojure was winning.
20:33gfredericksdevn: What? I thought you lived in Michisottagan or something
20:33devni live in Wisconsin
20:34devnI still went to London, though
20:34gfrederickss/Michisottagan/Michisottasconsin/
20:46zuzuncinki have no emacs background and i am trying to use emacs23 from ubuntu 10.04 repositories.there are some .el files in emacs-goodies.el which i want to use.should i prefer installing with the package manager all of the .el files which come with emacs-goodies or install only the specific file manually which i am interested in?
20:47zuzuncinkwill installing emacs-goodies make emacs slower?
20:49zuzuncinkups wrong channel :)
20:55emezeskednolen: ping
21:08devngfredericks: heh
21:08devngfredericks: it was a long trip, but worth it. beautiful venue. great list of speakers that ive never seen speak before. lots of people ive known on irc whom i've never met, etc.
21:10zakwilsonIt just came to mind that there's something I want to build on top of Lighttable.
21:12gfrederickszakwilson: fortunately there are many things that go on top of tables, so you have a long list of punny names
21:13amalloyLight SaltShaker
21:13zakwilsonHeh.
21:15zakwilsonWhat came to mind is a web-based SASS editor to let clients with designers or design skills of their own tweak their CSS without having to have a bunch of SASS tooling in projects that use SASS.
21:15devni can sum up most of the eurclojure conference
21:15devnhere it is: https://img.skitch.com/20120527-b35cuu2n8bs8x12kmpxep682bw.png
21:15devnnote that his hands act like parens
21:16devnalso this: https://img.skitch.com/20120518-2dgmtb5gmy74a7wxcn7f14kfx.png
21:16fil512question for you
21:16fil512what rules of thumb should I use to order function parameters?
21:17frozenlockHello fellas! Could someone please tell me how I should write an octet string to a file? I tried (spit "myfilename.txt" (.getBytes ...)). It writes a "myfilename.txt" file alright, but the content is the same output as on the repl: [B@2b27acc3
21:17fil512e.g. if a function transforms a collection using args, does the collection go first or the args?
21:17zakwilsonI'd put the collection first, because I use -> more than ->>
21:18fil512does clojure have a convention in general?
21:18gfrederickscollection functions in clojure.core often put the collection last
21:18gfredericksI normally have to use ->> with collections but -> with other things
21:18fil512thanks. sounds like collection last is best practice
21:19zakwilsonI think that's an artifact of the classic list operations having been that way forever.
21:19zakwilsonAlso, if there might be a variable number of args, collection first makes a lot of sense.
21:20gfredericksfrozenlock: you called .getBytes because you have a String?
21:21frozenlockgfredericks: it's a method from the java class I'm using (OctetString)
21:21gfrederickszakwilson: a lot of those functions take functions as arguments, so it's easy to think of the first arg (e.g. to map, filter, reduce, etc) as making more precise the behavior of the function
21:21gfredericksso it goes very well with partial
21:22fil512so collection last works better with partial?
21:22gfredericksfrozenlock: spit might not be usable for you then. I'm sure you can cook something up with what's in clojure.java.io
21:22zakwilsonYeah, that's a reason for that too, and map takes multiple collection args.
21:22gfredericksprobably outputstreams can be written with byte-arrays?
21:23gfredericksfil512: maybe it more has to do with HOFs than collection functions
21:23zakwilsonThe thing is, when you're using a function on a collection, you can just wrap up any extra args you need with partial or by making a new function on the spot.
21:23fil512cool. just want to double-check all this is pointing to collections last being a good thing right?
21:23gfredericksrecently I've wished multiple times that there were a but-first-partial
21:24zakwilsonIf your function doesn't take a function as an argument, I'd put the collection first, assuming there's only going to be one collection.
21:24fil512Just turn around if you want to go "butt first" :-)
21:24gfredericksmy son hasn't yet figured out that that's how you get off of things
21:24fil512lol
21:25gfrederickswell feet first I guess. at least not head first
21:27zakwilsongfredericks: I think you're not the first person to wish for that. This is an alternate solution: http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/
21:27rhdoengeswhat's the right lib to use for making http requests? or do I just need java.net.URLConnection?
21:27zakwilson(it's in useful.fn)
21:28zakwilsonrhdoenges: clj-http
21:29gfrederickszakwilson: not sure how thrush helps. It seems more of a use case for butfirst-partial than an alternative
21:29rhdoengeszakwilson: thanks.
21:29amalloythe recommendation for argument order is to put the "main" argument last if it's a sequence, but first if it's something else (eg a map)
21:30amalloythat makes it all work out better for update-in/swap!/etc chains
21:31gfredericksamalloy: how does the coll-last part make things work out better? (besides compatibility with core functions that are already that way)
21:31zakwilsongfredericks: I suppose it solves a slighly different problem. Forget I said that, but know it exists because it's useful anyway.
21:31amalloythat's not a good enough reason?
21:32amalloybut also gfredericks, it leaves you room to add additional sequences as varargs, like map and interleave
21:32gfredericksamalloy: well I'm curious if there's a good reason for the core functions being that way as well
21:32gfredericksthat's an interesting reason
21:32amalloywell, i just made it up
21:32gfredericksI didn't say it was _right_
21:33gfredericksyou don't have to take everything amalloy says so seriously
21:33hyPiRionIsn't a but-first-partial just (defn but-first-partial [f & args] (fn [n] (apply f n args))) ?
21:33zakwilsongfredericks: what you want is something that acts like (defn butfirst-partial [f & args] (fn [x] (apply f x args))), isn't it?
21:34gfrederickshyPiRion: yep. I don't mean I wish I could possibly have one. Just I wish it were around already, since I have a lot of cases where I'd like it but not badly enough to write/import it
21:34gfrederickszakwilson: you betcha
21:34hyPiRiongfredericks: Ah, I see.
21:34amalloywhy write but-first-partial instead of generalizing it to rpartial?
21:34zuzuncinkis there any way to see the code pasted in the channel like in clojure mode?
21:35gfredericksamalloy: because I don't remember how rpartial works exactly
21:35amalloy(defn rpartial [f & args] (fn [& args2] (apply f (concat args args2))))
21:35amalloyer, except swap args and args2 at the end there
21:35zakwilsonamalloy: because I don't know where rpartial is.
21:35amalloyit's right there, two lines above your message
21:35gfredericksamalloy: yep that's a gooder idea clearly
21:36zakwilsonWell, yes... not in any library?
21:36amalloyi don't really like rpartial, personally; using it is an indication you're taking/passing args in the wrong order
21:36gfrederickszakwilson: I'm sure it's in useful
21:36amalloybut it's better than a specialized but-first-partial
21:36amalloyit's not in useful
21:36zakwilsonIt's not in useful by that name.
21:36gfredericksamalloy: would it not be useful in comp/thrush?
21:36amalloyperhaps
21:37gfredericksrartial
21:37hyPiRionamalloy: Looks confusing with the wrong order.
21:37amalloyi think you'll probably wind up writing more junk with comp/rpartial when you could do it more simply with -> and a lambda
21:37zakwilsonIt may be an indication that you're taking args in the wrong order, but if you're interacting with someone else's library code, that may be the best solution.
21:38amalloy(comp (rpartial f :foo) g) => #(-> % (g) (f :foo))
21:38gfredericksamalloy: I should probably just get used to importing the dang diamond wand
21:38amalloyblech
21:38amalloy-<> is just an ugly way to write a let, isn't it?
21:38gfredericksI hate anonymous fns in the middle of threadings
21:38gfredericksis it?
21:39amalloyi dunno, i've never looked up the docs for -<>
21:39gfredericksit is like -> but you can insert <> into any form to specify alternative position
21:39amalloyright
21:39hyPiRionhackish.
21:39gfredericksI think of let as only being fundamentally useful when you need to use a value in more than one way
21:40amalloythere's a reason that every time someone suggests adding that to clojure.core, thirty people say "that's horrible. put it in your own library if you want"
21:40gfrederickswhich isn't the case for any -<> form
21:40gfredericksamalloy: I don't know what that reason is. And I'm not too bothered by it not being in core.
21:41amalloy(-<> x (foo bar <> baz) (f x y <>)) => (let [v1 (foo bar baz x)] (f x y v1))
21:41amalloyall -<> does is relieve you of the responsibility for naming your intermediate value
21:41gfredericksI think it reads a little easier
21:42gfredericksless steps to think about in your head
21:42emezeskeamalloy: It also makes your code impossible to read if you don't know what -<> is. And good luck googling it! :)
21:42gfredericksI'm not thinking "okay, v1 is now this thing, let's see what he does with it"
21:42gfredericksemezeske: you look at the ns form at the top of the page to see where it came from
21:42hyPiRionI find it kind of weird, as I would consider it as the same variable.
21:42zakwilsonI don't like -<>.
21:42emezeskeI suppose that's true
21:42hyPiRionPersonal opinion of course.
21:43gfredericks-> and ->> usually feel weird at first too
21:43zakwilsonI like ->
21:44gfrederickslet also breaks your code into two kinds of things -- the naming section and the body
21:44zakwilsonA lisper can read code with -> and, if familiar with the functions called inside it, guess what it does.
21:44gfredericksso you've got two different syntactic things going on
21:45gfredericksI think I end up reading let forms in a kind of backwards way that's a little jarring -- you read the form, then look at the name it gets
21:47frozenlockgfredericks: found it :) http://thesingularity.pl/blog/2010/writing-binary-files-in-clojure-the-recipe/
21:47amalloyzakwilson: i think your arguments all apply to -<> though, so far
21:47frozenlockThanks for showing me the way!
21:47emezeskegfredericks: The -<> wand uses the same symbol "<>" to refer to completely different values in the same expression. That seems pretty unfortunate.
21:48gfredericksfrozenlock: that guy is quite an indenter
21:48frozenlockIndeed
21:49gfredericksemezeske: that's an interesting objection. I think in practice it's a weird enough symbol that it wouldn't be an issue, but could understand disagreement there.
21:49amalloyi suspect -<> also doesn't nest usefully, whereas ->, ->>, and doto can all live together in harmony
21:50fil512what's the best way to format a float?
21:51gfredericksfil512: format should work
21:51gfredericksamalloy: well certainly -<> inside -> would work as expected
21:52gfredericks-<> inside -<> is questionable, but is there a reason you'd want to do such a thing?
21:52gfredericksthe fact that ->> is useful inside -> is precisely because you're not using -<>
21:55devnwait a fucking second here
21:55devn-<> ?
21:56gfredericksdevn: planned for inclusion in clojure 1.8
21:56devnlol
21:57devnAs long as we're getting crazy, why not: (-=<->=- ...)
21:57gfredericksclojure.core.sugar
21:58gfredericksdevn: because that function never comes up in practice
21:58devnor (-<-_->- ...)
21:58devnhaha
21:58gfredericksand -<-_->- was poorly designed to begin with
21:59fil512I'm struggling with hiccup.
21:59fil512http://tinypaste.com/44eb5acb
22:00fil512My two [:td] in the for loop
22:00fil512it only prints the first [:td]
22:00gfredericksfil512: ah ha
22:00gfredericksI've seen that mistake before
22:00fil512?
22:00gfredericksactually I'm curious why that even compiles; I thought for only accepted a single body form
22:01fil512I wondered about that too
22:01fil512it does compile
22:01gfredericksin any case I think you should bring the tr inside the for
22:01fil512but I need the [:th host]
22:01gfredericksyou're kind of trying to return two values from for and it's not clear what that would mean or how it would work
22:01gfredericksfil512: yeah bring that in too
22:02fil512but then wouldn't it repeat?
22:02gfrederickswait
22:02gfrederickshmm
22:02gfredericksokay nm
22:02fil512I tried putting [] around the two
22:02gfredericksso you're going for alternating TDs?
22:02fil512but it didn't like that
22:02fil512ya
22:03gfredericksprobably you will have to do something as complicated as however you would obtain such a sequence in a normal context
22:03gfredericksyou could build it into the for :/
22:03gfredericksmight be ugly
22:04gfredericks(for [[week value] host-results, x [(string/join " " week) (format "%.1f" value)]] [:td x])
22:04fil512ah
22:04gfrederickselse maybe you could use interleave
22:04fil512i see
22:04fil512interesting
22:04emezeskefil512: You probably need to do something equivalent to (concat (for [...] [stuff1 stuff2]))
22:05gfredericksemezeske: concat with 1 arg is identity, no?
22:05gfredericksapply concat maybe you meant
22:05emezeskeErr, (apply concat ...)
22:06fil512concat did wierd stuff to the :td
22:08lynaghk`emezeske: did you see the issue I raised about js externs/libs in dependencies with cljsbuild?
22:08fil512i kind of want a flatten operation
22:09fil512like is there something that takes [[a][b]] and turns it into [a][b]
22:09lynaghk`fil512: hiccup will explode children seqs in place, so the effect is the same
22:10emezeskelynaghk`: Yeah, that is something that I've wanted for a long time
22:10emezeskelynaghk`: I have been noodling on it today in the back of my head
22:11emezeskelynaghk`: I need to noodle some more before I can provide any useful input :)
22:11lynaghk`emezeske: yeah, me too. I'd be rad if we could figure something out so I can release these libraries I've been working on
22:11lynaghk`otherwise everyone's first taste will be, "uh, dumb. doesn't work" = )
22:11emezeskeYeah, that is a PITA.
22:12emezeskeI'm kind of thinking that something in the :jar hook could build some kind of metadata file with the project's required :libs, :externs, etc
22:12emezeskeBut I'm not sure how dependent projects would find that metadata file
22:13fil512no, when I try wrapping a [] around the two tds, I get the error: IllegalArgumentException [:td "2012 5 4"] is not a valid element name.
22:13lynaghk`emezeske: I think the simplest approach would be to just have a default path that automatically gets sucked in
22:13emezeskelynaghk`: Yeah, that's what I'm thinking, but cljsbuild still needs to know the root component of that path
22:13lynaghk`e.g., libs is prepopulated with "js-lib"
22:13emezeskelynaghk`: Like "c2/resources/cljsbuild-info.clj" or whatever
22:13lynaghk`does it? I thought the entire classpath was flattened.
22:14emezeskeIt is, but if multiple cljs libs supply js metadata info
22:14fil512is there a way I could escape the two tds inside the for loop and then unescape them outside?
22:14emezeskein the same file, they would stomp on one another
22:14lynaghk`oh, not into the project.clj. I mean sucked into the cljs compiler. So just make lib default to ["js-lib"], and then any cljs lib can have javascript get picked up by packaging it into their jar under js-lib/
22:15emezeskelynaghk`: Oooooh
22:15emezeskelynaghk`: But you can't list directories in JARs
22:15emezeskelynaghk`: So the compiler can't know what's in js-lib/
22:15lynaghk`I'm not sure if there will be stomping within ClojureScript compiler or Closure compiler, thougm
22:16lynaghk`emezeske: really? I've been getting away with just saying :libs ["path"] to get everything in path/*.js sucked in
22:16emezeskelynaghk`: That works if path is local
22:16emezeskelynaghk`: I'm pretty sure it doesn't work if path is in a JAR
22:16emezeskelynaghk`: I'd be happy to be proved wrong though
22:16lynaghk`I'm pretty sure it works, because you can suck cassowary-coffee in as a dependency and it works fine.
22:17lynaghk`(after you say, :libs ["cassowary"], of course.)
22:17emezeskeHuh, I'll have to dive into the compiler to see how that works
22:18amalloyfil512: (list [:td ...] [:tr ...])
22:19lynaghk`emezeske: do you have a preference for what that path should be called? I might refactor some libs to try it out this evening
22:21emezeskelynaghk`: I'm thinking nest it one level, so we can have other dirs in there; maybe under resources? So we'd have resources/js-libs and resources/js-externs
22:22emezeskelynaghk`: BTW, I just found how the compiler lists the libs dir
22:22lynaghk`emezeske: that would get jar'd up with "js-libs" and "js-externs" on the toplevel, unless you are suggesting we have a "resources" dir inside the jar?
22:22lynaghk`emezeske: which might get pretty damn confusing.
22:22emezeskelynaghk`: Oh, yeah, maybe resources/js/libs resources/js/externs? I dunno
22:23xeqi&(apply concat [:tr [:th "host"]] (for [[week value] [[1 2] [3 4] [5 6]]] [[:td\ week] [:td value]]))
22:23lazybotjava.lang.RuntimeException: Unsupported character: \ week
22:23xeqi&(apply concat [:tr [:th "host"]] (for [[week value] [[1 2] [3 4] [5 6]]] [[:td week] [:td value]]))
22:23lazybot⇒ (:tr [:th "host"] [:td 1] [:td 2] [:td 3] [:td 4] [:td 5] [:td 6])
22:24xeqifil512: do you want something like ^
22:24emezeskelynaghk`: Cool, it looks like the compiler recurses both :libs and :externs
22:24lynaghk`emezeske: my only concern is that having "js" in the toplevel of the classpath is that there might be collisions with Java JARs having documentation there or something.
22:25lynaghk`but maybe that's overthinking it.
22:25emezeskelynaghk`: Yeah, js is a bad choice
22:25lynaghk`emezeske: how do you mean?
22:25fil512gtg. thanks xeqi--i will try your suggestion later
22:25emezeskelynaghk`: I just mean that it works the same way with :externs that it does with :libs, which is cool
22:25lynaghk`ah, yep.
22:26lynaghk`emezeske: how about closure-js? It's not like any of this JS has anything to do with cljs, really. it's just js that the closure compiler eats.
22:26emezeskelynaghk`: I like it
22:27lynaghk`emezeske: cool. I'm going to go take a lil' computer break and unless I hear anything else from you in this chan I'll assume we'll give that a go and I'll adjust my libraries as such.
22:28emezeskelynaghk`: One note: if multiple libs supply the same file in there, things will get weird, but I guess that might not be a big deal in practice
22:28lynaghk`emezeske: got some baller cljs DOM stuff coming out soon = )
22:28emezeskelynaghk`: I look forward to seeing it!
22:28emezeskelynaghk`: Maybe update the github issue with a summary of what you're doing
22:28emezeskelynaghk`: Should be easy for me to add support
22:28lynaghk`emezeske: convention should be to namespace with project name, similar to how src/ is handled.
22:28emezeskelynaghk`: That works!
22:29emezeskelynaghk`: Also, let's call this super-alpha-level stuff, and not advertise it until we test it a little
22:29emezeskelynaghk`: I.e. get it right before getting other people to use it
22:30lynaghk`emezeske: super alpha is my middle name, evan.
22:30emezeskelynaghk`: rofl!
22:37emezeskelynaghk`: still there?
22:38emezeskelynaghk`: nm, I'll just update the issue
22:57anonas451hello. How to print like this on one line: "starting bigcalc... [time passes here and "starting bigcalc"is already visible ] took 3456.000 msecs" ?
22:57anonas451(flush) seems to force a new line
22:58gfredericksanonas451: you're using println instead of print?
22:58anonas451printf
22:59gfredericksman I always forget that exists
22:59amalloyflush definitely doesn't print a newline
22:59gfrederickswell printf just uses print. So it's not clear why you're getting any newlines
23:00anonas451hmm... could it be that it happens only in REPL? but not if I run it in shell?
23:00gfredericksit might be the the repl output is mixed with other output to give you the impression there's a newline
23:04anonas451ok. that was it... in shell it works fine, thank you for help.
23:08archaicI have a problem deserializing a record from swing, I just posted the code causing the issue here: https://groups.google.com/forum/?fromgroups#!topic/clojure/pIdi3w2xfF4
23:08archaicany advice much appreciated
23:32tomojnode-clojurescript's readme says "Modules developed in ClojureScript should be published with _only_ compiled JavaScript loaded at runtime (via NodeJS's require)."
23:34tomojbut couldn't we have ncljsc look into the local node_modules for cljs sources, and allow people to depend on multiple clojurescript projects on npm and compile them together?
23:54lynaghk`emezeske: what's the best way to test lein cljsbuild from git?
23:55lynaghk`emezeske: and/or do you want to push a build to clojars for me? = )