#clojure logs

2009-11-18

00:38technomancy_ato: how goes?
00:38technomancyhave you beaten me to the finish line yet? =)
01:19technomancyoy... you can't add a docstring to a namespace once it's been defined?
01:33_atotechnomancy: you should be able to, it should be mutable
01:33_atotechnomancy: alter-meta!
01:33technomancyright; I was expecting re-evaling the ns form after adding a docstring would do it.
01:33technomancyno such luck
01:34_atoah :(
01:34technomancyjust confused me because I started to wonder if I was accessing the metadata correctly for a minute
01:34_atooh and I'm getting there, got distracted by some other stuff for a few hours
01:35technomancyI just need more detailed help output for various tasks before I consider it ready for release.
01:35_atoI'm currently fighting sqlite's full-text search, looks like I need to make a seperate search table, it only wants to search one column at once
01:36technomancy=\
01:36technomancyhow much works so far? can you sign up for an account?
01:36_atopretty much everything but search should work, though it hasn't be thouroughly tested, lemme push my current version in to production
01:38_atotechnomancy: oh yeah. Also would you be able to add a way to set <description> in the POM with leiningen? (assuming you haven't since I last looked at it) I need something to search on ;-)
01:39technomancysure thing
01:41_atoooh.. I jsut looked in the production db and there's already 2 other users, how exciting! ;-)
01:43technomancyand now three!
01:45piccolinoFour
01:45_atodamn... uploading is broken
01:46piccolinoThat'll give me time to figure out how to make a jar.
01:51_atooh bummer, and links to jars aren't working either. heh. like I said not tested
01:51_atouploading should now work though.. sorta mostly :P
01:51_atooh and the repo URL is http://clojars.org/repo/
01:52technomancy_ato: pushed out descriptions in leiningen
01:55_atotechnomancy: awesome, thanks :)
02:04technomancyis lein push implemented?
02:05technomancyalso: do you want me to add clojars to the default repo for this release?
02:05technomancy_ato: ^^
02:07_atotechnomancy: take a look at http://github.com/ato/lein-clojars/
02:07technomancyI saw that; just wondering if it was working. =)
02:08_atopush should work with that, although again I haven't extensively everything yet
02:08technomancycool
02:08_atoerr extensively tested*
02:08_atoand yeah if you'd like to add clojars to lein's default repos, please do :)
02:09technomancyif you think it's ready. =)
02:09jkkramertechnomancy: there's a typo in your latest commit. "designed not to set your hair on _file_"
02:09jkkramerin the :description line
02:10technomancyoops! thanks
02:11_atotechnomancy: I'm determined to get the basics fully functional and debugged today. :)
02:14_atoah! fixed the jar pages: http://clojars.org/compojure
02:17technomancy_ato: you want me to mention clojars as a "coming soon, watch out for:" in my leiningen announcement?
02:17technomancy=)
02:17_atotechnomancy: hehe sure. :)
02:20technomancy_ato: I'm thrilled to get this out the door, but once the dust settles I'm going to be very interested in taking a closer look at the clojars code.
02:23_atoeek! :-) I'm a total compojure newbie so it probably doesn't look like much at the moment.
02:24adityoguys..what is Clojars.org?
02:24technomancy_ato: I haven't done anything with compojure either; no worries
02:25_atoadityo: it's *almost* a clojure community jar repository (for use with leiningen or maven or whatever)
02:25_atowell actually the repo part works, just need finish off browse and seearch
02:25adityocoool!!
02:32technomancyreleased, pushed, and announced.
02:34_atotechnomancy: congrats! goodnight. :-)
02:38adityowaddap piyush
05:02adityo,doc partial
05:02clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/doc
05:03adityo,(doc partial)
05:03clojurebot"([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."
05:03adityois a bit confusing!
05:03adityowould like to see some simple examples
05:27_ato,(filter (partial < 5) [1 7 3 2 5 9 2 3 4])
05:27clojurebot(7 9)
05:27_atoadityo: ^
05:33adityo_ato: hmm
05:33adityo,(filter #(< 5 %) [1 7 3 2 5 9 2 3 4])
05:33clojurebot(7 9)
05:34adityowhat would be the benefits of using partial
05:34Chousukeit's sometimes neater.
05:35Chousukemostly personal preference :P
05:36adityoanyways i think partial is cool :P
05:47hoeckadityo: also, partial can be nested, #() not
05:52adityohoeck: yeah, thanks for pointing that out :)
06:05Chousukeadityo: the biggest problem with partial is that it's got 7 characters :P
06:08hoeckChousuke: yes, are there any alternatives, for example, a shorter name or a reader macro?
06:09Chousukehoeck: well, you can (def p partial)
06:09Chousukebut there's no reader macro
06:09Chousukeand somehow I doubt there will be :/
06:10Chousukegood macro characters are a scarce resource :)
06:15hoeckChousuke: | is unused :)
06:15HunChousuke: not if your reader allows unicode :)
06:16Chousukeunicode characters are out by default. :P
06:18Chousukehoeck: and will probably be used for something more important than partial
06:26adityo,(doc comp)
06:26clojurebot"([f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."
06:42esjGuys, does there exists such a thing as a 'blocking rest' ? I have a seq that lives in atom and gets switched out from time to time as new data gets appended to it. I'm thinking about how to consume this seq, such that when the consumer gets to the end of the seq it doesn't just die, but blocks until something new is in the seq, rinse, repeat.
06:42esjany ideas ?
06:43Chousukerest won't block, because it's lazy and you won't actually execute the function until you call first on it
06:44Chousukebut if the function generating the lazy seq items blocks, then any attempts to advance the seq will block too
06:45ChousukeI think there's something in contrib that creates a seq based on a BlockingQueue or something. (...vague, huh :P)
06:45esjYeah, I've been reading through those
06:45esjits seque and fill-queue
06:46esjand something else too....
06:46Chousukethere's the hydra
06:46Chousukehmm
06:46ohpauleezdo you really want to block or do you want to poll/select?
06:46Chousuke~hydra
06:46clojurebotExcuse me?
06:46esjhydra - i'll have a look that
06:46esjI really don't want to poll
06:47Chousukeit was somewhere on pastebin/github
06:47ohpauleezahh ok
06:47esjI basically need to know, cheaply, when a seq has been extended
06:47Chousukehmm.
06:48esjI could use an observer type pattern so that the seq sends notifications, but wondered if there was a way to put the logic in the consumer, rather than the producer
06:49ohpauleezhttp://www.assembla.com/wiki/show/clojure/Protocols
06:49ohpauleezone possibility might be to add a protocol for it, extending it
06:49ohpauleezie: if you go to observer way
06:50cgrandesj, you can try a promised seq: (lazy-seq @p) where p is a promise, producer thread deliver p and calls to seq/next/rest will block
06:51ohpauleezcgrand: any docs on that?
06:53ohpauleezoh nvm, I just reread what you wrote, I get it
06:53esjesj has been scared to look at protocols --- massive brain stack overflow as it is :)
06:54ohpauleezhaha
06:55esjthanks for the input everybody.
06:56ohpauleezesj: np
07:14esjcgrand: oh having unpacked this promised seq idea, the question I have is what function do I use as the promise / future ? It needs to somehow know when the original seq has been extended, or am I being dull ?
07:15esjwhich is how I got to the idea of the 'blocking rest' function
07:25_ato,(doc fill-queue)
07:25clojurebot"clojure.contrib.seq-utils/fill-queue;[[filler-func & optseq]]; filler-func will be called in another thread with a single arg 'fill'. filler-func may call fill repeatedly with one arg each time which will be pushed onto a queue, blocking if needed until this is possible. fill-queue will return a lazy seq of the values filler-func has pushed onto the queue, blocking if needed until each next element becomes available. fil
07:31esj_ato: doh !
07:33licoresseoversaw someone speaking about many new special forms, where?
07:40rsynnottlicoresse: is it any good? (the mouse)
07:40licoressersynnott: so far I am realy happy with it, very flexible with what finger you use to scroll
07:40licoresseyou don't have to stay in the middle (where the ball previously were)
07:53the-kennyhm... I have to try the Magic Mouse in an Apple store.
08:45Licenserfor ideomatic naming every function that changes state, or has side effects should have a ! in the end? like cd! for moving into a new directory?
08:45cemerickthat's typical, yeah
08:46Licenserokay
08:46Licenserjust wanted to be sure since for FileSystem opperations it kind of looked odd to have all the ! theree
08:47cemerickwell, I don't do a lot of IO stuff, but ! is definitely associated with fns that destructively modify some data structure
08:47Licenserwell rm! does that kind of doesn't it? The Data structure is the FS not a clojure data structure, or am I seening this wrong?
08:47cemerickthinking about it, all of the database libs, etc., don't use !, so perhaps it can be safely skipped for libs that are always associated with IO operations.
08:48Licenser*nods*
08:48Licenserhmm file IO isn't thread save :/
08:48cemerickyeah, I'll backtrack and say that for things that are implicitly side-effecting, ! is probably unnecessary
08:49Licenserthat sounds usefull, it looked very odd after I added all the !
08:50Licenserhmm I think FS's are just not functional and I#ve to live with that
08:57weissjanybody here use vimclojure?
08:57ohpauleezI do
08:57weissjwas looking for a better colorscheme than default - couldn't figure out where to get the one shown here: http://kotka.de/projects/clojure/vimclojure.html
08:58chouserinkpot has been my favorite for quite a while
08:58weissjchouser: is that builtin?
08:58ohpauleezI use wombat
08:58chouserweissj: I don't think so
08:58ohpauleezinkpot: http://www.vim.org/scripts/script.php?script_id=1143
08:59ohpauleezwombat: http://dengmao.wordpress.com/2007/01/22/vim-color-scheme-wombat/
08:59ohpauleezin the comments is my 256 version
09:00weissjohpauleez: weird, i loaded inkpot and it's just plain green.
09:00weissjgreen is my terminal text color
09:00ohpauleezyou might need to set your term and vim to 256 color
09:00weissjohpauleez: gnome-terminal doesn't have 256?
09:01ohpauleezI've had issues with 256 and gnome-terminal, but other guys I work with have done it
09:01weissjohpauleez: any idea how/
09:02chouserI just use gvim.
09:02chousersorry that's not much help.
09:02ohpauleezhttp://ubuntuforums.org/showthread.php?t=1090344
09:02ohpauleezexport TERM="xterm-256color"
09:02ohpauleezin your bash or zsh rc
09:04weissjohpauleez: i think it got it, thanks!
09:04weissjsupposed to be a lot of purple and blue right
09:04ohpauleezweissj: awesome, glad to hear it!
09:06weissjohpauleez: so, what i find odd here is that "if" is purple, "defn" is green, "throw" is blue, "not" is red.
09:06ohpauleezwith wombat?
09:07weissjoh sorry, i'm using chouser's colorscheme. but i think all those are different colors in any scheme
09:07ohpauleezright, macro, special forms, functions, data types, comments
09:07ohpauleezetc
09:08chousernot is purple for me, like the other core fns
09:09chouserdunno why "for" is blue but "with-out-str" is green. honestly, I'd never thought about it.
09:09Licenserhmm is there a way to compile a clojure into a jar with all dependecies? like the clojure stuff, and additional lbiraries?
09:09weissjchouser: is defn green for you?
09:09chouserweissj: yeah. so is "ns"
09:10chouserLicenser: I think that lein-thing has an "uberjar" command to do just that.
09:10weissjso no one has any idea what colorscheme is used here: http://kotka.de/projects/clojure/vimclojure.html
09:11Licenserchouser: thanks I'll try to figure that out
09:11chouser~seen kotarak
09:11clojurebotkotarak was last seen quiting IRC, 983 minutes ago
09:11fogus_Licenser: http://ant.apache.org/manual/CoreTypes/zipfileset.html
09:11weissjchouser: oh ok didn't know he hung out here
09:13cemerickthat's funny, kotarak uses twitter via TwitVim
09:13chouserweissj: yeah, but I think he's on European time, so you'll have to wait a bit. :-)
09:13weissjchouser: isn't it the middle of the day in europe?
09:13Licenserfogus_: thanks
09:14weissjchouser or maybe you mean he hangs out here after work
09:14chouserweissj: hm. I guess you're right.
09:14liwpit's 2:13PM in the UK, so 3:13PM in Germany IIRC
09:15Licenserliwp: actually 15:14
09:15liwp:-P
09:15Licenserwe have twice as much houres here in germany then you in the us :P
09:15lisppaste8fogus pasted "zipfileset example" at http://paste.lisp.org/display/90663
09:15fogus_Licenser: Use like this ^^^^^^
09:15Licenserfogus_: thanks, you're my hero!
09:16fogus_Licenser: YW. BUT, using Leningen would be nice too. :)
09:17liwphas anyone tried / does anyone know if the repl in leiningen is slime/swank enabled?
09:18Licenserfogus_: not when you're trapped om M$ Windooze
09:19chouserleningen doesn't work on Windows?
09:20Licenserchouser: it has a bash file :P
09:20liwpshould be fine with cygwin or mingw though
09:20Licenserand I'm not in the mood right now to translate bash to bat :P
09:20chouserah, yeah, maybe it just needs a .bat
09:21liwpthe script uses curl / wget to pull stuff from github, so you need to have something similar available for windows
09:21chouserI haven't looked at it at all. Does it assume you have clojure or at least java already?
09:22liwpyeah, I think so
09:22chouserok
09:22liwpIIRC it just pulls the leiningen stuff from github and that's it]
09:23Licenserwell what I want to do is to create a .jar file that my more stupid colegues can execute without having to deal wit installing clojure or stuff
09:23liwpLicenser: are you using clojure at work?
09:24Licenserliwp: yes
09:24liwpLicenser: lucky you!
09:24Licenserbut not for a project just for supporting tools
09:24Licenserliwp: yap lucky me
09:24liwpLicenser: that's still better than no clojure
09:24weissjany vim clojure users recognize this error with omnicomplete: Error detected while processing function vimclojure#OmniCompletion..vimclojure#ExecuteNail..vimclojure#ExecuteNa
09:24weissjilWithInput:
09:24weissjline 19:
09:24weissjCouldn't execute Nail! [{"word" : "RuntimeException", "info" : "", "kind" : "c", "menu" : ""}]
09:24Licensermy boss as realized that letting me do my stuff is better then not letting me do my stuff :P
09:32esjsigh, making slime/swank work with the latest clojure is upsetting
09:33ambientmaking emacs a full clojure ide is upsetting, but perhaps that's just me
09:35esjmaking it work the first time was unenjoyable, but repeating the exercise...
09:35esjwell, it hasn't killed me, so i must be getting stronger
09:35chouserheh
09:36chouserunfortunately all you can no for sure is that it hasn't killed you *yet*
09:36ambientbut how would you know after you died that it killed you?
09:37Maddasesj: http://site.despair.com/images/dpage/adversity03.jpg
09:38ambientheh. my own version is "that which does not kill me, makes me weaker"
09:38chouserheh. replace "adversity" with "emacs" and *then* you'd have a poster.
09:38esjie: that which does not kill me, is due for upgrade in the next version ?
09:39ambientunless you kill it first
09:40ohpauleezweissj: are you just opening up vim or trying to open a fie
09:40ohpauleezalso, do you have nailgun running and is the client in your path?
09:40weissjohpauleez: it's working now, for some reason
09:40weissjnow i'm trying to figure out how to load the file i'm editing in a repl, and call one of the fn's
09:40weissjwhen i do \ef i get a read-only window listing the fn's
09:41ohpauleezOk, I've noticed that vimclojure will choke sometimes if you open a file with a ns form at the top
09:41weissjohpauleez: really? isn't that pretty much all of em
09:41ohpauleezweissj: (load-file "file-name")
09:41ohpauleezyes, it is, but after the error happens once it doesn't happen again for me
09:41weissjohpauleez: then what is \ef for
09:42weissj<LocalLeader>ef *ef* *EvalFile*
09:42weissj Send off the current file to the Clojure Server.
09:42ohpauleezohhh in vimclojure
09:42ohpauleezI thought you meant on any given REPL
09:42weissjohpauleez: yeah sorry :) that load thing is why i'm trying vimclojure
09:43weissjthat gets annoying
09:43ohpauleezI rarely use all the extra things, and only use it for text editing and quick evaling
09:43weissjhm ok
09:51Licenserhmm I found a pretty simple msolution, netbeans puts all libs in a lib folder which the jar uses automatically :D
10:00sh10151technomancy: found a little bug in swank-clojure-project the other night
10:02esjyeah, it came up on the googlegroup: http://www.mail-archive.com/clojure@googlegroups.com/msg20575.html
10:02esjhttp://www.mail-archive.com/clojure@googlegroups.com/msg20576.html rather
10:07sh10151think this is a different bug I found
10:07sh10151Mine's just the maven-specific portion should treat target/dependency like a directory full of jars, not an exploded directory of .class files
10:10esjok, sorry.
10:21patrkristhe way to get clojure 1.1 alpha is just by cloning the git repos?
10:21ohpauleezpatrkris: yes
10:21patrkristhanks
10:21ohpauleezclone it and build it, then put the jar in your classpath like normal
10:21ohpauleeznp
10:46michael_teterHello. I'm having great difficulty with basic configuration (I get FileNotFoundException when trying to use clojure.contrib)
10:47michael_teterI've built clojure-contrib.jar, and my clj.bat script is adding clojure.jar and clojure-contrib.jar to the classpath (-cp), but still I can't use clojure.contrib
10:47michael_teterIdeas?
10:50michael_tetermy script is listed at http://pastebin.com/d5bdff0ef
10:51michael_teterand C:\src\clojure contains clojure.jar, and C:\src\clojure-contrib contains clojure-contrib.jar
10:53AWizzArdmichael_teter: could you try to echo the variable which you append as the CP?
10:53AWizzArdSo you can see if it really points to the clojure.jar and the clojure-contrib.jar
10:54michael_teterok, willdo
10:54AWizzArdmaybe @echo on or something like that at top of the .bat file
10:54patrkrismichael_teter: what do you write in the REPL to try to use clojure-contrib?
10:55michael_teterIt appears I have a user path problem, so it was using an old clj.bat
10:55michael_teterI may be ok; let me test with the correct .bat :)
10:56michael_teterI'm sorry, this was a stupid user problem. my clj.bat is fine, and my contrib is loadable. I just had a windows path problem
10:56michael_teterbut to answer patrkris, I did (use 'clojure.contrib.sql)
10:57michael_teterit works now
10:57michael_teterThanks all
10:57sh10151looking at clojure.contrib.zip-filter.xml source, I don't see any negation examples
10:58sh10151has anyone done that? e.g. return nodes that don't match a predicate
10:58sh10151s/e.g./i.e.
10:59chousersh10151: I don't think I've done it, but each step in xml-> is a filter run against all nodes at the level, so it should be straightforward.
11:19Licenserhmm (reader) will block when the stream it reads from is empty, what is the best way to prevent this, or at least give a usefull return value like :reader_empty?
11:19stuartsierraLicenser: call .available on the stream
11:19stuartsierrahttp://java.sun.com/j2se/1.5.0/docs/api/java/io/InputStream.html
11:20Licenserah darn I looked at the output stream docs o.O
11:20stuartsierraor .ready on a Reader
11:21LicenserI called ready but (first (line-seq *reader-thingy*)) still blocks
11:21Licenserah darn I think I know why o.O because the line-seq does not find a \n on the last line *hrm*
11:24stuartsierrareader, line-seq, etc. are conveniences, if you need to handle streams directly, e.g. to avoid blocking, you may be better off working with the stream objects
11:25Licenser*whine* but it is javaisch :P
11:25stuartsierraClojure is Java. Therein lies its beauty and its tragedy.
11:26stuartsierraSpeaking of which, someone tried my clojure-hadoop library on large-ish data and kept getting "GC limit exceeded" errors
11:26LicenserClojure has the JVM but untill now it really shielded me from the ugly object mess in java
11:26cemerickstuartsierra: what's "large-ish"?
11:29sh10151chouser: looks as though it's as straightforward as (comp not (attr= :foo "bar")) at least in my case
11:29chousersh10151: great!
11:32stuartsierracemerick: 3 GB
11:33stuartsierraI think it's something to do with handling the Hadoop reducer operation with lazy sequences.
11:36cemerickholding head, etc., I presume
11:40stuartsierraI think so, yes. But it's interesting that it's not "Heap size exceeded," but "GC overhead exceeded," i.e., the JVM is spending too much time in GC.
11:41chouserstuartsierra: I tend to get those more or less interchangably
11:41chouserI think
11:41stuartsierraInteresting.
11:42tomojI've never seen "GC limit exceeded" before
11:42stuartsierraIs it true that simply (defn foo [a-sequence] ...) holds the head of a-sequence?
11:43cemerickit has to, yes
11:43tomojso how to the core sequence functions get around that?
11:43tomojhow _do_ I mean
11:44Licenserhmm why does the function has to hold head?
11:44cemerickfurther, I presume that rebinding a-sequence elsewhere doesn't impact that -- if that weren't the case, that would be helpful.
11:45tomojoh, I guess it only holds the head for the duration of the function call?
11:45stuartsierraLicenser: It doesn't HAVE to, but it does, because of the way Clojure and the JVM interact.
11:45Licenserwith [a-seq] do you meen the arg seq or is a-seq a argument passed to the seq?
11:45tomojso that if you return a lazy-seq, you're ok
11:45cemerickright, insofar as parameters to clojure fns are parameters to java methods, the same semantics apply
11:45stuartsierrayes, function locals last until the method returns
11:46rhickeystuartsierra: it won't hold it beyond the tail call of ...
11:46Licenserah okay that is what you mean
11:46Licenserif you don#t want to have it hold head you could call (afn (fn [] a-seq)) right?
11:47stuartsierrarhickey: That's what I thought. Unfortunately, the reducer function, as I've implemented it, has to return pairs.
11:47rhickeycemerick: and loop rebinding will overwrite and thus release
11:47stuartsierraIt looks like (defn my-reducer [key seq-of-values] [[key (reduce + seq-of-values)]])
11:47stuartsierrafor a simple wordcount example
11:48stuartsierraSo the (reduce + ...) isn't in tail position.
11:48cemerickrhickey: sure, but a loop binding doesn't impact a separate fn parameter binding w.r.t. the latter holding head, right?
11:48rhickeyyeah, the JVM doesn't see the stack reference to seq-of-vales as dead, and I only explicit null out (to help the JVM) on tail calls
11:49stuartsierraIs there a way I can work around that?
11:49rhickeycemerick: no, they are different bindings, even if the same name
11:49cemerickOK, glad I didn't misunderstand that.
11:50lpetitstuartsierra: out of my head (so maybe a big idiocy) : (defn my-reducer [key fn-producing-seq-of-values] [[key (reduce + (fn-producing-seq-of-values))]])
11:51stuartsierradoes that solve it?
11:54lpetitstuartsierra: or (not changing your user interface) : (defn my-reducer [key seq-or-fn] (if (ifn? seq-or-fn) [[key (reduce + (seq-or-fn))]] (recur key #(seq-or-fn))))
11:54lpetitugly, if not :)
11:54lpetitbut still I'm not 100% sure this solves your problem
11:54lpetitfeedback appreciated
11:56stuartsierralpetit: I'm not worried about changing the interface; my-reducer is a user-supplied function, not part of the library.
11:56lpetitstuartsierra: sorry, mistake in the #() (but you've got the idea)
11:56stuartsierraI'm going to try that, though
11:56lpetitstuartsierra: but beware the problem may still be hidden in the user code ?
11:57tomojis there a better way to get the project root than something like (nth (iterate #(.getParentFile %) (File. *file*)) 5) ?
11:59stuartsierratomoj: in general, Java prefers classpath-relative paths rather than filesystem lookup
12:01tomojyeah, but I wanted to get a file:///... to load some static html files with htmlunit
12:01tomojthinking I'll just start a servlet instead since I'll need to do cookies etc eventually
12:01stuartsierratomoj: you can add your static html directory to the classpath, then use one of the ClassLoader.getResource* methods
12:03tomojoh, that would be cool
12:03tomojthanks
12:03stuartsierranp
12:07Licensergrr, I don't seem to gasp the reader stuff, I came up with a own readln but it's ugly and mostly not working (always returning blank lines). If someone would take a look I'd be very glad, https://gist.github.com/edf803e0aa07ef2161eb
12:08stuartsierraLicenser: this would work better with a StringBuilder
12:08stuartsierraAlso Reader.read returns an int, not a char.
12:09Licenserahh nseaky I missed that :(
12:15lpetitstuartsierra: I must leave, would you please email me the result (if it works, or even if it doesn't work)?
12:15stuartsierrasure
12:15Licensernarf I fopund the problem
12:15Licenserthe function was called too fast, the stream hadn't had data yet
12:31radsin ruby you can do this: [0]*6 => [0,0,0,0,0,0]. what's the equivalent in clojure?
12:32tomoj,(repeat 6 0)
12:32clojurebot(0 0 0 0 0 0)
12:32radsthanks
12:48Licenserwell time to go home
12:59iceytechnomancy: congrats on launching leiningen - it looks awesome!
13:05technomancyicey: thanks! hope it works well for you.
13:11djorktechnomancy: what's leiningen?
13:11technomancydjork: a build tool designed not to set your hair on fire
13:11technomancyI should teach clojurebot!
13:11djorkoh cool
13:12djorkheh yes
13:12ohpauleezbuild tool, an awesome one
13:12technomancyclojurebot: leiningen is a build tool designed not to set your hair on fire (http://github.com/technomancy/leiningen)
13:12clojurebot'Sea, mhuise.
13:12technomancyof course, there's no guarantee that it won't set your hair on fire. that's just the goal.
13:12ohpauleezI haven't used it yet, but I'm pumped to
13:13ohpauleezWell I think any build tool that is expressive makes the job easier
13:13ohpauleezbut Clojure allows you to make a DSL
13:13ohpauleezfor building, which is ideal
13:17rahulkmr1Having trouble with vimclojure. It won't compile complaining about pprint not found. "Could not locate clojure/contrib/pprint__init.class or clojure/contrib/pprint.clj on classpath"
13:18michaeljaakahi
13:18rahulkmr1I compiled clojure-contrib again from source. and -Dclojure.jar=/path/to/clojure.jar
13:18michaeljaakaI want to learn how to assign new values to vars
13:18michaeljaakaI have read that somehting like this
13:18michaeljaaka,(do (def n 1)(set! n 2 )(println n))
13:18clojurebotDENIED
13:18ohpauleezYou need to put the contrib jar in your classpath too
13:18rahulkmr1but that still didn't solve the issue. Any ideas what am I doing wrong?
13:18michaeljaakais not valid
13:19rahulkmr1for compiling vimclojure? yes. I did that.
13:19michaeljaakaso what I should use to make it possible?
13:19djorkmichaeljaaka: try refs, not vars
13:19rahulkmr1when I compiled clojure-contrib with ant -Dclojure.jar, I still couldn't find the file vimclojure is complaining about
13:19rahulkmr1ppprint__init.class
13:19djorkmichaeljaaka: but first consider if you really need to change anything at all
13:20michaeljaakayes, I need it
13:20michaeljaakaI think that agents will be good
13:20rahulkmr1it wasn't there in the classes or clojure-contrib.jar. The error message also talks about pprint.clj. Is there a way I can place the .clj file somewhere and it takes it from there?
13:20michaeljaakabut first I want to learn anything about assigning values
13:21djorkmichaeljaaka: I just feel that if you're asking about how to re-assign to vars in Clojure you haven't had quite enough experience with the language to know if you really need to in the first place
13:21chouserchanging the root value of a var is hardly ever the right thing to do
13:21michaeljaakawell, I want to track available nodes in a cluster
13:22chousera ref!
13:22michaeljaakathey are chaning in time
13:22michaeljaakaso I need to store theirs availbility (addresses)
13:22djorka ref is perfect for that
13:22michaeljaakaand remove if timeout of hearbeat occures
13:22michaeljaakaok
13:23ohpauleezrahulkmr1: Are you building everything from clean, are following every instruction
13:24ohpauleezI've had vimclojure fail when I was building with an unclean build dir
13:24ohpauleezbut I just rebuilt everything about five days ago, and it's working ok for me
13:25rahulkmr1ohpauleez: ant clean should do the trick? anyways, let me try to untar and start again. But really, I don't see the pprint__init.class file in the contrib jar even when I did a "ant -Dclojure.jar=/path". I think even my clean compile will fail again.
13:26ohpauleezrahulkmr1: also, just for the sake of it: export CLASSPATH=$CLASSPATH:/path/to/clojure.jar:/path/to/contrib.jar:.
13:27rahulkmr1yes. I have that in my .bashrc. I have been running clojure for the past week. So no issues with cp. I was re-compiling contrib coz of vimclojure
13:27hiredman_rahulkmr1: where did you get contrib from?
13:27hiredman__!
13:28rahulkmr1hiredman: I didn't really pay attention. I got one copy of contrib with sample code for programming clojure. And I d/l the source a couple of mins ago from some git repo which came up in my google search. Do I know a specific one?
13:28hiredmansounds right
13:29hiredmanwhat does the output of ant look like?
13:29rahulkmr1BUILD FAILED
13:29rahulkmr1/home/rahulkmr/utils/vimclojure/vimclojure/build.xml:66: java.io.FileNotFoundException: Could not locate clojure/contrib/pprint__init.class or clojure/contrib/pprint.clj on classpath: (util.clj:23)
13:29hiredmanrahulkmr1: I meant for contrib
13:30rahulkmr1oops. sorry
13:30michaeljaakawhat is a difference between alter and commute?
13:30hiredman~commute
13:30clojurebotI don't understand.
13:30hiredman~alter
13:30clojurebotalter is always correct
13:30rahulkmr1hiredman: jar:
13:30rahulkmr1 [jar] Building jar: /home/rahulkmr/utils/richhickey-clojure-contrib-f165e28/clojure-contrib.jar
13:30rahulkmr1BUILD SUCCESSFUL
13:30michaeljaakaI can read that commute allow concurent changes within transaction
13:30hiredmanrahulkmr1: that is not the whole output
13:31hiredmanpastebin it somewhere
13:31rahulkmr1oh. ok. will do that
13:31michaeljaakaI mean others won't wait for transaction to finish
13:31hiredmanmichaeljaaka: use alter
13:31michaeljaakaok
13:31michaeljaakaalter is like pesimistic locking?
13:31michaeljaakaI alter lock
13:31hiredmanno
13:31michaeljaakamonitor or whatever
13:31michaeljaakachange value
13:31michaeljaakaand release lock?
13:31hiredmanno
13:32michaeljaakasynchonized(value) { value.add("somthing") }
13:32ohpauleezno
13:32michaeljaakathis is alter?
13:32hiredmanno
13:32michaeljaaka:)
13:32ohpauleezmichaeljaaka: http://groups.google.com/group/clojure/browse_thread/thread/0e575db4718c1f85
13:32danlarkinyes?
13:33ohpauleezalter does it during the transaction, commute waits for commit time
13:34hiredmanno
13:34ohpauleezno?
13:35hiredmanno
13:35hiredmanuse alter
13:37rahulkmr1hiredman: here is the dump: http://pastebin.mozilla.org/684620
13:37qedi have a grid 20x20 as a vector, how do I split it up into 2 sequences which are 20 rows and 20 columns
13:38michaeljaakawow, I manage to write first alternation in transaction! thanks man!
13:38hiredmanrahulkmr1: where did you get your clojure?
13:39rahulkmr1I think it's the one which came with the book. Lemme check
13:39hiredmanok
13:39ohpauleezqed: map vector, and partition?
13:39Bjering_Why does this throw IOException? (with-open [rdr (reader "http://clojure.org/&quot;)] (take 2 (line-seq rdr)))
13:39hiredmanyou will need the 1.0 compat branch of contrib
13:39hiredmanBjering_: line-seq and take are both lazy
13:40hiredmanso by the time you force them, with-open has closed the reader
13:40ohpauleez,(map vector [1 1 1 1][2 2 2 2])
13:40clojurebot([1 2] [1 2] [1 2] [1 2])
13:40Bjering_ah
13:40michaeljaakacheck this out and let me know if it is ok http://pastebin.com/d2a6d0ae0
13:40michaeljaakaor anything can be improved
13:41Bjering_Then the next q becomes, why is (with-open [rdr (reader "http://clojure.org/&quot;)] (doall (take 2 (line-seq rdr)))) empty?
13:42hiredman,(doc reader)
13:42clojurebot"clojure.contrib.duck-streams/reader;[[x]]; Attempts to coerce its argument into an open java.io.BufferedReader. Argument may be an instance of Reader, BufferedReader, InputStream, File, URI, URL, Socket, or String. If argument is a String, it tries to resolve it first as a URI, then as a local file name. URIs with a 'file' protocol are converted to local file names. Uses *default-encoding* as the text encoding. Should be
13:42qedohpauleez: oh right :) i didnt know about partition
13:42qedthanks
13:42ohpauleezqed: happy to help
13:44hiredmanBjering_: hard to say
13:44hiredmanI blame reader
13:47rahulkmr1hiredman: just to be sure, i just downloaded a new copy of clojure from clojure.org and compiled it. copied the jar files and set the classpath. I still am getting those pesky messages while compiling clojure-contrib if that's what you asked me where did I get clojure from
13:47rahulkmr1hiredman: Caused by: java.io.FileNotFoundException: Could not locate clojure/walk__init.class or clojure/walk.clj on classpath:
13:47rahulkmr1I got a new copy of clojure and these messages persist while compiling contrib
13:47hiredmanrahulkmr1: as I said, you need the 1.0 compat branch of contrib
13:48rahulkmr1oh. I thought I got the latest copy from github. Lemme check
13:48hiredmanyou did get the latest
13:48hiredmanbut you don't have the latest clojure
13:48hiredmanyou have the 1.0 release
13:48rahulkmr1so shall I do a repo copy then?
13:48rahulkmr1for clojure, I mean
13:49hiredmanyou can also just get the 1.0 compat branch of contrib
13:50rahulkmr1I would rather be on the bleeding edge:-). Will check if the repo copy works with this contrib or else would downgrade contrib
13:50jkkramerBjering: clojure.org redirects upon visiting. see `curl -i http://clojure.org`
13:51Bjering_jkkramer: aha.. yes wirks nicely with google.com
13:51Bjering_works
13:52Bjering_thanks hiredman & jkkramer
13:54michaeljaakaI need some advice can it be improved? http://pastebin.com/d3e81dde0
13:54michaeljaakaas you can see every time I create a map
13:54michaeljaakais there any way to replace values under key inplace ?
13:55michaeljaakathe keys are :alive and :reported
13:55michaeljaakamaybe I should use struct ?
13:58rahulkmr1So I got my vimclojure compiled. I had to "git clone" clojure to make it work with my copy of contrib. But the compilation completed fine. I have my vimclojure.jar now. Thanks
13:59ohpauleeznice to hear rahulkmr1, enjoy!
14:00stuartsierraCan we come up with a general notion of "lazy-safe" functions in Clojure?
14:01stuartsierraThat is, functions that take a sequence as an argument and will not run out of memory on very large sequences.
14:07chouserstuartsierra: how would you classify 'reduce'?
14:08chouser(reduce + c) is safe, (reduce conj {} c) is not
14:09hiredman(reduce + c) might not be either
14:09hiredmanfor a big C
14:09chouseroh?
14:09chouserIf it's ever safe to walk all of c, (reduce + c) is safe, isn't it?
14:10hiredmanthere is a limit to how large of a number that can be stored in the memory of a computer
14:10chouseroh
14:10chouser(reduce (constantly nil) c)
14:10hiredman:P
14:11hiredman(partial * 0)
14:11chouserbut of course if c is being held elsewhere, or if c itself has elements that are dangerous to compute, then still dangerous.
14:13hiredmanI think you end up with moscow rules with regards to laziness
14:14hiredmanhttp://en.wikipedia.org/wiki/The_Moscow_Rules
14:14chouseralready there
14:14chouser:-)
14:14stuartsierrahmph
14:15stuartsierraI was hoping we could codify some rules for what is "lazy-safe."
14:15hiredman"# Everyone is potentially under opposition control."
14:15stuartsierra"Technology will always let you down."
14:15chousereverything is lazy safe if seqs are never very large.
14:16hiredmanstuartsierra: that might just be the halting problem all over again
14:16hiredmanyou can't tell if it is lazy safe without computing it
14:16stuartsierrahiredman: Ok, not totally generally, then. But rules of thumb.
14:16tayssirHi! Can someone help with a weird headscratcher? I used to be able to MySQL db from Clojure/Emacs/Slime, but not today. It still works under both pure Java and commandline Clojure. And it's apparently not a classpath issue, since (Class/forName "com.mysql.jdbc.Driver") works... Voodoo suggestions welcome! ;)
14:17stuartsierraI don't want an algorithmic lazy-safe-check, I want guidelines to give to new users.
14:17rhickeystuartsierra: do you have an example of one that isn't?
14:17stuartsierraSure: (defn count-them [seq] [(count seq)])
14:18rhickeythat's your function, not Clojure's
14:18stuartsierraRight, so I want guidelines for writing functions that are lazy-safe.
14:18rhickeythe rules are simple, all seqs are live until the tail call of the function
14:19chouserstuartsierra: Guideline number 1: Vary your pattern and stay within your cover.
14:19stuartsierraok, so could one say that any function that calls a built-in sequence function in tail position is safe?
14:19rhickeystuartsierra: should be
14:21stuartsierraAnd, following lpetit's suggestion, a lazy seq wrapped in a function is also safe: (defn count-them [seq-fn] [(count (seq-fn))])
14:21ohpauleezchouser: haha
14:21ohpauleezre: vary your pattern...
14:21chouser:-)
14:22rhickeyyou can see the technique used in drop/drop-while also
14:22stuartsierraok, that's helpful
14:23stuartsierraCan I generalize that?
14:23chouserthe rules are as simple as when scheme will avoid stack consumption on a recursive call
14:23chousercan we have a 'recur' for lazy seqs?
14:23stuartsierraas in (defn count-them [a-seq] (let [f (fn [] s)] [(count (f))]) ?
14:23michaeljaakahi!
14:24michaeljaakaI have function
14:24stuartsierraI mean (defn count-them [a-seq] (let [f (fn [] a-seq)] [(count (f))]) ?
14:24michaeljaaka(fn [] let[ x 3 ] (when (true) (set! x 5)))
14:24michaeljaakahow to change local value in codition?
14:24chousermichaeljaaka: locals are immutable
14:25ohpauleezand are bound to that scope
14:25chousermichaeljaaka: you can get close to that with loop and recur
14:25stuartsierrano, that last example doesn't work
14:26rhickeystuartsierra: didn't think so
14:26michaeljaakahmmm, I will split func to two funcs and make an codition
14:27stuartsierraSo once you accept a sequence as an argument, you must use a lazy-seq function in tail position or you're hosed?
14:29rhickeylazy != ephemeral
14:32stuartsierrayeah, yeah. :)
14:32rhickeythat said, I understand it could be known that seq is not used after the call to count in: (defn count-them [seq] [(count seq)])
14:33rhickeyand the CLR knows that
14:33stuartsierraok
14:33stuartsierraIs there a way I can tell the JVM that?
14:33rhickeybut the JVM doesn't, and doing that manually would be a significant piece of work in the current compiler
14:33rhickeywhat I'm doing now (nulling locals on tail call) is a complete hack that shouldn't be needed
14:34chouserbut would be a cinch with datalog
14:34rhickeydoing liveness tracking a whole other thing
14:34stuartsierrarhickey: Got it. What I need is a workaround then. Wrapping the seq in a fn is one way, I guess.
14:34rhickeythere isn't always a workaround
14:34stuartsierrahrm, ok
14:35rhickeyone thing that might be possible, but extremely ugly and painful, would be some sort of (releasing seq) primitive
14:35rhickeyslectively applied could solve any case
14:36stuartsierraYeah, I wondered about that. (ephemeral! a-seq)
14:36rhickeyit's really (I'm-done-with seq)
14:36stuartsierra(dispose seq)
14:37rhickeyaargh
14:37stuartsierra:)
14:37rhickeybecause it doesn't really dispose, more like relinquish
14:38ohpauleez(release seq)
14:38rhickeyno point in a naming exercise since I'm unlikely to add this wart-like thing and have it be in people's code
14:39stuartsierraheh
14:39stuartsierrawish I could help with that
14:39ohpauleezhave you shopped it out yet, or asked around?
14:40cburroughsWhen would the 'wrap a seq in a fn' technique not work?
14:40ohpauleezI know the PyPy guys went on a speaking tour when their EU funding was running low
14:40rhickeyIt has to become important to enough companies that something like this: http://industry.haskell.org/index might fly
14:41ohpauleezI know for a fact of two companies in Philadelphia (one of them being Comcast) that are actively developing with clojure
14:42ohpauleezrhickey: If you want, I can roll through some of my contacts to see if I can get the groundwork for some sponsorship for you
14:42fogus_Is the Haskell industrial community that much larger?
14:43ohpauleezfogus_: I wouldn't think so
14:44fogus_Granted, Haskell has been around for 100 years
14:44chouserin "clojure years"
14:44ohpauleezhaha
14:45fogus_I dog year == ?? Clojure years
14:45fogus_1 that is
14:45jweissi got $20 i can donate :)
14:45rhickeyohpauleez: thanks, I'd like to wait until I have a model to propose
14:46ohpauleezrhickey: totally, let me know. I'm more than happy to help via community support or outreach
14:46michaeljaakahi can anyone tell what is wrong with that code? http://pastebin.com/d25bc28af
14:46michaeljaakaI get
14:46michaeljaaka#<CompilerException java.lang.IllegalArgumentException: if-let requires a vector for its binding (NO_SOURCE_FILE:457)>
14:46michaeljaakathat pseudo code (def n {123 #{"a" "b"}})(if-let [t (get n 123)] t nil) works fine
14:47michaeljaakaI think that I'm using it in the same way
14:48ohpauleez,(let [[a b c] [1 2 3] b (str b)] (list a b c))
14:48clojurebot(1 "2" 3)
14:48ohpauleezlook at your let form
14:49tomojis it just me or are you trying to call correct like correct(args...)
14:49sh10151tayssir: did you get your MySQL issue sorted out?
14:49michaeljaakadoh
14:50michaeljaakabad call for correct :)
14:50michaeljaakalol
14:50KjellskiGuess you´ve got exactly 5 min to show clojure in a REPL, what would you show?
14:50sh10151Kjellski: are you showing it to Java people, Lisp people, or scripting language people?
14:51Kjellskish10151 : Java...
14:52ohpauleezmichaeljaaka: did that fix it, the correct?
14:52michaeljaakayes
14:52tomojseqs and java interop?
14:52jweissany vimclojure users know how to control indenting? I'm surrounding a form with another fn call, i want it to indent the entire block more.
14:52michaeljaakathank you very much
14:52sh10151Kjellski: the Apache Commons isEmpty() example from "Programming Clojure" might be a good start
14:52Kjellskish10151 : And btw. The simple don´t fear the braces from stuarts book is in...
14:52sh10151sorry, isBlank
14:52Kjellskish10151 : ^^ you mean the indexOfAny?
14:53michaeljaakathis irc channel saves me a lot of time
14:53jkkramermanipulating parts of a running program is always fun to show off
14:53sh10151no, StringUtils.isBlank from page 2
14:53Kjellskijkkramer : like the almost "magically" Frame setSite?
14:53stuartsierra_show a simple "map" example, then ask "how would you parallelize this across multiple cores," then add one letter to get "pmap"
14:55sh10151are you showing it in a REPL or do you you use slime? when I did a presentation to Java people they seemed impressed with emacs + paredit + slime :-P
14:55Kjellskistuartsierra : Thats neat, ... definitively in...
14:55sh10151not really something to point out specifically
14:55jkkramerKjellski: could create/run a simple game, like tic-tac-toe. and manipulate rules or appearance during the game
14:55jkkrameri might be doing that for a presentation, using the game go
14:56Kjellskijkkramer : I would love to discribe what I´m doing while typing, and I guess it would be hard to tell them from scratch everything for a tic tac toe...
14:56jkkrameryeah, probably too complex to explain quickly
14:57stuartsierra_rhickey used to do demos showing that a Swing GUI app is shorter in Clojure than in Java
14:57sh10151Maybe you can concoct an example for (binding ...) ... every time I use it I think, "why the heck do people think they need a framework for this?"
14:57Kjellskistuartsierra_: damn, that is a really nice thing to ask... =)
14:57tomojI think it could be good to show them how easily they can use the java stuff they've already got
14:57tomojbut 5min isn't a long time :(
14:58sh10151since I'm pretty sure everything you can do with Spring container injection you can do with binding
14:59Kjellskitomoj: That´s true! Really not enough ... but I need to fix my time before breaking my own rules... ^^
15:00Kjellskish10151 : I´m not sure that everyone of them used these in lab... so I think one Java-interop thing is missing... maybe a small frame with setSize as you mentioned before?
15:01sh10151seems straightforward to me but I think it was stuartsierra_ mentioning Swing :)
15:02Kjellskioh, sorry... but that gave me some nice hints, thank all.
15:03tomojI'm wondering if I can convince my employers to let me use clojure since they have java stuff in place. probably unlikely since I'm the only one who knows clojure and I'm not gonna be there for a long time :(
15:03lisppaste8Chouser pasted "failed attempt to make assertions about head-holding" at http://paste.lisp.org/display/90685
15:04chouserhttp://www.ecentralmetrics.com/onlinedisplay/jobdisplay.cfm?posting=73790&amp;bid=326 -- comcast job listing with clojure
15:04sh10151tomoj: I've been able to use it pretty well as a prototyping/scripting/"one-time shot" language
15:05chouserrhickey: well this is meant as a diagnostic tool, not for deployed code.
15:05rhickeyjust kidding
15:05chouserbut I appear to be doing it wrong anyhow
15:06djorkchouser: wow, clojure in a job listing... that's a first for me
15:06chousertomoj: I've gotten away with using Clojure so far because they're under the vague impression it'll be rewritten in C++ once the performance starts to be an issue.
15:06stuartsierra_djork: there have been a few now; follow #clojure on Twitter
15:06djorkneat
15:07djorkheh http://craiglook.com/all.html?q=clojure
15:07djork0 results
15:07stuartsierra_cool jobs aren't on Craigslist :)
15:07djorkprobably not
15:08tomojchouser: haha
15:09stuartsierra_chouser: I did the pmap trick for a C++ guy and he said, "ooh, that's hot"
15:09chouserheh
15:10tomojthis job looks awesome http://is.gd/4YecE
15:10djorkI can't convince my C# friend that Clojure is even worth a glance
15:11ohpauleezthen he isn't your friend anymore
15:11djorkhah. he always says "I can do that with LINQ!"
15:11djorkbut then I say "but can you add new syntax? from a REPL?"
15:11ohpauleezYes Comcast uses clojure, as does Algorithmics
15:12chousercgrand: is pipe the same as fill-queue only *so* much cleaner?
15:12tomojC#==blub?
15:13djorkC# is a much better blub than most though
15:13Chousuke_chouser: when in fact, once performance becomes an issue, you'll just add type hints? :P
15:14iceydjork, I'm a c# guy; the key is to have him read up on macros
15:14djorkyeah, I might even call myself a C# guy too :)
15:15tomojhard to see why macros are useful if you've never used them before
15:15djorkyeah
15:15iceyi'm trying to remember when / how I saw the light
15:16djorkfunctional + REPL + macros + namespaces + multimethods + lazy seqs are the power features to me
15:16iceyoh, multimethods might be another good angle of attack
15:17iceyit will be tough to woo him away when F# lands / is supported officially
15:18chouserChousuke_: :-)
15:19djorkok... is "chousuke" "chouser's uke" or what?
15:19Chousuke_no :P
15:19Bjering_You know, you all probably know this, but what a newcomber really want to hear is how something great can be done with Clojure that is just too hard/expensive todo with another tool. Like how hearing that CCP used stackless-Python for EVE Online put many performance-huggers at rest.
15:19Bjering_...as it is _the_ largest single-shard-mmo server.
15:20djorkclojure would need some beefy hardware for a mmo server (because of thread overhead)
15:20djorkassuming you used something like an agent per player
15:20hiredmanerm
15:20hiredmanagents are not tied to threads
15:21djorkpools
15:21Bjering_Well, ofc it doesnät have to be that. That was a kiler app for a light-weight-thread system like stackless-Python
15:21djorkright?
15:23hiredmanapparently paypal is too hard for me
15:23djorksome days anything is too hard
15:24hiredmanI think I haven't used my paypal account in a few years, and maybe they changed something out from under me
15:24djorktoday it's this offshore team's tangle of globals and inane constructs in some iPhone code
15:38ambienticey clojure on clr would be sweet
15:38ambient...i mean as functional as it is on jvm
15:41ordnungswidrighi
15:42ohpauleezhello
15:46KirinDaveambient: That way we could have a slower, worse performing clojure on a runtime that is less open and less populated and run by a capricious company with competing products. Sounds good to me. ;)
15:46KirinDaveambient: And I say that from the perspective of a Microsoft employee. Even internally we get frustrated at the strange ways of the C#+CLR development timeline.
15:48djorkhah wow
15:48Bjering_Ok, I am at page 141 in "programming clojure" and reading about the relational-algebra. I take it there are no lazy sets?
15:48djorkyeah, I think the JDK is more well-defined than the CLR at this point, is that correct KirinDave
15:49KirinDavedjork: I can't ascertain a technical definition from "well-defined".
15:49KirinDavedjork: The main advantage of the CLR, in my estimation, is that you can write a search engine with C# but it's harder to do with Java. :D
15:50djorkwell-defined meaning how much effort it would take to implement a new and correct VM
15:50djorknot effort
15:50djorkbut hassle
15:50ChousukeBjering_: I'm not sure how you would implement a lazy set.
15:50djorkin terms of getting it to be compatible
15:51KirinDaveWasn't the old clojure a compiler to java and C#?
15:52stuartsierra_KirinDave: yes, it was never released
15:58hiredmanChousuke: rule sets!
15:58mrSpecHello
15:58Bjering_Chousuke: in a way any predicate is a lazy set I guess... but perhaps there is little value to be able to use the join syntax on those as there are other functions that does that.
15:58hiredman^-
15:59KirinDave2Does anyone here use emacs with swank-clojure?
16:00jasappare there many people who don't?
16:00KirinDave2I'm having trouble getting swank-clojure-project to work.
16:01KirinDave2I try to root to my project root and it waits forever.
16:01KirinDave2I suspect from looking at what process is started that it's not adding the swank-clojure-1.0.jar
16:01KirinDave2Obviously I can put that in lib
16:01KirinDave2but it seems like this must be a bug.
16:01KirinDave2Any advice?
16:02jkkramerKirinDave2: is it printing a newline after you press RET when giving the project root path?
16:03technomancyKirinDave2: it's a change in behaviour; if you use swank-clojure you should treat it like a dependency, even if it's only a dev-time dependency.
16:03KirinDave2technomancy: So I should link it into lib?
16:03technomancyprevious versions would automatically add it to the classpath, but they assumed that you had a git checkout of the swank-clojure project, which you can no longer assume
16:04technomancyyeah
16:05KirinDave2Well that fixed it. :)
16:05ohpauleezdoes anyone know if -?> is getting moved into core?
16:05KirinDave2technomancy: If you want to teach me I'll write up an epic dev howto.
16:05KirinDave2technomancy: I've gotta break into the community somehow, in any case. ;)
16:05shonenah it is time for me to start on my road with clojure so that opauleez and i can battle to the tic tac toe death
16:06KirinDave2I've got a SimpleDateFormat that I want to use ONE of to parse dates in my library
16:07KirinDave2Is it better style to use a def, or better style to (let [formatter (…)] (defn …))
16:09KjellskiIs every datastructure in clojure build from the bit mapped hash trees? In order to get the nice branching factor?
16:09hiredmanlists are just linked lists, I believe
16:09rhickeyKjellski: other than seqs, trees with high branching factors
16:10rhickeymaps/sets are tries, vectors just trees
16:10hiredmandidn't someone reimplement maps using something else?
16:10chousersorted-maps are red black trees, right?
16:10rhickeyright and sorteds are RB
16:11technomancyKirinDave2: I see def used more often than defn inside a let. you might also like defonce.
16:11KjellskiThanks!
16:12KjellskiIf I "alter" one thing in a list, this would cost linear time? Or how is the old version kept?
16:13chouserooh, you don't know? get ready to experience magic...
16:13ohpauleezhaha
16:14Kjellskichouser : C´mon, I am ready.
16:15ohpauleezKjellski: this was in the IRC yesterday, I'm looking through the logs to find it for you
16:15chouserit's "essentially constant" time to change one item. log32
16:15Kjellskiohpauleez : Thanks a lot...
16:15chouserno locks, no mutation
16:15hiredmanchouser: he asked about lists
16:16chouseroh
16:16chouseroh
16:16chouser:-(
16:16Kjellskichouser : =P
16:16ohpauleezyeah, if you're doing random access or lookup, you should use vectors
16:16KirinDave2Yeah, use vectors.
16:16ohpauleezunless you have to use a list
16:16chouseryou can't alter lists except as you would a normal linked list.
16:16KirinDave2But evidently (count list) is O(1)
16:17KirinDave2As is (count my-vec)
16:17KirinDave2So there is that at least. :)
16:17chouseryeah, an immutable linked list that knows its size.
16:17chouser:-)
16:17chouseradding/removing from the head is constant time. which is neat, of corse, but hardly magical.
16:18ohpauleezKjellski: check out: http://java.ociweb.com/mark/clojure/article.html#Collections
16:21Kjellskiohpauleez: Thanks...
16:21ohpauleezKjellski: np, totally welcome
16:29kzarSo I've been watching some Clojure videos and I'm pretty convinced but I had one question before I spend too much time learning it. I would want to run web apps on a VM with 256meg of ram, is that possible? (I found Hunchentoot used around 50megs with SBCL and Python used maybe 10megs with web.py, I was wondering what to expect with Clojure)
16:30ohpauleezI don't know footprints, but you there is a lightweight web.py like project
16:31ohpauleezas well as more complete web framework project, like pylons or rails
16:31kzarohpauleez: What's the lightweight one called?
16:32KjellskiIs there any other difference than spelling between "trees" and "tries"?
16:33ohpauleezThere is Compojure (which looks awesome, but I haven't built anything with it) and webjure
16:34kzarohpauleez: OK thanks
16:34ohpauleezkzar: I have one more link for you...
16:34ohpauleezhere is a blog, written in compojure: http://github.com/briancarper/cow-blog/tree/master/blog/
16:36KjellskiIs there any other difference than spelling between "trees" and "tries"?
16:37ohpauleeza trie is a prefix tree
16:37ohpauleezhttp://en.wikipedia.org/wiki/Trie
16:39shonenyessir a trie be prefix
16:41arjhi
16:41arjhow exactly does one import a static class into clojure?
16:42arja normal import seems to fail with class not found?
16:44hiredmanwell, then you must be doing it wrong
16:44hiredmanso unless you show use what you are doing, it will be difficult to tell you what exactly you are doing wrong
16:44arjI'm trying to import JNotify
16:44arjthat class is static
16:45arohnerarj: is the class on your classpath?
16:45arj(import net.contentobjects.jnotify JNotify)
16:45arjfails
16:45arjbut
16:45arj(import net.contentobjects.jnotify JNotifyListener)
16:45arjworks fine
16:45hiredman(import '(net.contentobjects.jnotify JNotify))
16:45arjah yeah sorry, that is what I was doing
16:45arjtried import-static from clojure-contrib, hence th change
16:46arjCould not initialize class net.contentobjects.jnotify.JNotify [Thrown class java.lang.NoClassDefFoundError]
16:46arjthe class contains only static stuff
16:47hiredmando you have the java docs for JNotify?
16:47arjno but I have the source
16:48hiredman:(
16:48arjhttp://jnotify.sourceforge.net/
16:48arjthere is some java examples
16:48arj*are
16:49hiredmanit's possible the native part of jnotify is missing
16:49chouserarj: do you need the windows support?
16:49arjnot really
16:49arjbut I'd like to use Jnotify and not the Linux one, since I would like the dir recursion stuff
16:49chouseroh, ok.
16:50arjI did a add-classpath with the dir I have the .so file in
16:50arjmaybe I need to do something else hiredman ?
16:50hiredman
16:50chouserclasspath doesn't help find .so files
16:50hiredman~add-classpath
16:50clojurebotadd-classpath is bad, avoid it. I mean it!
16:50kzarIs there a good page to read for people just starting with Clojure but with Lisp 'n Python experience? I want to give it a shot
16:50arjhmm
16:51technomancy~peepcode
16:51clojurebotpeepcode is a commercial screencast series; see the Clojure one at http://peepcode.com/products/functional-programming-with-clojure by technomancy
16:51KirinDave2I liked the peepcode.
16:51KirinDave2The project was cool
16:51arjhow do I make my repl find the .so file?
16:51KirinDave2technomancy: Although how you'd implement taking between users seemed tough to me. :)
16:51hiredman~blip.tv
16:51clojurebotblip.tv is http://clojure.blip.tv/
16:52technomancyKirinDave2: I had that in a branch of mire, but I didn't have time to work it into the video.
16:52KirinDave2technomancy: Did you have to make an agent per user?
16:53technomancyno, I stored a map of usernames to outputstreams rather than just a set of users
16:53technomancyit didn't work smoothly with the prompt though.
16:53KirinDave2Yeah
17:07arjgagh system/load also doesn't seem to work
17:12jasappis anyone familiar with discrete event simulation?
17:14jasappI need to do some simulation, preferably with clojure, and I'm a bit unsure of the proper clojure approach
17:24twbrayAm closing in on my (presumed, for the moment) memory leak... calling NIO to map regions of a file and stringify them. Never did like NIO much.
17:26hiredmanhuh
17:34ohpauleezjasapp: I have made a DES before
17:34ohpauleezin a lot of languages
17:34ohpauleezwhat's up?
17:34jasappinteresting
17:35jasappwhat do you think the best approach in clojure would be?
17:35jasappI'm having a hard time not thinking of explicit locking
17:36ohpauleezif it's single threaded, no need to lock. You can use a vector of vectors to represent a tree of events
17:36jasappI was thinking of using multiple threads, but I don't know why
17:37ohpauleezthen you push new events onto the tree and reorder it, and see if there is something to do
17:37ohpauleezthat's typically how I do these things
17:37jasappand a single threaded model doesn't suffer from any performance issues?
17:38ohpauleezis this for a college homework assignment or something mission critical
17:38jasappheh
17:38jasappwell, no one will die if it breaks, but it's work related
17:40jasappperformance would be nice since I was considering using a genetic algorithm to find good parameters
17:40ohpauleezSure, if you're just looking to use clojure a tree made up of a vector of vectors should do it
17:41ohpauleezand if you do things in a nice functional way, you should have no trouble
17:41jasappexcellent, thanks for the help
17:42ohpauleeztotally, I'm trying to dig you up an example before I put up my own
17:42jasappcool, ok
17:42jasappthe single threaded approach doesn't sound bad at all
17:42shonenyour brain will thank you as well :-P
17:43ohpauleeznope, it's real easy, especially when you use a functional approach, it'll be a breeze
17:43shonenhow many times have we all gone, "why is this variable changing!?! i hate you threading!!"
17:45hiredmanshonen: er
17:45hiredmanvariable?
17:46hiredmansurely you have mistaken #clojure for #imperative
17:46shonenhaha oh yes yes quite i apologize
17:46ohpauleezjasapp: specifically you want to use a heap: http://bit.ly/37wiF7
17:46ohpauleezthe first result has a PDF
17:47ohpauleezthat walks through it
17:47jasappthanks, I'll check it out
17:47KirinDaveHeap sorting by event timestamp?
17:48ohpauleezmore or less
17:48kzarDumb question, I'm following that peepcode video and I was curious how to stop the server from the repl?
17:50defn'lo
17:51ohpauleezjasapp: one really dirty and quick way would be to use a sorted map where the keys were timestamps, and the values were the events
17:52ohpauleezok, that's all I got, but the way to do it is with a heap. :)
17:54jasappyeah, I was thinking I might just hack out a quick one with a sorted map
18:10KirinDaveSo I have like 0 expereince with clojure and I started writing a quick twitter library
18:10KirinDaveFor a project I'd like to do
18:11ohpauleezawesome, how's it going?
18:11KirinDavehttps://gist.github.com/e696d410b168ba507046
18:11KirinDaveI feel like I am doing something wrong with prep-timeline-entry
18:11KirinDaveAnd yes, i am aware that map is lazy, it's fine.
18:12twbrayUm.... is "str" lazy? I kinda suspect it might be based on observed behavior.
18:12KirinDavetwbray: There is an easy way to find out. :)
18:13twbrayKirinDave: What would that be?
18:14KirinDavetwbray: Write a (str) that has side effects
18:14KirinDaveAnd capture that in a variable.
18:14twbrayKirinDave: What a perfectly horrible perverted thing to think about.
18:14twbrayThanks, I'll try that.
18:14ohpauleezhaha
18:14KirinDave(cliffnotes version: str is eager)
18:15hiredmanstr is definitely not lazy
18:15KirinDaveohpauleez: Is there anything I am doing obviously wrong?
18:15twbraybecause I'm keying a an array with (str foo bar) where bar is produced by (. substring ... ) out of a 50M Java string and it sorta looks like the string isn't being garbage collected
18:15twbrayer a map I mean
18:16ohpauleezKirinDave: I think I might have spotted it, but I'm going to hit the REPL to try some things out
18:16twbrayAnyhow, back to the coal-face... I'm closing in on the culprit one way or another
18:16hiredmantwbray: string literals in clojure are .intern'ed, I believe
18:16KirinDaveWoah
18:16twbrayhiredman: Yes, they are. None of these are literals.
18:18hiredmantwbray: have you seen http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=99227e05664f737f96932f3ec3c0?bug_id=4513622
18:19KirinDaveHuh
18:19KirinDaveThat there is a nasty bug.
18:19twbrayhiredman: Yeah, I knew that, but I'm taking the substring and making a bigger string with (str ... ); now if str were lazy, I'd have an explanation. But anyhow, I'll know what's going on by end-of-day
18:20ohpauleezKirinDave: I'm new to Clojure, this is new to me: [{user :user, created-at :created_at :as entry}]
18:20ohpauleezif that is indeed a hash map
18:20KirinDaveohpauleez: That's a destructing bind on a map.
18:20ohpauleezshouldn't it be :key value, etc
18:21ohpauleezgiven the :as in the arg list I figured it was destructuring, but that's the correct form?
18:21KirinDaveohpauleez: Clojure doesn't seem to feel that way: http://idisk.me.com/dfayram/Public/Pictures/Skitch/Terminal_%E2%80%94_java_%E2%80%94_Homebrew_%E2%80%94_ttys002_%E2%80%94_80%C3%9724-20091118-152059.png
18:22KirinDavedysinger: Fancy meeting you here.
18:22dysingerI'm usually always here :)
18:22ohpauleezah, awesome
18:22dysingerblending the erlang and clojure into a good golash !
18:22ohpauleezhmm, let me look some more
18:22KirinDavedysinger: My next project is a better jinterface binding for clojure.
18:23dysingersweet KirinDave we should team up - I did that over the weekend !
18:23the-kennyIs there a way to do a (binding) with dynamic scopt which gets inherited to threads started by inside this binding?
18:23dysingerKirinDave: not to say I have anything finished but played with it.
18:23KirinDavedysinger: Is it on github?
18:23dysingerno not yet
18:24hiredmanthe-kenny: there is a new construct, bound-fn, which will capture dynamic bindings
18:24KirinDavedysinger: It seems like a multi-method could make it very easy to auto-convert clojure primitives to the Erlang primitives.
18:24dysingerKirinDave there is some public domain clojure code on the clojure list @ goog groups
18:24the-kennyhiredman: Is this in the "new" branch?
18:24dysingerKirinDave: exactly
18:24ohpauleezKirinDave: what is happening when you run it. That looks fine to me
18:24KirinDavedysinger: And a language with vectors, lists, maps, and symbols makes it way easier.
18:24KirinDaveohpauleez: Oh it's not broken
18:24the-kennyhiredman: And... is it stable enough?
18:24dysingerthat's what the google groups code looks like KirinDave
18:24hiredmantehseel no idea
18:24hiredmaner
18:25hiredmanthe-kenny: no idea
18:25ohpauleezohh, that looks fine to me
18:25KirinDaveohpauleez: I was hoping for style tips, particularly with the prep-timeline-entry
18:25hiredmanI've never bothered with it, since I understand the difference between dynamic and lexical scope, and avoid dynamic scope
18:26the-kennyhm... it's in "fbacc4a"
18:26KirinDavehiredman: It makes sense for things like io streams. It was just overused in the past. :)
18:26dysingerKirinDave: http://clojure.googlegroups.com/web/erlang+(2).clj?gda=nPnuyEQAAAB9TgGpbzbMg0BCq3i8IqXnF8SIL0JIfoYuHsuFZ6eabNDNU7UYDrd2uE4tSk0x5Y5V6u9SiETdg0Q2ffAyHU-dzc4BZkLnSFWX59nr5BxGqA
18:26KirinDavehiredman: Fear it not
18:26hiredmanKirinDave: I don't fear it
18:26hiredmanI just have no need of it
18:26hiredmanand it annoys me that everone *must* write their database api to use it
18:27KirinDaveSo for something like clojure.contrib.json.read, what do you recommend is a better solution?
18:28the-kennyhiredman: That's exactly my problem :) I have a setup with some thread pools and one or two agents... and I'm using clojure-couchdb, which uses a binding named *server*.
18:28hiredmangrrr
18:28the-kennyI hacked a macro together, but it really bloats the code..
18:28hiredmanthe-kenny: wrap the api with functions that take a server argument
18:29hiredmanor write an email to the author complaining
18:29KirinDaveWell what's the correct solution?
18:29dysingerKirinDave: the thing I am working on is clojure + interface (client) | erlang + ports + clojure + jinterface (server)
18:29dysingers/interface/jinterface
18:29dysinger(on the side for fun)
18:29KirinDavedysinger: You know exactly why I'd like to get java talking over a local erlang port. ;)
18:29dysinger:)
18:30KirinDaveI can't show you the code yet, but the next big katamari thing is nodes that can handle multiple connections at once.
18:30dysingersweet
18:30KirinDaveAnd removing the insistence on port-based nodes.
18:30dysingercool
18:30KirinDaveWell, that'll make katamari able to work very well with hadoop.
18:31KirinDaveWhich I think will be a big part of the future of katamari...
18:31the-kennyhiredman: hm.. sounds a bit annoying. There is also a problem with the http-library clojure-couchdb uses.. I have to send an authentication-header to properly identify to the database server, and clojure-couchdb provides no api to access the underlying http-calls... I hacked together a solution to modify the standard-headers field of the http-client :D
18:31hiredmanhttp://github.com/hiredman/clojurebot/blob/master/hiredman/triples.clj <-- all the functions take a db parameter
18:31dysingerI like the idea - better than hadoop's IO based mappers
18:32jasapphiredman: did you ever use clsql for common lisp?
18:32KirinDavehiredman: Man that is one HELL of a defmethod criterion.
18:33hiredmanjasapp: nope
18:34hiredmanthe-kenny: http://stackoverflow.com/questions/480153/how-to-modify-the-header-of-a-httpurlconnection
18:34hiredmanKirinDave: :)
18:34hiredmanI'm sure I could have just written out a table and reduced it to a few cases
18:34hiredmanbut I just can't be bothered
18:35the-kennyhiredman: I know how to do this, but I don't have any access to the instance of HttpUrlConnection clojure-couchdb uses :(
18:35hiredman:|
18:36hiredmansounds like you need to reach out to the author
18:36hiredmandanlarkin?
18:36the-kennyYes
18:36the-kennyHe said some time ago that he's really busy
18:37the-kennyBut I have a fork of it in my local repository.
18:38the-kennyI think I'll just merge the http-url to the server with the db-parameter...
18:38the-kennyThe first time I tried to use the library, I tried exactly that because there was no documentation
18:38dysingerI have rubbed the genie lamp
18:39dysingerdanlarkin will be here in a sec :)
18:39the-kennyWow, where did you get that lamp? :)
18:39hiredmanalmost like /summon still worked
18:40dysinger(we work together)
18:40danlarkinthe-kenny: yeah I saw you have patches for me
18:41danlarkinI just haven't gotten around to reviewing or applying them :(
18:42the-kennydanlarkin: No problem :) I didn't want to rush you
18:44danlarkinthe-kenny: maybe I'll give you commit access to my repo and "solve" the problem that way :)
18:44danlarkinI'm not dealing with couchdb too much at the moment
18:45the-kennydanlarkin: Oh, I'm happy with my fork. I don't want to mess things up in your repository
18:53the-kennyAh, I think I've found a clean way to deal with the authentication problem
18:57qedevery time i think i understand loop/recur i just sit there and scratch my head -- im trying to take a vector [1 2 3 4 5], and conj the product of [1 2 3], [2 3 4], [3 4 5] onto a vector
18:58qederrr (* 1 2 3), (* 2 3 4), etc.
18:59the-kennyAwesome :) java.net.Authenticator is just perfect
19:01jweissanyone here use vimclojure? i'm trying to figure out why when i run this in its repl, (do (println "hi") (Thread/sleep 2000) (println "there")) - that nothing is printed until after the sleep, then it prints everything.
19:01qedjweiss: let me apologize in advance for saying this, but: learn emacs
19:02qedrepls in vim == ugly hacks
19:03jweissqed: i'm not going to learn emacs just to use clojure
19:03defmacrojweiss: amen
19:04the-kennyjweiss: But emacs is the nonplusultra for lisp-editing
19:04the-kennyI learned it just for CommonLisp and I'll never go back
19:04qedi learned emacs to use clojure
19:05qedit took about 1 week of pain, but now id never go back
19:05qed</editor wars>
19:05jweissmeh
19:05the-kennyqed: I felt no pain. I had a feeling of freedom after one or two years with vim
19:06qedi use vim still for really quick and dirty stuff if i dont have an emacs open already
19:06defmacroemacs is all pain to me, <8 vim, but that's just me
19:06fanaticothere is always viper-mode.
19:06qeddefmacro: the big thing for me was getting emacs configured to fit my tastes
19:06qedif you dont like emacs, you can change every damn thing you dont like
19:07fanaticoemulates the vi key bindings in emacs.
19:07qedevaluating elisp inside your buffer is pretty sweet
19:07defmacroqed: very very true, and I never got it configured to suit me. but i really love the modal editing theme in vim, the emacs commands didn't make sense to me
19:08qeddefmacro: yeah they're really weird at first, but its been about a month since i started with emacs, and im flying around now
19:08qedit's a little pain, big gain, IMO
19:08defmacroqed: emacs also have me more hand pain than vim, which is a serious thing fo rme
19:08the-kennyEmacs isn't complicated.. it's much easier to understand the first time than vim, in my opinion
19:08qedand this brings us to our next discussion: keybindings and keyboard choice
19:09defmacroqed: kinesis contour, with customized mappings for keys to load balance across my hands and good fingers left
19:09qedmap ctrl to caps lock
19:09qeddefmacro: booya, nice
19:09qedi love the kinesis advantage pro
19:09qedbut ive been using my happy hacking keyboard almost exclusively at work
19:10qednot as good for my hands, but very functional still
19:10defmacroyeah, i got three of the kinesis, for every workstation. i cannot type on anything else, making my macbook useless
19:10qedthe keyswitches on the HHK make it friggen butter
19:10qedTopre capacitive switches
19:12jweissi suppose it's not wasted
19:12jweissnone of the systems i use at work have emacs by default
19:12jweissbut they all have vi/vim
19:13the-kennyjweiss: It's possible to use vim *and* emacs.
19:13defmacroworking on using vim's ruby support to extend the editor, heh
19:13jweissthe-kenny: yeah, but having to learn more than one arcane editor kinda sucks. why can't one of them be enough
19:15defmacrojweiss: do you want/need to use slime? cause vim doesn't have anything close to that awesomeness, that's why one can't be enough
19:15qed^^
19:15the-kennyYes, slime and org-mode are the most awesome pieces of software for emacs.
19:16jweissdefmacro: what specifically about vim makes it worse? just that no one wrote something like slime for it?
19:16defncan you hang out in #clojure while you're coding clojure in another buffer and using slime/swank-clojure repl in another buffer inside your editor?
19:16jweissseems like of arbitrary
19:16defnjweiss: no it's the base construction of emacs
19:17defnthats why you can code something like slime for it
19:17defnvim "REPL"s are hacks
19:17defmacrojweiss: have someone show you slime in person, it blew me away. not enough to make me switch to emacs, tho ;p
19:17jweisswell, back in college i hated emacs, but then again, back then i found java confusing.
19:17jweissso maybe it's worth another look
19:17the-kennyvim can't execute other processes on a clean way.. I think that's the biggest problem
19:18defmacroalso, vimscript is not compariable to elisp for extending the editor
19:19defnjweiss: i know im evangelizing a bit here, BUT-- I tried to learn emacs like 4 times, always losing my will power and heading back to vim. This last time I said enough is enough, aliased vim, vi, etc. to emacs -nw, and struggled like crazy to do some of the most basic stuff imaginable for the first two weeks
19:20defnbut in the end, you will be a more efficient programmer if you take the time to get to know emacs, and that's probably going to sound like im trolling or something, but honestly, i firmly believe it to be the truth
19:20defnthe best software devs ive met in my life seemed to all have one thing in common: emacs
19:20jweissok, ok, it's not like vim is a shining example of clarity either, so my only reason not to go to emacs is inertia
19:21defmacroi should hire an emacs expert for a day to customize my setup, i just can't get started enough
19:21fanaticojweiss: once again, I gotta recommend viper-mode. Makes the transition much easier.
19:21technomancydefmacro: *cough*peepcode*cough*
19:21defndefmacro: the whole setup process involves a lot of pain
19:21technomancy</shameless-promo>
19:21defntechnomancy's screencast on peepcode is good
19:22defmacrotechnomancy: i bought that, but i want ultra aweosme customization and i want it in a day ;p
19:22defndefmacro: i know where you're coming from exactly
19:22duncanmtwbray: congrats congrats!
19:22defmacroonce i get it the way i like, oh, i'll be 100% into emacs, but until then, i can barely stand 20 mins figuruing this and that
19:22technomancydefmacro: ah, that will have to wait until my career-change to a traveling lisp mendicant then.
19:22defnmy advice is this: open up technomancy's elpa-to-submit in his starter-kit, and pick the .el files you want in your setup, install elpa, make your own init.el, and slowly start cobbling your setup together
19:23jweissi'm not going to customize anything. i hate that i can't do anything on any machine but my own. i always use basically stock setup
19:23defnIMO you absolutely cannot just use a starter kit out of the box and be happy
19:23defnyou're better off starting from scratch and adding stuff as needed
19:23defmacrodefn: tried that, i'm just too dumb. i'll keep trying tho, seriously i think a day with an emacs guy clarifying my misconcpetions about emacs setup is the way to go
19:24technomancydefmacro: nothing compares to looking over the shoulder of someone who's immersed in it.
19:24defmacrodefn: yeah, i agree
19:24technomancydefmacro: are you the guy behind defmacro.org?
19:24defmacrotechnomancy: all textmate and vimmers at work, hehehe
19:24defmacrotechnomancy: no, new nick
19:25arjI have a problem with the slime repl. I'm registering callback handlers in jnotify but I don't get any messages it seems when in slime, but if I start up a repl outside of emacs it works. Any ideas?
19:25defmacroactually, i've stopped playing with clojure cause coding with vim seems less than natural, tho for ruby it's fine
19:26Chousukejweiss: you could have your config on github or something and then just clone it onto machines (or download a tarball)
19:27technomancydotfiles on github is a must, no matter what your editor is
19:27jweisshm that's a good idea
19:29kzarso loop in clojure seems to be completely different to loop in CL, is there something like common lisp's loop?
19:29the-kennykzar: Loop is propably the ugliest and the most awesome thing at once - But I don't like it :)
19:30the-kennyOh and no, there isn't something like cl's loop in clojure.
19:30ChousukeI think I saw at least a partial implementation of cl loop somewhere. :/
19:30kzarthe-kenny: So supposing you need to loop over a list, grabbing the first 3 items each time what would be the clojure way to do that/
19:31Chousuke(map f (partition 3 list))?
19:31the-kennykzar: (map fn (partition 3 list) or so
19:31Chousukeexplicit loops are not idiomatic.
19:31defnoh boy
19:31defnim having a hard time understanding loop/recur too
19:31defnit still is making no sense to me :\
19:32the-kennydefn: Try not to use it :)
19:32defnim working on it the-kenny ! :)
19:32Chousukedefn: it's kind of like a recursive function
19:32defnright now i have this vector [1 2 3 4 5], and i want to conj (* 1 2 3), (* 2 3 4), etc. onto a list
19:33Chousukeonly: there is no function object and primitives are supported.
19:33defni put the conj part into my (recur ()), and inc my counter, but then i have 2 args where it expects 1
19:33defnit's unnerving
19:33Chousuke(map (partial apply *) (partition 3 1 [1 2 3 4 5]))
19:33Chousukehmm
19:33Chousuke,(map (partial apply *) (partition 3 1 [1 2 3 4 5]))
19:33clojurebot(6 24 60)
19:34defnclose
19:34kzarthe-kenny / Chousuke: With the example list of [1 2 3 4 5 6] I need to run fn on [1 2 3], [2 3 4], [3 4 5], [4 5 6]. I think that example would run it on [1 2 3] [4 5 6]
19:34defnkzar: #11 in projecteuler, eh?
19:34kzardefn: What's projecteuler?
19:34Chousukekzar: partition supports a step.
19:34Chousuke,(map (partial apply *) (partition 3 1 [1 2 3 4 5 6]))
19:34clojurebot(6 24 60 120)
19:35defnoh, nvm, i have the exact same question kzar -- which is weird
19:35the-kenny,(partition 3 1 [1 2 3 4 5 6])
19:35clojurebot((1 2 3) (2 3 4) (3 4 5) (4 5 6))
19:35kzarCool thanks
19:37defnwhoa dude, that's awesome
19:47defni was going about solving that problem the complete wrong way
19:50defn,(partition 1 [1 2 3] [1 2 3] [1 2 3])
19:50clojurebotjava.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number
19:50defn,(partition 1 [[1 2 3] [1 2 3] [1 2 3]])
19:50clojurebot(([1 2 3]) ([1 2 3]) ([1 2 3]))
19:51defn,(partition 2 1 [[1 2 3] [1 2 3] [1 2 3]])
19:51clojurebot(([1 2 3] [1 2 3]) ([1 2 3] [1 2 3]))
19:51Chousukewhat are you trying to accomplish?
19:51Chousukepartition takes a single sequence and divides it.
19:52defni have this vector of vectors, it amounts to a 20x20 grid, so now that i have all of the products for the horizontal combinations
19:52defni need to find the vertical combinations, and finally the diagonal combinations
19:53defnmy structure looks like [[1..20] [1..20]...[1..20]]
19:54KirinDaveWhy did you choose to make it that way?
19:54defnhow would you do it?
19:54Chousukewell the vertical combinations are easy I think
19:55Chousuke,(apply map + [[1 2 3] [4 5 6] [7 8 9]])
19:55clojurebot(12 15 18)
19:56KirinDavedefn: Well, I'd make it a flat array
19:56KirinDavedefn: And then use partition to make rows and columns as separate views.
19:56defnyeah i originally planned on doing just that
19:58_msta nice thing about the nested vectors approach is you can get out the diagonals using get-in...
19:58_mstpossibly a bit harder with a flat vector?
19:58defnChousuke: your solution works, but if i have [[1 2 3] [4 5 6] [7 8 9] [10 11 12]], i need to get (* 1 4 7), (* 4 7 10), etc.
19:58KirinDaveI dunno if it'd be any harder.
19:58defnharder to think about with a flat vector
19:58defnfor diagonals i like the nested vectors
19:59KirinDaveUm, just write a function to translate from [x,y] -> [n]
19:59defnlike i said "i like the nested vectors"
19:59KirinDaveThat's fine. I was just pointing out that the diagonals are not significantly easier to compute. :)
20:00defnsure sure
20:00defnim heading home, see you guys later
20:00defnthanks for the help all
20:03michaeljaakahi
20:03michaeljaakaI'm getting Caused by: java.lang.Exception: Can't take value of a macro: #'ds.commons/invoke-me
20:03michaeljaaka at clojure.lang.Compiler.analyzeSymbol(Compiler.java:4610)
20:03michaeljaaka at clojure.lang.Compiler.analyze(Compiler.java:4307)
20:03michaeljaakaany idea what causes that?
20:03michaeljaakaanyone got such problem?
20:08fanaticoJust like it says, you're trying to treat a macro like a value.
20:09KirinDave2michaeljaaka: What expression involving invoke-me signals that error?
20:10michaeljaaka(defn some[d] invoke-me d rest of args.. )
20:10KirinDave2Maybe you meant
20:10KirinDave2(defn some [d] (invoke-me d …))
20:10KirinDave2?
20:10michaeljaakathen i get EOF
20:11KirinDave2Um
20:11KirinDave2I suspect that there is a simple syntax error
20:11michaeljaakain macro?
20:11michaeljaakaCaused by: java.lang.Exception: EOF while reading
20:11michaeljaaka at clojure.lang.LispReader.readDelimitedList(LispReader.java:1003)
20:11michaeljaaka at clojure.lang.LispReader$ListReader.invoke(LispReader.java:860)
20:11michaeljaaka at clojure.lang.LispReader.readDelimitedList(LispReader.java:1011)
20:11michaeljaakawhen typed as you propsed
20:12KirinDave2What is the actual statement you typed?
20:12KirinDave2I'm pretty sure it's impossible to make a macro that makes unbalanced parens.
20:12duncanmla la la
20:14arjis there any way I can using ns and import, import something java into the namespace under a different name?
20:15fanaticoarj: Don't think so. Clojure and Java are in a different namespaces.
20:15michaeljaakahttp://pastebin.com/d46062ac6
20:15michaeljaakahere is an actual code
20:16michaeljaakathat don't want to compile
20:16arjfanatico: ok, it's just that if I import something I can't create my own e.g. structs with the same name as one I imported, it's a bit annoying
20:16KirinDave2michaeljaaka: One moment.
20:16fanaticomichaeljaaka: http://pastebin.com/mc7209be
20:17duncanmmichaeljaaka: why did you write that as a macro?
20:17michaeljaakabecause iface is an java interface name
20:17michaeljaakaand when written as fun iface won't be resolved
20:18fanaticoarj: yeah. If you're not using the java class/method that conflicts, you could exclude it from the import, or you could refer to the clojure name using the full namespace.
20:18michaeljaakafanatico: I get EOF when I write "act" like this
20:19fanaticomichaeljaaka: did you balance the parens for let?
20:19michaeljaakayes
20:19KirinDave2michaeljaaka: http://gist.github.com/238447
20:19KirinDave2michaeljaaka: That does not eof for me.
20:19KirinDave2And appears to match your intent
20:19KirinDave2What editor are you using?
20:19michaeljaakaenclojure
20:20KirinDave2Because lisps really demand an editor.
20:20arjsadly I am importing something important that conflicts. But it doesn't seem like I*m able to define a new struct with the same name as some java class I imported
20:20arjwould be cool with a import bla as foo
20:20KirinDave2I'd highly recommend emacs + clojure-mode + paredit
20:20michaeljaakathis is an editor for netbeans
20:20michaeljaakaok
20:20KirinDave2Anyways, I suspect you simply had unbalanced parens.
20:20michaeljaakaI will try compile it with emacs
20:21KirinDave2Just make sure your quotes are right
20:21KirinDave2Remember, invoke-rmi _must_ be immediately prefaced by an open-paren to work.
20:21arjdoes anyone know why slime eats some of the output that the running code produces? It seems like messages coming out-of-band are not displayed at all?
20:22KirinDave2"out of band"?
20:23the-kennyI think he means from a different thread or so.
20:23the-kennyarj: If so, you can find them in the inferior-lisp buffer.
20:24michaeljaakaok
20:24arjthe-kenny: ah!
20:24duncanmarj: yeah, it's a little confusing, but *out* and *err* are not the same as System.out and System.err
20:24arjthanks a lot
20:24michaeljaakaI have looked at code and truly there were missing two closing parens
20:24michaeljaakathanks a lot!
20:24arjvery newb slime question I guess :D
20:24michaeljaakabtw why pastebin is lame?
20:25KirinDave2arj: I'd use a C-x 3 in your slime repl, then swap one to the inferior lisp buffer.
20:25KirinDave2That is what I do
20:25duncanmmichaeljaaka: i don't understand your answer
20:26KirinDave2arj: You end up like so : http://idisk.me.com/dfayram/Public/Pictures/Skitch/%2Ainferior-lisp%2A-20091118-172516.png
20:26michaeljaaka; Rule #1, fuck pastebin.
20:26michaeljaakathis is from http://gist.github.com/238447#file_gistfile1.txt
20:26KirinDave2michaeljaaka: Because it is fairly ugly and hard to read. gist is nice because it puts the code way out in front, design wise
20:26KirinDave2I mean, compare those two pages.
20:26arjKirinDave2: yeah that's pretty cool, thanks agian
20:27KirinDave2michaeljaaka: You can also checkout and manipualte whole pastes as a git repo, which can be very handy sometimes in larger pastes. And also because mojombo, defunkt and the crew are Folks Who Know What Salsa Should Taste Like.
20:28michaeljaaka:)
20:28michaeljaakaok
20:28michaeljaakanow I know gist, paste.lisp.org and pastebin
20:29hiredmanhttp://delicious.com/clojurebot/pastbin
20:29michaeljaaka:)
20:30the-kennyclojurebot has a delicious integration? Nice idea :)
20:31hiredman:)
20:53churibwhen happens destructuring? at read time?
20:54chouserruntime
20:55churibokay, thanks
20:55hiredmanwell, it's a macro
20:56hiredmanit's expanded at macro expand time, but the code it expands to is run at runtime
21:13polypusis this (eval `(fn ~arg-lst ~expr)) the recommended way of building a function at run time when one has a param list and expression?
21:15duncanmpolypus: or you could use a macro
21:17duncanmchouser: do you understand what michaeljaaka said about his macro? i'm not completely familiar with how identifiers are resolved in Clojure macros (vs. Scheme macros), but what he said didn't make sense to me
21:26fanaticoduncanm: outside of the (.) special form, java methods don't resolve, so invoke-rmi has to be a macro.
21:34jweissok, so i was convinced this evening to switch to emacs+slime (from vim-clojure). it was pretty easy to set up. i still have no clue how to use emacs, but at least the REPL works. 2 questions. how to set classpath, and how to change the color scheme?
21:34jweissi saw via google a way to set classpath in the .emacs, but apparently you have to restart emacs anytime that changes. there must be an easier way?
21:36fanaticojweiss: C-x C-e evals the last sexp (both in elisp and clojure), so you can update the variable that way. You still may have to restart slime.
21:38jweisswow, in emacs, jumping to line 99 is "ESC-X goto-line <enter> 99" ? that sucks
21:39jweissi'm about to fall back on viper mode
21:39_mstalways seemed strange that it was never bound to a key
21:39_mstbut you can bind it to a key yourself! :)
21:39jweiss_mst: all in due time, first i have to figure out how to do basic stuff
21:40jweissbut i can see it'll be better than vi,someday
21:40_mstah right :) in my ~/.emacs I have: (define-key global-map (kbd "C-c g") 'goto-line)
21:40hiredmanpfft
21:40jweissi never knew the .emacs file was lisp. that is pretty cool
21:41dnolen_mst: I used (meta-n), simpler, I had multiple groups of keys I used often.
21:41dnolenalso a fan of binding function keys to start REPL, magit, shell, etc.
21:42_mstah yep. I'm not sure what my meta-n is off the top of my head, but I can assure you it's bound to something somewhere :)
21:43dnolenI hate multiple groups of keys I mean for common commands
22:12polypusduncanm: thanks but how? this don't work (defmacro template-function [arg-lst expr] `(fn ~arg-lst ~expr))
22:33kzarWhat's the easiest way to get the first 3 values of a sequence?
22:35fanatico,(take 3 '(1 2 3 4 5))
22:35clojurebot(1 2 3)
22:36kzarfanatico: ah sweet
22:36kzarthanks
22:36fanaticonp
22:41kzarfanatico: Is there something to give the rest after the first 3?
22:42fanatico,(drop 3 '(1 2 3 4 5))
22:42clojurebot(4 5)
22:44kzartah :)
22:46kzar(Although it would be kind of odd for a Lisp, maybe first and next should have an optional number parameter. It would make sense and avoid drop and take being needed)
22:47chouser,(split-at 3 (range 5))
22:47clojurebot[(0 1 2) (3 4)]
23:13kzarIs the closest to "for i in [1 2 3 4 5] ..." (map (fn [i] ...) [1 2 3 4 5] ?
23:14chouser,(for [i [1 2 3 4 5]] (* i 2))
23:14clojurebot(2 4 6 8 10)
23:17chouserkzar: note that both 'map' and 'for' return lazy seqs -- neither is an imperative loop like python's 'for'
23:19kzarwhoops I didn't realise there was a for. Yea I watched some of the videos that mentioned about lazieness, it seems like a brilliant idea that's going to fuck me over one day soon heh
23:22defn'lo
23:23kzarlaziness* damn flyspell :(
23:30chouserkzar: heh, could be.
23:31chouserkzar: usually it only causes me trouble when I'm trying to be too clever -- lazily consuming UI events or lines from an open file or something.
23:31defnhow do you use get-in?
23:31defni have a structure like [[1 2 3] [4 5 6]]
23:32_ato,(get-in [0 0] [[1 2 3] [4 5 6]])
23:32clojurebotnil
23:32_atohmm
23:32tomojbackwards
23:32tomoj,(get-in [[1 2 3] [4 5 6]] [0 0])
23:32clojurebot1
23:32_atoah right
23:32_atoof course
23:33tomoj,(get-in [[1 2 3] [4 5 6]] [1 1])
23:33clojurebot5
23:33defnah cool
23:33defnthanks
23:34_atoheheh I rely on slime's argument hints in the minibuffer too much... hmm... I wonder if I can get it to do it with IRC too. ;-)
23:35defni dont understand the get-in "documentation", the whole m keys thing
23:36_ato,(doc get-in)
23:36clojurebot"([m ks]); returns the value in a nested associative structure, where ks is a sequence of keys"
23:37_atom means map (an associative structure)
23:37_ato,(get-in {:foo {:bar 2}} [:foo :bar])
23:37clojurebot2
23:38_atoks is the keys in the nested maps that get to the value you want
23:38_atoa vector can be thought of as a map between indices and values
23:38defnsure i mean i understand the structure
23:39defnbut ive thought of [0 0] as being a sequence of keys
23:39defnnever thought of*
23:40defnnevermind it all makes sense now
23:41defnive successfully embaressed myself again
23:41defnno need to worry
23:46fanaticowhy does `get-in` take [m ks] instead of [m keys*]?
23:47fanaticoare there any guidelines about when to write one style over the other?
23:54fanatico,(defn my-get-in [x & args] (if (seq args) (recur (get x (first args)) (rest args)) x))
23:54clojurebotDENIED
23:55fanatico,((fn [x & args] (if (seq args) (recur (get x (first args)) (rest args)) x)) [[1 2 3] [4 5]] 0 1)
23:55clojurebot2