#clojure log - Jul 26 2011

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

0:08 dnolen_: for the those people that have been digging into ClojureScript, how to remove the use of js*, this macro always seems to throw an error after looping in node.js. https://gist.github.com/1105953

0:09 sorry two parts, 1) how to remove js* 2) why the error after loop?

0:09 loop/recur code emitted by ClojureScript seems crazy slow.

0:09 but that's another point.

0:10 qed: dnolen_: there are design discussions afoot about removing the need for js*

0:10 dnolen_: qed: yeah I'm aware of those, I'm curious as to why js* works here an not (js/Date.)

0:11 rimmjob_: hypothetically, could a clojure compiler be written that spits out java source code instead of bytecode?

0:11 gregh: you could use a java decompiler

0:11 though it would be *not pretty*

0:12 devn: dnolen_: could you elaborate?

0:12 dnolen_: ah, sorry, missed the gist

0:12 dnolen_: rimmjob_: early, early versions of clojure did that, and generated JS before that.

0:13 amalloy: rimmjob_: theoretically, a clojure compiler can do nearly anything. in practice, you still have to write java code in order to get java code

0:28 technomancy: rimmjob_: mirah does that

0:28 it has two output modes, bytecode and source.

0:30 devn: dnolen_: I have no immediate answer to the problem of that js* call, specifically in node.

0:32 rimmjob_: technomancy: thanks, ill start playing with it

0:33 technomancy: hm; I never thought of it that way, but it could be useful for school assignments where java source is required.

0:34 it's not too big of a leap from having an IDE fill in methods to having a compiler generate them from a better language.

0:34 after all, what is an IDE but a compiler that turns clicks and keystrokes into source code?

0:36 amalloy: technomancy: a language that is "better" enough for this to be a meaningful exercise is unlikely to translate into nice java

0:36 qed: rimmjob_: why the incendiary nickname? It kind of sucks, no offense.

0:36 It colors everything you say in this channel with some nasty garbage.

0:36 rimmjob_: its the name on my birth certificate

0:37 technomancy: amalloy: mirah is pretty close, actually. it has no runtime, so the only differences are nicer syntax, type inference, and converting closures into anonymous inner classes.

0:37 qed: rimmjob_: If my name was "Pussy Fart" I wouldn't make a habit of making it my nickname. It's gross and you should change it IMO, that is all.

0:38 rimmjob_: thats very rude

0:41 amalloy: if your goal is to improve the language in this channel (which is generally quite family-friendly), you're not doing very well, qed

0:43 qed: amalloy: It's not language; It's common decency. No, I would not like to have a conversation with someone whose moniker is rimmjob.

0:44 amalloy: then don't. the internet is the internet; in having a discussion about it you've brought it to everyone's attention and brought in some more words nobody is excited to hear

0:46 qed: amalloy, I won't after this. You can be sure of that.

0:53 zakwilson: Is there something in a popular library that converts Clojure maps to query strings?

0:53 dnolen_: lots of optimization opportunities in ClojureScript source generation ...

0:54 hiredman: I am shocked

0:54 dnolen_: does closure optimize them all?

0:54 amac: ClojureScript still has new car smell, give it some time to break in

0:55 dnolen_: hiredman: it doesn't make ClojureScript faster at all.

0:55 hiredman: just smaller?

0:55 you're not testing on rhino are you?

0:55 dnolen_: hiredman: node.js

0:55 * hiredman hasn't actually done anything with clojurescript

0:56 * amac hasn't either

0:56 dnolen_: hiredman: most just smaller from what I can tell.

0:56 devn: I have, but nil with node as of yet.

0:56 hiredman: I decided I wanted a clojurescriptable browser so I started reading objective-c cocoa docs and figuring out how to launch webkit

0:57 https://github.com/hiredman/webber

0:57 devn: hiredman: cool

0:57 hiredman: (very much a yak shave)

0:57 devn: hiredman: no matter, cool.

0:57 technomancy: hiredman: did you give up on compiling to conkeror?

0:57 dnolen_: for example ClojureScript uses the arguments object for multi arity fn dispatch, for even low level predicates, big perf hit.

0:58 hiredman: technomancy: conkeror is not the same, like I really just want something really minimal that exposes the pieces and build it up with js

0:58 dnolen_: I think the first hackernews comment I saw mentioned that

0:58 technomancy: yeah, too bad chromium's extension mechanism is batshit insane.

0:59 devn: technomancy: :)

0:59 hiredman: I need to figure out reflection in objective-c then I'll be able to do everything from js

1:00 technomancy: I don't have the patience to reimplement ido and hit-a-hint

1:01 hiredman: me neither, webber is destined to go no where

1:01 amalloy: dnolen_: i thought i read in someone's (chouser?) blog post that closure does the arity disambiguation for you

1:01 dnolen_: amalloy: I haven't seen anything like that in the generated source.

1:02 amalloy: dnolen_: http://blog.fogus.me/2011/07/21/compiling-clojure-to-javascript-pt1/

1:02 hiredman: but once you start writing code it's hard to stop and suddenly it's 3am saturday morning

1:02 amalloy: which might be exactly what you're saying? i'm not well-versed in js

1:02 technomancy: hiredman: you mean like http://wondermark.com/730/ ?

1:02 dnolen_: amalloy: there's no arity optimization going on there.

1:03 hiredman: just like that

1:03 Pupeno: I'm doing (ns timda.main (:use (timda.core)), but when I do (timda.core/blah) I get an error saying: Exception in thread "main" java.lang.ClassNotFoundException: timda.core (main.clj:12) when I run leon uberjar… in slime it seems to work.

1:03 hiredman: I found a blog post on the minimal cocoa app with a gui and started from there after some abortive xcode attempts

1:04 Pupeno: What am I doing wrong?

1:04 amalloy: drop the ()s around timida.core

1:05 Pupeno: Thanks.

1:11 dnolen_: removing arguments (by possibly tracking top-level multi-arity fns) and some inlining seems like it would pretty much eliminate a lot of the perf gap.

1:17 amalloy: dnolen_: won't you have to keep all the code anyway, for when you call a function through a function "pointer" rather than a top-level name?

1:18 dnolen_: secret to figuring out what the hell ClojureScript is doing: cljsc foo.cljs {:optimizations :simple :pretty-print true} > foo.js

1:19 amalloy: it would be a simple optimization, people are normally just going to use the top-level name. if there's no entry or it's higher order usage, the fast-path won't be used.

1:20 amalloy: i'm just saying, now you're trading space for time. it sounds like it would be a worthwhile tradeoff, but it's not a feature that would be universally desired

1:21 dnolen_: amalloy: ah but remember that Google Closure can remove the fns that's are used :)

1:21 s/are/aren't

1:21 lazybot: <dnolen_> amalloy: ah but remember that Google Closure can remove the fns that's aren't used :)

1:21 amalloy: hah, from what i hear if you're not careful with closure it will remove both kinds of functions

1:22 dnolen_: amalloy: it depends, right now ClojureScript is 10X slower than just writing it in JavaScript

1:22 for clientside code, I tend to agree, who cares.

1:22 but for scripts or server side stuff, these things matter more I think.

1:26 plus it would kind of cool to have core.logic run at a reasonable speed on clients, some interesting applications if paired w/ local storage there I think :D

1:27 zakwilson: Is there a more idiomatic way to convert a keyword to a string than (subs (str :foo) 1)?

1:27 dnolen_: ,(name :foo)

1:27 clojurebot: "foo"

1:29 devn: ,(keyword (str :foo))

1:29 clojurebot: ::foo

1:29 devn: ,(name ::foo)

1:29 clojurebot: "foo"

1:30 devn: ,(name (keyword (str :foo)))

1:30 clojurebot: ":foo"

1:31 devn: ,::foo

1:31 clojurebot: :sandbox/foo

1:31 devn: ,:foo

1:31 clojurebot: :foo

1:31 * devn goes to bed

1:32 amalloy: i wonder what devn was trying to demonstrate there

1:32 zakwilson: Thank you dnolen

1:32 devn: amalloy: it was interesting is all

1:33 that you could build up something that looks like a namespace qualified keyword but not have the same behavior from name

1:33 amalloy: i know why that is so, but even still it's interesting

1:36 ,(range 1 0 0)

1:36 clojurebot: (1 1 1 1 1 ...)

1:36 devn: ,(range 3 1 -1)

1:36 clojurebot: (3 2)

1:39 tomoj: I didn't think paredit-convolute-sexp would really be useful enough to bind

1:39 ..but I think it is

1:39 devn: tomoj: never used it.

1:39 tomoj: what does it do

1:39 tomoj: it's hard to understand

1:39 it's still hard for me to use, but I use it more and more often

1:39 * devn tries it

1:39 tomoj: just have to get used to noticing when it is what you want

1:40 devn: whoa. weird.

1:40 (name (key|word (str :foo))) => M-x paredit-convolute-sexp => (key(name word (str :foo)))

1:42 (name (keyword |(str :foo))) => M-x paredit-convolute-sexp => (keyword (name (str :foo)))

1:42 crazy...

1:42 tomoj: I had this: (concat (format-opts |opts) bound-opts)

1:42 convolute to bug-free |(format-opts (concat opts bound-opts))

1:42 devn: that's pretty cool tomoj

1:43 i can actually see myself using that regularly also

1:43 amalloy: tomoj: i bound it to M-LEFT

1:43 devn: just need to work it in

