#clojure log - May 26 2012

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

0:00 scottj: emezeske: ro_st was his name. if you have the logs from yesterday

0:01 emezeske: scottj: I don't :(

0:01 scottj: emezeske: btw it looks like you were talking to him right before he mentioned that

0:01 ,logs?

0:01 emezeske: scottj: Anyway, the way to do that is to have (for instance) three source dirs

0:01 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: logs? in this context, compiling:(NO_SOURCE_PATH:0)>

0:02 xeqi: ~logs

0:02 clojurebot: logs is http://clojure-log.n01se.net/

0:02 emezeske: scottj: "common", "mobile", "desktop"

0:02 scottj: Put common stuff in common, and then the platform-specific namespaces in their respective dirs

0:02 scottj: and then the :build options in project.clj?

0:03 emezeske: scottj: Two :build options, one for "mobile" and one for "desktop"

0:03 scottj: And then just make sure "common" gets on the classpath

0:03 scottj: They way to do that differs for lein1/lein2, either :extra-classpath-dirs or :source-paths

0:08 scottj: emezeske: 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?

0:08 emezeske: scottj: 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

0:08 scottj: ok

0:09 emezeske: I don't necessarily think it's worth supporting that in lein-cljsbuild, though

0:09 scottj: so yeah what this guy wanted was to pass the main namespace kind of like some of the clojure build tools do

0:10 emezeske: What's the overall goal? Just to trim a few bytes out of the resultant JS for the other platform?

0:11 scottj: idk, I think he had functionality like dealing with touch that he didn't want in the desktop version

0:11 emezeske: So, don't call that code?

0:13 scottj: yeah 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

0:13 emezeske: That makes the most sense to me

0:37 _KY_: There are some special keywords that can be used in "let", but I can't find it in the docs

0:38 Oh, it was "let" inside "for"

0:38 Nevermind...

0:40 scottj: _KY_: there's also :when and :while and maybe others

2:14 jhulten: Anyone 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.

2:14 https://gist.github.com/2792517

2:58 alexyakushev: I'm good too, thank you. Sorry, I passed out early yesterday.

2:58 Do you have a moment?

3:00 Sorry, mistyped the private chat:)

4:31 lypanov: finally after a very strong coffee and an early morning hack have third-party working.

4:33 * lypanov strikes a gong

4: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?

4:38 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?

4:39 I'm tempted to use a def variable to count it...

4:40 lypanov: write a recursive loop.

4:41 _KY_: lypanov: so there would be an extra argument?

4:42 lypanov: right.

4:42 _KY_: Thanks=)

4:42 lypanov: rest. and count.

4:42 yw

