#clojure logs

2011-07-26

00:08dnolen_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
00:09dnolen_sorry two parts, 1) how to remove js* 2) why the error after loop?
00:09dnolen_loop/recur code emitted by ClojureScript seems crazy slow.
00:09dnolen_but that's another point.
00:10qeddnolen_: there are design discussions afoot about removing the need for js*
00:10dnolen_qed: yeah I'm aware of those, I'm curious as to why js* works here an not (js/Date.)
00:11rimmjob_hypothetically, could a clojure compiler be written that spits out java source code instead of bytecode?
00:11greghyou could use a java decompiler
00:11greghthough it would be *not pretty*
00:12devndnolen_: could you elaborate?
00:12devndnolen_: ah, sorry, missed the gist
00:12dnolen_rimmjob_: early, early versions of clojure did that, and generated JS before that.
00:13amalloyrimmjob_: theoretically, a clojure compiler can do nearly anything. in practice, you still have to write java code in order to get java code
00:28technomancyrimmjob_: mirah does that
00:28technomancyit has two output modes, bytecode and source.
00:30devndnolen_: I have no immediate answer to the problem of that js* call, specifically in node.
00:32rimmjob_technomancy: thanks, ill start playing with it
00:33technomancyhm; I never thought of it that way, but it could be useful for school assignments where java source is required.
00:34technomancyit's not too big of a leap from having an IDE fill in methods to having a compiler generate them from a better language.
00:34technomancyafter all, what is an IDE but a compiler that turns clicks and keystrokes into source code?
00:36amalloytechnomancy: a language that is "better" enough for this to be a meaningful exercise is unlikely to translate into nice java
00:36qedrimmjob_: why the incendiary nickname? It kind of sucks, no offense.
00:36qedIt colors everything you say in this channel with some nasty garbage.
00:36rimmjob_its the name on my birth certificate
00:37technomancyamalloy: 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.
00:37qedrimmjob_: 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.
00:38rimmjob_thats very rude
00:41amalloyif your goal is to improve the language in this channel (which is generally quite family-friendly), you're not doing very well, qed
00:43qedamalloy: It's not language; It's common decency. No, I would not like to have a conversation with someone whose moniker is rimmjob.
00:44amalloythen 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
00:46qedamalloy, I won't after this. You can be sure of that.
00:53zakwilsonIs there something in a popular library that converts Clojure maps to query strings?
00:53dnolen_lots of optimization opportunities in ClojureScript source generation ...
00:54hiredmanI am shocked
00:54hiredmandnolen_: does closure optimize them all?
00:54amacClojureScript still has new car smell, give it some time to break in
00:55dnolen_hiredman: it doesn't make ClojureScript faster at all.
00:55hiredmanjust smaller?
00:55hiredmanyou're not testing on rhino are you?
00:55dnolen_hiredman: node.js
00:56dnolen_hiredman: most just smaller from what I can tell.
00:56devnI have, but nil with node as of yet.
00:56hiredmanI decided I wanted a clojurescriptable browser so I started reading objective-c cocoa docs and figuring out how to launch webkit
00:57hiredmanhttps://github.com/hiredman/webber
00:57devnhiredman: cool
00:57hiredman(very much a yak shave)
00:57devnhiredman: no matter, cool.
00:57technomancyhiredman: did you give up on compiling to conkeror?
00:57dnolen_for example ClojureScript uses the arguments object for multi arity fn dispatch, for even low level predicates, big perf hit.
00:58hiredmantechnomancy: conkeror is not the same, like I really just want something really minimal that exposes the pieces and build it up with js
00:58hiredmandnolen_: I think the first hackernews comment I saw mentioned that
00:58technomancyyeah, too bad chromium's extension mechanism is batshit insane.
00:59devntechnomancy: :)
00:59hiredmanI need to figure out reflection in objective-c then I'll be able to do everything from js
01:00technomancyI don't have the patience to reimplement ido and hit-a-hint
01:01hiredmanme neither, webber is destined to go no where
01:01amalloydnolen_: i thought i read in someone's (chouser?) blog post that closure does the arity disambiguation for you
01:01dnolen_amalloy: I haven't seen anything like that in the generated source.
01:02amalloydnolen_: http://blog.fogus.me/2011/07/21/compiling-clojure-to-javascript-pt1/
01:02hiredmanbut once you start writing code it's hard to stop and suddenly it's 3am saturday morning
01:02amalloywhich might be exactly what you're saying? i'm not well-versed in js
01:02technomancyhiredman: you mean like http://wondermark.com/730/ ?
01:02dnolen_amalloy: there's no arity optimization going on there.
01:03hiredmanjust like that
01:03PupenoI'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.
01:03hiredmanI found a blog post on the minimal cocoa app with a gui and started from there after some abortive xcode attempts
01:04PupenoWhat am I doing wrong?
01:04amalloydrop the ()s around timida.core
01:05PupenoThanks.
01:11dnolen_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.
01:17amalloydnolen_: 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?
01:18dnolen_secret to figuring out what the hell ClojureScript is doing: cljsc foo.cljs {:optimizations :simple :pretty-print true} > foo.js
01:19dnolen_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.
01:20amalloyi'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
01:21dnolen_amalloy: ah but remember that Google Closure can remove the fns that's are used :)
01:21dnolen_s/are/aren't
01:21lazybot<dnolen_> amalloy: ah but remember that Google Closure can remove the fns that's aren't used :)
01:21amalloyhah, from what i hear if you're not careful with closure it will remove both kinds of functions
01:22dnolen_amalloy: it depends, right now ClojureScript is 10X slower than just writing it in JavaScript
01:22dnolen_for clientside code, I tend to agree, who cares.
01:22dnolen_but for scripts or server side stuff, these things matter more I think.
01:26dnolen_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
01:27zakwilsonIs there a more idiomatic way to convert a keyword to a string than (subs (str :foo) 1)?
01:27dnolen_,(name :foo)
01:27clojurebot"foo"
01:29devn,(keyword (str :foo))
01:29clojurebot::foo
01:29devn,(name ::foo)
01:29clojurebot"foo"
01:30devn,(name (keyword (str :foo)))
01:30clojurebot":foo"
01:31devn,::foo
01:31clojurebot:sandbox/foo
01:31devn,:foo
01:31clojurebot:foo
01:32amalloyi wonder what devn was trying to demonstrate there
01:32zakwilsonThank you dnolen
01:32devnamalloy: it was interesting is all
01:33devnthat you could build up something that looks like a namespace qualified keyword but not have the same behavior from name
01:33devnamalloy: i know why that is so, but even still it's interesting
01:36devn,(range 1 0 0)
01:36clojurebot(1 1 1 1 1 ...)
01:36devn,(range 3 1 -1)
01:36clojurebot(3 2)
01:39tomojI didn't think paredit-convolute-sexp would really be useful enough to bind
01:39tomoj..but I think it is
01:39devntomoj: never used it.
01:39devntomoj: what does it do
01:39tomojit's hard to understand
01:39tomojit's still hard for me to use, but I use it more and more often
01:39tomojjust have to get used to noticing when it is what you want
01:40devnwhoa. weird.
01:40devn(name (key|word (str :foo))) => M-x paredit-convolute-sexp => (key(name word (str :foo)))
01:42devn(name (keyword |(str :foo))) => M-x paredit-convolute-sexp => (keyword (name (str :foo)))
01:42devncrazy...
01:42tomojI had this: (concat (format-opts |opts) bound-opts)
01:42tomojconvolute to bug-free |(format-opts (concat opts bound-opts))
01:42devnthat's pretty cool tomoj
01:43devni can actually see myself using that regularly also
01:43amalloytomoj: i bound it to M-LEFT
01:43devnjust need to work it in
01:43tomoj:(
01:43devnamalloy: that makes sense
01:43tomojI think I need to get used to arrow-key bindings for remote emacs
01:43tomojI try never to use the arrow keys though..
01:43amalloythat's true
01:43amalloyi don't either. i guess i got used to them for paredit, with M-UP and C-RIGHT
01:43devntomoj: I turned them off for a year, so I don't feel guilty anymore :)
01:44tomojI used the non-arrow-key bindings for that paredit stuff, but they don't work in my remote emacs
01:44tomojdevn: good idea
01:44tomojI was thinking electroshock
01:44devn;; ;; there are no free rides, kiddo
01:44devn;; (global-unset-key [right])
01:44amalloytomoj: it's more useful than you think, btw - it will also work for (try (let [x 1] |(inc x)))
01:44devnetc.
01:44tomojamalloy: yeah, I just still don't quite get it
01:44tomojso I only sometimes see it
01:45devnIt's like playing Go. :)
01:45tomojevery time I use it and it works I'm like hooray
01:45amalloynow 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
01:46tomojdid you just switch the shift modifier but leave everything in the same places?
01:46devnMakes me think M-* is not the right place for convolute, amalloy.
01:46amalloytomoj: i think so? i'm not sure i understand the question
01:46tomojare you qwerty?
01:46amalloydevn: it's just typing M-2 that's hard :P
01:46amalloyyeah
01:47tomojah, there is an alternate dvorak layout with shifted numerals, but the symbols are all different
01:47amalloyi work with ninjudd, who i think may have lost his mind when changing everything about his keyboard layout all at once
01:47amalloyso i didn't do that
01:47tomojheh
01:47devncolemak and dvorak be damned. it's a puzzle I don't care to solve, but I applaud those who do.
01:47tomojI switched in high school I think, so qwerty drives me insane
01:48devnI'm a keyboard nerd but even I don't have the gaul to switch layouts :)
01:48tomojwhat's M-2 for?
01:48amalloyhaha gaul. i love the idea that some french guy could help
01:48devngood ole charles
01:48amalloytomoj: same as C-2 - universal argument
01:48tomojholy god
01:49amalloyexcept that C-S-@ doesn't seem to map to C-2
01:49amalloyso i have to switch to using M-
01:49tomojI didn't know it had an argument
01:49amalloytomoj: i found it helpful to think of convolute as: "bubble" the wrapping sexp up by N
01:50devnman, the depth of nerdmanship here is...beyond
01:50tomojawesome
01:51devni love it, but i think it's worth noticing
01:51devnsuch a cool community
01:51devn<3
01:52devntomoj: so you use dvorak with emacs?
01:53amalloyactually, 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
01:53devnamalloy: terminal emacs?
01:53tomojdevn: everywhere
01:53amalloygnome
01:53devnamalloy: odd. I've had C-S-... problems with terminal emacs
01:53devnbut never with GTK/Nextstep
01:54amalloydevn: actually, even in xev, C-S-@ doesn't appear as a key
01:54devnamalloy: maybe your keyboard hardware and/or layout?
01:54amalloyi wonder if C-S-2 would
01:54tomojhmm
01:54devni had xmodmap in the mix on Linux and Unix always
01:55devnbut I run OSX now, so I'm not sure...
01:55amalloydevn: if i take out the xmodmap line, xev sees it fine
01:55tomojhow can you type a shifted @?
01:55amalloytomoj: xmodmap
01:56tomojoh
01:56amalloyor M-x event-apply-shift-modifier
01:57genokuberguys i can't understand why this function http://paste.org.ru/?x2xh6j return LazySeq
01:57genokubermaybe it is fundamentals but i don't get it :(
01:58amalloythat's just how map works. it returns a lazy sequence
01:59genokuberhow i can change this? i want to (+ resultofthisfunction somenumber) do
01:59genokubermaybe cast ?
01:59genokuberor what
01:59amalloyi 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
02:00devngenokuber: what is the goal of your functions?
02:01hiredmancasting?
02:01hiredmanreally?
02:01devns/s\?$//
02:01lazybot<devn> genokuber: what is the goal of your function
02:01amalloyhiredman: casting "solves" so many problems in java, so...why not
02:02genokuberdevn 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
02:02hiredmanI think people who throw around the word "cast" like it somehow changes something are rapidly become a new pet peeve
02:02amalloyfor those following along at home, i've gisted a legibly-formatted version to https://gist.github.com/530385f2c09c63f893d6
02:02devngenokuber: that is not a descriptrion. I follow you to a point, but the context helps.
02:03devn"I am trying to make a house out of sticks. The sticks are brittle. The ground is made of clay."
02:03devndescriptrions sound gnome-esque
02:03amalloyint thisIsTwo = (int)2.5; // :(
02:04devnamalloy: heh
02:04hiredmanthat is the nature of sticks, and it is the nature of the ground
02:04devnhiredman: we invent nature.
02:05devnwe have a choice in how we go about inventing it, anyway...
02:05genokuberdevn all i have is http://paste.org.ru/?qipc62
02:05hiredmandevn: not according to hume
02:06devnhiredman: im talking about programming
02:06devnphysical constraints like the nature of sticks or of the ground are meaningless
02:06hiredmanprogramming is no different from anything else
02:06genokuber:(
02:07devnhiredman: sure it is. the physical constraints placed on a programmer are quite different from that of a civil engineer.
02:07hiredmandevn: but there are constraints
02:07devnhiredman: absolutely. but they are different.
02:07hiredmanthere is suffering and attachment and freedom from the same
02:08devnyes, but applying "nature" when it comes to how brittle a wood object is, have precious little bearing on how we program
02:08devns/have/has/
02:08lazybot<devn> yes, but applying "nature" when it comes to how brittle a wood object is, has precious little bearing on how we program
02:08hiredmanunless you are simulating wood
02:09hiredmanunless your computer is a big set of water powered wooden cogs
02:09devnhiredman: I would contest that simulating wood is not something we do often
02:09devnhiredman: :)
02:12genokuberi solved this by adding to the func def ok and return it in end of the function
02:12genokuberworse :(
02:15hiredmanto say everything is different is not insightful, obviously they are, but how are they similar? what are the analogs and isomorphisms?
02:15devnhiredman: both questions are equally important
02:15devnhiredman: do we agree?
02:16hiredmanwhat question did you ask?
02:17devnhiredman: how are these things different?
02:17devnhiredman: not explicitly I don't think
02:18hiredman*shrug*
02:18devnhiredman: it seems like it ought to be as important to care about similarity as much as difference, no?
02:19devnhiredman: maybe not...
02:23hiredmanif 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
02:24devnhiredman: "no man can cross the same river twice" merges similarity with difference
02:24hiredmanbut because we can gloss over the change and see what is the same we live in a world of stable identities
02:25devnstability is a wave of the hand though
02:25hiredmanbut a useful one, yes?
02:25devnyes
02:25devn:)
02:34fbru02hey guys what's an easy way to make clj highlighting apply to cljs ? (emacs)
02:34hiredmanM-x clojure-mode
02:35fbru02hiredman: doh ! thanks ! :D
02:35hiredman(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode)) <-- something like thise with clj replaced with cljs
02:36fbru02thanks ! :)
02:39fbru02hiredman: does slime work for clojurescript?
02:40hiredmanfbru02: nah
04:47harblcatwould emacs be considered the de-facto "standard" editor for clojure code?
04:48Chousukeit certainly seems to be the most popular one
04:48kumarshantanuharblcat: Emacs is currently the most powerful editor for developing Clojure code
04:48ejacksonits certanly widely used
04:49ChousukeYou can use whatever you find adequate though
04:49Chousukelots of people just like slime and paredit :)
04:49zakwilsonThere's no one standard, but Emacs+Slime has some advantages.
04:49Chousukenot to mention the other nice things emacs has, like magit
04:50zakwilsonI haven't been able to get used to paredit yet.
04:50Chousukezakwilson: it's pretty easy once you actually bother to give it a try.
04:50kumarshantanuharblcat: Alternatives are Eclipse/CCW, Netbeans/EnClojure, IntellijIDEA/LaClojure, and of course Clooj
04:50Chousukeit feels weird at first but it'll grow on you
04:50zakwilsonChousuke: I've tried it for an hour at a time a couple times. Trying again is on my to-do list.
04:51Chousukeyeah, an hour is probably not enough
04:51kumarshantanuI noticed that RedCar and Sublime Text 2 (with TextMate Clojure bundle) also support Clojure
04:52zakwilsonProbably not. Work to get done though and the client already wants it yesterday. No time to play with toys.
04:52kumarshantanuand jEdit has a Clojure plugin too
04:53kumarshantanunot to forget Vim/VimClojure
04:54ahriman`eclipse is good one i think
04:55aleonhardthi! has anyone ever made an attempt at calling clojure code from MATLAB?
04:55aleonhardti.e., via the MATLAB java bridge.
04:55lnostdal-laptopi tried eclipse+counterclockworkwise, but really didn't understand the deal; it reloaded the clojure environment every time
04:56ahriman`for what puprose, sorry?
04:56lnostdal-laptop..but i might have been using it wrong
04:57aleonhardtahriman`: 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.
04:58aleonhardtno luck so far, though. MATLAB refuses to find the classes. works like a charm from every other JVM language.
04:59aleonhardtjust checking if that's a known issue, or if somebody's done this before.
05:18wjlroeDoes 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
05:21harblcatis there a way, in the ns statement or otherwise, to do something like "import foo.bar.*"?
05:22ejacksonharblcat: nope
05:24harblcataww, 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...
06:03Chousukehttp://wagjo.blogspot.com/2011/07/one-syntax-to-rule-them-all.html the second image made me laugh :)
06:05ejacksonyeah, I ilked his style.
06:46fhdI've fooled around with the ClojureScript JS REPL a bit this morning, and it crashed my netbook twice. Is that a known issue?
06:49Chousukejavascript shouldn't be able to crash anything :|
06:50ChousukeIf it's really crashing hard, most likely your computer is somehow broken and the repl is just triggering the brokenness. :/
06:52winkmemleak?
06:52Chousukememory leaks don't crash things either
06:52winkunless oomkiller decides to go nuts
06:53Chousukeunless the OS is stupid I guess, yes
06:53winkwell, shouldn't != doesn't :)
06:53Chousukemost likely ClojureScript is just a trigger to some other problem.
06:53Chousukefaulty memory perhaps
06:54Chousukeor an OS bug
06:55winkfhd: 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
07:17fhdwink: I'll have a look when I get home
07:18fhdThought 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...
07:19fhdWas just wondering if anyone else has such issues, or if it's a problem with my system
08:03wjlroeHow 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
08:19dbushenkohi all!
08:20dbushenkodoes anyone know how to create an autoincrementing ID column in a table schema for PostgreSQL using clojure jdbc?
08:29manutterI'm not sure, but does clojure jdbc let you create sequences and set defaults on columns?
08:30manutterIf so, http://goo.gl/Vul0d may be of some help
08:30dbushenkomanutter: I didn't find that opportunity that's why I'm asking
08:30manutterah, I thought there'd be a catch somewhere :\
08:30dbushenkoyep, when I create the schema manually I do exactly as you've pointed me
08:31manutterjdbc should let you send raw SQL at some point, though, doesn't it?
08:31dbushenkodon't know...
08:31dbushenkoI'm reading http://devcenter.heroku.com/articles/clojure-web-application
08:31manutterah
08:31dbushenkoit has the following strange code
08:31dbushenko["select * from shouts order by id desc"]
08:31manutterI haven't used clojure jdbc so I'm just fumbling here
08:32dbushenkobut there is no "id" definition:
08:32manutterhm, and that's postgres db?
08:32dbushenkoah, sorry, seems like I've found
08:32dbushenko[:id :serial "PRIMARY KEY"]
08:33manutteraha, that sounds right
08:51neotykis here someone from clojure/core, I would like to know what is clojure/core take on running clojurescript against closure-library svn head?
09:05SergeyDHi. 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) "
09:07SergeyDSorry for broken grammar
09:08cemerick,`(- ~'sym1)
09:08clojurebot(clojure.core/- sym1)
09:08cemerickSergeyD: ^^
09:09SergeyDThanks!
09:23jcromartieI feel like Compojure has hidden away the original idea of "take a request, return a response"
09:25jcromartieunless the new docs focus on the bindings so much that they don't mention how to simply handle the whole request?
09:27jcromartieI don't see any documentation of how to simply pass the request to another function
09:34neotykjcromartie: you would usually destructure it first and than work only on parts that are interesting for you
09:35jcromartieI guess I'm just used to the old way :)
09:35neotykthough you can use part of map destructuring {.. :as req} to destructure your request and than have it bound to req
09:36jcromartieyeah
09:36jcromartieI guess everybody was destructuring in every handler "body" fn
09:37jcromartieso it makes sense to move that up
09:37jcromartieI think my original frustration was from not being able to just see what the request was
09:38neotykrequest 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
09:39jweiss_(doc add-watch) says "Alpha - subject to change" but also "Added in Clojure version 1.0". is it really still alpha?
09:39clojurebot"([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
09:39neotykit is good to be able to look at it, but most likely you need only part of it
09:39jcromartieyea neotyk
09:40jcromartiemaybe it would be better to add middleware that prints out the request if I'm interested?
09:41neotykI guess that something like that might be there already
09:41jcromartieand use this: http://clojure.github.com/clojure/clojure.inspector-api.html
09:41jcromartieforfun
09:41neotyklike a log parser
09:42neotykcould be nice addition
09:48jcromartiebut after spending about 1 hour with Noir, I've ganked the parts that I like into my raw compojure app
09:48jcromartiemostly, defpartial
09:52neotykhaven't got time to play with Noir, was it nice?
09:54dbushenkoneotyk: try https://github.com/dbushenko/Clojure-WebApp
09:58ejacksonaaah, a rails-alike, that's potentially useful.
09:58neotykWell I'm not really into rendering html on server
09:59neotykrendering json is good enough :-)
10:01ejacksonneotyk: 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:01ejacksonsorry to be noobing it up quite so much
10:02neotykor directly to JS in front, or now to CS
10:03ejacksonwhat do you mean 'in front' ? sever-side ?
10:03neotykin front ~browser
10:03neotykor api consumer
10:06ejacksongotcha, thanks.
10:11neotyknp
10:16jcromartiewith-inspector middleware: https://gist.github.com/db4d99bbec37ca8a0f5d
10:16jcromartiesimply, but awesome
10:19jcromartiemakes your screen a bit messy
10:19jcromartiebut reminds me of Seaside in Smalltalk for some reason :)
10:19jcromartieexcept without the mutability
10:21Scriptorhi 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:23jcromartieScriptor: can you test it?
10:24jcromartieand I'd expect that macro expansion happens first
10:25jcromartiehm, looks like it doesn't
10:25jcromartie(defmacro m-split [] 'split) (. "a,s,d,f" (m-split) ",")
10:25jcromartiebased on that test
10:26Scriptorjcromartie: right, I'd guess it doesn't do macro-expansion first based on the source for functions like first, rest...
10:32kjeldahlwThere'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:36TimMcWhy are there no "[X] is the oomkiller" jokes on the web?
10:37Scriptorout of memory killer?
10:39raekkjeldahlw: add an IRC bot and then it's complete :-)
10:40raekScriptor: don't think so since . is a special form. I think you need to construct the method call code in your macro
10:41raekmacro expansion is only done at "places" which represent normal clojure expressions, e.g. (def foo <here>) but not (def <here> "value")
10:42Scriptorthought so, otherwise you'd run into issues with macro names colliding with method names
10:42kjeldahlwWith support for jvm,clr and javascript I'm running out of excuses for why I should not be using clojure everywhere.. :-)
10:44edwkjeldahlw: 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:45kjeldahlwedw: Yup, totally lickable.
10:50TimMcScriptor: Yeah, in parody of "Fear is the mind-killer..."
10:52jcromartieedw: it makes me sad whenever I have to work on our C# app
10:52jcromartieedw: or pretty much anything... although Emacs has some nice modes for Ruby etc.
10:57theignoratiis there an equivalent to != in Clojure?
10:58manutternot=
10:58dnolenman I wish people would stop feeding trollish behavior on the ML.
11:02cemerickI think it's an intractable problem unless someone is willing to actually mod people/messages out.
11:04jcromartieimproved with-inspector: https://gist.github.com/db4d99bbec37ca8a0f5d
11:04ejacksonI think it would be fun job for clojurebot.
11:04jcromartiesuitable for use on public sites
11:04jcromartienot that you'd REALLY want to do this
11:04jcromartiebut at least to guard against remote triggering of it :)
11:04dnolencemerick: troll feeding is nearly as bad the trolls IMO. if people don't ignore them, they'll never go away.
11:04jcromartiecemerick: it's like spam... if it didn't work, they wouldn't do it
11:04edwIf you spend too much time talking about trollish behavior, the terrorists -- er, trolls -- have already won.
11:05dnolenedw: 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:06cemerickI don't actually think trolls are discouraged by silence. It seems we've seen a couple of examples of that.
11:06dnolencemerick: no but it doesn't spawn pointless threads.
11:06dnolenthat's worse IMO.
11:07jcromartieOK guys this is probably going to be the best thing you learn all day... unless you already saw it on HN :P
11:07jcromartiehttp://www.gnu.org/software/libtool/manual/emacs/Follow-Mode.html
11:07ejacksonjcromartie: yeah its pretty fab.
11:07ejacksonthe problem is I like to have my source and repl side by side, and this eats it
11:09jcromartieejackson: I like the REPL at the bottom
11:09jcromartiefairly narrow
11:09ejacksonnow if I could have follow on 2 cols, and emacs in a third --- dammit, i'd have Visual Studio !
11:09jcromartieor rather, short
11:09jcromartieyou can do that
11:10jcromartiefollow mode <steve jobs>just works</steve jobs>
11:12jcromartieejackson: if you mean like: | code | code | repl |
11:13ejacksonmore like you |code|code| with repl below
11:13ejacksonbut I'll never keep up with that, too hard
11:13jcromartieoh? no that's exactly what I do
11:13jcromartiesometimes
11:14ejacksonyou you move between the buffers with c-x o ?
11:14jcromartiealthough more often than not, different windows are for different namespaces
11:14jcromartieor the mouse
11:14jcromartiebut yeah, C-x o is no biggie
11:14jcromartieI use Mac OS X Emacs
11:14jcromartieThat is, the GUI version of GNU Emacs for Mac OS X
11:15ejacksonhmm... follow-mode on that arrangement was particularly strange.
11:15thorwilhmm, how exactly could clojurescript help with client-server messaging, filling the gap where one might otherwise use json?
11:16dnolenthorwil: richer datastructures, arbitrary keys.
11:17ejacksonso you send your datastructure itself rather than serialise to json
11:18thorwilbut i thought you would have (compiled) JS on the client, so how/where to cross that bridge?
11:19dnolenthorwil: you'll just deliver the Clojure data structure as a string, just like JSON.
11:19ejacksonthorwil: my first guess is by writing the the clojure datastructure to a network stream, and reading it on the other side
11:19Scriptorthorwil: I think the clojurescript reader is built-in
11:19Scriptornot sure if that answers the question...
11:20thorwilScriptor: if that's true, i guess that's the missing piece i wasn't aware of
11:20dnolenScriptor: thorwil: the reader is written in pure ClojureScript
11:20Scriptorright ^
11:20Scriptorso you can include it just like any other js lib
11:21thorwilgreat :)
11:23thorwili'd still worry about debugging
11:23Scriptorthorwil: the whole cross-language debugging thing?
11:24dnolenthorwil: ClojureScript produces mostly sensible JavaScript. Eventually I imagine we'll have good source mapping.
11:24thorwilScriptor: testing with we b console/firebug in firefox and not being able to map the errors to the source
11:25Scriptorthorwil: it's actually not that hard to map the errors back
11:25Scriptorespecially if the output is sane
11:26Scriptordnolen: 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:26Scriptoreg: the body of an if expr compiled before the condition
11:27dnolenScriptor: I believe Google Closure already does this, haven't looked to closely at it yet tho.
11:27dnolenScriptor: does source mapping I mean.
11:28Scriptordnolen: I was thinking mapping a js line back to the original cljs line
11:29dnolenScriptor: 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:32Scriptordnolen: 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:33edwdnolen: 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:35ejacksonedw: 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:36edwejackson: What was the best seagull-combating technique?
11:36ejacksonedw: {}
11:36ejacksonthey are invinsible.
11:36cemerickejackson: you mean #{} ?
11:37ejacksoncemerick: indeed I do.....
11:37edwAh, so: "Eat your icecream indoors."
11:37Scriptorfalcon sounds maybe?
11:37ejacksonedw: we had one come into our office to get the breakfast cereal once
11:38ejacksonhe was encouraged though....
11:38edwHaha, Scriptor .
11:38cemerickScriptor: has the Closure inspector been mentioned already? https://code.google.com/closure/compiler/docs/inspector.html
11:39Scriptorcemerick: it hasn't, does it map back to the original clojure code?
11:39cemerickIt maps back to the original *javascript* code.
11:39Scriptorah
11:39Scriptorso js->clj mapping seems to be the next step
11:39cemerickThe cljs compiler would need to emit a corollary js -> cljs mapping
11:40cemerickright, plus forking the Closure inspector to make use of it.
11:40ejacksonthat could be useful indeed
11:40cemerickI look forward to someone else doing all that. :-D
11:40Scriptorhmm, the reader assigns line numbers to each token, right?
11:41Scriptor(not assigns, but you know what I mean)
11:41edwcemerick: I think we can all get behind that sentiment.
11:41cemerickRight!
11:41cemerickedw: Your mother smelled of elderberries! :-P
11:42edwI do not have access to the meaning behind that idiom.
11:42Scriptor*fater*, damnit
11:42Scriptor**father*
11:43cemerickedw: ah, sorry, then :-)
11:43ihodeshello all. it's been a while; is this room handling ClojureScript as well, or is there another #?
11:44Scriptorihodes: one channel to rule them all
11:44dnolenScriptor: I'm sure these will get sorted out. In fact I expect that the ClojureScript debugging story will outpace the Clojure one.
11:44ihodesScriptor: i'm more worried about one channel to bind them ;)
11:45dnolenScriptor: as script debugging interfaces in browsers are now pretty darn good and the major ones are interested in native support for source mapping.
11:46edwAh, Monty Python! I stayed away from that as a kid. Didn't want to do the full nerd.
11:46Scriptordnolen: pretty good news, I'm actually surprised it hasn't happen before, considering how ubiquitous cofeescript is getting
11:47cemerickedw: Right, finally got a good link for you: http://www.youtube.com/watch?v=QSo0duY7-9s ;-)
11:47cemerickThough I mixed up the insult a bit…
11:47edwRight, father and all. It's OK. Insult accepted!
11:47cemerickHa, excellent!
11:49edwI learned that Terry Glliam is American only yesterday.
11:50edwSorry for that poor grammar.
11:52Scriptorso there's no metadata support in clojurescript yet?
11:54dnolenScriptor: metadata is supported but not on symbols I think.
11:54dnolenScriptor: and by that I mean that symbols can't store metadata.
11:54ihodeswhat'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:56dnolenihodes: why not use an existing Java lib?
11:57ihodesdnolen: 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:57Scriptorhmm, 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:06ihodesi think i'll stick with a record for now and optimize later
12:11technomancyoh man, terry gilliam is the man
12:33gfrlogI 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:33gfrlognow various lein commands (including lein new) fail with:
12:33gfrlogjava.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:34gfrlogwhich is nothing I've ever seen in my twenty years as a clojure programmer
12:35gfrloganybody know what's going on or have any good guesses?
12:35ihodesgrrr... for future refernce, there's a complex-numbers namespace in contrib. doesn't look fast, but it'll do for now.
12:35technomancygfrlog: you probably want update-java-alternatives
12:36technomancyI think gcj only exists in apt for the poor souls on debian/kfreebsd who don't have openjdk.
12:37gfrlogtechnomancy: I've always wondered which is better.
12:37gfrlogtechnomancy: thanks for clearing that up
12:38technomancyhehe
12:38technomancyif you want to try fringe jdks you should check out avian
12:38technomancyapparently it can AOT straight to native code
12:38gfrlogtechnomancy: nope, don't want fringe jdks :) I just picked the first one on the list.
12:39gfrlogBut that does sound like an interesting project.
12:39technomancyI think the only criteria whereby gcj comes out ahead of openjdk is lexographic sorting.
12:40gfrlogwhich unfortunately is the only metric the managers care about
12:40kumarshantanutechnomancy: have you tried avian? would like to know about any first hand experience
12:41technomancykumarshantanu: only briefly. I haven't actually tried the AOT, and without AOT it's much slower to boot.
12:41technomancybut it works with Leiningen as long as you use the OpenJDK class library.
12:41technomancyapparently AOT cut the boot time in half for a raw clojure repl.
12:42technomancyalso: it has TCO and continuations.
12:42kumarshantanuthat sounds interesting (AOT boot time), worth a try
12:42ihodeswow... been a while since i needed to track down info on contrib :\ rough.
12:42kumarshantanuthough not sure how to try out TCO/continuations
12:43technomancyyeah, I don't know if continuations are exposed in a way that would be useful to clojure
12:44jonasenHow do I make (native) javascript maps in ClojureScript? Should I use (js* "{'a': 'b'}") or is there a better way?
12:44kumarshantanudoes avian extend the byte code set of the JVM/JLS? *wondering*
12:45ihodesjonasen: js-array i think... let me peek again
12:46ihodesjust array
12:46ihodeshaven'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:47jonasenihodes: But that creates an array, not a map with arbitrary keys?
12:48ihodesoh my bad, i completely misread map... as array. there's no excuse... wow haha
12:48gfrlogtechnomancy: lein work great now thanks
12:48Scriptoreven js-obj seems to use (js* "{}")
12:49jonasenScriptor: yes, I noticed that. I've been looking for it in the source but no luck yet
12:50jonasenThere is also a nice js->clj function. An inverse of that would be nice imo.
12:50Scriptorjonasen: found this with googles: https://gist.github.com/1098372/d4e234f1cb0316fcedf184e87ab9ca94033ad523
12:56jonasenThis seems to work: (defn js-map [& kv] (let [m (js-obj)] (doseq [[k v] (partition 2 kv)] (aset m k v)) m))
13:18jcromartieis it just a convenience that a Var implements IFn
13:18jcromartieor is there something else going on there?
13:18jcromartie,((var inc) 1)
13:18clojurebot2
13:22cemerickjcromartie: the former
13:25jcromartiecemerick: 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:25jcromartie(passing a var to the Jetty handler)
13:25jcromarties/handler/adapter/
13:25lazybot<jcromartie> (passing a var to the Jetty adapter)
13:26ataggartI'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:27neotykataggart: once at Amsterdam Clojurians we had nice presentation about FP in clojure
13:27neotyklet me look it up
13:28neotykataggart: https://github.com/joodie/talk-functional-clojure-sequences
13:28ataggartthanks. 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:28technomancywe had a talk like that at the seattle tech startups meetup.
13:28neotykif you can get FP 101 through you will benefit greatly from it :-)
13:28technomancyit didn't actually work out so well though
13:29technomancymostly because of short notice though
13:29neotykwe meet here in Amsterdam on monthly basis
13:29digasht
13:29ataggartwell the other guys have had a while to prepare. http://www.meetup.com/vancouver-scala/events/25283181/
13:30neotykbut we mostly code, rarely we do presentations
13:30neotykand that is probably why we get so little of newcomers
13:31neotykbut in 1.5 month we'll have Uncle Bob again, he always attracts attention
13:31ataggarttechnomancy: what stuff did you go over in your talk?
13:32ataggartI'm inclined to steal a bit from Fogus' talk on the expression problem
13:32technomancyataggart: state and identity mostly
13:33neotykataggart present ClojureScript
13:33neotykthat is what I'm planning to do next meetup
13:33ataggarttechnomancy: 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:35ataggartneotyk: 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:36ataggartmaybe macros
13:37neotykrunning on JS is distinct from other langs
13:37neotykbut it's your preso, not pushing
13:38ataggartit's on the list. I'd just need to educate myself on it first :)
13:39neotykI'm so happy for ClojureScript, only backbone.js was making it easier for me to write client side
13:39neotykand now I don't have to bother with it :-)
13:39hiredmanneotyk: there is a port of haskell to js somewhere
13:39neotykI've seen demo of it last year on Dutch FP Day
13:40neotykmust say it was quite different
13:40neotykeverything was IO monad
13:40neotykand ti was quite limited
13:40neotyks/ti/it/
13:40lazybot<neotyk> and it was quite limited
13:41hiredmanand clojurescript is not?
13:41neotykfrom what I could understand at that time
13:42neotykmight be a bit, but you have macros so what can go wrong ;-)
13:42hiredmanbut the macros are different
13:43hiredmanyou have to define them in a seperate file and include them differently than in clojure
13:44neotykpoint taken, but still I feel much better writing CljureScript than JavaScript
13:46neotykI guess the same as Haskellers generating JS
13:49ataggarthas anyone here used neo4j
13:53HK_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:53HK_is there a certain advantage in doing so?
13:55teromHomoiconicity is one big advantage. Code is data and data is code. This is why Lisp can have macros easily to generate code.
13:55ampleyflyI would guess because it makes function calls look like lists
13:55ataggartare lists, not just looks like
13:56mdrogalisMaybe because it's so easy to write the reader.
13:56ScriptorHK_: basically, there really arent' any operators, just function calls (and special forms, and macros)
13:56Scriptorbut even then, they can all be represented with the same data structure
13:57cemerickHK_: Lisp is something like 55 years old — I'm not sure it gets more conventional than that. ;-)
13:57ejacksonone () to rule them all ... and in the darkness bind them.
13:58cemerick:-D
13:58ejacksonof course, that assumes you're using emacs, in a dark color-scheme...
13:58ejackson... which, you are, naturally...
13:59ScriptorI use the default
13:59cemerickejackson: I can *never* remember your twitter handle. You should have paid @ejackson for his.
14:00ejacksonindeed - i dismissed twitter as a highschoolers toy to my detriment.
14:00ataggartI have yet to dismiss that notion.
14:02cemerickIt's definitely not a toy; a distraction, perhaps. That can be a good or bad thing, depending.
14:02HK_so would there be a disadvantage in using a lisp language that looked like convential functions in other lanugaes: function(param1 param2)?
14:02cemerickHK_: Macros would either not be possible, be less powerful, or be more difficult to implement / use.
14:03cemerickLook at the pain that are AST transformers in various languages for examples.
14:04ampleyflyhttp://en.wikipedia.org/wiki/M-expression
14:07HK_ok, thanks for all the answers
14:28amalloyampleyfly: crazy. imagine if M-expressions had survived
14:31mdrogalisWhat were M-Expressions?
14:31mdrogalisOh, nevermind. I see the link.
14:53ampleyflyamalloy: yeah, it would seem odd
15:01the-kennyAny idea why any kind of tab-completion in swank throws a ExecutionRejectedException?
15:02technomancythe-kenny: you want swank 1.3.2 probably
15:02the-kennytechnomancy: Ah, i'm on 1.3.1. Will try that, thanks.
15:04user__what does it mean if 'fn' has an asterisk (*) appended to it?
15:04the-kenny1.3.2 fixed it. Thanks :) Loosing autocompletion in slime is like loosing a finger (which is pretty problematic when coding in Emacs)
15:05Scriptoras long as you don't lose your thumb
15:08cemerickuser__: fn* is the "real" special form that is implemented in the Clojure compiler.
15:09amalloy&(macroexpand '(fn [] 1))
15:09lazybot⇒ (fn* ([] 1))
15:10user__cemerick: thank you
15:17dnolenhmm 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:24jcromartiednolen: that is incomprehensible to me... where would I start to understand logic programming?
15:25chouserdnolen: does that have any constraints other than just generating all possible options for a give phone number?
15:30dnolenchouser: no it just generates all possibilities for a given number. the magic is appendo.
15:31dnolenchouser: 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:31dnolenchouser: avoid all the split range acrobatics in stuart sierras version.
15:32chouserdnolen: where's his version?
15:32dnolenchouser: https://gist.github.com/1105563
15:33amalloychouser: 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:33dnolenmine is mostly the same besides encode.
15:33chouseramalloy: cdata, comments, etc. should perhaps be added
15:34mdrogalisDoes Compojure stack up to Sinatra? Is it more or less a complete web framework?
15:35dnolenjcromartie: The Reasoned Schemer, Ambrose's Logic Starter tutorial, or a good Prolog book (Bratko)
15:36technomancymdrogalis: clojure libraries tend to be built of simple composable pieces
15:37technomancycompojure 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:37mdrogalisSo it's more of a collection of pieces that you assemble yourself based on your own needs?
15:37raekyes
15:37raekmdrogalis: http://brehaut.net/blog/2011/ring_introduction
15:37technomancyright, like any well-designed, loosely-coupled system
15:37mdrogalisSeems a little harder to use, in my opinion. Is it more suitable for experienced web developers?
15:37raek"A Brief Overview of the Clojure Web Stack"
15:38mdrogalisThanks, raek!
15:38neotykchouser: what is clojure/core view on running clojurescript against svn head of closure-library?
15:38chouserneotyk: I'm aware of no official view.
15:39neotykThere is tons of goods in head
15:39neotykhtml5localsotrage, websocket
15:40neotykand probably more
15:41amalloyman. it ought to be punishable by death to release libraries with .foo.clj.swp files in the jars
15:41jcromartiemdrogalis: you have to know what's going on at the various levels to use Compojure
15:42jcromartiemdrogalis: I'd say you should be comfortable with various details of HTTP
15:42jcromartiethat 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:43mdrogalisInteresting.
15:43mdrogalisThat makes sense to me.
15:43jcromartieI 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:44jcromartiethe 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:44amalloyjcromartie: 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:44jcromartieno but Enlive and Hiccup aren't "web frameworks"
15:45jcromartiethey're HTML presentation libraries
15:45drew127anyone know why (.size (java.awt.Font. "Monaco" Font/PLAIN 12)) might not work?
15:45jcromartieand that's the beauty: it's all just libraries that can fit together easily because the interfaces are simple
15:45amalloy*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:45drew127I get #<CompilerException java.lang.IllegalArgumentException: No matching field found: size for class java.awt.Font
15:45drew127but the size field is right there in the Java docs
15:46amalloyso to say that one thing is a framework and one is a library is just a matter of degree
15:46Raynesamalloy: And for good reason.
15:46amalloyRaynes: you caught me, i'm secretly in love with rails
15:46jcromartiewell, things like Noir seem to be trying to be
15:46jcromartieNoir says "put your views here, use defpage, use hiccup"
15:46amalloy$javadoc java.awt.Font
15:46hiredmandrew127: protected field
15:47lazybothttp://download.oracle.com/javase/6/docs/api/java/awt/Font.html
15:47jcromartieand it does more "behind the scenes", where really Compojure is simple enough for me as it is
15:47amalloyindeed, protected. java loves you to use .getSize
15:48jcromartieI'm finding my app is straddling the line between an API and HTML site, so what Noir imposed didn't really make sense
15:48drew127hiredman: thanks
15:48drew127getting my Java hard knocks
15:48drew127and thanks amalloy
15:49hiredmanit's good that you are reading javadocs, a lot of people don't :/
15:49jcromartieNoir has a global state that keeps track of what routes do what, and middleware is applied globally too
15:50drew127I'd forgotten what protected meant
15:50drew127protected from \what, I wonder
15:50amalloyblech. global middleware?
15:50amalloydrewr: 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:51drew127hahaha
15:52jcromartieamalloy: yeah it's what you sacrifice for getting a "simple" framework
15:52drew127that reminds me of a sign on an abandoned playground I saw once
15:52drew127it said
15:52drew127"this playground has been closed for your convenience"
15:52drew127Java kind of feels like that
15:52cemerickamalloy: something like that would likely be necessary for a webmachine-like result
15:52cemerick(if that's something one cares about, anyway)
15:52amalloycemerick: tbh all i know about webmachine is that kirindave was excited about implementing it in clojure a while back
15:53cemerickI think that stalled out.
15:53amalloyi thought he got something he was happy with
15:53cemerickoh, nm then
15:53amalloybut since i never understood the goal, i'm not qualified to judge
15:54cemerickIn any case, the concept is that you define handlers such that interrogative requests (like HEAD), accept-encodings, etc. are handled properly.
15:55cemerickQuasi-automagically that is, which makes the solution perhaps necessarily framework-y.
16:01DethStrykels
16:01vertegalexit
16:01amalloyhuh. i had no idea hiccup's (html) macro made an attempt to precompile structures it recognizes
16:03hiredmanneat yes?
16:03amalloyyeah, that's pretty clever
16:04amalloyalthough, jesus, it uses eval at macroexpansion time to do it?
16:04amalloyi guess it only does so in some well-constrained ways, but it still worries me
16:17jcromartiewhat would worry you about that amalloy
16:18amalloyum. using eval is always worrisome, period, even if sometimes it's fine
16:18amalloyat macro-expansion time, it's usually a beginner trying to do something with a macro that can't be done with a macro
16:18amalloyobviously not the case in hiccup, though
16:19hiredmanman xcode4 is just like itunes
16:20Hodapphiredman: How?
16:21hiredmanthe ui
16:21Hodapphmm
16:21HodappI'm not a big XCode fan
16:21hiredmanme neither
16:21hiredmanall I want is to build the latest iterm2
16:22amalloyhiredman: see if Genius will build it for you
16:22hiredmangood point
16:34PupenoWhich contribs should I use (http://clojars.org/search?q=contrib)?
16:34technomancyis one of the prerequisites for OS X the ability to use the term "genius" non-ironically?
16:35Hodapptechnomancy: nah.
16:35technomancy(applied to software or front-line tech support grunts at least)
16:35scottjPupeno: for 1.2, the one that lein puts in your project.clj, for 1.3 maybe the ones at github.com/clojure
16:36Pupenoscottj: I don't think lein put one one my project.clj, but if it did, it's gone.
16:37Hodapptechnomancy: It's one of those oft-abused buzzwords, like "innovation" that some companies love to throw around
16:37Pupenoscottj: I created another project… no contrib.
16:37Pupenoclojure 1.2.1
16:38technomancyscottj: that doesn't get added by default anymore
16:38technomancyPupeno: use whatever contribs you need
16:38Chojinif 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:38technomancyavoid monolithic contrib if you can
16:39ChojinI don't want to have to use a bunch of (myns/foo (myns.bar :something))
16:40PupenoMmmh…. so, how do I get http://richhickey.github.com/clojure-contrib/properties-api.html
16:40Pupeno?
16:41technomancyPupeno: I think monolithic contrib is the only place to find that, so [org.clojure/clojure-contrib "1.2.0"]
16:42amalloytechnomancy: i thought you hated domain-name groupids; doesn't lein imlicitly supply the org.clojure part?
16:42technomancyit does, but I also hate special-cases
16:42technomancyso I'm torn.
16:43technomancyI'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:43amalloytechnomancy: solution: implicitly supply org.clojure for every artifact
16:43technomancyheh
16:44technomancyI like the cut of your gib.
16:46PupenoHow do I reload a project after clojure-jack-in? to re-load dependencies?
16:46technomancyPupeno: C-c C-l
16:48Pupenotechnomancy: doesn't seem to work just loading the project.clj, or do you mean something different?
16:48technomancyPupeno: it works on namespaces inside your project
16:48technomancythere's no way to reload the entire JVM without restarting
16:49Pupenook.
16:49hvwhat should I bind *out* to, in order to suppress it?
16:49hv,(binding [*out* nil] (println "suppressed"))
16:49clojurebot#<NullPointerException java.lang.NullPointerException>
16:50hiredman,(do (with-out-str (println "foo")) nil)
16:50clojurebotnil
16:55hvhiredman: Will it incur any overhead because it stores the string I want to discard, and at the end discards it?
16:55amalloyhv: looks like apache commons-io has http://commons.apache.org/io/api-1.4/org/apache/commons/io/output/NullWriter.html
16:55hiredmanhv: what do you think?
16:55amalloyor of course you could write your own
16:55amalloyor use a FileWriter on /dev/null, or...
16:56hvhiredman: I guess it stores it, but I am not sure.
16:59hvhiredman: yes, it keeps the string and discards at the end.
17:01hvamalloy: thanks. yet, I am looking for something simplre.
17:01hv*simpler
17:01drew127so I just patched clooj to change text size
17:01drew127anyone looking at the clooj codebase around here?
17:02drew127I want to make the zoom command "CMD +" as is usual
17:02drew127but I can't figure out how to say this to Java
17:02drew127for the time being I just used a letter
17:02drew127it works
17:02technomancyprobably because CMD isn't portable?
17:02drew127well, that's what's already in the clooj codebase
17:02drew127can I paste code here for example?
17:03technomancyas long as you use gist or something
17:04drew127like so?
17:04drew127https://gist.github.com/1108033
17:04drew127that's the way it seems to work in the clooj codebase
17:05amalloydrewr: macosx is probably stealing the cmd-+ before it gets to clooj
17:05amalloy(unless what technomancy said is right, which i'd prefer to believe)
17:05drew127it's not actually that
17:05drew127when I put "cmd +" in that code snippet
17:06drew127nothing showed up in the menu
17:06drew127so it's not even getting there
17:06drew127it's obviously the wrong way to tell Java the plus key
17:06drew127so I tried "cmd PLUS"
17:06drew127no luck
17:06drew127and I tried .getKeyCode, etc.
17:06drew127no help from that
17:06technomancypoor drewr
17:06drew127haha
17:06drew127do you know how to figure that out?
17:07drew127I'm sure the author of clooj does
17:07drew127maybe I'll just email him the patch
17:07technomancysorry, I've never done any gui work outside elisp
17:07drew127I don't blame you
17:07drew127though elisp is fun?
17:07drew127boy
17:07drew127I find *that* scary
17:08technomancyit's a crappy lisp, but it's the best UI toolkit I've ever seen
17:08drew127I wonder if this clooj might eventually become emacs in a *good* lisp
17:08drew127that would be amazing
17:08drew127I mean it's very basic now
17:08drew127but it's only released a week ago
17:08amalloytechnomancy, drewr: fwiw, "cmd" is replaced, by clooj, with the right modifier for the OS it's running
17:09technomancyamalloy: tab completion bro
17:09technomancygotta fix it
17:09drew127amalloy: is that in clooj.utils?
17:09amalloytechnomancy: haha i actually have it working fine, but forgot which drew i was talking to
17:09amalloyyes
17:10amalloyhttps://github.com/arthuredelstein/clooj/blob/master/src/clooj/utils.clj#L204
17:11amalloy$javadoc javax.swing.KeyStroke
17:11lazybothttp://download.oracle.com/javase/6/docs/api/javax/swing/KeyStroke.html
17:11amalloydrew127: so it probably wants Cmd Shift = or something
17:13drew127here's what it says:
17:13amalloy&(javax.swing.KeyString/getKeyStroke "ctrl shift =")
17:13lazybotjava.lang.ClassNotFoundException: javax.swing.KeyString
17:13amalloy&(javax.swing.KeyStroke/getKeyStroke "ctrl shift =")
17:13lazybot⇒ nil
17:13amalloy&(javax.swing.KeyStroke/getKeyStroke "ctrl s")
17:13lazybot⇒ nil
17:13amalloyhmph
17:14drew127sorry
17:14drew127didn't realize that was going to break things
17:14drew127using gist
17:15drew127https://gist.github.com/1108064
17:15drew127(my first time on IRC, sorry)
17:19teromMaybe "cmd typed +"?
17:23drew127amazing, that works
17:23drew127except
17:23drew127technomancy was right
17:24drew127it seems to be swallowed by the OS
17:24drew127I'm gonna see if Arthur Edelstein has any ideas on this
17:24drew127meanwhile
17:24drew127I'll just use some random letters
17:24drew127not ideal
17:24drew127but at least we get text zoom in clooj
17:24drew127of some kind
17:25drew127terom: btw, where do you find documentation on stuff like that
17:26technomancyis it still using a proportional-width font?
17:26drew127clooj you mean?
17:27technomancyyeah
17:27drew127I'm not sure
17:27drew127that means not fixed with, unlike emacs?
17:27drew127let me restart it and look
17:27amalloywell, emacs will use whatever font you tell it to
17:27amalloybut if you use variable width for coding you are a madman
17:28drew127it was courier and monaco
17:28drew127that's fixed width, right?
17:28technomancyyeah, I briefly took a look at it on my box and it was using some crazy proportional-width font here.
17:28technomancygood to know it wasn't intentional =)
17:29drew127seems to be fixed-width now
17:29drew127I'd like to make a menu to select fonts too
17:30drew127but right now changing size is enough of a win for me
17:30technomancymeh; put it in a config file
17:30drew127I hear an Emacs user talking
17:30drew127but it doesn't even have a config file at this point
17:30drew127it's hard-coded
17:31hiredman:(
17:31technomancycan you get a repl into clooj's own process?
17:31drew127you mean from an external process?
17:31drew127I doubt it
17:31drew127haven't tried
17:31technomancyno, I mean from within
17:31drew127well, there is a repl there
17:31drew127is that what you mean?
17:31amalloyi don't think he cares whether the repl is launched internally or internally
17:31drew127ther repl is a little weird
17:31technomancyright, but that's for the project
17:31amalloyhe wants to have a repl that can play around with clooj itself
17:31drew127oh
17:31drew127I don't think so
17:31technomancydoes clooj run in-process with the project being worked on?
17:32technomancyamalloy: well, not for me personally
17:32amalloytechnomancy: what, not going to abandon emacs?
17:32drew127what do you mean by in-process with the project being worked on?
17:32amalloy~salespitch
17:32technomancyI'm just saying, if you're going to build something like this, it needs to be self-hosting and expose its guts
17:32clojurebotTitim gan éirí ort.
17:32technomancyamalloy: heh
17:33technomancydrew127: 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:33drew127how do you determine that?
17:33neotykswank.swank/start-repl
17:33drew127using PS on your machine
17:33hiredmanthe first thing I got going in my little javascript<->cocoa webkit thing was a js repl
17:33drew127?
17:34amalloytechnomancy: it launches a classloader, looks like
17:34amalloybut not a jvm
17:34technomancyright; cool. so if it doesn't let you repl itself, that seems like a pretty big oversight
17:35hiredman"go repl yourself"
17:35technomancynot that it's unreasonable for three-week-old projects to have omissions like that
17:35drew127is that something that's easy to fix?
17:35technomancyit's just the first thing I would add if I were working on it
17:35amalloytechnomancy: can't you get one yourself, by launching clooj from a repl?
17:35technomancydrew127: hopefully, as long as the UI for the existing repl is flexible enough
17:36technomancyamalloy: probably, but you don't get any self-hosting points that way
17:36technomancy's all 'bout the turtles.
17:36drew127to quote tom lehrer quoting lobachevsky: "dis, I know from nothing"
17:36drew127anyway, can change text size now in clooj
17:37amalloytechnomancy is self-appointed Turtle Inspector. if he spots one damn elephant...
17:37drew127maybe turtles come later
17:39drew127anyway, if anyone is inclined to look at it, I'm curious if I've used agents properly in my patch:
17:39drew127https://gist.github.com/1108130
17:40drew127I thought I shouldn't use an atom, because in theory new objects could have side effects
17:40drew127I'm pretty new to this myself
17:41amalloyusing agents seems a bit nuts
17:41drew127yeah, it does
17:41amalloyand you're hardcoding monaco in one place, but not the other
17:42drew127well, monaco was already hardcoded
17:42drew127oh
17:42drew127true
17:42drew127so should I use an atom?
17:42drew127it seems nuts, as you say, to have to get the value of the agent with a separate deref
17:43amalloywell, it seems to me you're doing the whole concurrency thing wrong, by derefing and then setting
17:43amalloyinstead of passing a function that looks at the current state and changes appropriately
17:45drew127an agent returns the value it already is
17:45amalloybut i don't really understand what you're doing
17:45drew127whereas I need the value that it's changed to
17:45drew127that suggests using an atom
17:45drew127but atoms are bad for side effects
17:45drew127so it says
17:45amalloywhere are you getting the value it's changed to?
17:45amalloyall i see is you getting the initial value before doing anything
17:47drew127I make the value it will be changed to in advance, put that in the let, then change it to that value
17:47drew127this is all in change-font
17:47amalloyright...which is wrong, but seems unrelated to what you're saying
17:47drew127so what's the right way of doing it with agents
17:47drew127or with anything else?
17:48amalloy(send-off myfont (fn [old-font] (Font. ... (.getSize old-font))))
17:48drew127which is what I had at first
17:49drew127but I realized that this returns the un-incremented or decremented value of the font
17:49drew127change-font has to return the changed value of the font
17:49amalloythen you certainly do not want an agent
17:49amalloyan atom is what i would choose
17:49drew127yeah
17:49drew127it seems like that
17:49drew127but what about the side effects issue?
17:49hiredmanor await on the agent
17:50drew127it seems like an unclean style of coding
17:50amalloy$javadoc java.awt.Font deriveFont
17:50lazybothttp://download.oracle.com/javase/6/docs/api/java/awt/Font.html#deriveFont(int,%20float)
17:50hiredmanall of which seems horrible
17:50drew127because when you're making a new object
17:50drew127it could have side effects
17:50amalloysee also that, for creating a new font based on an old one
17:51hiredmanis current-doc another agent?
17:51drew127it's an atom
17:52drew127my question with the atom is, what happens if the atom has to be retried?
17:52drew127agents never get retried, right?
17:52drew127let's say you're incrementing it using this deriveFont
17:52drew127that's a stateful change
17:52drew127so couldn't it increment multiple times as the atom is being retried?
17:53amalloydrew127: https://gist.github.com/1108145 is a vague sketch taking out things that seem clearly crazy
17:53amalloyno guarantees that i haven't introduced other crazy things
17:53amalloyderiveFont isn't stateful
17:53hiredmandepends 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:53amalloyi think
17:53amalloyit certainly doesn't look like it
17:54hiredman(def font-size (atom 10)) (add-watch font-size ...)
17:54hiredmanor it's a field in the current-doc map
17:55drew127thanks amalloy, let me try that
17:55hiredmanand 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:55amalloydrew127: 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:57drew127ok, thanks, I'll work with it
17:57drew127I'm still trying to get my head around atoms vs. refs vs. agents
17:57drew127the retrying stuff worries me a little bit
17:58drew127but I guess that's what you have to deal with
17:59drew127hiredman: I guess I'll try the add-watch too
18:00drew127maybe you could make the setFont the result of a watch
18:00drew127that seems right
18:00hiredmanyou could also get rid of the global font var and make it part of the document
18:01drew127yeah, it would make sense
18:01drew127but right now that was how the code was structured
18:01drew127I don't want to introduce too many changes at once
18:01drew127maybe I'll try that in a later patch
18:01drew127add-watch is sort of a functional-reactive programming thing, isn't it?
18:01hiredmanscgilardi: what ever happened to your observable gui kit clojure stuff?
18:02drew127hiredman: what is observable gui kit clojure?
18:02drew127you mean it shows you what code you're using as you interact with a gui?
18:03hiredmanno
18:03hiredmanobservable like an interface
18:03amalloydrew127: fwiw, updated the gist to something that might possibly compile
18:03hiredmanbasically you want a queue where events go, and different widgets can sign up to observe certain events
18:03drew127that's the way gui programming should be done
18:04hiredmanright
18:04drew127car-ing things off a stream of events
18:04drew127there was something called FrTime in Scheme
18:04drew127programming with events is kind of perverse
18:04hiredmanso, go forth, and rewrite clooj to do it
18:04drew127in the next half hour!
18:04drew127actually I have to get dinner
18:04drew127maybe between dinner and dessert
18:06hiredmanmight have been the first time I tried to do anything with lein
18:07drew127haha
18:07drew127anyway
18:07drew127got to go for now
18:07drew127thanks guys
18:07drew127\leave
18:07drew127oops
18:07hiredmanhttps://github.com/hiredman/Repl/blob/master/src/hiredman/repl.clj
18:08drew127thanks for the example
18:08amalloydrew127: you're probably looking for /part or /quit
18:08drew127yep
18:08drew127here I go
18:08amalloy*chuckle*
18:34rimmjob_paredit is so good
19:58choffsteinEmacs won't let me delete a parens … wtf emacs.
19:58choffsteinI love your parens auto-complete and all … but when you don't respect my key-presses, you annoy me
19:59amalloychoffstein: give yourself over to paredit. embrace it
19:59choffsteinamalloy: i'm trying … i'm trying. gotta learn to work WITH it and not fight it
19:59amalloyyou don't really want to "delete a paren", you want to do some list-oriented operation like "merge two lists"
20:00amalloychoffstein: maybe paste/gist the text you have and the text you want?
20:00choffsteinC-u DEL did the trick :)
20:00amalloyhar har
20:00choffsteinbasically, I had a [ matched with a ) and couldn't get rid of the )
20:00amalloyyeah, if stuff gets unbalanced knowing the escape hatches isn't bad
20:01amalloychoffstein: C-q ] would have worked too, sorta
20:01choffsteini'm reading the paredit config file now to understand it better
20:03choffsteinwhat happens if I end up with something like ((f a b c)) and want to get rid of the outermost parens?
20:04amalloychoffstein: put point on the inner (, and M-r
20:04amalloyor M-s
20:04choffsteinor 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:04amalloychoffstein: for the latter: M-(
20:05amalloyactually 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:05the-kennyIs it feasible to use the output of pr-str as a over-the-wire protocol for a Clojure/ClojureScript Client/Server application?
20:05choffsteinHmmm, M-( doesn't seem to be working for me. Must be doing it wrong.
20:06amalloychoffstein: that's meta-shift-9, right?
20:06amalloyshould work, with point on the (
20:06choffstein…i'm a moron
20:06choffsteinI was doing meta-9 :D
20:06choffsteinannndddd time to stop coding
20:06amalloychoffstein: or do what i did! swap symbols with numbers so that M-9 works
20:11choffsteinthat isn't a bad idea...
21:02npoektophi! how to create an atom hash-map of atom lists?
21:03dnolen_,(atom {(atom []) (atom [])})
21:03clojurebot#<Atom@105b08c: {#<Atom@89ca51: []> #<Atom@41986c: []>}>
21:04dnolen_npoektop: though it seems like a strange thing to want
21:06npoektopi want to create and modify a hash-map and to modify lists which are values
21:08npoektopsmth like (push word (gethash (word->number word) table)))) if it was CL
21:10npoektopdnolen_: that code is from file reading loop
21:11dnolen_npoektop: you should try to do it in a functional manner first, no need to resort to atoms.
21:13tmciverWhat happened to sexpbot?
21:13zakwilsonIs there a standard date/time library people use? I didn't see one in contrib.
21:13npoektopdnolen_: now i do (.put *map* (word->num line) (cons line (.get *map* (word->num line)))) Not very nice i think
21:13dnolen_zakwilson: clj-time
21:13zakwilsondnolen_: thanks
21:14dnolen_npoektop: you don't need to use .put or .get
21:14dnolen_,(assoc {} :foo 'bar)
21:14clojurebot{:foo bar}
21:14dnolen_,(get {:foo 'bar} :foo)
21:14clojurebotbar
21:15dnolen_npoektop: if you have a loop, accumulate your data in functional way via loop/recur.
21:15zakwilsonThe leiningen workflow and the remote swank workflow don't work together nicely when adding a new dependency (unless I'm missing something)
21:16hiredmanwhat is the lein workflow?
21:16hiredman(and also what is the other one?)
21:17zakwilsonIn 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:18zakwilsonIt 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:35zakwilsonThere doesn't seem to be a nice way to get the number of days between two dates.
21:40zakwilsonAlso, what were the authors of the original Java date libraries smoking?
21:40scottjsmalltalk?
21:42zakwilsonDoes smalltalk have something that works like java.util.date?
21:51amalloytmciver: /topic in #sexpbot begins with "Official IRC channel for lazybot (neé sexpbot)"
21:55Raynestmciver: Also, now located at http://github.com/flatland/lazybot
21:55tmciverRaynes, amalloy: I see. Thanks.
22:13duck1123So 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:14duck1123switching to another terminal, re-copying the resources and the re-evaling my template code buffer is really hurting my flow
22:17zmarilI 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:38choffsteinGot 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:38choffstein… but I am wondering if there is a better solution.
22:41jcromartiewhat's the idiomatic way to test if all elements of a collection satisfy a predicate?
22:41amalloy&(doc every?)
22:41lazybot⇒ "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."
22:41amalloychoffstein: i don't understand the relation between the two lists you give
22:42jcromartiehah yes I got it thanks
22:42jcromartieI was looking for "all?"
22:43choffsteinamalloy: 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:43choffsteinas the previous 2.
22:44amalloydo you care if you end up with (1 0 2 3 2 3 4 0) instead?
22:45amalloyi 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:50choffsteinamalloy: Well, the issue is I have clusters identified by positive and negative values
22:50choffsteinand I want the clusters to be identified by positive values only
22:51metajackif they are sequential with no gaps just add the absolute value of the min element to all elements
22:52amalloybut 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:53choffstein…nice metajack. Very nice.
22:53choffsteinWelllll…except for that sequential issue. They aren't, necessarily.
22:53choffsteinamalloy: I'll see if I can refactor
22:57choffsteinwell, I did it with some very, very un-sexyness
22:57choffsteina gross little loop/recur. eck.
22:57amalloychoffstein: reduce would be cleaner imo
22:57amalloywell
22:58choffsteini'll show you my solution :)
22:58amalloyi try to avoid loop/recur, but i bet it leads to cleaner, and less code
22:58amalloyon this occasion
22:59choffsteinhttps://gist.github.com/1108567
22:59choffsteinI think a multi-method might clean that up a bit.
22:59choffsteinI don't like the double if statements
23:02amalloyjeez
23:02choffsteinit makes me feel dirty just looking at it.
23:04tomojcleverer way to do (into {} (for [[k v] m] [k (get m v v)])) ?
23:04choffsteinmaybe a helper multi-method that is recursive instead of using loop/recur?
23:08amalloychoffstein: at least do some destructuring. seeing first/rest all over makes me queasy
23:09amalloyi'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:09amalloyalso: oh god, apparently it used tabs
23:13choffsteinthanks, appreciate it
23:16tomojhttps://gist.github.com/f16a81797f1eb160d4b5
23:16tomojwhy doesn't that reductions return an infinite seq?
23:17tomojoh
23:17tomojduh
23:17tomoj:D
23:17tomojchoffstein: ^
23:17choffsteinoh. wow. sexy
23:18tomojamalloy can make it sexier
23:19amalloytomoj: nice. i like using (count m)
23:20tomojhttps://gist.github.com/ecd32c48fb704f1b0e73 :/
23:20tomojstill seems overly complicated
23:20choffsteinI definitely, definitely don't understand that code
23:21tomojto just find the index of first occurrence of each value
23:21tomojoh, hmm
23:23amalloytomoj: not enough arrows! any decent algorithm uses at least four arrows
23:23choffsteinHow does nil get destructured into [m i]?
23:23amalloychoffstein: as [nil nil]
23:24choffsteinOkay. I'm gonna have to ponder this one.
23:24tomojamalloy: just one arrow preferably :)
23:24amalloy&(let [[m i] nil] {:m m :i i})
23:24lazybot⇒ {:m nil, :i nil}
23:24tomojoh, it's not index of first occurrence
23:24amalloytomoj: 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:24tomojindeed
23:25choffsteinmy mind is exploding.
23:26choffsteinohhh, I didn't know that you could provide a default to get. that is cool
23:26choffsteinlearn something new every day :)
23:27choffsteinAlso didn't know you could (assoc nil …) and create a new hash.
23:28tomojhttps://gist.github.com/616f9601337786730d3e
23:28amalloychoffstein: ##(update-in nil [:key] (fnil inc 0))
23:28lazybot⇒ {:key 1}
23:28tomojhave to be in order?
23:29amalloyah, very good
23:31choffsteinwoah … tomoj. that last one is wicked.
23:31tomojhmm, it does two passes
23:31choffsteinNope, order isn't necessary.
23:32amalloytomoj: with laziness, N passes doesn't really matter much
23:32choffsteinI'm sort of confused as to where the mapped value is getting used in the (->>
23:32amalloythis won't handle infinite seqs, is your objection?
23:33tomojthe return value of the ->> form is a map (as in {}) which is called as a function by map (the function)
23:33tomojamalloy: hadn't thought of that, but.. yeah
23:34choffsteintomoj: yikes.
23:34choffsteinThat is cool.
23:34choffsteinDid not know you could call a map as a function
23:34choffsteinHoly crap I am learning a lot.
23:35tomoj&[({1 2} 1) ({1 2} 1 3) ({1 2} 4 3)]
23:35lazybot⇒ [2 2 3]
23:36amalloytomoj: i nominate you for an award. any award; i'm not picky
23:37tomojthanks, I will forward your nomination to the Iowa Pork Producers Association
23:38choffsteinmind = blown.
23:49choffsteinWell, thanks for all the help guys. That last one is particularly awesome, tomoj.
23:49choffsteinI'm outta here. Have a good one.
23:50zmarilIs it possible to partial a macro?
23:51amalloyzmaril: no. macros are contagious and not very composable
23:52zmarilamalloy: What does contagious mean in this context? That it can make bad things happen?
23:54amalloyonce you have a macro, you need more macros to do anything with it
23:55zmarilOh! I can just define by own macro then.
23:58zmarilIt worked! Thanks