#clojure log - Sep 04 2011

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

0:02 amalloy: technomancy: hey, glad to see i'm not the only one getting use out of clojurebot's "zip" spiel

0:03 technomancy: amalloy: making clojurebot earn its keep

0:04 amalloy: (def clojurebot (memoize technomancy))

0:05 technomancy: hehe

0:13 cemerick: not ignoring your post to the lein list; I promise. =)

0:14 just too much stuff in that post for me to address with my strangeloop talk still hanging over my head

0:15 that said, having a separate list of repos for deployment vs deps sounds great and I'd take a patch for that even before 2.0 without much further discussion

0:15 user317: is there an equivalent to haskells . operator? so i can do something like (x . y z) === (x (y z))

0:15 technomancy: (doc comp)

0:15 clojurebot: "([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."

0:15 cemerick: Whew, I thought my 'r' key was going to break from the ⌘-R keystrokes every 5 minutes… ;-)

0:15 technomancy: user317: ^^

0:16 hehe

0:16 user317: I think anyway, I haven't used haskell myself

0:16 amalloy: give the man a cigar

0:16 cemerick: technomancy: I'll see what I can do about the separate deployment repos sooner rather than later.

0:16 user317: hehe, the blind leading the blind

0:17 technomancy: that'd be super

0:17 * cemerick didn't realize technomancy was talking @ strangeloop

0:17 amalloy: &(let [f (comp inc +)] (f 5 6))

0:17 lazybot: ⇒ 12

0:17 cemerick: looking forward to it

0:17 technomancy: cemerick: it's one of the workshops on sunday rather than a regular talk

0:17 and it's on Emacs =)

0:17 user317: so (x (y z)) === ([x y] z) ?

0:17 cemerick: ah, that's why I didn't notice (on both counts! :-P

0:17 technomancy: I'm sure you'll be in the front row taking notes

0:18 amalloy: user317: no

0:18 cemerick: I didn't sign up for any workshops. Nothing really tickled my fancy.

0:18 user317: oh i see, nm

0:18 cemerick: At least, not enough to be away for the entire weekend.

0:18 amalloy: (x (y z)) === ((comp x y) z)

0:18 technomancy: I might have gone to the machine learning one if it hadn't been in the slot immediately preceeding mine

0:18 user317: yea, makes sense, its my second day playing around with clojure, i still get easily lost in the syntax :)

0:20 so are record access functions, functions?

0:20 (:foo bar), is ":foo" a real function?

0:20 amalloy: &(fn? :foo)

0:20 lazybot: ⇒ false

0:20 amalloy: &(ifn? :foo)

0:20 lazybot: ⇒ true

0:20 cemerick: user317: keywords (and symbols) implement IFn, the root function interface in Clojure's backend. So, yes, they are functions.

0:21 You could implement a Clojure function in Java or Ruby or Scala, if you so chose to.

0:21 user317: ok, cool

0:21 is ruby on java heavily used?

0:22 cemerick: quite, yes; JRuby, that is

0:22 user317: cool, i haven't used ruby in a loooong time, glad its still kicking around, i always thought it was cleaner then python

0:22 * cemerick knows a number of Rubyists that use JRuby almost exclusively at this point

0:29 user317: so is this a bug in lein? when i run an interactive shell and rerun the test command it doesn't build my sources if i change them

0:30 also, it hangs when it cant resolve a symbol

0:30 technomancy: user317: there's a (require 'foo :reload) call in tests in the latest release

0:31 there may have been a bug where it was missing in an earlier version

0:31 cemerick: technomancy: FYI, I think I'm probably 80% through a spike of a deploy-to-central plugin.

0:32 It would've been a one-afternoon job, but the bleeding got too bad near the end. Had to send for medics.

0:32 technomancy: cemerick: cool, so something that handles signing and the rest?

0:32 user317: cool, thanks, ill check it out

0:32 technomancy: user317: lein interactive is certainly not as well-tested as the integration with various editors though