4:43 aperiodic: why write a recursive loop? you can just do [(count (filter #(= -1 %) list)) (replace {-1 X} list)]

4:44 (where list is an argument of the function that snippet is implicitly in the body of)

4:45 AimHere: If performance is an issue, that would likely be slower, since it takes 2 passes

4:45 aperiodic: sure, but that sounds premature to me.

4:46 AimHere: I think your core choice of algorithm isn't 'premature optimization'

4:46 aperiodic: if the list is small, it won't matter; if the list is large, then i'd write the reduce and compare

4:46 i'll take n^2 if n is always less than 10!

4:47 s/reduce/loop/

4:49 AimHere: It'd be doable with reduce too

4:49 aperiodic: yeah, but reduce recurses, so if your motivation is performance, it'd be a poor choice

4:50 lypanov: huh

4:50 AimHere: I think it's more iterative than recursive

4:50 I don't see any stack growing

4:53 aperiodic: up until recently, it was implemented recursively (see: https://github.com/clojure/clojure/blob/87fa6c793592b7a3e99fcf9fb7cc08986889846a/src/clj/clojure/core.clj)

4:53 now, it uses the new reducers; i'm not sure if those consume stack or not

4:54 sorry, here's a link to the actual definition: https://github.com/clojure/clojure/blob/87fa6c793592b7a3e99fcf9fb7cc08986889846a/src/clj/clojure/core.clj#L6012

4:56 lypanov: aperiodic: you shouldn't read code without knowing the turtles all the way down.

4:56 http://clojure.org/special_forms#recur

4:57 the fact that recur is tail recursive is core clojure knowledge.

4:57 the fact that its efficient is the reason that clojure can function at all.

4:57 aperiodic: there's no recur statement in the definition of reduce

4:58 lypanov: again, you shouldn't read code without knowing the turtles all the way down.

4:59 you assume this but you don't read internal reduce definition.

5:00 aperiodic: the two-argument form doesn't appear to use that

5:00 lypanov: :/

5:00 * lypanov ignores and goes back to work

5:00 aperiodic: am i missing something obvious?

5:01 philandstuff: hello. is there a core function which will do (xxx 5 f n) => (f (f (f (f (f n))))) or something similar?

5:01 lypanov: aperiodic: the 2 arg form is calling the 3 arg form.

5:01 aperiodic: herp

5:01 philandstuff: i suppose I can do (apply comp (repeat 5 f)) but is there anything more idiomatic?

5:01 Iceland_jack: philandstuff: repeatedly?

5:02 AimHere: Well there's one non-tail recursive call then

5:02 Iceland_jack: hm no nvm

5:02 aperiodic: yeah, i was full of crap, though

5:02 Iceland_jack: oh, ,(doc iterate)

5:02 AimHere: philandstuff, maybe nth and iterate?

5:02 aperiodic: i think iterate is what you want

5:02 ,(doc iterate)

5:03 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

5:03 lypanov: aperiodic: thats lazy though.

5:03 but yes, if you need in lazy situation its cute.

5:03 philandstuff: i suppose. feels a bit odd to introduce a sequence when I only want a particular value, but it definitely works

5:04 aperiodic: well, you have to do the intermediate steps anyways. nth will force evaluation, so you don't have to worry about laziness after that.

5:04 lypanov: aperiodic: btw i'm just having a bad morning so wanted to do my turtle rant.

5:04 aperiodic: lypanov: no worries, thanks for calling me on my bull

5:04 philandstuff: ,(nth (iterate #(* 2 %) 1) 5)

5:04 clojurebot: 32

5:05 philandstuff: ,((apply comp (repeat 5 #(* 2 %))) 1)

5:05 clojurebot: 32

5:05 philandstuff: yeah iterate reads better

5:05 thanks aperiodic

5:06 aperiodic: hah, i was the third person to suggest it, but you're welcome

5:07 lypanov: aperiodic: naah, i'm full of bull too. my position comes from assuming hickey wouldn't do that not knowledge.

5:08 aperiodic: better to read core.clj and know it well than get lost like i do in the turtles.

5:08 on that note, gonna go back to reading about the new AMD architecture :P

5:09 aperiodic: i should spend an afternoon reading through core.clj one of these days

5:10 lypanov: i need to get off my ass and make a .clj -> mobi convertor that doesn't blow

5:10 namely one that uses prop fonts but doesn't loose indent

5:11 aperiodic: i can never stand proportional fonts for code. i usually just print that i'm studying out, but i don't have a kindle

5:11 s/print/print code/

5:12 dsantiago: weavejester, you around?

5:12 weavejester: dsantiago: Yup

5:12 dsantiago: weavejester: Hey, question about hiccup. It seems like there isn't really a way to hold a series of sibling nodes, is that correct?

5:13 weavejester: dsantiago: A list

5:13 dsantiago: (html (list [:p "foo"] [:p "bar])) => "<p>foo</p><p>bar</p>"

5:13 dsantiago: Or any seq

5:14 dsantiago: weavejester: Ah, OK. I wasn't aware of that part of the syntax. Didn't see it on the wiki.

5:15 weavejester: dsantiago: It's under "Expanding seqs" but perhaps I need to reword it.

5:16 dsantiago: weavejester: 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.

5:16 weavejester: dsantiago: Feel free to add a better example to the wiki page :)

5:20 dsantiago: weavejester: Thanks.

5:52 Borkdude: ibdknox people are questioning why you already closed the poll: https://kodowa.wufoo.com/forms/light-table-oss/

5:53 lypanov: "On FREE accounts, forms will be deactivated once they have exceeded the maximum number of entries allowed for a given month."

5:53 Raynes: And I'm certain they'll conclude that he is, indeed, the devil.

5:54 kab3wm: with the sorcery that is light table, I do believe he is the devil. ;)

5:56 Borkdude: light table: become a code alchemist

5:57 lol, 100 entries a month?

6:00 for a free account

6:55 lypanov: finally!!!

6:58 ibdknox: possible noir-cljs bug: rm -rf resources/public/cljs is required after doing a clojurescript upgrade.

7:02 AeroNotix: To me, Light Table looks like an emacs plugin. Is it actually an emacs plugin?

7:03 lypanov: ?

7:04 what do you base that on?

7:04 if its magic it must be emacs? :)

7:04 AeroNotix: lypanov: "It's magic" on what do you base *that* on?

7:05 lypanov: AeroNotix: huh?

7:05 man i remember why i never use irc.

7:05 AeroNotix: lol

7:06 ivan: no, it is not an Emacs plugin

7:07 AeroNotix: ivan: that's all I wanted to know

7:07 ivan: looks pretty meh to me

7:08 kilon_alios: hey i am getting an error on Lion when I try to build clojure latest with ant

7:08 [java] Exception in thread "main" java.lang.ClassNotFoundException: jsr166y.ForkJoinPool, compiling:(clojure/core/reducers.clj:56)

7:09 ivan: did you read readme.txt?

7:09 kilon_alios: oh boy

7:09 sorry i missed one

7:14 sucess

7:15 thanks ivan for reminding me what i should have done in the first place

7:15 question, does it also setup pathos so i can call clojure from anywhere ?

7:15 ivan: np :)

7:15 kilon_alios: *paths

7:15 ivan: no

7:15 you just get a jar

7:16 you might be looking for leiningen

7:17 kilon_alios: ok leiningen was my next step anyway

7:17 thansk will look into that now

7:18 how I exit the REPL ?

7:19 ivan: ctrl-c or ctrl-d

7:21 the-kenny: I want Light Table as an Emacs plugin :)

7:22 kilon_alios: nice

7:22 ok leiningen here i come

7:22 the-kenny: I'd suggest starting directly with leiningen 2

7:24 kilon_alios: another stupid question, will someone need to install clojure or anything else to run a clojure application ?

7:26 i am only asking since clojure apps are just java bytecode

7:26 AimHere: Well you should be able to package up your clojure app into a jar that could be run with just a java runtime

7:26 kilon_alios: ah ok, what i wanted to here

7:27 i would hate my users need to install dependencies , thanks AimHere

7:27 the-kenny: how i get 2, i am following instructions here -> https://github.com/technomancy/leiningen

7:28 borkdude: Some leiningen install instruction for (newbie dummy) Windows users: http://dl.dropbox.com/u/3914693/leiningen.org/public/install.html

7:28 philandstuff: aperiodic, Iceland_jack: thanks for your suggestion of iterate earlier. here's where I used it: http://rhebus.posterous.com/pitch-and-frequency

7:29 Iceland_jack: You're welcome philandstuff, looks like cool stuff

7:29 Overtone is way interesting

7:30 bordatoue: can anyone tell me how to create an interface in clojure

7:32 kilon_alios: bordatoue: anything for us macos users ?

7:32 bordatoue: hello

7:33 is it possible to create an interface in clojure

7:34 ca anyone see my messages

7:35 can anyone see my messages

7:36 borkdude: bordatoue yes we read you

7:37 bordatoue: thanks

7:37 Well any ideas on intefaces with clojure

7:37 borkdude: bordatoue do you need to implement an interface?

7:38 bordatoue: just to define a interface

7:38 p_l: there'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

7:39 bordatoue: thanks, I will have a look at it

7:39 borkdude: bordatoue this is a very handy chart: https://github.com/cemerick/clojure-type-selection-flowchart/blob/master/choosingtypeforms.png

7:40 bordatoue: thanks borkdude

7:41 kilon_alios: ok leiningen installed, is there a way to make it tell me where its installed ?

7:43 borkdude: kilon_alios the windows instructions I provided are almost the same for mac osx

7:43 kilon_alios only different script and no http client installation

7:43 kilon_alios look inside ~/.lein/self-installs

7:44 what minimum requirements does leiningen/clojure assume, 1.5, 1.6?

7:44 java I mean

7:44 kilon_alios: thank you

7:44 actually i was already sucessful installing it , that is why i ignored your link

7:45 yes it was very easy , too easy :D

7:45 ah thanks for the path too

7:45 you are my hero

7:46 you all are

7:46 very friendly community

7:46 xeqi: borkdude: clojure 1.4 supports 1.5, leiningen requires 1.6 (though most tasks should work in 1.5)

7:47 borkdude: xeqi ok added "assuming java runtime 1.6 or higher"

7:48 kilon_alios: ok all seem to work fine

7:48 thanks guy i am ready to rock with clojure now

7:49 next phase emacs and slime

7:50 what else do i need beside clojure and leiningen to make my life easier ?

7:51 jonh: millions of dollars and a maid staff

7:51 kilon_alios: haha

7:52 vosovich: paredit might be nice if you're spending a lot of time writing clojure

7:52 bordatoue: Is there any tutorial on installing clojure with acquamac

7:55 kilon_alios: go ask emacs :D

7:55 they love aquamacs

7:55 vosovich: thanks googling it

7:56 bordatoue: what do you guys use to program in clojure, is there any perticular IDE

7:56 i thought aquamacs was good

7:57 kilon_alios: bordatoue: well it is considered by some a somewhate limited implementation of emacs, gnu emacs seems to be the popular choice, and slime for clojure

7:57 emacs is not an ide is a text editor, a sophisticated one but still a text editor, but slime has a lot of ide functionality

7:58 bordatoue: is there any ide apart from emacs derivatives that would be good for clojure

7:58 kilon_alios: bordatoue: if you are afraid of emacs steep learning curver there is also Eclipse plugin

7:58 bordatoue: i use acquamac, on mac. Gnu emacs seems to give me problems with mac

7:58 kilon_alios: just google eclispe and clojure and you should get you some tutorials

7:59 borkdude: bordatoue eclipse

7:59 vosovich: I second eclipse with counterclockwise

7:59 kilon_alios: bordatoue: no problem with my mac and LION , i got an imac of 2007

7:59 vosovich: it's pretty good

7:59 bordatoue: is eclipse counterclockwise good for clojure

7:59 borkdude: bordatoue yes

7:59 kilon_alios: looks that way

8:00 borkdude: bordatoue also, there is a leiningen plugin

8:00 bordatoue so it will download dependencies based on project.clj and put them on the classpath for your eclipse project

8:00 bordatoue: what exctaly does leiningen plugin do , is it anlternative to the make

8:00 vosovich: it integrates lein in eclipse

8:00 bordatoue: like maven

8:01 is it similar to maven

8:01 borkdude: bordatoue like maven, but easier

8:01 bordatoue: cool

8:01 borkdude: bordatoue it uses maven under the hood

8:01 kilon_alios: i assume cw and lien like each other

8:02 bordatoue: And onemore thing , what tool do you use to view the documentation

8:02 borkdude: bordatoue &&(doc +)

8:02 bordatoue: is there anything similar to javadoc with winstyle

8:02 borkdude: ,(doc +)

8:02 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'"

8:03 borkdude: bordatoue or clojuredocs.org

8:03 bordatoue: is there any winhelp style doc for clojure

8:03 kilon_alios: hmm nice i assume also that it will be possible to customise Eclipse with clojure

8:05 bordatoue: when running emacs on Lion (pressing alt+x) is not entering meta mode

8:05 kilon_alios: thats strange

8:05 it works for me

8:05 bordatoue: where as on acquamac it works

8:05 thats the problem i have with gnu emacs, as with all linux based utility something needs fixing

8:05 kilon_alios: you got american keyboard ?

8:06 bordatoue: no UK keyboard

8:06 kilon_alios: maybe its the keyboard

8:06 bordatoue: GNU Emacs 22.1.1

8:06 Copyright (C) 2007 Free Software Foundation, Inc.

8:06 GNU Emacs comes with ABSOLUTELY NO WARRANTY.

8:06 You may redistribute copies of Emacs

8:06 under the terms of the GNU General Public License.

8:06 For more information about these matters, see the file named COPYING.

8:06 thats the version I am running

8:06 kilon_alios: thats old

8:06 mine is emacs 24

8:07 bordatoue: old, i got it from mac port

8:07 kilon_alios: and i have not bothered to get the newest version for some time

8:07 eeewww macports

8:07 no need

8:08 bordatoue: http://emacsformacosx.com/

8:08 bordatoue: thanks, I will try that

8:08 acquamac seems to be alrite

8:09 what did you say the problem with acquamac was

8:09 i have seen people using acquamac with inferiorlisp when working with clojure

8:10 thanks for the link

8:10 kilon_alios: bordatoue: 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

8:11 bordatoue: 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

8:11 borkdude: I'm using normal emacs as well

8:11 bordatoue: thanks very much , i shall start playing with emacs

8:12 borkdude: bordatoue about alt+x, are you sure, you didn't press cmd-x? I made that mistake a couple of times

8:12 bordatoue: ofcourse

8:12 i will try with this version

8:12 kilon_alios: bordatoue: it has the added advantage that once you go gnu, you can visit #emacs and ask them for fixs to your problems

8:12 bordatoue: yeah, i don't know why all gnu application requires fixing before using it

8:13 kilon_alios: to be fair, i had zero issues with emacs

8:13 bordatoue: luckly with mac there is no problem , i can't imagine doing a majore project on linux system

8:13 kilon_alios: even making it type in greek after some directions from #emacs has been a breeze

8:13 not that I type greek a lot in emacs even though I am greek

8:14 borkdude: kilon_alios have you tried a right to left language?

8:14 kilon_alios: but generally macports are not the best place to get stable builds

8:14 bordatoue: arabic

8:14 kilon_alios: no

8:14 not really

8:14 i am working 99.9% in english

8:14 because i do only coding and some chating in irc

8:15 if my code is commented in english, i rarely use greek :D

8:15 *even my code...

8:15 borkdude: kilon_alios hmm, I guess for variable names greek symbols could be nice

8:16 kilon_alios: i guess so

8:16 the problem with eclispe is that it can get very slow

8:16 borkdude: ,(let [add (fn [α β] (+ α β))] (add 1 2)

8:16 kilon_alios: trying to setup now cw and its slow as hell dont know why

8:17 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

8:17 kilon_alios: i would not use a greek letter for a variable to tell you the truth

8:17 the only greek i use is names for my projects

8:17 vosovich: I would, as a physicist

8:17 kilon_alios: like my latest one, a GUI and visual programming language called Ephestos

8:17 vosovich: it beats awkward naming at times

8:18 kilon_alios: https://github.com/kilon/Ephestos

8:18 borkdude: , ,(let [add (fn [α β] (+ α β))] (add 1 2))

8:18 clojurebot: 3

8:18 borkdude: it works! :){

8:18 kilon_alios: which hopefully will port to clojurescript and maybe clojure as well

8:19 borkdude: maybe we can make an alias for fn, called λ ?

8:19 vosovich: borkdude, try starter-kit-lisp

8:19 it has that alias and some more

8:20 borkdude: my iterm2 can't handle these greek cars

8:20 if I start an nrepl

8:20 can emacs connect to it, how?

8:22 bordatoue: version 23.4 downloaded from the link you gave is working

8:32 borkdude: should this work? https://gist.github.com/2793775

8:33 provided there is an nrepl running on that port

8:36 it works… a little

8:49 well, it works with inferior-lisp.. although at the inferior-lisp buffer it prints weird characters when I send input

8:50 [17G[8G[18G

8:50 what about this?

8:54 kilon_alios: borkdude: inferior lisp is not slime, you better use slime for clojure

8:54 borkdude: kilon_alios slime doesn't support nrepl

8:55 kilon_alios: what is nrepl ?

8:56 ah ok found it

9:01 borkdude: I guess this is basically enough: https://gist.github.com/2793775

9:02 kilon_alios: slime uses the repls of implementations

9:04 it should be realitive easy to customise to call another repl

9:04 or maybe not :D

9:04 borkdude: kilon_alios nrepl is a different protocol than slime

9:09 kilon_alios: oh boy

9:55 otfrom: anyone from EuroClojure out there?

10:36 kilon_alios: is JDK included with macos ?

10:36 I have Xcode installed

11:15 zaiste: I cannot get my head around middlewares in Ring, why does show-params print info as if it was the last function being invoked ?

11:16 according to -> macro definition it should be invoked as a first one

11:16 code is here: https://gist.github.com/2794258

11:20 tmciver: zaiste: 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:21 zaiste: Also, all middleware return a function of the request object so that they may be passed as handlers to other middleware.

11:22 zaiste: I admit it is a little difficult to get your head around at first.

11:22 zaiste: tmciver: yes, but show-params is supposed to be executed as first one, other middleware should add info "later"...

11:24 not sure if I put it clearly ;)

11:24 tmciver: zaiste: 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:25 zaiste: 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:25 zaiste: ok, it's called last, but it already carries info from other middleware

11:25 s

11:25 middlewares&

11:26 tmciver: zaiste: 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:28 borkdude: are there any recent audio podcasts/lectures I should listen to while vacuum cleaning (about clojure)?

11:28 (have listend to all Mostly Lazy ones

11:28 )

11:40 beffbernard: borkdude: Have you listened to the ThinkRelevance: The Postcast episodes?

11:41 borkdude: beffbernard any one in particular you recommend?

11:41 beffbernard: Not off the top of my head but they are all well done

11:41 tmciver: zaiste: 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:42 zaiste: tmciver: thanks, I think I got it, req is updated from "bottom-up" with -> macro

11:43 tmciver: I corrected Ring wiki, http://bit.ly/LqPW9f

11:44 tmciver: wrap-params is last, it's invoced as first, update req before "recursion"

11:52 tmciver: zaiste: 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:53 zaiste: tmciver: thank you !

12:03 alexyakushev: Have anyone seen Chas Emerick lately?

12:05 gfredericks: $seen cemerick

12:05 lazybot: cemerick was last seen quitting 5 hours and 34 minutes ago.

12:08 alexyakushev: Thanks

12:43 otfrom: alexyakushev: cemerick is in London atm and mostly afk. He was at EuroClojure yesterday

12:43 alexyakushev: otfrom: Thank you for this information!

12:43 otfrom: np

13:46 lynaghk: ping: technomancy

15:13 xeqi: I get 'cljs.core.logic.Set is undefined' when trying to use cljs, core.logic, and :optimizations :simple

15:13 anyone else used core.logic w/ cljs?

15:16 dnolen: xeqi: sorry been busy with stuff, there's a core.logic branch called cljs-head

15:17 xeqi: there's one outstanding bug I need to track before I can merge to mater and cut another release.

15:17 mater -> master

15:17 xeqi: dnolen: ah, thanks

15:17 borkdude: mater = the mother release

15:18 branch

15:19 lynaghk: dnolen: 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:19 dnolen: lynaghk: probably a bug, there's a default hash method that should be called I believe.

15:19 lynaghk: feel free to open a ticket

15:20 lynaghk: dnolen: yeah, I'm looking at core.cljs now, looks like you guys extend-type most of the natives to work properly

15:20 dnolen: cool. I'll get a ticket+patch in sometime in the next few days.

15:24 dnolen: lynaghk: fixing it now, extend-type default will call goog.getUid

15:24 KIMAvcrp: hey #clojure

15:24 lynaghk: dnolen: awesome, thanks!

15:25 KIMAvcrp: I 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:25 dnolen: lynaghk: in master now

15:25 KIMAvcrp: but I get the following error when i try to evaluate clojure code: function definition is void (lisp-eval-string)

15:25 lynaghk: dnolen: xoxoxoxo

15:26 KIMAvcrp: does anyone know where the function is defined wich file I an missing to require ?

15:33 uvtc: When 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:34 They both seem to work...

15:47 borkdude: uvtc C-h f <run-lisp or inferior-lisp> both seem to print the same text

15:47 -both

15:48 uvtc: borkdude, Doh. Should've tried that first! Thanks, borkdude. :)

15:57 acagle: join #leiningen

15:58 mittchel: What's the difference between if and when? And when should you use when instead of if

15:59 uvtc: mittchel, `when` has an implicit `do`.

15:59 mittchel: ahhh

15:59 And do is needed for side effects right?

16:00 borkdude: also when doesn't take an "else" expression

16:00 uvtc: mittchel, no, `do` is not needed for side-effects.

16:00 ,(if true (println "side-effect!"))

16:00 clojurebot: side-effect!

16:01 mittchel: Hm

16:02 borkdude: 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:02 Vinzent: Some 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:03 borkdude: mittchel: do evaluates possibly more than one expression, but only the result of the last expression is "returned"

16:03 ,(do 1 2 3)

16:03 clojurebot: 3

16:03 borkdude: mittchel but side effects of the other expressions do occur:

16:03 ,(do (println "foo") 4)

16:03 clojurebot: foo

16:03 4

16:04 mittchel: Alright, thanks borkdude. I'm going to study more:P Probably report back in a few mins haha

16:04 Vinzent: But it doesn't make any sense to put non-side-effecty expressions in the middle of the `do` block.

16:04 borkdude: Vinzent that's right

16:04 Vinzent: So side effects is exactly the thing `do` is used for.

16:07 borkdude: Vinzent it's a matter of style, when is just a macro which expands into if

16:08 ,(macroexpand '(when true :foo))

16:08 clojurebot: (if true (do :foo))

16:08 Vinzent: borkdude, yeah, I know.

16:08 uvtc: Things with "do" in the name tend to be side-effecty. doseq dotimes

16:10 Vinzent: uvtc, 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:11 borkdude: Vinzent when has an implicit do?

16:12 ,(when true (println "dude") 3)

16:12 clojurebot: dude

16:12 3

16:12 TimMc: (if test consequent alternative)

16:12 (when test body...)

16:12 borkdude: I think the if/when discussion isn't really important though

16:12 Vinzent: borkdude, yes, but the key word here is "implicit".

16:13 Sure.

16:13 TimMc: I often use "when" when I want to return nil if the test fails.

16:14 * Vinzent too

16:15 borkdude: or if-let

16:16 ah there's also when-let

16:17 all these shortcurts ;)

16:17 arohner: IMO, strongly prefer 'when', when there is no 'else'

16:18 (if test true-expr) shouldn't exist

16:18 mittchel: Since do only returns the last value.. for what practical use does this come in handy?

16:18 TimMc: mittchel: Side effects.

16:18 arohner: (do (side-effect1) (side-effect2) return-value)

16:19 mittchel: Yep, I understand it's useful for side-effects.. but an practical example when this comes in handy? :P

16:19 hyPiRion: Run up threads.

16:20 (do (.start thread) 0) or something.

16:20 borkdude: mittchel or just printing things

16:21 mittchel or doing things with atoms, databases, or other mutable things

16:21 arohner: (if test (do (println "it was true") true-result) false-expr)

16:22 mittchel: hmm sounds clear to me now ;) thanks!

16:23 hyPiRion: If 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:29 TimMc: mittchel: I mostly use 'do' when debugging.

16:29 Vinzent: This actually signalize that clojure has poor tool support.

16:30 TimMc: Although... the (doto ... (println)) approach is pretty sweet if that's what you want/

16:30 mittchel: TimMc: debugging? To print values for example?

16:30 TimMc: mittchel: Yep.

16:30 I haven't gotten Swank set up yet.

17:02 coventry: In 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:29 ghengis: hmm, there doesn't seem to be an is-array? function

17:29 coventry: Do you mean "vector?"?

17:29 ghengis: no java array

17:30 coventry: Slightly cleaned up version of the code in my question: http://pastebin.com/Ba3bEhGe

17:31 ghengis: What are you trying to do with the test?

17:31 ghengis: check if an argument is an array before trying to convert it to one

17:34 coventry: Why not just try to do the conversion, and handle the exception if it's not?

17:35 amalloy: &(map (fn [x] (.isArray (class x))) [1 '[a vector] (into-array '(an actual array))])?

17:35 lazybot: ⇒ (false false true)

17:36 amalloy: though i have to say, an API that accepts "either an array or not an array" is probably wrong

17:36 ghengis: cool, thanks!

17:37 well, i agree, but i'm implementing heap-sort as an array, but i want to take seq's

17:38 but then i might as well allow arrays

17:39 amalloy: so...why are you implementing a sort algorithm?

17:39 ghengis: studying for job interviews :)

17:40 coventry: Oh, 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:40 amalloy: mmm. well if it's sorta "for fun", it seems silly to work with arrays. the exact same algorithm will apply to vectors

17:41 ghengis: yeah, i might test the performance difference of vecs vs arrays once i'm done with this

17:51 goodieboy: nested destructuring... i have a map like {:params {:id 1}} -- how can i destructure so that id is bound to "id" ?

17:52 Vinzent: {{:keys [id]} :params} or something like that

17:52 goodieboy: Vinzent: awesome thanks!

17:55 coventry: What's clojure's equivalent to let*?

17:56 Vinzent: coventry, let

17:56 ghengis: it already behaves like let*

17:58 coventry: Cool. 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:59 Vinzent: coventry, (let [x 2 y (* x x)] ...)

18:00 coventry: Great, thanks.

18:01 Vinzent: coventry, 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:01 lazybot: ⇒ [1 2]

18:02 coventry: Thanks, that clears up my confusion

18:05 dsantiago: weavejester: Hickory now has zippers for hiccup forms.

18:07 weavejester: dsantiago: Ah, okay

18:07 dsantiago: I might be tempted to use the xml zippers in data.zip though

18:08 dsantiago: 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:08 dsantiago: weavejester: Oh yes. Well, hickory now also parses HTML into a simliar format to clojure.xml, and provides zippers for that too.

18:09 Hickory drops fewer document parts than clojure.xml.

18:09 weavejester: dsantiago: I was just about to mention that :)

18:10 dsantiago: There is a fair bit of loss when converting to clojure.xml...

18:10 dsantiago: Yeah. Hickory should be round-trippable.

18:10 But doesn't do XML (yet?)

18:10 weavejester: dsantiago: Yes… I can see that being useful.

18:11 dsantiago: 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:12 dsantiago: weavejester: Hm, yeah, sounds like we had similar thoughts.

18:12 Maybe I should add a function to strip out comments and doctypes, so it will really match up with clojure.xml.

18:12 weavejester: dsantiago: 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:12 dsantiago: Not sure why that'd be useful.

18:13 weavejester: dsantiago: It sounds like a separate library… Hickory seems useful on its own without trying to work on two formats, Hiccup and clojure.xml.

18:13 But then I've always been a fan of small libraries that do one thing :)

18:15 Raynes: dsantiago: How are things?

18:16 dsantiago: Well, 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:16 At 200 lines, it's hardly piggish.

18:16 Hey Raynes.

18:16 When you moving out here?

18:17 Raynes: dsantiago: I don't know yet.

18:18 dsantiago: Ah well.

18:19 coventry: Going back to the question I started with, why would (send target-agent f) cause clojure to hang if f returns an agent?

18:20 (Or maybe, why could it, since it might be something to do with the structure of the agents in this example.

18:29 hiredman: ,(doc send)

18:29 clojurebot: "([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:29 hiredman: what a crappy doc string

18:29 ,(doc agent)

18:29 clojurebot: "([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:31 coventry: Hmm, I read those before, but they didn't clarify the question for me. Could you explain a bit more?

18:34 gfredericks: coventry: I don't know why send would ever hang, so I don't think the answer is obvious

18:34 unless I have a major gap in my agent-knowledge

18:38 coventry: It's understandable that clojure wouldn't be as idiot-proof as python (which is the level of error reporting I'm used to. :-)

18:44 amalloy: gfredericks: send itself doesn't hang, but there are some ways you can trick yourself into doing it

18:45 eg: (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:11 arohner: amalloy: I thought await'ing in an agent action threw? How would that hang?

19:13 amalloy: arohner: does it? perhaps i oversimplified; i do know that if you try to use seque from within an agent action it hangs

19:13 i suppose that's because seque doesn't actually use await, it manually blocks on a LinkedBlockingQueue that an agent is responsible for filling

19:14 fil512: http://pastebin.com/qNaVAYVT

19:14 line 14 is the (def results line

19:14 why can't it compile my (def results) line?

19:15 arohner: ,(-> (agent nil) (send (fn [a] (await a))) (agent-errors)

19:15 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

19:16 fil512: Any 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:16 amalloy: &(-> (agent nil) (doto (send await)) (agent-errors))

19:16 lazybot: java.lang.SecurityException: You tripped the alarm! send is bad!

19:16 amalloy: ,(-> (agent nil) (doto (send await)) (agent-errors))

19:16 clojurebot: nil

19:16 arohner: anyways, something similar to that throws for me locally

19:16 " Can't await in agent action"

19:16 amalloy: arohner: i believe you

19:18 fil512: When I call (def results (get-results "../monitor/monitor_log.txt")) it gives me a compile error, saying "Key must be integer".

19:18 hiredman: ,(assoc [] :a 1)

19:18 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>

19:19 fil512: hmmmm

19:19 http://pastebin.com/qNaVAYVT

19:19 is there something in my definition of get-records that is trippy?

19:20 do I need to use (vector instead of [host ...?

19:23 emezeske: fil512: No, the vector literal there is fine.

19:23 &(into {} (for [x (range 0 10)] [x (inc x)]))

19:23 lazybot: ⇒ {0 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10}

19:32 gfredericks: emezeske: ##(= (range 0 10) (range 10))

19:32 lazybot: ⇒ true

19:33 emezeske: gfredericks: thanks!

20:07 zuzuncink: clojurebot: whats up? i feel so lonely.

20:07 clojurebot: I don't understand.

20:07 zuzuncink: i said i am alone.

20:08 clojurebot: ok you should talk to fsbot

20:08 clojurebot: bookshelf is http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH

20:31 devn: euroclojure was winning.

20:33 gfredericks: devn: What? I thought you lived in Michisottagan or something

20:33 devn: i live in Wisconsin

20:34 I still went to London, though

20:34 gfredericks: s/Michisottagan/Michisottasconsin/

20:46 zuzuncink: i 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:47 will installing emacs-goodies make emacs slower?

20:49 ups wrong channel :)

20:55 emezeske: dnolen: ping

21:08 devn: gfredericks: heh

21:08 gfredericks: 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:10 zakwilson: It just came to mind that there's something I want to build on top of Lighttable.

21:12 gfredericks: zakwilson: fortunately there are many things that go on top of tables, so you have a long list of punny names

21:13 amalloy: Light SaltShaker

21:13 zakwilson: Heh.

21:15 What 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:15 devn: i can sum up most of the eurclojure conference

21:15 here it is: https://img.skitch.com/20120527-b35cuu2n8bs8x12kmpxep682bw.png

21:15 note that his hands act like parens

21:16 also this: https://img.skitch.com/20120518-2dgmtb5gmy74a7wxcn7f14kfx.png

21:16 fil512: question for you

21:16 what rules of thumb should I use to order function parameters?

21:17 frozenlock: Hello 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:17 fil512: e.g. if a function transforms a collection using args, does the collection go first or the args?

21:17 zakwilson: I'd put the collection first, because I use -> more than ->>

21:18 fil512: does clojure have a convention in general?

21:18 gfredericks: collection functions in clojure.core often put the collection last

21:18 I normally have to use ->> with collections but -> with other things

21:18 fil512: thanks. sounds like collection last is best practice

21:19 zakwilson: I think that's an artifact of the classic list operations having been that way forever.

21:19 Also, if there might be a variable number of args, collection first makes a lot of sense.

21:20 gfredericks: frozenlock: you called .getBytes because you have a String?

21:21 frozenlock: gfredericks: it's a method from the java class I'm using (OctetString)

21:21 gfredericks: zakwilson: 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:21 so it goes very well with partial

21:22 fil512: so collection last works better with partial?

21:22 gfredericks: frozenlock: spit might not be usable for you then. I'm sure you can cook something up with what's in clojure.java.io

21:22 zakwilson: Yeah, that's a reason for that too, and map takes multiple collection args.

21:22 gfredericks: probably outputstreams can be written with byte-arrays?

21:23 fil512: maybe it more has to do with HOFs than collection functions

21:23 zakwilson: The 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:23 fil512: cool. just want to double-check all this is pointing to collections last being a good thing right?

21:23 gfredericks: recently I've wished multiple times that there were a but-first-partial

21:24 zakwilson: If 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:24 fil512: Just turn around if you want to go "butt first" :-)

21:24 gfredericks: my son hasn't yet figured out that that's how you get off of things

21:24 fil512: lol

21:25 gfredericks: well feet first I guess. at least not head first

21:27 zakwilson: gfredericks: 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:27 rhdoenges: what's the right lib to use for making http requests? or do I just need java.net.URLConnection?

21:27 zakwilson: (it's in useful.fn)

21:28 rhdoenges: clj-http

21:29 gfredericks: zakwilson: not sure how thrush helps. It seems more of a use case for butfirst-partial than an alternative

21:29 rhdoenges: zakwilson: thanks.

21:29 amalloy: the 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:30 that makes it all work out better for update-in/swap!/etc chains

21:31 gfredericks: amalloy: how does the coll-last part make things work out better? (besides compatibility with core functions that are already that way)

21:31 zakwilson: gfredericks: I suppose it solves a slighly different problem. Forget I said that, but know it exists because it's useful anyway.

21:31 amalloy: that's not a good enough reason?

21:32 but also gfredericks, it leaves you room to add additional sequences as varargs, like map and interleave

21:32 gfredericks: amalloy: well I'm curious if there's a good reason for the core functions being that way as well

21:32 that's an interesting reason

21:32 amalloy: well, i just made it up

21:32 gfredericks: I didn't say it was _right_

21:33 you don't have to take everything amalloy says so seriously

21:33 hyPiRion: Isn't a but-first-partial just (defn but-first-partial [f & args] (fn [n] (apply f n args))) ?

21:33 zakwilson: gfredericks: what you want is something that acts like (defn butfirst-partial [f & args] (fn [x] (apply f x args))), isn't it?

21:34 gfredericks: hyPiRion: 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:34 zakwilson: you betcha

21:34 hyPiRion: gfredericks: Ah, I see.

21:34 amalloy: why write but-first-partial instead of generalizing it to rpartial?

21:34 zuzuncink: is there any way to see the code pasted in the channel like in clojure mode?

21:35 gfredericks: amalloy: because I don't remember how rpartial works exactly

21:35 amalloy: (defn rpartial [f & args] (fn [& args2] (apply f (concat args args2))))

21:35 er, except swap args and args2 at the end there

21:35 zakwilson: amalloy: because I don't know where rpartial is.

21:35 amalloy: it's right there, two lines above your message

21:35 gfredericks: amalloy: yep that's a gooder idea clearly

21:36 zakwilson: Well, yes... not in any library?

21:36 amalloy: i don't really like rpartial, personally; using it is an indication you're taking/passing args in the wrong order

21:36 gfredericks: zakwilson: I'm sure it's in useful

21:36 amalloy: but it's better than a specialized but-first-partial

21:36 it's not in useful

21:36 zakwilson: It's not in useful by that name.

21:36 gfredericks: amalloy: would it not be useful in comp/thrush?

21:36 amalloy: perhaps

21:37 gfredericks: rartial

21:37 hyPiRion: amalloy: Looks confusing with the wrong order.

21:37 amalloy: i think you'll probably wind up writing more junk with comp/rpartial when you could do it more simply with -> and a lambda

21:37 zakwilson: It 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:38 amalloy: (comp (rpartial f :foo) g) => #(-> % (g) (f :foo))

21:38 gfredericks: amalloy: I should probably just get used to importing the dang diamond wand

21:38 amalloy: blech

21:38 -<> is just an ugly way to write a let, isn't it?

21:38 gfredericks: I hate anonymous fns in the middle of threadings

21:38 is it?

21:39 amalloy: i dunno, i've never looked up the docs for -<>

21:39 gfredericks: it is like -> but you can insert <> into any form to specify alternative position

21:39 amalloy: right

21:39 hyPiRion: hackish.

21:39 gfredericks: I think of let as only being fundamentally useful when you need to use a value in more than one way

21:40 amalloy: there'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:40 gfredericks: which isn't the case for any -<> form

21:40 amalloy: I don't know what that reason is. And I'm not too bothered by it not being in core.

21:41 amalloy: (-<> x (foo bar <> baz) (f x y <>)) => (let [v1 (foo bar baz x)] (f x y v1))

21:41 all -<> does is relieve you of the responsibility for naming your intermediate value

21:41 gfredericks: I think it reads a little easier

21:42 less steps to think about in your head

21:42 emezeske: amalloy: It also makes your code impossible to read if you don't know what -<> is. And good luck googling it! :)

21:42 gfredericks: I'm not thinking "okay, v1 is now this thing, let's see what he does with it"

21:42 emezeske: you look at the ns form at the top of the page to see where it came from

21:42 hyPiRion: I find it kind of weird, as I would consider it as the same variable.

21:42 zakwilson: I don't like -<>.

21:42 emezeske: I suppose that's true

21:42 hyPiRion: Personal opinion of course.

21:43 gfredericks: -> and ->> usually feel weird at first too

21:43 zakwilson: I like ->

21:44 gfredericks: let also breaks your code into two kinds of things -- the naming section and the body

21:44 zakwilson: A lisper can read code with -> and, if familiar with the functions called inside it, guess what it does.

21:44 gfredericks: so you've got two different syntactic things going on

21:45 I 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:47 frozenlock: gfredericks: found it :) http://thesingularity.pl/blog/2010/writing-binary-files-in-clojure-the-recipe/

21:47 amalloy: zakwilson: i think your arguments all apply to -<> though, so far

21:47 frozenlock: Thanks for showing me the way!

21:47 emezeske: gfredericks: The -<> wand uses the same symbol "<>" to refer to completely different values in the same expression. That seems pretty unfortunate.

21:48 gfredericks: frozenlock: that guy is quite an indenter

21:48 frozenlock: Indeed

21:49 gfredericks: emezeske: 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:49 amalloy: i suspect -<> also doesn't nest usefully, whereas ->, ->>, and doto can all live together in harmony

21:50 fil512: what's the best way to format a float?

21:51 gfredericks: fil512: format should work

21:51 amalloy: well certainly -<> inside -> would work as expected

21:52 -<> inside -<> is questionable, but is there a reason you'd want to do such a thing?

21:52 the fact that ->> is useful inside -> is precisely because you're not using -<>

21:55 devn: wait a fucking second here

21:55 -<> ?

21:56 gfredericks: devn: planned for inclusion in clojure 1.8

21:56 devn: lol

21:57 As long as we're getting crazy, why not: (-=<->=- ...)

21:57 gfredericks: clojure.core.sugar

21:58 devn: because that function never comes up in practice

21:58 devn: or (-<-_->- ...)

21:58 haha

21:58 gfredericks: and -<-_->- was poorly designed to begin with

21:59 fil512: I'm struggling with hiccup.

21:59 http://tinypaste.com/44eb5acb

22:00 My two [:td] in the for loop

22:00 it only prints the first [:td]

22:00 gfredericks: fil512: ah ha

22:00 I've seen that mistake before

22:00 fil512: ?

22:00 gfredericks: actually I'm curious why that even compiles; I thought for only accepted a single body form

22:01 fil512: I wondered about that too

22:01 it does compile

22:01 gfredericks: in any case I think you should bring the tr inside the for

22:01 fil512: but I need the [:th host]

22:01 gfredericks: you'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:01 fil512: yeah bring that in too

22:02 fil512: but then wouldn't it repeat?

22:02 gfredericks: wait

22:02 hmm

22:02 okay nm

22:02 * gfredericks ums

22:02 fil512: I tried putting [] around the two

22:02 gfredericks: so you're going for alternating TDs?

22:02 fil512: but it didn't like that

22:02 ya

22:03 gfredericks: probably you will have to do something as complicated as however you would obtain such a sequence in a normal context

22:03 you could build it into the for :/

22:03 might be ugly

22:04 (for [[week value] host-results, x [(string/join " " week) (format "%.1f" value)]] [:td x])

22:04 fil512: ah

22:04 gfredericks: else maybe you could use interleave

22:04 fil512: i see

22:04 interesting

22:04 emezeske: fil512: You probably need to do something equivalent to (concat (for [...] [stuff1 stuff2]))

22:05 gfredericks: emezeske: concat with 1 arg is identity, no?

22:05 apply concat maybe you meant

22:05 emezeske: Err, (apply concat ...)

22:06 fil512: concat did wierd stuff to the :td

22:08 lynaghk`: emezeske: did you see the issue I raised about js externs/libs in dependencies with cljsbuild?

22:08 fil512: i kind of want a flatten operation

22:09 like is there something that takes [[a][b]] and turns it into [a][b]

22:09 lynaghk`: fil512: hiccup will explode children seqs in place, so the effect is the same

22:10 emezeske: lynaghk`: Yeah, that is something that I've wanted for a long time

22:10 lynaghk`: I have been noodling on it today in the back of my head

22:11 lynaghk`: I need to noodle some more before I can provide any useful input :)

22:11 lynaghk`: 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:11 otherwise everyone's first taste will be, "uh, dumb. doesn't work" = )

22:11 emezeske: Yeah, that is a PITA.

22:12 I'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:12 But I'm not sure how dependent projects would find that metadata file

22:13 fil512: no, 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:13 lynaghk`: emezeske: I think the simplest approach would be to just have a default path that automatically gets sucked in

22:13 emezeske: lynaghk`: Yeah, that's what I'm thinking, but cljsbuild still needs to know the root component of that path

22:13 lynaghk`: e.g., libs is prepopulated with "js-lib"

22:13 emezeske: lynaghk`: Like "c2/resources/cljsbuild-info.clj" or whatever

22:13 lynaghk`: does it? I thought the entire classpath was flattened.

22:14 emezeske: It is, but if multiple cljs libs supply js metadata info

22:14 fil512: is there a way I could escape the two tds inside the for loop and then unescape them outside?

22:14 emezeske: in the same file, they would stomp on one another

22:14 lynaghk`: 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:15 emezeske: lynaghk`: Oooooh

22:15 lynaghk`: But you can't list directories in JARs

22:15 lynaghk`: So the compiler can't know what's in js-lib/

22:15 lynaghk`: I'm not sure if there will be stomping within ClojureScript compiler or Closure compiler, thougm

22:16 emezeske: really? I've been getting away with just saying :libs ["path"] to get everything in path/*.js sucked in

22:16 emezeske: lynaghk`: That works if path is local

22:16 lynaghk`: I'm pretty sure it doesn't work if path is in a JAR

22:16 lynaghk`: I'd be happy to be proved wrong though

22:16 lynaghk`: I'm pretty sure it works, because you can suck cassowary-coffee in as a dependency and it works fine.

22:17 (after you say, :libs ["cassowary"], of course.)

22:17 emezeske: Huh, I'll have to dive into the compiler to see how that works

22:18 amalloy: fil512: (list [:td ...] [:tr ...])

22:19 lynaghk`: 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:21 emezeske: lynaghk`: 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:22 lynaghk`: BTW, I just found how the compiler lists the libs dir

22:22 lynaghk`: 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:22 emezeske: which might get pretty damn confusing.

22:22 emezeske: lynaghk`: Oh, yeah, maybe resources/js/libs resources/js/externs? I dunno

22:23 xeqi: &(apply concat [:tr [:th "host"]] (for [[week value] [[1 2] [3 4] [5 6]]] [[:td\ week] [:td value]]))

22:23 lazybot: java.lang.RuntimeException: Unsupported character: \ week

22:23 xeqi: &(apply concat [:tr [:th "host"]] (for [[week value] [[1 2] [3 4] [5 6]]] [[:td week] [:td value]]))

22:23 lazybot: ⇒ (:tr [:th "host"] [:td 1] [:td 2] [:td 3] [:td 4] [:td 5] [:td 6])

22:24 xeqi: fil512: do you want something like ^

22:24 emezeske: lynaghk`: Cool, it looks like the compiler recurses both :libs and :externs

22:24 lynaghk`: 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:25 but maybe that's overthinking it.

22:25 emezeske: lynaghk`: Yeah, js is a bad choice

22:25 lynaghk`: emezeske: how do you mean?

22:25 fil512: gtg. thanks xeqi--i will try your suggestion later

22:25 emezeske: lynaghk`: I just mean that it works the same way with :externs that it does with :libs, which is cool

22:25 lynaghk`: ah, yep.

22:26 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:26 emezeske: lynaghk`: I like it

22:27 lynaghk`: 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:28 emezeske: lynaghk`: 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:28 lynaghk`: emezeske: got some baller cljs DOM stuff coming out soon = )

22:28 emezeske: lynaghk`: I look forward to seeing it!

22:28 lynaghk`: Maybe update the github issue with a summary of what you're doing

22:28 lynaghk`: Should be easy for me to add support

22:28 lynaghk`: emezeske: convention should be to namespace with project name, similar to how src/ is handled.

22:28 emezeske: lynaghk`: That works!

22:29 lynaghk`: Also, let's call this super-alpha-level stuff, and not advertise it until we test it a little

22:29 lynaghk`: I.e. get it right before getting other people to use it

22:30 lynaghk`: emezeske: super alpha is my middle name, evan.

22:30 emezeske: lynaghk`: rofl!

22:37 lynaghk`: still there?

22:38 lynaghk`: nm, I'll just update the issue

22:57 anonas451: hello. How to print like this on one line: "starting bigcalc... [time passes here and "starting bigcalc"is already visible ] took 3456.000 msecs" ?

22:57 (flush) seems to force a new line

22:58 gfredericks: anonas451: you're using println instead of print?

22:58 anonas451: printf

22:59 gfredericks: man I always forget that exists

22:59 amalloy: flush definitely doesn't print a newline

22:59 gfredericks: well printf just uses print. So it's not clear why you're getting any newlines

23:00 * gfredericks tries really hard to turn amalloy's statement into a toilet joke but fails

23:00 anonas451: hmm... could it be that it happens only in REPL? but not if I run it in shell?

23:00 gfredericks: it might be the the repl output is mixed with other output to give you the impression there's a newline

23:04 anonas451: ok. that was it... in shell it works fine, thank you for help.

23:08 archaic: I 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:08 any advice much appreciated

23:32 tomoj: node-clojurescript's readme says "Modules developed in ClojureScript should be published with _only_ compiled JavaScript loaded at runtime (via NodeJS's require)."

23:34 but 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:54 lynaghk`: emezeske: what's the best way to test lein cljsbuild from git?

23:55 emezeske: and/or do you want to push a build to clojars for me? = )

Logging service provided by n01se.net