#clojure logs

2009-02-03

00:39durka42so -- what is a "logical collection"?
00:39durka42is it different from "a seq or nil"
00:40durka42or is it just a duck that promises to turn into a seq or nil when you call seq on it
00:55gordongeckocould a reader macro allow something like ([1][1,2,3]) -> 2
00:55gordongeckocould a reader macro allow something like (#[1][1,2,3]) -> 2
00:55gordongeckocould a reader macro allow something like (#[1:3][1,2,3,4,5]) -> [2,3]
00:58durka42no, probably, and probably
00:58durka42but clojure doesn't have reader macros
00:59gordongeckois there a slice function?
00:59durka42subvec
00:59durka42(doc subvec)
00:59clojurebotReturns 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.; arglists ([v start] [v start end])
01:00durka42,(subvec [1 2 3 4 5] 2 3)
01:00clojurebot[3]
01:00durka42,(subvec [1 2 3 4 5] 1 3)
01:00clojurebot[2 3]
01:00durka42also
01:00durka42,(range 5)
01:00clojurebot(0 1 2 3 4)
01:00durka42,(range 3 700 50)
01:00clojurebot(3 53 103 153 203 253 303 353 403 453 503 553 603 653)
01:15hiredman,(use '(clojure.contrib.repl-utils))
01:15clojurebotnil
01:15hiredman,show
01:15clojurebotjava.lang.Exception: Unable to resolve symbol: show in this context
01:15hiredman,(use 'clojure.contrib.repl-utils)
01:15clojurebotnil
01:15hiredman,show
01:16clojurebot#<repl_utils$show__1120 clojure.contrib.repl_utils$show__1120@688954>
01:16hiredman,(source for)
01:16clojurebotSource not found
01:16hiredman:(
01:18durka42,(source subvec)
01:18clojurebotSource not found
01:18durka42it does that if you've updated clojure.jar out from under the running program
01:19hiredmanhmm
01:19hiredmanI have not
01:19durka42hmm
01:19durka42security crap preventing it from opening files?
01:19hiredmanah
01:19hiredmanYes
01:20durka42,(File. "/")
01:20clojurebotjava.lang.IllegalArgumentException: Unable to resolve classname: File
01:20durka42,(java.io.File. "/")
01:20clojurebot#<File />
01:21durka42,(.listFiles (File. "/"))
01:21clojurebotjava.lang.IllegalArgumentException: Unable to resolve classname: File
01:21durka42,(.listFiles (java.io.File. "/"))
01:21clojurebotjava.security.AccessControlException: access denied (java.io.FilePermission / read)
01:21durka42good
01:24hiredmanhmmm
01:24hiredmanthe sandbox should really be using java.util.concurrent.Executors
01:29gordongeckoim gonna sin
01:30durka42are you asking forgiveness? :p
01:36gordongeckoim gonna go !
01:36gordongeckofor-loops naturally encourage sideeffects
01:36gordongeckoim tryong to translate gaussjordan elimination from python to clojure
01:38hiredman,(doc dotimes)
01:38clojurebot"([bindings & body]); bindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1."
01:38hiredman,(doc doseq)
01:38clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
02:25lisppaste8gekko pasted "gauss jordan elimination" at http://paste.lisp.org/display/74770
02:25gordongeckoanyone could take a look at that and point me to the right direction? this is typical for the problems i have with functional langs
02:26gordongeckoit uses a lot of for loops at state and it alwyas becomes so messy when doing in a pure way
02:43Lau_of_DKGood morning everyone
02:48knaprhow do you nest loop/recur? does recur always recur to the closest loop? there is no magic there?
02:49Lau_of_DKI believe it always recurs to the closet loop
02:50hiredmanknapr: recur always recurs to the closest frame
02:50hiredmanwhich maybe a loop or a fn
02:50hiredmanif you use a macro that makes fns around statements this can lead to unpredictable results
02:52knapris there no function-global def?
02:52hiredmanhuh?
02:53Lau_of_DKdef is global
02:53knapri want to use def inside a function, can prevent that variable form becoming global to the program?
02:53hiredmannope
02:53hiredmandef != schemes define
02:54hiredmanyou can sometimes emulate that behaviour with let
02:57Lau_of_DKhiredman: He left before you answered :)
02:57hiredmanso he did
02:57Lau_of_DKFor local-scope defs he should probably use defn- from contrib
02:57hiredmanerm
02:58gordongeckoi thought defn- was in core
02:58hiredmandefn- is not from contrib
02:58Lau_of_DKFair enough, but you get the picture
02:58Lau_of_DKI think defn- originated from contrib
02:59hiredmandefn- is not local
02:59hiredmanit is private
02:59Lau_of_DKoh, thats not quite the same
02:59gordongeckoyes
02:59Lau_of_DKThen his option is using bindings ?
02:59hiredmannah
02:59hiredmanlet
03:00hiredmanand the fn in defn closes over what is bound with let
03:01Lau_of_DKOk, I see that binding is primarily for redefining something which is already bound to a value
03:01hiredman...
03:03hiredman,(.codePointAt "..." 0)
03:03clojurebot8230
03:03hiredman,(int \...)
03:03clojurebot8230
03:06hiredman,(short \...)
03:06clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
03:06hiredmanhmmm
03:45AWizzArdHi
03:48Lau_of_DKHey AWA
03:53AWizzArdclojurebot: max people
03:53clojurebotmax people is 137
03:53AWizzArduh :-)
03:53AWizzArdhi cg
03:53cgrandhi!
04:26newb12345how good is clojure for real world computing? stuff like parsing html files
04:33cgrandnewb12345: at least as good as Java :-) for parsing html you can use TagSoup for example. In the mailing list, there are examples of integrating TagSoup + zippers
04:36newb12345zippers? as in haskell/functional zippers?
04:38cgrandI'm not an Haskeller, but zippers as in functional artifacts to navigate/mutate trees
04:38newb12345whoa
04:39newb12345so clojure is elegant like lisp, but practical like java?
04:39AWizzArdindeed
04:39newb12345to play devil's advocate
04:40newb12345why hasn't it taken over the world yet?
04:40AWizzArdbecause Clojure 1.0 is not published.
04:40AWizzArdIn October there were around 70-80 people in this room.
04:40AWizzArdclojurebot: max people
04:40clojurebotmax people is 137
04:40newb12345how do i get the size of a channel?
04:40AWizzArdwith about 750 members in the Google Group
04:40metaperlwhen using 'ant' to build Clojure, what advantage does that give you? I dont have much java background.
04:41AWizzArdnewb12345: depends on your irc-client
04:41newb12345for yours, what is it?
04:41newb12345i'll just try it in mine
04:42AWizzArdmetaperl: in a project of 619 files you won't need to type 619x javac, but only one time ant.
04:42AWizzArdAnd don't forget dependencies.
04:42metaperldoes it make it easier to use clojure from the command line?
04:43metaperlright now, I downloaded clojure to a temp directory and run the REPL from there... I'm wondering if using 'ant' will perform a 'system install' and make clojure available from any directory.
04:44AWizzArdmetaperl: http://www.google.com/search?q=ant
04:44cgrandmetaperl: ant is make for java
04:48Lau_of_DK<newb12345> how good is clojure for real world computing? stuff like parsing html files
04:48Lau_of_DKThis is a classic quote :)
04:48Lau_of_DKcgrand: Why are you always pushing SoupBox, did you make it?
04:50cgrandno Mr Lau, it's just my reflex answer to "how to parse html in javaland"
04:51cgrandand its author created this irc channel :-)
04:53Lau_of_DKuuuh :)
04:54Lau_of_DKStill funny: real world computing = parsing html
04:55greghyou never know when you're going to be walking down the street and trip over some unclosed tags!
04:55Lau_of_DKthats certainly true
04:55Lau_of_DKcgrand: And you primarily a Git man, or an Svn girl ?
04:58cgrandLau_of_DK: I'm agnostic
04:59Lau_of_DKThats odd
05:01cgrandplus, I don't answer sexist questions :-)
05:02Lau_of_DKoh man, you really are french!
05:03cgrandwarum?
05:03Lau_of_DKhehe, Im not german. It just matched my stereotype of a french person, react that way to a git/svn joke :)
05:07cgrandSeriously, having to work crossplatform, I tried hg two years ago but it's quite recently that I tried git again
05:22Lau_of_DKcgrand: Git is pretty well supported for Windows isnt it?
05:23cgrandLau_of_DK: except git-svn, it seems to work well
05:24cgrand(but cygwin/git-svn works ok)
05:30Lau_of_DKAh ok
05:39Lau_of_DKcgrand: But to me its primarily a business case: Which gives minimal overhead without loss of relevant features? Git was a clear winner, and since our migration at the company, the feedback has been 100% positive
05:41gordongeckois there a function to update a vector at a specific pos?
05:42cgrandgordongecko: assoc
05:42gordongeckoah assoc works there too
06:00lisppaste8gordongecko pasted "matrix update" at http://paste.lisp.org/display/74776
06:00gordongeckocan ^^ be improved to something shorter and more clear?
06:02Chousukeis your matrix a vector of vectors?
06:02Chousukeif so, use assoc-in
06:03Chousuke,(assoc-in [[1 2 3] [4 5 6]] [1 1] :a)
06:03clojurebot[[1 2 3] [4 :a 6]]
06:03gordongeckook
06:03gordongeckois assoc O(1) ? so if i want to make a matrix it is efficient to sue evctirs?
06:03gordongeckovectors
06:03Chousukethe performance of assoc depends on the data structure.
06:04Chousukevectors might not be the most efficient matrix representation, at least for large matrices.
06:05gordongeckowellf or sparse amtrices i guess id use a hashmap but for dense ones?
06:05Chousukeassoc is not O(1) for vectors, but close enough.
06:06Chousukelog32 or something. :)
06:08gordongeckohow would you do the equivalent of: a={} for r in rows: for c in cols: a.update{(r,c): 0} ?
06:09gordongeckoie nest for loops and accumulate to a variable that is global in the function
06:12Chousukeyou want to zero the array? :/
06:13Chousukethat doesn't really make sense in clojure, unless you're dealing with mutable data.
06:16Chousukegordongecko: you could simply define A to be full of zeros to begin with, for example, (vec (take rows (repeat (vec (take cols (repeat 0))))))
06:17AWizzArdin Clojure in principle evrything are constants
06:18Chousukecompared to traditional languages, I suppose.
06:18AWizzArdyes
06:18Chousukein clojure a constant would be a name that always is bound to the same value.
06:19AWizzArdyou mean that the value is bound to the name?
06:19Chousukeor that.
06:19AWizzArd;-)
06:21Chousukegordongecko: it's important to keep in mind that once you have a value, there's *no way* to change it, if it is one of the clojure basic data types (and not some java stuff). You can only create *new* values based on the old one.
06:34knapri want to generate all pair-combinations of 2 ranges, like (range 1) (range 1), should gen [0 0] [0 1] [1 0] [1 1]
06:37AWizzArdknapr: (for [a (range 2) b (range 2)] ...)
06:38AWizzArd(for [a (range 2) b (range 2)] [a b])
06:45knaprcan you map over a hashmap somehow?
06:45knaprdo soemthing to eahc value i mean
06:48Chousukeyeah
06:48Chousukejust use map
06:48Chousukeeach key-value pair will be given to your function as a [k v] vector
06:50AWizzArdknapr: you can map over (vals your-map)
06:51Chousuke,(apply hash-map (map (fn [[k v]] [v k]) {:a 1 :b 2}))
06:51clojurebot{[1 :a] [2 :b]}
06:51Chousukehm
06:51Chousukenot quite :/
06:51AWizzArd(map #(+ 7 %) (vals my-mep))
06:52Carkawizzard : been reading cll again, i think trampolines are just perfect, the parser combinator think mentioned by JH makes no sense, the user of your library would of course need to adapt his programing style to use trampolines as well
06:52Chousuke,(int0 {} (map (fn [[k v]] [v k]) {:a 1 :b 2}))
06:52clojurebotjava.lang.Exception: Unable to resolve symbol: int0 in this context
06:52Chousukegah
06:52Chousuke,(into {} (map (fn [[k v]] [v k]) {:a 1 :b 2}))
06:52clojurebot{2 :b, 1 :a}
06:53AWizzArdCark: yes, for nearly (and maybe all) practical cases Trampolines should be enough.
06:58AWizzArdnewb12345: I use irssi, and for me the command is /names
07:15gordongeckobut lets say i want to keep some metadata like rows and cols to make some calcs faster, how would you do that? pass that along a s a struct or can you have metadata ona hashmap?
07:16AWizzArdyou should not put cache data into the metadata
07:17AWizzArdinstead you can memoize your function
07:17gordongeckoyes but for a matrix it makes sens e to just pass around the matrix-hashmap and rows and cols
07:17gordongeckoasa struct
07:17gordongeckono?
07:17Lau_of_DKgordongecko: I would say so
07:39gordongeckodoes clojure have something like haskells show?
07:40AWizzArdgordongecko: (str your-object)
07:40AWizzArd(str 10) ==> "10"
07:41AWizzArd,(str {"key" 'value})
07:41clojurebot"{\"key\" value}"
07:41gordongeckohow can I map println without nil?
07:42AWizzArdgordongecko: don't use map for side-effects. Use (doseq [obj collection] (println obj))
07:43gordongeckohmm?
07:43gordongecko(doseq println [[1 2 3] [4 5 6] [7 8 9]])
07:43gordongeckoah
07:44Lau_of_DK,(doseq [idx (range 10)] (println idx))
07:44clojurebot0 1 2 3 4 5 6 7 8 9
07:55clojurebotsvn rev 1248; [lazy] added sequence?
07:56gordongeckodoes clojure have something like haskell's show? so if i have a struct X i can write a function show for it so when you do x int he repl it shows not X but some other version of X, a prettyprinted one?
07:57AWizzArdyou mean you want your own printed representation of an object?
07:57durka42gordongecko: print-method is a multimethod that dispatches on class
08:01durka42see Chouser's recent patch: http://clojure.googlecode.com/issues/attachment?aid=3251654005916676481&amp;name=print-iref.patch
08:07Carkwith the upcoming changes regarding nil punning, would it be safer to use the empty? predicate to test if a collection is empty ?
08:07Carkor take the doc advice of using seq instead
08:08rhickeyCark: please no! empty? is still defined as (not (seq x)), and the preferred Clojure idiom is still (when (seq coll) ...)
08:09Carkthank you rhikey
08:11Carksee i have this trie library, and sometimes need to use the data as a seq, using the high order functions and lazy-cons is 10x slower than using loop recur to build a vector
08:11Carkactually no, it's 5 times slower
08:11Carkbut still =/
08:13rhickeybut if you are a die-hard Schemer or prefer termination conditions first, you can (cond (empty? x) foo :else bar), but not my preference
08:13rhickeyI am interested in reports of actual nil puns in the field broken by the lazy branch
08:14AWizzArdrhickey: so concat now has the role of lazy-cat?
08:14bakkdoorhi
08:15AWizzArdhey bak
08:15rhickeyAWizzArd: lazy-cat still exists, because, as a macro it suspended the entire argument expressions, but if those expressions are just other sequence calls, there's no need for lazy-cat, just use concat
08:16bakkdoori'm somehow having a problem with the clojure-contrib.jar. it doesnt show up within my repl in emacs, i mean the namespace doesnt. do i need to tell it somehow to load it? i use jline, have that installed and have the clojure.conf in my home folder as described in the tutorial. i also have the clojure-contrib.jar in ~/.clojure (with my jline.jar) and loading clojure with jline seems to work
08:16rhickeyuser=> (macroexpand '(lazy-cat xs ys zs))
08:16rhickey(concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))
08:17AWizzArdah okay, so lazy-cat was also adopted to the new lazyness
08:17rhickeyso if xs ys and zs are already sequence calls, they're already fully lazy and lazy-cat is redundant
08:17gordongeckois ther eno function forturning a vector into a hashmap?
08:17ayrnieubakkdoor - (.contains (System/getProperty "java.class.path") "clojure-contrib.jar") ?
08:17AWizzArdgordongecko: with keeping all indexes?
08:18bakkdoor=> true
08:18bakkdoorayrnieu: => true
08:19gordongeckoif i have this common idiom in my functions for (defstruct matrix :repr :rows :cols) where i take the repr, do soemthing ot it, then do (struct matrix new-repr (m :repr) (m :cols)), could i abstract that out? with -> perhaps?
08:19ayrnieu(use 'clojure.contrib.javadoc) (javadoc String) ?
08:19bakkdoorthis is my classpath: "/home/bakkdoor/opt/clojure/clojure.jar:/home/bakkdoor/.clojure/clojure-contrib.jar:/home/bakkdoor/.clojure/jline.jar"
08:20bakkdoorhm works, opens my browser
08:20ayrnieuso what are you trying that doesn't work?
08:20AWizzArdgordongecko: if you do this often you could think about having a ref/agent/atom on your structured-map
08:20bakkdoornow it also shows the clojure.contrib.javadoc.browser and hell-out when tab-completing
08:21gordongeckoAWizzArd: well then i make it mutable, thats not what iw ant
08:21AWizzArdthe map is still immutable
08:21AWizzArdonly the ref is mutable
08:22bakkdoorayrnieu: i wanted to use clojure.contrib.math.expt.. but after doing (use 'clojure.contrib.math) it now works.. hmm so is there a way to also load the stuff in clojure.contrib to be displayed with tab completion like the clojure.jar stuff is by default?
08:25ayrnieubakkdoor - you could cache tab-completion emacs-side; you could load all of the contrib modules.
08:27bakkdoorwhere would i put this? will it check for a .clojurerc file in my home directory or something where i can put some code i want it always to run when starting?
08:28ayrnieuyou can have your 'clj' script load ~/.clojurecl if it exists: http://aur.archlinux.org/packages/clojure-svn/clojure-svn/clj
08:28ayrnieu~/.clojure.clj , there
08:28clojurebotclojure is the bestest programming language available.
08:29bakkdoorah alright, thanks ;)
08:40clojurebotsvn rev 1249; [lazy] restore step fns in filter/drop
08:42leafwis there any clojure contrib in git, officially endorsed
08:42leafwkevin oneil's doesn't load.
09:03cemerickGood morning, all. I've been away for a while. I was hoping someone could clue me in on the latest "stable" rev in svn (e.g. the lastest prior to any experimental additions rolling in)...?
09:05ayrnieuclojurebot: latest
09:05clojurebotlatest is 1249
09:05ayrnieuthe eperimental additions are rolling into the lazy branch.
09:07cemerickwow, branches in a clojure svn? Shocked, I am! ;-)
09:09Lau_of_DKrhickey: Did you get that pic I sent you regarding the trunk ?
09:09rhickeyLau_of_DK: no - where?
09:09cemerickrhickey: I may have forgotten all of my svn-foo by then. ;-) We moved to git over the holidays, despite all of my anti-git agitations.
09:10Lau_of_DKhang on
09:10Lau_of_DKrhickey: http://images.nonexiste.net/irc/2008/10/13/git_two.jpg
09:11danlarkinLau_of_DK: I don't get it?
09:11Lau_of_DKyou dont? Git has no trunk, SVN has everything in trunk...
09:11danlarkinoh.... :-/
09:11ayrnieu(what you gon' do with all that origin? All that junk inside your origin?)
09:20Lau_of_DKrhickey: I take it you dont appreciate that kind of humor?
09:22rhickeyLau_of_DK: I don't git it at all
09:22RaynesLol'd.
09:30clojurebotsvn rev 1250; [lazy] more returns Sequence
09:31rhickeyhttp://clojure.org/lazier enhanced - feedback wanted, it is making sense?
09:51cgrandrhickey: what is the problem with loop in filter/drop?
09:51rhickeycgrand: consumes memory while skipping
09:54cgrandrhickey: ah yes, thanks!
09:54LordOfTheNoobsWould it be odd for `if' to call `seq' on any `(sequence? x)'? Conditionals would then consume at least one item from any sequence submitted to them, `(when (filter pred coll) foo) would consume coll until pred, etc. That would restore nil punning, no? Testing to see if our collection is populated rather than that we have a lazy collection that is potentially populated seems the better default. Maybe that is just me. (when (seq
09:54LordOfTheNoobs(filter pred coll)) foo) seems likely to introduce errors, and is, to me, somewhat unintuitive.
09:55rhickeycgrand: I explain the new closed-over clearing at the bottom of: http://clojure.org/lazier
09:56rhickeyLordOfTheNoobs: adding any overhead to something as primitive as 'if' would be unacceptable
09:58rhickeyLordOfTheNoobs: also would mess with your ability to distinguish something empty from nothing
09:58cemerickrhickey: I just finished a first read/skim of /lazier and /streams. Looks nifty, and I don't have much to add. FWIW, it seems like we're almost to #t and #f for truthiness.
09:59cemerick...which I'm mostly neutral about, so it's a wash for me for the most part
10:01rhickeycemerick: It may seem so on the surface, but there is still quite a bit of leverage to nil, using whens as seq bodies, when-first et al
10:02rhickeycemerick: seq/nil much more useful than #t/#f
10:03cemerickrhickey: yeah, I'm sure there's a lot of formal advantages to it. Of course, I'm one of those who like to have termination conditions first, so I do a bunch of (if-not ...) anyway, which I know you hate :-P
10:04rhickeycemerick: eah, I much prefer (when something-to-do do-it)
10:04cemerickI certainly will miss the current behaviour, just from a syntax/usability perspective. Python introduced me to empty-is-false, and I'll miss it.
10:05cemerickrhickey: well, I'm not much of a programmer, so don't pay any attention to me
10:05rhickeycemerick: 'empty' is false still for seqs, were you doing much (if (filter foo) ...)?
10:05ayrnieu(defn only-for-vecs ":(" ([[]] 0) ([_ & xs] (+ 1 (only-for-vecs xs))))
10:06Chouserayrnieu: trying to do pattern matching?
10:06cemerickrhickey: I can't say one way or the other right this minute. I've been away from programming for a solid month, so I can't even remember where I put my keyboard.
10:09ayrnieuChouser - I was trying to show that destructuring isn't seq-agnostic, but that example fails for other reasons.
10:13ayrnieu(defmulti length empty?) (defmethod length true [_] 0) (defmethod length false [[_ & xs]] (+ 1 (length xs)))
10:16Chousukeayrnieu: I'd call that abuse of multimethods :P
10:17Chouseror clever
10:17ayrnieuwell, enjoy rewriting your less-robust code when lazy hits :-)
10:18Chouserayrnieu: I'm still not sure what you're trying to show there.
10:18ayrnieuhow would you write that for a PersistentList?
10:19Chouser(length '(a b c)) returns 3 for me on trunk
10:19Chouserdoes it not on lazy?
10:21ayrnieuhuh. OK, nevermind.
10:27jkantzanyone have an example use-case for with-local-vars?
10:29ayrnieuhttp://github.com/search?language=clojure&amp;q=with-local-vars
10:30cgrandrhickey: hmm since LazySeq extends AFn can we have named lazy-seqs? (defn cycle[coll] (lazy-seq this (concat coll this))) :-)
10:34lisppaste8ayrnieu pasted "named lazy-seq" at http://paste.lisp.org/display/74786
10:37cemerickGiven an class with static members (e.g. an enum), referring to a non-existent member ends up throwing a "No such namespace" error. I understand that the Classname/Membername syntax has to fall back to checking for namespace/var-name, but it seems like if a class with the given name is in scope, an error message should be emitted that assumes that the code was referring to the imported class.
10:37Chousukenot just (defn cycle [coll] (lazy-seq (concat coll (cycle coll)))) or something?
10:37jkantzso when using with-local-vars are is closing over the local vars disallowed?
10:37ChousukeI think rhickey demonstrated something like that earlier.
10:38ChousukeI guess the name makes it a bit simpler :/
10:52rhickeycgrand: I'm not promising that derivation (from AFn)
10:53rhickeyjust an allocation optimization right now
10:54LordOfTheNoobsDuring a break I switched some personal code ( a parser combinator ) to use the lazy branch. The inability to nil pun isn't much fun in `if-let's and recursive function application through nested lazy sequences. :p
10:57rhickeyLordOfTheNoobs: any examples of changes you had to make that you could paste?
11:00jayfieldshas anyone use clojure to generate JUnit tests? I can't find anything on the web.
11:00jayfields(other than an old edition of Stu's book which has a gen-and-save-class example, but I was looking for something more dynamic)
11:21gordongeckohow do i throw an exception?
11:21cooldude127gordongecko: (throw (Exception. "blah"))
11:22AWizzArdIt seems gordongecko is about to learn all of Clojure within 1 or 2 days...
11:23LordOfTheNoobsrhickey: I was on a break at the time, sorry for the delay. I've github'd the code for the curious. Most `problems` will be easily solved when lazy merges. I'll just code some `if-seq-let` type functions.
11:23LordOfTheNoobshttp://github.com/knome/clojure-parser-combinator/blob/39604ab7f0a24f442da1b6ef40caebce544eea9e/parser.clj
11:25gordongeckogordongecko is out of jail for inside trading ready to take over the world
11:40paramondHi! Does anybody know how to load a Java class file at the repl? Something like (load-class "MyJavaClass.class")
11:41Chousukeparamond: you can't load class files directly, but you can add directories and jars to the classpath
11:41Chousuke(doc add-classpath)
11:41clojurebotAdds the url (String or URL object) to the classpath per URLClassLoader.addURL; arglists ([url])
11:41ChousukeThough I guess that could work for class files directly too :/
11:42paramondThanks, i will try that out.
11:43cooldude127is there a way to split a namespace into multiple files?
11:45jayfieldshow do I get an environment variable? (the equivalent of System.getenv("USERNAME"))
11:46Chousukecooldude127: sure; you can just declare the namespace in a master file and use (load-file)
11:46cooldude127Chousuke: ok thank you, my file is getting big but i don't want to split the namespace
11:46Chousukecooldude127: load-file is like include I suppose :)
11:48rhickeycooldude127: look at the end of core.clj where it loads the proxy/print and genclass stuff
11:48cooldude127ok
11:48Chousukejayfields: System/getenv; though apparently that's deprecated.
11:48cooldude127how is that deprecated?
11:48Chousukeit says in the docs you should instead use properties
11:49jayfieldsthanks
11:49cooldude127oh lamer
11:49cooldude127*lame
11:49Chousukewell, it's more portable I guess.
11:49cooldude127eh, since when does java care about portability ;)
11:49Chousuke:P
11:52shooverparamond: you will need your class's directory on the classpath and then call import to get the class. at the REPL: (import '(my.package MyJavaClass)), where the parent of directory my/package is on the cp
12:08paramondshoover: should i left my.package out if i didn't declare MyJavaClass in a package?
12:09Chousukeparamond: you need to declare it in a package I think
12:10paramondparamond: but isn't there something like an unnamed package in java?
12:10paramondshoover: but isn't there something like an unnamed package in java?
12:13kotarakwhich is discouraged to be used in java land....
12:14paramondof course
12:14duck1123Won't it end up in some default package? like 'user or some such.
12:14duck1123or is that only in a repl
12:14nsinghalI have classpath with "classes" and "src" directory of a java project in that order. When i do (require :reload-all 'org.cc.file) - it is not reevaluating the changed clj file. If i delete the classes files (file__init.class) than the new clj is getting loaded.
12:15gordongeckojava.lang.IllegalStateException: No transaction running (NO_SOURCE_FILE:0)
12:15gordongeckowhy not?
12:15duck1123is the clj file newer than the classes?
12:16nsinghalyes
12:16kotaraknsinghal: this is a known issue.
12:16cooldude127gordongecko: if you're doing something that needs a transaction, you probably need to wrap it in (dosync ...)
12:17nsinghalkotarak: thanks. is it being considered for fix?
12:17kotaraknsinghal: it's in the tracker: http://code.google.com/p/clojure/issues/detail?id=38
12:19kotaraknsinghal: so that tracker mainly consists of issues approved by rhickey it's probably fix at some point.
12:19nsinghalkotarak: thanks again. i will keep an eye on it
12:22kotarakBut probably not after a working day...
12:24gordongeckoif im nesting 3 for loops fo i need to dorun on all?
12:25kotarakgordongecko: for is not a loop. If you do this for side effects use doseq
12:26kotarakgordongecko: if you are interested in the results and still need side-effects, wrap the for in a doall.
12:27Chousukedoes doall realise the seqs recursively?
12:27Chousukefor somewhat unfortunate naming; but if you ask me, it's C that uses the name "for" wrong :P
12:27kotarakhehe
12:28gnuvinceChousuke: more succinctly: C is wrong.
12:28gnuvince;)
12:28kotarakgordongecko: do you have some code?
12:28Chousukenah
12:28kotaraklisppaste8: url
12:28lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
12:28ChousukeC is nice.
12:28ChousukeC++ is wrong :(
12:28kotarakhere's a place to put it. Looking at an example might help to help you.
12:29gnuvinceChousuke: I guess that's subjective, but there are a lot of things wrong with C.
12:30ChousukeWell, yeah
12:30replacaC is a very nice portable assembly language
12:30Chousukebut if you keep it simple, it does the job it's supposed to.
12:30kotarakChousuke: I think it depends on how the for's are nested. if the inner for produces a seq for the outer for it's evaluated I think. If the outer for generates a seq containing the inner for as elements....
12:32lisppaste8gekko pasted "sideeffecting problem" at http://paste.lisp.org/display/74798
12:32lisppaste8gekko annotated #74798 with "untitled" at http://paste.lisp.org/display/74798#1
12:32kotarakgordongecko: you want doseq instead of for
12:33Chousukeusing a ref like that looks wrong.
12:33gordongeckoanyone could take a look at that? i thnk imdoing the same as the java-code
12:33Chousukeit's simulating mutation; you need to figure out a more functional way to do it.
12:34gordongeckoyes but it should work anyway right?
12:34kotarakgordongecko: as I wrote, you want doseq instead of for
12:35gordongeckoyes i mgihtn want that but what im saying it should work like this too no?
12:36Chousukeit should, I guess.
12:36Chousukeassuming assoc-inc is just a typo in the paste :)
12:37Chousukebut that's really not a good way of doing it.
12:39lisppaste8gekko annotated #74798 with "untitled" at http://paste.lisp.org/display/74798#2
12:39gordongeckohttp://paste.lisp.org/display/74798#2
12:39gordongeckoassoc-inc is my own fucntion
12:40kotarakgordongecko: I suspect get-at also
12:41cooldude127gordongecko: funny, i'm also working matrices in clojure :)
12:41cooldude127except it's all functional. no refs or any mutation at all
12:42gordongeckoim only using mutation here
12:42gordongeckoi wrote the damn thing in haskell first
12:42gordongeckoworked nicely
12:43gordongeckou know there is colt(java lib) for hardcore matrix stuff right?
12:43gordongeckoboth sparse and dense
12:43cooldude127no i didn't, but part of the reason i'm writing it is educational
12:43cooldude127help myself learn the stuff i'm doing in my calc 3 class
12:44cooldude127just coded up some really shitty row reduction code
12:44cooldude127but i need to go, i'll be back on soon
12:45gordongeckocalc uni or hs?
12:58Chousukegah, I can never quite remember how matrix multiplication works :(
13:00ChousukeI always get confused about the order in which to multiply the component vectors :/
13:09durka42doesn't seem like you should need side effects for matrix multiplication
13:21jbondesonthe more code i write in C# the more i love immutable datatypes
13:21Nafaijbondeson: Why do you say that? I'm not closely familiar with C#
13:23jbondesonjust happen to be writing a new datatype and keeping track of data changing is a bitch. soooo much cleaner when your enclosed type can't change.
13:23gnuvinceEither he uses mutable data structures which cause him endless problems, or he uses immutable data structures which don't give him nearly as many problems.
13:24NafaiHeh
13:25jbondesonwhat's really annoying is having to realize that structs and classes are treated so much differently by the CLR, not to mention that sometimes structs are immutable in the BCL, and sometimes mutable.
13:26jbondesonmakes you want to throw your hands up in despair and just code some more clojure
13:27cooldude127jbondeson: clojure is my relief from my data structures class in java
13:27cooldude127i wrote a b-tree, then did some clojure code to make me feel better
13:27jbondesonheh
13:29cooldude127i think i just made myself a lot more productive in emacs by simply switching to the bar cursor instead of a box
13:30cooldude127apparently i spent a lot of time wondering what stuff was underneath my cursor
13:30technomancyyou can't see through it?
13:30cooldude127no, i guess my theme doesn't have it that way
13:30jbondesonThe box is more explicit for me, especially in insert mode
13:30technomancymaybe your graphics card doesn't have enough transparency support
13:32cooldude127technomancy: i doubt that
13:32cooldude127jbondeson: insert mode?
13:33cooldude127i used to be able to see through it, not sure when that stopped happening. i like the bar anyway tho
13:41Lau_of_DKGood evening gents
13:42cooldude127good afternoon lau
13:42duck1123I used to use the bar cursor, but I lost it a couple revisions ago when I was cleaning up my .emacs
13:44cgrand1good evening Mr of_DK
13:44Lau_of_DK:)
13:44jbondesoncooldude127: sorry, in emacs it's "Overwrite" mode
13:44jbondesonas in after you hit the "INS" key
13:44cooldude127jbondeson: oh, that. never used it :)
13:44duck1123I've disabled it
13:44jbondesonhah
13:45cooldude127mac doesn't even have an ins key, so i forgot about it
13:45jbondesoni use it for correcting capitalization, which as you can tell my my dislike of the shift key, happens quite a bit
13:45duck1123(put 'overwrite-mode 'disabled t)
14:08jayfieldsis there a target date for Clojure 1.0?
14:09cooldude127technomancy: wooo! my clojure-update function actually did its job! i just got some updated slime
14:10gnuvincecooldude127: what function?
14:10durka42slimier than ever!
14:10danlarkinjayfields: no
14:10cooldude127gnuvince: an emacs function to complement technomancy's clojure-install function
14:10technomancycooldude127: high-five!
14:10cooldude127updates your copies of clojure, clojure-contrib, swank-clojure, and slime
14:10technomancyI committed it to clojure-mode btw
14:10gnuvincenice
14:11cooldude127oh and recompiles clojure
14:11cooldude127technomancy: cool
14:11gnuvinceI got a python script to update swank-clojure, slime and clojure-mode and I do clojure and clojure-contrib by hand.
14:11technomancycooldude127: I took out the part that runs ant in clojure-contrib though since I realized it's unnecessary; just add clojure-contrib/src/ to the classpath instead.
14:11cooldude127technomancy: does clojure-slime-config take care of that?
14:11technomancyyups
14:11cooldude127cool
14:12cooldude127technomancy: i notice you haven't pushed that yet
14:12technomancycooldude127: not to master, no
14:12cooldude127technomancy: installer on github doesn't include it either
14:12technomancyoh crap
14:12technomancyyou are correct
14:12technomancydone
14:14cooldude127technomancy: i think i spot an erro
14:14cooldude127r
14:14cooldude127(concat clojure-src-root "/clojure-contrib/clojure-contrib/src/")
14:15cooldude127why two clojure-contribs?
14:15cooldude127i only have one in my checkout
14:15technomancyyou are right
14:15cooldude127wooo i'm on a roll today
14:15technomancythat's one way to think of it.
14:15technomancy(the other being that I'm losing it.)
14:15cooldude127lol
14:16cooldude127technomancy: you are really quick
14:16technomancyit's not a hard fix. =)
14:17cooldude127true
14:17cooldude127technomancy: i was going to ask why clojure-update didn't get an autoload, but then i realized that if you're using clojure-update, you probably already called clojure-slime-config
14:18technomancyaye
14:21cooldude127technomancy: you killed off the save-window-excursion part tho
14:22technomancycooldude127: oh dang; I was playing around with it and forgot it
14:22cooldude127lol
14:22technomancyyou had it around the compilation part, right?
14:22cooldude127yeah
14:22cooldude127in the normal case, the update part doesn't need it, they are one-liners
14:22technomancywill put that back in
14:22cooldude127cool
14:29cooldude127got the fix
14:39BigTomWhere can I get a gentle intro into swank/slime etc?
14:39BigTomI seem to spend all me time lookin for how to do things rather than doing Clojure
14:39BigTomso I'm back to JEdit and a REPL again
14:41BigTomI had more luck with Erlang so I don't think its Emacs (though I stumble around with that to some extent)
14:41cooldude127BigTom: what's going wrong for you?
14:42BigTomIts not 'going wrong' as such, I just cannot seem to get anything going I'm trying clojure box so It should have installed ok
14:43cooldude127BigTom: you on windows i figure if you're doing clojurebox?
14:43BigTomyup
14:43BigTommy work machine
14:44cooldude127i probably won't be too much help, but technomancy's clojure-mode fork has some good support for installing and setting up clojure and slime. don't think it will work well on windows tho
14:45BigTommaybe I'll try it on my linux box
14:45BigTomOnce I get over this hump
14:45cooldude127well i g2g
14:46technomancyBigTom: let me know if it works for you
14:46BigTomI have a bad habit of pissing time away on dev environments rather than learning the language so I am being a bit conservative
14:46technomancyif you can get it working on w32 I'd take some patches, but I don't think I could help much with it myself
14:46BigTomtechnomancy: thanks
14:46jbondesonBigTom: http://www.pchristensen.com/slimecommands.pdf
14:46technomancyBigTom: well this should be a single command, so it shouldn't take long to see if it works or not
14:47BigTomjbondeson: that looks good
14:48jbondesonC-c C-l is the big one, it load and evaluates a file
14:48jbondesonC-c C-c evaluates a form
14:48jbondesonif you just changed on form
14:49jbondesonone thing to realize is that you need to save your file before C-c C-l
14:49jbondesonalso some of those commands may not be available with swank-clojure
14:52technomancyjbondeson: there's another command that just loads w/o prompting you like C-c C-l
14:53jbondesonyeah, C-c C-k
14:54BigTomok, I have clojurebox slime running, I have loaded a file and load it (C-c C-l)
14:54BigTomThen I display the REPL
14:54jbondesonalso, i don't know how clojure-box comes set up, but you can split a window horizontally with C-x 3, and vertically with C-x 2
14:55BigTomhow do I get the REPL to execute? It just gives me a new line.
14:55jbondesondepending if you have a namespace defined, you may have to do a (in-ns) at the repl
14:55jbondesonyou're not getting results?
14:56BigTomno, just working my way down the REPL
14:58jbondesonwhen you type in a form it's not displaying the results?
14:58BigTomnope
14:58jbondesono_O
14:58jbondesonwhat does your repl say?
14:59BigTomA new 'unloaded' REPL works
14:59jbondesonI'm not quite following you.
15:00BigTomDoes clojurebox have its own Clojure.jar?
15:00jbondesonI believe clojure-box comes with a clojure.jar and clojure-contrib.jar
15:01BigTomjbondeson: First time round the REPL was a bit dead, seems healthier now
15:01BigTom(after restart)
15:01BigTomI am going to have to replace the clojure jars, I need the new watchers
15:02jbondesonyou can open up the .emacs file and change the location
15:02BigTomjbondeson: Ah, thanks
15:02shooverBigTom: how old is your clojure box? the one on the site matches clojure svn r1235
15:03BigTomshoover, I think I grabbed it a couple of days back
15:03BigTomjbondson: I take it I need my own .emacs, I don't have one yet, hang on
15:04shooverI would recommend grabbing again. I just uploaded yesterday
15:04BigTomah, will do
15:04shooveryou don't need .emacs. clojure box handles the initialization. but if you do have .emacs, it could mess up clojure box
15:04shoover(if you change settings it wants a certain way)
15:04hiredmanhmmm
15:05hiredmansomeone renamed the google map
15:05BigTomshoover: ok
15:05jbondesonBigTom: Sorry, I thought it simply came with a preconfigured .emacs file.
15:05hiredmanthe clojure google map has been renamed to "William Hidden"
15:05shooverit comes with a preconfigured default.el in the site-start directory
15:05BigTomshoover: I got it from bighugh, is that the right place?
15:06shooverBigTom: yes
15:06shooverhiredman: I don't blame that person... adding a point is hard to figure out
15:06hiredmanyeah
15:18BigTomshoover: Hi again
15:18shooverand?
15:19BigTomshoover: I have the latest and it compiles stuff and the REPL works out of the box
15:20shoovergood
15:20BigTomThe current problem is that I cannot run expressions from a file I have loaded (Unable to resolve symbol)
15:20shooverhmm, I just did a C-c C-l on fnparse and it resolved ok
15:20cooldude127BigTom: using clojurebox?
15:20BigTomhow do I sort the classpath out?
15:21BigTomcooldudel27: yes
15:21hiredmandoes the file declare a namespace at the top? are you in the namespace declared by the file?
15:21cooldude127oh
15:21BigTomhiredman: yes
15:21hiredmanyes to both?
15:22BigTomclojurebox and namespace in file
15:22BigTomfilename euler.clj namespace euler
15:22cooldude127BigTom: and it does (ns euler) at the top?
15:23BigTomcoldudel27: yes (ns euler)
15:23cooldude127hmm
15:23BigTomhow do I work out "where" the REPL thinks it is?
15:24shooverrun ProcMon :)
15:24Chousukehmm
15:24Chousukethere was some java property
15:24Chousukemaybe user.dir
15:25cooldude127BigTom: like what directory?
15:25cooldude127cuz that shouldn't matter in this case
15:25BigTomcooldudel27: ok, thanks, so the file location doesn't matter?
15:26shooverI can access symbols with a namespace-qualified name, but I can't use or require the namespace
15:27BigTomeverything I do with my code gets ; Evaluation aborted
15:27shooverBigTom: how are you trying to access the symbols from the loaded file? use? require? fully-qualified?
15:28hiredmanclojurebot: what do you think of emacs?
15:28clojurebot"Learning Emacs and SLIME was just about the most painful computer experience I've ever been through."
15:28BigTomI've tried (use 'euler) and (euler-euler-1 100)
15:28shoovereuler/euler-1
15:29cooldude127yeah
15:29BigTomI mean(euler.euler-1 1--)
15:29shooveruse a /
15:29shooveror you can (do (refer 'euler) (euler-1 100))
15:29BigTomshoover: Doh!
15:29Ariensclojurebot: what do you think of textmate?
15:29clojurebotHuh?
15:29BigTom(euler/euler-1 100) worked
15:29hiredman,(.codePointAt "..." 0)
15:29clojurebot8230
15:30shooverfor use and require, you will have to (add-classpath "file:///path/to/eulers/parent")
15:30cooldude127BigTom: apparently you just had the wrong namespace separator
15:30hiredmanclojurebot: how about that add-classpath?
15:30clojurebotclasspath is (System/getProperty "java.class.path")
15:30hiredmanclojurebot: add-classpath?
15:30clojurebotadd-classpath is bad, avoid it. I mean it!
15:30shooverclojurebot: why?
15:30clojurebotwhy not?
15:30BigTomcooldudel27: at the end, I think the add-classpath will be the trick
15:31BigTomhiredman: is that bad then?
15:31hiredmanBigTom: it is unreliable
15:31cooldude127BigTom: but really, if this is your own code, with slime you just load the file with your code, and run C-c C-k which compiles all your code into the repl
15:31cooldude127i've never once used add-classpath
15:33BigTomcooldude127: How do you invoke your expressions?
15:34cooldude127BigTom: when i first load slime, i run C-c C-k to load a file for the first time. after that, when i change a function, i run C-c C-c to compile just that function (or macro or any other toplevel expression)
15:35BigTomcooldude127: when you are testing them do you call them from the REPL with fully qualified names?
15:36shooverBigTom: try (refer 'euler). Normally that would be done as part of the ns at the top, but from the REPL refer should work after C-c C-k
15:36cooldude127BigTom: no, i usually change into the namespace they are in with ,!p
15:36cooldude127comma performs slime commands
15:36cooldude127!p is an abbreviation for change-package
15:37BigTomcooldude127: that got it, thanks
15:37cooldude127cool
15:37BigTomcooldude127: when yoy say it would normally be done as part of the ns, am I missing something?
15:37BigTomcooldude127: in my code?
15:38cooldude127well shoover said that, but he means in code, you wouldn't use (refer blah), as that would be done in your (ns) declaration at the top. but for the repl, you don't have one, so (refer) is ok
15:39BigTomcooldude127: thnaks
15:39cooldude127no problem
15:39technomancyyou can call ns in the repl
15:39BigTomOne last question, if I want to load a load of dependent jars (I am playing with compojure) what is the most convenient way?
15:39technomancybut if you'd rather not; yeah just call use or refer etc.
15:40cooldude127technomancy: you can, but it's usually easier to use the others if you're just messing around in user
15:40technomancyBigTom: I add them to swank-clojure-extra-classpaths before launching slime
15:40cooldude127BigTom: configure swank-clojure-extra-jars
15:40cooldude127BigTom: listen to technomancy, i was guessing
15:41technomancycooldude127: the advantage of running IRC in Emacs is you can type swank-clojure- followed by M-/, and it will autocomplete from all loaded lisp symbols. =)
15:42cooldude127technomancy: you're right, the thought to do that didn't even occur to me :)
15:42BigTomtechnomancy: that's in swank-clojure.el?
15:42cooldude127yes
15:42technomancyit's called intelligence augmentation. =) some of us need a little more help than others.
15:43cooldude127technomancy: apparently today you do ;)
15:43technomancy"I'm not... normally like this..."
15:43cooldude127lol
15:43cooldude127i have my own problems today
15:43BigTomAnd on that note I will go and do family stuff
15:43cooldude127i have no idea why my code to compute matrix inverses isn't correct, but i do know it's wrong
15:44BigTomThanks everyone for all the help
15:44cooldude127no problem
15:44shooverBigTom: you're welcome. Read the README.rtf in c:\program files\clojure box for how to customize that variable
15:45jbondesoncooldude127: because computing the inverse of matricies is friggin' evil.
15:45ayrnieureally? I don't know how anyone could find http://mathworld.wolfram.com/MatrixInverse.html unclear.
15:46cooldude127jbondeson: i have two ways of doing them, and one of them is very wrong for anything more than 3x3
15:46cooldude127but then apparently that method doesn't work for that
15:47cooldude127which i didn't know
15:47jbondesonanything over 3x3 (which mean 99.999% of the time) needs to use more advanced linear algebraic methods.
15:48jbondesonfriggin' LU Decomposition
15:48cooldude127jbondeson: i have LU sort of working
15:48cooldude127it doesn't handle the bad cases well tho
15:48cooldude1270's kind of trip it up
15:49cooldude127stupid row reduction
15:50ryszard_szopaI already know add-classpath is evil. Can anybody explain me why? (apart from the fact that it doesn't seem to work;))
15:50cooldude127ryszard_szopa: that's probably it
15:50jbondesonthat would probably be a good reason it's evil...
15:51ryszard_szopawell, I guessed that if that was it I would see people complaining and other fixing stuff...
15:52ryszard_szopa*other people
15:52cooldude127ryszard_szopa: naw, we just ignore it
15:52cooldude127pretend it's not there ;)
15:54jbondesonit's useful at the repl, but otherwise should be treated like a leper at a party: kept away from the chip bowl
15:55technomancyryszard_szopa: apparently the JVM makes it impossible to implement correctly
15:55technomancyI think that's the Official Story
15:55technomancyeven though somehow JRuby manages it...
15:55jbondesonruby involves deep magic... best not dwell upon it
15:56cooldude127i believe the underlying philosophy of ruby is magic
15:57technomancythe underlying philosophy of Ruby is "you can do it at runtime"... which can often mean magic. =)
15:57cooldude127lol
15:57hiredmanjruby most likely has more layers of indirection between it and the jvm, so it has room to shuffle stuff around
15:58ryszard_szopawell, I know next to nothing about Java (I have mainly Common Lisp and Python experience), and being able to poke around and see how some Java libraries work would probably help me a lot.
15:58technomancywhereas with Java it's like, "What do you mean you don't know your classpath at boot time? Haven't you held the requisite planning meetings to decide what jars you're going to use?"
15:58jbondesonit still kills me that ruby on the jvm is faster in many cases than ruby on it's own vm
15:58technomancyjbondeson: that was true two days ago... =)
15:58cooldude127technomancy: lol
15:58technomancyjbondeson: before Ruby had its own VM. now with its own VM it's usually faster than JRuby
15:59ryszard_szopathe present implementation of add-classpath is around 6 lines long
15:59ryszard_szopado you think it is really that hard to fix?
15:59hiredmanthe jvm is pretty cool and my respect for all the tools in the java runtime grows and grows
15:59jbondesontechnomancy: ruby: when you're starting to look bad, make some breaking change that'll slow down the opposition?
16:00technomancyhehe
16:00hiredmanryszard_szopa: it doesn't seem to bother people enough to try and fix it
16:02jbondesoni just avoid the whole problem by rolling one nice big jar with clojure and contrib in it (for my own stuff, no distribution)
16:03kotarakclojurebot: macro
16:03clojurebotmacro help is http://clojure-log.n01se.net/macro.html
16:08ryszard_szopaOK, so how can I check what is the current classpath, ie. if add-class has worked?
16:08ayrnieu,(System/getProperty "java.class.path")
16:08clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)
16:08ryszard_szopa(. System (getProperty "java.class.path")) seems to show me what was specified at the command line
16:09technomancyayrnieu: that only gives you the boot classpath
16:09technomancyryszard_szopa: AFAIK there's no way to get anything other than the boot classpath
16:09technomancysad but true
16:10ryszard_szopatechnomancy: does this mean there's no way of checking if add-classpath has succeeded?
16:10technomancyryszard_szopa: apart from trying an "import" and seeing if it fails, no
16:11technomancyryszard_szopa: it sucks to maintain your classpath list manually... the best I've been able to come up with is to have a jars directory and construct your classpath dynamically from its contents.
16:11technomancybut AFAIK there's no getting around restarting the JVM. which is sad.
16:11ayrnieuthe jars directory is what I do. CLASSPATH is not unlike C's LD_LIBRARY_PATH , ldconfig , etc.
16:12technomancyI've fought this fight... it's not worth it. accept the annoyance and move on; you'll have more fun.
16:12ayrnieuit's just that the small bit of architecturing you have to do for CLASSPATH, your OS already does for C.
16:12ayrnieuand perhaps your expectations are higher. Of *course* C doesn't let you switch between clojure-trunk and clojure-lazy at runtime.
16:13technomancyayrnieu: I've been spoiled by other lisps.
16:13RaynesIs there a function to get Console input in Clojure?
16:13ryszard_szopadoes writing a shell script to maintain a sane classpath count as fighting the system? ;-)
16:13ayrnieuwell, let the advantages of jars spoil these other lisps for you in other respects :-) Then you'll be too bitter to use anything.
16:13technomancyryszard_szopa: btw, I *think* the problems with add-classpath only apply to jars that contain java... it might be fine to use it with directories full of clj files.
16:14ryszard_szopaand, are there any drawbacks of having a large classpath?
16:14rhickeytechnomancy: do you know about java.ext.dirs?
16:14durka42,(.. clojure.lang.RT getRootClassLoader getURLs)
16:14clojurebot#<URL[] [Ljava.net.URL;@77a748>
16:14durka42,(map prn (.. clojure.lang.RT getRootClassLoader getURLs))
16:14clojurebotnil
16:14durka42the above is not a stable API
16:14technomancyryszard_szopa: as long as your shell script doesn't enumerate each jar but builds it up from a glob, I'd say you're good
16:14durka42but that is where add-classpaths go
16:14ayrnieuryszard, I have eight lines of CLASSPATH in my ~/.zshrc, and three add every .jar in a specific directory to it. I also have a Makefile that I say 'make lazy' 'make trunk' to, to swap out .jars
16:15technomancyrhickey: have read about it but haven't used it yet. does it allow you to add in a jar after the JVM has booted?
16:15technomancyvs building a static list at boot time
16:16AWizzArdwhere again can I find the roadmap for Clojure?
16:17ayrnieujava -Djava.ext.dirs=/directory/of/jars ...
16:17StartsWithKwhy not java -cp "lib/*" clojure.lang.Repl
16:18StartsWithKloads all jars under lib/
16:18durka42so only specifically mentioned (or globbed) jars are added to the classpath, but everything in the extdirs?
16:18technomancyStartsWithK: right, but you can't add anything after you've booted
16:19technomancyif java.ext.dirs allows for that, then that would pretty much take care of my issues
16:19technomancyit's a little inside-out from what I'm used to, but it'd still allow for what you need.
16:21ChouserI think people have had some issues with java.ext.dirs. something about it being meant for extensions (native libs?) not regular .jars.
16:22rhickeyhttp://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html#deployment
16:23ryszard_szopaayrnieu: do you think that generating my classpath with something like `mdfind -onlyin /usr/ "kind:jar"` would be overkill? ;-)
16:24rhickeyChouser: I think it is specifically for the kind of "installed on my machine" use you always wanted
16:24rhickeywith a single indirection
16:24rhickeyvs a true global install
16:31ChouserThis is the message I was thinking of: http://groups.google.com/group/clojure/msg/7f0c9775ba70d169
16:32Chouseror perhaps this one: http://groups.google.com/group/clojure/msg/f65dd874f779b15c
16:32Chouserin which case the only issue may be if your OS is already assuming (or has set) a java.ext.dir for you.
16:33Chouserin which case it might be better to simply install your jars there instead of resetting java.ext.dir
16:43hiredmandoes import not work with classes in jars added with add-classpath?
17:01lisppaste8ryszard_szopa pasted "memfn for static methods?" at http://paste.lisp.org/display/74820
17:01ryszard_szopais there something like memfn for static methods?
17:03Chouserryszard_szopa: that last example is what I always do
17:06ryszard_szopaChouser: well, it works, but somehow it doesn't seem "right". otoh from the character count point of view #(Foo/bar %) may be optimal...
17:08ChouserI think it should be possible for the compiler to recognize a static method reference in a value position and generate a little fn wrapper on the fly.
17:08Chouserdunno if rhickey would take a patch for that or not.
17:08Chouserhm, seems plausible that it could even recognize the .foo syntax and write #(.foo %) for you, though I guess that's a rather less common scenario
17:10ChousukeI think he mentioned possibly auto-memfn:ing java methods in value position once.
17:12Chouserhttp://clojure-log.n01se.net/date/2008-11-19.html#21:00a-21:04
17:16rhickeyChouser: the problem with the auto-memfning is overloads, once you need to distinguish #() wins
17:19Chouserarity overloading, right?
17:19durka42couldn't overloads be handled as normal?
17:20durka42,(map #(Math/ulp %) [(float 1.23) (double 1.23)])
17:20clojurebot(1.1920929E-7 2.220446049250313E-16)
17:20Chouserbecause it's unlikely that you'd be able to avoid reflection anyway
17:23rhickeyChouser: you can type-hint %
17:23Chouserright, but you'd have to do it explicitly on the arg.
17:23rhickey?
17:23rhickeyuser=> (set! *warn-on-reflection* true)
17:23rhickeytrue
17:23rhickeyuser=> #(Math/ulp %)
17:23rhickeyReflection warning, line: 9 - call to ulp can't be resolved.
17:23rhickey#<user$eval__29$fn__31 user$eval__29$fn__31@2db45934>
17:23rhickeyuser=> #(Math/ulp (float %))
17:24rhickey#<user$eval__36$fn__38 user$eval__36$fn__38@7be4d80b>
17:24Chouserthe compiler's not going to infer the type for the arg based on the seq passed to 'map', for example.
17:24rhickeythat doesn't mean reflection is unavoidable
17:25rhickeyyou can pick the overload with the type hint
17:25Chouseryes, I was too vague
17:27ChouserI just meant that #(Math/ulp %) by itself would use reflection. You have to add something to that expression itself to avoid the reflection.
17:28ChouserSo is the occasional need for #(Math/ulp (float %)) a good enough reason to never allow Math/ulp by itself?
17:29rhickeyChouser: I came to that conclusion
17:30rhickeyputting in un-hintable reflective sugar seems a false benefit
17:30rhickeyI guess the sugar could reject type-overloaded methods
17:30Chousereven if someone else wrote the patch for you? :-)
17:31rhickeywill the patch author answer all 'how do I speed up (map Math/udp ...) questions? :)
17:32rhickeyI had worked on this, including gen-class style Math/udp-float discrimination syntax
17:33Chouseroh. ew.
17:33rhickeywell, without that or a prohibition on type-overloaded methods I think it's a non-starter
17:34ChouserIt seems to me the transition from Math/ulp to #(Math/ulp (float %)) is not that much bigger a hurdle than from #(Math/ulp)
17:34rhickeyby the time you are mapping a method you are atthe point where you are calling it often enough to care about the reflection costs
17:34Chousereither way you have to be thinking about reflection and type hints
17:35rhickeymaybe so
17:35ChouserBut (map Integer. (line-seq my-file)) is so pretty.
17:35rhickey#(Math/ulp #^Float %) works too, less of a change if you were doing #(Math/ulp %) already
17:36rhickeyChouser: I agree completely about the prettiness, but there are limits to pretending a thing (method) is something it's not (a fn)
17:37rhickeyI just though it would encourage a lot of inefficiency, and that seems to be a focus of the community right now, for better or worse
17:38ChouserYeah, I don't know if it's for better or worse, esp. in the long run. But it's a mismatch with my personal interests, so I'm occasionally annoyed by it.
17:39rhickeyyeah, certainly the microbenchmarks are tiresome
17:39hiredman:(
17:40Chouserthe only performance metric that I'm at *all* unhappy with is startup time, and I think that's been addressed as much as possible.
17:40ChouserI intend to play with nailgun at some point and see how that feels.
17:40rhickeyso, while you may say ew at Math/udp-float, it makes the construct hintable. Alternatives for that would be welcome too
17:41hiredmanChouser: the solution to that is, start once and run forever
17:41rhickeydisallowing type-overloaded methods would disallow many methods
17:41ChouserHints already strike me as a (sometimes) necessary evil. I don't mind the extra #(%) noise if I'm also going to have type-hint noise.
17:42rhickeyIt's one thing to adorn what you've already got, another to have to switch constructs
17:43rhickeyyou are giving up too easily
17:44Chouserit's 5 characters. If they weren't all puncutation I would have given up sooner.
17:44rhickey:)
17:45Chouserstill no pricing up on ILC 2009. I can't decide if it's worth the trip out there.
17:45ayrnieutranslating Java to Clojure, I like the hints for documentation. I actually do a lot of "what *type* is this?!" reading Java; it helps to cache the lookups.
17:46rhickeyChouser: are you using exceptions for conditions?
17:46rhickeyI had conditions in an early prototype of Clojure
17:46rhickeybut exceptions are the only non-local flow control, and user catches can interfere
17:47rhickeystill, I had to use them for transactions
17:47Chouserrhickey: well, I don't think I'm going to do a straight port, but yeah I have to use exceptions in some places.
17:48ChouserI'm reading about CL's system, trying to make sure I at least have an excuse for any features I leave out.
17:49rhickeyChouser: fwiw, I used exception (actually Error) object identity for handler matches, custom derive your own Error type and neuter fillInStackTrace
17:50Chouserwhy neuter fillInStackTrace?
17:50hiredmanperformance?
17:50ryszard_szoparhickey: do you plan to make to make Clojure more Java (as in Java-the-language, not Java-the-vm-and-platform) independent in the future? Most of the time I spent learning Clojure consisted of reading about Java :-)
17:50rhickeybecause it's a huge overhead you don't need
17:50Chouserah. hm.
17:51rhickeyChouser: it's a standard technique when using exceptions for flow control
17:51hiredmanthere was something on reddit yesterday about exceptions that mentioned it
17:51Chouserwell, my #1 goal is a simple compile-free way to "throw" and "catch" custom "exceptions"
17:52ayrnieuhiredman - this? http://www.reddit.com/r/programming/comments/7u3jc/languages_on_the_jvm_can_implement_nonlocal/
17:52hiredmanayrnieu: looks like it
17:52rhickeyChouser: really, that's all?
17:52Chouserbut once starting down that road it seems a shame to leave out any useful features from CL's condition system, at least the ones that anyone ever uses.
17:52Chouserrhickey: yeah, I don't know CL well enough to have any larger ambitions
17:52Chouser:-)
17:53durka42wait, what do you mean compile-free
17:53ayrnieuChouser, you could a variant of 'try' that rethrows the type of exception that you use for this other purpose.
17:53rhickeyThe main point of conditions is to allow code to intervene before the stack unwinds
17:53Chouseryes, and I've got that already
17:53Chouserno Exceptions needed
17:53hiredmandurka42: no need to gen-class and (compile ...)
17:53Chouserhttp://paste.lisp.org/display/72867
17:54Chouserdurka42: yeah, what hiredman said
17:54Chouserbut if you want to restart anywhere other than the lowest level, or not restart at all, then I don't see how to avoid an Exception.
17:54Raynesread-line if broke in whatever version of Clojure Programming Clojure's sample code is using.
17:56ayrnieuRaynes, where do you see read-line ? I don't see it in the book or in the sample code.
17:56gnuvince_,(/ 25000 365)
17:56clojurebot5000/73
17:56gnuvince_,(double (/ 25000 365))
17:56clojurebot68.4931506849315
17:56Raynesayrnieu: I was using read-line, with his version. It's not in the book.
17:56hiredmanclojurebot: clojurebot is also like life: you make trade-offs
17:56clojurebotAck. Ack.
17:56RaynesAlso, *is in my previous statment.
17:57hiredmanugh
17:57hiredmanstupid completeion
17:57Raynesstatement*
17:57Raynes-.-
17:57hiredmanclojurebot: clojure is also like life: you make trade-offs
17:57clojurebotIk begrijp
17:58danlarkinRaynes: testbuttsecks.clj? jeez...
18:00Raynesdanlarkin: :| You try to think of a namespace name at 2 am after being awake for 36 hours :|
18:01ayrnieujust go with 'no namespace'.
18:01RaynesThe file name is main.clj, the package is testbuttsecks
18:01danlarkinRaynes: :) nah I don't blame you, I'm still nameless for a project I've been working on for a few weeks
18:01technomancyI bet *that*'s awkward.
18:01ayrnieuclojurebot: jure words
18:01clojurebothttp://gist.github.com/54847
18:01technomancyoh no, please no. =)
18:02technomancywe have enough *jure projects already
18:02technomancyexcept injure. that would be awesome.
18:03hiredmanclojurebot: Xiphojura?
18:03clojurebot2009:Jan:29:16:03:17 <hiredman> I call Xiphojura
18:03danlarkinhahaha oh man
18:03danlarkininure
18:03danlarkininjure rather
18:03danlarkinthat's the only acceptable -jure name
18:03durka42antipleajure
18:04durka42seijure
18:04durka42that's enough of that i think
18:04RaynesHeh, you should see the Haskell project names :|
18:04RaynesThey all start with an H :|
18:05technomancyruby projects all started with R until about 2005
18:06danlarkinoh it's the same with everything, kde/gnome were all k--- and g---
18:07technomancyI think a language outgrows that after a while. Hopefully with Clojure it can happen sooner rather than later.
18:07duck1123what do you think of a clojure-based identi.ca clone named indenjure
18:07ryszard_szopasuo-jure would be a good name for a project that is *something* in its own right
18:08duck1123I wanted to contact the .ar registar to get spec.tacul.ar
18:24hiredmanclojurebot: two cents is <reply>�
18:24clojurebotc'est bon!
18:25kotarakclojurebot: this is not a bug
18:25clojurebot'Sea, mhuise.
18:26hiredman,0800
18:26clojurebotEval-in-box threw an exception:Invalid number: 0800
18:26hiredman,0700
18:26clojurebot448
18:26hiredmanweird, yes?
18:27Chouserwhat's wierd?
18:28Chouserweird
18:28danlarkinhiredman: prefixing a number with 0 means octal
18:29hiredmanoh
18:29hiredmanof course
18:39danlarkinChouser: I came to the conclusion that clojure-json does belong in contrib. Or rather that contrib should have a good json library.. which it does, certainly, just that clojure-json has a few more features, but stephen's version is so much simpler, so I donno
18:41Chouserhm...
18:42Chouserhave you talked to him about it at all?
18:42danlarkinno I haven't
18:43danlarkinprobably should :)
18:44ozy`what's the word on efforts to get clojure featured in a hip new anime?
18:45ozy`you know, to compete with common lisp
18:45technomancyozy`: there was talk of using it to replace VB for creating a GUI to track IP addresses...
18:46danlarkintechnomancy: re: IP GUI: I'm all over that
18:46hiredmanthe first gui stuff I did with clojure was making a fake "TCP Flow Control Panel"
18:48ozy`technomancy: "serial experiments lain" was a -bit- more tech-savvy than CSI ;)
18:49ozy`I would like to make one of those interfaces where you type random keys into a window and it displays random lines and circles all over the screen
18:49ozy`that would be a neat prop to confuse my friends with
18:50hiredmanozy`: I think that is called "unicode font browser"
18:50hiredman,(char 3424)
18:50clojurebot\?
18:50hiredmanhmm
18:50ozy`hiredman: well played....
18:52hiredman,(char 1342)
18:52clojurebot\?
18:52hiredmanhmm
18:53ozy`technomancy: played Uplink recently? that's an even niftier hacking GUI... you could remake that with 3D graphics and it would be a blast
18:53ozy`:p
18:53ozy`,(char 1492)
18:53clojurebot\?
18:53hiredman,(char 1111)
18:53clojurebot\?
18:54hiredman,(char 911)
18:54clojurebot\?
18:54ryszard_szopa,(char 666)
18:54clojurebot\?
18:54mudphonetechnomancy: we'll probably need angelina jolie to help out too.
18:54ayrnieuthat character does not warrant its code.
18:55ryszard_szopa,(char 777)
18:55clojurebot\?
18:55ozy`,(map char (range 666 700))
18:55clojurebot(\? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \� \�� \?)
18:56Hunoh noes. my unicode font has a hole
18:56ryszard_szopawell, apparently phonetics is evil
18:57Chousukeregarding the technical realism in CSI... didn't they use photo manipulation in one episode to look behind a corner or something? /:
18:57ChousukeI think that's awesome.
18:57ozy`yeah, I hear they do that on a regular basis
18:57Hunblade runner did that first
18:57hiredmaninfinite resolution security cameras
18:57ozy`but with blade runner he was looking under the edge of a framed photo, wasn't he?
18:57Hunnumb3rs had some steganography a while ago
18:58Hunthey hid text in jpgs
18:58ayrnieu,(java.util.Date. (long (* 1000 1234567890)))
18:58clojurebot#<Date Fri Feb 13 15:31:30 PST 2009>
18:58Chousukeor getting the face of the attacker from the reflection in the victim's eye.
18:58ozy`D:
18:58Chousukethough that's almost believable.
18:58Hunand the cooldudes found it by zooming infinity plus one times in to read it
18:59Hunergo zoom a single black pixel to make it become a tiny `o'
18:59ozy`I think it was 24 (didn't see it, only heard about it) where someone takes a guard's picture, magnifies it in a copier, and holds it up to a retina scanner to get through a oor
18:59ozy`*door
18:59Hunawesome. i need one of those xeroxen
18:59Chousukeheheh
19:00technomancyyou sure that wasn't Space Quest IV?
19:00Chousukesee, unreal computer tech in movies is a GOOD thing.
19:00Chousukeendless source of amusement.
19:00ozy`Chousuke: and of "interesting" deadlines from easily amused management... ;)
19:00Huna few years ago in cobra 11 (german police series), the goodguys had a picture of the car of one of the badguys
19:01Hunbut a tree was blocking the sight of the license plate
19:01Hunso they photoshopped the tree away to read it
19:02ryszard_szopado you think it would be possible in Clojure to have sql queries behave like lazy sequences? So that you could do eg. (drop 5 some-query), and that would return a query like the original but with offset 5?
19:02danlarkinHun: I wish I could do that!
19:03hiredmanryszard_szopa: sure, just need someone to write it
19:03Chousukewell, hmm
19:03ozy`Hun: they should take that to its logical conclusion. some spies need to look inside a safe, so they take a picture from the other side of town and then photoshop it so it shows the room with the safe
19:03Chousukeyou could write something that executes the query when realised I guess
19:03hiredmanyou have an sql query, that has a custom seq
19:03ozy`and then when they have trouble shooping the safe open, someone has to flip a switch from "magic" to "more magic"
19:04Hunozy`: oh yays :)
19:04ryszard_szopahiredman: yeah, but how to implement stuff like filter?
19:05Hunozy`: and they photoshop the case away to see where the single wire to that switch goes
19:05ryszard_szopahiredman: I was thinking of having some map that would get serialized to the argument right after select
19:05Chousukeryszard_szopa: that sounds like you'd be better off creating a DSL with its own filter and drop functions.
19:06ryszard_szopaChousuke: well yeah, but lazy seqs are so cool ;-)
19:06Chousukeyou could still expose it as a lazy seq I guess.
19:07ChousukeI guess it'd be like a resultset-seq; only your DSL would allow you to manipulate the query in a functional style before you execaute it.
19:07Chousukeexecute*
19:08Chousukeimplementing such a system doesn't sound trivial though :/
19:09danlarkinthis is like how django QuerySet objects behave
19:09ozy`ants.clj has an internally inconsistent function definition style.... sometimes the docstring is before the arglist, sometimes after
19:09ozy`is there any semantic difference there?
19:10danlarkinModel.objects.all()[4:10] is offset 4 limit 10
19:11Chousukedanlarkin: does that modify the query itself? :/
19:11ryszard_szopadanlarkin: yeah, exactly... but in Python is just enough to implement a __getitem__ method
19:11danlarkinChousuke: yes, django QuerySet objects are lazy
19:11ryszard_szopacollections just have first, rest and something else I don't remember
19:11ayrnieuozy, (arglist docstring) is more common across languages, but it doesn't also work with multi-arglist functions.
19:13ayrnieuI found (docstring arglist) off-putting, but it puts [name list & more] closer to your (name (more (list ...)))'ing code.
19:13technomancyyeah, I found the different locations of the docstring kind of weird too
19:14technomancymakes sense why it's necessary though.
19:14Chousukeso wait, it works after the arglist in some cases? /:
19:14technomancyI have a hard time remembering to do it the clojure way
19:14technomancyChousuke: I don't think so.
19:14ozy`technomancy: looks like rhickey does, too :p
19:15ayrnieu(defn foo [] "doc" ...) works, yes.
19:15ozy`to be clear: this code is switching back and forth between (defn foo [args] "doc" (only-one-body)) and (defn foo "doc" [args] (still-only-one-body))
19:15ryszard_szopathat's kinda funny...
19:16ayrnieuyou don't have to stick to in-function docstrings, though; you can add the documentation in a later step.
19:16ryszard_szopaI guess it would be saner if the lisp/python way didn't work
19:17ryszard_szopaoh, but if you do it the docstring-after-args way doc doesn't show the docstring
19:18ayrnieuoops.
19:18technomancyryszard_szopa: you can put a string *anywhere* in a function body if you want. =)
19:19technomancyit's just not a docstring
19:20ozy`@stuff splices the contents of 'stuff into the current (arg)list, right?
19:21Chousuke,'@x
19:21clojurebot(clojure.core/deref x)
19:21Chousukeso, no. :)
19:22ayrnieu,`(def x [~@(list 1 2 3)])
19:22clojurebot(def clojure.core/x [1 2 3])
19:22ayrnieu,`(def x [~(list 1 2 3)])
19:22clojurebot(def clojure.core/x [(1 2 3)])
19:27ryszard_szopatechnomancy: so the docstring after args way *doesn't* work, after all. so it's sane. :)
19:28ayrnieu,(.setMeta #'+ (assoc (meta #'+) :doc "Returns the sums of nums. (+) should never be used."))
19:28clojurebotnil
19:28ayrnieu,(doc +)
19:28clojurebot"([] [x] [x y] [x y & more]); Returns the sums of nums. (+) should never be used."
20:11gnuvince_Wow
20:11gnuvince_An operation on 100 files took 188 seconds
20:11gnuvince_I added a type hint to some of the called functions
20:11gnuvince_dropped to 60 seconds
20:13ozy`see, the static typing people aren't -that- crazy :p
20:13gnuvince_Who said they were crazy?
20:14danlarkingnuvince: use (set! *warn-on-reflection* true) to find all places you're having to reflect
20:15gnuvince_danlarkin: do I need to put one per file?
20:15danlarkingnuvince_: no
20:15ayrnieuyou can set it once and then load all of your files.
20:20gnuvince_I'm gonna need to find more efficient ways to improve performance
20:29gnuvince_hmmm
20:29gnuvince_3 3.89% 23.43% 2216296 304693 sun.reflect.ReflectionFactory.copyMethod
20:30gnuvince_2.2M calls to copyMethod, is that usual in Clojure?
20:33darrintI "need" a loop to call setPosAt in Qt many times. Where do I find how to do that?
20:35Chouserdotimes, doseq, loop/recur
20:35ayrnieudorun
20:35darrintdotimes looks like what I need. Much thanks.
20:36ChouserThat's listed here under Looping: http://clojure.org/macros
20:36sohailhey how is the Qt interface going? is it still fugly
20:37darrintHope you aren't asking me. It's prettier from here than raw C++. That's all I know.
20:38Chouserseveral people have taken swings at it
20:38danlarkinChouser: pun intended?
20:39darrintI'm trying to make Graphics View work. So far so good.
20:39Chouserdanlarkin: nah, but I'll take it. :-)
20:41gnuvince_grrr!
20:45darrint"Hello World!" moving diagonally. w00t!
20:46darrinttomorrow, the world.
20:46dreishWas that in Acorn BASIC?
20:46ayrnieu(doto world greet conquer)
20:46dreishIf not, too bad. I love Acorn BASIC.
20:47dreishThough it might be better with macros.
20:48ayrnieudoto: http://paste.lisp.org/display/74762
21:04darrintOk. It there a quick way to get from a vector of some objects to a java array of that object?
21:04Chouser(into-array myvector)
21:06hiredmanthat was pretty quick
21:06darrintthanks.
21:08ayrnieu,[(into-array Integer/TYPE [1 2]) (into-array [(int 1) (int 2)])]
21:08clojurebot[#<int[] [I@15cd9a> #<Integer[] [Ljava.lang.Integer;@145d424>]
21:09ayrnieuoh, you don't need the (int %) in the second case. Instead:
21:09ayrnieu,(into-array [1 2 "3"])
21:09clojurebotjava.lang.IllegalArgumentException: array element type mismatch
21:10Chouserright, you can't put primitives in a Clojure container.
21:10hiredmanauto-bbbbbboxing
21:11ozy`,`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`a
21:11clojurebotclojure.core/a
21:12hiredmanI should figure out why clojurebot evals that to clojure.core
21:12ozy`,'a
21:12clojurebota
21:12ozy`,''a
21:12clojurebot(quote a)
21:12ChouserI think if you run Script, it defaults to clojure.core instead of user
21:12ayrnieuclojure.core vs. sandbox, ozy.
21:12ozy`,'~'a
21:12clojurebot(clojure.core/unquote (quote a))
21:12ozy`weird
21:12ayrnieu,*ns*
21:12clojurebot#<Namespace sandbox>
21:12ayrnieu,`~*ns*
21:12clojurebot#<Namespace sandbox>
21:13hiredmanChouser: I run Repl
21:13Chouserhm... oh, new thread?
21:13ayrnieu,::a
21:13clojurebot:clojure.core/a
21:13Chouserbindings go back to root
21:13hiredmanyeah, but *ns* is bound to (create-ns 'sandbox)
21:14hiredman,*ns*
21:14clojurebot#<Namespace sandbox>
21:14Chouserbefore you 'read'?
21:14hiredmanoh, I see
21:14cp2does anyone here have experience with lisp while on lsd?
21:17hiredman,~`a
21:17clojurebotjava.lang.IllegalStateException: Var clojure.core/unquote is unbound.
21:17hiredman,`~`a
21:17clojurebotsandbox/a
21:17hiredmanshaza
21:26Chouserhiredman: good job!
21:30ozy`cp2: that would be fascinating, I'm sure...
21:30ozy`,`~`~(exit)
21:30clojurebotjava.lang.Exception: Unable to resolve symbol: exit in this context
21:33metaperlcould someone share their .emacs config to use clojure-mode.el?
21:33metaperlis *command-line-args* in the package user?
21:34ayrnieuhttp://paste.lisp.org/display/74008
21:34ayrnieu,(var *command-line-args*)
21:34clojurebot#'clojure.core/*command-line-args*
21:34darrintIs (connect) part of the clojure api?
21:34cp2ozy`, i havent done it, but it would be interesting
21:35cp2i remember the first time i used a computer while using lsd, it seemed like everything made sense
21:35cp2but of course i didnt remember many details, so meh ;(
21:35ayrnieudarrint - no.
21:36darrintHow can I instrospect on the symbol and figure out where it came from?
21:36ayrnieu,(var *command-line-args*)
21:36clojurebot#'clojure.core/*command-line-args*
21:36ayrnieu,(meta (var *command-line-args*))
21:36clojurebot{:name *command-line-args*, :macro false, :doc "A sequence of the supplied command line arguments, or nil if\n none were supplied", :ns #<Namespace clojure.core>}
21:37darrintthanks
21:37metaperlayrnieu: thank you, however, it appears that slime is under cvs version control - http://common-lisp.net/project/slime/ ... where did you get a git clone?
21:38ayrnieumetaperl - I didn't, but see http://github.com/search?q=slime
21:38metaperlyour .emacs says ; git clone next to your load of slime
21:39ayrnieuthat isn't mine.
21:39metaperloh :)
21:39darrintnow I get it.
21:50lisppaste8metaperl pasted "(require 'clojure-auto) is failing" at http://paste.lisp.org/display/74844
21:53ayrnieudoes ~/emacs-contrib/clojure-mode/clojure-auto.el exist?
21:53hiredmanclojurebot: emacs?
21:53clojurebotbut I like using notepad++!
21:54durka42clojurebot: vim?
21:54clojurebotExcuse me?
21:54ayrnieuoh, you don't need clojure-auto anyway; you already have the autoloads in your .emacs
21:54durka42clojurebot: vim is <reply>Gesundheit!
21:54clojurebotIk begrijp
21:55darrintIs there a way to force gc from clojure?
21:55ayrnieu,(System/gc)
21:55clojurebotnil
21:55durka42i suppose Runtime.getRuntime().gc() would work
21:55durka42that too
21:55hiredmanif there is a way from java there is from clojure
21:55metaperlayrnieu: no ... I think that would be generated by the `update-directory-autoloads' function ... which I did not run
21:56dreishOccasionally I find microbenchmarks improve after a (System/gc) by more than the time (System/gc) itself took.
21:56darrintthanks
21:56darrintdreish, Occasionally I find that Qt apps hang for several seconds unless I call (System/gc) right after they exit. (maybe...)
21:57dreishOoh. That's unfortunate.
21:57dreishAt least there's a workaround.
21:57darrintI just keep putting (do (load-file "testqt.clj") (testqt/hello-graphics-view) (System/gc)) in the repl to test my app.
21:58darrintWell, got the long hang despite the gc. Mystery remains...
21:58cooldude127hey what shell does everybody use?
21:58dreishzsh
21:59dreishBash has pretty much caught up thought.
21:59cooldude127dreish: i'm thinking about switching to zsh
21:59dreishs/t\././
21:59durka42i use zsh because i read this blog post about how awesome it is, but i haven't really found anything that's incredibly awesome
21:59dreishIt's nice. I think Bash still only has one of the two =() <() forms.
21:59durka42the smarter tab completion is annoying as often as it's helpful
22:00ayrnieuI used to like zsh because I thought it cute to put my directory in RPROMPT; nowadays I do nothing special with the shell.
22:01cooldude127anyone have a good resource on how to customize zsh?
22:02dreishhttp://www.amazon.com/Bash-Z-Shell-Conquering-Command/dp/1590593766
22:02ayrnieuhttp://www.dotfiles.com/index.php?app_id=4
22:03lisppaste8metaperl pasted "java.lang.NoClassDefFoundError: clojure/main" at http://paste.lisp.org/display/74845
22:12hiredman ugh
22:13hiredmancooldude127: there are a few websites devoted to sharing .zshrc tips
22:13cooldude127http://www.wunjo.org/zsh-git/ this is pretty cool
22:13hiredmanhttp://zshwiki.org/home/
22:14hiredmanhuh
22:15hiredmanthats right, there is a zsh channel on freenode
22:16cooldude127that sounds right
22:20cooldude127holy jesus this is the most informative prompt i've ever seen
22:20hiredman:P
22:21hiredmanthe most important bit is a. hostname completion based ssh's known_hosts b. completiong of remote files for scp and rsync
23:11metaperlI'm not sure what the point of running ant was --- the downloaded clojure already had a clojure.jar in it...
23:13cooldude127lol
23:27newb12345user=> (use '[clojure.contrib.str-utils :onl (str-join)])
23:27newb12345java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath: (NO_SOURCE_FILE:0)
23:27newb12345how do I make this work?
23:29durka42is clojure-contrib.jar on the classpath?
23:31durka42newb12345, how did you set up contrib
23:35cooldude127newb12345: (System/getProperty "java.class.path") <- what does that give you?
23:35newb12345I run it from a dire that contains both clojure.jar and clojure-contrib.jar
23:36cooldude127newb12345: that doesn't add them to the classpath
23:36durka42in that case make sure the classpath contains "." (the current dir)
23:36durka42also you should spell :only correctly, but that isn't the error
23:36cooldude127durka42: that won't include the jars
23:36durka42oh
23:36durka42meh
23:36cooldude127he needs to explicitly specify the jars
23:36durka42i need to update smuggler to take note of that
23:37durka42is there a comprehensive reference on this stuff, along with extdirs
23:39cooldude127i don't know one
23:39cooldude127this is just built-up experience
23:39durka42extdirs is recursive though, yes?
23:39cooldude127i have no idea
23:41newb12345user=> (System/getProperty "java.class.path")
23:41newb12345"clojure.jar"
23:41cooldude127newb12345: there is problem
23:41durka42how are you running clojure?
23:41newb12345java -jar clojure.jar
23:41durka42try:
23:42durka42java -cp clojure.jar:clojure-contrib.jar -jar clojure.jar
23:42cooldude127durka42: i'm not positive, but i think those options conflict
23:43newb12345x@x:~/build/clojure$ java -cp clojure.jar:clojure-contrib.jar -jar clojure.jar
23:43newb12345Clojure
23:43newb12345user=> (use '[clojure.contrib.str-utils :only (str-join)])
23:43newb12345java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath: (NO_SOURCE_FILE:0)
23:43durka42oh, they do
23:43durka42java -cp clojure.jar:clojure-contrib.jar clojure.main
23:44cooldude127durka42: that one's a winner
23:44durka42(they conflict silently... java just ignores the classpath. classy.)
23:44newb12345works now
23:44cooldude127lol
23:44newb12345durka42: thanks
23:45durka42in fairness, the behavior is documented on the man page
23:46cooldude127durka42: no, that is not enough
23:57knaprif id o (let [x (ref a)] ...) and then change x or a, i dont change the other rght?
23:57knaprany plans on porting clojure to its own vm or to make it selfhosted?
23:58durka42as to the second question
23:58durka42i don't think so