#clojure logs

2009-02-12

00:05replacayeah, destructuring bind is one of the great lispisms
04:12AWizzArdclojurebot: max people
04:12clojurebotmax people is 149
04:25leafwanybody can comment on the binding+import problem I just posted to the list
04:26leafwis this a clojure bug, or am I missing something.
04:34hiredmanimport works in side binding here
04:35hiredmanuser=> (binding [] (import '(java.io File)))
04:35hiredmannil
04:35hiredmanuser=> File
04:35hiredmanjava.io.File
04:37leafwthat is case 1.
04:37leafwcase 2 fails.
04:38leafwthis fails: (binding [*out* bout] (import '(java.io File)) (println (File. "/home/albert"))
04:38leafwi.e. the import and the usage of the import all within the same binding block.
06:04tomswIs there an inbuilt function to get the length of a list? I'm trying to write a function to shuffle a list and (afaik) for this i need the length
06:04ayrnieu,(count '(1 2 3))
06:04clojurebot3
06:07AWizzArdtomsw: maybe you should shuffle a vector
06:07AWizzArdLists are not particularly important in Clojure.
06:18alinpopatomsw: you can use size from java: (.size '(1 2 3))
06:19alinpopaI don't know if it's not slower than count .. but if you come from a java world you can use it (eg. you can use length for strings: (.length "abc") => 3)
06:20alinpopa.(.size '(1 2 3))
06:20alinpopa,(.size '(1 2 3))
06:20clojurebot3
06:20alinpopa,(.length "abc")
06:20clojurebot3
06:37leafwalinpopa: it's the same really. count will call .length or .size, setup on read time, depending upon data type.
06:37alinpopaleafw: thanks for explanation
06:38alinpopaI noticed that count is more general form (eg. instead of using .length for String and .size for collections, count can be used for both)
06:54tomswok, I'm used to CL. Here's my attempt to shuffle a collection...
06:54lisppaste8tomsw pasted "Shuffle a collection" at http://paste.lisp.org/display/75328
06:54tomswComments welcome: be cruel to be kind (but not too cruel...)
06:59Chousuketomsw: why the weird destructuring?
07:00Chousuketomsw: looks like you should instead just overload it for one and two arguments
07:01tomswChousuke: the optional "up-to"?
07:03lisppaste8Chousuke annotated #75328 with "overloaded... not guaranteed to have matching parens." at http://paste.lisp.org/display/75328#1
07:03Chousukegah! just a moment after I clicked submit I noticed one missing paren...
07:03Chousukeafter the (shuffle coll (count coll))
07:05tomswChousuke: oh I get it. I didn't want to duplicate code, forgot that one overloading can use another.
07:05Chousukeotherwise that looks okay I think.
07:06ChousukeI think there's an implementation in contrib that copies the coll into a java array and uses java's shuffle, then returns that in a vector
07:06tomswChousuke: that's just cheating
07:06Chousukeyeah, it is :)
07:07Chousukebut sort does it too
07:07Chousukeit's probably a fair bit faster for larger collections too :/
07:07tomswChousuke: also, the wheel isn't as new & shiny as it used to be
07:07ayrnieucheating is destructively sorting a linked list via an array of pointers to cons cells.
07:08ayrnieugoing through a java array is just good sense :-)
07:08ChousukeI guess the immutable data structures just aren't fit for shuffling very efficiently :)
07:08Chousukenot that it matters much
07:10tomswChousuke: I have been trying to work through "Purely functional data structures" which shows how you can get good performace with immutable data structures. Just haven't got far enough to spot anything that might apply to shuffling. Quite a good way to hurt your brain though
07:11Chousukewell, shuffling is something where it's beneficial to be destructive, at least during shuffling
07:11Chousukesince you don't care at all about what the structure looks while you're shuffling
07:14Chousukeif you do the copy-and-shuffle trick the function remains purely functional to the outside anyway (to the extent that functions producing random results can be called purely functional)
07:15tomswChousuke: :) not at all, in fact...
07:19Holcxjo But, if you do it purely functional you might be able to do parallelise the shuffling?
07:19ayrnieuChousuke - they can't. But you can pass them the RNG's state, or imply this in a state-of-the-universe argument.
07:20ayrnieubut they can be pure and nondeterministic.
07:34tomswis there a good way to look up the java docs from inside Emacs?
07:37Holcxjotomsw: (use ['clojure.contrib.javadoc])
07:37ChousukeHolcxjo: that's easy to do with copying and destructive shuffling as well: just shuffle each half separately and concatenate :)
07:37HolcxjoThat's the best I know
07:37Holcxjothen (javadoc String) and a browser should open up
07:39HolcxjoChousuke: True :-) Although you might actually get better memory performance if you don't write into an consecutive array from multiple CPUs as the same time.
07:43tomswChousuke: ? but if you split a sequence in half & shuffle the halves separately, it won't be a fair shuffle
07:43Holcxjotomsw: Nope, you'll need to do more work
07:43Holcxjotomsw: He was just commenting on my paralisability comment
07:45Holcxjotomsw: and the more I think about it, the less I am convinced one can improve it much with parallel processing
07:45AWizzArdcool would be if one could simply do (sort random collection) and it shuffles that stuff
07:56tomswAWizzArd: trouble is that most sort algorithms assume they're sorting an ordered datatype - ie, two given items always have the same order. This won't be the case if your sort predicate is non-deterministic - and the combination won't guarantee a fair shuffle
07:58achim_pin some situations you could assign random values beforehand
07:58achim_p,(map val (sort-by key (zipmap (repeatedly rand) (range 10) )))
07:58clojurebot(4 7 9 8 3 5 1 6 0 2)
07:58Holcxjoshuffle is only O(n) right? Relying on sort (assuming it works as intended) is likely to get you into the O(n log n) teritory.
07:58achim_pHolcxjo: right
07:59HolcxjoSounds like a silly tradeoff
07:59achim_pbut tomsw's shuffle looks quadratic as well
07:59achim_premove-at is linear, i think
08:00HolcxjoOh, yes that might be.
08:01HolcxjoOne should probably use vectors and swap elements -- that's meant to be (amortised) O(1), right?
08:02tomswso copy the sequence into a vector, swap, copy it out again
08:02AWizzArdif the shuffeling is not a task which the computer needs to do for hours and hours, then the efficiency may not matter very much.
08:03cemerickChouser: you did up a 2x2 of the various reference types (atoms, refs, vars, etc) -- where might that be?
08:03Chousercemerick: http://clojure.googlegroups.com/web/clojure-conc.png
08:04Chouserthat's missing var and now future
08:05cemerickor, :-(
08:06rhickeyChouser: while future and delay now both support deref, I don't consider them full references as they don't mutate
08:06HolcxjoMore reliable than sort and still in the silly teritory would be to use be to use clojure.contrib.combinatorics's (permutations coll) -- pick a random numbe between 0 and (factorial (count coll)) and use that as an index into the collection of permutations...
08:07HolcxjoPut I guess, contrib.lazy-seqs's random-permutation is the real answer...
08:07cemerickrhickey: thanks again for your rapid assistance a few days ago. Our entire codebase is now safely "ported" to HEAD.
08:07rhickeycemerick: that's great!
08:07Holcxjo(which "cheats" and used java.util.Collections/shuffle )
08:08AWizzArdIs using random-permutation then also cheating? ;)
08:10Chouserfuture .isDone mutates, but I guess that's not quite the same thing.
08:11applicablecan someone writ the ycombinator in clojure?
08:12rhickeyChouser: isDone is not the cell itself
08:12Chouserapplicable: like this? http://groups.google.com/group/clojure/browse_frm/thread/3259f09e08be4cfd/21f0e19fdce15ae9
08:13rhickeyI'm running our of words to distinguish the indirection part from the mutable box part
08:14Chouser"isDone is not the reference"?
08:14Chousereh.
08:18lisppaste8AWizzArd pasted "Kent Pitmans implementation of the Y-Combinator, for applicable" at http://paste.lisp.org/display/75330
08:20AWizzArdrhickey: maybe short fantasy names can be used? (fub ...) (shunk ...) and so on?
08:20AWizzArd"Let's shunk-fub this code..."
08:23HolcxjoWhen running out of names, using a different language is always a good choice. Classic Sanskrit is good as there won't be any name clashes with existing code...
08:24Holcxjo.. readablity suffers a bit though.
08:26leafwswitch to spanish -- second world language.
08:26leafwI meant, second language in the world.
08:26HolcxjoRight after Chinese?
08:27leafwyes.
08:27Holcxjoso, why not Chinese?
08:27leafwlatin script.
08:28leafwnot symbols.
08:30HolcxjoAh yes, Java is still stuck in the 20th century and doesn't cope with Unicode identifiers, right?
08:31Chouserno, Clojure can handle unicode identifiers, but they're generally avoided by builtins.
08:32cemerickif you're on a mac, a lot of useful mathematical symbols are an easy shortcut away, which helps a lot
08:37Chousukeheh
08:37Chousukeno lambda shortcut on this layout though ;(
08:38Chousukewonder if clojurebot allows defmacros now.
08:38Chousuke,(defmacro ? [& body] `(fn ~@body))
08:38clojurebotDENIED
08:38Chousuke:(
08:39cemerickChouser: fwiw, it's easy to remap some keybinding to lambda on the mac using DefaultKeyBinding.dict (a simple plist mapping between keystrokes and what you'd like them to emit)
08:39Chousukewell, yeah
08:40AWizzArdcemerick: even easier when you use the Neo layout instead of qwertz. There you have several greek letters available. "lambda" could be written as "??????" for example :)
08:41cemerickChousuke: nope, I'm a simpleton :-)
08:44ChousukeWhen doing tabcompletion, irssi prefers people who were last seen speaking
08:44Chousukeone of those features you wouldn't think of at first, but make a whole lot of sense when you think about it.
08:49leafwChousuke: irssi has a large club of fans.
08:49leafwChousuke: irssi has a large club of fans.
08:49leafwdetachable IRC non-browser bound. Like, reinventing water (and awesome)
09:11lisppaste8tomsw annotated #75328 with "untitled" at http://paste.lisp.org/display/75328#2
09:15rsynnottChousuke: that feature can occasionally be terribly confusing
09:36AWizzArd,(doc call-future)
09:36clojurebotjava.lang.Exception: Unable to resolve var: call-future in this context
09:36Chousuke,(doc future-call)
09:36clojurebot"([f]); Takes a function of no args and yields a future object that will invoke the function in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block."
09:37AWizzArdCan one (await a-future)?
09:38Chousukeawait is for agents
09:38Chousukeall you need to do is @afuture
09:39AWizzArdfuture-call will directly fire off the execution? Or will that future only run when I try to deref it?
09:40ChousukeAWizzArd: it'll start instantly.
09:41Chousukeit's a computation that will complete sometime in the future.
09:42Chousukeso you can start the computation, do other stuff and use the future result when you need it; if it isn't completed yet, it'll just block until it's done.
09:42Chousuke"easy" threading :)
09:42AWizzArdyes
10:31Chouserthis stupid graph has me peeved. why can't I find better tools for this?
10:42cemerickChouser: graph of?
10:45Chouserthe class inheritence
10:45Chouserit's just a directed graph, with the connections created programmatically.
10:45cemerickah, yeah, stuff like that can be very painful
10:45AWizzArdstrange that there are no Java tools yet, to visualize that
10:45Chousergraphviz dot is a fine 80% solution (or maybe 60%)
10:46cemerickof course, the real goods are in the last 5%
10:46cemerickAWizzArd: there's lots of options, but none ever really do all that you want
10:46Chouserbut the latest inheritence change (adding Counted) has pushed it over the edge, and the thing is now unreadable, and I'm simply failing to find a way to fix it.
10:47cemerickChouser: do you have a draft of the new version? Maybe it's not really that bad...
10:47ChouserI think what I want is dot (or something like it) to produce an initial layout, and then be able to drag around nodes or groups of nodes manually
10:47Chousercemerick: http://chouser.n01se.net/misc/tmp.png
10:48Chousercemerick: if you can tell by looking at that chart what two things IPersistentSet implements, I'll publish this version.
10:49Chouseranyway, that doesn't sound like a tall order, but apparently it is. :-P
10:50cemerickIPersistentCollection and Counted, I think :-D
10:50Chouserheh. yeah. very nice.
10:50Chousukecemerick: you're good at guessing
10:50cemerickhonestly, I've seen *much* worse
10:50Chouserbut it needs to me useful, otherwise what's the point?
10:51cemerickChousuke: :-) well, there are only so many pink lines, and the only other options was PersistentQueue, but that didn't have an arrow
10:51Chouser,(parents clojure.lang.IPersistentSet)
10:51clojurebot#{clojure.lang.IPersistentCollection}
10:51cemerickdon't know what to say to color-blind people, though
10:51Chousukemaybe it'd be better to have some kind of "badges" for the most common interfaes
10:52Chousukeand just tag other interfaces and classes with those badges.
10:52Chouseroo!
10:52cemerickChouser: omnigraffle has *really* good tools for rearranging graphs "gently" -- so you could move stuff around as you like, and it tries to satisfy whatever other constraints you've set while disturbing your manual placements minimally
10:53cemericknot sure what it has under its sleeve for data import, tho
10:53Chousercemerick: yeah, that's usually the kicker.
10:53Chouserthere are the nice interactive tools, and then there are the ones with clean data import
10:54ChouserI've been eyeing the idea of using xslt to tweak an inkscape svg file, but ... well... *sigh*
10:54cemerickChouser: omnigraffle pro supports graphviz dot files, apparently: http://paco.to/blog/000040.html
10:55cemerickI have OP, if you want me to give it a shot with the dot file you have
10:55lisppaste8Chouser pasted "latest graph.dot for cemerick" at http://paste.lisp.org/display/75338
11:04Chouserit looks like they're working on something called smyrna that may do what I want.
11:18AWizzArdrhickey: is there a plan for a lazy version of futures? One which only kicks of the execution of the future when the deref is made?
11:19jbondesonAWizzArd: but then it would immediately block your thread of execution
11:20AWizzArdwhy?
11:20jbondesonderef'ing a future blocks until the calculation is complete
11:20AWizzArdright
11:20AWizzArdit would only block when the deref happens
11:20jbondesonso if it waited until a deref request you'd be blocked.
11:21AWizzArdbut if it never happens then my other threads get more cpu time.
11:21jbondesonso it would act exactly like a lazy function evaluation.
11:21AWizzArdyes
11:21AWizzArd,(doc delay)
11:21clojurebot"([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force), and will cache the result and return it on all subsequent force calls"
11:22jbondesoni'm confused why you would use futures for that.
11:22jbondesonseems like you want a new object that implements deref that evaluates the function when you deref
11:23Chousukethat's delay :/
11:23jbondesonkinda, it's a thin wrapper over delay that makes it look like a regular reference
11:23Chousuke,(let [a (delay (println "test") 1)] (println "test2") @a)
11:23clojurebot1
11:24clojurebottest2 test
11:24jbondesonoh hey look at that
11:24Chousukethe funky print order is due to how clojurebot handles *out*
11:24jbondesonsooo, now i'm really confused why delay doesn't work for you AWizzArd
11:25AWizzArdjbondeson: before I write 3 minutes ago ,(doc delay) I did not know about the existance of delay.
11:25cemerickChouser: so, OP will create a decent force-directed graph, but that loses all of the nice alignment of related items
11:26AWizzArdwrote
11:26jbondesonah
11:27Chousukehm
11:27Chousukeit's not like the lines in the graph need to be continuous, as longs as it's clear where they connect :)
11:28Chousuke-s
11:28ChousukeI have no idea how to do that with dot though :/
11:29cemerickI can post what OP produced, but I don't think it's an improvement...
11:30Chouserwell, I posted this yesterday too, but it wasn't popular: http://chouser.n01se.net/misc/tmp2.png
11:30danlarkinhurts my eyes!
11:30Chouserbut you can tell where the lines are going, and you can read the text.
11:31Chouserall its missing is a certain aesthetic
11:31ChousukeI mean, why do you need lines at all
11:31AWizzArdjbondeson: is it new that you can (deref a-delay)?
11:32ChousukeI think UML has some notation for a "teleport" kind of thing :P
11:32AWizzArdI can not run your example, I have to use (force a)
11:32ChousukeAWizzArd: I think it was added with futures.
11:33jbondesonAWizzArd: with futures IDeref was added, so yeah, i think that's where it came in
11:34jbondesoni didn't even know you could do that, but you learn something new every day.
11:35gnuvinceIs there an easy way to get the entire content of a file in a string with Clojure? (something (reader "/etc/passwd"))?
11:36Chouserslurp
11:36jbondesonlove that name
11:36ChouserI must say I prefer slurp to spit
11:36jwinter,(doc slurp)
11:36clojurebot"([f]); Reads the file named by f into a string and returns it."
11:36rhickeyChouser: spew?
11:36gnuvinceChouser: thanks
11:36leafwI find line-seq easier to use than slurp -- or rather, more useful.
11:37gnuvinceAlways forget about it
11:37Chouserhurl? expectorate? regurgitate?
11:37Chouserwrite?
11:37jwinterleafw: how do you use line-seq?
11:40cooldude127does clojure have a way to extend the reader?
11:40leafwjwinter: http://github.com/acardona/xmms2-clj/blob/89ae9d125af9968fefcf7c31505c23000a29c0f4/xmms2.clj#L34
11:41leafwjwinter: just give a reader to line-seq.
11:41jwinterleafw: cool, thx
11:41Chousercooldude127: like adding new reader macros? no.
11:42cooldude127Chouser: :( is it planned at some point?
11:43Chousercooldude127: if you can figure out how to allow reader macros from different authors to be used at the same time, perhaps.
11:43Chouserin other words, no.
11:43shoovercooldude127: regarding your complaint yesterday about Math functions, have you seen clojure.contrib.import-static?
11:44fandaChouser: concerning creating graph of Clojure classes/interfaces...
11:44fandaone time I used yEd Graph Editor:
11:44fandahttp://www.yworks.com/en/products_yed_about.html
11:44fandaall you need is to generate for example .gml file, import it and then use some layout from the menu
11:44fandai guess it is more manual than graphviz, but it gives you more power...
11:45AWizzArdleafw: why not read-lines?
11:45AWizzArdin duck-streams
11:45cooldude127shoover: no, but really i'm disappointed in clojure's not having it's own math functions, for instance ones that work on ratios too
11:45cooldude127like absolute value
11:46cooldude127and such
11:46rsynnottdanlarkin: I'm very used to languages which haven't really changed in the last decade :)
11:46jbondesonthe only thing you have to be careful about with read-lines is that if you don't consume the entire sequence the file doesn't close
11:47Chouserfanda: thanks for yED -- I'll look at it.
11:49rsynnottcooldude127: you could always write your own
11:50p_ldanlarkin: The problem with changing languages is that sometimes you find this very useful piece of code, only to end with it not compiling because while it looks completely okay, someone changed the language since that time... <--- happened few times to me
11:51danlarkinp_l: yup, that'll happen
11:51danlarkinc'et la vie!
11:52p_ldanlarkin: When 'if(!var)' stops working, people get angry :-)
11:52jbondesonyou only really have to worry about that if you're providing other people with code, because you could always include a specific version of clojure in your jar you distribute.
11:52ChousukeAt least Clojure still has a good excuse to change. :)
11:52rsynnottindeed
11:52rsynnottoh, I'm not complaining about it
11:53rsynnottit's just not at all what I'm used to
11:53HolcxjoChouser: I had some luck with "mclimit=2500.0" in my .dot files -- improved the layout somewhat
11:53cooldude127rsynnott: i did, i was just disappointed that i had to
11:53leafwAWizzArd: didn't know about read-lines. But line-seq is lazy -- that alone is nice.
11:53p_lAlso, I guess that with clojure one could use macros to provide "compatibility layer" :-)
11:54jbondesonleafw: read-lines is lazy too.
11:56rsynnottp_l: to run programs for revision X on revision Y, use THIS macro, for revison Z use THAT macro :)
11:56rsynnottcould get messy
11:57leafw,(doc read-lines)
11:57clojurebotjava.lang.Exception: Unable to resolve var: read-lines in this context
11:57leafwaha. So read-lines is not in std clojure lib
11:57leafwdidn't know why I hadn't come across it.
11:57jbondesonclojure.contrib.duck-streams
11:57leafw,(doc line-seq)
11:57clojurebot"([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."
11:58jbondesonyou are responsible for teh reader you provide, read-lines will open the file for you and close it after you consume the sequence.
11:58p_lrsynnott: I envisioned something more like loading a jar which would use macros to redefine few things to emulate behaviour from a certain "version" (more like snapshot of language :) )
12:01p_lafk
12:01Chousukejbondeson: what if you never consume it fully, though? :/
12:03jbondesonChousuke: then it's not closed until the seq gets GCed.
12:03jbondesonif you're going to read the whole file it's good.
12:03jbondesonif you're not... well, i suppose you want something else.
12:06jbondesonit's just really handy when you know you're going to consume the entire file to not have to worry about the file reader object
12:09technomancycan someone explain to me why I can't call "read" on something I got from the "reader" function in duck-streams?
12:09technomancyseems like if I have a reader, I should be able to read, no?
12:09technomancyotherwise why call it a reader?
12:11Chouser'read' needs a particular kind of reader, but it's name is based on lisp history.
12:11cooldude127read is the R in REPL
12:11cooldude127:)
12:12technomancyChouser: couldn't it be made smart enough to turn a regular reader into a pushback reader?
12:15technomancya pushbackreader just means that characters can get pushed back onto the stream?
12:15ChouserI think so
12:17technomancyit's a nit-picky thing, but it really bugs me to have to say (read (java.io.PushbackReader. (reader file)))
12:18technomancyI suspect the problem with that is you'd have to turn read into a multimethod?
12:20cooldude127technomancy: you wouldn't have to, but it would be more elegant
12:20cooldude127wait is read implemented in clojure?
12:21cooldude127how could it be? you need a reader before you can do clojure
12:21technomancycooldude127: it calls clojure.lang.LispReader
12:21cooldude127oh
12:22technomancywhich I guess you could add a read method to that could perform the conversion?
12:22technomancyand you wouldn't have to change any existing code
12:23rsynnotthow are multimethods implemented for JVM, actually?
12:24Chouserrsynnott: clojure multimethods?
12:27technomancyI'll bring it up on the mailing list
12:43scottj_What's the idiomatic way to do cl's loop collecting?
12:45rsynnottChouser: yep
12:45Chouseryou need to build a new collection from an old one? only including non-nil things? (sorry don't know C:)
12:46ayrnieuscottj - for, filter, a function with a recursive (loop [accumulutor] ...)
12:46rsynnottI had the idea, though I may be wrong, that ABCL's poor CLOS performance was due to some problem in implementing clos multimethods in hava
12:46technomancyis there a slight performance hit when invoking multimethods vs regular functions?
12:46Chouserrsynnott: each defmethod is an object that has a map of dispatch values to fns
12:46Chousertechnomancy: yes
12:47rsynnottah
12:48Chouserrsynnott: the multifn also keeps a cache mapping the dispatch fn's return value to the appropriate defmethod fn.
12:48Chousersorry, messed up the earlier statement. each *defmulti* is an object...
12:49ayrnieursynnott - it may just be a bad implementation. But there's some activity just last month, with someone getting Closette on ABCL http://article.gmane.org/gmane.editors.j.devel/2276 , and with this thread http://article.gmane.org/gmane.editors.j.devel/2258
12:50Chouserso the given dispatch fn is called for every call to the method, but the heirarchy computation is cached so will be just an extra map lookup
12:50Chouserand I imagine all that gets in the way of hotspot efficiently inlining it, but I don't know that for sure.
12:51rsynnottah, it has a MOP; cool
12:51Chouserhttp://code.google.com/p/clojure/source/browse/trunk/src/jvm/clojure/lang/MultiFn.java
12:52rsynnottwhat's going on with the invokes, there?
12:52rsynnottis it an optimisation, or does java lack functions with arbitrary numbers of parameters?
12:53rsynnottoh, nevermind, found it :)
12:55Chouserwell, I think Chousuke idea of badges was fantastic. So is this implementation decent? http://chouser.n01se.net/misc/tmp3.png
12:56jbondesonnice
12:56gnuvinceChouser: what's the lib to generate this?
12:57Chousergnuvince: /tree/master
12:57Chouserum
12:57Chousergnuvince: http://github.com/Chouser/clojure-classes
12:57jbondesonI take it Clojure Interface/Class vs. Java Interface/Class is anything in clojure.* and anything not?
12:57Chouserjbondeson: right
12:59ChouserThis doesn't include any of the nested classes.
12:59Chouserthere are many more ISeq types
13:04jbondesonaww, you hardcoded some of the mappings ;)
13:05Chousercolors, predicates, and one alias
13:05Chouserand badges, now
13:10lisppaste8gnuvince pasted "Any way to prettify this?" at http://paste.lisp.org/display/75347
13:13craigmcdAnyone have a working example of :exposes-methods from gen-class?
13:16Chousergnuvince: I don't think there's any point in avoiding 'count', is there?
13:16Chouser(defn avg [coll] (/ (reduce + coll) (count coll)))
13:17ayrnieu(defn avg [coll] (/ (reduce + coll) (count coll))) ... too slow.
13:17Chouser:-)
13:17brianhman, just looked at that MultiFn java code. rhickey must've felt like a pirate after typing all of those args....;)
13:17Chouserbrianh: ha!
13:17technomancyhehe
13:18gnuvinceOh right, count is O(1) for most data structures now
13:19rhickeythat brings up a poll I wanted to do - what's the max number of fixed args you have in your Clojure code?
13:19rhickeygnuvince: that O(1) count is not new, I've strived for it everywhere possible
13:20ayrnieuI see a (defn bifold [p f1 f2 acc1 acc2 coll] , but the average is probably 1 or 2.
13:20gnuvincerhickey: ah, I didn't know that.
13:20danlarkinrhickey: 8
13:21gnuvince4 args max here.
13:21technomancybonus points if you write a function to look through your codebase to determine the max arg count. =)
13:21gnuvinceMaybe it should be mentioned here (http://clojure.org/api#count) that count is O(1).
13:22rhickeygnuvince: it's not universally
13:22Chousergnuvince: only classes marked with a 1 here can count in O(1): http://chouser.n01se.net/misc/tmp3.png
13:23rhickeygnuvince: the new counted? pred will tell you
13:27mattreplcraigmcd: http://gist.github.com/62795
13:27craigmcdmattrepl: thanks
13:29craigmcdmattrepl: I see what I was doing wrong now: (.superUpdate this ...), not (superUpdate ...).
13:29StartsWithKlisppaste8: help
13:29lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
13:29gnuvinceSo any class that implements Counted *must* provide constant time count?
13:30mattreplis that a hint? ;)
13:30rhickeygnuvince: yes
13:30cooldude127if a namespace is defined, is (ns blah) the same as (in-ns 'blah) ?
13:31lisppaste8StartsWithK pasted "Clojure Ant Task (like javac)" at http://paste.lisp.org/display/75350
13:32StartsWithKyou can use it like <clojurec srcdir='..' destdir='...'/>, it will find all .clj files and compile the, also if there is a error this one stops ant
13:33technomancywhat's more amazing is that it's actually working on the first try
13:33gnuvincetechnomancy: you're not the only one
13:33Chousercooldude127: no
13:33cooldude127Chouser: what's the difference?
13:33cooldude127Chouser: it doesn't look like it affects my :use's and stuff
13:34Chouserns always 'refer's clojure.core, unless you modify via :refer-clojure
13:34lisppaste8tomsw pasted "Why doesn't the map work?" at http://paste.lisp.org/display/75351
13:34tomswwhy isn't map doing anything when used inside a awt.Canvas' paint method?
13:35Chousertomsw: map is lazy
13:35tomswChouser: is there an unlazy version?
13:35tomswChouser: or must I use take or something?
13:36Chousertomsw: you can wrap it in 'dorun', but you might find 'dotimes' or 'doseq' to be a better fit in this case.
13:36cooldude127Chouser: so if i don't care about what it does with :refer-clojure, they're essentially the same
13:36Chousercooldude127: yes, but the namespace existing doesn't change anything
13:37tomswChouser: Think I better go and so some more reading. Thanks!
13:37cooldude127Chouser: wait so does (in-ns) create a namespace too?
13:38cooldude127if it doesn't exist?
13:38Chousertomsw: looking at your code a bit more closely, wrapping dorun around your map may actually be the most convenient.
13:38Chousercooldude127: correct
13:39cooldude127Chouser: ok, got it. i'm using in-ns anyway, i thought that slime wasn't figuring that out right, but it is, so that's fine
13:39Chousertomsw: or maybe (doseq [[img x y] (map vector imgs (range...) (range...))] (.drawImage ...))
13:42Chouserrhickey: thanks for making small literal maps array-maps. that's pleasant.
13:44rhickeyChouser: you're welcome, ye, much better now that it's consistent
13:44rhickeyyes
13:49alinpopagood evening
13:49alinpopahave one fast q
13:50alinpopatime macro, is returning 10.492 msecs for instance
13:50alinpopawhat this it means ?
13:50alinpopa10 milliseconds ?
13:50ayrnieuyes.
13:50alinpopaok, thank you
13:51alinpopathe doc doesn't tell what is the unit returned
13:51alinpopaMacro
13:51alinpopa Evaluates expr and prints the time it took. Returns the value of
13:51alinpopa expr.
13:51alinpopa,(doc time)
13:51clojurebot"([expr]); Evaluates expr and prints the time it took. Returns the value of expr."
13:52alinpopa492 are ... microseconds ?
13:52danlarkinalinpopa: msecs is the unit :)
13:52rsynnottalinpopa: yep
13:52alinpopayes danlarkin I noticed :D
13:52alinpopaseems to be too fast to be 10 mseconds that's why I asked
13:53alinpopa,(time (count (list 1 2 3 4 5 6 7 8 9 10)))
13:53clojurebot10
13:53clojurebot"Elapsed time: 0.165 msecs"
13:53alinpopaI got: "Elapsed time: 0.075 msecs"
13:53alinpopaso ... this seems it took how much ?
13:53alinpopa75 microsecs ?
13:54ayrnieumilliseconds.
13:54ayrnieuYou just asked, and I answered.
13:54ayrnieuAnd then you *thanked* me.
13:54alinpopa:) yes, I did that
13:55alinpopa0.075 msecs = ? msecs ? microsecs ?
13:55alinpopado you see my point now ?
13:56alinpopanevermind, I got the idea
13:58rsynnott0.075 milliseconds is 75 microseconds
13:59lisppaste8ayrnieu pasted "src/clj/clojure/core.clj:time" at http://paste.lisp.org/display/75353
13:59tomswChouser: just figured out if I have nested maps I need nested doruns...
13:59ayrnieuit seems like that ought to (doall ~expr)
14:00technomancyyay, first clojure patch submitted.
14:01ayrnieu... to src/clj/clojure/core.clj:time ? That was fast!
14:01technomancyheh; no.
14:01technomancyto clojure.lang.LispReader
14:01cooldude127technomancy: what was your patch?
14:02technomancycooldude127: http://code.google.com/p/clojure/issues/detail?id=79&amp;colspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary
14:02technomancyyou can call read on any reader now, not just a PushbackReader
14:02cooldude127nice
14:05cooldude127synergy as in the kvm type thing?
14:05tesynergy owns.
14:05tetruly.
14:05technomancycooldude127: yeah
14:05cooldude127fun
14:05technomancyI like it, but every now and then it turns my X server into "control is always on" mode
14:06teI wish synergy was easier to set up in impromptu situations
14:06telike if im in the library it would be nice to hit a button and have both screens
14:06technomancyte: mango lassi supposedly does that with zeroconf
14:07technomancybut I haven't heard anything about that in a long time
14:07cooldude127ok i have some problems getting a (load) statement in my code to work
14:07cooldude127i'm splitting a namespace up into a couple files, so i'm using load kinda like the clojure.core code uses
14:07cooldude127but it can't find the file
14:08p_lte: Have you looked at Plan B operating system? :-)
14:08cooldude127ok something's wrong with my classpath
14:09cooldude127technomancy: do you know how i can add to the classpath while still using clojure-slime-config?
14:09RaynesGood day.
14:09Rayneso.o
14:09cooldude127i tried a simple add-to-list, and it's not working. slime still loads with the original classpath
14:10technomancycooldude127: add-to-list on swank-clojure-extra-classpaths?
14:10technomancydid you kill your *inferior-lisp* buffer?
14:10cooldude127technomancy: yeah
14:10cooldude127yeah
14:11technomancycooldude127: hrm; I'm not sure. you could use add-classpath, but that will get you in trouble
14:11cooldude127technomancy: i don't want to do that
14:12cooldude127there is no reason i shouldn't be able to configure this. let me restart emacs real quick
14:12cooldude127technomancy: ok restarting emacs made it change
14:12cooldude127the hell if i know why
14:13p_ltechnomancy: What problems are there with add-classpath?
14:13technomancycooldude127: I haven't looked at swank's internals; it could be caching something
14:13cooldude127technomancy: it might be
14:13cooldude127technomancy: btw, is there any reason that clojure doesn
14:14cooldude127't get any pretty lambda/fn love?
14:14cooldude127god i hate that ' and RET are right next to each other
14:14technomancyp_l: apparently the JVM's classloader makes assumptions about having the full classpath upfront; it's very difficult and unreliable to work around that.
14:14tep_l: no I havent' looked at plan b
14:14tewhat is it?
14:14technomancyp_l: theoretically that shouldn't affect using add-classpath on clojure code, but people in here will still yell at you for it. =)
14:15technomancycooldude127: mostly because fn is already so short. =)
14:15technomancyit would be easy to add though
14:15tep_l: this looks like Plan 9
14:15temixed with Inferno-os
14:15technomancyte: plan b is plan 9 + 2
14:15cooldude127technomancy: i might just do that. the question is do i want the pretty f from the javascript stuff or a lambda
14:16technomancycooldude127: yes. unicode does raise some difficult questions.
14:16technomancyI'm confident you'll make the right choice.
14:16p_lte: It's Plan 9 with some apps to automate various things... Like entering a room and getting additional displays, room's sound system etc. as devices of your laptop :P
14:16cooldude127that's cool as shit!
14:16cooldude127technomancy: lol
14:17tep_l: dude wtf this is my idea
14:17teI really love the idea of physically discrete aspects of my computing environment
14:17p_ltechnomancy: Hmmm. Yell at me you say... Funny that I was just thinking about making something like Haskell's Cabal or RubyGems, which you could use to download/compile/load libraries (and which might need add-classpath)
14:17tei find when i have my iphone hooked up to my laptop i am confined to doing just one thing in that space, and i like that
14:18p_lte: They're currently working on new, Inferno based system with similar goals
14:18technomancyp_l: I think such a thing is an eventual necessity.
14:18tei was thinking it might be cool to have 5-10 of those sort of interfaces, small screens, discrete computing environments
14:18tetha tbasically provide a ubiquitous interface
14:18technomancyp_l: but I'm not convinced there are currently enough libs to justify it.
14:18tep_l: i did the google summer of code for inferno-os
14:18teit's sad that inferno gets no attention whatsoever
14:18p_ltechnomancy: Java's CLASSPATH is annoying me enough :)
14:18teLimbo could have been the next Java
14:19teerr the /first/ Java
14:19rsynnottp_l: java's classpath is very, very annoying
14:19tep_l: technomancy: I have class, but I wish I could stay and chat
14:19technomancyte: I'll be around. =)
14:20teI love this damned channel -- plenty of brave souls who aren't afraid of new ideas
14:20rsynnottmaven does things with the classpath, so you have to mess around a bit to get it to work properly
14:20technomancyp_l: right now the solution to the packaging problem is just "stick everything in contrib!"
14:20technomancywhich is awesome
14:20teso many programmers i meet are of the "oh i dont know about that, isnt that just some new fad language" cloth
14:20technomancybut can't last forever
14:20tep_l: are you working on plan b at all?
14:20rsynnott(I'm writing a comet app in clojure; jetty has decent comet server plugin)
14:21p_lte: Not now, but I did setup few Plan9 installs in past, for experiments
14:21p_lI'm also lurking on 9fans
14:21teYeah I'm in there as well
14:21tesome of the guys on that list just dominate
14:21tethere is such a vast expanse of information and work thats been done its hard to catch up on it
14:22cooldude127technomancy: shit i don't think this is good. every defn turned into de?
14:22tei had that problem with the google summer of code for inferno
14:22technomancyhehe
14:22teyou basically need to learn the history of computing to code in Limbo
14:22technomancycooldude127: use (fn instead of fn
14:22rsynnottit's a shame plan9 didn't work out, really
14:22p_linteresting enough, tommorrow is organisational meeting for Computing Society of my Uni. I was wondering of making a set of presentations about various less-known but nice-to-know languages/OSes
14:22cooldude127technomancy: lol what if i like this ?
14:22teagreed -- although plan9 is kind of a 3rd party candidate, many of its ideas are being filtered intlo Linux
14:22Chouserplan9's not open/free, is it? I know it wasn't early on.
14:22teIt is
14:23technomancycooldude127: I won't question your Alternative Life Choices.
14:23p_lChouser: Now it is
14:23teinferno-os was 1million for a license, now its free
14:23cooldude127technomancy: i'm gonna fix it, it's too close to a regular def
14:23teid like to buy the inferno developer pack from vitanuova
14:23tei hear it comes with some cool tools
14:23Chouserif it had been free from the beginning, things might be very different now.
14:23teChouser: there's still time
14:23technomancythe plan9 stuff that got rolled into wmii was really intriguing
14:24te15million lines of code to run Gnome isn't exactly what I'd call efficient
14:24cooldude127technomancy: ok i broke it. no more font-lock
14:24p_lChouser: If Research Unix was more widespread, we might never had to work with BSD sockets :D
14:24tePlan9 is still the future
14:24rsynnottthough I don't think many of Bell Labs' research projects have ever turned directly into real products
14:24te^^The transistor?
14:24rsynnottthey pump money into something for a decade or so, then someone else canibalises it, seems to be the way it goes
14:24te;)
14:24teBell doesn't really do that kind of research anymore
14:24teit used to be /the/ place for cutting edge research
14:24technomancyChouser: you could say that about a lot of things... anything that was a good idea in the 80's basically. =)
14:24danlarkinrsynnott: C!?! unix?
14:25tenow its a relic
14:25technomancyCL, smalltalk
14:25p_lrsynnott: C, Unix, Plan 9 and Inferno all got commercial use :)
14:25teI wrote a distributed synthesizer in Limbo
14:25technomancyrsynnott: sounds like Xerox
14:25rsynnottte: they still do some interesting work
14:25cooldude127technomancy: how can i make this regexp "(?\\(fn\\>\\)" match (fn instead of fn
14:25tei had an orchestra of 386 computers
14:25teerr 7, 386arch computers
14:26teall passing around their data
14:26Chousercooldude127: yikes, is that an emacs regex?
14:26technomancycooldude127: remove the question mark, I guess
14:26cooldude127Chouser: yes
14:26technomancyChouser: shield your eyes!
14:26Chouserindeed. I think I'll go do something else now...
14:26rsynnottI say nearly, because by the time they actually got back to me and offered it to me, I had been working for someone else for a month
14:26cooldude127technomancy: perfect
14:26technomancyyou gotta give them props for making parens literal though; it's great for working with lisp.
14:27rsynnott(they're not very efficient. They had to clear all hiring, including internships, in their Dublin facility through their headquarters in New Jersey)
14:28p_lrsynnott: management tends to be a PITA...
14:28rsynnottthen, ridiculously, they got back to me the next year offering me the same position, so I said okay
14:29rsynnottand then heard back from them in August, which was three months later than they said, and far too late
14:30rsynnott(considering that anyone remotely suitable for their internships will be working during the summer anyway, you have to wonder if they ever manage to fill them at all)
14:40hiredmanclojurebot: latest?
14:40clojurebotlatest is 1276
14:40hiredmansvn rev 1276
14:41hiredmanclojurebot: well?
14:41clojurebotHuh?
14:58applicablei want clojure on its own VM or compilable to binaries
14:59applicablewith its own webserver
14:59p_lapplicable: GCJ?
14:59applicablegcj?
15:00hiredmanapplicable: you don't want the jvm?
15:00hiredmanis that what you are saying?
15:02hiredmanclojure is closely tied to the jvm and this integration provides a lot of its greatest strengths, clojure minus the jvm would not be clojure
15:02p_lapplicable: GCJ is a GNU Java Compiler that can produce native executables (or so I heard)
15:07p_lpersonally, I'd be wary of it
15:07applicablecanit it have its own vm like python?
15:08jbondesonwhat's the difference between having it's own vm and using the jvm (other than a whole mess more work)
15:08applicableisnt there an easy automatic way to compile all the way to a jar?
15:08jbondesonyou can go directly to a jar
15:08jbondesonall you need to use is ant
15:09applicablei hate ant, javas tools are all so verbose and donkish
15:09jbondesonif you look at the build.xml file with clojure you can easily adapt it to compile your own jar
15:10p_lapplicable: Isn't that kind of defeating the purpose of removing JVM? There are though slightly different VMs that run/might run Clojure: Dalvik? (Android's VM), IKVM (.NET) etc.
15:11technomancyapplicable: ant is pretty silly; you could try lancet.
15:11technomancyclojurebot: lancet?
15:11clojurebotlancet is a build system that works with ant written as an example for the Programming Clojure book.
15:11jbondesonlancet is just a clojure layer on top of ant...
15:11jbondesoni mean, sure it's less xml-y
15:11technomancyyeah, but you don't have to greenspun
15:11waltersit's not really hard to build jars without ant
15:12jbondesonmy buil.xml is all of 38 lines...
15:12waltersjar is just a slight variation of zip, you can run "jar" as a subprocess from make easily enough, pass it the files you want in it, done
15:12technomancyjbondeson: every time you write a line of executable XML, a little part of you dies inside.
15:13jbondesontechnomancy: XML is like violence, if it doesn't work use more.
15:13jbondeson;)
15:13albinonot even a little part, a big huge part
15:13forestmaven is also very nice tool
15:13forestespecially for large projects
15:13jbondesoni'm sorry, but xml has its uses, and ant's xml is hardly verbose
15:15jbondesonheck, i have a build.xml that embeds the contents of other jars into mine and it's still only 58 lines, hardly a problem to write.
15:16gnuvinceDid something change with regards to type hints recently? My project is suddenly giving me reflection warnings and it running nearly 100x slower than it did two days ago
15:16hiredmanouch
15:17jbondesongnuvince: main branch?
15:17gnuvinceYes.
15:18jbondesonlatest rev?
15:18gnuvinceYes
15:18jbondesonmonday the warn option was added...
15:19jbondesondo you use pmap heavily?
15:20gnuvinceNot at all.
15:21technomancyjbondeson: wouldn't you rather write Real Code though?
15:21jbondesongnuvince: lots of multimethod calls?
15:21jbondesontechnomancy: yes, but ant is write once, run foreva'
15:22jbondesontechnomancy: and lancet is just a thing vaneer over the top of ant, so i'd rather just use ant.
15:22gnuvincejbondeson: yes.
15:22jbondesongnuvince: rev 1262 was a patch to the multimethod system
15:23jbondesoni would try backing to 1261 and see if that is it.
15:23jbondesonif that is a huge speed slowdown it may need a patch
15:23lisppaste8gnuvince pasted "New slowness" at http://paste.lisp.org/display/75360
15:26jbondesontry 1261 vs 1262 if you could...
15:26gnuvincejbondeson: nearly identical
15:27jbondesonfast?
15:27gnuvincefaster
15:27jbondesonhmmmm
15:27jbondesonso it's not that.
15:27gnuvinceI'm updating one rev at a time
15:27gnuvinceup to r1265 now
15:27jbondesononly other big one is the Counted changes that Chouser made
15:27jbondeson1268
15:28gnuvinceStill fine at 1268
15:29gnuvinceOh wait
15:29gnuvinceI'm ultra stupid
15:29gnuvinceduh
15:29gnuvinceI forgot to run ant
15:29jbondesonhahaha
15:29gnuvinceLet's start this again
15:31jbondesoni was wondering how you were pulling-comiling-running those so fast.
15:31jbondeson+p
15:31gnuvinceOK, it's not r1262
15:32jbondesoni think 1268 is you next possible suspect
15:33technomancygnuvince: tried git bisect?
15:33gnuvincetechnomancy: svn my friend
15:34technomancygnuvince: you can give git bisect a command to run to validate a revision, and it can automatically binary search to find the commit that caused the breakage. it's badass.
15:34jbondesontechnomancy: this isn't really a "break" just a slowdown
15:34jbondesonthough
15:34technomancyjbondeson: well, you could return an error code if a certain operation takes too long in your checker script
15:35jbondesontrue
15:35technomancytakes all the guesswork out of finding regressions like this
15:35technomancyI get excited every time I use it.
15:36gnuvinceI wish I could use it
15:36gnuvincebut I don't think svn ahs this
15:36technomancygnuvince: it works fine with git-svn
15:36gnuvinceThe time it would take to run git-svn, I'll have found the slow revision by then :)
15:37gnuvinceding ding ding!
15:37gnuvince1268
15:37technomancytrue
15:37jbondesonbeat Chouser
15:37Chouser:-(
15:37Chouserwhat's the code?
15:37Chouseroh, I see it
15:38gnuvinceOh wait
15:38gnuvince1267 might have the problem too
15:39jbondeson1267 was my patch for proxy, unless you're creating a million proxies...
15:39gnuvinceNo proxies in there.
15:40Chouseryou get extra reflection as of 1268?
15:40gnuvinceChouser: earlier than that it seems
15:40gnuvinceI'm trying to narrow it down
15:40gnuvincer1264 is fine; I get the extra warnings starting at r1265
15:41p_lhmmm.... is there any elisp code for integrating JDE and Clojure? NetBeans is a little unwieldy in places (read: Java & XMonad don't go well together), but I don't want to lose completion of Java objects...
15:41jbondesonthat's odd
15:41gnuvince,r1265
15:41clojurebotjava.lang.Exception: Unable to resolve symbol: r1265 in this context
15:41gnuvincesvn r1265
15:41gnuvinceclojurebot: svn 1265
15:41clojurebotsvn is http://clojure.googlecode.com/svn/trunk/
15:41gnuvinceNot super useful
15:41hiredmansvn rev 1265
15:41Chouserclojurebot: rev 1265
15:41clojurebotTitim gan �ir� ort.
15:41hiredman*sigh*
15:42gnuvincer1265 | richhickey | 2009-02-10 12:24:20 -0500 (Tue, 10 Feb 2009) | 1 line
15:42gnuvinceChanged paths: M /trunk/src/clj/clojure/core.clj
15:42gnuvinceadded inlining on remaining coercions
15:42jbondesonit's the inlining
15:42Chousergnuvince: oh, this is that tortured bit of coersion we were messing with before, isn'tit.
15:42jbondesondo you use boolean, char, byte or short?
15:43technomancyp_l: I haven't heard of anyone using tho two together unfortunately
15:43gnuvincejbondeson: byte *and* char
15:43jbondesonah
15:43gnuvincejbondeson: I'll give you the link
15:43gnuvincehttp://github.com/gnuvince/clj-starcraft/blob/3d8cd9b36728eb43b32c4c3d5c88d08898e8a916/starcraft/replay/parse.clj#L14
15:43gnuvinceget-byte and get-short are the ones affected.
15:44p_ltechnomancy: Well, I'll try to set something together. Java's library is a little too big to use without autocomplete (and too verbose)
15:45gnuvinceChouser: yes, it is.
15:46clojurebotsvn rev 1265; added inlining on remaining coercions
15:46hiredmanclojurebot: fool
15:46clojurebotNo entiendo
15:46albinostarcraft replay files, this sounds awesome
15:47hiredmanweird
15:47hiredmanI was getting stackoverflow when derefing a ref
15:47jbondesonoh
15:47gnuvinceSo... what can I do?
15:47gnuvinceFile a bug report?
15:48gnuvinceOr is there a new way to use short and byte?
15:48jbondesonthe RT cast functions are casting from Object -> Number -> Value
15:48jbondesonchar does an instanceOf
15:48jbondesonchar is what's killing you.
15:48Chouserno, it's the reflection that kills
15:49p_ltechnomancy: Apparently someone managed to make it possible without JDE, writing some clojure code to use Java Reflection API :)
15:49gnuvinceI'm enclined to agree with Chouser; last time this program was slow, he helped me get the type hints right and it sped the application significantly.
15:49ChouserI mean, I'm sure avoiding an instanceOf would help too, but the reflection always hurts more than almost anything else.
15:50jbondesongnuvince: for now you can just do (. x (byteValue))
15:52jbondesonChouser: does casting in Java use reflection?
15:52gnuvincejbondeson: same problem, Clojure complains that byteValue cannot be resolved.
15:52jbondesonhmmm.
15:53technomancyp_l: if I find myself unable to avoid writing Java in the future I may be interested in helping w/ that
15:53jbondesonsorry
15:53Chouserjbondeson: by reflection I mean what Clojure is warning about. Specifically it's failing, at compile time, to choose exactly one method to call, so it produces code that checks at runtime.
15:54Chouserso it's at the clojure/java boundary
15:54jbondesoninteresting.
15:55gnuvinceHow should I proceed? Write up a summary of the problem, post it on the mailing list and wait until Rich says it's okay to add it to the list of issues on the tracker?
15:55jbondesonthe weird thing is that the byteCast and shortCast only take objects, and everything should be able to be boxed in Java, correct?
15:57jbondesoni come from .net land, so my java knowledge is non-existent.
15:57Chousergnuvince: probably. get-short and get-byte each stand alone to produce the warning. post those with the needed import line, and you should get some response
15:58gnuvinceChouser: ok
16:12Chousergnuvince: that's a tough nut to crack.
16:12ChouserI can't figure out how to get the byte to hint either as a primitive int or as an Object.
16:13Chouser(defn get-byte
16:13Chouser [#^ByteBuffer buf]
16:13Chouser (let [x (int (.get buf))
16:13Chouser y 0xff]
16:13Chousersorry
16:13Chouser...except to use (int ...) which itself requires reflecton.
16:15gnuvinceChouser: I'm almost done with my post
16:17gnuvincehttp://groups.google.com/group/clojure/browse_frm/thread/53bcf20ff17b73ed#
16:20Chouserwell, I just found a way to avoid reflection, but it may still be slower than what you had working before.
16:20gnuvinceI'll report the problem
16:20gnuvinceI'd rather we have a real solution than a workaround.
16:20Chouseryep
16:20gnuvinceWe're not PHP
16:20Chouser:-)
16:21lisppaste8Chouser pasted "workaround for gnuvince" at http://paste.lisp.org/display/75363
16:22Chouserbouncing the byte/short through Box gets you an Object hint, so that the compiler can pick the and(Object,Object) method.
16:22gnuvinceOK
16:23jbondesonseems like creating a function to do the bit-and that takes a Byte also works
16:24Chouserah, disallowing the inline form. that makes sense.
16:25Chouseryeah, that's better than mine.
16:26technomancygnuvince: I'm curious: what does replaying a starcraft file look like?
16:26jbondesonfound one more way
16:26jbondesonwell, really it's the same way, but without a separate function
16:26technomancygnuvince: I mean, are you visualizing anything, or is it just "this SCV went to this position", "This ultralisk attacked a Marine", etc.
16:27Chouser(#'bit-and (.get (ByteBuffer/allocate 100)) 0xff)
16:27gnuvincetechnomancy: It's a big binary string packed in a weird format (for which unpacker libs exist in C and Java, fortunately)
16:27lisppaste8jbondeson pasted "workaround 2" at http://paste.lisp.org/display/75364
16:27gnuvincetechnomancy: it's just the commands given by the players. I imagine that given the same input, Starcraft does the same thing (including glitches), so they just need to record what the players did.
16:28technomancygotcha
16:28gnuvincetechnomancy: http://github.com/gnuvince/clj-starcraft/blob/3d8cd9b36728eb43b32c4c3d5c88d08898e8a916/starcraft/replay/actions.clj
16:28gnuvincetechnomancy: these are the known actions
16:29gnuvinceIsn't it possible simply deactivate the inlining form?
16:29applicableif i have a .java file and want to use it form clojure, what do i ahve to do? first compile then make a jar out of it?
16:30technomancyapplicable: yeah
16:30Chousergnuvince: how? #' does it, but how else?
16:30technomancywell, you might not need to make a jar out of it, but it's probably better if you do
16:30gnuvinceChouser: just wondering
16:32lisppaste8Chouser annotated #75363 with "slightly less ugly workaround" at http://paste.lisp.org/display/75363#1
16:32ChouserI would expect that to match the speeds you were getting before.
16:33Chouserbest would be if there were bit-and methods for byte and short, then you could just hint your constants and you'd get unboxed speed.
16:34gnuvinceChouser: yeah, that gives about the same performance as before.
16:35gnuvinceWell, I need to leave. That math course is not gonna complete itself, unfortunately :(
16:35gnuvinceLater
16:35Chouserciao
16:40applicablecan a .zip file be import from clojure? ie is a .zip thr same a s a .jar?
16:42applicablehmm i tired rto jar -c org (a dir) and it went nuts and started beeping
16:43technomancysweet, mire made the github highscore list
16:45jbondesonok, that trouble shooting was a lot more fun than my real job. quick someone else have problems
16:47technomancywow... there are only two libraries on the first five pages of github clojure projects that are more than three months old.
16:49Chouserjbondeson: I relate.
16:49WizardofWestmarcjbondeson: dude, vb6. Of COURSE it's more fun :P
16:50jbondesonworse, fixing others build errors
16:50WizardofWestmarcah still dealing with the build retardation? Awesome
16:51danlarkintechnomancy: what's the github highscore list?
16:52technomancydanlarkin: http://github.com/languages/Clojure
16:52technomancy"Most Watched This Week"
16:52danlarkinsweet
16:53WizardofWestmarcRing hit first in clojure? Huh. Not surprised Programming Clojure's is #2 though
16:55WizardofWestmarc...Ring is most forked too? double huh
17:05applicableso can a .zip-file be used as a package?
17:05jwinterWhere are the backtick, ~, and ~@ operators mentioned in the docs?
17:05applicableor a .java file can never be accessed form clojure+ it has to be compiled ot .class(i suppose9?
17:05jwinterI didn't see them in macros secion.
17:05ayrnieuapplicable - yes, it has to be compiled.
17:06Chouserjwinter: http://clojure.org/reader under Syntax-quote
17:07jwinterChouser: thx
17:11applicableme clojure should run on pythons vm instead
17:11cooldude127NOOOOO
17:11applicableeverything java makes me want to kill myself
17:11p_l...
17:12Chouserapplicable: I had similar reactions the first few moneths trying to get comfortable with clojure.
17:12p_lapplicable: there's little sense in making something target python vm... unless you mean the other Python, which is a compiler :P
17:13kotarakAnd to improve concurrency we get the global lock back.
17:14danlarkinlong live the GIL
17:14applicablelong live haskell!
17:19scottj_When I get an error in clojure+slime, it appears that the backtrace is pretty much useless because there's so much swank stuff in there I can't actually see my functions. Am I missing something?
17:20Chousukethe python VM is not much compared to the JVM though :/
17:20technomancyscottj_: the non-slime backtraces are pretty messy too. =\
17:20technomancyscottj_: I've been meaning to check out the clj-backtrace library; it's supposed to clean things up
17:24scottj_technomancy: do you know if it works with slime or just plain repl?
17:26Chouserscottj_: I think there's a keystroke to see the next the deeper 'cause'. are you aware of it?
17:30scottj_Chouser: nope
17:31ChouserI don't use slime, but my understanding is that some kind of menu pops up and there's an option for the next 'cause'. Often the one you want is the second or last, not the first.
17:31danlarkinscottj_: In my configuration (which is whatever aquamacs set up for me) I can press "1" to see the cause
17:31technomancyChouser is right
17:33clojurebotsvn rev 1277; [lazy] only coerce LazySeq to seq in analyze, fixing evaluation of ()
17:37scottj_Chouser: danlarkin, thanks, "1"/cause makes the backtrace a more manageable.
17:37scottj_I still long for a clojure debugger that's as easy to understand and use as a smalltalk debugger :)
17:38technomancyscottj_: you misspelled Object Browser.
17:38clojurebotsvn rev 1278; fixed distinct nil handling
17:43cooldude127scottj_: i've actually been using smalltalk lately, and that debugger is FANTASTIC
17:43Chouserlazy-cons is used quite a lot in contrib.
17:50Chouserrhickey: any plans for allowing code to (temporiarily) work with either trunk or lazy?
17:51rhickeyChouser: not sure what you mean by that
17:51ChouserI'm trying to fix up some things in contrib, but would like to provide two defn for some functions, based on which branch is trying to run it.
17:52Chouser(if (resolve 'lazy-cons) (defn foo...) (defn foo...))
17:52rhickeyChouser: hmmm... what do you need from lazy/trunk to support that?
17:52Chouserbut that doesn't work. I'm just wondering if it's something you've thought about.
17:53Chouserif you haven't, i'll think about it and get back to you. :-)
17:53rhickeyok
17:53rhickeythe issue doesn't really come up for core
17:54Chouserright
17:54Chouserbut will for any lib, at least for a while.
17:58Chouserok, that was easy. (defmacro only-when [s x] (when (resolve s) x))
17:58Chouser(only-when lazy-cons (defn foo ...))
17:58Chouser(only-when lazy-seq (defn foo ...))
18:11Chouserin trunk, (concat) returns nil, in lazy it returns ()
18:13rhickeyChouser: well, that's the key difference between the branches
18:13rhickeyconcat et al no longer return seq/nil
18:15Chouserwell, that seems to suggest I should feel silly for bringing it up. give me a sec and I probably will...
18:15rhickeyalso note that the () is just a print representation:
18:15rhickeyuser=> (class (concat))
18:15rhickeyclojure.core$concat__3081$fn__3083
18:15Chouseryeah, did exactly that.
18:16Chouserit's still not clicking though
18:16rhickeythat's what I need feedback on - hpw much code depends on sequence fns returning seq/nil
18:18rhickey:)
18:20rhickeyuser=> (sequence? (concat))
18:20rhickeytrue
18:20rhickeythat's the only promise made by the sequence fns
18:22ChouserI thought I understood all this, but I'm not yet getting how the code describes that behavior.
18:22Chousergotta go, bbl.
18:53technomancycooldude127: have you thought about a more interesting name for your date library?
18:53cooldude127no i have not
18:55technomancyhow about "chrono"?
19:04cooldude127that's a pretty good name
19:07danlarkinhow about clojure.contrib.date
19:08technomancybland.
19:08danlarkin:)
19:08cooldude127danlarkin: plus that's what it is right now :)
19:08danlarkinoh... well good!
19:08cooldude127haha
19:08technomancywell... not really; it's not part of contrib yet
19:09cooldude127true
19:53danlarkinuh oh! circular dependancy... this /is/ annoying
19:55durka42circular dependencies are bad...
19:58danlarkinrepresent calls invoke-templattag and invoke-templatetag calls represent :'(
19:59danlarkinand that's fine if they live in the same file because I can (declare represent) but it's a problem if I want to separate them
20:01technomancydanlarkin: every time I run into that I get annoyed and then start to wonder if I should really be annoyed or if it's just a sign I shouldn't be trying to do that in the first place.
20:02danlarkinHurumph
20:03technomancyhaven't been convinced either way yet though.
20:03danlarkinnot sure what I should do differently, they definitely need to call eachother, but they don't really belong in the same file
20:06durka42could you trampoline them?
20:06ChouserI don't think that would help.
20:07danlarkindurka42: already am :)
20:07cp2so, i was just given an "emacs vps"
20:07cp2see http://www.informatimago.com/linux/emacs-on-user-mode-linux.html
20:08cp2quite humorous :)
20:09technomancycp2: I've done the shell version
20:09cp2yeah, this is full blown though
20:09technomancyonce they get webkit embedded, I'll be all over that. =)
20:17danlarkinmaybe there could be some sort of cross-namespace declare form
20:18Chouserdo they belong together in a 3rd file?
20:18Chouseron the other hand, you're sure you need more than one file?
20:38danlarkinChouser: no, they don't /need/ to be in separate files, but they should be -- they're doing different types of things
20:41danlarkintrying to figure out maybe a 3rd file solution
20:46gnuvince_Anybody good in calculus?
20:46gnuvince_Or just decent will probably do
20:47cooldude127gnuvince_: i'm decent :)
20:47cooldude127gnuvince_: college student at ga tech here, what you need?
20:49gnuvince_cooldude127: moral support mainly
20:49gnuvince_And some informations.
20:49cooldude127gnuvince_: ok
20:50gnuvince_I will preface by saying that I am not good at maths, that I am following a correspondance class (access to the teacher is nigh impossible) and that I am taking the class in French, so I may not know all the terms.
20:50cooldude127lol ok
20:50jbondesonthat's a whole lot of caveats ;)
20:51gnuvince_First, here's a very general question: what's the point of a derivative? They suggest in the book that it is used to find the instantenous speed of an object, but why can't we just input the time into the speed function and get the result?
20:51cooldude127gnuvince_: what if you don't have a speed function?
20:51cooldude127gnuvince_: the derivative will find a speed function
20:51gnuvince_cooldude127: In this particular case, I have one; v(t) = -5t^2 + 10t.
20:51gnuvince_Why couldn't I just put in the time and get the result?
20:52cooldude127gnuvince_: that's exactly what you would do
20:52p_lLooks like I'm starting to get some rudimentary library organization for Clojure :)
20:52cooldude127unless you're interested in acceleration
20:52cooldude127gnuvince_: derivative of v(t) will give you acceleration
20:52jbondesonderivatives measure the rate of change of a function.
20:52cooldude127exactly
20:53cooldude127it will give you the slope of a line that is tangent to a point on a curve
20:53gnuvince_The first question with this function is "At the beginning of the experiment, what is the speed of the object?"
20:53cooldude127gnuvince_: v(0)
20:53gnuvince_I figure 0, but I fear I may be way off track here.
20:54jbondesonspeed or velocity?
20:54p_lgnuvince_: first derivative of a function gives you current "angle". Thus you can use it to analyze whether the function at this point is flat (d(f(x)) = 0), rising, or going down... Second derivative can be used to check for how the slope is shaped (i.e. is the rate of change more and more steep or getting flatter or no change) etc.
20:54jbondesoncause tecnically speed is the absolute value of velocity
20:55danlarkinoh god! make the calculus go away! I thought I left this in my past
20:55cooldude127gnuvince_: with your given velocity function, v(0)=0, so yes 0
20:55jbondeson(integrals are easier to hold than derivatives)
20:55gnuvince_Oh this is bad...
20:55gnuvince_I'm afraid I'm not gonna make it through this class
20:55p_lpity that they removed integration from HS math curriculum before I entered my last two years...
20:56p_ljbondeson: I always assumed that integration is harder :)
20:56cooldude127it is
20:56cooldude127but integral signs are more weapon shaped
20:57gnuvince_ok
20:57jbondesonintegration is only tough when you start throwing in non-polynomials, then you just start reaching for the integration tables.
20:57gnuvince_Here's an exercise I'm working on, and I can't get to the final solution: http://mathbin.net/5831
20:57gnuvince_Could anyone hint me to my next logical step?
20:57jbondesongod bless LaTeX
20:58gnuvince_durka42: what is it?
20:58durka42"baby, i wish i were your derivative so i could lie tangent to all your curves" or something along those lines... i told you it was terrible
20:58jbondesonwhich problem are you working on, there are a lot of functions there
20:58p_lsince we started mixing math and love... http://xkcd.com/55/
20:59jbondesonor is that your work
20:59durka42gnuvince_: what are you working towards, just the derivative of f(x)?
20:59gnuvince_jbondeson: it's my development. I need to find the derivative of f(x) (at the top) and the next lines are the steps I took so far
20:59jbondesonah
20:59cooldude127gnuvince_: i think you've pretty much found it
20:59durka42i think you've found it, haven't you
20:59durka42you could simplify a little if you wanted to
20:59cooldude127gnuvince_: maybe could be simplified slightly, but not much
20:59cooldude127durka42: damnit!
21:00gnuvince_The answer is apparently: 2(6x^2 + 1)^3(54x^2 - 192x + 1)
21:00gnuvince_But I don't know how to get there.
21:01jbondesonyou can pull out the (6x^2 + 1)^3 from both terms
21:01jbondesonalong with the 2
21:01cooldude127gnuvince_: what jbondeson said
21:01jbondesonalso use the & = & to align your equals signs =P
21:02gnuvince_jbondeson: thanks for the help and for the tip :)
21:02gnuvince_I'll try it out
21:02jbondesonafter you factor out you cna then simplify
21:02jbondesonyou had all the hard parts done
21:02cooldude127i remember the good old days of derivatives and integrals. now i'm stuck with matrices and vectors
21:02jbondesonlinear algebra?
21:02cooldude127jbondeson: yes
21:03jbondesoni had a LA test where we were doing LU factorization on non-trivial matricies of 9x9 dimensions, it was murder
21:03jbondesonall by hand of course
21:03jbondesonno calculators allowed
21:04cooldude127jbondeson: that's awful
21:04jbondesoni got a B+ because i didn't reduce all my 5-digit fractions
21:04cooldude127lol
21:05gnuvince_jbondeson: oh thanks so much
21:05jbondeson"you can reduce 34325/64230, sorry -5 pts"
21:05ayrnieu,34325/64230
21:05clojurebot6865/12846
21:05cooldude127lol
21:06cooldude127well they were obviously both multiples of 5
21:06gnuvince_Here's another more general question: have you guys ever taken a class by correspondance?
21:06cooldude127no
21:06gnuvince_I'm finding it to be a lot harder and frustrating than an in-class course would be.
21:06jbondesoni wonder if (.hashCode) will work for the priority function of a treap...
21:06ayrnieu,(/ (/ 34325 5) (/ 64230 5))
21:06clojurebot6865/12846
21:06ayrnieuwell, that's not useful :-)
21:06cooldude127jbondeson: what purpose would that serve
21:07jbondesongnuvince_: it is. (this will make me sound very young) my mother actually just finished up her degree via correspondence in accounting and it was horrible for her.
21:07jbondesoncooldude127: treaps are randomized BSTs
21:07jbondesonyou need a fairly random number for priority
21:08cooldude127jbondeson: oh yeah, that's right
21:08gnuvince_jbondeson: I am taking this class to get my math credits to go to university, but this is not helping me keep my motivation
21:08jbondesoni'm just concerned about it being random enough
21:08cooldude127jbondeson: i haven't actually learned them, just looked at the wikipedia page one time
21:08jbondeson,(hash '(1))
21:08clojurebot32
21:08cooldude127jbondeson: what about actually using a random number?
21:08jbondeson,(hash '(2 3))
21:08clojurebot1026
21:08jbondesoncooldude127: i would like to use something deterministic to utilize memoziation
21:08cooldude127oh
21:09jbondesonusing lazy evaluation with memoization will allow for proper amortized costs
21:09cooldude127,(hash 2)
21:09clojurebot2
21:09cooldude127,(hash '(2))
21:09clojurebot33
21:09jbondesonyeah, that's the part i'm concerned about
21:09cooldude127jbondeson: hash codes for numbers aren't random
21:10blbrownis there proxying involved for java.lang objects like string. for example (def a "kljdfklsdjf") looks like type string, but is there a proxy between java.lang.String and the one represented there
21:10jbondesoni don't think that should matter too much, because you're not likely to be using contiguous real numbers in a treap
21:10cooldude127blbrown: clojure uses java.lang.String
21:10jbondeson,(hash 4.23)
21:10clojurebot1588116073
21:10cooldude127jbondeson: oh ok
21:10cooldude127blbrown: clojure uses java data types anywhere possible
21:10jbondesonblbrown: no, it's a java string
21:11jbondesonproxies are only used for dynamic objects that need to implement certain interfaces.
21:11jbondesonthere are very few in core clojure.
21:11blbrowncooldude127, that is interesting, because I can call (first "klsjflksd" )
21:11cooldude127blbrown: clojure implements first on strings
21:11jbondesonfutures use them , but when they get stable the proxy will likely be removed.
21:12cooldude127blbrown: any of the seq functions work on strings
21:12blbrownjbondeson, it is just interesting how clojure treats types
21:12jbondesonrich was just really smart ;_
21:12jbondeson;) even
21:12cooldude127blbrown: clojure isn't object-oriented, so functions can operate on anything they want
21:12blbrownsimple yet powerful
21:12cooldude127i agree, rich is very smart
21:13jbondesonblbrown: it's amazing how much you can do with a hash map. cooldude127 can show you his avl tree that only uses linked hash maps and no "data types" as it were
21:13blbrownOK here is an example, I am pretty sure with ABCL/Common Lisp, you don't have this kind of interoperability. Clojure handles different types seamlessly
21:14jbondesoni hate to admit it, but being on the jvm allows you to do some very handy things
21:14cooldude127blbrown: the difference is clojure was built from the ground up on the jvm
21:14cooldude127abcl had to lug around CL compatibility
21:15jbondesonhow can acm not have anything on treaps in their digital library? what am i paying $200 a year for >=/
21:15blbrownhehe
21:15cooldude127blbrown: if you're interested in what jbondeson mentioned about the avl trees: http://github.com/cooldude127/clojure-code/blob/6401c6eb0b9a1fc087d17cd1999f49658d312375/structures/avl_tree.clj
21:15cooldude127damnit github
21:15cooldude127long-ass urls
21:16jbondesonwatch out, or clojurebot will start tinyurl'ing everything again
21:16blbrowncooldude127, are you talking to the wrong person
21:16cooldude127lol
21:16jbondesonhiredman is just waiting for the day!
21:16cooldude127blbrown: no. jbondeson mentioned this to you
21:16jbondesonthat was an example of how the "type" system in clojure works
21:17jbondesoncooldude127 just did a very clean implementation that gets the point across nicely
21:17cooldude127well, clojure does have a kind of type system, but often it's unnecessary
21:17jbondesonwell, yeah
21:17cooldude127jbondeson: the only reason i wrote this was to learn how to write an avl tree. then i had to do it in java
21:17cooldude127awful
21:17jbondesonbut you don't use it much unless you want to leverage multimethods.
21:17cooldude127yeah
21:18jbondesoncooldude127: come now, all the persistent data structures were implemented in Java by rich.
21:18jbondesonthink of THAT pain
21:18blbrowncooldude127, yea, I would have written it in clojure and then code generated the java
21:18cooldude127yeah i applaud and admire him
21:18cooldude127blbrown: the idioms are different
21:19cooldude127the clojure version is purely functional
21:19jbondesoni've been tempted to do some persistent data structure programming in C# and then i think of the pain it will cause me...
21:19cooldude127yeah screw that
21:20jbondesonone day people at my office will come in and half the codebase will be in clojure and it will be glorious.
21:20cooldude127lol
21:20cooldude127i have a computer programming project for calculus 3, so i'm writing all kinds of linear algebra stuff in clojure
21:21jbondesoni love programming projects for non-programming classes.
21:22cooldude127jbondeson: me too
21:22cooldude127it's really fun to be in class writing the code to do the stuff we are currently going over in class
21:22cooldude127also a good way to actually learn it
21:23jbondesonforces you to think about the nitty-gritty
21:23cooldude127btw has anybody given a go at symbolic math in lisp?
21:23jbondesonplenty
21:23cooldude127jbondeson: yeah, apparently row-reduction is way more difficult for a computer than a person
21:23p_lcooldude127: many had given a go, including textbooks (PAIP comes to mind)
21:24cooldude127p_l: what's paip?
21:24cooldude127i just found cl-symbolic-math on github lol
21:24jbondesonmathematical functions are so regular that symbolic math parsers are actually very similar to lisp readers.
21:24p_lcooldude127: "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp"
21:24cooldude127oh god
21:24jbondesonAI Bible
21:25jbondesonMade by god.
21:25ayrnieucoolude - http://maxima.sourceforge.net/
21:25jbondesoni.e. Norvig
21:25p_land a kind of advanced CL textbook :)
21:25cooldude127oh wow
21:25cooldude127i opened up a can of worms i wasn't ready for
21:26jbondesonyou want a can of worms you aren't ready for just go look up "A New Kinda of Science" by Wolfram
21:26jbondesonTHE Wolfram that is.
21:26p_lAFAIK one of the first apps to tackle symbolic math was "Student"? ca. 1960s?
21:26cooldude127oh no
21:26ozy`,`('foo unquote 'bar)
21:26clojurebot((quote sandbox/foo) clojure.core/unquote (quote sandbox/bar))
21:27ozy`oh cool
21:27jbondesonsymbolic math and lisp are like kissing cousins.
21:27ozy`,'`(foo ~bar ~@baz)
21:27clojurebot(clojure.core/concat (clojure.core/list (quote sandbox/foo)) (clojure.core/list bar) baz)
21:27cooldude127jbondeson: what exactly do you mean by that?
21:28p_lBTW, people here interested in making clojure equivalent of clbuild?
21:28ozy`,'`foo
21:28clojurebot(quote sandbox/foo)
21:28ozy`weird
21:29cooldude127p_l: as in a package manager?
21:29jbondesoncooldude127: i wouldn't be at all surprised if one of the first applications McCarthy came up with for Lisp was symbolic math
21:29cooldude127like a version of asdf that is not crappy as hell
21:29cooldude127jbondeson: it seems like a natural with symbols being there and all
21:30jbondesonasdf... ewwww
21:30jbondesonasdf is about pain
21:30p_lcooldude127: ASDF is a build system. clbuild was for actually downloading the stuff in the first place
21:30ozy`jbondeson: isn't that why he made it?
21:30jbondesoni belive so
21:30cooldude127p_l: ok like a less crappy asdf-install
21:30ayrnieuwhat's painful about ASDF, jbondeson?
21:30cooldude127ayrnieu: EVERYTHING
21:31jbondesonyes, i do believe that the question to be asked is "What is NOT painful about ASDF"
21:31p_lAFAIK Lisp was conceived as a nice theoretical tool. Then a certain student had gone to McCarthy after a lecture, and said "Hey, if I implement (eval ...), I'll get the whole language!"
21:32ozy`yeah
21:32p_las for now, I've got a simple script that will build CLASSPATH so that all jars that are lying in certain directory are included
21:32p_l(this script is a wrapper for clojure)
21:33jbondeson.emacs will do that for you in 1 elisp line =P
21:33ayrnieucooldude - OK, so everything except for 'defining systems, compiling them, loading them, putting them where ASDF can find them'. Well, you can get a little bit of code to do that last part, or you can use asdf-install which does that too. It's *so* painful, it says "hey, do you want me to install this locally or system-wide? Oh, OK." And then it sort of whines about GPG.
21:33p_ljbondeson: Yeah, and I'll load up Emacs to do it for me on every invocation on cmdline? /bin/sh is still smaller :P
21:33stimulihi
21:34jbondesonp_l: wait, emacs is an operating system... what is a shell?
21:34p_ljbondeson: Part of that Exokernel that runs Emacs
21:34stimulian easy way to copy files inside of emacs ?
21:34ayrnieustimuli - dired.
21:34stimuliM-x shell
21:34jbondesonso confused
21:35stimuliwrote my first is-test code ... It is pretty good
21:35stimuliI like that it isn't hideously complicated
21:35ayrnieup_l - by simple script, do you mean: for x in some/dir/*.jar; do CLASSPATH=$CLASSPATH:$x; done ?
21:35jbondesonemacs loves you... why would you ever abandon it?
21:35stimulithere are things besides emacs ???
21:35p_layrnieu: something like that (I've got some additional things loaded, like switching debugging options on and off etc.)
21:35stimulidon't even say that
21:36cooldude127alright well great, i started reading code for symbolic math and now i've ruined my life ;)
21:37durka42there's vim :)
21:37hiredmanmmmm vim
21:37p_layrnieu: Now I'm writing something to actually download/upgrade/compile clojure libs and then symlink them to said dir :)
21:38p_lat the moment it's going to be pure shell script, because I pretty well know that it's not rare for me to fuckup my install :)
21:39gnuvince_,seen rhickey
21:39clojurebotjava.lang.Exception: Unable to resolve symbol: seen in this context
21:39Chouser~seen rhickey
21:39clojurebotrhickey was last seen in #clojure, 199 minutes ago saying: that's the only promise made by the sequence fns
21:40jbondesonChouser to the rescue.
21:40gnuvince_Thanks
21:41cooldude127this might also work
21:41gnuvince_I was wondering if he'd seen the report on byte, short et al.
21:41cooldude127clojurebot: seen rhickey?
21:41clojurebotrhickey was last seen in #clojure, 200 minutes ago saying: that's the only promise made by the sequence fns
21:41Chouserno future in lazy
21:41jbondesondamn do i love academia: "On Using Condiditonal Rotations and Randomized Heuristics for Self-Organizing Ternary Search Tries"
21:42cooldude127jbondeson: oh my god
21:42stimuliI'd call it "Tries that ROCK!" .. my professors be damned
21:42cooldude127lol
21:43stimuliI've been pouring through like 3490239423094 journal articles on Datalog
21:43stimulithey're sometimes ... dense
21:44jbondesoni bet if i read this paper this guy took a 30 year old algorithm and said "What if we don't rotate all the time?" and wrote a 7 page paper on the topic
21:45stimulihmmm
21:46stimuliwell ... there are more students than ideas I suppose
21:46jbondesonnot everyone can be Okasaki
21:46stimulino
21:46p_lstimuli: and big amount of students are not really that keen on making new stuff
21:47stimuliI suppose I shouldn't criticize ... I can't fill up a twitter post
21:53ChouserThis appears to be a infinite loop in lazy branch: (take-while #(>= % 0) (repeatedly #(.read stream)))
21:55notyouravgjoelI need to create the powerset of a set, and my current implementation (based off of the contents of SICP) is killing my application with memory use. Any suggestions for a speedy powerset implementation?
21:56jbondesoni think there's a powerset in contrib... or at least someone submitted on to the group
21:56ayrnieuif you paste your current implementation, maybe someone can help you with memory use.
21:56notyouravgjoelthanks
21:57ChouserIs that the same as clojure.contrib.combinatorics/subsets ?
21:58jbondesonChouser: yes, just found the clojure.contrib issue
21:58stimulihas anyone put together a graph library ?
21:58notyouravgjoelwhere do i find clojure.contrib references?
21:58ayrnieunotyour - there's a link on clojure.org
21:59jbondesonhttp://clojure-contrib.googlecode.com/svn/trunk/
21:59cooldude127stimuli: which kind of graph? the data structure? or the chart kind?
22:00stimulidata structure
22:00stimulitraversals .. strongly connected components and that stuff
22:00cooldude127stimuli: then no, but i might do it. i'm in a data structures class right now and we're about to learn graphs
22:00stimuliI'd love a lazy post-order stream ... I've written a non-lazy one
22:00stimulibut it is non-obvious how to make it lazy
22:01cooldude127stimuli: obviously, or you would have done it ;)
22:01jbondesonstimuli: add cheetos
22:01stimuli:P
22:01stimuliyeah
22:01lisppaste8notyouravgjoel pasted "powerset" at http://paste.lisp.org/display/75390
22:01stimuliis powerset the same as all subsets ?
22:01notyouravgjoelmy current implementation, btw
22:01notyouravgjoelyes
22:02stimulithere is one in the combinatorics library in contrib
22:02jbondesonwhich is vastly more comple
22:02jbondeson+x
22:03stimulicontrib has some cool stuff in it
22:03stimuliI'm prolly going to use monads soon
22:03jbondesonhonestly your best bet is to pull down contrib and use clojure.contrib.combinatorics/subsets
22:04stimuliyeah
22:04stimulito "seriously" use clojure .. you pretty much need contrib
22:04stimuliits kinda becoming a standard library
22:04cooldude127yeah for reals
22:05Chouserthis is broken in lazy: (take-while #(>= % 0) (range 9 -9 -1))
22:05stimulihmmm
22:05jbondesoncool kids reimplement all of contrib ... in an hour B)
22:05stimulichouser : do you think lazy will become official ?
22:05stimuli<-- not a cool kid, evidently :)
22:05jbondesondamn you enter key
22:05ChouserMy guess? yes. But that's just a guess.
22:06stimuliI guess I'll have to learn it then :)
22:07Chouserrange is broken
22:08Chouseroh. range uses take-while.
22:09stimuliI just hope we don't end up with stream ... destructive streams are evil
22:10cooldude127stimuli: i don't think rich really likes streams
22:10cooldude127because of the whole state thing
22:10stimuligood
22:10stimuliyeah
22:10stimuliocaml had stream
22:10stimulithey were a PITA
22:10jbondesonahhhhh ML
22:10cooldude127ocaml state doesn't it?
22:10jbondesonML, O'Caml, F# god bless them
22:10cooldude127s/ocaml/ocaml has/
22:11stimuliyeah .. it's ml with object .. more or less
22:11cooldude127i personally just hated the syntax of ocaml
22:11stimulior maybe sml with objects ... I'm not sure
22:11cooldude127;; <- wtf?
22:11jbondesonhah
22:11stimulior the dots :)
22:11stimuliremember the dots ?
22:11cooldude127oh god
22:11jbondesonsorry but ':=' is still the worst
22:11stimuli*. ... or was it .*
22:11gnuvince_*.
22:12cooldude127jbondeson: i don't mind :=
22:12jbondesonscrew pascal
22:12stimuliR uses <-
22:12stimuliwhich is kind of cool if you like typing
22:12jbondesoni loath the shift key
22:12cooldude127jbondeson: smalltalk also uses :=
22:12jbondesoncooldude127: wait is that a plus? ;)
22:12cooldude127jbondeson: smalltalk is win
22:13cooldude127if i have to do oo, it better be in smalltalk
22:13stimuliyeah ... smalltalk is lovely and wonderful
22:13jbondesonso sad
22:13jbondesongreat ideas, horrid implementation
22:13cooldude127jbondeson: i get screwed cuz i try to use Emacs keybindings in visualworks
22:14cooldude127and i end up deleting all the code i just wrote
22:14gnuvince_Smalltalk environments are bad.
22:14gnuvince_They should do like Factor and open an external editor to edit code.
22:14cooldude127yeah it's the main reason i don't use it more
22:14Chouserrhickey: I've got a tiny patch to fix a paren typo in take-while. You want the whole group/issue process?
22:14jbondesoncooldude127: then you tried to do C-x _?
22:14Chouserthis is in the lazy branch.
22:15cooldude127jbondeson: yeah i tried C-x C-s and the C-x killed everything
22:15jbondesonhahaha
22:15cooldude127jbondeson: save often ;)
22:15jbondesonthis is exactly why you should never leave emacs
22:15cooldude127jbondeson: i could probably do that with gnu smalltalk
22:15cooldude127it has an emacs mode
22:17cooldude127anyway, what language is this channel about again?
22:17gnuvince_heh
22:17jbondesonhaskell?
22:17jbondesoni forget...
22:17stimulithe smalltalk environments were both cool and sucky at the same time
22:17stimuliBCPL ?
22:17cooldude127jbondeson: that's pretty close
22:17gnuvince_Ah, Haskell :)
22:17cooldude127jbondeson: at least you picked a functional language
22:17jbondesonstill miss patern matching
22:17cooldude127jbondeson: me too
22:17gnuvince_If it wasn't for Clojure, I'd be into Haskell full time
22:18cooldude127i couldn't make haskell be useful
22:18cooldude127cuz i still don't fully understand monads
22:18jbondesonmonads are a whole lot of philosophy and not much science...
22:18stimuliI kinda do understand monads .. er .. most of the time ... well ... kinda
22:18gnuvince_cooldude127: the problem with monads is that they're simple and can be used to do crazy things
22:19cooldude127gnuvince_: yeah i could never figure out just how
22:19cooldude127i tried
22:19cooldude127then i found better ways to spend my time
22:19gnuvince_One problem with monads is that the same syntax can have vastly different effects depending on the type being worked with
22:19cooldude127true true
22:19stimuliyeah .. I remember on of walder's early articles where he changed the eval order of a program (completely reversing it) just by changing the monad
22:20cooldude127oh god
22:20stimuliI mean .. it's cool
22:20jbondesonyou know what the only problem with persistent datastructures is? having to think about all the bloody copying.
22:20stimuliyeah
22:20notyouravgjoelsorry for being so... bad at this, but how exactly do I used contrib? I checked out the svn and created clojure-contrib.jar by running ant
22:20ayrnieujbondeson - think about all the safely shared data.
22:20stimuliwe spend like 3290409230984 hours today tracking down a bug that just *couldn't* happen in FP
22:21ayrnieunotyour - add the .jar to CLASSPATH
22:21notyouravgjoelah k
22:21gnuvince_stimuli: what kind of days do you have on your planet?
22:21jbondesonnotyouravgjoel: are you using emacs?
22:21stimulignu : long ones
22:21stimuli:)
22:21notyouravgjoelyes
22:21notyouravgjoelemacs
22:22gnuvince_Well I'm going to bed
22:22gnuvince_Hopefully Rich will see my issue tomorrow
22:22stimulinot : in your .emacs there is prolly some place where you set the classpath for whatever slime/mode/otherwise you are using
22:22notyouravgjoelah, not using slime; never bothered to get it working
22:22jbondesonadd it to your swank-clojure-extra-classpaths
22:22stimulinot : does M-x run-lisp or run-clojure work for you ?
22:23notyouravgjoelno
22:23stimuliso how do you run code ?
22:23stimulifrom shell ?
22:23notyouravgjoelyep
22:23stimulioh
22:23cooldude127notyouravgjoel: maybe try technomancy's clojure-mode clojure-install function?
22:23stimulithere are some not-quite-slime major modes out there
22:23stimulithat let you run your code in emacs
22:23stimulimore or less slime like but easier to setup
22:24notyouravgjoelI'm fine with this, for now
22:24lisppaste8jbondeson pasted "add classpath" at http://paste.lisp.org/display/75392
22:24jbondesonthat reeeaaaaly helps
22:24stimuliyour productivity will go up a lot ..... when you have some free time it is worth pursuing
22:24notyouravgjoeljust because I have a deadline with this thing, tomorrow at midnight
22:24stimuliah
22:24jbondesonadd that to .emacs and you can M-x clojure-add-classpath anything
22:25danlarkinChouser: I pulled represent and invoke-templatetag into a separate (3rd) file. Ugly, but working, solution
22:25stimulinot : do you use Java ? know how classpaths work ?
22:25lisppaste8jbondeson annotated #75392 with "more emacs goodness" at http://paste.lisp.org/display/75392#1
22:25notyouravgjoelehh, I believe I do. Its simply where java searches for classes, if not in current directory, right?
22:25stimuliyeah
22:25jbondesonthose two together will allow you to not have to restart emacs when you want to screw with your classpaths
22:25stimuliso you do java -classpath clojure.jar:clojure-contrib.jar:whateverelse.jar ....
22:26ayrnieunotyour - it's a list of .jars and directories that java searches for classes in, yes.
22:26stimuliyou might have to use a ; instead of a :
22:26notyouravgjoelahh
22:26stimuliyou can put them in an environment var CLASSPATH
22:26stimuliand then Java will find them
22:26stimuliwhich helps when you have a zillion jars
22:27cooldude127jbondeson: your code there now reveals why my classpath addition didn't work until i restarted emacs
22:27notyouravgjoelah, added it
22:27notyouravgjoelbut still no good
22:27jbondesoncooldude127: can't take credit, i sooo lifted that off the internet
22:28cooldude127jbondeson: either way, i now know why it didn't work :)
22:28stimulinot : java -help :)
22:29notyouravgjoelwell anywya, I'm currently specifying it via -cp
22:29notyouravgjoelie, im running
22:29stimulinot : awesome!
22:29notyouravgjoeljava -agentlib:yjpagent -Xms128m -Xmx256m -cp jline-0.9.94.jar:clojure.jar:clojure-contrib.jar jline.ConsoleRunner clojure.lang.Repl
22:29notyouravgjoeland.. nothing, still
22:29stimulioh
22:30stimuliare all the jars in your local directory ?
22:30notyouravgjoelyep
22:30stimuliis there an error message ?
22:30notyouravgjoelwow, jar -t clojure-contrib.jar hangs
22:30notyouravgjoelfor quite a while
22:30stimulitry jar -tf
22:30stimuli:)
22:31notyouravgjoelah
22:31stimuliit was waiting on stdin
22:31notyouravgjoelmakes sense, ahha
22:31Chouserdanlarkin: hm, ok.
22:31notyouravgjoelwait.. these are all .clj files
22:31stimulithat is ok
22:31lisppaste8p_l pasted "Ugly clojure startup script" at http://paste.lisp.org/display/75393
22:31stimulito get *.class files in clojure-contrib.jar you have to tell ant where clojure.jar is
22:32stimuliwhen you build contrib
22:32stimulibut it should still work w/ just the .clj files .. just loads slower
22:32notyouravgjoelmm, okay
22:32notyouravgjoelI'll check it out
22:32stimuliyeah .. play around w/ it
22:34stimuliwell .. I'm turning in .. goodnight (or afternoon or whatever) everyone
22:34notyouravgjoelthanks for the help
22:34notyouravgjoelah
22:36p_lQuestion: When I attempt to autocomplete symbols in SLIME, I get "funcall: Synchronous Lisp Evaluation aborted"
22:36cooldude127p_l: perhaps your slime or swank-clojure is old
22:36cooldude127p_l: i had that and then updated
22:36notyouravgjoelhow do I set the clojure.jar path with ant?
22:40jbondesonnotyouravgjoel: notyouravgjoel: for clojure.contrib "-Dclojure.jar=/path/to/clojure.jar"
22:40jbondesonwhops
22:40notyouravgjoelah thanks
22:41notyouravgjoeloh god
22:41notyouravgjoelit still wont work
22:41jbondeson?
22:42notyouravgjoelactually, I think classpath isn't working properly in any case
22:42notyouravgjoeltake it back
22:43notyouravgjoelit is, itself, but clojure-contrib.jar isn't working one pit
22:44notyouravgjoelso, I ran "ant -Dclojure.jar=clojure.jar"
22:45notyouravgjoel(i copied clojure.jar into clojure-contrib-read-only)
22:45notyouravgjoelthen, copied clojure-contrib into my main clojure directory
22:46notyouravgjoelwhen running, I use
22:46notyouravgjoeljava -agentlib:yjpagent -Xms128m -Xmx256m -cp jline-0.9.94.jar:clojure.jar:clojure-contrib.jar jline.ConsoleRunner clojure.lang.Repl
22:46notyouravgjoeljava -agentlib:yjpagent -Xms128m -Xmx256m -cp jline-0.9.94.jar:clojure.jar:clojure-contrib.jar jline.ConsoleRunner clojure.lang.Repl
22:46notyouravgjoelugh
22:46p_lYeah! I've got Java symbol completion partially working!
22:47notyouravgjoelonce the REPL starts, "(clojure.contrib.combinatorics/subsets '(1 2 3 4))" returns "java.lang.ClassNotFoundException: clojure.contrib.combinatorics (NO_SOURCE_FILE:1)"
22:47notyouravgjoelany ideas?
22:47ayrnieunotyour - (use 'clojure.contrib.combinatorics)
22:48notyouravgjoelah, should have figured
22:49notyouravgjoelmm, are lambdas still not garbage collected?
22:50cooldude127p_l: did the update fix it?
22:52p_lcooldude127: not only update - Java object completion was added outside it. Clojure objects _were_ fixed by it
22:52ayrnieunotyour - they are.
22:53notyouravgjoelk
22:53cooldude127p_l: cool
22:55p_lcooldude127: Now I need to experiment a little more so that I'll get completion a'la NetBeans :P
22:55danlarkinChouser: uh oh! now I have a love triangle of (require ) forms. I feel like this is something I shouldn't have to deal with
22:55cooldude127danlarkin: sounds like you've got something wrong
22:55danlarkincooldude127: won't be the last time :)
22:56cooldude127lol
22:59notyouravgjoelhaha, my own powerset implementation is significantly faster than the contrib version
22:59cooldude127notyouravgjoel: WOOHOO! screw standard libraries
23:00notyouravgjoelpff, at least when the textbook version is 3x as fast as the std lib version
23:01cooldude127lol
23:03notyouravgjoelSoo, back to my original question : any idea how to optimize this: http://paste.lisp.org/display/75390
23:06notyouravgjoelI actually do only use a small portion of the entire powerset, but I don't know an effective way of pruning the execution tree
23:06notyouravgjoelI realize that creating a particularly large powerset is very hard
23:07notyouravgjoel(has n^2 elements for a set of length n)
23:10Chousernotyouravgjoel: with a quick glance, that appears to be pretty lazy
23:10Chouserit should only compute what you use.
23:11Chouser(seq set) is more correct than (nil? set)
23:11Chouseror just (if set ...)
23:11notyouravgjoelI don't understand lazyness entirely
23:12notyouravgjoelor well, I get the gist
23:12notyouravgjoelbut, how do I apply it to this problem?
23:12Chouser'set' is the name of a builtin function, though, so you might choose a different name for that arg
23:12notyouravgjoelcan I creat the powerset, and then use some filter to only ahve what I want?
23:12Chouserwell, you said you only need a "small portion". which portion?
23:13notyouravgjoelI filter the problem to make it smaller, not using any sets that have greater than half the original set's amount of sets
23:14notyouravgjoel(thanks for your help by the way)
23:15Chouserhm, sounds like laziness might not help you much then
23:16notyouravgjoelyeah. It would be great, though
23:16notyouravgjoelI'll have to ponder the powerset function, I suppose
23:16notyouravgjoelmaybe prune it a bit
23:16Chouserif you were to do (take 5 (powerset...)) it would only compute the first 5
23:16notyouravgjoelis it possible to do something like
23:16Chouser(assuming it's as lazy as I'm guessing by just looking at it)
23:16notyouravgjoeltake a random 5?
23:17Chouserthe 'rest' of a seq is lazy
23:18Chouserthe only way to get to item n in a seq is to walk past and realize all of the items up to n
23:19Chouserso counting a lazy seq realizes the whole thing
23:20Chouserthat means to get a fair random selection, laziness won't help. Though you could "flip a coin" on each item until you have as many as you want, leaving the rest unrealized.
23:20notyouravgjoelmakes sense
23:20notyouravgjoelthe problem is that this implementation goes...
23:21notyouravgjoel(powerset (range 1 4))
23:21notyouravgjoel([] (3) (2) (2 3) (1) (1 3) (1 2) (1 2 3))
23:21notyouravgjoelah well
23:21notyouravgjoelso 1's only start getting added after the others
23:22notyouravgjoelah well
23:22notyouravgjoelThanks man =)
23:22ChouserIt seems like you might be able to build your "less than half the length" constraint right into the function.
23:22notyouravgjoelI'll go think about it
23:22Chousergood enough.
23:22notyouravgjoelwell see
23:23notyouravgjoela powerset of a set of n elements is length 2^n
23:23notyouravgjoelcutting it in half == a new length of 2^(n-1)
23:23notyouravgjoelwhich only yields me an extra 1
23:23notyouravgjoelie, i can now calculate the powerset of a set with 22 elements, whereas now I'm stuck at 21
23:24notyouravgjoelbut yeah, that IS a good net improvement
23:25notyouravgjoelOhhh wait, you gave me an idea!