1:43 tomoj: :(

1:43 devn: amalloy: that makes sense

1:43 tomoj: I think I need to get used to arrow-key bindings for remote emacs

1:43 I try never to use the arrow keys though..

1:43 amalloy: that's true

1:43 i don't either. i guess i got used to them for paredit, with M-UP and C-RIGHT

1:43 devn: tomoj: I turned them off for a year, so I don't feel guilty anymore :)

1:44 tomoj: I used the non-arrow-key bindings for that paredit stuff, but they don't work in my remote emacs

1:44 devn: good idea

1:44 I was thinking electroshock

1:44 devn: ;; ;; there are no free rides, kiddo

1:44 ;; (global-unset-key [right])

1:44 amalloy: tomoj: it's more useful than you think, btw - it will also work for (try (let [x 1] |(inc x)))

1:44 devn: etc.

1:44 tomoj: amalloy: yeah, I just still don't quite get it

1:44 so I only sometimes see it

1:45 devn: It's like playing Go. :)

1:45 tomoj: every time I use it and it works I'm like hooray

1:45 amalloy: now that i have my number keys and symbols switched, it's hard for me to type (eg), M-2 M-LEFT, or i bet i'd use convolute even more

1:46 tomoj: did you just switch the shift modifier but leave everything in the same places?

1:46 devn: Makes me think M-* is not the right place for convolute, amalloy.

1:46 amalloy: tomoj: i think so? i'm not sure i understand the question

1:46 tomoj: are you qwerty?

1:46 amalloy: devn: it's just typing M-2 that's hard :P

1:46 yeah

1:47 tomoj: ah, there is an alternate dvorak layout with shifted numerals, but the symbols are all different

1:47 amalloy: i work with ninjudd, who i think may have lost his mind when changing everything about his keyboard layout all at once

1:47 * devn rolls his eyes, but smirks

1:47 amalloy: so i didn't do that

1:47 tomoj: heh

1:47 devn: colemak and dvorak be damned. it's a puzzle I don't care to solve, but I applaud those who do.

1:47 tomoj: I switched in high school I think, so qwerty drives me insane

1:48 devn: I'm a keyboard nerd but even I don't have the gaul to switch layouts :)

1:48 tomoj: what's M-2 for?

1:48 amalloy: haha gaul. i love the idea that some french guy could help

1:48 devn: good ole charles

1:48 amalloy: tomoj: same as C-2 - universal argument

1:48 tomoj: holy god

1:49 amalloy: except that C-S-@ doesn't seem to map to C-2

1:49 so i have to switch to using M-

1:49 tomoj: I didn't know it had an argument

1:49 amalloy: tomoj: i found it helpful to think of convolute as: "bubble" the wrapping sexp up by N

1:50 devn: man, the depth of nerdmanship here is...beyond

1:50 tomoj: awesome

1:51 devn: i love it, but i think it's worth noticing

1:51 such a cool community

1:51 <3

1:52 * devn double rainbows

1:52 devn: tomoj: so you use dvorak with emacs?

1:53 amalloy: actually, that's interesting. if i type C-S-@, emacs doesn't even recognize that i typed a key at all, even in "tell me about this key" mode. but C-S-! maps to C-1, no problem

1:53 devn: amalloy: terminal emacs?

1:53 tomoj: devn: everywhere

1:53 amalloy: gnome

1:53 devn: amalloy: odd. I've had C-S-... problems with terminal emacs

1:53 but never with GTK/Nextstep

1:54 amalloy: devn: actually, even in xev, C-S-@ doesn't appear as a key

1:54 devn: amalloy: maybe your keyboard hardware and/or layout?

1:54 amalloy: i wonder if C-S-2 would

1:54 tomoj: hmm

1:54 devn: i had xmodmap in the mix on Linux and Unix always

1:55 but I run OSX now, so I'm not sure...

1:55 amalloy: devn: if i take out the xmodmap line, xev sees it fine

1:55 tomoj: how can you type a shifted @?

1:55 amalloy: tomoj: xmodmap

1:56 tomoj: oh

1:56 amalloy: or M-x event-apply-shift-modifier

1:57 genokuber: guys i can't understand why this function http://paste.org.ru/?x2xh6j return LazySeq

1:57 maybe it is fundamentals but i don't get it :(

1:58 amalloy: that's just how map works. it returns a lazy sequence

1:59 genokuber: how i can change this? i want to (+ resultofthisfunction somenumber) do

1:59 maybe cast ?

1:59 or what

1:59 amalloy: i can't understand your code without some more time, but if you want to add something to the result of a map, you're confused

2:00 devn: genokuber: what is the goal of your functions?

2:01 hiredman: casting?

2:01 really?

2:01 devn: s/s\?$//

2:01 lazybot: <devn> genokuber: what is the goal of your function

2:01 amalloy: hiredman: casting "solves" so many problems in java, so...why not

2:02 genokuber: devn my function args are some number (abs) and (expert) that is some string. then i check if abs is in some range and if yes then output some text

2:02 hiredman: I think people who throw around the word "cast" like it somehow changes something are rapidly become a new pet peeve

2:02 amalloy: for those following along at home, i've gisted a legibly-formatted version to https://gist.github.com/530385f2c09c63f893d6

2:02 devn: genokuber: that is not a descriptrion. I follow you to a point, but the context helps.

2:03 "I am trying to make a house out of sticks. The sticks are brittle. The ground is made of clay."

2:03 descriptrions sound gnome-esque

2:03 amalloy: int thisIsTwo = (int)2.5; // :(

2:04 devn: amalloy: heh

2:04 hiredman: that is the nature of sticks, and it is the nature of the ground

2:04 devn: hiredman: we invent nature.

2:05 we have a choice in how we go about inventing it, anyway...

2:05 genokuber: devn all i have is http://paste.org.ru/?qipc62

2:05 hiredman: devn: not according to hume

2:06 devn: hiredman: im talking about programming

2:06 physical constraints like the nature of sticks or of the ground are meaningless

2:06 hiredman: programming is no different from anything else

2:06 genokuber: :(

2:07 devn: hiredman: sure it is. the physical constraints placed on a programmer are quite different from that of a civil engineer.

2:07 hiredman: devn: but there are constraints

2:07 devn: hiredman: absolutely. but they are different.

2:07 hiredman: there is suffering and attachment and freedom from the same

2:08 devn: yes, but applying "nature" when it comes to how brittle a wood object is, have precious little bearing on how we program

2:08 s/have/has/

2:08 lazybot: <devn> yes, but applying "nature" when it comes to how brittle a wood object is, has precious little bearing on how we program

2:08 hiredman: unless you are simulating wood

2:09 unless your computer is a big set of water powered wooden cogs

2:09 devn: hiredman: I would contest that simulating wood is not something we do often

2:09 hiredman: :)

2:12 genokuber: i solved this by adding to the func def ok and return it in end of the function

2:12 worse :(

2:15 hiredman: to say everything is different is not insightful, obviously they are, but how are they similar? what are the analogs and isomorphisms?

2:15 devn: hiredman: both questions are equally important

2:15 hiredman: do we agree?

2:16 hiredman: what question did you ask?

2:17 devn: hiredman: how are these things different?

2:17 hiredman: not explicitly I don't think

2:18 hiredman: *shrug*

2:18 devn: hiredman: it seems like it ought to be as important to care about similarity as much as difference, no?

2:19 hiredman: maybe not...

2:23 hiredman: if you cross a river twice, it is obviously not the same river each time, different water, different time of day, the sun is in a different position the sticks in the current are different

2:24 devn: hiredman: "no man can cross the same river twice" merges similarity with difference

2:24 hiredman: but because we can gloss over the change and see what is the same we live in a world of stable identities

2:25 devn: stability is a wave of the hand though

2:25 hiredman: but a useful one, yes?

2:25 devn: yes

2:25 :)

2:34 fbru02: hey guys what's an easy way to make clj highlighting apply to cljs ? (emacs)

2:34 hiredman: M-x clojure-mode

2:35 fbru02: hiredman: doh ! thanks ! :D

2:35 hiredman: (add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode)) <-- something like thise with clj replaced with cljs

2:36 fbru02: thanks ! :)

2:39 hiredman: does slime work for clojurescript?

2:40 hiredman: fbru02: nah

4:47 harblcat: would emacs be considered the de-facto "standard" editor for clojure code?

4:48 Chousuke: it certainly seems to be the most popular one

4:48 kumarshantanu: harblcat: Emacs is currently the most powerful editor for developing Clojure code

4:48 ejackson: its certanly widely used

4:49 Chousuke: You can use whatever you find adequate though

4:49 lots of people just like slime and paredit :)

4:49 zakwilson: There's no one standard, but Emacs+Slime has some advantages.

4:49 Chousuke: not to mention the other nice things emacs has, like magit

4:50 zakwilson: I haven't been able to get used to paredit yet.

4:50 Chousuke: zakwilson: it's pretty easy once you actually bother to give it a try.

4:50 kumarshantanu: harblcat: Alternatives are Eclipse/CCW, Netbeans/EnClojure, IntellijIDEA/LaClojure, and of course Clooj

4:50 Chousuke: it feels weird at first but it'll grow on you

4:50 zakwilson: Chousuke: I've tried it for an hour at a time a couple times. Trying again is on my to-do list.

4:51 Chousuke: yeah, an hour is probably not enough

4:51 kumarshantanu: I noticed that RedCar and Sublime Text 2 (with TextMate Clojure bundle) also support Clojure

4:52 zakwilson: Probably not. Work to get done though and the client already wants it yesterday. No time to play with toys.

4:52 kumarshantanu: and jEdit has a Clojure plugin too

4:53 not to forget Vim/VimClojure

4:54 ahriman`: eclipse is good one i think

4:55 aleonhardt: hi! has anyone ever made an attempt at calling clojure code from MATLAB?

4:55 i.e., via the MATLAB java bridge.

4:55 lnostdal-laptop: i tried eclipse+counterclockworkwise, but really didn't understand the deal; it reloaded the clojure environment every time

4:56 ahriman`: for what puprose, sorry?

4:56 lnostdal-laptop: ..but i might have been using it wrong

