#clojure log - Mar 07 2011

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

2:24 amalloy: do 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?

2:25 eg, (my-sorted-map-by (memfn length) "test" 1 "sample" 2) would get a map sorted by length of key

2:32 hiredman: length? really?

2:33 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L510

2:33 amalloy: hiredman: i actually do have a case where length would be useful, but it's just an example

2:33 oh

2:33 hah

2:33 fine fine, count

2:34 hiredman: - as the comparator?

2:34 - is a function, just compose it into the comparator

2:35 amalloy: hiredman: 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

2:35 (fn [a b] (- (somefn a) (somefn b)))

2:36 hiredman: (comp *1 make-it-an-int)

2:36 amalloy: everything there but somefn is pretty generic and i wouldn't be surprised if someone had written this already

2:36 hiredman: (partial (fn [somefn a b] (- (somefn a) (somefn b))) count)

2:37 also, whoever keeps using alength, knock it off

2:38 tufflax: What exactly does 'resolve' mean here: "For Symbols, syntax-quote resolves the symbol in the current context, yielding a fully-qualified symbol."?

2:38 amalloy: ,(resolve 'inc)

2:38 clojurebot: #'clojure.core/inc

2:39 hiredman: amalloy: no

2:39 amalloy: no?

2:39 hiredman: tufflax: it means that syntax qoute replaces the symbol with a new namespace qualified symbol, taking the namespace part from the current namespace

2:40 amalloy: that is symbol to var resolution, not the same thing

2:40 amalloy: `[inc not-existent]

2:40 ,`[inc not-existent]

2:40 clojurebot: [clojure.core/inc sandbox/not-existent]

2:40 hiredman: the symbol -> namespace qualified symbol thing happens at read time when a syntax-quoted form is read

2:40 tufflax: Ok. Thank you!

2:40 amalloy: hiredman: 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

2:41 makes it sound as if `inc would resolve to 'sandbox/inc

2:41 raek: tufflax: the symbol will become a fully qualified one, taking in account the use, use :rename and require :as for the current namespace

2:41 hiredman: amalloy: fine

2:41 I am kind of surprised that syntax quoting isn't a macro yet

2:42 having the reader do it is kind of yetch

2:43 ,(doc ns-map)

2:43 clojurebot: "([ns]); Returns a map of all the mappings for the namespace."

2:43 raek: (ns my-ns (:use [foo.a :only [x]] [foo.baz :only [y] :rename {y z}]) (:require [foo.c :as f]))

2:43 `(x z f/w) --> (foo.a/x foo.baz/y foo.c/w)

2:45 hiredman: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L718 yetch

2:46 https://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj#L367

2:48 http://www.thelastcitadel.com/images/syntax.png trying to figure out flow control for syntax reader

2:50 amalloy: nice. looks perfectly clear to me

2:50 hiredman: java is structured programming, I swear

2:56 amalloy: hiredman: what tool does that control-flow graph?

2:56 (if you drew it yourself, please just lie)

2:58 hiredman: well, I did it with dot

2:59 * raek <3 dot

3:00 raek: it made my life much more bearable when I ported some assembly code into C

3:02 when I look at this control flow graph, I know Dijkstra was right about structured programming: http://raek.se/graphs/start.png

3:06 companion_cube: is this the output of a compiler ?

3:11 khaliG: hm so is there a trick to getting useful information out of a restart screen in slime or is this still being improved?

3:11 it always says "No Locals" on the backtrace

3:16 raek: khaliG: 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

3:16 khaliG: but in general, no. I think this is because when you receive the exception, the stack has already unwinded and the locals are gone

3:17 khaliG: damn ok :/

3:17 debugging is kinda primitive then, back to stone age prints

3:17 raek: (I think this is being thought upon by the core clojure guys. there is certainly an interest in having these features=

3:18 khaliG: raek, glad to hear! :)

3:18 hiredman: I think it would require reified environments, which would be very hard

3:18 khaliG: i dont mind using prints but not when working with maps where you print out possibly too much info

3:18 hiredman: you can go at it from the java side using a java debugger or cdt

3:19 http://georgejahad.com/clojure/cdt.html

3:19 khaliG: maps/vectors/collections

3:19 hiredman, that looks promising, thanks

4:26 rangen: enclojure 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?

4:30 uups, wrong channel

4:31 oh well, nobody in #enclojure

4:42 ok, 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:10 bennylu: defining exception using deftype - can i add constractor that takes message?

10:39 fogus`: Joy of Clojure is at the printers!

10:40 TimMc: fogus`: \o/

10:40 Congratulations.

10:40 raek: yay!

10:40 fliebel: fogus`: Yay!

10:40 amac: fogus`: when does it launch?

10:42 fogus`: amac: Sometime Mid-late-March

10:42 amac: nice

10:42 fogus`: More information here: http://blog.fogus.me/2011/03/07/the-joy-of-the-joy-of-clojure/

10:42 TimMc: sweet

10:45 amac: the print book on amazon is cheaper than the manning ebook :(

10:46 fogus`: Weird.

10:46 pdk: (let [x (atom 1) y x] (print "x:" x "y:" y) (swap! y inc) (print "x:" x "y:" y))

10:46 ,(let [x (atom 1) y x] (print "x:" x "y:" y) (swap! y inc) (print "x:" x "y:" y))

10:46 clojurebot: x: #<Atom@1832397: 1> y: #<Atom@1832397: 1>x: #<Atom@1832397: 2> y: #<Atom@1832397: 2>

10:47 fogus`: I believe if you buy the print book then the ebook comes for free... that's what the cover says anyway

10:47 amac: ^^^

10:47 pdk: you have to buy it through manning to get early access + the ebook deal

10:47 it's 20 bucks after the promotional discount on manning anyway

10:48 fogus`: Even better

10:48 amac: where is it 20$?

10:49 for me it says 35$ for ebook, 45$ for book+ebook

10:50 regardless, I'll buy it - I'm just extremely cheap

10:50 also broke

10:52 semperos: users of cake: is there a "preferred" version of Ruby? any issues using 1.9.1?

10:53 joly: Congrats on the JoC printing! I'm looking forward to receiving my copy.

10:54 fogus`: joly: That makes two of us. ;-)

11:00 pyr: hi guys

11:01 for a future ftr

11:01 (.get ftr timeout TimeUnit/MILLISECONDS) waits for a timeout

11:01 is there a way to wait on multiple futures at once ?

11:03 it seems raek's blog post covers it, ignore me

11:07 cemerick: congrats, fogus` and chouser_ :-)

11:07 fogus`: cemerick: Thank you sir

11:10 jwr7: How do I import a Java enum that has a dot (period) in the name?

11:10 pdk: try replacing the dot with /

11:10 jwr7: I'm trying to use imgscalr (http://www.thebuzzmedia.com/downloads/software/imgscalr/javadoc/index.html) and it has a class called Scalr.Method

11:16 Ahh, got it — (:import (com.thebuzzmedia.imgscalr Scalr Scalr$Method))

11:51 waxrose: Good morning/afternoon/evening every one

11:53 semperos: howdy

12:12 fogus`: Anyone care to spread some love? :-) http://news.ycombinator.com/item?id=2297669

12:14 pd: fogus`: ha, are you taking writing tips from david foster wallace or what?

12:14 the bulk of your content is in the footnotes

12:15 fogus`: pd: The explanation for that can be found... in one of the footnotes. ;-)

12:15 pd: =)

12:22 waxrose: I'm ready for that book to come out!

12:22 hiredman: fogus`: perhaps you could persuade manning to use bigints to index footnotes, then you could have has many as you like

12:24 fogus`: hiredman: Nah... we only needed a short int.... errr... unsigned.

12:24 waxrose: fogus`, You are the author?

12:25 jkdufair: fogus`: congrats. i like #9

12:26 fogus`: waxrose: co-author

12:27 waxrose: fogus`, 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:29 jkdufair, I agree.

12:30 Great footnotes. lol

12:32 jwr7: fogus: congratulations I've been obsessively checking the manning site for updates recently...

12:32 fogus`: jkdufair: #9 makes it clear how much I've avoided doing because of this dumb book. :-O

12:33 waxrose: I'm sure it's not a dumb book. :D

12:53 amalloy: semperos: 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:53 and if you're on windows i think you have to use 1.8.x

13:16 semperos: amalloy: thanks for that; I'm on a Windows work machine, so I suppose it's 1.8

13:17 amalloy: $google cake windows ruby version

13:17 sexpbot: First out of 81400 results is: Issues - ninjudd/cake - GitHub

13:17 https://github.com/ninjudd/cake/issues/45/find

13:17 amalloy: hm. not the issue i was hoping to find

13:17 semperos: definitely did some googling, but didn't find anything definitive

13:18 I 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:30 raek: pyr: also check out CompletionService ( http://download.oracle.com/javase/6/docs/api/java/util/concurrent/CompletionService.html )

13:31 pyr: it allows you to wait for multiple futures to finish (even if you don't submit all of them at once)

13:34 pyr: raek: thx!

13:46 semperos: trying to use cake (on Windows), my Java install doesn't have a "server" vm, only client; how do I get the server version?

13:47 (cake keeps looking for jre6/bin/server/jvm.dll)

13:51 spewn: semperos: The server one comes with the JDK, but not the JRE. http://www.oracle.com/technetwork/java/javase/jrereadme-182762.html

13:52 semperos: yeah, just re-found it in my jdk install, thanks

13:55 khaliG: i'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:56 oh, i think i got it

13:56 amalloy: (def my-fn (memoize (fn [] ...)))

13:57 semperos: there's also clojure.contrib.def/defn-memo

13:57 amalloy: there's also a defm somewhere in contrib

13:57 or i guess it's called defn-memo, apparently?

14:00 khaliG: ok that's confusing :/

14:01 amalloy: khaliG: what is?

14:02 (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:02 khaliG: this is what i've tried so far, (defn my-fn [] (let [f (fn [] ...)] (memoize f) (f))

14:02 right that's where i'm stuck

14:02 amalloy: *boggle*

14:02 khaliG: so i have to use the macros then?

14:02 amalloy: seriously it is as simple as (def my-fn (memoize (fn [] ...)))

14:02 no other nonsense is needed

14:03 khaliG: oh DEF

14:03 i misread as defn, let me try that

14:04 amalloy, thanks that's easy and it works :)

14:04 jweiss: khaliG: also you should realize that clojure is immutable by default.

14:05 (memoize f) returns a new function and leaves your original argument f untouched.

14:05 khaliG: understood

14:08 amac: is there a performance benefit to putting :use/:require in the ns form, or separately as (use ...) (require ...)?

14:08 or is it strictly style

14:10 amalloy: amac: 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:13 hiredman: amac: put it in the ns form

14:24 amalloy: yeah, that's probably a better answer than mine. if you're seriously trying to squeeze performance out by *moving your imports*, consider suicide

14:33 mattmitchell: I can't seem to get this trivial multi-method code to work: https://gist.github.com/859053

14:33 anyone see what i'm doing wrong?

14:34 i get this error: java.lang.IllegalArgumentException: No method in multimethod 'select-ux' for dispatch value: hello

14:38 amalloy: mattmitchell: your code is fine; you're being tripped up by the def-once semantics of defmulti dispatch functions

14:38 ie, if you (defmulti foo bar) and then later (defmulti foo baz), the dispatch function is still bar

14:38 to rework multimethods in this way, you have a few options, but the simplest is restarting the repl

14:38 mattmitchell: oh! so i'm re-executing my changes by using (load "my-file.clj")

14:39 amalloy: restarting the repl aye. ok. what are the other ways?

14:39 amalloy: next-simplest is probably (ns-unmap *ns* 'select-ux)

14:39 mattmitchell: amalloy: right on that worked :)

14:39 khaliG: amalloy, 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:40 mattmitchell: amalloy: thank you

14:40 amalloy: the other one i can think of is (defn dispatch [obj] ...) (defmulti select-ux #'dispatch)

14:40 then if you redefine the "dispatch" function the var will have a new value and select-ux should use that

14:41 khaliG: you're looking for a way to purge the memoization cache?

14:42 khaliG: amalloy, yes

14:42 well i want the effect of evaluating the def again

14:42 amalloy: in a side-effect-y way that affects everyone using the globally-def'ed function? that seems gross

14:42 pdk: http://www.paullegato.com/blog/memoize-reset-clojure/ perhaps?

14:42 the stock memoize, defn-memo etc keep all the memoized values around forever

14:43 khaliG: oh i see

14:43 amalloy: the simplest way is to wrap the memoization up in a defn

14:43 khaliG: well maybe i dont even need a reset, if i try hard

14:43 amalloy: (defn cached-myfn [] (memoize (fn [x] ...)))

14:43 then whenever someone wants a new cache they can call (cached-myfn) to get a new version

14:44 and track that object themselves to keep the cache around as long as they want

14:44 khaliG: hmm

14:44 no i think i'll just avoid reset. i only needed it for initial testing now that i think about it

14:50 amalloy: argh, 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:56 patrkris: does 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:57 amalloy: patrkris: pretty sure it defaults to utf-8. what issue are you having?

14:58 patrkris: amalloy: sending an e-mail from a clojure program garbles non-english characters

14:58 and (System/getProperty "file.encoding") returns "MacRoman"

14:59 strange... just tested by running `lein repl` and now (System/getProperty "file.encoding") returns UTF-8... the error occurs when running `lein ngserver`

15:03 ok, now it works as per the instructions here: http://mathias-biilmann.net/2009/3/clojure-repl-and-utf-8

15:03 TimMc: I'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:07 waxrose: TimMc, I'm going to Clojure Conj for sure now.

15:07 TimMc: Yay!

15:07 waxrose: :D

15:08 TimMc, Is brain on fire your blog?

15:09 __name__: What blog engines do you guys use?

15:09 I am looking for a good restructured text blog.

15:09 fliebel: __name__: Wordpress :(

15:09 I don;t think there is anything written in Clojure that can compete.

15:10 waxrose: __name__, I used this site to set up my blog on Google App Engine --> http://compojureongae.posterous.com/?page=3

15:11 To help*...

15:11 TimMc: waxrose: Yup.

15:12 __name__: Are there libs for rst for the JVM?

15:13 waxrose: TimMc, Nice information on there. Do you have a twitter by any chance?

15:13 I need to finish setting up my blog this week.

15:30 amalloy: __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:30 scottj: uploaded 8 more screencasts, 2 about Clojure, please upvote at http://news.ycombinator.com/item?id=2298525 if you like them

15:31 drobati: Hi, I was wondering if I should preorder "The Joy of Clojure" or is there a better book?

15:34 waxrose: drobati, 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:35 drobati: Its affordable off amazon (with prime). And so far I've enjoyed the first chapter.

15:35 waxrose: I pre-ordered mine already. :)

15:35 drobati: Figured I'd get the communities opinion before I ordered it.

15:35 Yea, I think I'll buy it.

15:36 waxrose: The co-author was in here earlier.

15:36 amalloy: waxrose: fogus and chouser are both in here all the time, one way or another

15:36 at the moment they're both away, but leave a message and they'll get back to you

15:36 drobati: Yea I saw fogus` go away right after I asked the question. :P

15:37 amalloy: drobati: haha, so he did. i guess he's hiding from the paparazzi

15:37 waxrose: amalloy, Thanks for the heads up. I'll probably be around every day now to notice that next time haha.

15:37 drobati: Yea amazon lists 26.40 for me.

15:38 I'm a student on a budget and amazon prime makes it a steal!

15:38 waxrose: drobati, I work part time at B&N, so I'll just use my discount for it.

15:38 drobati: Ah.

15:39 I was thinking about picking up a copy of Let over Lambda too.

15:39 waxrose: I was debating on skipping that one for now.

15:40 Too many good books to dissect. >.<

15:40 drobati: A friend of mine owns it, but I love lisp so much I figured I should own my own copy.

15:41 Does "The Joy of Clojure" cover lien and slime?

15:41 lein*

15:42 I've set up and used both successfully but I want more in-depth guidance.

15:42 scottj: drobati: have you checked out http://youtube.com/emailataskcom ?

15:42 I cover slime quite a bit

15:42 drobati: I believe you linked that to me previously.

15:42 brehaut: drobati: lein is mentioned once

15:42 drobati: A couple weeks back.

15:42 :P

15:42 brehaut: and slime not at all

15:43 drobati: brehaut: thanks

15:43 waxrose: scottj, Thanks for the link. :P

15:43 brehaut: drobati: thats based on searching copy of the MEAP i have; dunno about the final book

15:44 amalloy: drobati, 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:44 drobati: I saw the source uses lein.

15:45 I mean I need no help with lein, just more a workflow.

15:45 amalloy: thanks for the heads up

15:46 waxrose: amalloy, I actually have a copy of On Lisp in ebook form. Just havn't started reading it yet. :P

15:47 scottj: on 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:48 drobati: I need to do that.

15:48 waxrose: drobati, same

15:48 drobati: Anyone like The Little Schemer?

15:48 waxrose: I have that in ebook as well, and havn't started reading it also. haha

15:49 drobati: Its a easy book to read but the later chapters do require some analysis.

15:50 waxrose: I'm still dealing with SICP. I think I've read it 3 or 4 times already.

15:50 dnolen: drobati: yes, and The Seasoned Schemer, The Reasoned Schemer as well.

15:50 drobati: I haven't gotten a chance to read them.

15:51 When I start making more money I am definately going to buy them.

15:52 waxrose: I'm sure you can find them in ebook form for cheap.

15:52 drobati: I don't like ebooks for programming books.

15:52 waxrose: same, but they sure are portable. :D

15:52 drobati: Yea.

15:53 waxrose: I usually just keep classics in physical form and everything else in ebook.

15:53 drobati: I have a kindle that I love reading on.

15:54 But I absolutely hate programming books in digital formats.

15:54 I suppose its cause I like to leave notes in the books.

15:55 raek: drobati: 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:57 waxrose: drobati, Oh you actually write in your books?

15:57 drobati: No

15:58 stickies

15:58 waxrose: oh okay

15:58 drobati: :P

15:58 They are like precious pieces of gold. I wouldn't deface them like that.

15:58 waxrose: I was about to say, "How dare you write on the pages of SICP!!"

15:58 lol

15:58 drobati: :P

15:59 jfields: when 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:59 waxrose: I'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:59 paper*

16:01 drobati: waxrose: org-mode

16:01 <3 org-mode

16:01 But you'

16:01 re right*

16:01 amalloy: jfields: blurg. varargs in java are kinda gross to begin with. just make it take a Collection<Foo> instead of Foo...

16:01 waxrose: I've looked at it some what. I need to check it out again.

16:02 drobati: Well I use Emacs like an OS.

16:02 So Org-mode makes todo, notes, agendas, ect awesome.

16:03 amalloy: at the bytecode level varargs are just syntactic sugar for arrays

16:03 jfields: amalloy, that's true

16:03 waxrose: drobati, I just got done building Emacs 24 from source. :P

16:03 raek: jfields: 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:03 scottj: waxrose: http://jaderholm.com/screencasts/org-mode/ :)

16:04 jfields: but, calling a method foo(1, "hi", "blah") is much better than foo(asList(1, "hi", "blah"))

16:04 waxrose: scottj, You are starting to be my source friend. :D

16:06 bawr: I 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:07 amalloy: bawr: an atom around the vector?

16:08 bawr: Ah, right. Goes to show how much I know about non-trivial Clojure. :)

16:10 naeu: chouser_: congrats on getting the book to the printers

16:11 khaliG: bawr, 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:11 (there may be better ways to do it, im a newbie too)

16:12 mattmitchell: anyone know of a good library for constructing url query strings out of hash-maps/vectors?

16:12 (to-query {:id 1 :mode true}) => "id=1&mode=true" etc.

16:12 amalloy: mattmitchell: for constructing them? that's a lot easier than parsing them

16:13 mattmitchell: amalloy: for constructing yes

16:13 amalloy: i guess it's probably easy enough to just write one!

16:13 amalloy: (defn to-query [m] (clojure.string/join "&" (for [[k v] m] (str k "=" v))))

16:13 is my rough draft

16:14 &(require 'clojure.string)

16:14 sexpbot: ⟹ nil

16:14 amalloy: &(let [to-query (fn [m] (clojure.string/join "&" (for [[k v] m] (str (name k) "=" v))))] (to-query {:id 1 :mode true})

16:14 sexpbot: java.lang.Exception: EOF while reading

16:14 amalloy: &(let [to-query (fn [m] (clojure.string/join "&" (for [[k v] m] (str (name k) "=" v))))] (to-query {:id 1 :mode true}))

16:14 sexpbot: ⟹ "id=1&mode=true"

16:15 raek: for url-enconding the contents: http://clojuredocs.org/ring/ring.util.codec/url-encode

16:15 waxrose: scode_, Thanks a lot. That is another great link.

16:15 opps

16:15 amalloy: good point raek

16:17 a thought: would people see it as a feature or a bug if sexpbot automatically balanced any missing close-braces in an eval request?

16:19 bawr: khaliG: Ooh, right. Even better. :)

16:23 spewn: amalloy: 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:24 amalloy: spewn: yeah, clearly those are the competing concerns. you're being asked to vote :)

16:25 bobo_: amalloy: if it states that it added braces i think its ok.

16:25 amalloy: i bet i could get the best of both by making him do something like:

16:25 /msg sexpbot say #clojure ⟹ "id=1&mode=true" ; WARNING repairing malformed code snippet

16:25 hm. apparently that /msg didn't work

16:26 bawr: I 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:26 raek: if the bot tells you in what way it repaired the expression, I guess it's ok

16:26 amalloy: raek: in what way?

16:26 raek: also, where should the missing paren be inserted? always at the end?

16:28 bawr: Where 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:28 (Full disclosure - I'm one of those lazy people mostly.)

16:28 amalloy: bawr: (let [x [1] (inc x))

16:29 couldn't fix that by adding to the end

16:29 er, i guess you could

16:29 bawr: amalloy: And you would want to fix it?

16:29 amalloy: (let [x 1) (inc x))

16:30 bawr: I kind of assumed you meant straight-up matching at the end.

16:30 amalloy: i'd leave that alone, but it's another place you could try to fix

16:31 bawr: I 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:37 dnolen: Nice, V8 JS has Object.freeze. Yet another reason for Clojure -> JS.

16:38 drobati: waxrose: I've been using 24 on my other computers.

16:38 brehaut: dnolen: any implementation of JS that has web workers needs that i think

16:39 drobati: This computer (windows) is due for an update but I only use windows at work for compatability.

16:40 dnolen: brehaut: No. Web Workers communicate via strings.

16:40 brehaut: dnolen: they did, i was under the impression that changed

16:41 dnolen: brehaut: ah, you're probably right, I haven't followed web workers too closely since I first looked at them.

16:45 brehaut: dnolen: sadly i cant find anything to back myself up

16:53 semperos: brehaut: thank you for writing necessary-evil, just got to use it for the first time, real time-saver

16:53 brehaut: semperos: your welcome

16:53 semperos: im planning to get 1.1 done shortly (got a work project to finish first), which includes improved fault handling

16:54 semperos: I'll keep an eye out for it

16:54 brehaut: cool :)

17:20 khaliG: is 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:31 pyr: well it seems futures inside futures end up causing problems and blocking too :(

17:31 brehaut: pyr it should only be a problem if there is a cycle?

17:32 pyr: how do you mean a cycle ?

17:33 raek: pyr: do you have a fixed size thread pool?

17:33 pyr: i don't think so

17:34 brehaut: pyr 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:34 pyr: nope i don't have that

17:34 i have a future A which must run in n seconds

17:35 which spawns 5 futures B, B', B'' ... which must themselves complete within some amount of time

17:35 raek: as 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:35 pyr: 'k, i'm creating the tasks with future

17:36 raek: (with task I here meant the function / expression that should be executed in some thread)

17:37 (a future is the "ticket" you get when it is submitted to an executor)

17:37 pyr: i got you first comment

17:37 raek: and, obviously, it is also the name of a macro in clojure.core

17:38 pyr: i was reffering to the macro

17:38 raek: which was maybe what you referred to before I complicated the matter... :)

17:38 pyr: :)

17:39 nope and reading your blog post

17:39 raek: clojure.core/future uses a cached thread pool (non-fixed), so that shouldn't be a problem in this case

17:39 pyr: yep

17:40 of course under the hood there's AMQP calls

17:40 which might trigger a weird behavior

17:44 I'll get it, eventually

18:00 ieure: Is visualvm the best way to debug Java heap OOM issues, or is there some other tool I should look at?

18:02 pyr: meh, that was a stupid mistake, behavior is as expected

18:10 khaliG: hm i give up. i think the java example is incomplete. it doesn't seem to retrieve a url to the uploaded pic

18:43 ieure: Is 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:43 If not, I guess I’m writing a new compilation-derived mode to make that happen.

18:45 amac: ieure: I always use lein, let me know if you find a shortcut from within emacs

18:57 ieure: amac, In the shell, you mean?

18:58 I 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:58 *like

18:58 amac: ieure: yeah

19:00 amalloy: ieure: are you talking about M-n and M-p? those go to next/prev error when compiling

19:01 amac: nah, he's looking for project build shortcuts

19:01 a la 'lein uberjar'

19:01 ieure: amalloy, C-x `

19:01 Well, kind of.

19:01 Like I said, I know I can compile one _file_ with SLIME.

19:02 But I want to compile my whole project.

19:14 thx: clojure dash E doesn't work? https://gist.github.com/859565

19:17 amac: java -jar clojure-1.2.0.jar -e "(+ 2 2)"

19:17 something gives with your clj script

19:17 that works for me

19:18 amalloy: amac: too slow. you needed to answer in 2.5 minutes to be considered for the honor of solving his problem

19:19 amac: I will never close this window again. Ever.

19:21 Ptival: From clojure.contrib.logging "Logging levels are specified by clojure keywords [...]", but it doesn't tell me /how/ or /where/ I should specify this...

19:23 lancepantz: Ptival: what are you trying to do? i just joined?

19:24 Ptival: Just using cloj.contrib.logging, but right now my logs don't show, I believe because I never set the log-level

19:24 I think I found some help here: http://www.paullegato.com/blog/setting-clojure-log-level/

19:25 I don't get why the API doesn't allow to set the level while it uses it...

19:25 TimMc: That's kind of terrible.

19:26 amalloy: amac: 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:27 TimMc: amalloy: Maybe.

19:27 lancepantz: Ptival: there are info, debug, and a few other macros in cc.logging that i use

19:28 Ptival: (info "foo")

19:28 amac: amalloy: that would not be surprising, that dude had grief.

19:28 Ptival: yes that's what I use too (in my case)

19:29 amalloy: Ptival: 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:29 Ptival: lancepantz: 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:30 amalloy: thanks

19:30 TimMc: They're both "Andrew", and both trying to use clj directly.

19:30 amalloy: TimMc: profile picture is what tipped me off

19:31 TimMc: I see it, but I don't learn anything from it.

19:31 (just like Andrew)

19:31 amac: hahaha

19:32 brehaut: just a note: not all andrew's are incompetent

19:41 Ptival: hum...

19:41 waxrose: hmm

19:48 TimMc: waxrose: I'm back!

19:48 waxrose: TimMc, Welcome back!

19:48 TimMc: Internet connection died about 5 seconds after I answered you.

19:48 waxrose: lol

19:48 TimMc: And nope, don't have a Twitter.

19:48 waxrose: Oh okay, what about a github?

19:49 TimMc: I do! timmc@github

19:49 One app in active development, the HW3 thing.

19:49 waxrose: cool cool I'll follow you! I have some thing in mine you might want to play with, clone of the Lisp Machine

19:49 TimMc: The Genera thing?

19:50 waxrose: Yeah

19:50 I have the cadr emulator and then the open genera 2.0 in my repo

19:52 Ptival: user=> (impl-get-log "")

19:52 #<RootLogger java.util.logging.LogManager$RootLogger@8429c19>

19:52 shouldn't I be able to call LogManager methods on this?

19:52 TimMc: OK, I see you.

19:52 waxrose: :D

19:55 I need to find a DEC Alpha. :/

20:01 amalloy: Ptival: i don't think so

20:01 that's necessarily, anyway

20:02 it's not a LogManager object; it's a RootLogger object embedded inside of a LogManager

20:03 Ptival: ok

20:07 TimMc: waxrose: I might be able to dig one up for you in the area. :-P

20:08 I saw a real Lisp Machine at MIT!

20:08 waxrose: oh wow lol

20:08 TimMc: The MIT Museum is pretty cool.

20:08 waxrose: Well, I shouldn't be surprised. But I still am!

20:08 TimMc: But I think I also saw one at the Stata center in the CSAIL area.

20:09 waxrose: I forgot why the Lisp machines died out.

20:09 Adamant: RISC was good enough and cheaper

20:10 basically

20:10 thanks to better compilation techniques via using lots of registers

20:11 you couldn't have Lisp Machine grade elegance that easily, at least without buying Genera, but you could have it's speed

20:11 TimMc: I've heard some mumblings about mismanagement and poor marketing, but I really have no idea.

20:12 waxrose: shame

20:13 Adamant, Thanks for elaborating.

20:13 At least it's fun to still run the emulator at least. Blast to the past.

20:13 amac: I love that line from Hackers "RISC is going to change everything"... no it didn't

20:14 waxrose: lol

20:14 Adamant: TimMc: 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:14 waxrose: I havn't seen that movie in a while, I should go watch it tonight.

20:14 Adamant: it did

20:14 amac: I love that movie :)

20:14 Adamant: your x86-64 ISA is basically a frontend for a RISC processor

20:15 under the hood

20:15 pure RISC didn't win, but pure CISC did lose

20:15 amac: true

20:15 CISC got slightly simpler, but not anywhere near to the RISC set

20:15 waxrose: It is funny how fighting always destroys a project rather than the project itself.

20:16 Adamant: TimMc: also Lisp Machines were oversold to business and got nuked hard by the AI winter

20:16 which was a result of AI being oversold

20:17 waxrose: Do you think the Lisp machine may ever make a come back?

20:17 amac: unlikely

20:17 Adamant: probably not, but "general-purpose" processors may have better hardware support for some language paradigms

20:18 many 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:18 amac: although 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:19 waxrose: hmm

20:19 Adamant: amac: ARM's in theory have specialize support instructions for Java via Jazelle

20:19 it doesn't do full JVM, but it accelerates several JVM functions

20:20 about 50-60% can be done in hardware

20:20 amac: hmm, that's interesting

20:20 Adamant: getting access to that for mere mortals is supposedly not easy, though

20:20 for cloud vendors, there's not a lot of upside to being language specific

20:20 amac: aren't they starting to push out blade servers packed with low power arm chips?

20:21 Adamant: they have

20:21 depending on the computing load, that can work

20:21 amac: that would be really interesting to see the performance gain

20:21 Adamant: cloud vendors are also pushing out GPGPUs

20:21 which have even more potential for performance

20:22 I expect sooner or later they may let customers they vet use FPGA's cloud-style

20:22 since you don't let random yahoos upload code to a FPGA

20:23 amalloy: Adamant: 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:23 Adamant: amalloy: it's less security than breakage

20:23 amac: highly coupled gpus are definitely on the way, with ati+amd and nvidia+intel

20:23 amalloy: Adamant: even good guys break stuff accidentally

20:23 amac: coupled to cpus that is

20:24 amalloy: if that's a concern you shouldn't let anyone have it

20:24 Adamant: amalloy: absolutely, but the business wants to reduce it's risk

20:24 amalloy: if they can cover the cost of breakage and make a profit, it makes sense for them to do

20:24 amalloy: fair enough

20:25 Adamant: if vetting customers lets them meaningfully reduce the chance of breakage, then they'll do tha

20:25 t

20:25 you may be right though

20:25 it may not be enough

20:36 TimMc: You can break an FPGA?

23:45 amalloy: (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

Logging service provided by n01se.net