#clojure logs

2011-03-07

02:24amalloydo we have a function like sorted-map-by, except that instead of taking a comparator it takes a coerce-to-integer function, applies it to the two elements and uses - as the comparator?
02:25amalloyeg, (my-sorted-map-by (memfn length) "test" 1 "sample" 2) would get a map sorted by length of key
02:32hiredmanlength? really?
02:33hiredmanhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L510
02:33amalloyhiredman: i actually do have a case where length would be useful, but it's just an example
02:33amalloyoh
02:33amalloyhah
02:33amalloyfine fine, count
02:34hiredman- as the comparator?
02:34hiredman- is a function, just compose it into the comparator
02:35amalloyhiredman: i don't want to write a comparator at all, i want to write a "make this an int" function and then have the ints compared for me
02:35amalloy(fn [a b] (- (somefn a) (somefn b)))
02:36hiredman(comp *1 make-it-an-int)
02:36amalloyeverything there but somefn is pretty generic and i wouldn't be surprised if someone had written this already
02:36hiredman(partial (fn [somefn a b] (- (somefn a) (somefn b))) count)
02:37hiredmanalso, whoever keeps using alength, knock it off
02:38tufflaxWhat exactly does 'resolve' mean here: "For Symbols, syntax-quote resolves the symbol in the current context, yielding a fully-qualified symbol."?
02:38amalloy,(resolve 'inc)
02:38clojurebot#'clojure.core/inc
02:39hiredmanamalloy: no
02:39amalloyno?
02:39hiredmantufflax: it means that syntax qoute replaces the symbol with a new namespace qualified symbol, taking the namespace part from the current namespace
02:40hiredmanamalloy: that is symbol to var resolution, not the same thing
02:40amalloy`[inc not-existent]
02:40amalloy,`[inc not-existent]
02:40clojurebot[clojure.core/inc sandbox/not-existent]
02:40hiredmanthe symbol -> namespace qualified symbol thing happens at read time when a syntax-quoted form is read
02:40tufflaxOk. Thank you!
02:40amalloyhiredman: i realize it turns into a symbol, not a var, and thank you for correcting me there, but saying it takes it from the current namespace is misleading
02:41amalloymakes it sound as if `inc would resolve to 'sandbox/inc
02:41raektufflax: the symbol will become a fully qualified one, taking in account the use, use :rename and require :as for the current namespace
02:41hiredmanamalloy: fine
02:41hiredmanI am kind of surprised that syntax quoting isn't a macro yet
02:42hiredmanhaving the reader do it is kind of yetch
02:43hiredman,(doc ns-map)
02:43clojurebot"([ns]); Returns a map of all the mappings for the namespace."
02:43raek(ns my-ns (:use [foo.a :only [x]] [foo.baz :only [y] :rename {y z}]) (:require [foo.c :as f]))
02:43raek`(x z f/w) --> (foo.a/x foo.baz/y foo.c/w)
02:45hiredmanhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L718 yetch
02:46hiredmanhttps://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj#L367
02:48hiredmanhttp://www.thelastcitadel.com/images/syntax.png trying to figure out flow control for syntax reader
02:50amalloynice. looks perfectly clear to me
02:50hiredmanjava is structured programming, I swear
02:56amalloyhiredman: what tool does that control-flow graph?
02:56amalloy(if you drew it yourself, please just lie)
02:58hiredmanwell, I did it with dot
03:00raekit made my life much more bearable when I ported some assembly code into C
03:02raekwhen I look at this control flow graph, I know Dijkstra was right about structured programming: http://raek.se/graphs/start.png
03:06companion_cubeis this the output of a compiler ?
03:11khaliGhm so is there a trick to getting useful information out of a restart screen in slime or is this still being improved?
03:11khaliGit always says "No Locals" on the backtrace
03:16raekkhaliG: you can use this to get the locals at the point wher you write (swank.core/break) http://hugoduncan.org/post/2010/swank_clojure_gets_a_break_with_the_local_environment.xhtml
03:16raekkhaliG: but in general, no. I think this is because when you receive the exception, the stack has already unwinded and the locals are gone
03:17khaliGdamn ok :/
03:17khaliGdebugging is kinda primitive then, back to stone age prints
03:17raek(I think this is being thought upon by the core clojure guys. there is certainly an interest in having these features=
03:18khaliGraek, glad to hear! :)
03:18hiredmanI think it would require reified environments, which would be very hard
03:18khaliGi dont mind using prints but not when working with maps where you print out possibly too much info
03:18hiredmanyou can go at it from the java side using a java debugger or cdt
03:19hiredmanhttp://georgejahad.com/clojure/cdt.html
03:19khaliGmaps/vectors/collections
03:19khaliGhiredman, that looks promising, thanks
04:26rangenenclojure installed, started new project, i press Play, and get following dialog: Select main class for execution. <No main classes Found.>. how i can define main class?
04:30rangenuups, wrong channel
04:31rangenoh well, nobody in #enclojure
04:42rangenok, solved that, had to manually specify main class in properties, run. however, now i press play and get error "Could not reserve enough space for object heap" from maven invication
10:10bennyludefining exception using deftype - can i add constractor that takes message?
10:39fogus`Joy of Clojure is at the printers!
10:40TimMcfogus`: \o/
10:40TimMcCongratulations.
10:40raekyay!
10:40fliebelfogus`: Yay!
10:40amacfogus`: when does it launch?
10:42fogus`amac: Sometime Mid-late-March
10:42amacnice
10:42fogus`More information here: http://blog.fogus.me/2011/03/07/the-joy-of-the-joy-of-clojure/
10:42TimMcsweet
10:45amacthe print book on amazon is cheaper than the manning ebook :(
10:46fogus`Weird.
10:46pdk(let [x (atom 1) y x] (print "x:" x "y:" y) (swap! y inc) (print "x:" x "y:" y))
10:46pdk,(let [x (atom 1) y x] (print "x:" x "y:" y) (swap! y inc) (print "x:" x "y:" y))
10:46clojurebotx: #<Atom@1832397: 1> y: #<Atom@1832397: 1>x: #<Atom@1832397: 2> y: #<Atom@1832397: 2>
10:47fogus`I believe if you buy the print book then the ebook comes for free... that's what the cover says anyway
10:47fogus`amac: ^^^
10:47pdkyou have to buy it through manning to get early access + the ebook deal
10:47pdkit's 20 bucks after the promotional discount on manning anyway
10:48fogus`Even better
10:48amacwhere is it 20$?
10:49amacfor me it says 35$ for ebook, 45$ for book+ebook
10:50amacregardless, I'll buy it - I'm just extremely cheap
10:50amacalso broke
10:52semperosusers of cake: is there a "preferred" version of Ruby? any issues using 1.9.1?
10:53jolyCongrats on the JoC printing! I'm looking forward to receiving my copy.
10:54fogus`joly: That makes two of us. ;-)
11:00pyrhi guys
11:01pyrfor a future ftr
11:01pyr(.get ftr timeout TimeUnit/MILLISECONDS) waits for a timeout
11:01pyris there a way to wait on multiple futures at once ?
11:03pyrit seems raek's blog post covers it, ignore me
11:07cemerickcongrats, fogus` and chouser_ :-)
11:07fogus`cemerick: Thank you sir
11:10jwr7How do I import a Java enum that has a dot (period) in the name?
11:10pdktry replacing the dot with /
11:10jwr7I'm trying to use imgscalr (http://www.thebuzzmedia.com/downloads/software/imgscalr/javadoc/index.html) and it has a class called Scalr.Method
11:16jwr7Ahh, got it — (:import (com.thebuzzmedia.imgscalr Scalr Scalr$Method))
11:51waxroseGood morning/afternoon/evening every one
11:53semperoshowdy
12:12fogus`Anyone care to spread some love? :-) http://news.ycombinator.com/item?id=2297669
12:14pdfogus`: ha, are you taking writing tips from david foster wallace or what?
12:14pdthe bulk of your content is in the footnotes
12:15fogus`pd: The explanation for that can be found... in one of the footnotes. ;-)
12:15pd=)
12:22waxroseI'm ready for that book to come out!
12:22hiredmanfogus`: perhaps you could persuade manning to use bigints to index footnotes, then you could have has many as you like
12:24fogus`hiredman: Nah... we only needed a short int.... errr... unsigned.
12:24waxrosefogus`, You are the author?
12:25jkdufairfogus`: congrats. i like #9
12:26fogus`waxrose: co-author
12:27waxrosefogus`, Good to know. I've been waiting for my copy to come into my job so I can buy it before it goes on the shelf! (so no sweaty palm people touch my book)
12:29waxrosejkdufair, I agree.
12:30waxroseGreat footnotes. lol
12:32jwr7fogus: congratulations I've been obsessively checking the manning site for updates recently...
12:32fogus`jkdufair: #9 makes it clear how much I've avoided doing because of this dumb book. :-O
12:33waxroseI'm sure it's not a dumb book. :D
12:53amalloysemperos: i use ruby 1.9.0; i think i tried 1.9.1 at some point but downgraded (i only use ruby for cake) when i ran into trouble with the readline library
12:53amalloyand if you're on windows i think you have to use 1.8.x
13:16semperosamalloy: thanks for that; I'm on a Windows work machine, so I suppose it's 1.8
13:17amalloy$google cake windows ruby version
13:17sexpbotFirst out of 81400 results is: Issues - ninjudd/cake - GitHub
13:17sexpbothttps://github.com/ninjudd/cake/issues/45/find
13:17amalloyhm. not the issue i was hoping to find
13:17semperosdefinitely did some googling, but didn't find anything definitive
13:18semperosI don't really care either way, I use RVM on Linux and pik on Windows; just wanted to know what folks actually used and was stable
13:30raekpyr: also check out CompletionService ( http://download.oracle.com/javase/6/docs/api/java/util/concurrent/CompletionService.html )
13:31raekpyr: it allows you to wait for multiple futures to finish (even if you don't submit all of them at once)
13:34pyrraek: thx!
13:46semperostrying to use cake (on Windows), my Java install doesn't have a "server" vm, only client; how do I get the server version?
13:47semperos(cake keeps looking for jre6/bin/server/jvm.dll)
13:51spewnsemperos: The server one comes with the JDK, but not the JRE. http://www.oracle.com/technetwork/java/javase/jrereadme-182762.html
13:52semperosyeah, just re-found it in my jdk install, thanks
13:55khaliGi'm having trouble using the memoize function. ive used it like (defn my-fn [] (memoize (fn [] ...)) but the result of this is some memoized thing, which isn't what the inner fn actually returns
13:56khaliGoh, i think i got it
13:56amalloy(def my-fn (memoize (fn [] ...)))
13:57semperosthere's also clojure.contrib.def/defn-memo
13:57amalloythere's also a defm somewhere in contrib
13:57amalloyor i guess it's called defn-memo, apparently?
14:00khaliGok that's confusing :/
14:01amalloykhaliG: what is?
14:02amalloy(memoize ...) returns a function, which has been memoized. you want my-fn to be a function which has been memoized, *not* to be a function which calls memoize
14:02khaliGthis is what i've tried so far, (defn my-fn [] (let [f (fn [] ...)] (memoize f) (f))
14:02khaliGright that's where i'm stuck
14:02amalloy*boggle*
14:02khaliGso i have to use the macros then?
14:02amalloyseriously it is as simple as (def my-fn (memoize (fn [] ...)))
14:02amalloyno other nonsense is needed
14:03khaliGoh DEF
14:03khaliGi misread as defn, let me try that
14:04khaliGamalloy, thanks that's easy and it works :)
14:04jweisskhaliG: also you should realize that clojure is immutable by default.
14:05jweiss(memoize f) returns a new function and leaves your original argument f untouched.
14:05khaliGunderstood
14:08amacis there a performance benefit to putting :use/:require in the ns form, or separately as (use ...) (require ...)?
14:08amacor is it strictly style
14:10amalloyamac: i can't see how it would matter. you could conceivably save on performance by putting a rarely-used (use ...) inside of a function so that the code doesn't get loaded until it's used, but i'm not actually sure if that works the way i think it does
14:13hiredmanamac: put it in the ns form
14:24amalloyyeah, that's probably a better answer than mine. if you're seriously trying to squeeze performance out by *moving your imports*, consider suicide
14:33mattmitchellI can't seem to get this trivial multi-method code to work: https://gist.github.com/859053
14:33mattmitchellanyone see what i'm doing wrong?
14:34mattmitchelli get this error: java.lang.IllegalArgumentException: No method in multimethod 'select-ux' for dispatch value: hello
14:38amalloymattmitchell: your code is fine; you're being tripped up by the def-once semantics of defmulti dispatch functions
14:38amalloyie, if you (defmulti foo bar) and then later (defmulti foo baz), the dispatch function is still bar
14:38amalloyto rework multimethods in this way, you have a few options, but the simplest is restarting the repl
14:38mattmitchelloh! so i'm re-executing my changes by using (load "my-file.clj")
14:39mattmitchellamalloy: restarting the repl aye. ok. what are the other ways?
14:39amalloynext-simplest is probably (ns-unmap *ns* 'select-ux)
14:39mattmitchellamalloy: right on that worked :)
14:39khaliGamalloy, i'm trying to define a reset function but all i came up with was a copy paste of the (def my-fn (memoize (fn ..)..) form. Is there a nicer way to do it?
14:40mattmitchellamalloy: thank you
14:40amalloythe other one i can think of is (defn dispatch [obj] ...) (defmulti select-ux #'dispatch)
14:40amalloythen if you redefine the "dispatch" function the var will have a new value and select-ux should use that
14:41amalloykhaliG: you're looking for a way to purge the memoization cache?
14:42khaliGamalloy, yes
14:42khaliGwell i want the effect of evaluating the def again
14:42amalloyin a side-effect-y way that affects everyone using the globally-def'ed function? that seems gross
14:42pdkhttp://www.paullegato.com/blog/memoize-reset-clojure/ perhaps?
14:42pdkthe stock memoize, defn-memo etc keep all the memoized values around forever
14:43khaliGoh i see
14:43amalloythe simplest way is to wrap the memoization up in a defn
14:43khaliGwell maybe i dont even need a reset, if i try hard
14:43amalloy(defn cached-myfn [] (memoize (fn [x] ...)))
14:43amalloythen whenever someone wants a new cache they can call (cached-myfn) to get a new version
14:44amalloyand track that object themselves to keep the cache around as long as they want
14:44khaliGhmm
14:44khaliGno i think i'll just avoid reset. i only needed it for initial testing now that i think about it
14:50amalloyargh, someone has written a useful library and chosen to only make it available through ant tasks. what't the right clojure tool to use to create and execute ant targets on the fly?
14:56patrkrisdoes anyone know how to start the JVM with utf-8 encoding with leiningen? I tried both setting :jvm-opts in project.clj and also exporting the JVM_OPTS environment variable, setting it to "-Dfile.encoding=UTF-8"
14:57amalloypatrkris: pretty sure it defaults to utf-8. what issue are you having?
14:58patrkrisamalloy: sending an e-mail from a clojure program garbles non-english characters
14:58patrkrisand (System/getProperty "file.encoding") returns "MacRoman"
14:59patrkrisstrange... just tested by running `lein repl` and now (System/getProperty "file.encoding") returns UTF-8... the error occurs when running `lein ngserver`
15:03patrkrisok, now it works as per the instructions here: http://mathias-biilmann.net/2009/3/clojure-repl-and-utf-8
15:03TimMcI've never used memoization, but it just occurred to me that it's a potential source for soft memory leaks if you use it poorly
15:07waxroseTimMc, I'm going to Clojure Conj for sure now.
15:07TimMcYay!
15:07waxrose:D
15:08waxroseTimMc, Is brain on fire your blog?
15:09__name__What blog engines do you guys use?
15:09__name__I am looking for a good restructured text blog.
15:09fliebel__name__: Wordpress :(
15:09fliebelI don;t think there is anything written in Clojure that can compete.
15:10waxrose__name__, I used this site to set up my blog on Google App Engine --> http://compojureongae.posterous.com/?page=3
15:11waxroseTo help*...
15:11TimMcwaxrose: Yup.
15:12__name__Are there libs for rst for the JVM?
15:13waxroseTimMc, Nice information on there. Do you have a twitter by any chance?
15:13waxroseI need to finish setting up my blog this week.
15:30amalloy__name__: i use hubpages for my blogging. less flexible than wordpress i think, but (a) nice editing UI, (b) very nice SEO tools to increase your traffic, and (c) i work there :P
15:30scottjuploaded 8 more screencasts, 2 about Clojure, please upvote at http://news.ycombinator.com/item?id=2298525 if you like them
15:31drobatiHi, I was wondering if I should preorder "The Joy of Clojure" or is there a better book?
15:34waxrosedrobati, I hear it's going to be an awesome book. And I believe there is a 35% coupon for it if you get it off manning.com
15:35drobatiIts affordable off amazon (with prime). And so far I've enjoyed the first chapter.
15:35waxroseI pre-ordered mine already. :)
15:35drobatiFigured I'd get the communities opinion before I ordered it.
15:35drobatiYea, I think I'll buy it.
15:36waxroseThe co-author was in here earlier.
15:36amalloywaxrose: fogus and chouser are both in here all the time, one way or another
15:36amalloyat the moment they're both away, but leave a message and they'll get back to you
15:36drobatiYea I saw fogus` go away right after I asked the question. :P
15:37amalloydrobati: haha, so he did. i guess he's hiding from the paparazzi
15:37waxroseamalloy, Thanks for the heads up. I'll probably be around every day now to notice that next time haha.
15:37drobatiYea amazon lists 26.40 for me.
15:38drobatiI'm a student on a budget and amazon prime makes it a steal!
15:38waxrosedrobati, I work part time at B&N, so I'll just use my discount for it.
15:38drobatiAh.
15:39drobatiI was thinking about picking up a copy of Let over Lambda too.
15:39waxroseI was debating on skipping that one for now.
15:40waxroseToo many good books to dissect. >.<
15:40drobatiA friend of mine owns it, but I love lisp so much I figured I should own my own copy.
15:41drobatiDoes "The Joy of Clojure" cover lien and slime?
15:41drobatilein*
15:42drobatiI've set up and used both successfully but I want more in-depth guidance.
15:42scottjdrobati: have you checked out http://youtube.com/emailataskcom ?
15:42scottjI cover slime quite a bit
15:42drobatiI believe you linked that to me previously.
15:42brehautdrobati: lein is mentioned once
15:42drobatiA couple weeks back.
15:42drobati:P
15:42brehautand slime not at all
15:43drobatibrehaut: thanks
15:43waxrosescottj, Thanks for the link. :P
15:43brehautdrobati: thats based on searching copy of the MEAP i have; dunno about the final book
15:44amalloydrobati, waxrose: LoL is pretty fascinating stuff; i need to get myself a copy. you might want to check out On Lisp, which is free online, and also excellent
15:44drobatiI saw the source uses lein.
15:45drobatiI mean I need no help with lein, just more a workflow.
15:45drobatiamalloy: thanks for the heads up
15:46waxroseamalloy, I actually have a copy of On Lisp in ebook form. Just havn't started reading it yet. :P
15:47scottjon lisp is probably my favorite lisp book, I really like how pg writes code. if you haven't read the code for hacker news and you like webapps you're missing out
15:48drobatiI need to do that.
15:48waxrosedrobati, same
15:48drobatiAnyone like The Little Schemer?
15:48waxroseI have that in ebook as well, and havn't started reading it also. haha
15:49drobatiIts a easy book to read but the later chapters do require some analysis.
15:50waxroseI'm still dealing with SICP. I think I've read it 3 or 4 times already.
15:50dnolendrobati: yes, and The Seasoned Schemer, The Reasoned Schemer as well.
15:50drobatiI haven't gotten a chance to read them.
15:51drobatiWhen I start making more money I am definately going to buy them.
15:52waxroseI'm sure you can find them in ebook form for cheap.
15:52drobatiI don't like ebooks for programming books.
15:52waxrosesame, but they sure are portable. :D
15:52drobatiYea.
15:53waxroseI usually just keep classics in physical form and everything else in ebook.
15:53drobatiI have a kindle that I love reading on.
15:54drobatiBut I absolutely hate programming books in digital formats.
15:54drobatiI suppose its cause I like to leave notes in the books.
15:55raekdrobati: re. slime workflow, I summarized my personal routine here: (it might not be as in-depth as you were looking for though) http://groups.google.com/group/clojure/browse_thread/thread/4d8a1fc669a5a2df
15:57waxrosedrobati, Oh you actually write in your books?
15:57drobatiNo
15:58drobatistickies
15:58waxroseoh okay
15:58drobati:P
15:58drobatiThey are like precious pieces of gold. I wouldn't deface them like that.
15:58waxroseI was about to say, "How dare you write on the pages of SICP!!"
15:58waxroselol
15:58drobati:P
15:59jfieldswhen I'm using gen-class and I want to create a java method that takes varargs, what do I make the :methods look like (:gen-class :methods [[foo [?] void]]) What goes in the place of ?
15:59waxroseI've tried to figure out how to create an easy note taking system in digital form, but it just doesn't feel as good as a notebook.
15:59waxrosepaper*
16:01drobatiwaxrose: org-mode
16:01drobati<3 org-mode
16:01drobatiBut you'
16:01drobatire right*
16:01amalloyjfields: blurg. varargs in java are kinda gross to begin with. just make it take a Collection<Foo> instead of Foo...
16:01waxroseI've looked at it some what. I need to check it out again.
16:02drobatiWell I use Emacs like an OS.
16:02drobatiSo Org-mode makes todo, notes, agendas, ect awesome.
16:03amalloyat the bytecode level varargs are just syntactic sugar for arrays
16:03jfieldsamalloy, that's true
16:03waxrosedrobati, I just got done building Emacs 24 from source. :P
16:03raekjfields: I'm not sure you can generate those with gen-class. I base my assumption on the fact that clojure does not treat varargs like java when calling with interop (last arg is an array)
16:03scottjwaxrose: http://jaderholm.com/screencasts/org-mode/ :)
16:04jfieldsbut, calling a method foo(1, "hi", "blah") is much better than foo(asList(1, "hi", "blah"))
16:04waxrosescottj, You are starting to be my source friend. :D
16:06bawrI need some high-level advice, bevause I don't seem to have a good idea. I want to display and edit a clojure vector using Swing's JTable. The display part is easy enough if I implement a model based on my vector, but how do I do edits?
16:07amalloybawr: an atom around the vector?
16:08bawrAh, right. Goes to show how much I know about non-trivial Clojure. :)
16:10naeuchouser_: congrats on getting the book to the printers
16:11khaliGbawr, yep like amalloy said, an atom oround a vector is easy. I use proxy on AbstractTableModel and implement the methods to work on the closed over atom
16:11khaliG(there may be better ways to do it, im a newbie too)
16:12mattmitchellanyone know of a good library for constructing url query strings out of hash-maps/vectors?
16:12mattmitchell(to-query {:id 1 :mode true}) => "id=1&mode=true" etc.
16:12amalloymattmitchell: for constructing them? that's a lot easier than parsing them
16:13mattmitchellamalloy: for constructing yes
16:13mattmitchellamalloy: i guess it's probably easy enough to just write one!
16:13amalloy(defn to-query [m] (clojure.string/join "&" (for [[k v] m] (str k "=" v))))
16:13amalloyis my rough draft
16:14amalloy&(require 'clojure.string)
16:14sexpbot⟹ nil
16:14amalloy&(let [to-query (fn [m] (clojure.string/join "&" (for [[k v] m] (str (name k) "=" v))))] (to-query {:id 1 :mode true})
16:14sexpbotjava.lang.Exception: EOF while reading
16:14amalloy&(let [to-query (fn [m] (clojure.string/join "&" (for [[k v] m] (str (name k) "=" v))))] (to-query {:id 1 :mode true}))
16:14sexpbot⟹ "id=1&mode=true"
16:15raekfor url-enconding the contents: http://clojuredocs.org/ring/ring.util.codec/url-encode
16:15waxrosescode_, Thanks a lot. That is another great link.
16:15waxroseopps
16:15amalloygood point raek
16:17amalloya thought: would people see it as a feature or a bug if sexpbot automatically balanced any missing close-braces in an eval request?
16:19bawrkhaliG: Ooh, right. Even better. :)
16:23spewnamalloy: Possibly a bug if it makes the code look correct and then the code gets pasted elsewhere where it's expected to be proper. On the other hand, a damn neat feature.
16:24amalloyspewn: yeah, clearly those are the competing concerns. you're being asked to vote :)
16:25bobo_amalloy: if it states that it added braces i think its ok.
16:25amalloyi bet i could get the best of both by making him do something like:
16:25amalloy/msg sexpbot say #clojure ⟹ "id=1&mode=true" ; WARNING repairing malformed code snippet
16:25amalloyhm. apparently that /msg didn't work
16:26bawrI think it's al right, when people paste code, they usually do so in a paren-matching environment, anyway. Though it should scream at people if- yeah, that.
16:26raekif the bot tells you in what way it repaired the expression, I guess it's ok
16:26amalloyraek: in what way?
16:26raekalso, where should the missing paren be inserted? always at the end?
16:28bawrWhere else? I mean, this is mostly targeted at lazy people who don't maintain an internal paren stack, so they don't remember how many to close.
16:28bawr(Full disclosure - I'm one of those lazy people mostly.)
16:28amalloybawr: (let [x [1] (inc x))
16:29amalloycouldn't fix that by adding to the end
16:29amalloyer, i guess you could
16:29bawramalloy: And you would want to fix it?
16:29amalloy(let [x 1) (inc x))
16:30bawrI kind of assumed you meant straight-up matching at the end.
16:30amalloyi'd leave that alone, but it's another place you could try to fix
16:31bawrI think for the most part, it's more trouble than it's worth - probably the people who make the most mistakes like that wouldn't be sure if the fix is kosher.
16:37dnolenNice, V8 JS has Object.freeze. Yet another reason for Clojure -> JS.
16:38drobatiwaxrose: I've been using 24 on my other computers.
16:38brehautdnolen: any implementation of JS that has web workers needs that i think
16:39drobatiThis computer (windows) is due for an update but I only use windows at work for compatability.
16:40dnolenbrehaut: No. Web Workers communicate via strings.
16:40brehautdnolen: they did, i was under the impression that changed
16:41dnolenbrehaut: ah, you're probably right, I haven't followed web workers too closely since I first looked at them.
16:45brehautdnolen: sadly i cant find anything to back myself up
16:53semperosbrehaut: thank you for writing necessary-evil, just got to use it for the first time, real time-saver
16:53brehautsemperos: your welcome
16:53brehautsemperos: im planning to get 1.1 done shortly (got a work project to finish first), which includes improved fault handling
16:54semperosI'll keep an eye out for it
16:54brehautcool :)
17:20khaliGis there any code for putting images on imgur? i'm looking at the java example and it's already pretty short so i dont imagine there is.. but no harm in asking :)
17:31pyrwell it seems futures inside futures end up causing problems and blocking too :(
17:31brehautpyr it should only be a problem if there is a cycle?
17:32pyrhow do you mean a cycle ?
17:33raekpyr: do you have a fixed size thread pool?
17:33pyri don't think so
17:34brehautpyr if you have futures A and B and if A and B both depend on the results of each other, you have a cycle
17:34pyrnope i don't have that
17:34pyri have a future A which must run in n seconds
17:35pyrwhich spawns 5 futures B, B', B'' ... which must themselves complete within some amount of time
17:35raekas long as all tasks can run in threads at the same time, and they don'r block in a circular manner, they shouldn't hang
17:35pyr'k, i'm creating the tasks with future
17:36raek(with task I here meant the function / expression that should be executed in some thread)
17:37raek(a future is the "ticket" you get when it is submitted to an executor)
17:37pyri got you first comment
17:37raekand, obviously, it is also the name of a macro in clojure.core
17:38pyri was reffering to the macro
17:38raekwhich was maybe what you referred to before I complicated the matter... :)
17:38pyr:)
17:39pyrnope and reading your blog post
17:39raekclojure.core/future uses a cached thread pool (non-fixed), so that shouldn't be a problem in this case
17:39pyryep
17:40pyrof course under the hood there's AMQP calls
17:40pyrwhich might trigger a weird behavior
17:44pyrI'll get it, eventually
18:00ieureIs visualvm the best way to debug Java heap OOM issues, or is there some other tool I should look at?
18:02pyrmeh, that was a stupid mistake, behavior is as expected
18:10khaliGhm i give up. i think the java example is incomplete. it doesn't seem to retrieve a url to the uploaded pic
18:43ieureIs there a slime thing to build a whole Clojure project? I know of C-c C-k to compile/load the current file, but I’d like a way to invoke `lein jar' or `lein uberjar'.
18:43ieureIf not, I guess I’m writing a new compilation-derived mode to make that happen.
18:45amacieure: I always use lein, let me know if you find a shortcut from within emacs
18:57ieureamac, In the shell, you mean?
18:58ieureI also do that, I was just wondering if there was already a thing that hooked into compilation-mode (or some SLIME equivalent) to provide next-error / previous-error navigation and the likd.
18:58ieure*like
18:58amacieure: yeah
19:00amalloyieure: are you talking about M-n and M-p? those go to next/prev error when compiling
19:01amacnah, he's looking for project build shortcuts
19:01amaca la 'lein uberjar'
19:01ieureamalloy, C-x `
19:01ieureWell, kind of.
19:01ieureLike I said, I know I can compile one _file_ with SLIME.
19:02ieureBut I want to compile my whole project.
19:14thxclojure dash E doesn't work? https://gist.github.com/859565
19:17amacjava -jar clojure-1.2.0.jar -e "(+ 2 2)"
19:17amacsomething gives with your clj script
19:17amacthat works for me
19:18amalloyamac: too slow. you needed to answer in 2.5 minutes to be considered for the honor of solving his problem
19:19amacI will never close this window again. Ever.
19:21PtivalFrom clojure.contrib.logging "Logging levels are specified by clojure keywords [...]", but it doesn't tell me /how/ or /where/ I should specify this...
19:23lancepantzPtival: what are you trying to do? i just joined?
19:24PtivalJust using cloj.contrib.logging, but right now my logs don't show, I believe because I never set the log-level
19:24PtivalI think I found some help here: http://www.paullegato.com/blog/setting-clojure-log-level/
19:25PtivalI don't get why the API doesn't allow to set the level while it uses it...
19:25TimMcThat's kind of terrible.
19:26amalloyamac: i wouldn't worry about it though; from the gist owner it looks like it was the same guy in here yesterday who was railing about refusing to take any of the suggestions he was given
19:27TimMcamalloy: Maybe.
19:27lancepantzPtival: there are info, debug, and a few other macros in cc.logging that i use
19:28lancepantzPtival: (info "foo")
19:28amacamalloy: that would not be surprising, that dude had grief.
19:28Ptivalyes that's what I use too (in my case)
19:29amalloyPtival: https://github.com/Raynes/sexpbot/blob/master/src/sexpbot/plugins/log.clj#L23 and https://github.com/Raynes/sexpbot/blob/master/src/sexpbot/utilities.clj#L83 are some code i use to readjust the logging levels in sexpbot
19:29Ptivallancepantz: I just have to figure out what logger is actually used, where it actually logs to, and whether it logs at the default log-level
19:30Ptivalamalloy: thanks
19:30TimMcThey're both "Andrew", and both trying to use clj directly.
19:30amalloyTimMc: profile picture is what tipped me off
19:31TimMcI see it, but I don't learn anything from it.
19:31TimMc(just like Andrew)
19:31amachahaha
19:32brehautjust a note: not all andrew's are incompetent
19:41Ptivalhum...
19:41waxrosehmm
19:48TimMcwaxrose: I'm back!
19:48waxroseTimMc, Welcome back!
19:48TimMcInternet connection died about 5 seconds after I answered you.
19:48waxroselol
19:48TimMcAnd nope, don't have a Twitter.
19:48waxroseOh okay, what about a github?
19:49TimMcI do! timmc@github
19:49TimMcOne app in active development, the HW3 thing.
19:49waxrosecool cool I'll follow you! I have some thing in mine you might want to play with, clone of the Lisp Machine
19:49TimMcThe Genera thing?
19:50waxroseYeah
19:50waxroseI have the cadr emulator and then the open genera 2.0 in my repo
19:52Ptivaluser=> (impl-get-log "")
19:52Ptival#<RootLogger java.util.logging.LogManager$RootLogger@8429c19>
19:52Ptivalshouldn't I be able to call LogManager methods on this?
19:52TimMcOK, I see you.
19:52waxrose:D
19:55waxroseI need to find a DEC Alpha. :/
20:01amalloyPtival: i don't think so
20:01amalloythat's necessarily, anyway
20:02amalloyit's not a LogManager object; it's a RootLogger object embedded inside of a LogManager
20:03Ptivalok
20:07TimMcwaxrose: I might be able to dig one up for you in the area. :-P
20:08TimMcI saw a real Lisp Machine at MIT!
20:08waxroseoh wow lol
20:08TimMcThe MIT Museum is pretty cool.
20:08waxroseWell, I shouldn't be surprised. But I still am!
20:08TimMcBut I think I also saw one at the Stata center in the CSAIL area.
20:09waxroseI forgot why the Lisp machines died out.
20:09AdamantRISC was good enough and cheaper
20:10Adamantbasically
20:10Adamantthanks to better compilation techniques via using lots of registers
20:11Adamantyou couldn't have Lisp Machine grade elegance that easily, at least without buying Genera, but you could have it's speed
20:11TimMcI've heard some mumblings about mismanagement and poor marketing, but I really have no idea.
20:12waxroseshame
20:13waxroseAdamant, Thanks for elaborating.
20:13waxroseAt least it's fun to still run the emulator at least. Blast to the past.
20:13amacI love that line from Hackers "RISC is going to change everything"... no it didn't
20:14waxroselol
20:14AdamantTimMc: negative competition between Symbolics and LSL or whatever, infighting in the MIT AI Lab community that produced it, and that lead to the FSF via Stallman
20:14waxroseI havn't seen that movie in a while, I should go watch it tonight.
20:14Adamantit did
20:14amacI love that movie :)
20:14Adamantyour x86-64 ISA is basically a frontend for a RISC processor
20:15Adamantunder the hood
20:15Adamantpure RISC didn't win, but pure CISC did lose
20:15amactrue
20:15amacCISC got slightly simpler, but not anywhere near to the RISC set
20:15waxroseIt is funny how fighting always destroys a project rather than the project itself.
20:16AdamantTimMc: also Lisp Machines were oversold to business and got nuked hard by the AI winter
20:16Adamantwhich was a result of AI being oversold
20:17waxroseDo you think the Lisp machine may ever make a come back?
20:17amacunlikely
20:17Adamantprobably not, but "general-purpose" processors may have better hardware support for some language paradigms
20:18Adamantmany early processors were informally and unintentionally optimized for FORTAN and such, while later ones were done for PASCAL, and most modern-ish ones for C
20:18amacalthough I am slightly surprised that java processors havn't made a comeback, esp with the push over the past few years to 'cloud' everything
20:19waxrosehmm
20:19Adamantamac: ARM's in theory have specialize support instructions for Java via Jazelle
20:19Adamantit doesn't do full JVM, but it accelerates several JVM functions
20:20Adamantabout 50-60% can be done in hardware
20:20amachmm, that's interesting
20:20Adamantgetting access to that for mere mortals is supposedly not easy, though
20:20Adamantfor cloud vendors, there's not a lot of upside to being language specific
20:20amacaren't they starting to push out blade servers packed with low power arm chips?
20:21Adamantthey have
20:21Adamantdepending on the computing load, that can work
20:21amacthat would be really interesting to see the performance gain
20:21Adamantcloud vendors are also pushing out GPGPUs
20:21Adamantwhich have even more potential for performance
20:22AdamantI expect sooner or later they may let customers they vet use FPGA's cloud-style
20:22Adamantsince you don't let random yahoos upload code to a FPGA
20:23amalloyAdamant: seems to me you either make yourself safe from the FPGA in some way and let everyone have it, or you don't and then you shouldn't let anyone upload to it
20:23Adamantamalloy: it's less security than breakage
20:23amachighly coupled gpus are definitely on the way, with ati+amd and nvidia+intel
20:23amalloyAdamant: even good guys break stuff accidentally
20:23amaccoupled to cpus that is
20:24amalloyif that's a concern you shouldn't let anyone have it
20:24Adamantamalloy: absolutely, but the business wants to reduce it's risk
20:24Adamantamalloy: if they can cover the cost of breakage and make a profit, it makes sense for them to do
20:24amalloyfair enough
20:25Adamantif vetting customers lets them meaningfully reduce the chance of breakage, then they'll do tha
20:25Adamantt
20:25Adamantyou may be right though
20:25Adamantit may not be enough
20:36TimMcYou can break an FPGA?
23:45amalloy(if-let [a b] x y z) is clearly incorrect code, but the compiler could give a better warning message: it complains that if-let requires a vector for its binding