#clojure logs

2009-12-05

00:00_ato(.getURLs (.getContextClassLoader (Thread/currentThread)))
00:00_ato^ that might work for add-classpath stuff
00:07alexyk_ato: thx!
00:14alexykdid clojure-maven-plugin disappear from build.clojure.org/snapshots?
00:16slyrus_duper: common lisp, #lisp
00:16cemerickalexyk: huh, I didn't know it was ever there
00:16alexykcemerick: my bad
00:16alexykcemerick: but now I can ask you about importing << :)
00:17cemerickthat was fast :-)
00:17alexykIDEA did a load-file on your goodies, says, #'commons.clojure.strint/<<
00:18cemerickalexyk: did you hit a snag?
00:18alexyknow I'm in my own namespace user=> still
00:18alexykit works with full name, but I can't rename it into the current namespace in repl
00:18cemerickoh -- just (use 'commons.clojure.strint) if you're at a repl
00:18alexykI'm sure it works fine in a new script, but I want a way to get it into repl without modifying classpath
00:19alexykor restarting the repl
00:19alexykfolks suggested (alias '<< #'commons.clojure.strint/<<) -- fails
00:19alexykand a version of (defmacro << {your #'commons.clojure.strint/<< tortured})
00:19cemerickthat's not necessary -- 'use' doesn't work?
00:19alexykdidn't work either
00:20cemerickthat doesn't make sense
00:20alexykthe file is not on my classpath as I pasted it into IDEA :)
00:20cemerickoh, oh
00:20cemerickI don't know anything about how IDEA's clojure stuff works
00:20alexykI'm generally curious about importing things from other namespaces in repl
00:20alexykit was loaded into repl with (load-file ...)
00:20alexykand created << in its own namespace
00:21alexykand it works fine! :)
00:21cemerickthen (use 'commons.clojure.strint) should bring << into user (or whatever ns your repl is in)
00:21cemerick*ns*, I should say
00:21alexyk(use 'commons.clojure.strint) => java.io.FileNotFoundException: Could not locate commons/clojure/strint__init.class or commons/clojure/strint.clj on classpath: (NO_SOURCE_FILE:0)
00:22alexykit's not compiled yet as was loaded as-is
00:22cemerickand that's after using load-file?
00:22alexykwith (load-file ...) :)
00:22alexykyep
00:22cemerickhuh
00:22cemerickthere's a lot of things that could be getting in the way there.
00:22cemerickI haven't used load-file in about a year :-)
00:23alexykthis is general, I understand no aspersions are cast on the fine-crafted << programming
00:23cemerickheh
00:23alexykyeah, IDEA did it after clicking on "run file in repl"
00:23alexykcemerick: I'll overlook your Scala flame-bait, this time, there :)
00:23cemerickoh. Maybe it's running the file in a separate classloader, which would make it inaccessible
00:24alexykit just types (load-file ...) into a repl, I see it
00:24alexykbut anyways it's contrived, I should use it from a script anyhow
00:25hiredmanalexyk: use won't work if the file is already loaded
00:25hiredmanuse refer
00:25hiredmanuse tries to load then refer a namespace
00:25alexykhiredman: (refer '...)?
00:25hiredman,(doc refer)
00:25clojurebot"([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to something else in the current nam
00:26cemerickalexyk: OK, so I get the same behaviour in enclojure. I really never use load-file, so I guess I don't understand what its semantics are.
00:27alexykhiredman: almost there! my previous attempts defined << in local ns, how do I undefine it?
00:27hiredman(ns-unmap *ns* '<<)
00:28alexykeureka!
00:28alexyk(<< "There's ~(seq (range n 90 -1)) bottles of beer on the wall...")
00:28alexyk"There's (99 98 97 96 95 94 93 92 91) bottles of beer on the wall..."
00:28alexykcemerick deserves one of those! :)
00:29alexyk(refer 'commons.clojure.strint) ; did the trick
00:30hiredmanbut I guess I am old fashioned
00:30alexykcemerick: your blog says, "you should follow me on twitter..." usually this is written as "follow me on twitter..." :)
00:31hiredmanthere was a blog post somewhere about commanding people to follow you results in more follows
00:31alexykhiredman: I look down on Ruby's interpolation, format is visually separable, but the bottle example is good in terms of -- try to format that
00:32cemerickalexyk: I'm aping http://dustincurtis.com/you_should_follow_me_on_twitter.html there
00:32cemerickI could care less about the wording, so...
00:32cemerickhiredman: I've been using format and String.format for too long, and too much. I couldn't take it anymore for certain things.
00:33hiredman,(format "There's %s bottles of bear on the wall..." (prn-str (range 100 99 -1)))
00:33clojurebot"There's (100)\n bottles of bear on the wall..."
00:33hiredmanerp
00:33hiredman,(format "There's %s bottles of bear on the wall..." (pr-str (range 100 90 -1)))
00:33clojurebot"There's (100 99 98 97 96 95 94 93 92 91) bottles of bear on the wall..."
00:33hiredman,(format "There's %s bottles of beer on the wall..." (pr-str (range 100 90 -1)))
00:33clojurebot"There's (100 99 98 97 96 95 94 93 92 91) bottles of beer on the wall..."
00:33cemerickyeah, sure. It's when there's 10 args that it gets rough.
00:33hiredmansure
00:34hiredmanwhich is why you write the function that takes a map and generates the string once
00:34alexykcemerick: nice explanation of twitter :)
00:35hiredmancemerick: it's neat macro and everyone likes it
00:35cemerickI'm surprised that there's been such a response, but I'm happy others appreciate it.
00:36alexykbut you can't avoid () can you
00:36cemerickavoid ()?
00:36alexykor ~(seq ...) will fall apart
00:37hiredmanerm
00:37hiredmanit's a function call
00:37alexykcan you do: There's 100 99 ... 91 bottles...
00:37alexykI mean in the result
00:37alexykformat does it in the same way, but interpolation?
00:38_atoi guess theres: ~(apply str (range 100 90 -1))
00:38_atough
00:38hiredman,(format "There's %s bottles of beer on the wall..." (apply str (range 100 90 -1)))
00:38clojurebot"There's 100999897969594939291 bottles of beer on the wall..."
00:38_atono that won't give you spaces
00:38hiredmanyou have to use interleave
00:38hiredmanor reduce
00:39_atoyeah, or join from str-utils2
00:39hiredman,(format "There's %s bottles of beer on the wall..." (reduce (partial str " ") "" (range 100 90 -1)))
00:39clojurebot"There's 100999897969594939291 bottles of beer on the wall..."
00:39hiredmanhmmm
00:39_ato,(format "THere's %s bottles of beer on the wall..." (clojure.contrib.str-utils2/join " " (range 100 90 -1)))
00:39clojurebotjava.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.contrib.str-utils2
00:39hiredman,(format "There's %s bottles of beer on the wall..." (reduce #(str %1 " " %2) (range 100 90 -1)))
00:39clojurebot"There's 100 99 98 97 96 95 94 93 92 91 bottles of beer on the wall..."
00:40_ato(require 'clojure.contrib.str-utils2)
00:40_ato,(format "THere's %s bottles of beer on the wall..." (clojure.contrib.str-utils2/join " " (range 100 90 -1)))
00:40clojurebotjava.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.contrib.str-utils2
00:40_ato,(require 'clojure.contrib.str-utils2)
00:40clojurebotnil
00:40_ato,(format "THere's %s bottles of beer on the wall..." (clojure.contrib.str-utils2/join " " (range 100 90 -1)))
00:40alexykyes! now will cemerick's << do that? without ()?
00:40clojurebot"THere's 100 99 98 97 96 95 94 93 92 91 bottles of beer on the wall..."
00:40hiredmansame call I would imagine
00:40hiredmanwhere is the url for cemericks code?
00:41alexykhttp://muckandbrass.com/
00:42cemerickalexyk: I don't really think you want to go down that path. If you start adding formatting options to something like <<, the syntax will degrade into misery.
00:42cemerickthe permutations expand *really* fast
00:42hiredman,(refer 'commons.clojure.strint
00:42clojurebotEOF while reading
00:42hiredman,(refer 'commons.clojure.strint)
00:42clojurebotnil
00:42hiredman,>>
00:42clojurebotjava.lang.Exception: Unable to resolve symbol: >> in this context
00:42_ato,<<
00:42clojurebotjava.lang.Exception: Can't take value of a macro: #'commons.clojure.strint/<<
00:43alexykcemerick: I want to avoid surrounding parens, that's all
00:43_ato,(<< "hello ~(join \" \" (range 10)) world")
00:43clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character
00:43cemerickoh, gawd, it's in clojurebot now :O
00:43hiredman_ato: can't have strings inside
00:43alexykright: (<< "There's ~(reduce #(str %1 " " %2) (range 100 90 -1)) bottles of beer on the wall...") => java.lang.IllegalArgumentException: Wrong number of args passed to: strint$-LT--LT- (NO_SOURCE_FILE:0)
00:43hiredmancemerick: :)
00:44alexykneed to quote is somehow...
00:44hiredmanuse \space
00:44hiredman,\space
00:44clojurebot\space
00:44hiredman,(str \space)
00:44hiredman
00:44_ato,(<< "hello ~(join \space (range 10)) world")
00:44alexykclojurebot: breathe
00:44hiredman,(str "a" \space "b")
00:44cemerickalexyk: you want the parens, otherwise, you'd be depending on whitespace after your binding name, etc.
00:44clojurebot" "
00:44clojurebotUnsupported escape character: \s
00:44clojurebotTitim gan éirí ort.
00:44clojurebot"a b"
00:44hiredmanah
00:45hiredman\space isn't going to work either
00:45alexykcemerick: yeah, but I don't want them to be in output!
00:45cemerickalexyk: well, that's what you get when you str a seq *shrug*
00:45hiredman_ato: format works :P
00:46alexyktrue
00:46alexykcan live with that
00:46cemerickcemerick: retarding clojure programmer productivity WORLDWIDE! :-P
00:46_ato,(<< "hello ~(+ 1 1)")
00:46clojurebot"hello 2"
00:47alexyknow we can say, take that, Ruby folk!
00:47cemerickeh, hardly
00:48cemerick<< is an order of magnitude of capability away from #{} and heredocs
00:49alexyk,(<< "hello ~(reverse \"ruby\")")
00:49clojurebot"hello (\\y \\b \\u \\r)"
00:49_ato,(str "hello " (reverse "ruby"))
00:49clojurebot"hello (\\y \\b \\u \\r)"
00:49_atoso much nicer :p
00:50alexyk_ato: ambiguous spaces and gluing!
00:50alexykI see [ " ] and am not sure whether it begins or ends what
00:52_ato(<< "hello ~(<< \"nested ~(str \\"world\\")\")!")
00:52_ato,(<< "hello ~(<< \"nested ~(str \\"world\\")\")!")
00:52clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: strint$-LT--LT-
00:52_atook.. I can't pull that off
00:52_atotoo confusing
00:53_ato,(<< "hello ~(<< \"nested ~(str \\\"world\\\")\")!")
00:53clojurebot"hello nested world!"
00:53_atoah
00:53_atoheh
00:53cemerickoy
00:54_atoalexyk: fair enough. I can see the simple variable case, like "hello $foo". But anything more complex quickly becomes ugly
00:55alexykexactly
00:55alexyk(<< "hello ~(<< \"nested ~(str \\\"cemerick\\\")\")!")
00:55alexyk,(<< "hello ~(<< \"nested ~(str \\\"cemerick\\\")\")!")
00:55clojurebot"hello nested cemerick!"
00:56alexyknow we only need to rot13 the nested string...
00:57hiredman,(+ (mod (+ (int \a) 13) 26) (int \a))
00:57clojurebot103
00:58hiredmanhmmm
00:58cemerick_ato: I suspect the best usage will be stuff like (<< "Hi ~(:name user), you have ~{msg-cnt} messages waiting for you in ~(:inbox-loc user)"), or whatever
00:58hiredman,(char 103)
00:58clojurebot\g
00:58hiredman,(+ (mod (+ (int \z) 13) 26) (int \a))
00:58clojurebot102
00:58hiredman,(char 102)
00:58clojurebot\f
00:58hiredman:|
00:58hiredman,(+ (mod (+ (- (int \z) (int \a) 13) 26) (int \a))
00:58clojurebotEOF while reading
00:59hiredman,(+ (mod (+ (- (int \z) (int \a)) 13) 26) (int \a))
00:59clojurebot109
00:59hiredmanthat's not right
00:59duncanmla la la
01:00hiredmanis that right?
01:01hiredman(yes)
01:03interferonhow do i do a multiline regex match?
01:05hiredman,(re-find #"foo\nbar" "foo\nbar")
01:05clojurebot"foo\nbar"
01:05hiredman,(re-find #"foo\nbar" "foobar")
01:05clojurebotnil
01:07interferoni have a string that looks like "Account\rfoo"
01:07interferonbut Acc(.*) only gets "ount" in the first group[
01:07interferonit's either not doing multiline or the \r is confusing it
01:10hiredmanyou aren't writing a csv parser are you?
01:10hiredman(just checking)
01:11hiredman(because really there are a million libraries for that and you should just use one, if that is what you are doing)
01:11interferonnope, QIF parser
01:11interferon,(re-find #"Ac(.*)" "Account\rxyz")
01:11clojurebot["Account" "count"]
01:12interferoni want what's after the line too...
01:13hiredman ,(re-find #"Ac(.*)+" "Account\rxyz")
01:13hiredman,(re-find #"Ac(.*)+" "Account\rxyz")
01:13clojurebot["Account" ""]
01:15chouser,(re-find #"(?s)Ac(.*)" "Account\rxyz")
01:15clojurebot["Account\rxyz" "count\rxyz"]
01:15carkPattern.compile(regexString,Pattern.MULTILINE);
01:15hiredman" The regular expression . matches any character except a line terminator unless the DOTALL flag is specified. "
01:15chouser(?s) turns on DOTALL
01:16hiredmanneat
01:17chouser"The s is a mnemonic for "single-line" mode, which is what this is called in Perl"
01:17chouserjust to clear things up. :-P
01:18hiredmanmakes total sense
01:18hiredman
01:19slyrus_so what are we supposed to use now that add-classpath is deprecated?
01:19hiredmannothing
01:20hiredmanyou shouldn't be using add-classpath
01:20hiredmanso it's removal should be a nop
01:20slyrus_so how do you, say, add a jar to the classpath?
01:20hiredmanyou don't
01:20hiredmanthere is no reliable way to do it
01:21hiredmanadd-classpath fails in weird ways in weird places
01:21slyrus_i get that. I've got a jar. I want clojure's java process to know about its contents. how do i tell clojure "hey, there's a whole bunch of java classes in this file -- go look in there!"?
01:22hiredman
01:22hiredmanyou just rephrased the question I already answered
01:22slyrus_is that some weird unicode smiley?
01:22hiredmanif you want another answer ask a different question
01:23hiredmanunicode ellipsis
01:23hiredman. . .
01:23slyrus_i have a jar file, let's call it incanter.jar. i'd like clojure to know about its contents. how can i tell clojure that it should consider looking in incanter.jar for the class files?
01:24hiredmanslyrus_: put it on your classpath
01:24slyrus_great. how do i do that? add-classpath?
01:24hiredman-cp or CLASSPATH environment variable
01:24hiredman~google java classpath
01:24clojurebotFirst, out of 292000 results is:
01:24clojurebotSetting the class path
01:24clojurebothttp://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html
01:24slyrus_bah. I don't want to do that at the time i start the damn process!
01:25slyrus_i want to find the jar later. surely that's what add-classpath used to do, no?
01:25hiredmanwell, you can copy the implementation of add-classpath, just don't expect support when it fails
01:25slyrus_i'm confused... are you telling me i have to know the jars I want to use when i _launch the process_?
01:25hiredmanyes
01:26JAS415its the java way
01:26slyrus_I thought the whole point of clojure was that it was supposed to make the jvm dynamic!
01:26carkyou can use wildcard in the classpath
01:26hiredmandynamic is a word that encompasses a wide variety of behaviour
01:26JAS415you can load whatever clojure code you want :-)
01:26slyrus_look, this whole jvm thing is ... interesting, but i expect things to be done the ... right way ... the lisp way. :)
01:27hiredmanslyrus_: well, sign a CA and submit a patch
01:27JAS415oh man
01:27JAS415that would be a heck of a patch
01:27slyrus_i guess i was just blissfully ignorantly using add-classpath before and everything seemed ok
01:28JAS415rewrote JVM to make it lispy :-)
01:28hiredman~add-classpath
01:28clojurebotadd-classpath is bad, avoid it. I mean it!
01:28carkthere are always limitations, even with CL, in practice the classpath stuff is no problem at all
01:28hiredmanshould have asked clojurebot
01:29JAS415one time in CL I managed to get myself into a state where the code couldn't be loaded from a file
01:29JAS415because there were like
01:29JAS415forward and backward dependencies
01:30JAS415it was a learning experience :-)
01:30polypussame thing happeded to me in C++ but we won't talk about that
01:33polypusdoes clojurebot have documentation someplace?
01:33slyrus_i'm still in a state of shock here, but i find it hard to believe that there's no better way than to specify the location of the classes at the time the process is started.
01:34slyrus_am i missing something really obvious here?
01:34JAS415i was in that same state of shock for a while too
01:34hiredmanpolypus: docs for clojurebot? (no)
01:35slyrus_JAS415: and then what?
01:35JAS415i got really good at writing the bash script to start clojure with whatever jars i want
01:35JAS415:-P
01:35JAS415uh
01:35JAS415also
01:35JAS415what i tend to do
01:35JAS415is i make a deps directory
01:35hiredmanthere is kind of a vague and incomplete list of the various plugins in the readme
01:35JAS415and just point java at that with a wildcard
01:36JAS415i end up with a couple copies of certain jars laying around
01:36polypushiredman: ty
01:36hiredmanI stick jars in ~/.jars and put $HOME/.jars/* on the classpath
01:36JAS415but less of a headache to drop the jar into the directory than to rewrite thescript
01:36carkah i do it on a per project basis
01:36JAS415i do that to cark
01:37JAS415mostly for startup time
01:37carkso that i stay with the same version of libs and clojure
01:37JAS415(or at least in my semi-magical understanding it seems to change the startup time)
01:37hiredmanI tend to move in that direction when I am farther down the road once dependencies have all been figured out
01:37carkalso when you distribute the project, it's easy, no need to hunt for dependencies
01:38carkah that makes sense
01:38hiredmanotherwise I just throw everthing in .jars and it's always there if I need it
01:38JAS415i built a jar the other day
01:38JAS415that was exciting
01:39JAS415i figured out the voodoo, did it, then promptly forgot :-/
01:40JAS415but you can get all of your deps into a single jar
01:40carkJAS415: http://github.com/cark/clj-exe-jar i just take this as a starting point
01:40JAS415even clojure and clojurecontrib
01:40JAS415that's a niceity
01:40carkrun ant and be done with it
01:40JAS415oh wow
01:40JAS415cool
01:41JAS415*bookmarked*
01:53tomojI think there were a couple blog entries about it too
01:54tomoj(making executable clojure jars I mean)
02:19timothypratley1is there a nice way to call 'read' on a string?
02:20timothypratley1something like (read "{:a 1, :b 2}") <-- but not
02:22danlarkinread-string
02:22timothypratley1danlarkin: thanks!!!
03:09triyoanyone using Leiningen to compile and build their projects?
03:09tomojcertainly someone is?
03:10_atotriyo: what's the problem?
03:10triyoIt would be really cool if there was a command that generates .emacs entries for dev purpose (i.e. load all the deps jars)
03:11_atotriyo: do you know about M-x swank-clojure-project ?
03:11triyo_ato: no, I don't, how does it work?
03:11tomojI would think that leiningen would work well with swank-clojure-project
03:11tomojsince I learned of both from the same person
03:12_atojust run it and it'll ask you for a project directory. Point it at the directory of your lein project and it'll start slime with the correct classpath
03:12tomojdoes lein download deps into lib/?
03:12_atoyes
03:12tomojI still haven't tried it :/
03:13tomoj"maven repositories" scare me
03:13triyo_ato: oh great, thats awesome. I'll give it try
03:13tomojI mean, say I have enlive as a dependency
03:13tomojis it in maven somewhere? if not, will lein help me?
03:14triyo_ato: any ideas what swank-clojure-project module comes with? I don't seem to have it installed. I do have clojure slime / swank installed
03:14_atoIf you run into trouble, you might need to copy ~/.swank-clojure/swank-clojure-1.0.jar into your-project/lib. I think it's supposed to add it automatically, but it doesn't work with my setup for some reason (I've probably broken it somehow when tinkering with my emacs config)
03:14_atoah
03:14_atotriyo: you probably need a newer version of swank-clojure
03:14_atotriyo: did you install via ELPA?
03:14triyoyup
03:15triyohow do you do update again :>?
03:15_atoM-x package-list-packages
03:15tomojI don't need to screw around with swank-clojure jars
03:15tomojand I don't have a .swank-clojure
03:16tomoj..maybe I have an old version
03:16_atopress "i" on the swank-clojure entry and hit C-c C-c (and pray) ;-)
03:16tomojoh, I have swank-clojure from git
03:16tomoj(and clojure-moe)
03:16meeif there other other lurking clojure newbs here, this is good (if slow) http://blip.tv/file/2145329/
03:17triyook I see swank-clojure 1.0... is that the right ver?
03:17_atotomoj: looks like nobody has uploaded enlive to clojars yet
03:17tomojmee: thanks, always love to find more clojure videos
03:17_atotriyo: that's the version I'm running
03:21triyo_ato: press "i" on the swank-clojure entry and hit C-c C-c -> C-c C-c undefined
03:21piccolinoAren't you supposed to hit X?
03:22_atoah yeah
03:22_atothat's the one
03:22triyohehe, yup it is
03:22_atoC-c C-c is "submit" or "go" in virtually every other mode
03:24triyo_ato: greate, it broke my slime :)
03:25piccolinoAre you using some variant of Emacs 23?
03:25_atopiccolino: yeah
03:25_atotriyo: aww really? :(
03:26triyopiccolino: yup, aquamacs
03:26piccolino_ato, I was asking triyo. :)
03:26piccolinoOK, Aquamacs 2.0?
03:26triyonope, 1.8c
03:26piccolinoAh, Slime won't work on that.
03:26piccolinoYou need one of the 2.0 betas.
03:26piccolinoPre-2.0 is based on Emacs 22.
03:27triyoslime was working...it just broke when I installed swank-clojure
03:27tomojhmm
03:27tomojI thought I had slime+clojure working in a non-beta aquamacs
03:27tomojtriyo: what's the breakage look like?
03:27piccolinoI dunno, I've only recently come to Clojure, but that was the reason it wasn't working for me, and upgrading Aquamacs fixed it.
03:28piccolinoI'm sure regular slime works in 22.
03:28piccolinoThere was some undefined symbol or function in swank-clojure, as I recall, in 22.
03:29tomojI think I might have had that same problem in gnu emacs
03:29tomojbut I don't remember how I fixed it :(
03:29_atohmm, I guess make sure you've got the latest clojure-mode as well and also try commenting out all the swank/slime-related stuff in your .emacs
03:29_atoI run it with no configuration at all
03:30tomojhuh?
03:30tomojdon't you at least need to specify your clojure src directory? or is there a default?
03:30_atoit'll download it
03:30_atoto ~/.swank-clojure
03:30tomojhm
03:31tomojI must have an old version I guess
03:31_atoand I think it also looks like ~/.clojure
03:31tomojI have to do (clojure-slime-config ...)
03:31_atoit does a whole bunch of magic these days
03:31tomojthough if I weren't also using slime for sbcl, that'd be all I needed to do
03:31triyoclojure-test-mode.el:87:1:Error: You must specifiy either a `swank-clojure-binary' or a `swank-clojure-jar-path'
03:31triyooh, thats just clojure-test
03:32tomojI think I will try upgrading, wish me luck :)
03:32triyotomoj: 2.0preview3?
03:32tomojof what, aquamacs?
03:32triyoyup
03:33tomojI abandoned my mac a while ago
03:33triyooh i see
03:33tomojthe clojure-mode/swank-clojure versions I was using with aquamacs are probably at least a couple months old
03:33tomojbut I'm sure I didn't use a beta version of aquamacs
03:34triyoWhen I run M-x slime -> You must specify either a "swank-clojure-binary" or a "swank-clojure-jar-path"
03:34_atohmm
03:35_atoI just grepped my .emacs.d for swank-clojure-jar-path and got no hits
03:35_atoyou must have an old version of something still
03:35triyohmm
03:36triyowould it help to drop all downloaded packages and try fresh install?
03:37_atoI have: clojure-mode-1.6, clojure-test-mode-1.3, swank-clojure-1.0, slime-20091016, slime-repl-20091016
03:37tomojdo you have a clojure-slime config?
03:37tomojer, (clojure-slime-config ...)?
03:37tomojmaybe if you're using ELPA stuff this is no longer necessary
03:37triyoI upgraded clojure-mode from 1.3 to 1.6
03:38tomojI did a clojure-install in a non-default place and so needed to add a (clojure-slime-config ...) to my emacs config
03:38_atomaybe it didn't remove the old swank-clojure and just installed the new one on top or something. I had issues with upgrading stuff through ELPA
03:38_atolook in ~/.emacs.d/elpa
03:39tomojwhen using elpa, are you restricted to whatever releases the people in control make? I feel like if I tried to use elpa I'd end up wanting some other fork or patches and wind up abandoned elpa for git anyway
03:39triyoyup you right, it hasn't removed the old ver
03:41_atotomoj: well it doesn't stop you installing things manually, but yeah you only get the easy install for stuff that people have packages
03:45_atoELPA still seems pretty buggy :-( It's not that great for someone who knows emacs well, but if you're new to it, it at least makes setting things up a bit easier.
03:45_atoThe reason I'm using it is mainly just to try it out cause technomancy was talking about it all the time
03:57meeoh wow, ref validators are rad
03:57triyocorrect me if I'm wrong, but isn't clojure-mode or one of other ELPA packages suppose to download clojure from github automatically?
03:58_atotriyo: yeah, it's supposed to happen when you do M-x slime
03:58_atoif it's not working check if you have a ~/.clojure or ~/.swank-clojure directory and if so rename it
04:00_atosweet. javascript has a (weirdly-named) recur: return arguments.callee(arg1, arg2);
05:02talios'lo
05:03taliosGiven a list of [:foo "bar" :bar "foo"] - how can I easily turn that into a map? I thought I saw something in clojure core for that, or I should I just use map or something?
05:07arbscht,(apply hash-map [:foo "bar" :bar "foo"])
05:07clojurebot{:foo "bar", :bar "foo"}
05:07arbschtlike that?
05:07taliosthats the one ;)
05:08arbscht:)
05:09micampeI am exploring clojure and I was trying to do it by myself
05:09micampewhy is this giving an error?
05:09micampe(let [v [:foo "foo" :bar "bar"]]
05:09micampe (reduce conj {} (partition 2 v)))
05:09taliosarbscht - first I had maven building clojure code, now I have maven building code WITH maven ( pom.clj ) :)
05:11_ato,(reduce #(conj %1 %2) {} (partition 2 [:foo "foo" :bar "bar"]))
05:11clojurebotjava.lang.Exception: Unable to resolve symbol:   in this context
05:11_ato,(reduce #(conj %1 %2) {} (partition 2 [:foo "foo" :bar "bar"]))
05:12clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry
05:12_atooh right
05:12_ato,(reduce conj {} (partition 2 [:foo "foo" :bar "bar"]))
05:12clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry
05:12arbscht,(partition 2 [:foo "foo" :bar "bar"])
05:12clojurebot((:foo "foo") (:bar "bar"))
05:12_ato,(reduce conj {} (map vec (partition 2 [:foo "foo" :bar "bar"])))
05:12clojurebot{:bar "bar", :foo "foo"}
05:12arbscht(conj {} '(:foo "foo"))
05:13_ato,(conj {} '(:foo "foo"))
05:13clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry
05:13_atoso it looks like conj on a map can only take vectors, not lists
05:13micampethanks
05:13tomoj,(apply hash-map [:foo "foo" :bar "bar"])
05:13clojurebot{:foo "foo", :bar "bar"}
05:13tomoj?
05:13arbschttalios: interesting!
05:14taliosarbscht - using a project similar to leiningen's, but this is using the maven3 polyglot apis
05:15talioswhether I can get anything working enough to include in maven3 who knows ( not sure if this code base will be merged either )
06:06lisppaste8nipra pasted "dissoc for a list of keys" at http://paste.lisp.org/display/91630
06:07_ato,(dissoc {:a 1 :b 2 :c 3} :a :b :c)
06:07clojurebot{}
06:07_atonipra: ^
06:08_ato,(apply dissoc {:a 1 :b 2 :c 3} [:a :b :c])
06:08clojurebot{}
06:08nipra_ato, ??
06:09_atonipra: your paste?
06:10_atojust saying a simpler definition would be: (defn dissoc* [map keys] (apply dissoc map keys))
06:11nipra_ato, oops.. yes :-)
06:12nipramy bad
06:12nipradidn't read the doc well
06:33cgrand_ato, tomoj: I think there's a problem with Clojar's search function: http://clojars.org/enlive is up since tuesday
06:35AWizzArdAbout monitors: in the repl i do (def x (Object.)) and then have a function (defn foo [n] (println n) (.wait x) (println "Ending" n)). Now I (dotimes [i 10] (future (foo i))) and then wait a bit and want to (.notifyAll x).
06:36AWizzArdWhy does it throw an IllegalMonitorStateException? What can I do to become the owner of the Monitor?
06:41_atocgrand: ah right, yeah it messes up when there's no description. I'll push a fix out for it tomorrow
06:42cgrand_ato: thanks, I'll put a description string
06:43cgrandAWizzArd: (locking x (.notifyAll x))
06:43AWizzArdok, let me try that
06:45cgrandAWizzArd: and wrap you .wait in a locking form too
06:45AWizzArdok
06:46AWizzArdOkay, that works, thanks.
07:17timothypratley1,(str nil)
07:17clojurebot""
07:17timothypratley1how do I get "nil"?
07:18_ato,(prn-string nil)
07:18clojurebotjava.lang.Exception: Unable to resolve symbol: prn-string in this context
07:18_ato,(prn-str nil)
07:18clojurebot"nil\n"
07:18_atohmm
07:19timothypratley1ah grea thanks _ato!
07:19timothypratley1,(pr-str nil)
07:19clojurebot"nil"
07:19_atoah
07:47StartsWithKcan i simulate 'let' form with push/pop-thread-bindings? http://paste.pocoo.org/show/155005/
07:47_atolet is implemented differently, it doesn't use vars
07:48_atoI think anyway. ;-)
07:49StartsWithKi'm looking at LetExpr in compiler, and i can see it uses Var/pushThreadBindings
07:50_atoI could be wrong, but I'm pretty sure the compiler is using pushThreadBindings there to store a map of the local environment, but that's just a compile-time thing
07:51_atoit doesn't exist at runtime
07:51StartsWithKi see
07:54_atoalso let bindings are lexically scope while thread bindings are dynamically scoped, so you can't even emulate a let binding with a thread binding
07:55_atowhich means that if you close over a thread binding and then exit the binding form it won't work as you'd expect a let binding to
07:56_ato,(binding [inc 5] ((fn [] inc)))
07:56clojurebot5
07:56_ato,((binding [inc 5] (fn [] inc)))
07:56clojurebot#<core$inc__4732 clojure.core$inc__4732@1121f65>
07:56_ato,((let [inc 5] (fn [] inc)))
07:56clojurebot5
07:57StartsWithK,(binding [i 1] ((binding [i 2] (fn [] i))))
07:57clojurebotjava.lang.Exception: Unable to resolve var: i in this context
07:58_atoa thread-binding must be on an already existing var, that's why I used "inc"
07:58StartsWithK,(binding [inc 1] ((binding [inc 2] (fn [] inc))))
07:58clojurebot1
07:58StartsWithK:) your right, this is not let-like
08:03_ato,(((fn [x] (fn [] x)) 4))
08:03clojurebot4
08:04_ato^ you can a closure to implement let
08:04_ato(at the expense of generating a whole bunch of unnecessary anonymous functions)
08:04michaeljaakahello mastas
08:04michaeljaakafast question
08:04michaeljaaka(defn me[ & a ] (if (seq a) true false))
08:04michaeljaakahow to make equivalent with identity
08:04michaeljaaka?
08:05michaeljaaka(defn me[ & a ] (identity (true? (seq a )))))
08:05michaeljaakadoesn't work
08:05Chousukejust (seq a)?
08:05michaeljaaka:D
08:05michaeljaakaehhh, it is time to go out ;D
08:06_ato(defn me [& a] (boolean (seq a))) if it absolutely has to return true/false
08:06michaeljaakaok
08:07michaeljaakayes I wanted to return true or false
08:07michaeljaakabut when I use seq in if
08:07michaeljaakaI should get true/false right?
08:07michaeljaakathe seq won't be evaluated
08:07_atoyes
08:07_atothat's correct
08:08michaeljaakaok, thanks
08:08StartsWithK_ato: thanks, would that be a good way to construct let if trying to create one of thoes crazy metacircular evaluators? where environment would be replaced with normaln clojure namespace?
08:09_atoyeah that'd be one way to do it
08:11_atoalso if you say wanted to write something that converts clojure code to say Python and wanted let to behave like it does in Clojure. In Python a local var is accessible anywhere in the function, not just inside the enclosing form.
08:13StartsWithKfor now what i'll try to do is clojure->clojure with one extra special form so it has to have custom macro expander, i think that will be a good minimal start
08:15StartsWithKwith-local-vars and bindings is not a problem, they realy use push/pop thread-bindings, so there should be no problem
08:23StartsWithKso (fn [] (let [a 1] (println a)) (println a)) -> (fn [] (let [a 1] (println a)) (let [a nil] (println a)) -> convert to python
08:26_atoother way around: (let [a 1] (println a)) -> ((fn [a] (println a)) 1) -> (lambda a: print(a))(1)
08:26_atopython doesn't have a "let"
08:27_atoof course the other way to do it is to keep track of your local environment and do clearing of vars and figure out nesting in the compiler, which is faster at runtime and what I think Clojure's compiler does.
08:28_atobut just turning lets into calls to anonymous functions is a really easy way to implement it
08:44cgrand_ato: thanks for the tip, http://clojars.org/search?q=enlive isn't empty anymore
09:21triyoI tried doing a clean install of swank-clojure and got this error during install -> swank-clojure.el:37:1:Error: Cannot open load file: clojure-mode
09:23triyoclojure-mode is a dependent, which it seem to have installed during install using ELPA
09:25triyoline 37 -> (require 'clojure-mode)
09:28triyohere is my full output of installing swank-clojure via ELPA: http://pastebin.com/m5d7c2d26
09:33_atostupid ELPA :(
09:33_atothat's crazy
09:33_atoit says it compiled it just above, why can't it now find it?
09:33_ato:/
09:33triyo_ato: I am so so so unhappy now :)
09:34triyoignore the smiley
09:34triyoI'll try continue as ELPA says all is installed fine... go figure
09:35_atooh.. well it might be ok actually
09:36_atoI didn't read the output when I installed it, so I could have got the same thing :-P
09:36triyohehe, can you try reinstall again see if you do get it? *just kidding* :)
09:38_atoI just did actually (in a fresh user account)
09:38clojurebota is t
09:38_atogot the same error but for slime instead of clojure-mode
09:38_atoso yeah, looks like that's normal
09:38triyohehe so seems thats ok
09:39_atocompletely blank user: I pasted the ELPA stuff instead *scractch*, evaled it, did M-x package-list-packages, hit "i" on "swank-clojure", pressed "x". Let it download everything. M-x slime. "y" yes to install Clojure. let it download. Got a REPL
09:40_atoso that works ok. That's on regular Emacs 23 under Linux though. I don't have a mac handy to try aquamacs
09:41_atodoes clojurebot like parens or something: (scala)
09:41_atodoes clojurebot like parens or something: (in a fresh user account)
09:41_atohmm... maybe it's random
09:49triyoOn "do you want to install clojure y/n? I got -> "Wrong number of arguments: delete-directory, 2"
09:49triyogrr
09:50triyo_ato: what instructions do you use to install?
09:50triyoI must be doing something wrong
09:53triyoOk, I think I got it....even better, I think I got it running just the way I wish I did in the first place..
09:54offby1([2 3 5 7] 0) => 2, of course. What's an easy way to make ([2 3 5 7] 10) yield nil? I assume I can either handle the IndexOutOfBoundsException, or else perhaps there's some syntax or something that says "If the element isn't present, return this instead". What do y'all recommend?
09:55triyo_ato: I install swank-clojure then I ran swank-clojure-project and pointed to an existing leingen created project I have that has a /lib with all libs including swank-clojure, clojure-lang, etc.
09:55Chousukeoffby1: pass it a second argument
09:55Chousuke,([1 2] 5 :not-found)
09:55clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: PersistentVector
09:55Chousukehm.
09:55triyo_ato: ohh it works 100% now
09:55Chousukeoh well
09:55ChousukeI guess you need to use get then
09:56Chousuke,(get [1 2] 5 :not-found) should work :P
09:56clojurebot:not-found
09:56offby1Chousuke: thanks
09:57carkany idea when the protocols will be somewhat stabilized ?
09:57offby1Chousuke: figured it'd be something easy like that :)
09:57carkthe "new" stuff
09:58Chousukecark: I think the syntax is pretty much decided now.
09:58carkright now i have manu protocol files everywhere with multimethods ... i'd like to convert that to real protocols
09:58cark*many
09:59carkbut i'm a bit shy !
10:14interferon,(defn parse-transactions (txs) (let [records (re-split #"\\r\\^\\r(?m)" txs)](map #(parse-detail (re-split #"\\r(?m)" %)) records)))
10:14clojurebotDENIED
10:14interferonwhen i evaluate that i get an obscure "cannot create iseq from symbol" exception
10:14interferonanyone see anything wrong with it?
10:14carkparameters to your function should be a vector
10:15cark(defn parse-transaction [txs] ...
10:15interferonoh man!
10:15interferoni feel dumb
10:15interferonthanks
10:15interferonused to CL :)
10:15carki still get bitten by that after a year =/
10:24maddisis there a way to do negation? like (!nil? foo), meaning "not nil" ?
10:24interferonmaddis: (not foo)
10:24interferonis there a good clojure debugger? i love slime, but it seems like i can't do much once i hit an error
10:24interferon,(not true)
10:24clojurebotfalse
10:25interferon,(not false)
10:25clojurebottrue
10:25carkyou have println
10:25carkand if you want to get fancy, go with c.c.pprint !
10:25carkseriously : you can use java debugers
10:25maddisoh thanks, of course, stupid me
10:26rhickeyinterferon: Java debuggers work well with Clojure -
10:26interferoni can still see clojure variables and function names in a java debugger?
10:27carkif you like single step hell i guess, i never even tried any debugger with clojure
10:28rhickeyvariables - yes, and function names get a slight but readable mangle. and you can set breakpoints in Clojure code
10:29interferonoh how do i set breakpoints?
10:30interferonand is there a clojure debugger in slime that i'm missing or is that feature not there?
10:30rhickeyinterferon: depends on the debugger - usually just park the cursor on the code
10:31rhickeyinterferon: I don't think Slime debugging works with CLojure as it does with CLs. It presumes an interleaving of the runtime with execution that doesn't exist in Clojure
10:32interferonoh i see what you mean
10:32interferonokay
10:34triyoswank-clojure docs shows that I can keep my CL implementation using: (add-to-list 'slime-lisp-implementations '(sbcl ("sbcl"))) and then running M-- M-x slime which enables me to type the impl name in. However it doesn't have my CL impl, it only has clojure. Am I missing something?
10:35triyoI just wish to run my working CL slime side-by-side with my clojure env
10:35interferonthought you meant something like a "(break)" form
10:37interferon,(clojure.contrib.str-utils/re-split #"x.*b(?s)" "fooxy\nzbbar" )
10:37clojurebotjava.lang.ClassNotFoundException: clojure.contrib.str-utils
10:38interferonwhy doesn't that (?s) modifier make the . match anything?
10:43interferonahh needs to be a the front
10:43interferon,(re-find #"(?s)x.*b" "fooxy\nzbbar" )
10:43clojurebot"xy\nzbb"
10:43interferonstay tune, while i answer more of my own questions
10:55slyrus_speaking of swank-clojure... has there been any progress on making it run with the current slime CVS HEAD?
10:56slyrus_whoops... my window was scrolled back a few screens. we weren't just talking about swank-clojure...
10:56slyrus_oh, yes we were... too early for me.
10:59rsynnottThe slime CVS head tends to be a moving target :)
11:00rsynnottIt might almost make sense to incorporate swank-clojure into the swank project proper, but I suppose the maintainers mightn't want to do that
11:01MikeDevdo you need to say return in clojure?
11:02the-kennyMikeDev: No.
11:02the-kennyThe result of the last form us returned from a function
11:15MikeDevOught one be able to defnine functions with clourebot
11:17the-kennyMikeDev: You can always define inline-functions
11:17the-kenny,(let [myfun (fn [a
11:17clojurebotEOF while reading
11:17the-kennyoop
11:18the-kenny,(let [myfun (fn [a] (inc a))] (myfun 42))
11:18clojurebot43
11:19MikeDevso let's syntax is: let [def] expr
11:20MikeDevin ML it's let def in expr
11:20the-kenny(let [foo 42 bar 23] (list foo bar))
11:20the-kenny,(let [foo 42 bar 23] (list foo bar))
11:20clojurebot(42 23)
11:22MikeDevfor if it's (if (expr) expr expr)???
11:23the-kenny(if (expr) expr else-expr
11:23the-kenny+)
11:24Chousukeactually just (if test-expr then-expr else-expr)
11:24the-kennyMikeDev: You can look at the api-docs on clojure.org.
11:24the-kennyThere are plenty of examples on the site
11:25MikeDevI'm looking on clojure.org and the reference section sucks
11:26the-kennyhttp://richhickey.github.com/clojure/clojure.core-api.html
11:26MikeDevmuch better
11:28Chousukelet is not described very well by its docstring though :/
11:28the-kennyChousuke: let and every other special form too
11:29AnniepooIf some AI oriented person on this list is looking for a modest sized project a nice version of find-doc that had some intelligence would be a cool one
11:29MikeDevyeah that happens too but kenny fixed that 4 me
11:30slyrus_liebke: you're missing a parenthesis in incanter.el
11:31MikeDevcan a function return things of 2 completely diff types
11:31JAS415yes?
11:31alexykliebke: why did project.clj disappear?
11:32offby1is (count x), when x is a list, fast? (i.e., constant-time?)
11:32ChousukeMikeDev: a function can return any descendant of Object currently.
11:32chouseroffby1: yes
11:32chouser,(counted (list 1 2 3))
11:32clojurebotjava.lang.Exception: Unable to resolve symbol: counted in this context
11:32offby1chouser: thanks
11:32Chousukeoffby1: For lists yes, but not for all sequences :/
11:32chouser,(counted? (list 1 2 3))
11:32clojurebottrue
11:33Anniepoo,#([{:tacos "Yes!"} :deconstructionism 7])
11:33clojurebot#<sandbox$eval__5478$fn__5480 sandbox$eval__5478$fn__5480@a6287>
11:33MikeDevfor example, I'm making a function that will take a url arg and if valid, parse it and return a list of certain elements. If it's not a valid URL, I'd want to have an error of some sort. It would be nice to return either an error string or a list of 0 or more elements
11:34liebkealexyk: it is possible I broke the original incanter.el file technomancy contributed, but since I don't use emacs, I wouldn't have noticed. Can you submit the fixed version?
11:34Anniepoowhile you can do that, why not have it throw an exception?
11:34MikeDevbecause I'm stupid and ont know how
11:34liebkealexyk: I removed project.clj until we have a version that can actually build the project
11:34MikeDevthat prob would be best, yes
11:34alexykliebke: that was slyrus :) I'm using TextMate
11:35Anniepooah, then there's no time like the present to learn
11:35MikeDev:)
11:35alexykliebke: so for *using* incanter, just :dependencies [[incanter/incanter "0.9.0"]] is enough in a project.clj?
11:35liebkesorry :)
11:35liebkeslyrus_ can you submit a fixed version of the el file?
11:36MikeDevAnniepoo, plus i have to get this done in a timely manner
11:36liebkealexyk: yes
11:36chouser,(-> "Something failed" Exception. throw)
11:36clojurebotjava.lang.Exception: Something failed
11:36slyrus_liebke: can you be a bit more specific about what you mean by "submit"? e.g. send you an email with a patch?
11:36Anniepoothen use the exception.
11:36alexykliebke: so incanter.jar sucks in all the deps?
11:36Anniepoolike that
11:36MikeDevi might be able to get a job doing this
11:37alexykliebke: I miss fine-grained histogram control of R. E.g. specifying bucket boundaries...
11:37liebkealexyk: patches welcome :-)
11:37MikeDevand stop doing PHP content managed websites
11:37clojurebotwe can't stop here! this is bat country!
11:38Anniepooright now there are a large number of talented programmers who have discovered Clojure, but the message hasn't percolated
11:38liebkethere are a lot of features I'd like to add to the charts library
11:39MikeDevis that exception code above to be considered an expression?
11:39Anniepooto more conservative software devs/cto's/ceo's and so currently there's a shortage of clojure work
11:39Anniepoobut we all feel your pain
11:39alexykliebke: so these JFreeCharts, are they actively under development?
11:40liebkeyep: http://www.jfree.org/jfreechart/
11:40Anniepoojfreecharts are a good thing
11:40liebkei've only scratched the surface of the jfreechart api
11:41Anniepooand would be a great application for a DSL
11:42offby1I've got a loop that's orders of magnitude slower than I'd expect. How might I investigate?
11:42Anniepoo,(import 'java.util.Date)(macroexpand '(.getDay (Date.)))
11:42clojurebotjava.util.Date
11:42carkoffby1 set *warb-on-reflection* to true
11:42carkthen recompile
11:42Anniepoo,(macroexpand '(.getDay (Date.)))
11:42clojurebot(. (Date.) getDay)
11:43Anniepoook, why does that expand to Date. and not (new Date)?
11:43offby1cark: aaaaaahhh.
11:44offby1cark: I'm not sure how to do that, though. I'm currently just loading a file; I don't know how to set the variable before compiling. I doubt it'll suffice to just stick an assignment at the top of the file.
11:44cark*warn-on-reflection* actually
11:44carkyes it will suffice
11:44offby1that too.
11:44offby1oh!
11:44offby1ok, I'll try that
11:45carkif you have no warning, just show us some of your code =)
11:47offby1cark: well, I do have a warning, but it's not blindingly obvious that it's pertinent. So here be the code: http://gist.github.com/249755
11:47offby1the slow loop is around line 35
11:50carkcount on a list is O(n)
11:50carkerr i think
11:50carktry passing in a vector instead
11:50offby1oh!
11:51offby1but ... ,(counted? (list 1 2 3))
11:51offby1,(counted? (list 1 2 3))
11:51clojurebottrue
11:51offby1I thought that implied it was O(1)
11:51chousercount on a PersistentList is O(1)
11:51carkah right, anyways you should test with (seq words)
11:51offby1is that the equivalent to Scheme's (not (null? words))
11:51chouseroffby1: are you using set/union to add a single thing to a set?
11:52offby1chouser: I think so, lemme double-check
11:52carkoffby1 : yes
11:52offby1should I use conj?
11:52chouserI bet that's slow. try conj instead.
11:52chouser,(conj #{1 2 3} 4)
11:52clojurebot#{1 2 3 4}
11:52carkanyways you're passing in a lazy list, not a persistent list (i think)
11:52offby1,(conj #{1 2} 2)
11:52clojurebot#{1 2}
11:52offby1hm
11:53chouseryeah, don't use (zero? (count words)), just (seq words)
11:53cark,(counted? (filter odd? (list 1 2 3 4)))
11:53clojurebotfalse
11:54offby1,(conj #{"x" "y"} "x")
11:54clojurebot#{"x" "y"}
11:54ikitatanyone know why `lein swank` would fail with (use 'clojure.test) in the repl?
11:57carkoffby1 : i wonder why you're not using reduce =/
12:00MikeDev,(re-matches #"<h[1-6]>.*?</h[1-6]>" "<h1>Clow</h1><div><h2>Jure</h2></div>")
12:00clojurebotnil
12:01MikeDevwhy?
12:01MikeDevIt works in perl
12:01offby1cark: probably because I didn't know it existed
12:01carkhehe =)
12:03offby1I stuck (seq words) in instead of (zero?(count words)), but that made the test fail.
12:03ikitat,(re-find #"<h[1-6]>.*?</h[1-6]>" "<h1>Clow</h1><div><h2>Jure</h2></div>")
12:03clojurebot"<h1>Clow</h1>"
12:03MikeDevyeah ok
12:03offby1,(seq? (list))
12:03clojurebottrue
12:03offby1,(seq (list))
12:03clojurebotnil
12:03offby1,(seq (list 1))
12:03clojurebot(1)
12:05alexykliebke: lein deps/repl works fine for an incanter app! nice
12:05offby1cark: what is this =/ of which you speak?
12:06alexykso in lein, as opposed to mvn, you specify a top dependency alone, and all the subdeps are included, apparently
12:07carkoffby1 : err sorry that a smiley
12:08offby1ah
12:08offby1I considered "reduce". Can't remember why I didn't use it
12:08offby1anyway, using (seq words), despite my earlier protestation, works great; thanks.
12:08carkgreat
12:28MikeDevQuestion: does clojure have an html parser?
12:29MikeDevhttp://clojure.org/libraries sez maybe clj-html?
12:30MikeDevbut doesnt look like it
12:30MikeDevupon further review
12:33mikemMikeDev: you could try using a Java library for that (ie: TagSoup)
12:34MikeDevk
12:41chousertagsoup is beatiful, and works well with clojure.xml, clojure.contrib.lazy-xml, and then zip and zip-filter
12:42chouserbeautiful
12:43MikeDevif you had a big tree structure of an html document, how do you easily pull out certain tags that could be arbitrarily deep
12:45the-kennyMikeDev: Xpath
12:45the-kennyMikeDev: There's also something in contrib, wait
12:45the-kennyc.c.zip-filter
12:45the-kennyThat's almost xpath, but in clojure-style
12:46MikeDevso i have to download tagsoup right?
12:47MikeDevwouldnt be standard right?
12:48the-kennytagsoup?
12:51MikeDevyes
12:52the-kennyWhat's that?
12:52MikeDevI hope this is fine: http://home.ccil.org/~cowan/XML/tagsoup/tagsoup-1.2.jar
12:52KirinDavecgrand-r1c: Hey, are you around?
12:53MikeDevcan u just use any java class with clojure?
12:53the-kennyMikeDev: Yes
12:53MikeDevneet
12:54the-kennyMikeDev: But you won't need tagsoup.jar or any other external library to use c.c.zip-filter. It's written in clojure and integrated in contrib
12:55the-kennyMikeDev: Clojure's Java-Interop: http://clojure.org/java_interop
12:56MikeDevkenny: zip-filter can parse HTML and not just XML
12:56MikeDev?
12:56the-kennyMikeDev: xhtml is valid xml. "normal" html should be xml too
12:56MikeDevhtml 4 strict isnt
12:56MikeDev<br>
12:57the-kennyhm... I would give it a try
12:57the-kennyMaybe it can handle the special cases of html
12:58MikeDevbear in mind that all i need to do is process header tags. dont care about anything else. the only reason I ask about html parsers is that the guys in #perl are saying I suck if I dont use an html parser
12:59MikeDevi think I will just use re's
12:59MikeDevparticularly over something more complicated that might not work anyway
13:11MikeDevSo if you do (?'Name'pattern) in a re, you are supposed to be able to recall it in the pattern later with \k'Name' ?
13:11danlarkinjava regexes doen't support named groups
13:12MikeDevi see
13:13KirinDaveAhah, got enlive working. :\
13:15KirinDaveI gotta patch that.
13:15KirinDaveit shouldnt throw a null pointer exception for a missing file.
13:15KirinDaveThis is the problem with direct code generation macro systems. People get so caught up in the codegen logic that it gets difficult to add solid error handling.
13:16KirinDaveclj needs MBE.
13:19interferoni'm having a hard time working with a data structure i've set up. basically, i have a map of vendor names to vendor structs. each vendor struct has an :inventory key that contains a list of inventory structs, each of which contains a name and a quantity
13:20interferonif i want to adjust the quantity of one product for one vendor, my code becomes somewhat convoluted
13:20interferonare there any guides to working with complex structures like this?
13:20arohnerKirinDave: what is MBE?
13:20chouserMikeDev: tagsoup parses broken html pages as if they were valid xml, so you can feed that into clojure.xml/parse or clojure.contrib.lazy-xml
13:21carkinterferon : go bottom-up ... first write functions that work with your inventory structs
13:21carktaking the struct as first parameter
13:21interferonhere's what i have now http://paste.lisp.org/display/91655
13:21carkthe you can go one level up
13:21carkthen*
13:22KirinDavearohner: PLT Scheme has a different macro system that many people have adopted
13:22KirinDavethere are even CL libraries for it
13:22KirinDaveIt's called "Macro By Example"
13:22KirinDaveOr "pattern macros"
13:22KirinDavehttp://docs.plt-scheme.org/guide/pattern-macros.html
13:22KirinDaveIt also is a good way to encapsulate truly hygienic macros.
13:23arohnerinterferon: probably the biggest lesson I've learned about writing clj code is to build composable functions. Small functions with a clearly identified purpose
13:23carkinterferon : so when you want to go a level up you can use update-in, using your lower level functions
13:24arohnerinterferon: well designed functions play nicely with map, filter, reduce, etc
13:24arohneror whatever the appropriate core functions for your datastructure is
13:24interferonis update-in built-in?
13:25arohneryes
13:26arohner,(doc update-in)
13:26clojurebot"([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."
13:26carkof course it's not always that simple... but that should get you going
13:27arohnerKirinDave: thanks. this is probably the first documentation for syntax rule that I've ever understood
13:28carkyou're using merge when assoc should do the work, or assoc-in or update-in
13:30carkin the end you should have an api such that you can (update-vendor "paul" add-inventory "nasal spray" 2)
13:30carkor something like it =)
13:31interferoncan someone explain how -> works?
13:33cark,(-> "hello" count inc)
13:33clojurebot6
13:33cark,(-> "hello" count inc (* 5))
13:33clojurebot30
13:34cark,(-> {:a 1 :b {:c 2 :d 3}} :a :d)
13:34clojurebotnil
13:34cark,(-> {:a 1 :b {:c 2 :d 3}} :b :d)
13:34clojurebot3
13:35cark,(:d (:b {:a 1 :b {:c 2 :d 3}}))
13:35clojurebot3
13:35dulanovvah, (count (range 100))
13:35dulanov(count (range 100))
13:35dulanov,(count (range 100))
13:35clojurebot100
13:36interferonso it applies functions in a chain?
13:36KirinDavearohner: It's not new. PLT Scheme has fabulous documentation, they have for years.
13:36cark,(doc ->)
13:36clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
13:36MikeDevsuppose you *know* that the arg to function will be a list of which you want the second element. can u pattern match on that?
13:36MikeDevin ML you can do fun Blah a::list
13:37carkinterferon : you can use macroexpand to see what a macro does
13:37KirinDaveMikeDev: You mean, checking type? Or deconstructing objects in the list?
13:37MikeDevprobably deconstructing
13:37KirinDaveMikeDev: Because then it's no and yes.
13:38MikeDevin ML you can do fun blah a | fun blah a::list
13:38MikeDev| fun blah nil
13:38cark,((fn [[_ a]] (inc a)) 10)
13:38clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: Integer
13:38cark,((fn [[_ a]] (inc a)) (list 10 11))
13:38clojurebot12
13:38interferonupdate-in is very helpful - thanks guys
13:39MikeDevso can I do fn [a b] = b
13:40the-kennyMikeDev: Looks like haskell
13:40carkthat's what i showed or did i misunderstand your question ?
13:41MikeDevi guess
13:42arohnerKirinDave: I hadn't seen PLT's documentation before. I always saw links to either R5RS or some random blog post. Those weren't very good.
13:43arohnerlisppaste8: url
13:43lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
13:43MikeDevcark, no yours is a list of 2 i have a list of n which are lists of 2
13:43MikeDevi guess i need map
13:43lisppaste8arohner pasted "weak reference" at http://paste.lisp.org/display/91658
13:44arohnerweak-reference seems useful. I wonder if it is worthy to go into contrib
13:45MikeDev,(re-seq #"<h[1-6]>(.*?)</h[1-6]>" "<h1>Clow</h1><div><h2>Jure</h2></div>")
13:45clojurebot(["<h1>Clow</h1>" "Clow"] ["<h2>Jure</h2>" "Jure"])
13:45MikeDevwant the 2nd args
13:45MikeDevis that a list of lists?
13:45the-kennyMikeDev: Yes
13:45MikeDeva list of vectors?
13:46the-kennylist of vectors
13:46the-kennynow just (map second your-result)
13:46MikeDev,(map (fn [[_ b]] (b)) (re-seq #"<h[1-6]>(.*?)</h[1-6]>" "<h1>Clow</h1><div><h2>Jure</h2></div>"))
13:46clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
13:46MikeDevThat is what I thought would work
13:46MikeDev,(map (fn [_ b] (b)) (re-seq #"<h[1-6]>(.*?)</h[1-6]>" "<h1>Clow</h1><div><h2>Jure</h2></div>"))
13:46clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--5653$fn
13:47the-kennywhy (b)
13:47the-kennyyou try to call the function in b, but b holds a string
13:47the-kennyoh.. and you can just use second
13:47MikeDevthought that's how fn's are defined syntactialy
13:47the-kenny,(map second (list ["foo" "bar"] ["bla" "foobar"]))
13:47clojurebot("bar" "foobar")
13:47the-kennyNo
13:48the-kenny,((fn [_ a] a) 42)
13:48clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--5668$fn
13:48the-kenny,((fn [_ a] a) 42 23)
13:48clojurebot23
13:48the-kenny,((fn [_ a] (a)) 42 (fn [] 23))
13:48clojurebot23
13:48the-kenny,("foobar")
13:48clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
13:48MikeDevseond will work
13:49the-kennyYes
13:49solussdis there a function/macro that prints the code for a function?
13:49the-kennyand take a look at the syntax for (fn)
13:49solussde.g. (show-code loop)
13:49the-kennysolussd: I think so. Somewhere in clojure.contrib
13:49the-kennyrepl-utils iirc
13:49solussdthanks
13:50the-kenny(use 'clojure.contrib.repl-utils)
13:50arohnersource in repl-utils
13:50the-kenny,(use 'clojure.contrib.repl-utils)
13:50clojurebotjava.lang.ExceptionInInitializerError
13:50solussdyep. found it
14:06MikeDevIs there any kind of filter function which will go thru a list, apply a function you create to each item, and return a list of only the items for which your function returned true?
14:07solussdyes, filter does that
14:07the-kennyMikeDev: (first (filter ...))?
14:07the-kennyOh, I read "only one item"
14:07the-kennysorry
14:07MikeDevonly *the* items
14:07MikeDevdidnt see filter in cor
14:07MikeDevcore*
14:07solussd,(filter #(= 3) [1 2 3 4 5 6 3])
14:08clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--5698$fn
14:08MikeDevno filter: http://richhickey.github.com/clojure/clojure.core-api.html
14:08solussd,(filter #(= 3 %) [1 2 3 4 5 6 3])
14:08clojurebot(3 3)
14:08the-kenny,(doc filter)
14:08clojurebot"([pred coll]); "
14:08MikeDevthat's fine, thx
14:09KirinDaveMan
14:09KirinDaveWtf
14:09KirinDavehttp://github.com/richhickey/clojure-contrib/blob/5055f41c8bc99747392396d622f17f723470858e/src/clojure/contrib/http/agent.clj#L306
14:09KirinDave,(#{:foo :baz} {:foo 1 :bar 2 :baz 3})
14:09clojurebotnil
14:09KirinDaveI'm confused.
14:10offby1(printf "foo") goes to stdout. How do I print to stderr?
14:10MikeDevprintf 2 "foo"
14:10MikeDev(maybe)
14:10arohner,(#{:foo :baz} :foo)
14:10clojurebot:foo
14:10arohner,(#{:foo :baz} :bogus)
14:10clojurebotnil
14:10KirinDaveAhh, I see
14:10arohnerthat's checking whether an item belongs to a set
14:10KirinDaveYeah, I was reading it backwards
14:10KirinDavelike, "Can you union two keys with a set for access into a hash?
14:10solussda set is function
14:11KirinDaveThat'd actually be pretty cool.
14:11offby1dynamically bind *out*, maybe
14:11arohneroffby1: yeah
14:11arohner(binding [*out* error-stream] (println ...)
14:12MikeDevif there's a second, is there a third?
14:12arohnerI think there's a name for stderr, but I don't remember what it is
14:12arohneroh, *err*
14:12arohnerduh
14:12offby1System/err, I'd guess
14:12arohner,(doc *err*)
14:12clojurebot"; A java.io.Writer object representing standard error for print operations. Defaults to System/err, wrapped in a PrintWriter"
14:14MikeDev,((fn [z y x] x) ["a" "b" "c"])
14:14clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--5772$fn
14:14offby1,(print "hey")
14:15clojurebothey
14:15offby1,(binding [*out* *err*](print "hey"))
14:15clojurebotnil
14:15clojurebothey
14:15offby1odd, the output vanishes when I try it :-|
14:15arohnerwhere are you trying it?
14:16solussdMikeDev, I think you want 'apply'
14:16arohnersomething in your environment could be ignoring/ dropping stderr
14:16dulanov,(.toString *out*)
14:16clojurebot""
14:16solussd(apply (fn [z y x] x) ["a" "b" "c"])
14:16dulanov,(class*out*)
14:16clojurebotjava.lang.Exception: Unable to resolve symbol: class*out* in this context
14:16solussd,(apply (fn [z y x] x) ["a" "b" "c"])
14:16clojurebot"c"
14:17arohnerstupid keyboard shortcuts
14:17solussdor you could just pass the vec as args:
14:17arohnerI hate that emacs shortcuts typed into another other program does bad stuff
14:17arohner* into any other program
14:17solussd,((fn [z y x] x) "a" "b" "c")
14:17clojurebot"c"
14:18dulanov,((fn [_ _ x] x "a" "b" "c")
14:18clojurebotEOF while reading
14:18dulanov,((fn [_ _ x] x) "a" "b" "c")
14:18clojurebot"c"
14:18the-kennyarohner: I really miss paredit in almost every other program... I keep forgetting to close braces
14:18solussdparedit is a pain though if you want to rearrange things...
14:19dulanov,(#(%3) "a" "b" "c")
14:19clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
14:19arohnerthe-kenny: I'd be happy with ctrl-N, ctrl-P, ctrl-W not doing destructive things or popping up dialog boxes
14:19the-kennysolussd: "Rearrange"?
14:19dulanov,(#('%3) "a" "b" "c")
14:19clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: Symbol
14:19arohneror leaving chat rooms...
14:20arohnerdulanov: #() is not the same as fn
14:20solussdthe-kenny: in emacs, using paredit always balances your parens, If I want to kill the end of a line (with closing parens) and maybe yank it somewhere else, it seems to get in the way.
14:21Chousukesolussd: use C-k to kill s-exps instead :/
14:21solussdthe-kenny: but I only used it for maybe an hour before getting frustrated with it, so what do i know...
14:21the-kennysolussd: hm.. I understand what you mean
14:21MikeDevhey I fed a bad thing to closurebot how do I cancel it
14:21MikeDevnow it just hangs for me
14:21Chousukesolussd: it makes no sense to delete everything to the end of the line if it breaks the s-exp structure. :)
14:21the-kennyBut I like it for lisp-development. As Chousuke said, it will yank the sexp instead
14:22MikeDevnevermind, it' thinkgs
14:22solussdChousuke: i'm sure I'd learn to work with it if I gave it enough of a chance. It would probably just spoil me though. :)
14:22Chousukesolussd: yeah, it does :P
14:22the-kennyIt always keep the sexp-tree valid :)
14:22Chousukesometimes you can end up with mismatching parens though :/
14:23Chousukebut then it's not too difficult to force emacs to insert them
14:26the-kennyagh...
14:26solussdwhich git repository?
14:27Chousukethe-kenny: just delete the commit :)
14:27the-kennyChousuke: ..or change the password ;)
14:27Chousukewell, whichever.
14:27the-kennyI think I already committed it with the initial commit... It's easier to change it
14:28Chousukeheh
14:28Chousukeyou could also use git's history filtering features!
14:29ChousukeI like how nothing is sacred in git :P
14:29the-kennyI could also shoot myself in the foot :p
14:29Chousukeyou can change anything at any time and it's not git's problem if that breaks things.
14:39MikeDevhow do you cast a string to a char sequence?
14:39cark,(seq "blah")
14:39clojurebot(\b \l \a \h)
14:39MikeDevty
14:41JAS415the-kenny needs to use oauth :-P
14:42the-kennyJAS415: hm.. Maybe I'll have a look at oauth ;) But I have to refactor some files before that
14:44eno__how do you get the key of a map with max value?
14:44eno__e.g. {:three 3 :five 5 :four 4}, I want to get :five
14:51j3ff86eno, i have a function that does that, let me get it
14:53j3ff86(apply max-key second (indexed coll))))
14:53eno__j3ff86: thx
14:54j3ff86(apply max-key second (indexed coll))
14:56j3ff86actually i dont know if it works for symbols
14:56eno__not quite
14:58eno__,(let [m {:three 3 :five 5 :four 4}] (apply max-key #(val (second %)) (indexed m)))
14:58clojurebot[1 [:five 5]]
14:58eno__getting close
15:00eno__,(let [m {:three 3 :five 5 :four 4}] (key (second (apply max-key #(val (second %)) (indexed m))))
15:00clojurebotEOF while reading
15:01eno__,(let [m {:three 3 :five 5 :four 4}] (key (second (apply max-key #(val (second %)) (indexed m)))))
15:01clojurebot:five
15:10MikeDevWhat is :blah all about?
15:11Chousukeit's a keyword
15:11Chousukea symbol which evaluates to itself.
15:12Chousukehmm
15:12Chousuke,(map identical? [:foo 'bar] [:foo 'bar])
15:12clojurebot(true false)
15:12MikeDevHey keyword, why dont you go evaluate yourself?
15:12JAS415the-kenny: i used this when i did oauth in clojure: http://code.google.com/p/oauth-signpost/
15:14the-kennyJAS415: I'll bookmark this. Thanks :)
15:15ska2342Chousuke: (identical 'bar 'bar) is false, because quote creates a new symbol every time.
15:15ska2342..identical?..
15:16Chousukeska2342: yeah
15:17ska2342Chousuke: do you have any idea, how to access a symbol later again? E.g. to retrieve metadata associated with that sym?
15:18chouserthe reader creates a new symbol every time, whether it's quoted or not
15:18StartsWithK,(let [m {:three 3 :five 4 :four 4}] (-> m seq (apply max-key second) first))
15:18clojurebotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap$Seq cannot be cast to clojure.lang.IFn
15:18StartsWithK,(let [m {:three 3 :five 4 :four 4}] (->> m seq (apply max-key second) first))
15:18clojurebot:four
15:18StartsWithKups
15:19chouser,(apply = ((juxt first second) '(:foo :foo)))
15:19clojurebottrue
15:19chouser,(apply = ((juxt first second) '(foo foo)))
15:19clojurebottrue
15:19chouser,(apply identical? ((juxt first second) '(foo foo)))
15:19clojurebotfalse
15:19chouser,(apply identical? ((juxt first second) '(:foo :foo)))
15:19clojurebottrue
15:20ska2342chouser: I already tried to get an answer to this from the groups, but w/o success. If I create a symbol and add metadata to it, how can I access the metadata of /that symbol/ later (not a copy of it attached to a Var)?
15:23MikeDevwhat is string concat?
15:23MikeDev,(. "a" "b")
15:23clojurebotjava.lang.IllegalArgumentException: Malformed member expression
15:23MikeDev,(+ "a" "b")
15:23clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
15:24eno,(str "abc" "def")
15:24clojurebot"abcdef"
15:24MikeDev,(str "a" "b")
15:24clojurebot"ab"
15:24MikeDevk
15:24ska2342,(str "first" "second")
15:24clojurebot"firstsecond"
15:26ekontsevoyhttp://clojure.org/libraries says "There are many libraries for Clojure that complement what is in the Clojure core" and then goes a long list of clojure.contrib.* pacakges, but where's a reference for aforementioned "Clojure Core"? Or should I use verbose Java SE for everything?
15:27dulanovhttp://richhickey.github.com/clojure/
15:27dulanov?
15:27dulanovAPI section
15:28ekontsevoyOh! Thanks
15:29ska23421chouser: is my question concerning symbols and metadata too stupid? Am I missing something easy and important?
15:31hiredman,(meta (with-meta 'foo {:bar 1}))
15:31clojurebot{:bar 1}
15:31hiredman,(identical? 'foo 'foo)
15:31clojurebotfalse
15:32ska23421hiredman: and how would you access the metadata of 'foo later?
15:32hiredmankeep 'foo around
15:32hiredman(def a 'foo)
15:33hiredman(let [a 'foo])
15:33hiredmanetc
15:34hiredmanif that doesn't work for your, then your data isn't a good fit for metadata
15:34ska23421hiredman: actually I don't need that functionality. Just trying to grok metadata attached to symbols
15:36hiredmansymbols are not interned, so a 'foo somewhere and a 'foo somewhere else in code don't yield the same object
15:37ska23421hiredman: OK. What happens to the metadata of (def #^{:context "Symbol"} my-symbol "What ever value")
15:37ska23421Is only copied once from the symbol 'my-symbol to the Var with that name or is it still hanging around and accessible somehow?
15:38hiredmanit is only copied if you use def
15:38MikeDevhow to comment a line?
15:38MikeDev/
15:39MikeDev///
15:39hiredman;
15:39the-kenny;
15:39MikeDevk
15:39hiredman,;comment
15:39clojurebotEOF while reading
15:39ska23421hiredman: consider (def #^{:c "sym"} mysym #^{:c "val"} [1 2 3])
15:40ska23421{:c "sym"} is nowhere to be found later, or?
15:40hiredmanyou don't retain a reference to mysym, so the object is lost a long with it's metadata
15:40hiredmanbut def copies the metadata to the var named by mysym
15:41ska23421hiredman: ^mysym --> {:c "val"}. No copy here.
15:41hiredmanthat is not the var
15:41hiredman#'mysym is the var
15:42hiredmanmysym is resolved to the three element vector
15:42hiredmanwhich has the metadat {:c "val"}
15:42hiredman,+
15:42clojurebot#<core$_PLUS___4745 clojure.core$_PLUS___4745@120c359>
15:42hiredmanvs.
15:42hiredman,#'+
15:42clojurebot#'clojure.core/+
15:42ska23421hiredman: hang on, need some REPLing :-)
15:43hiredman,(meta +)
15:43clojurebotnil
15:43hiredman,(meta #'+)
15:43hiredmanclojurebot: are you kidding me?
15:44clojurebot{:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 654, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$fn__4742 clojure.core$fn__4742@552a98>, :doc "Returns the sum of nums. (+) returns 0."}
15:44clojurebotYou will not become skynet
15:44the-kennyclojurebot: No, clojurebot will become skynet
15:44clojurebotclojurebot will become skynet
15:45the-kenny:)
15:48interferonis there a function that checks to see i a sequence contains an object, e.g. (contains [1 2 3] 2) => true
15:48hiredman,(.contains [1 2 3] 2)
15:48clojurebottrue
15:49hiredman,(some #{2} [1 2 3])
15:49clojurebot2
15:49interferondoesn't work on sets
15:49interferonah some is better
15:49hiredmanuh
15:49hiredmanare you sure?
15:49chouser(#{:a :b :c} :b)
15:49hiredman,(.contains #{1 2} 2)
15:49clojurebottrue
15:49chouser,(#{:a :b :c} :b)
15:49clojurebot:b
15:50interferon:)
15:50hiredmanclojure's collections are all java Collections and .contains is a java Collection method
15:51ska23421wow, this almost answers my questions concerning contains? for lists in the group. Good day today: to long standing questions seem to go away. Thanks
15:52ska23421(I still think contains? should do something on lists other than returning false all the time)
15:53hiredmanlists don't have keys, so a list won't have the key you are looking for
15:53slyrus_liebke: is it your intent that folks using incanter should be using the bundled clojure and clojure-contrib?
15:53interferoni find the use of sets as functions a little confusing, so it's good to know that contains? is a function
15:54ska23421hiredman: contains? even works on strings and arrays
15:54ska23421,(contains? [1 2 3] 3)
15:55clojurebotfalse
15:55ska23421It is a confusing function, isn't it?
15:57the-kennyIt is
15:57interferon,(contains? '(1 2) 1)
15:57clojurebotfalse
15:58the-kenny,(doc contains?)
15:58clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
15:58interferonthat is an offensive function
15:58ska23421interferon: it will *always* return false if fed a list
15:59ska23421,(contains? "hello" \e)
15:59clojurebotfalse
15:59ska23421,(contains? "hello" 2)
15:59clojurebottrue
16:00ska23421OK, in line with docs. Confusing nevertheless. And just nothing implemented for lists.
16:01hiredmanthe majority of your "lists" are lazy sequences regardless
16:01hiredmanwhich means there would have to be a non-lazy linear time search
16:02MikeDevhttp://pastie.org/private/5shvcyia8dnzowg7qwldw
16:02MikeDevI have no idea what that error even is
16:03hiredmanand your code is unreadble
16:03hiredman~style
16:03clojurebotstyle is http://paste.lisp.org/display/81021
16:03danlarkinoh god
16:03ska23421hiredman: I agree that a linear non-lazy search would be neccessary if really searching for an element == the key. The index-bases lookup would be O(1) for lists, so at least that would be possible.
16:03danlarkinhurts my eyeballs!
16:04hiredmanMikeDev: and you didn't paste the exception (as far as I can tell) so no one can help you
16:04MikeDevhttp://pastie.org/private/gpd3vq1xhl8de9holniagw
16:04MikeDevoh sorry
16:04hiredmanand camelcase has got to go
16:05arohnerany clojuresql people online?
16:05hiredmanfoo-bar vs fooBar
16:05arohnerthe clojureql wiki link is broken
16:06MikeDevI dont use camelcase
16:06MikeDevso np
16:07ChousukeWhat's that HeadingResultsToTable called then? :/
16:07Chousukeshould be heading-results-to-table
16:07hiredmanor heading-results->table
16:08MikeDevhttp://pastie.org/private/dyr2o1fg0ncjvklbacvaxw
16:08MikeDevTry that
16:08MikeDevIt's got the exception and code
16:08Chousukealso you should learn out of the habit of putting the closing parens on their own lines.
16:08Chousukeno-one does that.
16:08MikeDevIt's not camelcase
16:08MikeDevand no thanks
16:08Chousukeso your code will just look different from everyone else's
16:09MikeDevcamelCase
16:09MikeDevMyCase
16:09danlarkinaaaaand gross
16:09ChousukeYourCase is just as bad :P
16:09hiredmanso you don't want other people to be able to read your code and help you?
16:09MikeDevno, camelCase doesnt scale
16:09hiredman
16:09danlarkintroll alert!
16:09MikeDevI can use all_lower, FirstLetter, and ALL_CAPS
16:10hiredmanall-lower
16:10ChousukeClojure has a few exceptions to the foo-bar style though
16:10Chousukenamely, most java stuff
16:10Chousukebut it seems it's also okay to name protocols as FooProtocol
16:11ska2342MikeDev: you probably use the case to denote something? Scope, type?
16:11MikeDevwell, in object oriented langs, yes
16:11hiredman~def slurp*
16:11ska2342MikeDev: which Clojure is not
16:11Chousukeanyway, you won't see that style used in anything but newbie code.
16:11Chousukeso you shouldn't use it either :)
16:12MikeDevBut I always use FirstLetter with functions
16:13hiredmanMikeDev: you are passing slurp* nil
16:13carkare you not able to adapt to language conventions ?
16:13carkwhen in rome act as a roman
16:13MikeDevI may have to to get paid
16:13ChousukeMikeDev: You'll learn out of that habit if you keep using clojure though.
16:13MikeDevhiredman, thx
16:13MikeDevo i c
16:13hiredmanMikeDev: in the future, if you need help, please consider the poor brain of the person who has to read your code
16:13MikeDevyeah I gotta catch that
16:14ChousukeMikeDev: you also indent way too much. Two spaces is just fine for lisp
16:14hiredmaninstead of being a jerk and saying "this is how I write it!"
16:15Chousukelisp code tends to nest quite a lot so if you use excessive indentation it's going to look awful
16:15MikeDevwell i use tab. cant u change it to be = to 2 spaces?
16:15patrkrisMikeDev: and you don't have to worry about having a lot of end-parens on one line if you have a decent editor
16:16technomancywell you could make everyone who reads your code change their tab stops, or you could just do it right in the first place.
16:16hiredmanrainbow parens!
16:16ChousukeMikeDev: 2 spaces is pretty much universal accross all lisp dialects.
16:16ChousukeMikeDev: it's not like with C or Java where everyone has their own indentation preference.
16:16Chousukeacross*
16:17ska2342I never indent my code. Emacs does :-) C-M-q
16:32meeany vim users? how do you automatically format your code? is there a standalone code formatter like perltidy for clojure?
16:33hiredmanthat is an excellent qquestion to which I have no answer
16:33meesearching turned up this, which is hilarious (read the contents of the Command(s)) http://www.flickr.com/photos/manjilab/4097992719/
16:34hiredman
16:35Chousuke:P
16:48LauJensenEvening gents. I'm trying to call a C lib via clojure-jna and documentation is a little scarce. I believe the function takes an argument of the by BSTR and returns a Long. How do I call passing a BSTR?
16:53technomancymee: hah; nice
16:57MikeDevis there a good example of exception catching?
16:59the-kennyMikeDev: It's pretty straightforward if you know the syntax: http://clojure.org/special_forms#toc12
17:02MikeDev(catch classname name expr*)
17:03the-kennyInside a (try), yes.
17:03MikeDevwhat are classname and name
17:05ChousukeMikeDev: NullPointerException somename
17:05Chousukethe name is arbitrary. it's used to refer to the exception itself
17:06the-kennylisppaste8: url
17:06lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
17:06MikeDevhow did you get NullPointerException?
17:06lisppaste8the-kenny pasted "try-catch-example" at http://paste.lisp.org/display/91665
17:06the-kenny(Bad indent, but there's an example)
17:07the-kenny(the whole thing is sent to an agent, so [] is there to set the new state of the agent)
17:08prhlavaAre questions about 1.1-alpha considered here or I should wait for the release?
17:09MikeDevif they consider my questions, they'll probably consider yours
17:09the-kennyprhlava: Just ask ;)
17:09prhlava:-) OK
17:09prhlavaI have a simple "skeleton" application which uses http://www.gridgain.com/ - free cloud platform - Clojure 1.0 works, 1.1 - does not - class not found. No other change, but switched clojure version
17:10prhlavaall points to clojure.lang.RT
17:10prhlava(the gridgain uses remote class loader and the app fails only when more than 1 node is started)
17:12michaeljaakawhy the contrib APi was taken from clojure.org?
17:12michaeljaakait was very usefull
17:12michaeljaakanow again it is hard to find the doc
17:13michaeljaakaand link under API was replaced from old clojure.org/api
17:17prhlavaThe application works with clojure 1.0 on multiple nodes - no problem. With clojure 1.1 - the remote node fails to load a clojure class: "core_init".
17:19prhlava(back in 5 minutes)
17:20MikeDevthx all. im tired
17:26prhlavahmm, otoh, it is quite possible that gridgain class loader does something not quit right :-(
17:26prhlavawhat is the main function of clojure.lang.RT?
17:31technomancyclojure.lang.RT does basically everything
17:31technomancyRT stands for Runtime
17:32prhlavatechnomancy: :-)
17:33Chousukeprhlava: it implements core functions in Java for performance/bootstrapping reasons as far as I can tell.
17:34prhlavaI am just looking at the RT, it is failing at: at clojure.lang.RT.doInit(RT.java:406), that line does load("clojure/core").
17:35Chousukeprhlava: is the code AOT-compiled?
17:35Chousukeprhlava: if it's AOT-compiled for 1.0, it probably won't work with 1.1
17:37prhlavaChousuke: yes, it is AOT compiled (and I did AOT re-compile with 1.1)
17:37prhlava(before running with 1.1)
17:37Chousukehmm :/
17:42leafwanybody knows of a java-only persistent list with structural sharing?
17:42leafwbeing stuck in java world with a clojure view can get hard
17:44arohnerleafw: clojure.lang.PersistentList?
17:45arohneror do you mean without loading clojure.jar?
17:45leafwarohner: I'd use it, but I suspect it may disappear in future clojure releases
17:45arohnerwhy is that?
17:45leafwand it depends on a lot of cthe clojure.jar
17:45leafwarohner: clojure-in-clojure project.
17:45Chousukeleafw: type everything as IPersistentCollection then
17:45Chousukeor whatever interface there is
17:46Chousukethose most likely will stay
17:46arohnerright. the implementation might change, but I'd be very surprised if rhickey dropped java interop with a persistent list
17:46leafwChousuke: ok, so then I should just copy the whole class and freeze it in time
17:46leafwand use the clojure.jar for the interfaces only
17:47arohnerwhy do you need to copy it?
17:47leafwis that a horrible idea? I kind of think that it is. I wish for a proper package like java.util.concurrent.* but for persistent collections
17:48arohnerclojure's list implements j.u.list and j.u.collection
17:48LauJensenEvening gents. I'm trying to call a C lib via clojure-jna and documentation is a little scarce. I believe the function takes an argument of the by BSTR and returns a Long. How do I call passing a BSTR?
17:48arohnerrun (ancestors (class (list 1 2)))
17:49leafwarohner: I know, I know
17:49arohnerLauJensen: what is BSTR? byte string?
17:50LauJensenI don't know, I've never come across it in Java
17:50arohnerLauJensen: http://markmail.org/message/ypuginjtwdvqc6do#query:java%20JNA%20bstr+page:1+mid:mpoiqq36yxdnbgy2+state:results
17:51LauJensenarohner, that looks like the stuff, thanks a lot
17:51LauJensen'night all
17:52leafwby the way the IPersistentList .containsAll(Collection col) function is ... weird: returns col.isEmpty()
18:01prhlavaThank you all, and good night...
18:06arohnerlisppaste8: url
18:06lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
18:07lisppaste8arohner pasted "untitled" at http://paste.lisp.org/display/91668
18:07arohnerany ideas why that's blowing up?
18:09arohneroh right, the arities are different
18:10arohnerthat's a little confusing
18:10clojurebota is t
18:10ataggartjust started playing with protocols about 15 mins ago
18:11Chousukehm
18:12arohnerit'd be nice if there was a convention or something for that
18:12arohnerlike _
18:13Chousukethere was a lot of discussion about whether there should be an explicit "this"
18:15arohnerI just want the arity on the protocol and deftype to match
18:15ataggartah just firgured out what you're talking about
18:15ataggartyeah that's a bit weird
18:16ataggartperhaps it could be solved with a better warning?
18:17ChousukeI think things ended up so that 'this' is explicit, but can be left out, in which case you have no way to refer to it.
18:23ataggartok, I'm confused. What was the arity problem above?
18:25arohnerif you define a protocol method with an arity of (method [dispatch-type foo bar]), then when making a deftype implement the protocol, the arity must be (method [foo bar])
18:25arohners/arity/signature/
18:27arohneris there a clean, generic way to update a nested map and then return the root of the tree?
18:27ataggartupdate-in
18:28arohneryeah, but my leaf node is a set rather than a map
18:28ataggartjust have the fn return a modified set
18:29arohnernm, I was reading it wrong
18:29arohnerthat might do what I want
18:29_ato(update-in {...} [:foo :bar] conj thing-to-add-to-set)
18:29arohnerperfect. thanks
18:29ataggartah and I see my confusion with defprotocol. I thought the symbol for the instance was specified in the deftype implementation.
18:30ataggartseems weird to only have it specified in the defprotocol.
18:30Chousukeit can be specified in deftype as well
18:30Chousukeor hm
18:31ataggartdoes that mean if I have a deftype that reifies multiple protocols, there could be multiple symbols referencing the instance object?
18:31ChousukeI'm not sure how the new syntax works, anymore :P
18:32Chousukeah, right. (deftype Foo [a b c] :as thisname (blah [] ...))
18:32arohnerand using :as doesn't change the method signatures, right?
18:33Chousukecorrect
18:35ataggartso then why did that code not work? both the arglists have the same arity
18:36ataggartclearly I'm not grokking this yet
18:36arohnerwhy did my pasted code not work?
18:36ataggartya
18:36arohnerbecause my deftype implementation needed one fewer argument
18:37ataggartyeah, I'm just trying to figure out why that's the case. All of the examples on the wiki use the same number of args
18:38Chousukesame hm?
18:38ataggart(defprotocol P
18:38ataggart (foo [x])
18:38ataggart (bar-me ([x] [x y])))
18:38ataggart (deftype Foo [a b c] [P]
18:38ataggart (foo [x] a)
18:38ataggart (bar-me [x] b)
18:38ataggart (bar-me [x y] (+ c y)))
18:38Chousukethat's not right.
18:38Chousukethat's out of date
18:38ataggarthttp://www.assembla.com/wiki/show/clojure/Protocols
18:38arohnerthat example is out of date. Try that in the repl
18:38ataggartahh k
18:39Chousukelook at the datatype lpage.
18:40ataggarttime for (doc defprototype)
18:41ataggarterm defprotocol
18:47the-kennytechnomancy: Is there a nice way to use defprotocol etc. with leiningen?
18:48ataggartI'm sure Rich has a good reason for it, but that defprotocol and a called method have a different number of args from the deftype impl is odd.
18:48ataggarte.g., http://paste.lisp.org/display/91669
18:48technomancythe-kenny: sure; just use the clojure version number from the "new" branch
18:49technomancyI haven't done it myself, but that branch is being built regularly on build.clojure.org, so there shouldn't be any tricks necessary
18:51the-kennytechnomancy: hm.. what's the version number?
18:51the-kennyOr: Where can I find it?
18:54_atodoesn't look like it's actually being put in the snapshots directory though: http://build.clojure.org/snapshots/org/clojure/clojure/
18:57the-kenny_ato: hm :(
19:00the-kennyAny idea why not?
19:02ataggartthe project is configured to run ant jar
19:03ataggartinstead of ant nightly-build
19:03ataggarthence no uploading
19:03ataggartcompare http://build.clojure.org/job/clojure/40/console with http://build.clojure.org/job/clojure%20%28new%29/35/console
19:07the-kennyhm
19:20ataggartit's a simple config change, just need rights to do so.
19:22konr1I'm moving from vi to emacs - is there a slime tutorial you guys recommend me watching/reading?
19:23konr1And are CL-focused slime tutorials applicable to Clojure?
19:24the-kennykonr1: Yes, they are
19:24the-kennykonr1: Slime isn't very complicated
19:26j3ff86is there a limit to how big a sequence can be in clojure?
19:26the-kennyj3ff86: the java heap-space ;)
19:26j3ff86ah
19:26the-kennyI don't think there's another limit
19:27the-kennyBut if you're working with long sequences, you maybe want a lazy-sequence
19:27j3ff86good point
20:07technomancykonr1: the slime manual is pretty thorough
20:07technomancya few features haven't been ported to clojure yet, but most of it is solid
20:27mtm_technomancy: just ran 'lein self-install' on a fresh Snow Leopard box, it installed fine. When I try 'lein help new' or lein new foo' I get an trace that says "Exception in thread "main" java.io.FileNotFoundException: project.clj (No such file or directory)"
20:27mtm_any ideas?
20:28Chousuketry creating an empty project.clj?
20:29mtm_hmm, that blowed up real good with "Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/new__init.class or leiningen/new.clj on classpath:"
20:29mtm_maybe a buggy lein script?
20:29mtm_I'll dig further
20:30_atomtm_: "lein new" doesn't exist in 0.5.0. It's coming in 1.0.0
20:30mtm_ah, I was going from the readme
20:30mtm_silly me :)
20:31ataggartwhat's the "right" way to organize tests if we want to get lein to run them (which I assume it can, haven't delved too deeply yet)
20:31toupsHi #clojure. I notice there is a kind of impedane mismatch between the way swank-clojure-project expects things to be set up and my desire to maintain some general libraries which I use in many differeny projects. Is there a community standard way of handling this?
20:33somniumtoups: put symlinks in ./lib ?
20:33_atotechnomancy: what do you think of setting the default github branch to stable for Leiningen (github project -> admin -> default branch)? That way the main page will show the README from the stable branch. I think mtm_ is the third person I've seen run into problems due to the README not matching what self-install installs.
20:33toupssomnium: simple as they, eh?
20:33toupsthat, I mean
20:33somniumtoups: it works for me
20:34toupsI just like to check to see if everyone is doing the same thing before I reinvent the wheel
20:34_atoataggart: just put a bunch of .clj files in project/test/ that use clojure.test and define some tests with (deftest)
20:34_atoataggart: you can see how I do it here: http://github.com/ato/clojars-web/blob/master/test/clojars/test/utils.clj
20:34ataggartso you split them out from the code being tested?
20:35ataggarthmm, looks like it could work either way
20:35_atoyeah. well Leiningen's just going to go through every namespace under project/test, load it and eval (run-tests) in it
20:36_atoso you could just symlink your sources in there if you mix deftests into your implementation files
20:36_atoI assume that would work
20:38ataggartcool
20:43mtm__ato: all is well now; I've got the latest leiningen built and working. thanks for the help
20:44_ato:-)
20:50tolstoyIs there a way to get the name of the namespace your functions running in?
20:53_ato,*ns*
20:53clojurebot#<Namespace sandbox>
20:53tolstoyAh, cool. Still trying to learn how to learn where things like *ns* are documented.
20:54konr1Has anyone any idea on how clojure-swank handles the classpath? I just installed the whole thing on emacs using ELPA, and after starting slime with "m-x slime", swank complains that it couldn't find test.clj on the classpath
20:56_ato,(name (ns-name *ns*))
20:56clojurebot"sandbox"
20:56_atotolstoy: ^ you might need that if you want it as a string
20:57tolstoy_ato: Thanks. Mostly just for println/debugging or whatever.
21:00hjiangIt seems I need to add ~/.m2/repository to CLASSPATH in my shell config. Is that the correct way? I didn't see it in the installation notes.
21:01hjiangsorry, the question was for Leiningen
21:02_atohjiang: you shouldn't need to, the bin/lein script should set the classpath for you.
21:02_atohjiang: is it not working?
21:03hjiang_ato: lein new testp
21:03hjiangException in thread "main" java.io.FileNotFoundException: Could not locate leiningen/new__init.class or leiningen/new.clj on classpath:
21:03hjiang_ato: yeah, seems the path isn't setup properly.
21:04_atohjiang: I think you're having exactly the same problem mtm_ just had. "lein new" doesn't exist in lein 0.5.0
21:05hjiangoh, I see. I'll try the latest then. Thanks!
21:06tolstoyHm. *ns* seems bound to clojure.core when I run my app. Interesting.
21:07chousertolstoy: would you bring that up on the google group
21:07chousertolstoy: I don't think it's intentional, and we might be able to fix it before 1.1
21:07tolstoyAh, really? Hm Okay.
21:13tolstoyI think *ns* is bound to the name space of the initial function being called, and even if you call functions in other names spaces, which print out *ns*, you get the original value.
21:13tolstoyI'm not sure that's wrong.
21:15tolstoyAll I'm really looking for is something like class.getName(). Something analogous to that.
21:15_atotolstoy: ah yeah, that's current. If you want the namespace that function is defined in you might need to do it with a macro
21:16tolstoyOkay. It's not that big of a deal, fortunately. ;)
21:16_atothis might work: (defmacro current-ns [] *ns*)
21:18_atoso then you can do something like (println "I'm in" (current-ns))
21:18tolstoy_ato: Yeah, that's closer.
21:18_atobecause its a macro *ns* is evaluated at compile-time so *ns* should be set to whatever file the macro is being expanded in
21:19tolstoyYes, exactly.
21:21technomancy_ato: I think it should be less of a problem post-1.0 since our main launch stuff won't be changing much
21:22_atotechnomancy: good, and I noticed you've put in a task not found error, which is less befuddling than the stacktrace 0.5.0 throws up
21:38meewhat's the difference between (advantages of?) (> foo 0) and (pos? 0). Just sugar?
21:38meeerr (pos? foo)
21:39ChousukeI guess pos? is a bit faster
21:39meeoh, return values are different
21:40meeit's very cool that the documentation links to the implementation, even if I can't read it all very well
21:41Chousukeheh
21:41Chousukethat's a recent improvement.
22:04technomancyis there some trick to calling clojure.main/repl and getting standard in hooked up correctly?
22:04technomancyjava -cp clojure-1.1.0-alpha-SNAPSHOT.jar clojure.main -e "(clojure.main/repl)" # <= does not cut it
22:05JAS415hmm
22:05JAS415what are you trying to do?
22:06meejava -cp .../clojure.jar clojure.lang.Repl "$@" ?
22:06meeis the command in clojure-repl, which seems to work
22:06JAS415yeah mine has jline.ConsoleRunner in there too
22:06technomancyyep, I'm just wondering if there's a way to call it from inside clojure.main -e
22:07JAS415i would guess that you would have to connect it to the tty or whatever
22:09JAS415maybe try /legacy_repl
22:12JAS415hmm
22:12JAS415nope
22:14JAS415hmm
22:14JAS415it looks like that command prints one repl
22:14JAS415neat
22:23JAS415ah
22:24JAS415technomancy: got a little closer with this... java -cp clojure.jar clojure.main -e "(clojure.lang.Repl/main (make-array String 0))"
22:24JAS415still not quite
22:30JAS415hmm
22:30JAS415looks like the stuff you need to do it isn't externalized
22:30ataggartuse clojure.lang.Script if you want to pass it a clj file
22:31ataggartas for eval'ing a string from the commandline, I don't know
22:31JAS415i think he's trying to start a repl by evaling the string
22:31ataggartwhy?
22:32ataggartwhat's wrong with: java -cp clojure.jar clojure.lang.Repl
22:32ataggart(besides missing the convenience jars)
22:33JAS415i have no idea :-P
22:33ataggartk
22:33JAS415you can also do java -cp clojure.jar clojure.main
22:34ataggartmy clj script still works thankfully. no-args and it starts the repl, otherwise it runs a file, etc.
22:34JAS415i'm just intrigued now as to why it doesn't loop when you try to call main directly
22:40ataggartanyone know of a simple way to return a modified version of a deftype'd instance, akin to how assoc would work on structs?
22:51somniumataggart: you can use conj if you include IPersistentMap in interfaces
22:51somniumataggart: otherwise seems necessary to implement Associative atm
22:51ataggartaha!
22:52ataggartI had read that part of the wiki, but it didn't sink in
22:56technomancyataggart: I'm wanting to start the repl from within a "java" ant task so I can set the classpath in Clojure
22:56technomancysince ant sets up a subclassloader for you
22:57ataggartgotcha
22:59JAS415woahh
23:00JAS415hm
23:01JAS415so you want to start the ant task in java, run the repl in the middle, and finish the ant task?
23:03JAS415could you start the repl in the beginning and call ant from clojure in like another thread and then call back to the prompt?
23:03JAS415(I clearly don't know how ant works)
23:05technomancyno, the repl needs to be loaded from the subclassloader so it will have the calculated classpath
23:06JAS415darn
23:06ataggartwhy not stick the calculated classpath into the java task itself?
23:09ataggartah, unless you're using clojure to calculate it
23:09technomancyyeah, that's right
23:10JAS415haha
23:10JAS415could you use sys.exec to run clojure
23:13technomancyactually... it looks like it's the ant task that's screwing up *in*. bugger.
23:55ngocHi, is it possible to use more than 1 infinite seq like this?
23:55ngoc(def l100
23:55ngoc (for [a (iterate inc 1)
23:55ngoc b (iterate inc 1)
23:55ngoc :when (= (+ a b) 100)]
23:55ngoc [a b]))
23:55ngoc(take 2 l100)
23:55technomancyngoc: map accepts mutiple seqs in parallel
23:56technomancyif you use for it treats one of them as an "inner seq" or some such
23:57ngocCan you show me how to fix the code using map?
23:58tomojb
23:58tomojoops.\
23:58technomancyngoc: something like this: (map (fn [a b] [...]) (iterate inc 1) (iterate inc 1))