0:33 cemerick: mvn's (via the ant tasks) is doing all the heavy lifting. There's (IIRC) some very nasty skeletons around the gpg signage that central expects; not using mvn's gpg plugin as dictated by the OSS parent POM is not something I have a lot of interest in exploring. ;-)

0:34 technomancy: ah, gotcha

0:40 cemerick: hrm, maybe it was older versions of maven that fell down on the signing…

0:40 "Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums respectively." Nice!

0:42 amalloy: cemerick: signatures are for sissies anyway

0:42 cemerick: amalloy: duly noted!

1:38 user317: is there partial function application?

1:39 duh, partial :)

1:50 how do i transpose a list of lists? not just (map list ls1 ls2) but (map list (list ls1 ls2))

1:52 amalloy: &(doc apply)

1:52 lazybot: ⇒ "([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."

1:53 amalloy: i was going to say, doesn't haskell have apply? but i guess it can't

1:53 user317: yea, it cant, unless you use generics

1:54 which, imho, if you are you are doing something wrong :)

1:58 &(map (partial apply list) (list '(1 2 3) '(4 5 6)))

1:58 lazybot: ⇒ ((1 2 3) (4 5 6))

1:58 user317: oh wait, nm

1:59 &(apply (partial map list) (list '(1 2 3) '(4 5 6)))

1:59 lazybot: ⇒ ((1 4) (2 5) (3 6))

2:04 amalloy: user317: not that using lists is a crime or anything, but vectors have a more convenient literal syntax. plus, using lists for (mostly) code and vectors for (mostly data/bindings) provides useful visual cues

2:05 &(apply (partial map list) [[1 2 3] [4 5 6]]) ;; easier to write and read

2:05 lazybot: ⇒ ((1 4) (2 5) (3 6))

2:11 user317: amalloy, thanks, ill keep it in mind, i think my code looks like its translated from haskell :)

2:11 do lets get evaluated or are they only evaluated if the branch is taken

2:11 amalloy: point-free style loses something in the translation; clojure's syntax doesn't make it as pretty

2:13 user317: yea, i think so, but i am starting to like it, like the chains of static typing have been lifted :)

2:13 amalloy: *chuckle*

2:13 alas, hoogle has abandoned you

2:13 user317: its like riding a volvo vs a motorcycle at night drunk and without a helmet

2:14 amalloy: hm. which language is which, here?

2:14 user317: well, haskell is really safe

2:14 on accasion your program blows up in memory for no reason, but beyond that once you compile you are basically done

2:16 amalloy: i've only dabbled in haskell, but the number of clojure programs that are Right The First Time is a lot higher than, say, java or C programs

2:17 user317: yea, i think thats common to functional languages all around

2:17 amalloy: i'm happy to believe that this is even more true for haskell, but having made a living with C, Java, and now Clojure, i'd say Clojure is the best at being predictable

2:17 user317: haskell is lazy evaluated, which makes reasoning about memory usage really difficult

2:18 amalloy: not just memory, but stack too, right?

2:19 user317: yea, its a similar problem, the stack or the heap blows up when you have some infinite data structure that you are trying to evaluate completely

2:19 like a foldl on an infinite list vs a foldr

2:20 amalloy: you can get into similar situations with clojure's lazy sequences

2:20 even though the language itself is eager, the laziness of sequences, while useful, is occasionally surprising

2:20 user317: yea, i am sure, its a great abstraction though, unfortunately nothing is bulletproof

2:21 amalloy: clojurebot: haskell?

2:21 clojurebot: haskell is Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you don't compute.

2:22 user317: hehe

2:22 ambrosebs: lol

2:22 amalloy: heh. i haven't heard that one before

2:23 clojurebot: scala?

2:23 clojurebot: {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}

2:23 amalloy: good stuff

2:23 cemerick: mm, there's that new one…

2:24 user317: heh

2:25 amalloy: clojurebot: now you've got me curious. what do you know about python?