4:57 aleonhardt: ahriman`: not sure if directed at me. if so, i'm writing a MATLAB toolbox that needs lots of java-interop. given that i'm learning clojure, i thought this might be a nice opportunity to do both at the same time.

4:58 no luck so far, though. MATLAB refuses to find the classes. works like a charm from every other JVM language.

4:59 just checking if that's a known issue, or if somebody's done this before.

5:18 wjlroe: Does anyone know why running "lein jar" or "lein uberjar" from Hudson would result in the job just hanging and doing nothing? "lein deps" and "lein clean" worked fine

5:21 harblcat: is there a way, in the ns statement or otherwise, to do something like "import foo.bar.*"?

5:22 ejackson: harblcat: nope

5:24 harblcat: aww, so you have to manually type in every class you want to use? I guess it makes sense to make the programmer think about what he's using...

6:03 Chousuke: http://wagjo.blogspot.com/2011/07/one-syntax-to-rule-them-all.html the second image made me laugh :)

6:05 ejackson: yeah, I ilked his style.

6:46 fhd: I've fooled around with the ClojureScript JS REPL a bit this morning, and it crashed my netbook twice. Is that a known issue?

6:49 Chousuke: javascript shouldn't be able to crash anything :|

6:50 If it's really crashing hard, most likely your computer is somehow broken and the repl is just triggering the brokenness. :/

6:52 wink: memleak?

6:52 Chousuke: memory leaks don't crash things either

6:52 wink: unless oomkiller decides to go nuts

6:53 Chousuke: unless the OS is stupid I guess, yes

6:53 wink: well, shouldn't != doesn't :)

6:53 Chousuke: most likely ClojureScript is just a trigger to some other problem.

6:53 faulty memory perhaps

6:54 or an OS bug

6:55 wink: fhd: my rough suggestion, in order would be: (if linux) check dmesg, check messages and syslog, try to reproduce with coredump, use valgrind, reboot with grml and do a memcheck

7:17 fhd: wink: I'll have a look when I get home

7:18 Thought the Clojure -> JS -> Rhino way might be a bit heavy on memory, but I have 1 GB RAM and 8GB swap on that box, so...

7:19 Was just wondering if anyone else has such issues, or if it's a problem with my system

8:03 wjlroe: How can you set ssl options like "-Djavax.net.ssl.keyStorePassword=thepassword -Djavax.net.ssl.trustStore=/Users/will/.keystore -Djavax.net.ssl.trustStorePassword=thepassword" for leiningen, because setting them in :jvm-opts doesn't seem to work

8:19 dbushenko: hi all!

8:20 does anyone know how to create an autoincrementing ID column in a table schema for PostgreSQL using clojure jdbc?

8:29 manutter: I'm not sure, but does clojure jdbc let you create sequences and set defaults on columns?

8:30 If so, http://goo.gl/Vul0d may be of some help

8:30 dbushenko: manutter: I didn't find that opportunity that's why I'm asking

8:30 manutter: ah, I thought there'd be a catch somewhere :\

8:30 dbushenko: yep, when I create the schema manually I do exactly as you've pointed me

8:31 manutter: jdbc should let you send raw SQL at some point, though, doesn't it?

8:31 dbushenko: don't know...

8:31 I'm reading http://devcenter.heroku.com/articles/clojure-web-application

8:31 manutter: ah

8:31 dbushenko: it has the following strange code

8:31 ["select * from shouts order by id desc"]

8:31 manutter: I haven't used clojure jdbc so I'm just fumbling here

8:32 dbushenko: but there is no "id" definition:

8:32 manutter: hm, and that's postgres db?

8:32 dbushenko: ah, sorry, seems like I've found

8:32 [:id :serial "PRIMARY KEY"]

8:33 manutter: aha, that sounds right

8:51 neotyk: is here someone from clojure/core, I would like to know what is clojure/core take on running clojurescript against closure-library svn head?

9:05 SergeyD: Hi. Could you remind the syntax for escaping fully qualifying a symbol in macro? So " `(- sym1) " to become "(clojure.core/- sym1)", not " (clojure.core/- user/sym1) "

9:07 Sorry for broken grammar

