#clojure logs

2010-06-14

00:00LuminousMonkeyI can just use a cycle sequence so for a given column I can get the correct align info, but at the moment I'm using a doseq and a for, and it can't be the best way to do it, and I'm just new to Clojure.
00:00LuminousMonkey(doseq [row (for [row (rest table-data)] (interleave (first table-data) row))]
00:00LuminousMonkey (process-table-row table row))
00:02tomoj,(map vector (cycle [1 2]) [:foo :bar :baz :bing])
00:02clojurebot([1 :foo] [2 :bar] [1 :baz] [2 :bing])
00:02LuminousMonkey(defn process-table-row
00:02tomojhow does that help you?
00:02LuminousMonkey "Given a row, steps through and adds the cells to the table, a map is
00:02LuminousMonkey expected to be in-front of the cell data for aligning options, etc."
00:02LuminousMonkey [table row]
00:02LuminousMonkey (doseq [cell row] (if (map? cell) (process-cell-options cell table) (.addCell table cell))))
00:02clojurebotmacro help is http://clojure-log.n01se.net/macro.html
00:04LuminousMonkeyI was hoping to get them in seperate args to the function, that was I can get rid of the (if map?)
00:04tomojLuminousMonkey: paste on gist or paste.lisp.org or pastie or pastebin or whatever you like
00:04LuminousMonkeyIt works as I have it now, it just seems to damn ugly. :)
00:07LuminousMonkeyhttp://pastie.org/1003361
00:11LuminousMonkeyExample of data being passed in: http://pastie.org/1003377
00:45vIkSiThmm, so If I'm in (ns myproject.core) in core.clj, and I have a file called db.clj, which has a (ns myproject.db).
00:45vIkSiTwhats the best way to use db within core?
00:45vIkSiTshould I be using - :use or :require?
00:48TeXnomancyvIkSiT: if you are just using a few vars from the db namespace I would stick with (:use [myproject.db :only [my-fn my-other-fn]])
00:48TeXnomancybut if you have a lot, then (:require [myproject.db :as db])
00:48vIkSiTTeXnomancy, ah yes, probably the latter then. hmm
00:48Scriptoris there a way to turn off the indentation specific to vimclojure, so that I can go back to the settings in my .vimrc? I tried #vim but didn't get a response
00:52vIkSiTTeXnomancy, hmm, when using a :require :as ..
00:52vIkSiTshouldn't something like (def v (db.recordname. (args))) work?
00:53TeXnomancyvIkSiT: it'd be db/recordname
00:53vIkSiTTeXnomancy, http://paste.lisp.org/display/111416 for instance
00:53vIkSiTin both cases (/ or .) gives me a "class not found"
00:54vIkSiTeither (td.TupleDesc. (ref []))
00:54vIkSiTeither (td.TupleDesc. (ref [])) or (td/TupleDesc. (ref []))
00:55tomojI think you have to import the class nowadays
00:55vIkSiToh.
00:55tomojthe code that generates a constructor function seems to be commented out
00:55tomoj(well, and you wouldn't be calling the constructor function even if it were there..)
00:55TeXnomancyright; java classes must be brought in with import rather than require/use
00:55vIkSiTtomoj, you mean code in my paste?
00:56tomojhuh
00:56vIkSiTI'm not using any java classes here..
00:56tomojyeah you are :(
00:56vIkSiToh darn
00:56vIkSiTgen-class
00:56tomojno, just defrecord
00:57vIkSiToh I see
00:57tomojnote also your "Foo." syntax which is for java class constructors
00:57vIkSiT(I didn't realize that actually)
00:57vIkSiTgood point
00:57tomojwonder why the constructor functions disappeared, though?
00:58tomojbecause it makes it impossible to refer to the class, maybe?
00:59vIkSiTtomoj, so in this case, how would do an import/use that namespace's records and protocols?
01:00vIkSiTfor instance, I can already do (:require [cljsimpledb.tupledesc])) and then do : (cljsimpledb.tupledesc.TupleDesc. (ref []))
01:00vIkSiTwhich works fine
01:00vIkSiTbut that is *long*!
01:00tomoj(:import cljsimpledb.tupledesc.TupleDesc) I assume
01:02vIkSiTah thanks. that seems to work
01:09tomojI wonder if it would be nice to have a protocol for functions
01:10tomojso that your types could be callable
01:10tomojinstances of your types I mean
01:14quotemstrDoes clojure have anything like CL's EVAL-WHEN or COMPILE-TIME-VALUE?
01:15tomojwhy isn't compile-time-value in the clhs?
01:15quotemstrerr, LOAD-TIME-VALUE.
01:15quotemstrC-T-V is an SBCL extension.
01:16tomojah
01:17tomojwhat exactly are you trying to do?
01:18quotemstrI'm not trying to do anything in particular --- I'm just trying to get a feel for the difference between CL's evaluation model and Clojure's.
01:18tomoja conditional that checks whether you're AOT compiling or something?
01:18tomojoh, I see
01:18tomojall I know is that it's different :)
01:18tomojI was hoping to get a feel as well
01:19TeXnomancythere's something like *compiling-files*
01:19TeXnomancy,*compile-files*
01:19clojurebotfalse
01:19quotemstrnon-toplevel defmacro seems to be meaningful.
01:19TeXnomancythat tells you whether you're in an AOT run or not
01:19quotemstrWhich is fine.
01:21tomojI guess we just have load-time and AOT-time?
01:21quotemstrThat's interesting --- defmacro seems to be lexically scoped?
01:21quotemstr(do (bar) (defmacro bar [] 81))
01:21quotemstrErr, nevermind.
01:22tomojTeXnomancy: you're not an impostor, are you? :)
01:23vIkSiThehe
01:23TeXnomancytomoj: this is my "I forgot to connect to dircproxy" fallback nick.
01:23tomojah
01:23defnI'm pasta.
01:23vIkSiTyou mean you're toast?
01:24quotemstrTeXnomancy: You can ghost yourself.
01:24defnvIkSiT: precisely.
01:24TeXnomancyquotemstr: except my dircproxy is set to auto-reconnect
01:24TeXnomancyif I weren't lazy I'd just quit and connect to that instead.
01:25quotemstrTeXnomancy: nickserv has something for that actually.
01:25TeXnomancyoh?
01:27quotemstrHrm, I could have sworn it had some kind of lock-unlock feature; maybe I'm thinking of a different IRC network.
01:27defni know on slashnet you could ghost and then recover
01:27defnor ghost, release
01:27defnor something
01:32vIkSiTfn doest support ghosting, quotemstr
01:32vIkSiTdoes*
01:33vIkSiTbtw, what kind of frameworks do you guys use to test code?
01:34defnin clojure i assume?
01:34defnmost peopple from what i read and hear use clojure.test -- stuart sierra is working on lazytest, but IMO it is largely unusable still
01:35vIkSiTah thanks, i'll check
01:36mabesyeah, clojure.test is the standard for now.. I've used circuspec on some projects, but that will be going away once lazytest is done
01:36mabeser.. circumspec
01:37defnlazytest gets some Friday love due to friday open source day or something at think relevance
01:37Scriptorwhat's Friday open source day?
01:44defnso once a week ytou can count on some form of progress :)
01:44defnScriptor: they have some sort of company policy where they can work on open source stuff on Friday I believe
01:45defnkind of like Google's 20% of your time if your own development time
01:45defn(I think that's the %)
01:45Scriptorso if you release your own os project you could work on it, and not have to worry about the company trying to say it owns any part of it?
01:49defnI don't work there so I don't know
01:49defnI'm just telling you I know they have something like that on Fridays
01:50defnI've always been under the impression that they are a pretty non-evil company, but I suppose they could claim they own your stuff if they wanted to squander good will and be a bunch of jerks...
01:52Scriptorthis is relevance, right?
01:53vIkSiThmm this is weird. So I've got 2 namespaces: a and b. Each has a protocol declared, with a function called to-string in both protocols
01:54vIkSiTin namespace a, I do a (:use) for namespace b
01:54defnScriptor: i think that's who stuart sierra works for. i really can't tell you anymore than i have
01:54defnit was in a 140 character tweet. i know nothing more.
01:54vIkSiTand end up getting: "error: java.lang.IllegalStateException: to-string already refers to"...
01:55vIkSiTso I'm in another namespace, and am referring to namespace a's functions using the full notation - and this still happens?
01:57tomojuhh
01:57tomojif you have a protocol in namespace a with a to-string, you shouldn't :use namespace b which also has a to-string..
01:58vIkSiTtomoj, hmm the problem is that the method you suggested earlier (import) - causes issues - I get messages saying that a particualr fn isn't defined for that protocol in the corresponding record
01:58tomojyou need to import the class to get the constructor, you must require or use to get the protocol fns
01:58tomojand you can't :use namespace b in namespace a
01:59vIkSiThmm. So, import for protocols, and then do a : use to get the functions - wouldn't that imply using having to use ns b in a?
02:00tomojif you've got a/to-string and b/to-string, a can't :use b..
02:00vIkSiTthen :require?
02:00tomojthat should work
02:01tomojyou could also :use :rename I suppose
02:01vIkSiTah thanks for the pointer. ns's and protocols are taking some time to wrap my head around :)
02:01vIkSiTso much easier with defstructs
02:01tomojdefprotocol defines fns just like normal
02:01vIkSiTright
02:02tomojso the fn names have to be unique per namespace, but ':use b' refers to everything in b directly
02:02vIkSiTright. so a use would make a direct reference, but a require would need a fully qualified reference?
02:03tomoj(ns ... (:require [foo.bar.baz :as baz])) (baz/my-protocol-fn)
02:03vIkSiTi see
03:39LauJensenMorning all
03:41naeucan someone explain the difference between rest and next, and perhaps also why rest is implemented as more()
03:45tomoj(doc rest)
03:45clojurebot"([coll]); Returns a possibly empty seq of the items after the first. Calls seq on its argument."
03:45tomoj(doc next)
03:45clojurebot"([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."
03:45tomoj,(next [1])
03:45clojurebotnil
03:45tomoj,(rest [1])
03:45clojurebot()
03:46LauJensennaeu: where is more() defined?
03:47tomojRT.java L567
03:48tomojthen in whatever seq classes
03:50tomojASeq has a more which defers to next() and then special-case returns () if next returns nil :)
03:50naeuLauJensen: more() is defined in ISeq
03:51naeuit's also called by the implementation of rest
03:51naeuwhich is in RT.java
03:52LauJensenok
03:53naeuso is the difference between rest and next that next in the case of a one-element-seq, next will return nil whereas rest will return an empty seq
03:54LauJensennaeu: yea, just like the doc string says
03:54tomojalso (rest nil) is () while (next nil) is nil
03:54tomojsimilarly for empty seqs
03:55naeuwhich would enable nil punning with next
03:56LauJensen(when (empty? (rest c))) vs (when (next c))
03:56naeuyeah, for some reason I didn't read the documentation for next and rest, I just went straight to the implementation
03:56naeuthen got confused by more()
03:59LauJensenI think there's also a lazy/eager concern, but I forget if thats changed in the current implemented, do you remember tomoj ?
03:59tomojI don't think we're supposed to use nil-punning anymore anyway
04:00tomojI only learned about the lazy/eager issue a few moments ago reading http://clojure.org/lazy
04:00tomojunfortunately it doesn't explain the issue
04:01LauJensenIt sorta does, in that next gives a "possibly delayed path" to the remaining items. I think the call to seq preserves laziness while nil evaluation doesnt
04:03tomoj"possibly delayed path"?
04:05LauJensenlazy?
04:05clojurebotlazy is hard
04:05LauJensenhow?
04:05clojurebotwith style and grace
04:05LauJensenwho?
04:05clojurebotwho is x
04:06tomojsince next is implemented in terms of rest, I don't see how next could be less lazy
04:06tomojer, I mean, rest is implemented in terms of next
04:06tomojbasically
04:07LauJensenIf its not explained by the call to seq I dont know, but I dont have time to look at the source just now
04:07tomojyou mean (next aseq) == (seq (rest aseq)) ?
04:08tomojthat call to seq, I mean?
04:08LauJensentomoj: According to the doc you linked, next wraps its argument in seq
04:08tomojso does rest
04:09naeutomoj: I don't see how rest is implemented in terms of next
04:09naeuunless all the persistent data structures do that
04:09tomojsee for instance ASeq.java L115
04:10naeunext maps onto ISeq#next() and rest maps onto ISeq#more()
04:10hoeckrest is more lazy than next, see , see http://gist.github.com/437419
04:10naeuand then it's up to the implementations to implement these methods as they see fit
04:10tomojyes, I should've said only ASeqs
04:11naeudoes anyone know why Rich chose the method name more()?
04:11Chousukeit was to be the name of the function
04:12Chousukebut then it changed, and the method didn't :P
04:12tomojhm... LazySeqs aren't ASeqs
04:12tomojam I right that for ASeqs, rest is no more lazy?
04:12tomojerr
04:13tomojthat doesn't even make sense, does it? :)
04:13Chousukethe default implementantion maybe
04:13tomojare any ASeqs lazy?
04:13ChousukeNo idea. :)
04:14Chousukewell, I mean, all seqs are lazy, it just varies how lazy :P
04:14tomojPersistentVector$ChunkedSeq is an ASeq, and I guess it's somewhat lazy?
04:14Chousukeyes.
04:15tomojI can't think of a way to test rest vs next on them though
04:16tomojoh well.. so rest in lazy-seq, next everywhere else, and always something like (when (seq s)), yes?
04:16mmarczyk,(rest [1])
04:16clojurebot()
04:16mmarczyk,(next [1])
04:16clojurebotnil
04:16mmarczykso that's one difference
04:16tomojI meant whether rest is more lazy on them
04:16mmarczykmorning :-)
04:16mmarczykwhat would that mean?
04:16tomojI don't even know
04:16mmarczykthey're produced in chunks anyway, which is good for memory
04:17tomojless chunking when you next up to a boundary or something
04:17mmarczykbut if your vector holds "actual elements", as it will
04:17mmarczykless chunking, hm
04:17tomojdunno how to detect a chunk being produced
04:18tomojer, one would expect next to cause more chunking at a boundary, I guess, if there is in fact any difference
04:18LauJensenchunks are evil, hopefully they'll go away soon
04:19tomojto be replaced by cells, or..?
04:19LauJensenExactly
04:19mmarczyktomoj: actually chunkMore for a vector is implemented in terms of chunkNext
04:19LauJensenRich has also made some nice prototypes, that worked better than chunks, without the evil
04:19mmarczykthe difference being that chunkMore returns () at the end
04:19mmarczykthat's chunkedMore
04:20tomojI still have no idea what cells are
04:20tomojwho calls chunkedMore?
04:20mmarczyktomoj: that's because they are a transient concept at this time, you can't properly hold onto it ;-)
04:20LauJensenThey are a mutable construct, a little similar to cells, but where concurrency is handled through locking - Because they are low on allocation, they perform even better than chunks. Rich has implemented map and filter et al using cells
04:21LauJensens/to cells/to transients/
04:21sexpbotThey are a mutable construct, a little similar to transients, but where concurrency is handled through locking - Because they are low on allocation, they perform even better than chunks. Rich has implemented map and filter et al using cells
04:21tomojah, so the "sentry" is some thing you can pass in which decides how to handle the locking?
04:21LauJensenmaybe :)
04:21tomojheh
04:23mmarczyktomoj: PersistentVector's implementation of next calls chunkedNext
04:23mmarczyknot sure who calls chunkedMore, to be honest
04:23tomoj:)
04:23tomojdead code?
04:24mmarczykclojure.core/chunk-rest
04:24tomojaha
04:24Rayneshttp://www.reddit.com/r/programming/comments/cejxa/scala_for_hackers/c0s0y3j Is this a true statement?
04:24mmarczykalso see gvec.clj, there's one more call in there
04:24Raynes$(iterate inc 0)
04:24sexpbotjava.lang.NoClassDefFoundError: clojure/core$iterate$fn__3752
04:24RaynesThat's weird.
04:24LauJensenRaynes: 2/3 of the way, yea
04:25RaynesLooks like a clj-sandbox bug. I'll have to scream at Licenser about it later. There is a similar problem with rseq.
04:25Raynes$(rseq [1 2 3])
04:25sexpbotjava.lang.NoClassDefFoundError: clojure/lang/APersistentVector$RSeq
04:25RaynesLauJensen: Thanks for letting me know.
04:25mmarczykRaynes: what does that "has better performance" mean? better than what?
04:26mmarczykor is there no context
04:26Raynesmmarczyk: I remember back in '08, gnuvince was a Clojure guy who whined about performance a lot. He made blog posts about it. Then he stopped using Clojure and started using Scala. There is no context here, though.
04:26mmarczykah, I see, sorry -- picked the wrong link
04:26mmarczyknot fully awake yet.
04:27RaynesBetter performance than "Scala".
04:27RaynesSorry, I thought he mentioned that.
04:27RaynesIf that's the context you mean't, anyway.
04:27mmarczykyeah, thanks
04:27Raynesmeant*, I hit permalink and shot away. :p
04:27mmarczyk:-)
04:28mmarczykfunny how everyone seems to believe that starting with Scala is easier on account of it being vaguely similar to Java :-P
04:28mmarczykno worries at all about the most complex type system on Earth? :-)
04:28tomojmost complex? scala?
04:29mmarczykwell, isn't it?
04:29RaynesI don't know Java though. Clojure was more familiar to me when starting with JVM languages.
04:29eevar2hmm.. he seems to claim that scala has better performance than clojure
04:29LauJensenmmarczyk: not vaguely similar, its like javas twin brother with a 3.rd arm
04:29RaynesI was under the impression that you could get near-Java performance with type-hint trickery and such.
04:29mmarczykI wouldn't want to comment on the performance difference, don't know about Scala in practice
04:29RaynesThere is no way in hell that Scala is as fast as Java, anyway. People would be bragging about that.
04:30RaynesSo I'm not certain.
04:30LauJensenWell - I think its premature to discuss compiler speeds when Scala programs are still 2x as verbose as Clojure programs
04:30mmarczykLauJensen: hm :-)
04:30mmarczykRaynes: actually I thought that people were in fact bragging about that :-)
04:30LauJensenI got heavily flamed by some Scala dude for suggesting that Scala programs where 3x as verbose, because after he had fine tuned the program, it was only 2x as verbose
04:30LauJensenOk - I admit it publicly, Scala is only twice as verbose :)
04:30mmarczykno links though, so maybe I'm dreaming it
04:31tomojmmarczyk: more complex than haskell?
04:31Raynesmmarczyk: I don't think I've ever heard that. I've heard both language's brag about "near-Java performance".
04:31mmarczyktomoj: I'd have thought so
04:31tomojmmarczyk: does scala have a monomorphism restriction?
04:31tomoj:)
04:31mmarczyktomoj: sorry, not a Scala expert, wouldn't want to comment
04:31mmarczyk:-)
04:32mmarczykalso, for Haskell it's an implementation issue
04:32mmarczykand *also*, I don't see that it adds that much in the way of complexity :-)
04:32RaynesWould anybody have use for Clojure bindings for the Github API? :o
04:32LauJensenRaynes: Nope, but I did wrap git once
04:33LauJensenAnywaay, gotta jet, its on Github if you want it
04:33mmarczykLauJensen: good to know about the 3x -> 2x thing, my right wrist is every so slightly less worried about possibly writing Scala :-)
04:33mmarczykhave a good day
04:33mmarczyk(ever so slightly)
04:33RaynesI'm asking because I'm not too far off from having implemented the entirety of the Github API. It's going to include the Gist API as well.
04:34RaynesI've kept it under the covers so that people wouldn't use it until it was done.
04:34Raynes:>
04:34RaynesI probably have 10 thousand uses for it in sexpbot.
04:34RaynesA friend has already started implementing a repo watcher, last I heard through sexpbot radio.
04:34mmarczykRaynes: how about a "gist this session" link in Clojure REPL?
04:35Raynesmmarczyk: Possibly. Might have to talk with chrisdone about that one though.
04:36tomojI have kind of wanted to try c&c in clojure
04:36RaynesSpeaking of that, I might ought to work on getting my local changes working. Me and Chris broke it a couple of days ago. :p
04:40LauJensenSorry for the OT: A few months ago, somebody posted this cool webapp on HN, where you picked a color, and it would generated all shades of that color, appropriate for a color-scheme - anybody got the link? :)
04:45mmarczykhttp://alexpogosyan.com/color-theme-creator/
04:45mmarczykLauJensen: you mean this one?
04:46LauJensenNo - It was for website design
04:46mmarczykah.
04:47mmarczykhttp://colorschemedesigner.com/
04:47mmarczyk?
04:47mmarczykLauJensen: another link for you
04:47LauJensenNo - Though I might try that, since all links seem to go back. This other one was nicely designed, and you just picked a color, and you would get a looong vertical list of the shades and their code, but thanks :)
04:48mmarczykhm, sounds cool
04:48LauJensenIt was - And it picked great shades
04:49tomojdo you think clojure is doomed for real-time music performance because of the JVM?
04:49LauJensendefine music performance? Playing, sampling, mixing, what ?
04:50tomojyes
04:50tomoj:)
04:50tomojsomething like Max/MSP say
04:50tomojexcept without all the graphical programming bullshit and in clojure
04:51LauJensenI would be very surprised if Clojure couldnt handle that
04:51TakeVI've been using it for game programing.
04:52tomojcan't have a train wreck because of GC :(
04:52LauJensentomoj: The GC is also subject to tweaking
04:52mmarczykLauJensen: last one for now: http://www.neteffect.dk/colormatch/ -- found it here: http://www.bestdesigntuts.com/20-color-tools-for-designers/
04:53tomojI found a paper about some crazy IBM JVM that does AOT compilation to machine code and uses a special garbage collector to achieve 5.0+-0.75ms keyboard-to-speaker latency
04:53mmarczyktomoj: whoa, cool :-)
04:53LauJensentomoj: Cliff Clickyti Click has a pauseless GC running on Azul
04:54mmarczykalright, got to go for now
04:55tomojmmarczyk: sounds more scary and difficult to work with than cool to me :(
04:55LauJensenmmarczyk: ok, thanks
04:55naeutomoj: have you seen overtone?
04:56tomojhttp://rosejn.github.com/overtone/ that?
04:56tomojno, thanks
04:56tomojthe blurb there sounds like exactly what I want :)
04:57LauJensen"does everything in half the time with no latency"
04:57LauJensenperfect!
04:57tomojLauJensen: that's azul? or?
04:57LauJensenJust referring to the sales pitch which sucked you into naeu project :)
04:57tomojah, heh
04:58LauJensenmmarczyk: this was it: http://0to255.com/
04:58naeuLauJensen: what sales pitch?
04:58LauJensen'which' sales pitch you mean, this:
04:59LauJensen<tomoj> the blurb there sounds like exactly what I want :)
04:59naeuLauJensen: you're being very pedantic today
04:59LauJensenWhy thank you :)
04:59naeuI don't need my grammar corrected in IRC
05:00LauJensenActually you do, but I will respect it if you're not ready to recognize that fact yet :)
05:00naeuI'm just throwing words out, not curating a precise essay
05:01naeuwell, each to their own opinion
05:01naeuI prefer not to correct people's grammar unless they ask me to or I'm pretty certain they'd appreciate it
05:02LauJensenhehe
05:02naeubut seriously, I've not seen a better music framework than SuperCollider
05:03naeuit's basically a linguistic version of Max/MSP
05:03LauJensennaeu: If you'd prefer me to not comment, I'd be happy to restrain myself. Though I think generally people today are sooo sensitive to critique, which is why most people go an entire lifetime without learning anything meaningful. No harm intended I assure you
05:03tomoj"an interpreted object-oriented language"
05:03tomojfail
05:03tomoj:P
05:04tomojLauJensen: you split your infinitive :O
05:04LauJensentomoj: where?! :)
05:04mmarczykLauJensen: thanks for the link, that is really cool :-)
05:04LauJensenmmarczyk: np big guy
05:04tomoj"to not comment"
05:05tomojjust kidding :)
05:05naeuLauJensen: I understand your point, it's just important to realise that when giving critique it's easy to come across as pedantic/arrogant/imperious rather than helpful
05:05LauJensennaeu: So you're saying that its the way I presented the critique, instead of your level of sensitivity? How could I have done better?
05:06tomojnaeu: shit thanks for pointing me at overtone
05:06tomojthis is great
05:06naeuno, I'm not making such an explicit distinction, I'm just saying it's important to realise that both the presentation and the context of the critique are worth considering
05:07naeutomoj: I agree, it really is great
05:07LauJensennaeu: I agree
05:07naeutomoj: in fact, I believe it so much I'm going to dedicate next year to working with it
05:08tomojis someone gonna pay you?
05:08naeutomoj: sort of
05:08naeuI'm going to start a research project at Cambridge University
05:11tomojoh, nice
05:12tomojgood luck
05:12naeutomoj: thanks
05:12LauJensennaeu: What was topic of your project?
05:12naeuLauJensen: What 'is' the topic of my project? ;-)
05:12naeusorry, couldn't resist
05:12LauJensenHOW DARE YOU! PEDANTIC !"%!"%
05:12LauJensenNo Im just kidding, thanks for pointing it out to me :)
05:13naeu:-p
05:13naeuThe project is entitled improcess
05:13naeuwhich is a conflation of improvisation and process
05:14naeuI'm exploring the potential of using formalised process to enhance our ability to improvise electronic music
05:14tomojmy feeling was that I probably want to write all the clojure ahead of time and have it expose controls
05:14tomojagree?
05:14naeuI'm going to combine live coding with the use of external interfaces such as 3D mice and monomes
05:14tomojwell, I mean, I guess it's obvious that you're not going to be writing clojure live :)
05:14tomojoh, live coding? you're a better coder than I, then
05:14naeutomoj: actually I am going to be writing clojure live
05:14tomojI'm jealous if you can get your hands on monomes
05:14LauJensennaeu: Oh - Like making a process which produces creativity?
05:15naeuor at least some internal DSL on top of raw clojure
05:15LauJensentomoj: he can, he's already got a 3D mouse :)
05:15naeuLauJensen: perhaps, although I don't want to replace the human. Rather, I want to augment the human with extra powers with which to express his/her creativity
05:15LauJensenYea exactly - Sounds like a lot of fun
05:16naeuit should be
05:16naeu:-)
05:16naeutomoj: actually I have 3 monomes
05:16naeua 64, 128 and a 256
05:17naeuI'm most fond of my 64 right now because it's bus powered and fits snugly in my satchel
05:17naeuI've already written Clojure drivers for my 3D mouse and the monome
05:18naeubut I'm still learning a lot of basic stuff to make it all happen
05:18naeualthough I am making a lot of progress
05:18naeuright now I'm workign through JoyofClojure whilst working through the Clojure source
05:18naeuvery interesting stuff
05:18naeuI'm hoping to be already running when I start in Sept
05:19tomojnaeu: awesome!
05:19tomojI would _love_ to hack clojure + monome
05:19naeuyeah, it's good fun :-)
05:19naeuhave you thought of building your own ardiunome?
05:29tomojI haven't..
05:29tomojI have a duemilanove
05:30tomojI'd seen some recent stuff on planet clojure about arduino+clojure, but it seemed like it only worked when tethered to the computer
05:30tomojof course for music this is no problem
05:30naeuoh nice
05:31naeuI think it's such a shame the JVM doesn't ship with a raw socket library
05:33LauJensen*geeks* :)
05:33naeuof course :-)
05:36tomojI'd really like to try sewing some lilypads onto LED gloves and hacking that in clojure, but I think it's impossible :(
05:36LauJensen?!
05:36tomojthere's some haskell lib that provides a dsl that can generate arduino code, and I guess you could do that in clojure, but it sounds nasty
05:37tomoj?!?
05:37LauJensenlily pads? LED gloves?
05:38naeusounds cool
05:38naeualthough i've never heard of lily pads
05:38naeudo you have a link?
05:38tomojhttp://www.arduino.cc/en/Main/ArduinoBoardLilyPad
05:39nipra,(do (declare foo) (defmulti bar foo))
05:39clojurebotDENIED
05:39tomojLauJensen: LED gloves are just gloves with LEDs in the fingertips
05:39LauJensenyea ok, now it makes more sense - I thought you meant the flower :|
05:40naeuah nice
05:40naeuso much cool stuff, so little time!
05:40tomoj:)
05:41nipraWhy does (do (declare foo) (defmulti bar foo)) throw unbound var error while (do (declare fred) (defn barney [] (fred))) doesn't?
05:43tomojdefmulti does stuff with the dispatch-fn
05:44tomojdefn doesn't try to use fred until you call it
05:45nipratomoj, hmm.. Ok. Thanks.
05:53mmarczyktomoj: re: Clojure & Arduino: http://github.com/hayamiz/kondo-lisp
05:54mmarczykthere's also a number of posts on nakkaya.com
05:55tomojyeah, saw this kondo-lisp thing on planet clojure, but the README is intimidating :)
05:55mmarczykyeah, FIXME: write sounds scary :-)
05:56tomojand I would need to not be tethered, which pretty much means either 1) the arduino runs clojure (impossible?) or 2) clojure generates arduino code (nasty?)
06:01LauJensen2) doesnt have to be nasty - Penumbra generates C with much success
06:07tomojhrmm
06:07tomojthat would probably be more attractive if I knew C
06:09LauJensenWell you know macros right? Zach has made heavy use of them to let Clojure write many of its own functions - The approach is identical for Arduino
06:10tomojyeah, sounds worth looking into, thanks
06:11mmarczykgood night (ugt) for now, bbl
06:12LauJensensee u
06:17RaynesReal Lispers don't sleep.
06:23LauJensenThats why they're so grumpy all the time. Clojurians sleep at least 5 hours per night :)
06:42squidsoupwow just discovered http://sicpinclojure.com/ .. awesome idea
06:44Raynes$(filter identity [1 2 3 "omg" nil true false])
06:44sexpbot=> (1 2 3 "omg" true)
07:18canderaGood morning #clojure
07:18DarthShrineHi candera
07:18RaynesMorning.
07:19canderaWatched a stealth bomber fly over my house last night. That was cool.
07:20eintrnot very stealthily of it.
07:20canderaYou're the third person to make that joke. ;)
07:20eintr*snare* ;)
07:40defnI really don't know how I feel about Clojurians versus Clojurists
07:40opqdonutClojurers
07:41defnThat is just wrong. :D
07:41opqdonut:)
07:41opqdonuti think it's fun how it's a bit like conjurers
07:41LauJensendefn: You dont need to feel anything, Rich said 'Clojurian' :)
07:41eintrcloji?
07:41LauJensenBut thats for the hardcore. if you're just a tourist in Clojure, then Clojurist is best
07:42eintrclojeur?
07:42defneintr: i like that
07:42defncloji, like magi
07:43defnthe ability to read stars, and manipulate the fate the stars foretold
07:43defnsounds pretty accurate :)
07:43eintrclojeurs have an....uhm... unhealthy... relationship with persistent vectors.
07:43squidsoup"A computational process is indeed much like a sorcerer's idea of a spirit. It cannot be seen or touched. It is not composed of matter at all. However, it is very real. It can perform intellectual work. It can answer questions." -Gerald Sussman on scheme, SICP
07:44squidsoupClojurer is kind of cool
07:44defnclojeurs are people who get all tingly when they see a really complicated destructuring
07:46defnclojurati
07:46defnaka rich and chouser
07:46RaynesClojurian is canonical. All else is blasphemy.
07:48Lajlaeintr, one of the things I noticed too
07:48Lajlathe use of vectors where I would use lists.
07:48defnclojurian is good and all, but i have a hard time keeping a straight face when saying it out loud to someone who isn't part of the clojure community
07:49defni cant think of another programming language which contains -ians
07:49LajlaI am an exchange student, plus, I was banned from #scheme for off topic holocaust denial legalisation advocacy.
07:49squidsouphah
07:49defnlispers, rubyists, pythonistas -- no -ians to be found
07:49Raynesdefn: I can't think of a programming language that is Clojure, as well.
07:50defni dont see how that follows
07:50eintrLajla: you need to put that on a t-shirt
07:50squidsoupschemers have the best collective noun
07:50Raynesdefn: And you feel perfectly serious saying "Pythonista" out loud?
07:50Lajlaeintr, what?
07:51LajlaI want a t-shirt with tail-call-optimization))))))))))))))))))))))))))))))))))) on it
07:51defnhaha
07:51eintrLajla: re banned from #scheme.
07:51Lajlaeintr, ahh
07:51squidsoupok here's a related joke.. What do you call a group of Haskell programmers?
07:51defni dont know, what?
07:51Lajlawell, to be honest, I asked some strange quaestions there too that were beyond any practical use.
07:51LajlaA type class?
07:51squidsoupCategory theorists
07:52defnhehe
07:52LajlaWhat's the difference between an introvert and an extravert mathematician?
07:52defn?
07:55defnIs that the punch line?
07:55Lajladefn, the extraverted looks at _your_ shoes when you talk.
07:56defnhah, I've heard that one somewhere
07:56squidsoupclearly Lajla's joke engine is written in ruby
07:56Lajlasquidsoup, explain
07:56LajlaMy joke engine is written in Scheme
07:56squidsoupyour punchline took a long time to process :P
07:56defnhe's poking fun at Ruby's 1.8.X performance woex
07:56defnwoes*
07:56defnmost of which have been fixed in 1.9.X
07:56squidsoupoh don't get defensive, ruby's lovely :)
07:57LajlaRuby suuuuuuuuuuuqqqqhhz
07:57defn<--former rubyist
07:57Lajlasquidsoup, I was reading a mail, pardon
07:57LajlaRuby is a crippling asset to the mind.
07:57RaynesLot's of Clojurians are former Rubyists. I've seen people hung for less.
07:57defnAw, that's not true -- I bet I can rapid prototype faster'n'you
07:58LajlaI don't like this 'principle of least surprise'.
07:58eintrLajla: dude, you can't just run off and do chores before delivering a punchline. that's so andy kaufman.
07:58defnit applies to clojure as well I think -- not a lot of surprises
07:58defnI don't see why you'd ever want to be surprised
07:58squidsoupRaynes: I'm a ruby developer, so presumably I'm allowed to poke fun at it
07:58LajlaIt cripples programmers minds, they should in stead be trained in the fact that a machine follows logic dumbly and thus can be surprising to human intuition
07:59LajlaWell, in Scheme (= 0.1 1/10) ===> #f
07:59LajlaSOme would call that a 'surprise'.
07:59defnLajla: You're friends with Djikstra, aren't you?
07:59Raynesdefn: If you lead a dull and predictable life, you need a little excitement in your code, I guess. :\
07:59Lajladefn, oh yeah.
07:59ChousukeLajla: that's just silly
07:59LajlaDijkstra was da bomb.
07:59LauJensenLajla: I've processed the logs for #clojure and the result is, that you need to check out #clojure-casual :)
07:59LajlaChousuke, moi, miten menee?
07:59ChousukeLajla: a machine is designed my people; it doesn't need to do stupid things
08:00RaynesLauJensen: Don't direct him there! :(
08:00LauJensen?!
08:00RaynesLauJensen: He might actually come. ;)
08:00LajlaI rather have programmers be trained to understand that logic can be very counter intuitive than for programming languages to have a lot of exceptions to a general logic to make it easier for people.
08:00ChousukeLajla: that is, if a program can do something that people would expect it to do instead of doing something completely different, doing the expected thing is often better.
08:00squidsoupwell, I'm off to bed.. just wanted to spread a little joy after discovering the SICP in Clojure rewrite
08:00squidsoupgreat initiative
08:01LajlaI've seen peoplle that have 6 years of experiencing coding in Java that still did not realize exactly why they used == in conditionals.
08:01squidsoupnight Clojurers and Clojurians
08:01defnRe: Djiskstra -- "On the fact that most software is written on one side of the Atlantic Ocean" --Alan Kay
08:01ChousukeLajla: "exceptions" do not adhere to the principle, do they? :/
08:01defnciao squidsoup
08:01LajlaChousuke, in the case of programming languages, exceptions often contradict axioms.
08:01LajlaWhich were stated otherwise
08:01Lajlaand thus in effect were not the true axioms.
08:02defnLajla: that's a 100 level CS course or an intro to symbolic logic course
08:02ChousukeLajla: if a result of something is exceptional or incoherent, other things considered, then it's not the "least astonishing" thing
08:02Lajlathe true axiom would be 'except in the special case B, A applies' andnot 'A aplies'
08:02LajlaChousuke, human intuition and logic are two completely different things.
08:02defnif you call someone who uses == in their Java programs programmers, then my cat may also fit your definition
08:02defnerr without knowing what it does...
08:02Lajladefn, I said they didn't realize why they used == instead of =.
08:02LajlaIt's true.
08:02ChousukeLajla: can you give a practical example?
08:03ChousukeLajla: I mean, from a programming language
08:03LajlaChousuke, for instance, the fact that a < b < c in many languages compares 1 to c or 0 to c is considered a 'surpirse'.
08:03LajlaEven though it follows clearly out of the language specs, similarly to a * b + c for instance.
08:03ChousukeLajla: right. yes.
08:04LajlaPython allows a < b < c, which is different to (a < b) < c
08:04defnThis whole conversation is a but nerve racking simply because what surprises one person may be completely natural and what they'd expect
08:04defnIt's awfully subjective
08:04Lajladefn, that too.
08:04defns/but/bit
08:04ChousukeLajla: because that notation is familiar to anyone with basic knowledge of maths
08:04LajlaWhich makes the 'principle of least surprise' an even vaguer concept.
08:04ChousukeLajla: programming languages are tools for *humans*
08:04LajlaChousuke, it's abuse of notation in mathematics though.
08:04LajlaAnd that's one of the things, I don't thing programming languages should resemble mathematical textbook notation
08:05LajlaMathematical textbook notation is often ambiguous and laden with inconsistencies and abuses of notation. Not a thing you want for a programming language.
08:05LajlaThat's why I like S-expressions
08:05defnSee: APL
08:05LajlaErase all faults, start again
08:05defn:D
08:05Lajladefn, exactly.
08:05LajlaBrilliant language, brilliant notation.
08:05Chousukeif anything, a programming language should error when it encounters a < b < c
08:05Lajlaa < b < c is awkward, but (< a b c) i fine
08:05Lajlais fine*
08:06ChousukeC's weird interpretation of that is even worse
08:06LajlaChousuke, not if a < b returns an integer.
08:06LajlaAs in C.
08:06ChousukeLajla: no, it makes no sense
08:06LajlaWhy, it's a perfectly valid operation?
08:06defnBrilliant language, brilliant notation, awfully surprising when compared to every other language I've ever used.
08:06ChousukeLajla: it's not conceptually valid
08:06LajlaChousuke, it makes all sense, < is an operation int x int -> int
08:06LajlaChousuke, what's concept got to do with it?
08:06ChousukeLajla: that's stupid
08:06LajlaIt's just a symbol for an operation on integers.
08:07Chousukebut it's not an operation on integers conceptually!
08:07LajlaIt could be $ or |@ or !!
08:07LajlaIt's just a symbol given to a certain operation
08:07Chousuke*no-one* would say that a > b > c makes sense in C
08:07LajlaDepends on what you want to do.
08:07LajlaSay c is guaranteed to be 0 or 1.
08:07LajlaThen it can make all the sense.
08:07Chousukeit goes through the compiler because C is stupid, but it makes no sense.
08:07LajlaWhat if c itself is the result of a < operation earler.
08:07Chousukeno, it's just bad code then
08:07Lajlaint c = q < r
08:07Chousukeand still doesn't make sense.
08:08LajlaChousuke, it makes all the sense and it can be used to build a program.
08:08Chousukecode that compiles doesn't mean it's code that makes sense.
08:08LajlaIf c is guaranteed to be 0 or 1.
08:08LajlaWhat is 'makes sense'.
08:08Chousukesomething that makes conceptual sense.
08:08defnI lost track where we stopped talking about "surprises" and instead began a veiled discussion on purity
08:08Chousukecomparing truth values to integers does not make that.
08:08LajlaIf c is guaranteed to be 0 or 1 then a > b > c can be used to effective results.
08:08defnThey are very different discussions
08:08LajlaChousuke, they aren't truth values.
08:08LajlaTHey're integers.
08:09ChousukeLajla: yes. but it STILL doesn't make sense.
08:09ChousukeLajla: to the programmer, they are truth values
08:09LajlaChousuke, why not?
08:09LajlaThen that's where you go wrong.
08:09LajlaThey're integers.
08:09LajlaIt's operations on integers.
08:09LajlaIt's an operator like * or +
08:09ChousukeLajla: C imposes this idiotic equivalence between truth values and integers, but that's another thing
08:09LajlaChousuke, a boolean is not a truth value.
08:09LajlaIt's just a datatype
08:09defnit is in my view
08:09Chousuke... skflsdjlfkj
08:10Chousukeand pointers are just integers
08:10Chousukeand arrays
08:10LajlaChousuke, nope, but pointers are arrays.
08:10Chousukepointers are also integers
08:10Lajlaintegers and pointes are different
08:10LajlaYou can't multiply pointers
08:10LajlaAnd they are typed
08:10Lajlaa + 3 is a very different result depending on a is a pointer or an integer.
08:10Chousukeyes you can, just cast to int :P
08:10LajlaChousuke, if you can cast that surely means that it's different?
08:11LajlaEspecially when you need it.
08:11LajlaBut yeah, an array is just a pointer.
08:11Chousukethe thing is, even if they are the same thing to the machine, they're still different to the human
08:11Lajla"string" is a pointer towards an 's' const char, statically allocated after which comes 't' ... and finally a 0 char.
08:11Chousukeand while it's sometimes useful, your boolean example in particular is completely idiotic
08:12LajlaChousuke, to humans whose minds have been crippled by ruby yes.
08:12ChousukeLajla: bah
08:12LajlaThe root of all bugs is people that think in 'concept's rather than in atoms that perform transformations on data.
08:12ChousukeLajla: I've never programmed in ruby. :)
08:12Chousukeno
08:12defnno one's mind is crippled by using another language
08:12defni can do math and logic the same as you after a year and a half of ruby
08:12LajlaChousuke, learn to let go, 'concepts' don't exist, your program is a pipeline of transformations on data.
08:13Chousukethe root of all bugs is people not understanding what they're doing *and* programming langauges doing idiotic things like treating booleans as integers :P
08:13ChousukeLajla: concepts do exist.
08:13ChousukeLajla: existence is a concet.
08:13Chousukeconcept*
08:13defnLajla: Ruby very much works like transformations on data most of the time...
08:13LajlaChousuke, naïve realism much?
08:13ChousukeLajla: you're just being overtheoretical here.
08:13LajlaChousuke, when you see a 'tree', surely you realize your mind just creates an abstraction and what's there are a pile of elementary particles?
08:13ChousukeLajla: you axiomatically assert that the programming langauge is right and the human is wrong.
08:13LajlaChousuke, I would not be Lajla if I were not.
08:14ChousukeLajla: yes, and the tree exists.
08:14RaynesI was hoping this channel would never end up housing such comp.lang.lisp garbage. :\
08:14LajlaChousuke, I don't even believe in 'right' or wrong. =P
08:14_extermLajla, if you want a language that is statically checking thoroughly enough to slap you in the face for a < b < c, use one. like Haskell ;-)
08:14defnLajla: i think you're verging on hysterical realism
08:14LajlaChousuke, naïve realist?
08:14defnfwiw
08:14ChousukeLajla: what?
08:14Lajladefn, I am a mereological scepticist, yes.
08:14serp_O_O
08:14defnsee: http://en.wikipedia.org/wiki/Hysterical_realism
08:14LajlaChousuke, a naive realist is some one who believe things exist necessarily because they are perceived.
08:15ChousukeLajla: just because a tree is a complex structure of cells and other things doesn't mean it's not a tree
08:15LajlaOr rather, does not quaestion the existence of and validity of perception.
08:15LajlaChousuke, it's a collection of subatomic particles.
08:15LajlaSubatomic particles 'exist' because they can be defined.
08:15ChousukeLajla: yes. also that.
08:15LajlaTrees are just abstractions
08:15ChousukeLajla: and a million other things
08:15ChousukeLajla: it's still a tre.
08:15Chousuketree*
08:15defnHysterical realism is typified by a strong contrast between elaborately absurd prose, plotting, or characterization and careful detailed investigations of real specific social phenomena.
08:15LajlaChousuke, naïve realism is hard to maintain scientifically.
08:15Chousukethat it is one thing doesn't mean it also isn't another
08:16LajlaChousuke, do you think there's a reason there's no objective way to test if something is a tree or not?
08:16ChousukeLajla: I'm not saying our perceptions are always correct but you're saying they never are.
08:16ChousukeLajla: of course it's not objective. But it can be reasonably defined.
08:16LajlaOr that philosophy has tried for 2 000 years to define such things as 'trees' or 'humans' but ultimately failed why it took physicists 2 months to define the concept of photon rigorously?
08:17Chousukeand why does that matter?
08:17Chousukethe concept of trees and humans are still extremely useful
08:17LajlaChousuke, well, it's called naïve realism, and as it seems it's not some-thing that can be reconciled with materialistic science.
08:17Chousukemore so than the concept of photons, in many contexts
08:17LajlaChousuke, that doesn't mean it exists or is true.
08:17defnit's another symbol
08:17defnwhy do you need the definition to sleep at night?
08:18LajlaA lie can be very useful to believe, especially if the truth is either too complex or too frightening to handle.
08:18ChousukeLajla: it's not a lie. it's a flexible definition
08:18LajlaChousuke, it's an approxiation, if you like.
08:18Chousukeor that.
08:18Chousukestill, not a lie
08:18LajlaChousuke, what is the difference between a 'flexible definition' and vagueness?
08:18defnHubble's constant by your definition wouldn't be good enough
08:19ChousukeLajla: vagueness is a concept that's applied when something is not defined in any useful way.
08:19LauJensenChousuke: Lajla: Seriously, isnt this discussion perfect for #clojure-casual?
08:19LajlaHubble's constant is defined rigorously, just not _found_ rigorously yet.
08:19ChousukeLajla: the definition of a tree is useful
08:19candera+1
08:19defnprobably a good idea...
08:19candera(that is) LauJensen: +1
08:19defn@Lau
08:19LajlaChousuke, get into casual
08:19LajlaCan't see you there here.
08:19eevar2or #clojure-blah
08:20RaynesFor the record, Lajla has joined #clojure-casual.
08:20LajlaI have
08:20ChousukeI suppose I could join
08:20Rayneseevar2: #clojure-casual is an established channel.
08:20eevar2Raynes: okies. i'm thinking of #haskell-blah i guess
08:21Rayneseevar2: Indeed. psykotic created the channel a while back. He's disappeared, but he made me an op before his vanishing act.
08:47LicenserRaynes: I may protest, not everything is a sadbox bug this certenly isn't the iterate problem is clojurebots one
08:48RaynesHuh?
08:48RaynesHow is that not a bug? :o
08:49LicenserRaynes: it is one but not a sandbox one, since it works in a vanilla sandbox
08:50RaynesOh yeah, I forgot. But it isn't a sexpbot bug either, thankyouverymuch.
08:50RaynesIt works on my local sexpbot, but not on your server.
08:50RaynesTherefore, your server is the bug!
08:50Raynes;)
08:50Licenserworks it with the same version of clojure or do you have a different one on the server?
08:51RaynesIt should be the same version. There hasn't been a new snapshot in 6 days, and I've ran lein clean && lein deps recently locally and on your server.
08:51RaynesSo, I don't know what causes the bug. I gave up days ago.
08:51Raynesrseq wasn't a big deal, but iterate borking is kind of seriously annoying.
08:51RaynesNot your fault though.
08:51Licenserhmm hmmm
08:52RaynesI may just need to re-clone sexpbot or something.
08:52Raynes:|
08:52Licenserhmm hmm hmmmm hmmm
08:52Licenseror it is the java version it runs
08:52RaynesJava 6?
08:52RaynesOr is it 7?
08:52RaynesI run 6 locally.
08:52Licenserthe default java runs java 7 since it is my playground
08:53Licensertry to use java 6?
08:53RaynesHow can I make it use 6? >.>
08:53defnRaynes: get thee a branch
08:54Licensertry to run it with /usr/jdk/jdk1.6.0_16/bin/java
08:54RaynesI run it via lein swank. I can't control what leiningen uses, sadly.
08:54defnRaynes: you can i believe
08:54Raynesorly
08:55Licenser*updates to the neewest java 7 snapshot*
08:57RaynesI can just run sexpbot via the ./sexpbot script to test it.
09:00defndo you just need to set java.library.path?
09:00RaynesOr I could just do that.
09:00Raynes$(rseq [1 2 3])
09:00sexpbot=> (3 2 1)
09:00RaynesLicenser: Yep, that was it.
09:00defnalso Raynes consider using swank-clojure-project if lein swank wont honor the directive
09:01Raynesdefn: Over ssh? I think not.
09:01defni think they're functionally equivalent nowadays
09:01defnoh, right
09:03RaynesIf I had leiningen installed locally, I could just edit that.
09:03RaynesBut Licenser has it installed globally.
09:29LicenserRaynes: try ain?
09:29RaynesLicenser: Try what again?
09:29Licenserrun swank again?
09:30RaynesLicenser: I just spent the last 10 minutes figuring out how to make my ~/bin/java take precedence over /usr/bin/java, just to run Java 6.
09:30LicenserRaynes: I updated java 7 to the newest version
09:30RaynesDoesn't mean it fixed the problem. :p
09:31Licenserit doens'T mean it doesn't
09:31Licenserthat is why I say try
09:31bartjtomoj: just learnt to do (rand-int num) instead of (int (random number))
09:31duck1123there is no try
09:31bartjtomoj: thanks to your code snippet above
09:31RaynesI guess. As soon as I figure out why I can't get in my screen session.
09:43RaynesBleh.
09:44Lajla,(car [1 2 3 4])
09:44clojurebot:volkswagen
09:44LajlaAhaha
09:44Lajla,(first [1 2 3 4])
09:44clojurebot1
09:44patrkrisIf I have 20-30 minutes to talk about Clojure and Software Transactional Memory, what would be the most important stuff to include in your opinion? The audience will mostly be representatives from various small and large IT companies.
09:47arkhI'm sure you've seen it, but just in case, I'd cover what Rich did in http://blip.tv/file/812787
09:48bartjpatrkris: this is the article I like best - http://java.ociweb.com/mark/stm/article.html - perhaps, it should help you?
09:49Chousukepatrkris: the ease of working with data that you can trust no to change, no matter what happens :)
09:49Chousukenot*
09:51bartjpatrkris: I am sure you would have seen this wonderful presentation as well - http://docs.google.com/viewer?a=v&amp;q=cache:9t4z3xYqYPMJ:java.ociweb.com/mark/stm/STM_1up.pdf+clojure+stm&amp;hl=en&amp;gl=in&amp;pid=bl&amp;srcid=ADGEESiSWzwW5jQM-xLSunwiXrk2i1EI0fkkY_rH6XYn0wt3EbW0coe9OBrX0zz1LlIKuOJku4-UeJFUaMPcwAV2CytmahRa9YORHf9cVpz6s5kmphrYHbfqMSCwh43u6oEhdGeUPDoW&amp;sig=AHIEtbRMvwluDplu4bmPeAeucaAhBZYZBQ
09:52patrkrisarkh: thanks for the suggestion, and yes, I have seen it. It's a pretty long video, and I have only got 20-30 minutes. I'm thinking about what could seem most important to these people. I don't expect anyone being familiar with Lisp and functional programming. In fact, I think most of them are pointy-haired bosses who chose 'safe technologies'. But I want somehow to convey my enthusiasm but leave them with an impression that Clojure *matters*. It's n
09:52patrkrisjust another academic idiot trying to push an esoteric language down their throats.
09:52patrkrisbartj: i'll take a look, thanks
09:52patrkrisChousuke: that's a good point
09:52bartjpatrkris: this is a saner URL - java.ociweb.com/mark/stm/STM_1up.pdf - "Tackling Concurrency With STM"
09:53patrkrisbartj: ah, thanks
09:53Chousukepatrkris: remember to mention that stuff can change unexpectedly even in a non-multithreaded program (eg. if you pass a reference to something to a function etc.)
09:54patrkrisJust a little context: This presentation is held for a bunch of IT companies, as I said. It's done at my university, and it allows said companies to get a glimpse of what software engeering and computer science students are doing.
09:54patrkrisI don't expect any of the company representatives to really have a grasp about the importance of immutability and functional programming. But maybe I'll be surprised.
09:55patrkrisChousuke: again, good point
10:04arkhpatrkris: from the phb point-of-view, the future of hardware looks like it will be in the form of more parallelism, like many-core cpus. For developers to take advantage of that while avoiding the traditionally difficult problem of concurrency (maybe point out that most people are "doing it wrong" right now) they need the right tools. STM and specifically Clojure can provide those tools, on top of a JVM they may already have running on servers, leve
10:04arkhraging Java code they may have already developed or purchased.
10:05arkh*leveraging
10:06patrkrisarkh: noted, thanks!
10:07Chousukeleveraging ;/
10:07arkhChousuke: thank you : )
10:08patrkrisChousuke: You have to remember that these are managers and bosses. They'll appreciate business-words like 'leveraging'.
10:08patrkris:)
10:09patrkrisChousuke: Although I'll give the talk in Danish - so it doesn't really matter for me.
10:09arkhyou can't "make use of" synergies as well if you're not leveraging them. See, you make the stakeholders gather 'round the tribal knowledge, maybe taking it offline ...
10:09arkh;P
10:10patrkrisI wish I could just say something like 'Clojure will give you less headaches, and programmers will have more fun.'
10:12arkhcoming from a non-functional background, clojure was painful at first. It's frustrating to be thrust back in time to when I didn't "get" how to program something. I'm thankful I continued with it, though. The effort was worth it by a lot.
10:12patrkrisi feel exactly the same way
11:18rrc7czhow might you do (apply or [f f f f t])? I've tried something like (apply #(or %&) ..) but I'm missing something. It also doesn't accept a seq
11:18rrc7czdoes everyone just use reduce?
11:18canderaIs there something wrong with reduce?
11:19AWizzArdrrc7cz: or is not a function, it is a macro, so you can't apply it.
11:20rrc7czI understand
11:20AWizzArdAnd what are f and t?
11:20rrc7czbut then how would you do it?
11:20rrc7cztrue/false
11:20rrc7czit isn't literal code, just an example
11:21rrc7czI have (reduce #(or %1 %2) [true false false false]) right now
11:21clojurebotproject euler is http://ProjectEuler.net
11:21AWizzArdrrc7cz: I would write: (some identity [false nil nil true false])
11:21AWizzArdsome is what you want
11:21AWizzArdYour reduce is wrong.
11:22canderarrc7cz: I see the problem with reduce. No short-circuiting.
11:22rrc7czAWizzArd,candera: is that the only prob with the reduce? no short circuiting? or did I miss something else?
11:22rrc7czAWizzArd: I like your solution
11:22AWizzArdsome ==> or, every? ==> and, not-any? ==> (not (and ..)), not-every? ==> (not (or ..))
11:23canderaWell, I'm the dumbest guy in the room (although hopefully by less each day), but that's the only problem I can see. :)
11:23AWizzArdreduce *can* be used to do what you want, but the function will have to be more complex
11:23rrc7czok
11:24rrc7czAWizzArd: can you give me a hint as to the problem? :-) just so I understand
11:24chouserno way to make reduce short-circuit
11:24rrc7czI mean, if you assume for a moment short circuiting is not necessary; perhaps we just have a set of bools
11:25chousereven then, reduce will examine all of them, doing unnecessary work that 'some' would not
11:26rrc7czokay makes sense
11:26rrc7czthanks guys
11:26fogusTo make things a little clearer you can use (some #(or %)...) and (some #(and %)...)
11:27chouserwouldn't both of those do the same thing
11:27chouser?
11:28foguschouser: Shoot, you're right!
11:29rrc7czI like the readability though
11:29fogus(every? #(and %) ...) is what I should have said
11:30fogusAlthough at that point clarity is subjective
11:30rrc7czwhy doesn't some have a question mark?
11:32fogusrrc7ca: It's not a predicate
11:32rrc7czjust saw that, with the example (some #{:a} [:a :b])
11:45arkhwhat's the reason for this not returning a prompt at the repl:
11:45arkh(def counter (agent 0))
11:45arkh(await (send-off counter inc))
11:45arkh(prn @counter)
11:46arkhit's like the agent thread sits out there, not joining after send-off
11:46jcromartieit doesn't block for me
11:47arkh: (
11:47jcromartieusing 1.2 built a few days ago
11:47arkhfwiw, using 1.1
11:48puredangerare there any guarantees that keys or vals will give me back the keys or vals of a record in the order of definition?
11:49arkhpuredanger: no (with maps)
11:52cemerickwell, records aren't maps
11:52cemerickbut no, there are not guarantees
11:52cemerickpuredanger: ^^
11:52cemericks/not/no
11:55puredangerI ask because I always seem to get back keys and vals in the order of definition for a record
11:56puredangerand I could believe that if it's based on field ordering from a defined class that it *might* have a stable ordering based on that
11:57puredangermaybe another way to phrase this would be to ask whether a record acts as a sorted map based on field definition order
11:57puredangereither intentionally or accidentally
11:57cemerickpuredanger: the ordering originates in the defrecord declaration, but it's certainly an impl detail
11:58puredangerif so, then it seems like the docs should make it clear not to rely on it
11:58puredangeris there a way to reliably get the fields of a record in order?
12:00puredangerI was also curious about doing (defrecord A [c b g]) and then (print (A. 1 2 3)) which yields #:user.A{:c 1, :b 2, :g 3}
12:00cemerickpuredanger: looking at the impl, it'd take some bit of effort to make it so that the defined order isn't used for keys, seq, etc.
12:01cemerickWhy does ordering of the fields matter at all anyway?
12:01cemerickThat is, if they *do* matter, sort the map entries however you like.
12:01rhickeypuredanger: I think the order of the base fields will become a guarantee
12:02puredangerfine, but how would I sort them based on definition order then :)
12:03LicenserI offer cookies!
12:03puredangerfor reasons that are probably less than useful to explain (shaving a testing yak) I was trying to figure out how to take a record and produce a string that would construct that record
12:03puredangerwhich is of course what I'd really want print to be doing for me more transparently
12:04rhickeypuredanger: readable print for records is on the way
12:04puredangerand is #:user.A{:c 1, :b 2, :g 3} the form for that?
12:04rhickeyif you are looking for introspection, try (keys arecord)
12:04jcromartieis there an overview on records on the site?
12:04rhickeypuredanger: no, will be different then #:recordname{]
12:05puredangerrhickey: right, that's what drove the question about whether key order was stable wrt record field definition
12:05rhickeyjcromartie: http://clojure.org/datatypes
12:05jcromartiethanks
12:05rhickeypuredanger: will be yes, for the base keys
12:05jcromartieIs defstruct going away?
12:05rhickeypuredanger: and is already now, but nt yet promised
12:06puredangerrhickey: thanks, very helpful (and I'll take that as a promise :) )
12:08arkhI thought I read somewhere that defstruct would not be used anymore, instead using defrecord or deftype (??) What should be used?
12:08puredangercemerick: btw, I will reply to your question on the enclojure list re maven...still in my queue
12:08cemerickarkh: I can't think of any reason to use defstruct anymore.
12:08jcromartieand is defrecord useful for Clojure interop from Java?
12:08cemerickIt should probably be marked as deprecated.
12:08arkhcemerick: why the change?
12:09cemerickarkh: because records are better in every way :-)
12:14puredangercemerick: one nit I've seen with records is that you can't gradually construct them as in the record the fields are final/immutable and you must set during construction
12:15cemerickpuredanger: you mean vs. structs?
12:15jcromartieyou mean you can't say (assoc some-record :key val)
12:15jcromartie?
12:15cemerickstructs are persistent and immutable as well
12:16cemerickoh
12:16cemerickjcromartie: I think puredanger means that you can't provide fewer values than the number of defined slots to a record's ctor.
12:16puredangercemerick: yeah, what jcromartie said
12:17cemerickwhich is true...but sort of inconsequential
12:17puredangercemerick: kind of the old constructor injection vs setter injection argument
12:17jcromartieright
12:17cemerickwait, I'm confused now
12:17cemerickpuredanger: you can certainly assoc in a new value for a defined field
12:17jcromartieso someone tell me: why are records better than objects? :)
12:17rhickeypuredanger: you will be able to do so with a factory that constructs the record from a map. The positional ctor is kind of a low-level thing
12:17puredangercemerick: agreed, the vast benefits of having final immutable fields overweighs that for me
12:17jcromartie(aside from immutability)
12:18puredangerrhickey: ah, that makes sense - basically the builder pattern
12:18rhickeypuredanger: the name of that factory fn is still being worked out, but it will be provided by defrecrod
12:20puredangerrhickey: cool. reminds me of a blog post I wrote about using Builder and Factory Method patterns to swap between constructor and setter dependency injection styles in Java http://tech.puredanger.com/2007/07/30/builder-factory/
12:22riddochcI've got a few places in my code where I'm using maps that I'd probably benefit from promoting them to records.
12:24puredangerrhickey: for the time being, we just hacked in a new print-method for records to print as (Foo. 1 2 3). because multimethods are the shit. we'll pull that crutch out later.
12:26fogusrhickey: Any plans for providing a way to describe invariants (i.e. pre- post-) for the factory fn?
12:28rhickeyfogus: the factory function may be user-overridable, and then you can do whatever you please. But that may leave the positional ctor without protection
12:30fogusrihickey: I don't mind too much about that. If the ctor is viewed as low-level then I'm happy with all bets being off when using it.
12:30rhickeyfogus: agreed
12:30fogusrhickey: ^^ (sorry)
12:31puredangerrhickey: what if you made the positional constructor private when a factory function is defined?
12:32fogusI've gotten to the point in my contracts lib where I have started thinking about type/record invariants, so I'm more than happy to stop thinking about it until the factor fn is fleshed out :-)
12:32rhickeypuredanger: that would make it hard to write such factories
12:33rhickeypuredanger: the idea is to move away from things that would, in Java, need to be methods. 'Protection' engenders that
12:33rhickeybetter to think of the records as information and an open set of functions as the API
12:36rhickeypersonally I think protection is always in the way. Why should we write software protecting ourselves from those that would build on top of implementation details? We should avoid such people
12:36puredangerrhickey: I will meditate on that as a koan
12:37puredangerrhickey: in general, I agree. but I have 15 years of institutional Java baggage to work through :)
12:37cemerickpuredanger: of course, a particularly sane java pattern is for data objects to only have a ctor and public final fields. Makes lots of things easier, if you can get away with it. :-)
12:38rhickeypuredanger: well, it's a classic case of tradeoffs where people don't measure the cost. It *seems* like protecting things is a good idea, why not? The why not is, it creates incredible pressure to put things on the inside, a limited, closed space.
12:38puredangercemerick: yes, I am a fan of that style when it makes sense
12:38puredangerrhickey: agreed
12:39cemerickwell, that's the default in clojure :-)
12:39cemerickmaybe except when one would want to muck with bits of clojure implemented in Java :-/
12:40rhickeyanyone know of a way to get IntelliJ to show you all the cases of auto-boxing?
12:41riddochcI agree with your koan on protection, rhickey. It's one of the things that's always bothered me about traditional java.
12:43rhickeyI think the application of OO to information is one of its biggest failings
12:47quotemstrrhickey: How so?
12:47quotemstrI'm just glad opposition to OO is no longer heretical.
12:51rhickeyquotemstr: to the extent OO is about encapsulation, what's the point of encapsulated information (i.e. with custom access protocols)? You can get representation independence with common access protocols. To the extent it is about messaging/behavior, that too makes no sense for information. State?, also, no
12:58jashmennhow do I get a class object for something that is not a primitive. e.g. Integer/TYPE only for a custom object
12:59ChousukeClassName
12:59jashmennoh wait nvmd, i see my problem. Integer/TYPE returns int
12:59jashmennthanks Chousuke
12:59jashmennmakes sense
13:09pao #erlang
13:34anars&window 1
13:34anarsoops.
13:41vin http://sprunge.us/BSYF I have this file, and I am trying to compile it, so I start clj in the directory where that file is and type (compile 'cmd-line-demo) and it tells me: java.io.IOException: No such file or directory (cmd_line_demo.clj:1)
13:42vinthe filename is cmd_line_demo.clj
13:42jcromartiedoes your clj program include the current directory in the CLASSPATH?
13:42jcromartie.
13:43vinno, I guess it does not, how do I do that?
13:46jcromartiewell, what `clj` program are you using?
13:46jcromartiedid you write it yourself?
13:46jcromartie(I use my own shell script)
13:46jcromartieI'm not sure what's out there now
13:47vinhttp://sprunge.us/jaGA this one
13:49jcromartiehmm, that includes "."
13:52eevar_hmm.. the lazy stuff was included in 1.0, right? -- clojure.org/lazy says: (Note: this section describes work in prerelease, available in the SVN trunk since rev 1287)
13:53cemerickThis seems wrong:
13:53cemerick,(.append (StringBuilder.) (make-array Character/TYPE 0))
13:53clojurebot#<StringBuilder [C@d96f5b>
13:54Licenser,(str (.append (StringBuilder.) (make-array Character/TYPE 0)))
13:54clojurebot"[C@170efea"
13:54Licenserhmm oi
13:55cemerick,(.append (StringBuilder.) (make-array Character/TYPE 10) 0 1)
13:55clojurebot#<StringBuilder
13:55Licenser,(str (.append (StringBuilder.) (make-array Character/TYPE 65)))
13:55clojurebot"[C@f6b220"
13:55Licenser,(.append (StringBuilder.) (make-array Character/TYPE 65))
13:55clojurebot#<StringBuilder [C@d5acae>
13:55cemerickrhickey: seems like a dispatch issue? ^^
13:56cemerick,(.append (StringBuilder.) ^chars (make-array Character/TYPE 0))
13:56clojurebot#<StringBuilder >
13:57cemerickoh, it's getting routed through the Object overload :-/
13:57cemerickThe char[] overload is a perfect match though.
13:57Licenser(doc make-array)
13:57clojurebot"([type len] [type dim & more-dims]); Creates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."
13:57Licenserah I see how it works
13:58rhickeywhither char-array?
13:58Licenserwel the reason might be that the make array thing isn't initialized?
13:58Licenser,(make-array 0)
13:58clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$make-array
13:58Licenser,(make-array Character/TYPE 0)
13:58clojurebot#<char[] [C@125997>
13:59rhickey(doc char-array)
13:59clojurebot"([size-or-seq] [size init-val-or-seq]); Creates an array of chars"
13:59Licenser,(.append (StringBuilder.) #^chars (make-array Character/TYPE 65))
13:59clojurebot#<StringBuilder
13:59Licenser,(.append (StringBuilder.) #^chars (make-array Character/TYPE 0))
13:59clojurebot#<StringBuilder >
13:59Licenserhmm this looks better doesn't it?
13:59Licenser,(.append (StringBuilder.) #^chars (make-array Character/TYPE 1))
13:59clojurebot#<StringBuilder
13:59cemerickyes, I demonstrated that earlier
14:00Licenseroh ojkay sorry :) I didn't read that
14:00Licensercemerick: why do you have to be faster then me at boing smart? :P
14:00cemerickrhickey: char-array or not, shouldn't (.append sb any-char-array) get dispatched to the char[] overload?
14:00Licenser,(.length (.append (StringBuilder.) #^chars (make-array Character/TYPE 1)))
14:00clojurebot1
14:01Licenser,(.length (.append (StringBuilder.) #^chars (make-array Character/TYPE 42)))
14:01clojurebot42
14:01Licenserokay this is greatish :D
14:01Licenserbut cemerick you are right, it should
14:02Licenser$(.length (.append (StringBuilder.) (make-array Character/TYPE 10)))
14:02sexpbot=> 10
14:02Licenser,(clojure-version)
14:02clojurebot"1.2.0-master-SNAPSHOT"
14:02Licenser$(clojure-version)
14:02sexpbot=> "1.2.0-master-SNAPSHOT"
14:03Licensercemerick: it seems to work on sexpbot, perhaps it is a clojurebot thingy?
14:03cemerickLicenser: I get the same bad behaviour in my repl. Not sure what the bots versions are.
14:04Licenserthe sexpbot uses the lates snapshot, I'm not sure about clojurebot exactly
14:04cemerick$(.append (StringBuilder.) (make-array Character/TYPE 0))
14:04sexpbot=> #<StringBuilder >
14:04cemerickI'm not far from the latest -- lagging by a few days tops.
14:04Licensercemerick: I'm not entirely sure
14:05Licenseroh wait no it might be clj-sandbox who accidently fixes it
14:05Licenserclj-sandbox uses it's own .
14:05Licensernot the clujure one, meaning it might be 'more correct' about relfection then clojure itself o.O
14:06anarssame behavior on clojure 1.1.0
14:07Licenserhttp://github.com/Licenser/clj-sandbox/blob/master/src/net/licenser/sandbox.clj#L28 is what I use instead of the original
14:07Licenser*.
14:07cemerickanars: in that case, I either really don't understand how host dispatch is supposed to work, or this is a long-standing bug.
14:09zakwilsonWouldn't a team of ferrets do better at that?
14:09cemerickmonkeys type faster
14:11rhickeycemerick: it is a long standing bug in any API that takes Object that when given one of its other arg types as an Object it doesn't call the same code
14:11rhickeyi.e. StringBuilder is broken
14:11cemerickhrm
14:11cemerickbut:
14:12cemerick,(.append (StringBuilder.) (.toCharArray "foo"))
14:12clojurebot#<StringBuilder foo>
14:12cemerickoh, string representation
14:12LauJensenIs there anything in contrib which does (shorten 6 "hey there!") => "hey..!" ?
14:13cemerickrhickey: I remain confused. Shouldn't the most specific overload be dispatched to? What's so special about having an Object overload?
14:14rhickeycemerick: this using reflection?
14:15cemerickrhickey: presumably, yes
14:15rhickeyno, so, all compiler knows is you have an object, it matches, done
14:16rhickeythat's why this API is broken, you should never do something different for a reference type arg than you would for the same object passed as an Object
14:16cemerick'course, it never actually matters in Java, so it probably never came up
14:17cemerickor, doesn't matter in non-reflective java calls, I should say
14:17rhickeycemerick: it does matter in Java, if you have your stuff in a collection of Objects and pass to the API
14:18rhickeyit's a goofy broken API that does that
14:18rhickeyoverloading gone awry
14:19cemerickBut wouldn't the only alternative be to force a .toString call on every object that you would otherwise pass into append?
14:19rhickeycemerick: no, append Object should do the right thing
14:20cemerickoh, *if* there's a useful other overload available
14:20rhickeycemerick: exactly, same object through 2 different doors should get same result
14:22rhickeydoing something different based upon the static type of the object is just bad design, IMO
14:24rhickeyfragile at least
15:14durka42with leiningen, how do I add as a dependency a jar that is not found in any repositories (i.e., it came from sourceforge)?
15:14lancepantzdurka42: i usually add it to clojars
15:15durka42lancepantz: add the external jar to clojars?
15:16lancepantzyeah, and then add it as a dep on your project
15:16lancepantzthat's what i always do atleast
15:16lancepantzyou can also set up a private repo
15:17durka42lancepantz: i'll try the clojars way
15:26arkhdoes anybody have a favorite "clj script"? Or is there anything sophisticated like ipython?
15:42dakronearkh: here's my favorite: http://gist.github.com/438179 and the ~/.clojure.conf file I use: http://gist.github.com/438180
15:46arkhdakrone: thank you
15:46dakrone:)
15:56serp_I have a bunch of functions with side-effects. is it possible to, during a transaction, enqueue a bunch of function calls to these functions and have them run only after the transaction finished successfully?
15:56chouserserp_: you could send them to an agent
15:57serp_chouser: but won't the agent start processing my requests even though the transaction didn't finish?
15:57chousernope. sends to agents are held until the transaction commits
15:57serp_aha nice. just was I was looking for :9
16:14timcharperI think the single most painful thing about clojure right now are the back traces.
16:15lancepantzagree 100%
16:19timcharperIs there any hope of things improving in clojure 1.2?
16:20rfgIs there a list anywhere of interfaces that can be implemented in a deftype?
16:20dnolentimcharper: doubtful, 1.2 is pretty close to being done it seems. what dev environment do you use?
16:21dnolenrfg: ? I think deftype/defrecord can implement any Java interface unless I'm mistaken.
16:21timcharperI'm currently using Clojure 1.1
16:22dnolentimcharper: I mean dev environment - Eclipse, Netbeans, Emacs?
16:23rfgdnolen: Right yeah.
16:24timcharperDoes anybody else run into this? If an error occurs within an anonymous function called by a lazy sequence, all stack trace beyond that point is completely lost?
16:25timcharperActually, it seems that it's just the anonymous function that does it.
16:25timcharperI don't understand why the stack trace needs to be lost. It's my understanding that every element of code in clojure has metadata indicating which line it came from
16:25rfgdnolen: I guess I'm trying to ask for common clojure interfaces for ISeq, etc.
16:28rfgDoes that make any sense?
16:31rfgDoes one just look at clojure.lang source code?
16:31chousertimcharper: are you seeing only a single Cause instead of the whole chain?
16:34chouserso it definitely strikes me as awkward that protocols can't dispatch on meta :type or something.
16:35chouserI define a protocol because it makes sense conceptually. Perhaps extend it to a class or two. Then realize it would fit nicely with an informal object type I've been using that's just a clojure map.
16:36chouser...and I'm stuck.
16:36chouserI guess my best option is to switch from a protocol to multimethods and adjust all my existing implementations?
16:36raekexceptions that escapes from code that run "inside" a lazy sequence are caught by the forcing mechanism and thrown as the cause of a RuntimeError
16:37raekI think this has to do with that exceptions thrown from a lazy sequence may end up anywhere
16:37raekdepending on when the lazy sequence is realized
16:37AWizzArdchouser: that sounds at least like a workable strategy
16:37chouserbut it's really annoying.
16:38chouserit suggests to me that perhaps I shouldn't be using protocols at all until I'm ready to switch to higher-performance code.
16:39chouserBut the syntax for multimethods is quite different than protocol implementations, so requires significant refactoring to accomplish. feels un-clojurey
16:42raektimcharper: the original exception should be wrapped in a RuntimeException
16:42raektimcharper: http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java#L45
16:43timcharperraek, chouser: I'll come up with sample code that shows the issue... one moment
16:43timcharperthanks :)
16:43timcharperraek: actually, that explains it. If the original exception is wrapped in another exception, that would explain why I can't see the backtrace for with the default backtrace formatter
16:44timcharperOr does it?
16:45raeksome formatters (emacs?) also shows "caused by:" and continues with the cause
16:46raekmy experience is that error reporting with exceptions and lazy sequences don't play well together
16:46chousertimcharper: no it doesn't -- you should see all caused-by's, or you need to fix your environment
16:46timcharperchouser: okay, perhaps something is broken then. (Good news)
16:46raekone could throw an Error instead of an Exception, but that is kinda hackish
16:47AWizzArdchouser: yes, some intermediate macro that expands into multimethods or protocolls could be helpful
16:48raekor, sometimes one can restructure the code to work like middleware in compojure does
16:48raek(which resembles continuation passing style a lot, IMO)
16:53serp_is there a neat way of "decorating" a function in clojure? let's say I have a function f and want to replace it with a function that does something to the arguemnts before passing them on to f
16:54dnolenserp_: sounds like comp to me
16:54danlarkinrober hooke!
16:55danlarkinhttp://github.com/technomancy/robert-hooke
16:58raek((comp f g) val) does (f (g val))
16:59raeka decorating function can choose not to call g
17:00chouserserp_: every high-order function is a sort of decorator
17:00raekexample (ring/compojure middleware): (defn my-decorator [handler] (fn [request] (if (...) (handler request) ...)))
17:01timcharperchouser, raek: now that you have pointed it out (the "caused by" lines in the stack trace), I understand what's going on, and I'm seeing that the stack trace is in fact pointing me where I need to look. Thank you!
17:01serp_I'd like to do a more static decoration
17:03raekmemoize in clojure.core is used this way: (def my-fn (memoize (fn [...] ...)))
17:03raekor maybe (defn my-fn [...] ...) (def my-fn (memoize my-fn)
17:04raekthere's a defn-memo macro in clojure.contrib.def to make this shorter
17:08serp_it's not memoization I want to do though
17:11raekcan you show a simple example of what you want to be able to do?
17:13serp_sure
17:15serp_http://aee22f28384e4376.paste.se/
17:16serp_so I would like to wrap a function inside another function with the same name
17:18raekis there any special reason to let them have the same name?
17:18serp_the real use for this is to make the set-pos function in a game not only change the position of a character but also send the new position over the network
17:19raekredefining functions -- in other cases than fixing broken code -- should be avoided
17:19chouserhm... the position of the character is held in a reference object?
17:19serp_chouser: yup
17:19chouserserp_: do you know about watchers?
17:19serp_nope
17:19chouser(doc add-watch)
17:19clojurebot"([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
17:20serp_awesome
17:20serp_sounds just like what I'm after
17:21anars is add-watch being stabilized with clojure 1.2.0?
17:21sholdenwhats the timeframe on 1.2?
17:21chouseranars: hasn't changed since before 1.0, iirc.
17:21anarsaye
17:21chouserseems pretty stable. :-)
17:22AWizzArdtrue
17:22AWizzArd,(doc subseq)
17:22clojurebot"([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"
17:23AWizzArdSomeone mentioned a few days ago that subseq can also return nil, while this docstring makes me think that it will always return a seq.
17:23AWizzArdThose doc strings could benefit from an update
17:30raekcan somebody bring me up to date about how #^ and ^ has changed?
17:30raek^ is the new #^ ?
17:30chouseryes
17:30chouser^x used to mean (meta x) but doesn't anymore.
17:30raekand old ^ must be written in the full (meta ...) form nowadays?
17:30chouseryes
17:31raekso, what will "new #^" be?
17:31chouserhaven't heard of anything yet. I don't think it's even officially deprecated, which would probably happen for a release before it's used for something else.
18:32zakwilsonI wonder how much risk there is in exposing Swank to the public internet.
18:39dakronezakwilson: would they be able to connect and via java-interop run system commands on your system?
18:40zakwilsondakrone: Yes. There's no doubt that it's a risk in theory. It's more a question of liklihood.
18:49zakwilsonSSH tunneling should be the Right Thing, but it doesn't seem to be working.
18:52raekI often use ssh tunneling with swank...
18:55zakwilsonIt was working on my LAN, but not over the public internet
18:56zakwilsonssh -L 4005:localhost:4005 user@public-IP # opens the port but I get "connection refused" when I try to use slime-connect
19:01raekand you're connecting to localhost:4005 with slime?
19:03zakwilsonraek: yes
19:04zakwilsonOn the remote box, I see "channel 3: open failed: connect failed: Connection refused"
19:05raekstrange
19:07zakwilsonPossibly oddness related to the fact that remote box is a Mac.
19:12Chousukethe firewall thingy in OS X might be blocking you?
19:13ChousukeI got a prompt asking is java is allowed to listen for connections when I first used swank :P
19:14zakwilsonI can connect to Swank directly. I just can't connect over the SSH tunnel
19:21arohnerzakwilson: can you connect to swank locally, on the remote box?
19:24zakwilsonarohner: I think you may have solved it for me. I can connect remotely, but NOT locally. I previously had the opposite problem and had to specify the IP to bind to.
20:31anonymouse89clojure equivalent of common lisp logbitp, anyone?
22:18herdrickquestion: on the topic of dealing with maps as if they were sets
22:18herdrickin the sense that merge-with is sort of like union of sets
22:19herdricki want to combine two maps like merge-with does, except I want some special handling for the case when a key is in only of of the maps
22:19herdrickso i wrote this:
22:19herdrickhttp://gist.github.com/438610
22:19herdrickany thoughts?
22:19herdricki swear there should be a better way
22:20herdrickin fact something more general yet than this would be a good thing for the core or at least contrib