2:25 clojurebot: python is ugly

2:25 cemerick: clojurebot: scala is val foo = bar ~-> 45 <~< "Fred" %% x

2:25 clojurebot: In Ordnung

2:25 user317: clojurebot: what do you know about lua?

2:25 clojurebot: Titim gan éirí ort.

2:25 cemerick: almost the same knock against ruby tho…

2:26 * cemerick ducks

2:26 amalloy: user317: i think we just got lucky that he guessed i was asking about python

2:26 clojurebot: lua?

2:26 clojurebot: Excuse me?

2:26 amalloy: well, i guess now's your chance to teach him something

2:27 user317: haha

2:27 amalloy: $google funny lua code

2:27 lazybot: [Loading Lua code dynamically for fun and profit (on-calc Lua editor)] http://www.omnimaga.org/index.php?topic=9178.0

2:29 cemerick: clojurebot: python is "I think dropping filter() and map() is pretty uncontroversial…" — GvR

2:29 clojurebot: You don't have to tell me twice.

2:29 hiredman: clojurebot does try and pull the subject of sentences out via parts of speach tagging using https://github.com/dakrone/clojure-opennlp

2:29 amalloy: hiredman: nice

2:30 cemerick: I should stop. I'll blow clojurebot's heap if I load up all the winners I've seen from GvR.

2:30 amalloy: i'd love to teach clojurebot that lua is http://www.facepunch.com/threads/993206-PointMod-Bad-lua-code-PointMod - but this looks like a guy who could write bad code in any language

2:30 doesn't clojurebot have a database backend???

2:30 lazybot: amalloy: How could that be wrong?

2:30 wdkrnls: Hi, I am trying to setup SLIME. I installed lein, elpa, swank-clojure and slime packages as well as clojure-mode, but slime never connects.

2:30 hiredman: yes

2:31 cemerick: amalloy: joking, my man, joking :-)

2:31 amalloy: hiredman: sorry, i guess with lazybot on /ignore you don't get the joke. he jumps in to respond in the positive if you end a question with ??? (and ?? is negative)

2:31 cemerick: heh, I didn't get the joke either :-P

2:32 lua's used as the scripting lang for so many gaming engines that there's a *lot* of bad lua out there to mock, if one is so inclined.

2:32 amalloy: ah, my highbrow humor is lost on the #clojure crowd

2:33 cemerick: The extra two ?s make it highbrow?

2:33 Maybe that indicates a british accent?

2:33 hiredman: I've been thinking it might be interesting to figure out the subject of sentences and keep per subject markov models for generating responses

2:34 amalloy: "i want to concat two lists into another list? please, anyone help me, is it possible???" - i've just noted that people who ask a question with three ???s are usually crazy, so giving them a bot response seems appropriate

2:36 cemerick: Maybe reply with, "Why, yes, Prime Minister!"

2:36 Probably too on the nose.

2:37 amalloy: cemerick: happy to add that to the list of positive responses :P

2:39 user317: does apply come from lisp?

2:40 amalloy: yes

2:41 eventually, everything but fortran comes from lisp

2:47 currentB: Hi everyone, I kind of have a design related question:

2:48 I'm building a sort of toy shopping cart web app (based losely on http://kylebanker.com/blog/2010/04/30/mongodb-and-ecommerce/) , using Mongo as a DB, with congomongo to use it from clojure.