9:08 cemerick: ,`(- ~'sym1)

9:08 clojurebot: (clojure.core/- sym1)

9:08 cemerick: SergeyD: ^^

9:09 SergeyD: Thanks!

9:23 jcromartie: I feel like Compojure has hidden away the original idea of "take a request, return a response"

9:25 unless the new docs focus on the bindings so much that they don't mention how to simply handle the whole request?

9:27 I don't see any documentation of how to simply pass the request to another function

9:34 neotyk: jcromartie: you would usually destructure it first and than work only on parts that are interesting for you

9:35 jcromartie: I guess I'm just used to the old way :)

9:35 neotyk: though you can use part of map destructuring {.. :as req} to destructure your request and than have it bound to req

9:36 jcromartie: yeah

9:36 I guess everybody was destructuring in every handler "body" fn

9:37 so it makes sense to move that up

9:37 I think my original frustration was from not being able to just see what the request was

9:38 neotyk: request hash is only needed as whole during dispatch and as entry to handler, but handler usually doesn't care for it all, most of the time path-params form-params and alike

9:39 jweiss_: (doc add-watch) says "Alpha - subject to change" but also "Added in Clojure version 1.0". is it really still alpha?

9:39 clojurebot: "([reference key fn]); Alpha - subject to change. Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state, its new-state. Whenever the reference's state might have been changed, any registered watches will have their functions called. The watch fn will be called synchronously, on the agent's thread if an agent, before any pending sends if agent or r

9:39 neotyk: it is good to be able to look at it, but most likely you need only part of it

9:39 jcromartie: yea neotyk

9:40 maybe it would be better to add middleware that prints out the request if I'm interested?

9:41 neotyk: I guess that something like that might be there already

9:41 jcromartie: and use this: http://clojure.github.com/clojure/clojure.inspector-api.html

9:41 forfun

9:41 neotyk: like a log parser

9:42 could be nice addition

9:48 jcromartie: but after spending about 1 hour with Noir, I've ganked the parts that I like into my raw compojure app

9:48 mostly, defpartial

9:52 neotyk: haven't got time to play with Noir, was it nice?

9:54 dbushenko: neotyk: try https://github.com/dbushenko/Clojure-WebApp

9:58 ejackson: aaah, a rails-alike, that's potentially useful.

9:58 neotyk: Well I'm not really into rendering html on server

9:59 rendering json is good enough :-)

10:01 ejackson: neotyk: so the idea would be to pass that json from a RESTful thingy to a javascript on the client which then renders it into some kind of layout ?

10:01 sorry to be noobing it up quite so much

10:02 neotyk: or directly to JS in front, or now to CS

10:03 ejackson: what do you mean 'in front' ? sever-side ?

10:03 neotyk: in front ~browser

10:03 or api consumer

10:06 ejackson: gotcha, thanks.

10:11 neotyk: np

10:16 jcromartie: with-inspector middleware: https://gist.github.com/db4d99bbec37ca8a0f5d

10:16 simply, but awesome

10:19 makes your screen a bit messy

10:19 but reminds me of Seaside in Smalltalk for some reason :)

10:19 except without the mutability

10:21 Scriptor: hi everyone, when you call a method on an object, say something like (. obj (first)) would it try to macro-expand first or does it not do macro-expansion on method calls?

10:23 jcromartie: Scriptor: can you test it?

10:24 and I'd expect that macro expansion happens first

10:25 hm, looks like it doesn't

10:25 (defmacro m-split [] 'split) (. "a,s,d,f" (m-split) ",")

10:25 based on that test

10:26 Scriptor: jcromartie: right, I'd guess it doesn't do macro-expansion first based on the source for functions like first, rest...

10:32 kjeldahlw: There's something perversly geeky with setting up my clojure dev environment to both host a repl, ring based server AND the clojurescript compiler inside the same process...

10:36 TimMc: Why are there no "[X] is the oomkiller" jokes on the web?

10:37 Scriptor: out of memory killer?

10:39 raek: kjeldahlw: add an IRC bot and then it's complete :-)

10:39 * kjeldahlw smiles

10:40 raek: Scriptor: don't think so since . is a special form. I think you need to construct the method call code in your macro

10:41 macro expansion is only done at "places" which represent normal clojure expressions, e.g. (def foo <here>) but not (def <here> "value")

10:42 Scriptor: thought so, otherwise you'd run into issues with macro names colliding with method names

10:42 kjeldahlw: With support for jvm,clr and javascript I'm running out of excuses for why I should not be using clojure everywhere.. :-)

10:44 edw: kjeldahlw: It's nice to have Emacs open connected to Clojure, knowing that I can sketch out the solution to nearly any type of problem.

10:45 kjeldahlw: edw: Yup, totally lickable.

10:50 TimMc: Scriptor: Yeah, in parody of "Fear is the mind-killer..."

10:52 jcromartie: edw: it makes me sad whenever I have to work on our C# app

10:52 edw: or pretty much anything... although Emacs has some nice modes for Ruby etc.

10:57 theignorati: is there an equivalent to != in Clojure?

10:58 manutter: not=

10:58 dnolen: man I wish people would stop feeding trollish behavior on the ML.

11:02 cemerick: I think it's an intractable problem unless someone is willing to actually mod people/messages out.

11:04 jcromartie: improved with-inspector: https://gist.github.com/db4d99bbec37ca8a0f5d

11:04 ejackson: I think it would be fun job for clojurebot.

11:04 jcromartie: suitable for use on public sites

11:04 not that you'd REALLY want to do this

11:04 but at least to guard against remote triggering of it :)

11:04 dnolen: cemerick: troll feeding is nearly as bad the trolls IMO. if people don't ignore them, they'll never go away.

11:04 jcromartie: cemerick: it's like spam... if it didn't work, they wouldn't do it

11:04 edw: If you spend too much time talking about trollish behavior, the terrorists -- er, trolls -- have already won.

11:05 dnolen: edw: what I'm complaining about is not the trolls, you can't do anything about them. what I'm complaining about is people not leaving them alone.

11:06 cemerick: I don't actually think trolls are discouraged by silence. It seems we've seen a couple of examples of that.

11:06 dnolen: cemerick: no but it doesn't spawn pointless threads.

11:06 that's worse IMO.

11:07 jcromartie: OK guys this is probably going to be the best thing you learn all day... unless you already saw it on HN :P

11:07 http://www.gnu.org/software/libtool/manual/emacs/Follow-Mode.html

11:07 ejackson: jcromartie: yeah its pretty fab.

11:07 the problem is I like to have my source and repl side by side, and this eats it

11:09 jcromartie: ejackson: I like the REPL at the bottom

11:09 fairly narrow

11:09 ejackson: now if I could have follow on 2 cols, and emacs in a third --- dammit, i'd have Visual Studio !

11:09 jcromartie: or rather, short

11:09 you can do that

11:10 follow mode <steve jobs>just works</steve jobs>

11:12 ejackson: if you mean like: | code | code | repl |

11:13 ejackson: more like you |code|code| with repl below

11:13 but I'll never keep up with that, too hard

11:13 jcromartie: oh? no that's exactly what I do

11:13 sometimes

11:14 ejackson: you you move between the buffers with c-x o ?

11:14 jcromartie: although more often than not, different windows are for different namespaces

11:14 or the mouse

11:14 but yeah, C-x o is no biggie

11:14 I use Mac OS X Emacs

11:14 That is, the GUI version of GNU Emacs for Mac OS X

11:15 ejackson: hmm... follow-mode on that arrangement was particularly strange.

11:15 thorwil: hmm, how exactly could clojurescript help with client-server messaging, filling the gap where one might otherwise use json?

11:16 dnolen: thorwil: richer datastructures, arbitrary keys.

11:17 ejackson: so you send your datastructure itself rather than serialise to json

11:18 thorwil: but i thought you would have (compiled) JS on the client, so how/where to cross that bridge?

11:19 dnolen: thorwil: you'll just deliver the Clojure data structure as a string, just like JSON.

11:19 ejackson: thorwil: my first guess is by writing the the clojure datastructure to a network stream, and reading it on the other side

11:19 Scriptor: thorwil: I think the clojurescript reader is built-in

11:19 not sure if that answers the question...

11:20 thorwil: Scriptor: if that's true, i guess that's the missing piece i wasn't aware of

11:20 dnolen: Scriptor: thorwil: the reader is written in pure ClojureScript

11:20 Scriptor: right ^

11:20 so you can include it just like any other js lib

11:21 thorwil: great :)

11:23 i'd still worry about debugging

11:23 Scriptor: thorwil: the whole cross-language debugging thing?

11:24 dnolen: thorwil: ClojureScript produces mostly sensible JavaScript. Eventually I imagine we'll have good source mapping.

11:24 thorwil: Scriptor: testing with we b console/firebug in firefox and not being able to map the errors to the source

11:25 Scriptor: thorwil: it's actually not that hard to map the errors back

11:25 especially if the output is sane

11:26 dnolen: what are your thoughts on how source mapping should be done? I have a similar cross-language project, but the problem is that expressions are compiled out of order

11:26 eg: the body of an if expr compiled before the condition

11:27 dnolen: Scriptor: I believe Google Closure already does this, haven't looked to closely at it yet tho.

11:27 Scriptor: does source mapping I mean.

11:28 Scriptor: dnolen: I was thinking mapping a js line back to the original cljs line

11:29 dnolen: Scriptor: that's what I'm talking about. Someone needs to look at Google Closure and see what it would take to map back to cljs.

11:32 Scriptor: dnolen: but Closure would at most only be able to map back to the js that clojurescript outputs, right? It doesn't do anything with the clojurscript code itself

11:33 edw: dnolen: I hear you. Rittenhouse Square here is Philadelphia has squirrels so aggressive they'll run up your leg to grab an apple out of your hands. Don't feed the squirrels!

11:35 ejackson: edw: i used to live on an island with seagulls so big and aggressive they'd mug you for your icecream. Fun to watch the tourists react with disbelieiving disregard to the warnings, followed swiftly by horror :)

11:36 edw: ejackson: What was the best seagull-combating technique?

11:36 ejackson: edw: {}

11:36 they are invinsible.

11:36 cemerick: ejackson: you mean #{} ?

11:37 ejackson: cemerick: indeed I do.....

11:37 edw: Ah, so: "Eat your icecream indoors."

11:37 Scriptor: falcon sounds maybe?

11:37 ejackson: edw: we had one come into our office to get the breakfast cereal once

11:38 he was encouraged though....

11:38 edw: Haha, Scriptor .

11:38 cemerick: Scriptor: has the Closure inspector been mentioned already? https://code.google.com/closure/compiler/docs/inspector.html

11:39 Scriptor: cemerick: it hasn't, does it map back to the original clojure code?

11:39 cemerick: It maps back to the original *javascript* code.

11:39 Scriptor: ah

11:39 so js->clj mapping seems to be the next step

11:39 cemerick: The cljs compiler would need to emit a corollary js -> cljs mapping

11:40 right, plus forking the Closure inspector to make use of it.

11:40 ejackson: that could be useful indeed

11:40 cemerick: I look forward to someone else doing all that. :-D

11:40 Scriptor: hmm, the reader assigns line numbers to each token, right?

11:40 * cemerick should not be trusted with webby stuff

11:41 Scriptor: (not assigns, but you know what I mean)

11:41 edw: cemerick: I think we can all get behind that sentiment.

11:41 cemerick: Right!

11:41 edw: Your mother smelled of elderberries! :-P

11:42 edw: I do not have access to the meaning behind that idiom.

11:42 Scriptor: *fater*, damnit

11:42 **father*

11:43 cemerick: edw: ah, sorry, then :-)

11:43 ihodes: hello all. it's been a while; is this room handling ClojureScript as well, or is there another #?

11:43 * Scriptor reads the reader

11:44 Scriptor: ihodes: one channel to rule them all

11:44 dnolen: Scriptor: I'm sure these will get sorted out. In fact I expect that the ClojureScript debugging story will outpace the Clojure one.

11:44 ihodes: Scriptor: i'm more worried about one channel to bind them ;)

11:45 dnolen: Scriptor: as script debugging interfaces in browsers are now pretty darn good and the major ones are interested in native support for source mapping.

11:46 edw: Ah, Monty Python! I stayed away from that as a kid. Didn't want to do the full nerd.

11:46 Scriptor: dnolen: pretty good news, I'm actually surprised it hasn't happen before, considering how ubiquitous cofeescript is getting

11:47 cemerick: edw: Right, finally got a good link for you: http://www.youtube.com/watch?v=QSo0duY7-9s ;-)

11:47 Though I mixed up the insult a bit…

11:47 edw: Right, father and all. It's OK. Insult accepted!

11:47 cemerick: Ha, excellent!

11:49 edw: I learned that Terry Glliam is American only yesterday.

11:50 Sorry for that poor grammar.

11:52 Scriptor: so there's no metadata support in clojurescript yet?

11:54 dnolen: Scriptor: metadata is supported but not on symbols I think.

11:54 Scriptor: and by that I mean that symbols can't store metadata.

11:54 ihodes: what's the best way to deal with complex numbers? i need something performant (going to do some DSP with them). i was thinking deftype

11:56 dnolen: ihodes: why not use an existing Java lib?

11:57 ihodes: dnolen: just personal prefence, and for something so inconsequential it makes more sense for me to avoid the bloat. call me crazy if necessary ;) but i'd rather not be stuck with commons.math

11:57 Scriptor: hmm, from the few minutes I've seen the reader doesn't seem to add any metadata, so it could be handy if it added line numbers

12:06 ihodes: i think i'll stick with a record for now and optimize later

12:11 technomancy: oh man, terry gilliam is the man

12:33 gfrlog: I have a new computer that came with ubuntu 11.04 pre-installed; I apt-get-installed gcj-jdk and then downloaded the lein script.

12:33 now various lein commands (including lein new) fail with:

12:33 java.lang.VerifyError: verification failed at PC 214 in clojure.core.protocols$fn__5393:invoke((Ljava.lang.Object;Ljava.lang.Object;Ljava.lang.Object;)Ljava.lang.Object;): incompatible type on stack

12:34 which is nothing I've ever seen in my twenty years as a clojure programmer

12:35 anybody know what's going on or have any good guesses?

12:35 ihodes: grrr... for future refernce, there's a complex-numbers namespace in contrib. doesn't look fast, but it'll do for now.

12:35 technomancy: gfrlog: you probably want update-java-alternatives

12:36 I think gcj only exists in apt for the poor souls on debian/kfreebsd who don't have openjdk.

12:37 gfrlog: technomancy: I've always wondered which is better.

12:37 * gfrlog removes gcj

12:37 gfrlog: technomancy: thanks for clearing that up

12:38 technomancy: hehe

12:38 if you want to try fringe jdks you should check out avian

12:38 apparently it can AOT straight to native code

12:38 gfrlog: technomancy: nope, don't want fringe jdks :) I just picked the first one on the list.

12:39 But that does sound like an interesting project.

12:39 technomancy: I think the only criteria whereby gcj comes out ahead of openjdk is lexographic sorting.

12:40 gfrlog: which unfortunately is the only metric the managers care about

12:40 kumarshantanu: technomancy: have you tried avian? would like to know about any first hand experience

12:41 technomancy: kumarshantanu: only briefly. I haven't actually tried the AOT, and without AOT it's much slower to boot.

12:41 but it works with Leiningen as long as you use the OpenJDK class library.

12:41 apparently AOT cut the boot time in half for a raw clojure repl.

12:42 also: it has TCO and continuations.

12:42 kumarshantanu: that sounds interesting (AOT boot time), worth a try

12:42 ihodes: wow... been a while since i needed to track down info on contrib :\ rough.

12:42 kumarshantanu: though not sure how to try out TCO/continuations

12:43 technomancy: yeah, I don't know if continuations are exposed in a way that would be useful to clojure

12:44 jonasen: How do I make (native) javascript maps in ClojureScript? Should I use (js* "{'a': 'b'}") or is there a better way?

12:44 kumarshantanu: does avian extend the byte code set of the JVM/JLS? *wondering*

12:45 * kumarshantanu likes jonasen's question (that's my question too)

12:45 ihodes: jonasen: js-array i think... let me peek again

12:46 just array

12:46 haven't used any ClojureScript, just browsed source, so YMMV, see here: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L42

12:47 jonasen: ihodes: But that creates an array, not a map with arbitrary keys?

12:48 ihodes: oh my bad, i completely misread map... as array. there's no excuse... wow haha

12:48 gfrlog: technomancy: lein work great now thanks

12:48 Scriptor: even js-obj seems to use (js* "{}")

12:49 jonasen: Scriptor: yes, I noticed that. I've been looking for it in the source but no luck yet

12:50 There is also a nice js->clj function. An inverse of that would be nice imo.

12:50 Scriptor: jonasen: found this with googles: https://gist.github.com/1098372/d4e234f1cb0316fcedf184e87ab9ca94033ad523

12:56 jonasen: This seems to work: (defn js-map [& kv] (let [m (js-obj)] (doseq [[k v] (partition 2 kv)] (aset m k v)) m))

13:18 jcromartie: is it just a convenience that a Var implements IFn

13:18 or is there something else going on there?

13:18 ,((var inc) 1)

13:18 clojurebot: 2

13:22 cemerick: jcromartie: the former

13:25 jcromartie: cemerick: thanks. I am just trying to grok how my compojure app is working. I don't like using conventions in code that I don't understand

13:25 (passing a var to the Jetty handler)

13:25 s/handler/adapter/

13:25 lazybot: <jcromartie> (passing a var to the Jetty adapter)

13:26 ataggart: I'm doing a short, last-minute presentation on Clojure at a meetup tomorrow (replacing the scheduled scala presentation), alongside other presentations for Haskell, R, and Erlang. If anyone has presentation materials or good ideas for what to bring up in 10 minutes, I'd be grateful.

13:27 neotyk: ataggart: once at Amsterdam Clojurians we had nice presentation about FP in clojure

13:27 let me look it up

13:28 ataggart: https://github.com/joodie/talk-functional-clojure-sequences

13:28 ataggart: thanks. The presenters are currently trying to figure out what each other is going to say so we avoid repeatedly going over the same FP 101 stuff.

13:28 technomancy: we had a talk like that at the seattle tech startups meetup.

13:28 neotyk: if you can get FP 101 through you will benefit greatly from it :-)

13:28 technomancy: it didn't actually work out so well though

13:29 mostly because of short notice though

13:29 neotyk: we meet here in Amsterdam on monthly basis

13:29 digash: t

13:29 ataggart: well the other guys have had a while to prepare. http://www.meetup.com/vancouver-scala/events/25283181/

13:30 neotyk: but we mostly code, rarely we do presentations

13:30 and that is probably why we get so little of newcomers

13:31 but in 1.5 month we'll have Uncle Bob again, he always attracts attention

13:31 ataggart: technomancy: what stuff did you go over in your talk?

13:32 I'm inclined to steal a bit from Fogus' talk on the expression problem

13:32 technomancy: ataggart: state and identity mostly

13:33 neotyk: ataggart present ClojureScript

13:33 that is what I'm planning to do next meetup

13:33 ataggart: technomancy: s&I is a good one. reasonably short, and the other guys might not go into that. Just need to tie it explicitly into the language.

13:35 neotyk: I think this is more of a "get to know a bunch of cool languages" thing, plus I'm mostly ignorant on ClojureScript. I'd like to demonstrate features distinct from haskell, r, or erlang.

13:36 maybe macros

13:37 neotyk: running on JS is distinct from other langs

13:37 but it's your preso, not pushing

13:38 ataggart: it's on the list. I'd just need to educate myself on it first :)

13:39 neotyk: I'm so happy for ClojureScript, only backbone.js was making it easier for me to write client side

13:39 and now I don't have to bother with it :-)

13:39 hiredman: neotyk: there is a port of haskell to js somewhere

13:39 neotyk: I've seen demo of it last year on Dutch FP Day

13:40 must say it was quite different

13:40 everything was IO monad

13:40 and ti was quite limited

13:40 s/ti/it/

13:40 lazybot: <neotyk> and it was quite limited

13:41 hiredman: and clojurescript is not?

13:41 neotyk: from what I could understand at that time

13:42 might be a bit, but you have macros so what can go wrong ;-)

13:42 hiredman: but the macros are different

13:43 you have to define them in a seperate file and include them differently than in clojure

13:44 neotyk: point taken, but still I feel much better writing CljureScript than JavaScript

13:46 I guess the same as Haskellers generating JS

13:49 ataggart: has anyone here used neo4j

13:53 HK_: I love how lisp languages work, but does anyone know why they choose to write the operator after the open parenthesis instead of before the open parenthesis like more conventional languages do?

13:53 is there a certain advantage in doing so?

13:55 terom: Homoiconicity is one big advantage. Code is data and data is code. This is why Lisp can have macros easily to generate code.

13:55 ampleyfly: I would guess because it makes function calls look like lists

13:55 ataggart: are lists, not just looks like

13:56 mdrogalis: Maybe because it's so easy to write the reader.

13:56 Scriptor: HK_: basically, there really arent' any operators, just function calls (and special forms, and macros)

13:56 but even then, they can all be represented with the same data structure

13:57 cemerick: HK_: Lisp is something like 55 years old — I'm not sure it gets more conventional than that. ;-)

13:57 ejackson: one () to rule them all ... and in the darkness bind them.

13:58 cemerick: :-D

13:58 ejackson: of course, that assumes you're using emacs, in a dark color-scheme...

13:58 ... which, you are, naturally...

13:59 Scriptor: I use the default

13:59 cemerick: ejackson: I can *never* remember your twitter handle. You should have paid @ejackson for his.

14:00 ejackson: indeed - i dismissed twitter as a highschoolers toy to my detriment.

14:00 ataggart: I have yet to dismiss that notion.

14:02 cemerick: It's definitely not a toy; a distraction, perhaps. That can be a good or bad thing, depending.

14:02 HK_: so would there be a disadvantage in using a lisp language that looked like convential functions in other lanugaes: function(param1 param2)?

14:02 cemerick: HK_: Macros would either not be possible, be less powerful, or be more difficult to implement / use.

14:03 Look at the pain that are AST transformers in various languages for examples.

14:04 ampleyfly: http://en.wikipedia.org/wiki/M-expression

14:07 HK_: ok, thanks for all the answers

14:28 amalloy: ampleyfly: crazy. imagine if M-expressions had survived

14:31 mdrogalis: What were M-Expressions?

14:31 Oh, nevermind. I see the link.

14:53 ampleyfly: amalloy: yeah, it would seem odd

15:01 the-kenny: Any idea why any kind of tab-completion in swank throws a ExecutionRejectedException?

15:02 technomancy: the-kenny: you want swank 1.3.2 probably

15:02 the-kenny: technomancy: Ah, i'm on 1.3.1. Will try that, thanks.

15:04 user__: what does it mean if 'fn' has an asterisk (*) appended to it?

15:04 the-kenny: 1.3.2 fixed it. Thanks :) Loosing autocompletion in slime is like loosing a finger (which is pretty problematic when coding in Emacs)

15:05 Scriptor: as long as you don't lose your thumb

15:08 cemerick: user__: fn* is the "real" special form that is implemented in the Clojure compiler.

15:09 amalloy: &(macroexpand '(fn [] 1))

15:09 lazybot: ⇒ (fn* ([] 1))

15:10 user__: cemerick: thank you

15:17 dnolen: hmm interesting where LP beats in FP in succinctly expressing an idea, stuartsierra phone-code from Odersky's talk in core.logic, https://gist.github.com/1107653

15:24 jcromartie: dnolen: that is incomprehensible to me... where would I start to understand logic programming?

15:25 chouser: dnolen: does that have any constraints other than just generating all possible options for a give phone number?

15:30 dnolen: chouser: no it just generates all possibilities for a given number. the magic is appendo.

15:31 chouser: appendo can infer all two lists that can be appended to form the number, these inferred sublists are used to look up the words.

15:31 chouser: avoid all the split range acrobatics in stuart sierras version.

15:32 chouser: dnolen: where's his version?

15:32 dnolen: chouser: https://gist.github.com/1105563

15:33 amalloy: chouser: is there a way for an Element to represent, say, a CDATA section? or does "just work" if an element's contents are "<![CDATA[foo]]>"?

15:33 dnolen: mine is mostly the same besides encode.

15:33 chouser: amalloy: cdata, comments, etc. should perhaps be added

15:34 mdrogalis: Does Compojure stack up to Sinatra? Is it more or less a complete web framework?

15:35 dnolen: jcromartie: The Reasoned Schemer, Ambrose's Logic Starter tutorial, or a good Prolog book (Bratko)

15:36 technomancy: mdrogalis: clojure libraries tend to be built of simple composable pieces

15:37 compojure doesn't tell you what templating engine to use or how to access your database, because those are orthogonal to the HTTP request/response cycle.

15:37 mdrogalis: So it's more of a collection of pieces that you assemble yourself based on your own needs?

15:37 raek: yes

15:37 mdrogalis: http://brehaut.net/blog/2011/ring_introduction

15:37 technomancy: right, like any well-designed, loosely-coupled system

15:37 mdrogalis: Seems a little harder to use, in my opinion. Is it more suitable for experienced web developers?

15:37 raek: "A Brief Overview of the Clojure Web Stack"

15:38 mdrogalis: Thanks, raek!

15:38 neotyk: chouser: what is clojure/core view on running clojurescript against svn head of closure-library?

15:38 chouser: neotyk: I'm aware of no official view.

15:39 neotyk: There is tons of goods in head

15:39 html5localsotrage, websocket

15:40 and probably more

15:41 amalloy: man. it ought to be punishable by death to release libraries with .foo.clj.swp files in the jars

15:41 jcromartie: mdrogalis: you have to know what's going on at the various levels to use Compojure

15:42 mdrogalis: I'd say you should be comfortable with various details of HTTP

15:42 that being said I don't think it's that hard... just a much lower level than most frameworks. And other Clojure web frameworks are build on Compojure

15:43 mdrogalis: Interesting.

15:43 That makes sense to me.

15:43 jcromartie: I just started some projects in Compojure, looked at the Noir framework, and went back to "raw" Compojure, but I borrowed the bits I liked from Noir

15:44 the best part about Ring/Compojure is that handlers are just functions, and you can add really neat stuff by just decorating the handers with your own logic

15:44 amalloy: jcromartie: built on compojure? i'm not sure that's true. noir is, sure, but eg enlive and hiccup don't care what's under them at the compojure level - could be moustache

15:44 jcromartie: no but Enlive and Hiccup aren't "web frameworks"

15:45 they're HTML presentation libraries

15:45 drew127: anyone know why (.size (java.awt.Font. "Monaco" Font/PLAIN 12)) might not work?

15:45 jcromartie: and that's the beauty: it's all just libraries that can fit together easily because the interfaces are simple

15:45 amalloy: *shrug* you can draw that distinction if you want. i don't think clojure has any "web frameworks" that are as all-encompassing as rails

15:45 drew127: I get #<CompilerException java.lang.IllegalArgumentException: No matching field found: size for class java.awt.Font

15:45 but the size field is right there in the Java docs

15:46 amalloy: so to say that one thing is a framework and one is a library is just a matter of degree

15:46 Raynes: amalloy: And for good reason.

15:46 amalloy: Raynes: you caught me, i'm secretly in love with rails

15:46 jcromartie: well, things like Noir seem to be trying to be

15:46 Noir says "put your views here, use defpage, use hiccup"

15:46 amalloy: $javadoc java.awt.Font

15:46 hiredman: drew127: protected field

15:47 lazybot: http://download.oracle.com/javase/6/docs/api/java/awt/Font.html

15:47 jcromartie: and it does more "behind the scenes", where really Compojure is simple enough for me as it is

15:47 amalloy: indeed, protected. java loves you to use .getSize

15:48 jcromartie: I'm finding my app is straddling the line between an API and HTML site, so what Noir imposed didn't really make sense

15:48 drew127: hiredman: thanks

15:48 getting my Java hard knocks

15:48 and thanks amalloy

15:49 hiredman: it's good that you are reading javadocs, a lot of people don't :/

15:49 jcromartie: Noir has a global state that keeps track of what routes do what, and middleware is applied globally too

15:50 drew127: I'd forgotten what protected meant

15:50 protected from \what, I wonder

15:50 amalloy: blech. global middleware?

15:50 drewr: http://steve-yegge.blogspot.com/2010/07/wikileaks-to-leak-5000-open-source-java.html is an entertaining fake-news story mocking private/protected members

15:51 drew127: hahaha

15:52 jcromartie: amalloy: yeah it's what you sacrifice for getting a "simple" framework

15:52 drew127: that reminds me of a sign on an abandoned playground I saw once

15:52 it said

15:52 "this playground has been closed for your convenience"

15:52 Java kind of feels like that

15:52 cemerick: amalloy: something like that would likely be necessary for a webmachine-like result

15:52 (if that's something one cares about, anyway)

15:52 amalloy: cemerick: tbh all i know about webmachine is that kirindave was excited about implementing it in clojure a while back

15:53 cemerick: I think that stalled out.

15:53 amalloy: i thought he got something he was happy with

15:53 cemerick: oh, nm then

15:53 amalloy: but since i never understood the goal, i'm not qualified to judge

15:54 cemerick: In any case, the concept is that you define handlers such that interrogative requests (like HEAD), accept-encodings, etc. are handled properly.

15:55 Quasi-automagically that is, which makes the solution perhaps necessarily framework-y.

16:01 DethStryke: ls

16:01 vertegal: exit

16:01 amalloy: huh. i had no idea hiccup's (html) macro made an attempt to precompile structures it recognizes

16:03 hiredman: neat yes?

16:03 amalloy: yeah, that's pretty clever

16:04 although, jesus, it uses eval at macroexpansion time to do it?

16:04 i guess it only does so in some well-constrained ways, but it still worries me

16:17 jcromartie: what would worry you about that amalloy

16:18 amalloy: um. using eval is always worrisome, period, even if sometimes it's fine

16:18 at macro-expansion time, it's usually a beginner trying to do something with a macro that can't be done with a macro

16:18 obviously not the case in hiccup, though

16:19 hiredman: man xcode4 is just like itunes

16:20 Hodapp: hiredman: How?

16:21 hiredman: the ui

16:21 Hodapp: hmm

16:21 I'm not a big XCode fan

16:21 hiredman: me neither

16:21 all I want is to build the latest iterm2

16:22 amalloy: hiredman: see if Genius will build it for you

16:22 hiredman: good point

16:28 * dnolen remembers when XCode was Project Builder on OS X 10.1

16:34 Pupeno: Which contribs should I use (http://clojars.org/search?q=contrib)?

16:34 technomancy: is one of the prerequisites for OS X the ability to use the term "genius" non-ironically?

16:35 Hodapp: technomancy: nah.

16:35 technomancy: (applied to software or front-line tech support grunts at least)

16:35 scottj: Pupeno: for 1.2, the one that lein puts in your project.clj, for 1.3 maybe the ones at github.com/clojure

16:36 Pupeno: scottj: I don't think lein put one one my project.clj, but if it did, it's gone.

16:37 Hodapp: technomancy: It's one of those oft-abused buzzwords, like "innovation" that some companies love to throw around

16:37 Pupeno: scottj: I created another project… no contrib.

16:37 clojure 1.2.1

16:38 technomancy: scottj: that doesn't get added by default anymore

16:38 Pupeno: use whatever contribs you need

16:38 Chojin: if you want to make a DSL, is there some way of writing it that you don't have to pollute your code with namespace qualifiers or use the "use" function? Or is this way too complicated a question to ask here?

16:38 technomancy: avoid monolithic contrib if you can

16:39 Chojin: I don't want to have to use a bunch of (myns/foo (myns.bar :something))

16:40 Pupeno: Mmmh…. so, how do I get http://richhickey.github.com/clojure-contrib/properties-api.html

16:40 ?

16:41 technomancy: Pupeno: I think monolithic contrib is the only place to find that, so [org.clojure/clojure-contrib "1.2.0"]

16:42 amalloy: technomancy: i thought you hated domain-name groupids; doesn't lein imlicitly supply the org.clojure part?

16:42 technomancy: it does, but I also hate special-cases

16:42 so I'm torn.

16:43 I'll drop the special case for contrib in lein 2.0 since it's deprecated, which is why I didn't rely on it above.

16:43 amalloy: technomancy: solution: implicitly supply org.clojure for every artifact

16:43 technomancy: heh

16:44 I like the cut of your gib.

16:46 Pupeno: How do I reload a project after clojure-jack-in? to re-load dependencies?

16:46 technomancy: Pupeno: C-c C-l

16:48 Pupeno: technomancy: doesn't seem to work just loading the project.clj, or do you mean something different?

16:48 technomancy: Pupeno: it works on namespaces inside your project

16:48 there's no way to reload the entire JVM without restarting

16:49 Pupeno: ok.

16:49 hv: what should I bind *out* to, in order to suppress it?

16:49 ,(binding [*out* nil] (println "suppressed"))

16:49 clojurebot: #<NullPointerException java.lang.NullPointerException>

16:50 hiredman: ,(do (with-out-str (println "foo")) nil)

16:50 clojurebot: nil

16:55 hv: hiredman: Will it incur any overhead because it stores the string I want to discard, and at the end discards it?

16:55 amalloy: hv: looks like apache commons-io has http://commons.apache.org/io/api-1.4/org/apache/commons/io/output/NullWriter.html

16:55 hiredman: hv: what do you think?

16:55 amalloy: or of course you could write your own

16:55 or use a FileWriter on /dev/null, or...

16:56 hv: hiredman: I guess it stores it, but I am not sure.

16:59 hiredman: yes, it keeps the string and discards at the end.

17:01 amalloy: thanks. yet, I am looking for something simplre.

17:01 *simpler

17:01 drew127: so I just patched clooj to change text size

17:01 anyone looking at the clooj codebase around here?

17:02 I want to make the zoom command "CMD +" as is usual

17:02 but I can't figure out how to say this to Java

17:02 for the time being I just used a letter

17:02 it works

17:02 technomancy: probably because CMD isn't portable?

17:02 drew127: well, that's what's already in the clooj codebase

17:02 can I paste code here for example?

17:03 technomancy: as long as you use gist or something

17:04 drew127: like so?

17:04 https://gist.github.com/1108033

17:04 that's the way it seems to work in the clooj codebase

17:05 amalloy: drewr: macosx is probably stealing the cmd-+ before it gets to clooj

17:05 (unless what technomancy said is right, which i'd prefer to believe)

17:05 drew127: it's not actually that

17:05 when I put "cmd +" in that code snippet

17:06 nothing showed up in the menu

17:06 so it's not even getting there

17:06 it's obviously the wrong way to tell Java the plus key

17:06 so I tried "cmd PLUS"

17:06 no luck

17:06 and I tried .getKeyCode, etc.

17:06 no help from that

17:06 technomancy: poor drewr

17:06 drew127: haha

17:06 do you know how to figure that out?

17:07 I'm sure the author of clooj does

17:07 maybe I'll just email him the patch

17:07 technomancy: sorry, I've never done any gui work outside elisp

17:07 drew127: I don't blame you

17:07 though elisp is fun?

17:07 boy

17:07 I find *that* scary

17:08 technomancy: it's a crappy lisp, but it's the best UI toolkit I've ever seen

17:08 drew127: I wonder if this clooj might eventually become emacs in a *good* lisp

17:08 that would be amazing

17:08 I mean it's very basic now

17:08 but it's only released a week ago

17:08 amalloy: technomancy, drewr: fwiw, "cmd" is replaced, by clooj, with the right modifier for the OS it's running

17:09 technomancy: amalloy: tab completion bro

17:09 gotta fix it

17:09 drew127: amalloy: is that in clooj.utils?

17:09 amalloy: technomancy: haha i actually have it working fine, but forgot which drew i was talking to

17:09 yes

17:10 https://github.com/arthuredelstein/clooj/blob/master/src/clooj/utils.clj#L204

17:11 $javadoc javax.swing.KeyStroke

17:11 lazybot: http://download.oracle.com/javase/6/docs/api/javax/swing/KeyStroke.html

17:11 amalloy: drew127: so it probably wants Cmd Shift = or something

17:13 drew127: here's what it says:

17:13 amalloy: &(javax.swing.KeyString/getKeyStroke "ctrl shift =")

17:13 lazybot: java.lang.ClassNotFoundException: javax.swing.KeyString

17:13 amalloy: &(javax.swing.KeyStroke/getKeyStroke "ctrl shift =")

17:13 lazybot: ⇒ nil

17:13 amalloy: &(javax.swing.KeyStroke/getKeyStroke "ctrl s")

17:13 lazybot: ⇒ nil

17:13 amalloy: hmph

17:14 drew127: sorry

17:14 didn't realize that was going to break things

17:14 using gist

17:15 https://gist.github.com/1108064

17:15 (my first time on IRC, sorry)

17:19 terom: Maybe "cmd typed +"?

17:23 drew127: amazing, that works

17:23 except

17:23 technomancy was right

17:24 it seems to be swallowed by the OS

17:24 I'm gonna see if Arthur Edelstein has any ideas on this

17:24 meanwhile

17:24 I'll just use some random letters

17:24 not ideal

17:24 but at least we get text zoom in clooj

17:24 of some kind

17:25 terom: btw, where do you find documentation on stuff like that

17:26 technomancy: is it still using a proportional-width font?

17:26 drew127: clooj you mean?

17:27 technomancy: yeah

17:27 drew127: I'm not sure

17:27 that means not fixed with, unlike emacs?

17:27 let me restart it and look

17:27 amalloy: well, emacs will use whatever font you tell it to

17:27 but if you use variable width for coding you are a madman

17:28 drew127: it was courier and monaco

17:28 that's fixed width, right?

17:28 technomancy: yeah, I briefly took a look at it on my box and it was using some crazy proportional-width font here.

17:28 good to know it wasn't intentional =)

17:29 drew127: seems to be fixed-width now

17:29 I'd like to make a menu to select fonts too

17:30 but right now changing size is enough of a win for me

17:30 technomancy: meh; put it in a config file

17:30 drew127: I hear an Emacs user talking

17:30 but it doesn't even have a config file at this point

17:30 it's hard-coded

17:31 hiredman: :(

17:31 technomancy: can you get a repl into clooj's own process?

17:31 drew127: you mean from an external process?

17:31 I doubt it

17:31 haven't tried

17:31 technomancy: no, I mean from within

17:31 drew127: well, there is a repl there

17:31 is that what you mean?

17:31 amalloy: i don't think he cares whether the repl is launched internally or internally

17:31 drew127: ther repl is a little weird

17:31 technomancy: right, but that's for the project

17:31 amalloy: he wants to have a repl that can play around with clooj itself

17:31 drew127: oh

17:31 I don't think so

17:31 technomancy: does clooj run in-process with the project being worked on?

17:32 amalloy: well, not for me personally

17:32 amalloy: technomancy: what, not going to abandon emacs?

17:32 drew127: what do you mean by in-process with the project being worked on?

17:32 amalloy: ~salespitch

17:32 technomancy: I'm just saying, if you're going to build something like this, it needs to be self-hosting and expose its guts

17:32 clojurebot: Titim gan éirí ort.

17:32 technomancy: amalloy: heh

17:33 drew127: I mean is there a separation between clooj's code and the project? do they run in the same JVM with the same classloader etc?

17:33 drew127: how do you determine that?

17:33 neotyk: swank.swank/start-repl

17:33 drew127: using PS on your machine

17:33 hiredman: the first thing I got going in my little javascript<->cocoa webkit thing was a js repl

17:33 drew127: ?

17:34 amalloy: technomancy: it launches a classloader, looks like

17:34 but not a jvm

17:34 technomancy: right; cool. so if it doesn't let you repl itself, that seems like a pretty big oversight

17:35 hiredman: "go repl yourself"

17:35 technomancy: not that it's unreasonable for three-week-old projects to have omissions like that

17:35 drew127: is that something that's easy to fix?

17:35 technomancy: it's just the first thing I would add if I were working on it

17:35 amalloy: technomancy: can't you get one yourself, by launching clooj from a repl?

17:35 technomancy: drew127: hopefully, as long as the UI for the existing repl is flexible enough

17:36 amalloy: probably, but you don't get any self-hosting points that way

17:36 's all 'bout the turtles.

17:36 drew127: to quote tom lehrer quoting lobachevsky: "dis, I know from nothing"

17:36 anyway, can change text size now in clooj

17:37 amalloy: technomancy is self-appointed Turtle Inspector. if he spots one damn elephant...

17:37 drew127: maybe turtles come later

17:39 anyway, if anyone is inclined to look at it, I'm curious if I've used agents properly in my patch:

17:39 https://gist.github.com/1108130

17:40 I thought I shouldn't use an atom, because in theory new objects could have side effects

17:40 I'm pretty new to this myself

17:41 amalloy: using agents seems a bit nuts

17:41 drew127: yeah, it does

17:41 amalloy: and you're hardcoding monaco in one place, but not the other

17:42 drew127: well, monaco was already hardcoded

17:42 oh

17:42 true

17:42 so should I use an atom?

17:42 it seems nuts, as you say, to have to get the value of the agent with a separate deref

17:43 amalloy: well, it seems to me you're doing the whole concurrency thing wrong, by derefing and then setting

17:43 instead of passing a function that looks at the current state and changes appropriately

17:45 drew127: an agent returns the value it already is

17:45 amalloy: but i don't really understand what you're doing

17:45 drew127: whereas I need the value that it's changed to

17:45 that suggests using an atom

17:45 but atoms are bad for side effects

17:45 so it says

17:45 amalloy: where are you getting the value it's changed to?

17:45 all i see is you getting the initial value before doing anything

17:47 drew127: I make the value it will be changed to in advance, put that in the let, then change it to that value

17:47 this is all in change-font

17:47 amalloy: right...which is wrong, but seems unrelated to what you're saying

17:47 drew127: so what's the right way of doing it with agents

17:47 or with anything else?

17:48 amalloy: (send-off myfont (fn [old-font] (Font. ... (.getSize old-font))))

17:48 drew127: which is what I had at first

17:49 but I realized that this returns the un-incremented or decremented value of the font

17:49 change-font has to return the changed value of the font

17:49 amalloy: then you certainly do not want an agent

17:49 an atom is what i would choose

17:49 drew127: yeah

17:49 it seems like that

17:49 but what about the side effects issue?

17:49 hiredman: or await on the agent

17:50 drew127: it seems like an unclean style of coding

17:50 amalloy: $javadoc java.awt.Font deriveFont

17:50 lazybot: http://download.oracle.com/javase/6/docs/api/java/awt/Font.html#deriveFont(int,%20float)

17:50 hiredman: all of which seems horrible

17:50 drew127: because when you're making a new object

17:50 it could have side effects

17:50 amalloy: see also that, for creating a new font based on an old one

17:51 hiredman: is current-doc another agent?

17:51 drew127: it's an atom

17:52 my question with the atom is, what happens if the atom has to be retried?

17:52 agents never get retried, right?

17:52 let's say you're incrementing it using this deriveFont

17:52 that's a stateful change

17:52 so couldn't it increment multiple times as the atom is being retried?

17:53 amalloy: drew127: https://gist.github.com/1108145 is a vague sketch taking out things that seem clearly crazy

17:53 no guarantees that i haven't introduced other crazy things

17:53 deriveFont isn't stateful

17:53 hiredman: depends how you do it, what you really want is to keep an reference to a number that is the current font size, and when someone changes that number you want to change the font everywhere

17:53 amalloy: i think

17:53 it certainly doesn't look like it

17:54 hiredman: (def font-size (atom 10)) (add-watch font-size ...)

17:54 or it's a field in the current-doc map

17:55 drew127: thanks amalloy, let me try that

17:55 hiredman: and you have a watch that checks to see if a change changes the value of that field and if it does it cascades the change

17:55 amalloy: drew127: it won't compile; i'm sure i left at least two variables with the wrong name. but it's something to work with

17:57 drew127: ok, thanks, I'll work with it

17:57 I'm still trying to get my head around atoms vs. refs vs. agents

17:57 the retrying stuff worries me a little bit

17:58 but I guess that's what you have to deal with

17:59 hiredman: I guess I'll try the add-watch too

18:00 maybe you could make the setFont the result of a watch

18:00 that seems right

18:00 hiredman: you could also get rid of the global font var and make it part of the document

18:01 drew127: yeah, it would make sense

18:01 but right now that was how the code was structured

18:01 I don't want to introduce too many changes at once

18:01 maybe I'll try that in a later patch

18:01 add-watch is sort of a functional-reactive programming thing, isn't it?

18:01 hiredman: scgilardi: what ever happened to your observable gui kit clojure stuff?

18:02 drew127: hiredman: what is observable gui kit clojure?

18:02 you mean it shows you what code you're using as you interact with a gui?

18:03 hiredman: no

18:03 observable like an interface

18:03 amalloy: drew127: fwiw, updated the gist to something that might possibly compile

18:03 hiredman: basically you want a queue where events go, and different widgets can sign up to observe certain events

18:03 drew127: that's the way gui programming should be done

18:04 hiredman: right

18:04 drew127: car-ing things off a stream of events

18:04 there was something called FrTime in Scheme

18:04 programming with events is kind of perverse

18:04 hiredman: so, go forth, and rewrite clooj to do it

18:04 drew127: in the next half hour!

18:04 actually I have to get dinner

18:04 maybe between dinner and dessert

18:05 * hiredman has a gui repl that uses queues pretty badly

18:06 hiredman: might have been the first time I tried to do anything with lein

18:07 drew127: haha

18:07 anyway

18:07 got to go for now

18:07 thanks guys

18:07 \leave

18:07 oops

18:07 hiredman: https://github.com/hiredman/Repl/blob/master/src/hiredman/repl.clj

18:08 drew127: thanks for the example

18:08 amalloy: drew127: you're probably looking for /part or /quit

18:08 drew127: yep

18:08 here I go

18:08 amalloy: *chuckle*

18:34 rimmjob_: paredit is so good

19:58 choffstein: Emacs won't let me delete a parens … wtf emacs.

19:58 I love your parens auto-complete and all … but when you don't respect my key-presses, you annoy me

19:59 amalloy: choffstein: give yourself over to paredit. embrace it

19:59 choffstein: amalloy: i'm trying … i'm trying. gotta learn to work WITH it and not fight it

19:59 amalloy: you don't really want to "delete a paren", you want to do some list-oriented operation like "merge two lists"

20:00 choffstein: maybe paste/gist the text you have and the text you want?

20:00 choffstein: C-u DEL did the trick :)

20:00 amalloy: har har

20:00 choffstein: basically, I had a [ matched with a ) and couldn't get rid of the )

20:00 amalloy: yeah, if stuff gets unbalanced knowing the escape hatches isn't bad

20:01 choffstein: C-q ] would have worked too, sorta

20:01 choffstein: i'm reading the paredit config file now to understand it better

20:03 what happens if I end up with something like ((f a b c)) and want to get rid of the outermost parens?

20:04 amalloy: choffstein: put point on the inner (, and M-r

20:04 or M-s

20:04 choffstein: or if I have (f a b c) and want to write (g (f a b c)) -- I find myself having a highlight a lot… I must be missing keystrokes

20:04 amalloy: choffstein: for the latter: M-(

20:05 actually i guess you can put point *anywhere* in the first expression and M-s will work. i don't use M-s that much

20:05 the-kenny: Is it feasible to use the output of pr-str as a over-the-wire protocol for a Clojure/ClojureScript Client/Server application?

20:05 choffstein: Hmmm, M-( doesn't seem to be working for me. Must be doing it wrong.

20:06 amalloy: choffstein: that's meta-shift-9, right?

20:06 should work, with point on the (

20:06 choffstein: …i'm a moron

20:06 I was doing meta-9 :D

20:06 * amalloy is a good guesser

20:06 choffstein: annndddd time to stop coding

20:06 amalloy: choffstein: or do what i did! swap symbols with numbers so that M-9 works

20:11 choffstein: that isn't a bad idea...

21:02 npoektop: hi! how to create an atom hash-map of atom lists?

21:03 dnolen_: ,(atom {(atom []) (atom [])})

21:03 clojurebot: #<Atom@105b08c: {#<Atom@89ca51: []> #<Atom@41986c: []>}>

21:04 dnolen_: npoektop: though it seems like a strange thing to want

21:06 npoektop: i want to create and modify a hash-map and to modify lists which are values

21:08 smth like (push word (gethash (word->number word) table)))) if it was CL

21:10 dnolen_: that code is from file reading loop

21:11 dnolen_: npoektop: you should try to do it in a functional manner first, no need to resort to atoms.

21:13 tmciver: What happened to sexpbot?

21:13 zakwilson: Is there a standard date/time library people use? I didn't see one in contrib.

21:13 npoektop: dnolen_: now i do (.put *map* (word->num line) (cons line (.get *map* (word->num line)))) Not very nice i think

21:13 dnolen_: zakwilson: clj-time

21:13 zakwilson: dnolen_: thanks

21:14 dnolen_: npoektop: you don't need to use .put or .get

21:14 ,(assoc {} :foo 'bar)

21:14 clojurebot: {:foo bar}

21:14 dnolen_: ,(get {:foo 'bar} :foo)

21:14 clojurebot: bar

21:15 dnolen_: npoektop: if you have a loop, accumulate your data in functional way via loop/recur.

21:15 * zakwilson waits forever for the uberjar to recompile.

21:15 zakwilson: The leiningen workflow and the remote swank workflow don't work together nicely when adding a new dependency (unless I'm missing something)

21:16 hiredman: what is the lein workflow?

21:16 (and also what is the other one?)

21:17 zakwilson: In this case, the workflow is to add a dependency to project.clj, run lein deps, run lein uberjar, copy the jar to the server and restart the app.

21:18 It would be nice if there was some way to give the new information to the running app. I think it would require leiningen to know how to copy things to the server and some sort of classpath voodoo.

21:35 There doesn't seem to be a nice way to get the number of days between two dates.

21:40 Also, what were the authors of the original Java date libraries smoking?

21:40 scottj: smalltalk?

21:42 zakwilson: Does smalltalk have something that works like java.util.date?

21:51 amalloy: tmciver: /topic in #sexpbot begins with "Official IRC channel for lazybot (neé sexpbot)"

21:55 Raynes: tmciver: Also, now located at http://github.com/flatland/lazybot

21:55 tmciver: Raynes, amalloy: I see. Thanks.

22:13 duck1123: So does anyone here have any tips on how to best get maven to reload my Soy templates when they're changed during a swank session?

22:14 switching to another terminal, re-copying the resources and the re-evaling my template code buffer is really hurting my flow

22:17 zmaril: I am trying to see if mutlimethods handle authorship triangles correctly. Can anybody tell if I set up a test case properly? https://gist.github.com/1108533

22:38 choffstein: Got a strange question for everyone :) I have a list of integers that represent group identification (e.g. (3 -1 2 1 2 1 -2 -1) would represent 5 different sets) which I would like to transform into a list of positive integers (e.g. the previous list becomes (0 1 2 3 2 3 4 1)). Any idea how I can do this? I don't think it would be hard to do a little recursive function and use a map to keep track of the groups I have already s

22:38 … but I am wondering if there is a better solution.

22:41 jcromartie: what's the idiomatic way to test if all elements of a collection satisfy a predicate?

22:41 amalloy: &(doc every?)

22:41 lazybot: ⇒ "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

22:41 amalloy: choffstein: i don't understand the relation between the two lists you give

22:42 jcromartie: hah yes I got it thanks

22:42 I was looking for "all?"

22:43 choffstein: amalloy: Yeah, that was really poorly written. So basically, it should go through the first list and if the element hasn't been seen before, give it an index. So, starting at 0, since 3 hasn't been seen, I give it the index 0. Then I increment the counter and go on to the next element, -1, which hasn't been seen, so it is given the index 1. This continues until we get to "2" again, which has been seen, so it is given the same

22:43 as the previous 2.

22:44 amalloy: do you care if you end up with (1 0 2 3 2 3 4 0) instead?

22:45 i guess i don't have any great way of computing that either. but it seems a bit weird, like you're trying to solve some intermediate problem that doesn't need to exist, rather than the real problem

22:50 choffstein: amalloy: Well, the issue is I have clusters identified by positive and negative values

22:50 and I want the clusters to be identified by positive values only

22:51 metajack: if they are sequential with no gaps just add the absolute value of the min element to all elements

22:52 amalloy: but what's making this difficult is that you are trying to maintain lists of things in order, because they're "related" to other lists. if you instead kept maps you wouldn't have to care about order and this would be easy

22:53 choffstein: …nice metajack. Very nice.

22:53 Welllll…except for that sequential issue. They aren't, necessarily.

22:53 amalloy: I'll see if I can refactor

22:57 well, I did it with some very, very un-sexyness

22:57 a gross little loop/recur. eck.

22:57 amalloy: choffstein: reduce would be cleaner imo

22:57 well

22:58 choffstein: i'll show you my solution :)

22:58 amalloy: i try to avoid loop/recur, but i bet it leads to cleaner, and less code

22:58 on this occasion

22:59 choffstein: https://gist.github.com/1108567

22:59 I think a multi-method might clean that up a bit.

22:59 I don't like the double if statements

23:02 amalloy: jeez

23:02 choffstein: it makes me feel dirty just looking at it.

23:04 tomoj: cleverer way to do (into {} (for [[k v] m] [k (get m v v)])) ?

23:04 choffstein: maybe a helper multi-method that is recursive instead of using loop/recur?

23:08 amalloy: choffstein: at least do some destructuring. seeing first/rest all over makes me queasy

23:09 i'm on a machine that's not so good for developing atm, so finishing this is painful, but here's a rough draft i started on: https://gist.github.com/1108576

23:09 also: oh god, apparently it used tabs

23:13 choffstein: thanks, appreciate it

23:16 tomoj: https://gist.github.com/f16a81797f1eb160d4b5

23:16 why doesn't that reductions return an infinite seq?

23:17 oh

23:17 duh

23:17 :D

23:17 choffstein: ^

23:17 choffstein: oh. wow. sexy

23:18 tomoj: amalloy can make it sexier

23:19 amalloy: tomoj: nice. i like using (count m)

23:20 tomoj: https://gist.github.com/ecd32c48fb704f1b0e73 :/

23:20 still seems overly complicated

23:20 choffstein: I definitely, definitely don't understand that code

23:21 tomoj: to just find the index of first occurrence of each value

23:21 oh, hmm

23:23 amalloy: tomoj: not enough arrows! any decent algorithm uses at least four arrows

23:23 choffstein: How does nil get destructured into [m i]?

23:23 amalloy: choffstein: as [nil nil]

23:24 choffstein: Okay. I'm gonna have to ponder this one.

23:24 tomoj: amalloy: just one arrow preferably :)

23:24 amalloy: &(let [[m i] nil] {:m m :i i})

23:24 lazybot: ⇒ {:m nil, :i nil}

23:24 tomoj: oh, it's not index of first occurrence

23:24 amalloy: tomoj: yeah, i have to say i'm not a fan of the inner arrow. i lovvve (juxt identity foo), but this is overdoing it :P

23:24 tomoj: indeed

23:25 choffstein: my mind is exploding.

23:26 ohhh, I didn't know that you could provide a default to get. that is cool

23:26 learn something new every day :)

23:27 Also didn't know you could (assoc nil …) and create a new hash.

23:28 tomoj: https://gist.github.com/616f9601337786730d3e

23:28 amalloy: choffstein: ##(update-in nil [:key] (fnil inc 0))

23:28 lazybot: ⇒ {:key 1}

23:28 tomoj: have to be in order?

23:29 amalloy: ah, very good

23:31 choffstein: woah … tomoj. that last one is wicked.

23:31 tomoj: hmm, it does two passes

23:31 choffstein: Nope, order isn't necessary.

23:32 amalloy: tomoj: with laziness, N passes doesn't really matter much

23:32 choffstein: I'm sort of confused as to where the mapped value is getting used in the (->>

23:32 amalloy: this won't handle infinite seqs, is your objection?

23:33 tomoj: the return value of the ->> form is a map (as in {}) which is called as a function by map (the function)

23:33 amalloy: hadn't thought of that, but.. yeah

23:34 choffstein: tomoj: yikes.

23:34 That is cool.

23:34 Did not know you could call a map as a function

23:34 Holy crap I am learning a lot.

23:35 tomoj: &[({1 2} 1) ({1 2} 1 3) ({1 2} 4 3)]

23:35 lazybot: ⇒ [2 2 3]

23:36 amalloy: tomoj: i nominate you for an award. any award; i'm not picky

23:37 tomoj: thanks, I will forward your nomination to the Iowa Pork Producers Association

23:38 choffstein: mind = blown.

23:49 Well, thanks for all the help guys. That last one is particularly awesome, tomoj.

23:49 I'm outta here. Have a good one.

23:50 zmaril: Is it possible to partial a macro?

23:51 amalloy: zmaril: no. macros are contagious and not very composable

23:52 zmaril: amalloy: What does contagious mean in this context? That it can make bad things happen?

23:54 amalloy: once you have a macro, you need more macros to do anything with it

23:55 zmaril: Oh! I can just define by own macro then.

23:58 It worked! Thanks

Logging service provided by n01se.net