#clojure logs

2009-04-11

00:00hiredman,(uncurry +)
00:00clojurebot#<sandbox$uncurry__1858$uc__1860 sandbox$uncurry__1858$uc__1860@127d5a0>
00:00hiredman,(((uncurry +) 2) 3)
00:00clojurebot#<sandbox$uncurry__1858$uc__1860 sandbox$uncurry__1858$uc__1860@fae256>
00:00RaynesMan, why do people like Groovy. How could anyone like something with such a horrible name. :|
00:01hiredman,((((uncurry +) 2) 3))
00:01clojurebot5
00:01Carkhum i see
00:01Cark,(((((uncurry +) 2) 3) 4))
00:01clojurebot9
00:02Cark,(-> (uncurry +) (apply 3) apply)
00:02clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: Integer
00:02Cark,(-> (uncurry +) (apply [3]) (apply []))
00:02clojurebot3
00:02hiredman,(doc call)
00:02clojurebot"([x & y]); (apply x y)"
00:03Cark,(-> (uncurry +) (call 3) (call))
00:03clojurebot3
00:03Cark,(-> (uncurry +) (call 3) call)
00:03clojurebot3
00:03Carkall right so what's a real world use of uncurry ?
00:05Carkman your pl macro is some hairy stuff
00:05hiredman,(((((uncurry (flip map)) (range 3)) (range 3)) +))
00:05clojurebot(0 2 4)
00:10Carknice library
00:10hiredman:)
00:11hiredmanit was fun
00:31nzkozI feel like I'm missing something, but why does (rest []) return a not-a-vector (list?)
00:32hiredmanmost of the sequence handling functions call seq first
00:32nzkozmeant that my fancy ref to a vector turned into something else where conj put things on the front and my app stopped behaving. I'm clearly doing something wrong headed
00:33hiredmanfilter, map, etc
00:33durka42don't use rest anymore, use next
00:33durka42might do the same thing
00:33durka42,(next [])
00:33clojurebotnil
00:33durka42,(next [1])
00:33clojurebotnil
00:33durka42,(next [1 2])
00:33clojurebot(2)
00:33hiredman,(next [])
00:33clojurebotnil
00:33hiredman,(rest [])
00:33clojurebot()
00:34nzkozcheers
00:35hiredmanmaybe contrib should have a vector map, filter, etc
00:36hiredman,(assoc [] 10 :a)
00:36clojurebotjava.lang.IndexOutOfBoundsException
00:37hiredman,(assoc [] 0 :a)
00:37clojurebot[:a]
00:37hiredman,(assoc [:b] 1 :b)
00:37clojurebot[:b :b]
00:37hiredman,(assoc [:a] 1 :b)
00:37clojurebot[:a :b]
00:37hiredmaninteresting
00:37nzkozyeah, I basically just want to atomically pop and push from *something*
00:37nzkozmy java / ruby brain wants an array / queue with locks
00:38durka42use transactions instead
00:38hiredmanor you can use your java brain and use a blocking queue
00:38nzkozdurka42: right, that's what I'm trying to do 'right'
00:39nzkozhttp://gist.github.com/93459
00:39nzkozI have that so far
00:39nzkozworks, but feels questionable
00:40hiredmanblocking queues are threadsafe, so no locks anyway
00:40durka42,(conj [1 2 3] 4)
00:40clojurebot[1 2 3 4]
00:40durka42,(pop [1 2 3 4])
00:40clojurebot[1 2 3]
00:40hiredmanwell, BlockingQueue
00:41durka42,(peek [1 2 3 4])
00:41clojurebot4
00:41nzkozso pop + peek should work too
00:41durka42just be careful they act different with different collection types
00:41durka42like conj
00:42nzkozyeah, a little confusing I have to say
00:42hiredmando you really need indexed access?
00:43nzkoznot at all, just want to do add-foo and get-foo
00:44nzkozwith fifo
00:44hiredmanyou might use subvec instead of rest
00:44hiredman,(doc subvec)
00:44clojurebot"([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."
00:47nzkozraises for start > size, so would need a special case to handle empty
00:47nzkozbut that feels a little more natural
00:49dakrone_hb7/clear
00:49dakrone_hbbah
00:50dakrone_hb,(show-doc "xml")
00:50clojurebot[ 0] clojure.core/xml-seq [ 1] clojure.zip/xml-zip [ 2] clojure.xml/parse [ 3] hiredman.clojurebot.svn/summary
00:51dakrone_hb,(show-doc "xml" 0)
00:51clojurebot------------------------- clojure.core/xml-seq ([root]) A tree seq on the xml elements as per xml/parse
00:51dakrone_hb,(show-doc "xml" 1)
00:51clojurebot------------------------- clojure.zip/xml-zip ([root]) Returns a zipper for xml elements (as from xml/parse), given a root element
00:56durka42(doc show-doc)
00:56clojurebotexcusez-moi
00:57durka42,(doc show-doc)
00:57clojurebot"([re-string-or-pattern] [re-string-or-pattern index]); Based on find-doc and clojure.contrib.repl-utils/show. With one argument, prints a list of all vars whose documentation or name contains a match for re-string-or-pattern. Each var is listed with a number of it's index which can be used to print the documentation for that var."
01:08dakrone_hbI have been reading, and I still can't find where it's mentioned what the '^' in front of a hash-map does
01:08dakrone_hb,^{:a 1}
01:08clojurebotnil
01:08dakrone_hb,{:a 1}
01:08clojurebot{:a 1}
01:09dakrone_hbcan someone explain what the ^ is used for?
01:09hiredmanit is a reader macro
01:09hiredman,^{:a 1} 'a
01:09clojurebotnil
01:09hiredman,#^{:a 1} 'a
01:09clojurebota
01:10hiredman,(meta #^{:a 1} 'a)
01:10clojurebotnil
01:10hiredmanbah
01:10dakrone_hberr...
01:10dakrone_hbfor reading metadata?
01:10hiredmanfor attaching metadata
01:11hiredmanoh
01:11hiredmanyeah
01:11dakrone_hbso is it for reading or attaching metadata?
01:11dakrone_hbor both?
01:11hiredman^ is for reading
01:11hiredman#^ is for attaching
01:12hiredman,^#^{:a 1} 'a)
01:12clojurebotnil
01:12hiredman,(let [#^{:a 1} a 3] ^a)
01:12clojurebotnil
01:12hiredman,^(with-meta 'a {:a 1})
01:12clojurebot{:a 1}
01:13durka42(doc with-meta)
01:13clojurebotReturns an object of the same type and value as obj, with map m as its metadata.; arglists ([obj m])
01:14dakrone_hbso you're associating metadata {:a 1} with the 'a' object, then reading it all out
01:14dakrone_hb?
01:14hiredmanyeah
01:14dakrone_hbdoes ^ read all the metadata, or just specific fields?
01:14hiredmanall
01:14hiredmanthe metadata is a single map
01:15dakrone_hbokay, so you could do (:a ^(with-meta 'b {:a 1}))
01:15dakrone_hb,(:a ^(with-meta 'b {:a 1}))
01:15clojurebot1
01:15hiredmanI would use ^
01:15dakrone_hbneat
01:15hiredmaner
01:15hiredmanwouldn't
01:15dakrone_hboh, okay
01:15hiredmanbut I guess it is personal choice
01:15hiredmanI use (meta )
01:15hiredman,(macroexpand '^a)
01:15clojurebot(clojure.core/meta a)
01:15hiredman:P
01:16dakrone_hbokay, but it definitely helps for reading other people's code
01:16dakrone_hb,(macroexpand '#^a)
01:16clojurebotUnmatched delimiter: )
01:16hiredmanand I use vary-meta more then with-meta
01:16hiredman,(meta (vary-meta 'a assoc :a 1))
01:16clojurebot{:a 1}
01:16dakrone_hbis there a good reference for "shortcut operators" for Clojure anywhere?
01:17dakrone_hbsince the clojure site won't let me search for '^', and it's not very google-friendly
01:17hiredmanmaybe the reader page on the website
01:17durka42"reader macro" is the googlable term you're looking for
01:17dakrone_hbthere we go, there's the list
01:18dakrone_hbhiredman, thanks for the explaination, very helpful
02:41msinghwhy does having clojure written in clojure make it easier to port?
02:43hiredmanit makes the part that needs to be ported smaller
02:44hiredmanif the data structures are written in clojure, then they don't need to be written for a non-java platform
02:44msinghoh i see
02:44hiredmanetc
02:44msinghcool thanks that makes seense
02:44lepassiveanyone using enclojure netbeans plugin with NetBeans 6.7 M3 ?
02:47msinghhiredman: so it there a well understood core of clojure that would need to be implemented in the native environment to host the rest of the portable clojure code?
02:48hiredmanit depends
02:49hiredmanthe self hosting aspect can be pushed pretty far
06:34somethinggood morning.
06:35somethingI'm having trouble adding clojure-contrib to my .emacs. I did the following (setq swank-clojure-extra-classpaths (list "my-path-to-contrib-jar"))
06:36somethingam I missing something?
06:38something:w
11:32digashswank-clojure only read that variable once on the slime startup
11:34digashtry (setq slime-lisp-implementations (delete-if '(lambda (i) (eq (car i) 'clojure)) slime-lisp-implementations)
11:34digash(add-to-list 'slime-lisp-implementations `(clojure ,(swank-clojure-cmd) :init swank-clojure-init) t)
11:34digashor just restart emacs
16:42blbrown_win" kjsldjfsd ; kljsfksljdf" what is the split character in clojure to seperate based on a particular character
16:44blbrown_win,(.split "abc ; 123")
16:44clojurebotjava.lang.IllegalArgumentException: No matching field found: split for class java.lang.String
16:44durka42,(.split "abc ; 123" ";")
16:44clojurebot#<String[] [Ljava.lang.String;@12c61fe>
16:44durka42,(dorun (map prn (.split "abc ; 123" ";")))
16:45clojurebot"abc " " 123"
16:45blbrown_win(map trim (.split "abc ; 123" ";"))
16:45blbrown_win,(map trim (.split "abc ; 123" ";"))
16:45clojurebotjava.lang.Exception: Unable to resolve symbol: trim in this context
16:45blbrown_win,(map .trim (.split "abc ; 123" ";"))
16:45clojurebotjava.lang.Exception: Unable to resolve symbol: .trim in this context
16:46durka42(.trim " abc")
16:46durka42,(.trim " abc")
16:46clojurebot"abc"
16:46blbrown_win,(map (fn [a] (.trim a) (.split "abc ; 123" ";"))
16:46clojurebotEOF while reading
16:46durka42,(map #(.trim %) (.split "abc ; 1 2 3" ";"))
16:46clojurebot("abc" "1 2 3")
16:46blbrown_win,(map (fn [a] (.trim a)) (.split "abc ; 123" ";"))
16:46clojurebot("abc" "123")
16:46blbrown_winwhat is the '%' in your last example
16:47durka42my example is exactly equivalent to what you wrote right after it
16:47durka42% is the parameter in anonymous functions
16:47durka42,(macroexpand #(.trim %))
16:47clojurebot#<sandbox$eval__2693$fn__2695 sandbox$eval__2693$fn__2695@ac087b>
16:47durka42er
16:47durka42,(macroexpand '#(.trim %))
16:47clojurebot(fn* [p1__2699] (.trim p1__2699))
16:47durka42,(macroexpand '#(+ %1 %2))
16:47clojurebot(fn* [p1__2703 p2__2704] (+ p1__2703 p2__2704))
16:47blbrown_winah
16:48blbrown_winnice
16:49blbrown_win,(map #(.trim %) (.split "abc ; 1 2 3 ;" ";"))
16:49clojurebot("abc" "1 2 3")
16:49dreishFor that matter, ,'#(+ %1 %2)
16:49dreish,'#(+ %1 %2)
16:49clojurebot(fn* [p1__2715 p2__2716] (+ p1__2715 p2__2716))
16:49blbrown_win,(map #(.trim %) (.split "abc ; 1 2 3 ; ;" ";"))
16:49clojurebot("abc" "1 2 3" "")
16:49dreish#() is expanded by the reader; it isn't a macro per se.
16:49blbrown_win,(remove nil? (map #(.trim %) (.split "abc ; 1 2 3 ; ;" ";")))
16:49clojurebot("abc" "1 2 3" "")
16:49blbrown_win,(remove empty? (map #(.trim %) (.split "abc ; 1 2 3 ; ;" ";")))
16:49clojurebot("abc" "1 2 3")
16:49blbrown_winnice little one liner
16:50blbrown_win,(remove empty? (map #(.trim %) (.split "" ";")))
16:50clojurebot()
16:50blbrown_win,(remove empty? (map #(.trim %) (.split ";;;;;;" ";")))
16:50clojurebot()
16:50blbrown_winI am unit testing with the bot
16:58d2dchatDo clj files have to be compiled before you can read them from other clj files?
16:58d2dchatI'm trying to namespace one of my libraries
16:58d2dchatand read from another clj file
16:58d2dchatand I'm having problems
17:30blbrown_winno they do not have to be compiled, can you post your code to the pastebin including the error
18:09d2dchatblbrown_win: sure hold on a sec
18:10d2dchatblbrown_win: http://pastie.org/443938
18:10d2dchatThe weird thing is, I did the same thing independent of those two files in the same directory
18:10d2dchatand it seemed to work
18:14durka42d2dchat: what is $PWD then
18:15d2dchatecho $PWD is /Users/lancelotcarlson/Projects/clojure/redwine
18:15d2dchatdurka42: ^
18:16durka42oh, i see, but it finds src/redwine/server.clj anyway so it should really find request.clj...
18:16durka42i'm not sure
18:16d2dchatit should find both
18:16durka42maybe if you put $PWD/src on the classpath?
18:16d2dchatwell if finds server.clj because I specify in the run.sh file
18:16d2dchatBUT
18:16d2dchatit doesn't find request.clj
18:17d2dchatdurka42: didn't work :(
18:18d2dchatI tried this:
18:18d2dchatjava -DDEBUG -cp $PWD/src -Djava.ext.dirs=jars clojure.main src/redwine/server.clj -- $*
18:18d2dchat(ns redwine.server
18:18d2dchat (:use redwine.request)
18:18d2dchat(ns redwine.request)
18:18durka42meh
18:18d2dchatin the different files respectively^
18:18durka42i am stumped :(
18:18durka42and i have to run
18:18durka42sorry
18:18d2dchathaha
18:18d2dchatdurka durka
18:18d2dchat:(
19:19dmiles_afkseem all languages on the JVM are plagued with a fixnums not being a primitive type.. some at least (does clojure?) at least try to use/reuse java's nullable version Integer?
19:20gnuvince_dmiles_afk: unless explicitly coerced, Clojure's ints are Java's Integers
19:21dmiles_afkwhich i guess is the best case anyways
19:21gnuvince_Almost; the really best case would be that you'd never need to know or care.
19:22dmiles_afkindeed
19:25dmiles_afki am trying to figure out if it is going to be required in the long run to have primitive taking method signatures besides the nullable method singatures
19:26dmiles_afkit'd be such a pain to do.. in any compiler.. wondering if clojure has had to consider do this to speed up use of numbers
19:30dmiles_afkone jvm language started doing this, scala, they secretly add the same methods to things but that take primitives as well as their numberic datatypes
19:30dmiles_afkso that way there is never box/unbox/rebox/unbox etc
19:31rhickeydmiles_afk: something like this is on the drawing board
19:31dmiles_afkso it actualyl seemed worth it.. thats what i was wondering
19:35dmiles_afkone methodology that almost can make the path to doing this simplier.. is to go ahead and do what your already doing with java.lang.Integer.. then looking for the numberi operations from the bytecode level and replacing it with the same forms using primtives.. GJIT.. is an exmaple of such an aniomal that takes Groovy post compiled code.. then rewrites the bytecode to not use the expensive boxed versions of the operations
19:37dmiles_afkbut its too easy to create barriers that GJIT wouldnt be able to do its smart stuff on.. so doing it in the intial phase when you can is always going to be the best
19:39dmiles_afki am glad it's one the drawing board though
19:39dmiles_afkone/on
19:40blbrown_winwhat is the benefit of lazy sequences
19:41blbrown_winclojurebot: do you ? what is the benefit of lazy sequences
19:41clojurebotc'est bon!
19:41dmiles_afkthe same benefits as lazy lists
19:43blbrown_winwhat are the benefists of lazy lists
19:43d2dchatanyone know about require and use in clojure? I'm having all kinds of problems with use and getting files to load
19:43d2dchathttp://pastie.org/443938
19:44dmiles_afkrhickey: my project is finally moving to useing Clojure on IKVM instead of DotLisp ;P
19:45d2dchatgrr I've tried so many combinations with the java command and nothing seems to be working
19:47dnolend2dchat: are you trying to load your own clj files?
19:47d2dchatdnolen: yes
19:47dmiles_afkthe project hasnt had a lot of DotLisp code written by users so it's not going to be difficult changeover, but what was impressive was how many cloure features DotLisp had at the get go
19:47rlbblbrown_win: that's a pretty general question...
19:48hiredmand2dchat: I would not use ext.dirs
19:48hiredmanand it's the only one he hasble
19:48d2dchathiredman: what should I use?
19:48hiredman~jar directory
19:48clojurebotwith java6(jdk1.6) CLASSPATH can contain a "*" so /jar/dir/* will suck in all the jars in the /jar/dir directory, this also works with swank-clojure-extra-classpaths in emacs, alternatively you can use this shell snippet: find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"
19:49d2dchathiredman: so I should use classpath exclusively?
19:49hiredmanI think it is the most reliable option
19:49hiredmanalso what directory are you running java in?
19:50d2dchatthe path of the project
19:50hiredmanis the directory containing the "src/" directory on the classpath?
19:50d2dchatI think si
19:50d2dchatso
19:51hiredmanthink?
19:51rlbblbrown_win: ...but in general, the laziness allows you to delay evaluation (computation, allocation, etc.) until it's actually required.
19:51d2dchatI'm changing stuff around right now
19:51d2dchat:)
19:51dmiles_afkblbrown_win: the benefits of lazy lists usually are that if the list contains evaluation to generate the full values of the list.. you are not penalized for head use operations
19:51d2dchatdirectories are split out with the colon character rght?
19:52hiredmanon unix systems
19:52hiredmanon windows, semi-colon
19:52rlb...also allows for infinite sequences, etc.
19:54d2dchathiredman: ok this is what I'm running:
19:54d2dchat./System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -cp /Users/lancelotcarlson/Projects/clojure/redwine/jars:/Users/lancelotcarlson/Projects/clojure/redwine/src -DDEBUG clojure.main src/redwine/server.clj
19:54d2dchatand it's saying:
19:54d2dchatjava.io.FileNotFoundException: Could not locate clj_html/core__init.class or clj_html/core.clj on classpath: (backtrace.clj:0)
19:55hiredmanseveral things
19:55hiredman/Users/lancelotcarlson/Projects/clojure/redwine/jars should be something like /Users/lancelotcarlson/Projects/clojure/redwine/jars/\*
19:55hiredman/Users/lancelotcarlson/Projects/clojure/redwine/src should be /Users/lancelotcarlson/Projects/clojure/redwine/
19:56hiredmanjust two things then
19:56d2dchatah, separated by colons though
19:56d2dchathow do I do that?
19:56d2dchatright now it's running
19:57d2dchat./System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -cp /Users/lancelotcarlson/Projects/clojure/redwine/jars/clj-backtrace.jar /Users/lancelotcarlson/Projects/clojure/redwine/jars/clj-html-helpers.jar /Users/lancelotcarlson/Projects/clojure/redwine/jars/clj-html.jar /Users/lancelotcarlson/Projects/clojure/redwine/jars/clj-unit.jar /Users/lancelotcarlson/Projects/clojure/redwine/jars/clojure-contrib.jar /Users/lancelotcarlson/Projects/c
19:57d2dchatlol
19:57st3fanis there someting like CLOS for Clojure?
19:57d2dchatafter I added /\*
19:57d2dchatjars/\*
19:57hiredmand2dchat: pardon?
19:58d2dchathiredman: http://pastie.org/443998
19:58d2dchatthat is spitting out what is above
19:59blbrown_windmiles_afk, aren't there timing issues with lazy operations. For example, if I need a set of sequences to be called in a set order and but the lazy operation is called whenever it is required, wouldn't that cause issues with your code
19:59hiredmanignore the run script
20:00blbrown_windmiles_afk, but then again, if you are careful where you use lazy lists then I guess you are OK
20:00hiredmantype in "java -cp $PWD/jars/\*:$PWD clojure.main src/redwine/server.clj"
20:00rlbst3fan: you mean something exactly like CLOS? Clojure has multimethods, etc., but they're a bit different.
20:01dnolenst3fan: no, however much of what you might want is available with multimethods and hierarchies. The main missing bit is inheritance of fields, though this isn't too difficult to implement.
20:01st3fani'm not sure what i mean :-)
20:01dmiles_afkblbrown_win: right .. just have to decide when they are apropriate
20:01blbrown_windmiles_afk, cool
20:02st3fani would like to write some OO code with clojure, or is that the wrong approach?
20:02dnolenstefan: do you need field inheritance?
20:02st3fandunno, i can probably do without
20:02hiredmanwhat is OO to you?
20:03dnolenthen just use multimethods, and ad hoc types
20:03dmiles_afkblbrown_win: but in the first case you cited.. you can always copy it into a new list evaled element by evaled element with the new list/seq not lazy
20:03blbrown_windmiles_afk, but personally, I wish that the api would explicty tag lazy operations. For example, I think 'for' uses lazy lists now with the 200903 release. Wish it were called lazy-for or something
20:03rlbst3fan: I would take a look at what clojure already has -- it's very powerful, and if you know CLOS, less surprising that if you only knew Java/C++/...
20:03st3fanhiredman: class hierarchy ctually
20:03dnolenstefan: http://clojure.org/multimethods
20:03rlbs/that if/than if/
20:03hiredmanst3fan: well, clojure has heirachies
20:04blbrown_windmiles_afk, yea, I use 'for' a lot and I have to get used to the new lazy approach to i
20:04st3fani have a lot to read i guess
20:04blbrown_winit
20:04rlbblbrown_win: I would suspect that if the order is critical, then you should be forcing the order anyway.
20:05dnolenst3fan: unfortunately there are a few undocumented things, Rich recently added a handy feature where you can get the specific method for a particular dispatch type. but yeah, there's a little bit to read, but it's not a big topic.
20:05dmiles_afkrlb, blbrown_win: the 'for' would enforce some order already right?
20:05rlb(i.e. doall)
20:06blbrown_windmiles_afk, it enforces order, but I believe the list that you build won't get built until you need it. And I am guessing it didn't work this way with the older clojure release
20:06rlbI suppose I shouldn't have said order -- I really meant "timing".
20:06d2dchathiredman: /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -cp /Users/lancelotcarlson/Projects/clojure/redwine/jars/*:/Users/lancelotcarlson/Projects/clojure/redwine -DDEBUG clojure.main src/redwine/server.clj
20:06d2dchatjava.lang.Exception: Unable to resolve symbol: lazy-seq in this context (str_utils.clj:38)
20:06clojurebot?
20:06hiredmanah
20:06hiredmannow we are getting somewhere
20:07blbrown_winrlb, dmiles_afk I am not concerned or anything or have any issues. I think it is a cool feature. For me though, I have to get used to lazy operations in a language, especially as it relates to debugging
20:07hiredmand2dchat: do you have the latest versions of everything?
20:08d2dchathiredman: yea, when I had the ext.lib thing pointing to the jars path.. everything was working EXCEPT for my extra .clj file I was trying to include
20:08blbrown_windmiles_afk, I could be wrong, but I couldn't want to use lazy lists and database operations together
20:08hiredmand2dchat: well, if you want to go back to that, the problem was the "src" at the end of your classpath
20:09dmiles_afki am new to clojure myself but i assume there was something you can wrap a list in. a memoizer that on first use walks the list on first use
20:09hiredmanyour namespaces all start with src.* so src needs to be in soemthing on the classpath, but not on the classpath
20:09d2dchathiredman: if we can get this classpath method to work, then I'm all for it
20:09blbrown_windmiles_afk, I don't know. I was using 'for' as my example. Maybe somone else knows
20:09hiredmandmiles_afk: lazy-seqs cache their results
20:10blbrown_win,(doc lazy-seqs)
20:10clojurebotjava.lang.Exception: Unable to resolve var: lazy-seqs in this context
20:10hiredmaneach part computation for an element in a lazy-seq is done once
20:10clojurebotfor is a loop...in Java
20:10hiredman,(doc lazy-seq)
20:10clojurebot"([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. Any closed over locals will be cleared prior to the tail call of body."
20:10hiredmanall the clojure functions that deal with seqs that can be lazy are
20:11d2dchathiredman: I'm not so sure that the jars/* is working as it should
20:11dmiles_afkthat is a good default
20:11hiredmand2dchat: I am sure it is, that str_utils exception is something I have seen before, but I forget exactly the circumstances
20:12hiredmanI think it was something to do with clj-html
20:12blbrown_windmiles_afk, do you work with haskell? is that the approach the haskell uses
20:12d2dchathiredman: well I imported all of the deps for the ring project
20:12d2dchatall of the jars that it uses is on the repo
20:12d2dchatand stuck them inside of the jars folder
20:13hiredmanI think clj-html has it's own git repo, which may be newer then whatever ships with ring
20:13dmiles_afkblbrown_win: i am a lzay list prolog programmer.. dont know haskell yet.. but i thought haskell assumes the evaluation is not cachabel ussually.. so if you broke into a debugger.. every inspection might trigger the call again?
20:13d2dchathiredman: I don't necessarily want new.. just whatever works with ring
20:14dmiles_afkcachabel/cachable
20:14hiredmand2dchat: that is the thing, I think the clj-html that comes with ring doesn't work
20:14d2dchathaha gotcha
20:14d2dchat:(
20:14d2dchatalthough it wasn't complaining before..
20:15hiredmanI forget exactly because it was something like a month ago when I ran into this
20:16d2dchathiredman: I'm not even using html in my code :(
20:16hiredmand2dchat: if you want to go back to ext, go ahead, the problem with you classpath is the "src" at the end
20:16dmiles_afkblbrown_win: my assumptionm to haskell not caching it is that good haskell code .. knows how to 'undo side effects' .. so caching would be only an optimization.. not for cleanliness
20:16blbrown_windmiles_afk, shrug, I remember there might issues with the haskell approach as lazy by defult for most sequence operations and can cause memory problems. But this is coming froma a person that doesn't understand it all
20:16hiredman~lazy
20:16clojurebotlazy is hard
20:18dmiles_afkclojure would be caching the evaluations for cleanliness .. so side effects only trigger when they should (is that one reason?)
20:18blbrown_winask rhickey_
20:18hiredmandmiles_afk: the operations that generate you lazy-seq are not free
20:18hiredmanbetter to just do it once, instead of everytime you walk a seq
20:19blbrown_windmiles_afk, at least with the jvm, there are better tools to monitor memory/heap usage and other tools for tracing operations...compared to haskell. So it would be an interesting expirement
20:20hiredmanthere is a branch in svn of work on "streams" which are like non-caching lazy-seqs
20:22dmiles_afksomeone wrote a JVM in prolog.. it had the ability to run bytecode forward and backward
20:22hiredmannice
20:22blbrown_windo you mean a VM?
20:22hiredmanmaybe someone shoudl write a jvm in clojure
20:23dmiles_afka java bytecode interpreter
20:23hiredmanI heard you like clojure so I wrote your jvm in clojure so you can run clojure in clojure while you run clojure
20:24durka42what happens when you run bytecode backwards?
20:24hiredmanyou gain memory
20:24hiredman:P
20:24dreishSun's stock goes up.
20:24dmiles_afkthat was true
20:24hiredmanha ha
20:24hiredman~ticker JAVA
20:24clojurebotJAVA; +0.02
20:25blbrown_winI guess it is kind of like call with current with continuations, only a relic of scheme apparently
20:29d2dchathiredman: btw I think this is better:
20:29d2dchatEXT="$(find $PWD/jars -mindepth 1 -maxdepth 1 -print0 | tr \\0 \:)"
20:29d2dchathiredman: still having problems, but same error
20:33blbrown_winI guess I work for a big company and use clojure, maybe I should market my clojure use...naah
20:35dmiles_afki am working on a secondlife bot that is programable in clojure
20:36blbrown_winnice
20:37blbrown_winhttp://code.google.com/p/lighttexteditor/ I have written and rewritten this for the last 6-7 months
20:37hiredmandmiles_afk: oooo
20:38blbrown_winI am starting to use George Bush terminology. But at least I am drinking right now
20:38dmiles_afkhiredman: http://code.google.com/p/opensim4opencog/source/browse/trunk/bin/cogbot.lisp (we naming them lisp becasue it it's Cojure's anccestor DotLisp)
20:38dmiles_afk*Clojure's
20:39blbrown_windmiles_afk, do you like second life
20:39d2dchatarg this dependency hell is frustrating
20:39hiredmanclojurebot should totally hang out is second life
20:39hiredmanin
20:40blbrown_wind2dchat, no offense, but it isn't that hard. I have found the clojure namespace system to be pretty good
20:40dmiles_afknope, but SL provides a place to runs bots with real people
20:40d2dchatblbrown_win: IT IS easy.. if it worked...
20:40hiredmand2dchat: are you still getting that str-utils exception?
20:40d2dchathiredman: yes
20:41hiredmanI would pull the latest clj-html from github and try it
20:41d2dchathiredman: and I copied over the clj-html jars I generated from the git repo
20:41hiredman~google clj-html
20:41clojurebotFirst, out of 58700 results is:
20:41clojurebotmmcgrana&#39;s clj-html at master - GitHub
20:41clojurebothttp://github.com/mmcgrana/clj-html/tree/master
20:41d2dchathiredman: tried that already
20:41hiredmanhmmm
20:42dmiles_afkLTEC looks pretty good
20:42blbrown_windmiles_afk, ahh?? C# ...just kidding
20:42pjstadig,(type (into-array [1 2 3]))
20:42clojurebot[Ljava.lang.Integer;
20:42dmiles_afkblbrown_win: clojure runes very well on IKVM recently
20:43dmiles_afkruns
20:43hiredmanclojurebot: would you like to hang out in second life?
20:43clojurebotPardon?
20:43pjstadighow would i find the type of an array's elements?
20:43hiredmanclass?
20:43hiredmanor type I guess
20:43pjstadig,(class (into-array [1 2 3]))
20:43clojurebot[Ljava.lang.Integer;
20:43pjstadigno i want it to return Integer
20:43hiredmanon the first element
20:44dmiles_afkIKVM = .NET JVM.. you get to write implmentations in C#,J#,Java,VB,etc
20:44pjstadigoh
20:44pjstadighmm
20:44hiredman~javadoc java.utils.Array
20:44d2dchatblbrown_win: it's not as if dependencies in clojure or any language aren't a problem.. I'm not only relying on my stuff to work.. but other's :-P
20:44hiredmanbah
20:44hiredman~javadoc java.util.Array
20:44blbrown_windmiles_afk, would be another interesting project to port clojure to llm
20:45blbrown_winllvm
20:45hiredmanwhere is the array utility stuff?
20:45durka42~javadoc java.util.Arrays
20:46blbrown_wind2dchat, I was just kidding, I wasn't really look at the problem, all I know I have always used ns, :use, :import without any problems for multiple files, projects and dependencies
20:47hiredman~google clojure ring
20:47clojurebothttp://lmgtfy.com/?q=clojure+ring
20:47hiredmanThanks
20:48hiredman~google clojure ring
20:48clojurebotFirst, out of 3110 results is:
20:48clojurebotRing: A Web application library for Clojure. - Clojure | Google Groups
20:48clojurebothttp://groups.google.com/group/clojure/browse_thread/thread/bbc9fd453667d953/0214afdf2da814cd?show_docid=0214afdf2da814cd
20:54hiredmanfresh ring checkout works fine here
20:55hiredmanjava -cp $PWD/jars/\* clojure.main src/ring/examples/wrapping.clj
21:04d2dchatblbrown_win: it does work.. the problem are the jars I'm pulling now :(
21:04something (setq swank-clojure-extra-classpaths (list "path/to/my/clojure-contrib.jar") is what I need to do to setup clojure contrib in my.emacs?
21:05somethingbecause it's not working for me.
21:05hiredman~jar directory
21:05clojurebotwith java6(jdk1.6) CLASSPATH can contain a "*" so /jar/dir/* will suck in all the jars in the /jar/dir directory, this also works with swank-clojure-extra-classpaths in emacs, alternatively you can use this shell snippet: find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"
21:05d2dchatI think.. but all of the jars *were* working when I used -Djava.ext.lib=
21:05d2dchatwhich is weird..
21:06durka42yes, extdirs and classpath act differently
21:06d2dchatdurka42: bah! Now I have to go
21:07durka42such is life
21:07durka42~life
21:07clojurebotmeaning of life is to become one with Lisp
21:07d2dchatdurka42: pastie before I leave:
21:07d2dchathttp://pastie.org/444046
21:07durka42old clojure version
21:07d2dchatdurka42: bah.. really?
21:07d2dchatlol
21:07durka42do you have the one from before lazy was introduced?
21:08durka42old clojure and latest contrib generally do not play nice
21:08d2dchatdurka42: I'm using the version that was included with ring
21:08durka42hmm, could be the issue
21:09hiredmanring works fine with the jars it comes with here
21:09d2dchathiredman: it works fine when I use ext.lib
21:09d2dchatext.dir
21:09d2dchator whatever
21:09d2dchatnever remember what it was
21:10hiredmanthen use that
21:10d2dchatlol
22:01aCogCorrodedHey, guys. I am trying to install clojure. I am not much of a java programmer, and not much of a programmer at all at the moment. So this is probably a simple mistake on my part. So I put the jline jar file in my clojure directory, then run "java -cp jline-0.9.94.jar:clojure.jar jline.ConsoleRunner clojure.lang.Repl" and get "Could not find the main class: jline.ConsoleRunner." What am I doing wrong?
22:03hiredmanmy guess is an extra "." after jline.ConsoleRunner
22:03cconstantineaCogCorroded: not sure
22:04hiredmanI recommend rlwrap instead of jline
22:04aCogCorrodedOkay, I will look up rlwrap.
22:04hiredmanjline has some mangling issues with unicode
22:05hiredmanaCogCorroded: does clojure.lang.Repl work without jline?
22:06aCogCorrodedhiredman, I'll check
22:06aCogCorrodedit works with "java -cp clojure.jar clojure.lang.Repl"
22:07aCogCorrodedI am actually slowly moving over to vim from IDEs, could I just start with that?
22:08hiredmanit works, but you don't get history, and up arrow and stuff
22:09aCogCorrodedAh. I will continue to explore. Thanks for the help.
22:11hiredmancrazy
22:12aCogCorroded?
22:14hiredmanI built a desk today, and just borrowed a level, and it is almost dead level
22:14dreishaCogCorroded: He was not calling you crazy.
22:16aCogCorrodedWait. I'm not sure I understand exactly what these programs do. A readline wrapper. I am a windows user. I don't know if that makes a difference, but the concept is new to me.
22:17aCogCorrodeddreish, ah. Now I get it. And hiredman, that is crazy.
22:18dreishaCogCorroded: If you're on Windows, and don't want to spend hours ramming your head into one wall after another, my recommendation (without having tried it since I'm not on Windows) is Clojure Box: http://clojure.bighugh.com/
22:20aCogCorrodedThanks. I will have a look.
22:21aCogCorrodedThat looks perfect. Thanks.
22:42aCogCorrodedWow, Clojure Box looks pretty awesome, though I know nothing of emacs, but using it for clojure seems simple enough.
23:03gnuvince_I just wrote a super simple recursive dirtree with indentation in C, Clojure, Python and Haskell. The Clojure version is the shortest one. Funnily enough, I had more difficulties with the Haskell one than the the C one; all that monadic IO is nice in theory, but is really a pain in the ass otherwise
23:05dakrone_hbgnuvince_, how's the performance of the 4?
23:07gnuvince_Pretty much the same, Clojure takes the most time to start.
23:07gnuvince_It's REALLY simple
23:07gnuvince_dirtree /path/to/dir
23:07gnuvince_and it outputs the directory structure
23:07dakrone_hbas a hash-map? array?
23:08gnuvince_array
23:08gnuvince_(.listFiles path)
23:08gnuvince_Then a doseq over that
23:08gnuvince_check if .isDirectory
23:08gnuvince_really, really simple
23:08gnuvince_Anyway, just thought it was nice that Clojure was even a little more concise than Python
23:09dakrone_hbneat
23:09gnuvince_And that Haskell wasn't so nice, unfortunately.
23:09ice_fourIs there an equivalent to return in clojure?
23:20cp2gnuvince_: can you paste the source? i would like to see how you implemented it
23:22lisppaste8gnuvince pasted "dirtree" at http://paste.lisp.org/display/78433