2:50 so a cart is represented by a mongo document, which would basically translate to a hash map in clojure, with containing a key :line-items, with value [{:name "item1" :price 5}{:name "item2 :price 3} ...]

2:51 eh, each line item would also have a :qty also

2:51 I'm unsure how to go about updating items, which will need to be done fairly often

2:52 is it better to write a few functions the find the items based on :sku (this would also be in each item), update it and return the new vector, and thus update the mongo document

2:53 or to go lower level and do it using custom mongo queries

2:53 or is this a stupid question and it doesn't really matter

2:53 amalloy: they both seem like dumb approaches

2:53 currentB: what's a good one?

2:53 amalloy: make a shopping cart just contain SKUs and quantities

2:53 then you can change the "properties" of a SKU with a single write to one place

2:54 hiredman: eventing sourcing seems aim square at that sort of thing

2:54 currentB: hmmmm

2:55 hiredman: the state of the cart is derived from a series of events starting with create cart id=x, add item x to cart id=x, ...

2:56 actually the last event sourcing presentation I saw used a shopping cart as an example

2:56 http://www.infoq.com/presentations/Events-Are-Not-Just-for-Notifications

2:56 currentB: sweet I'll watch that thanks!

2:57 and amalloy, do you mean have a mongo doc that just looks more or less like {"sku123" 2 "sku3123" 5}

2:58 amalloy: *nod*

3:01 currentB: or I guess something like {"sku123" {:name "item1" :qty 5}...} } to avoid looking up names each time, and stuff like shipping info could be elsewhere

3:02 hiredman: *shrug* doing a lookup by key (sku) can be made very fast

3:02 and cached since sku=>item mapping shouldn't change

3:02 amalloy: i agree. if you want to cache stuff, cache stuff. don't pollute the data model

3:03 currentB: k

4:25 lobotomy_: jkkramer: you're right - simply adding (set ... ) to remove-threatening-squares fixed the problem

4:27 obviously that should have been returning a set all along - apparently the reason why things still worked is because initially i create a bunch of sets, and i guess those often but not always remained sets :)

5:44 hmm, when i'm typing code in emacs, on the status line it shows a completion hint (that is, function definitions with args)

5:44 but occasionally it stops showing that. how do i make it resume showing that?

6:15 oh, it seems there was a forgotten window with some exception, waiting for input. my bad ;)

6:28 Netpilgrim: Hi. In the code at https://gist.github.com/1191537 the pre conditions are ignored. Could someone look at it and tell me what's wrong with it?

6:49 wunki: ough, struggling with paredit mode..

6:52 aamar: Netpilgrim: in the example, you're calling the code with 2 args, and there's no :pre condition on that case.

6:52 no, I'm wrong... ignore that.

6:54 Netpilgrim: aamar: Thanks for looking at it.

6:56 raek: maybe defrecord does not "support" pre and post conditions

6:59 Netpilgrim: raek: I'll look into it.

7:06 raek: You seem to be right. When I define the very same function outside the defrecord (https://gist.github.com/1191537) the pre conditions work.

7:08 aamar: Netpilgrim: mentioned here: http://groups.google.com/group/clojure-dev/browse_thread/thread/006678a29f02b212

7:09 even {:pre [false]} seems not to run, so it does seem like the conditions are just ignored.

7:09 extend-type & extend-protocol might be acceptable workarounds?

7:11 Netpilgrim: aamar: Thanks for the info. This is too bad. extend-protocol will work, but according to JoC the performance is worse than if you put the protocol implementation in defrecord.

7:40 kephale: A question to anyone familiar with the destructuring code: is there a way to avoid redundantly typing keys twice if you are supplying default values?

7:40 that is:

7:40 ,((fn foo [& {:keys [b c], :or {b 7, c 10}}] (+ b c)) :b 17)

7:40 clojurebot: 27

7:41 kephale: but sometimes i have a huge map inside the :or clause, and writing the same keywords in :keys seems really redundant

7:44 kof4001: hello

7:44 I can't get slime interaction to work

7:44 i followed http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html tutorial

7:44 and after lein deps and lein swank

7:44 i fire up emacs

7:45 slime-connect

7:45 it connects, but does not evaluate the input

7:45 even after c-x c-e

7:45 Enter only brings a new line

7:46 it does not evaluate expressions

7:46 Well, I guess its still very early in US

7:46 raek: kof4001: that tutorial is very outdated

7:47 kof4001: Where could I get the updated information?

7:47 raek: I recommend http://technomancy.us/149 or http://dev.clojure.org/display/doc/Getting+Started+with+Emacs

7:48 hrm, looks like the tutorial you linked to has been updated

7:49 but you have a lein project, and you use swank and slime, so that's good

7:50 no need to compile clojure though

7:54 kof4001: after i install with lein plugin install swank-clojure 1.3.2

7:54 it does not recognize the M-x clojure-jack-in command

8:15 raek: kof4001: clojure-jack-in is provided by clojure-mode.el

8:16 vini_: Hi, I'm trying to install slimv in my vim, but I'm having problems. Here is my configuration (http://pastebin.com/P53FUfk7)

8:17 when I type "vim teste.lisp", I have no highlight nor slimv commands.

8:17 clojurebot: paredit commands is http://mumble.net/~campbell/emacs/paredit.html

9:18 gfrlog: I've fired up the clojurescript repl twice now and both times it dies and prints "Killed" seemingly without provocation. Is this heard of?

9:19 make that three times

9:25 woah, and then java hosed up my vm

9:25 (out of memory)

12:23 I think I just didn't have very much memory

12:34 edwardruggeri: Does anyone have advice about defining helper-functions within a function?

12:34 I could use let and fn, but I have four or five nested functions I want to declare

12:35 I could use defn inside the function, but that exposes implementation details

12:39 kephale: ,(doc letfn)

12:39 clojurebot: "([fnspecs & body]); fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+) Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body."

12:41 edwardruggeri: Hmm, thanks keyhole; that might work

12:41 But I don't know if I want to declare complicated functions inside a let/letfn

12:41 On the other hand, maybe I misunderstood fn

12:42 Looks like it is not side-effect free; you can supply a name

12:42 keyhole = kephale

12:42 kephale: do your helper functions have side-effects?

12:42 gfrlog: edwardruggeri: I think using let and a bunch of fns is pretty common. what don't you like about it?

12:43 edwardruggeri: Well, imagine if all this code were written in a let:

12:43 (defn make-fixed-tasks [recurring-task interval]

12:43 (def ival-end (.getEnd interval))

12:43 (defn day-fits [current-date-time]

12:43 (contains? (:days-of-week recurring-task) (.getDayOfWeek current-date-time)))

12:43 (defn make-task-interval [current-date-time]

12:43 (let [task-start-date-time (.withFields current-date-time (:start-local-time recurring-task))

12:43 task-end-date-time (.plus task-start-date-time (get-task-duration recurring-task))]

12:43 (Interval. task-start-date-time task-end-date-time)))

12:43 (defn next-midnight [current-date-time]

12:43 (.withFields (.plusDays current-date-time 1) LocalTime/MIDNIGHT))

12:43 (defn day-fits [current-date-time]

12:43 (contains? (:days-of-week recurring-task) (.getDayOfWeek current-date-time)))

12:43 (defn maybe-add-task [fixed-tasks current-date-time]

12:44 (if (day-fits current-date-time)

12:44 (let [task-interval (make-task-interval current-date-time)]

12:44 (if (.overlaps (Interval. current-date-time ival-end) task-interval)

12:44 kephale: aaaaa

12:44 gfrlog: when your let gets too big, maybe it's time to make it all a separate namespace?

12:44 since you're concerned about not exposing too many functions

12:45 edwardruggeri: Fair. Thanks a lot gfrlog, kephale.

12:45 gfrlog: yep

13:33 srid: wish there was way to find all "clojure projects depending on the FOO library". this would enable me identify projects using core.match so I get to see how real projects make use of (match ...)

13:48 fliebel: srid: I think you might be able to execute a smart search query on GitHub

13:53 TimMc: git clone git://github.com/* :-P

14:11 Saturnation: Is there a way to refer to Java this in a :gen-class?

14:15 TimMc: Saturnation: I think the value of "this" is passed explicitly as the first argument to class methods.

14:19 Saturnation: that make sense

14:21 TimMc so the next question is can I implement a constructor in clojure?

14:21 TimMc: http://clojuredocs.org/clojure_core/clojure.core/gen-class

14:21 Saturnation: Thanks!

14:22 was reading that, but hadn't gotten there yet... :)

14:22 TimMc: Saturnation: Although, I think :gen-class in the (ns) statement is preferred.

14:23 fliebel: Uhm, I have the idea cake submodules aren't really working :(

14:29 https://github.com/flatland/cake/wiki/Subproject-Dependencies

14:31 So, I added subproject.masai = /Users/pepijndevos/git/masai to the jiraph project, and updated the jiraph project.clj to reflect the version in the masai project.clj, but it still tries to fetch it from clojars.

14:33 In fact, it seems to completely ignore my .cake/config file.

14:36 Can I add something clearly visible in there to confirm that?

15:10 kiras: i have mostly used vim/emacs/cake/leiningen for clojure so far, but decided to try counterclockwise. this may be the wrong place to ask and this question may have been answered several times before, but i haven't had much luck finding an answer so far, so hopefully someone here can help me. basically, when using lein/cake and version control, i don't have to put .jars in the repository, since lein and cake can gather dependencies. is

15:10 this true for whatever counterclockwise clojure projects are using as well?

15:12 maybe i phrased that poorly... basically, if i'm using counterclockwise, do i need to put .jars in version control or is it possible to have whatever build system is in use (ant? maven?) gather those automatically, like lein and cake do?

15:14 jeremyheiler: Why would you not just use lein or cake? It looks like counterclockwise isn't meant for dependency management.

15:16 mindbender1:

15:18 kiras: jeremyheiler: i'm not sure what you mean, exactly. are you saying not to use counterclockwise at all, or are you suggesting using counterclockwise together with lein/cake?

15:19 jeremyheiler: I didn't say not to use counterclockwise. I took a look at the counterclockwise website and it doesn't look like depenency management is a goal.

15:22 kiras: i didn't mean to imply that counterclockwise would handle dependency management itself, just thought that maybe whatever system it was using to build projects might do it and i just wasn't aware of how to use it yet.

15:25 jeremyheiler: Ah, I see. Are you able to point the "build path" in counterclockwise like you would with a normal Java Eclipse project? If so, you could just point it to whatever directory the build/dep management system you use. Either way, it might be better to ask on their user group: http://groups.google.com/group/clojuredev-users?pli=1

15:30 kiras: jeremyheiler: that may work. i've never really done any java coding before, so my knowledge of java/eclipse/etc. isn't really there. there's actually a guide to using lein with counterclockwise, but i wasn't sure i wanted to go that route since i have a feeling there isn't much IDE support for it yet.

15:30 srid: re - finding '(match ...)' use in github. how would you refine this? https://github.com/search?type=Code&language=Clojure&q=%22%28match+%22&repo=&amp;langOverride=&x=0&y=0&start_value=1

15:54 michaelr525: hey!

15:54 gfrlog: hey!

15:54 jeremyheiler: hey!

16:12 akov: is there anyway i can 're-'use a namespace so i can change code then interact with the updated code without restarting my repl instance?

16:13 michaelr525: akov: you just have to define it again, or (load-file) if it's in a file..

16:15 raek: akov: (require 'the.name.space :reload)

16:15 akov: the require thing does it, thanks guys

16:15 raek: there is also :reload-all

16:21 michaelr525: The architecture described here seems like a good generic design for collecting lot's of data and producing reports from it. I'm talking mostly about the batch part. http://www.readwriteweb.com/hack/2011/01/secrets-of-backtypes-data-engineers.php

16:22 What do you think?

16:41 kjeldahl: Weird. "lein repl" works fine. "lein run" runs fine. "lein test" fails with error about "initialize" already refers to something else, although none of the test code pulls in modules differently from the rest of the code (or have anything named initialize). Any special behaviour I need to know about when using clojure.test?

17:03 Definitively something wonky with clojure.test; renaming the intialize method in a model source file solves it. Considering I never use that module without pulling it in with ":as something", it seems clojure.test somehow disregards the namespace when pulling things together. Oh well.

17:06 ibdknox: kjedahl: can you gist your ns declaration for that test file?

17:08 kjeldahl: https://gist.github.com/1193515 Both betapp modules have an initialize method when it doesn't work. Renaming initialize to matches-initialize in the betapp.models.matches makes it work of course.

17:08 ibdknox: kjeldahl: you shouldn't use those

17:08 kjeldahl: you need to require them

17:09 kjeldahl: I think I tested that as well, but I'll give it another try.

17:09 ibdknox: kjeldahl: when you do (:use) you're essentially telling the compiler to put all of the symbols in those files into the context of this one

17:09 kjeldahl: which means all of those "initialize" functions will collide

17:10 kjeldahl: Looks like you nailed it, thanks. Sloppy of me.

17:41 TimMc: Hmm, I think the example in https://github.com/swannodette/match/tree/ under "As Patterns" is wrong.

17:42 Shouldn't that return [:a1 2 [1 2]]?

17:47 (I tried testing it, but match errors out.)

17:48 amalloy: TimMc: looking at it, i agree, but i don't know anything about match really

19:56 hah. 1.3 added funcall, except they called it deliver and pretend it's for use with promises: (defn deliver [promise val] (promise val))

19:57 i guess that was the 1.2 impl too, i just never noticed

20:11 TimMc: amalloy: That would be awesome for use in an obuscated clojure contest.

20:12 amalloy: &(deliver inc 1)

20:12 lazybot: ⇒ 2

20:12 amalloy: GENIUS

20:12 TimMc: &(apply inc 1)

20:12 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

20:12 TimMc: :-( oh right

20:13 amalloy: TimMc: but it's easy to define funcall in terms of apply

20:14 &(let [funcall (fn [f & args] (apply f args))] (funcall inc 1))

20:14 lazybot: ⇒ 2

20:30 * gfrlog stares at amalloy's funcall looking for a simple point-free version

20:34 gfrlog: best I could get is (def funcall (comp (partial apply apply) (juxt first rest) list))

20:34 which is of course terrible

20:35 amalloy: gfrlog: i see you've reached a valuable conclusion about point-free style

20:36 gfrlog: amalloy: so what is juxt used for then? :P

20:38 amalloy: c'mon, how can you not love ##(map (juxt identity (partial * 2)) (range 5))

20:38 lazybot: ⇒ ([0 0] [1 2] [2 4] [3 6] [4 8])

20:39 gfrlog: (for [x (range 5)] [x (* 2 x)]) has 94 fewer characters

20:39 amalloy: for less trivial functions than (partial * 2), i use that all the time

20:39 and i've pulled (juxt identity foo bar baz) into (decorate foo bar baz)

20:40 gfrlog: There should be a convenience method that lets you juxt all the function-vars in a namespace

20:40 amalloy: I bet there's a good pop-psychology name for that one

21:27 mudge: hey, I'm doing some work with sockets and I found that Clojure has several IO libraries that seem similar so I was wondering which one I should use for my case

21:29 there's clojure.io.java, there's clojure.contrib.duck-streams, there's clojure.contrib.io, which one should I use for writing sockets?

21:30 amalloy: don't use anything that has "contrib" in it, if something else will do

21:31 mudge: amalloy, so then clojure.io.java

21:31 amalloy: well. c.j.io

21:32 mudge: what's c.j.io ?

21:32 amalloy: clojure.java.io

21:32 you're getting the order wrong

21:32 mudge: oh i see, yea

22:13 tomoj: https://gist.github.com/1a5f9767b2733e7a81b8 - getting a "Cannot set property 'Unicode' of undefined" error here on nodejs. any ideas?

22:13 think this must be part of the standard clojurescript output?

23:53 technomancy: amalloy: whoa I never noticed that about deliver

23:53 I totally would have used that in my bbq directions

Logging service provided by n01se.net