#clojure logs

2010-05-23

00:00scgilardia mouse crossed technomancy's path once... once.
00:11johnmn3looking at Lau B. Jensen's prototurtle blog entry (http://bestinclass.dk/index.clj/2010/04/prototurtle-the-tale-of-the-bleeding-turtle.html), I noticed the example of defrecord has no default implementation. Just a signature. He could have built the protocol first and built the defrecord with an implementation, right?
00:14_na_ka_na_Hi all
00:15_na_ka_na_Any one answer http://groups.google.com/group/clojure/browse_thread/thread/ea39801f8e907640 ?
00:31johnmn3_na_ka_na_: sorry, I don't know about that
00:31_na_ka_na_johnmn3: thx for looking anyway
00:34johnmn3is reify, deftype, or defrecord preferred over proxy now?
00:36technomancyjohnmn3: reify replaces most uses of proxy
00:37johnmn3clojure.org/datatypes: "reify is preferable to proxy in all cases where its constraints are not prohibitive."
00:37johnmn3bah, thanks technomancy
00:38johnmn3that page also says: "mutability should be the default
00:38johnmn3and is the only option for records"
00:39johnmn3but lau put's gui components into defrecord... which are mutable. perhaps it means only the keys are immutable?
00:43technomancyno, records are immutable
00:49johnmn3technomancy: k, thanks
01:05johnmn3I'm trying to translate a java class to clojure. this class has fields that aren't passed to the constructor but are created in the body of the class.
01:05johnmn3they can be accessed like object.myString
01:06johnmn3the constructor for the class, though, only takes one gui component.
01:08technomancyjohnmn3: if you are just learning Clojure, I'd advise against making a gui app your first project.
01:08johnmn3is it possible for the implementation within a defrecord to generate an accessible field? or do they all have to be specified in the params to the defrecord?
01:10johnmn3yea, I hear ya, technomancy. I just really want to make this program. It's a lot of fun
01:10technomancysure, don't let me dissuade you from having fun. =)
01:10johnmn3dealing with GUIs arent.
01:12johnmn3oh, I'm thinking about this all wrong. this example I've been working with.. it starts with an abstract class, then another extends it.
01:14johnmn3rich stated not to extend concrete implementations (if I read that correctly). so this example doesn't map to clojure that way
01:15johnmn3"you cannot derive datatypes from concrete classes, only interfaces"
01:16johnmn3meaning, I won't be able to create a "default implementation" and then extend that implementation by simply adding or changing method definitions.
01:16johnmn3if I understand correctly
02:08hsuhhm, clojure.org not working
02:26johnmn3how does one refer to fields from within a record's definition?
02:26johnmn3like this:
02:26johnmn3(defrecord R [arg] P (foo [] arg))
02:26johnmn3or:
02:26johnmn3(defrecord R [arg] P (foo [] (:arg this)))
02:26johnmn3?
02:41hoeckjohnmn3: I would prefer to use the former, except when the fieldname clashes with an argument name
02:42hoeckthere is even a third possibility (least preferred, I guess): (.arg this)
02:45johnmn3hoeck: in that example "arg" is not an argument to the method.. the method is trying to refer to the value of the field. so that is allowed?
02:48hoeckof course, (.arg this) refers to the field named "arg", though it seems that it prefers to call a method "arg" if both, the method and the field exist
02:49johnmn3ok.. that makes things easier
02:51johnmn3and if one of the methods calls another method within the same type/protocol, we use the literal word "this"?? like, (.other-method this)
02:51johnmn3?
02:51hoeckno, the this is defined in the signature of the method
02:52hoeck(defrecord X [..] P (method [this, args ...] ))
02:52johnmn3well, as per Lua Jenson's prototurtle example, he put "this" in the signature of the protocol, but not the record.
02:53johnmn3http://bestinclass.dk/index.clj/2010/04/prototurtle-the-tale-of-the-bleeding-turtle.html
02:53sexpbot"Best In Class: ProtoTurtle - The tale of the bleeding turtle"
02:53hoeckyeah, there used to be a :this parameter to the defrecord some weeks ago
02:53johnmn3aaah
02:54johnmn3ok, so keep the "this" param in both the protocol and the record/datatype?
02:55hoeckthe :this parameter is gone, and each method takes the current object as the first argument
02:56johnmn3ok
02:57johnmn3so does that mean I have to do this: (defrecord R [arg] P (foo [this] (:arg this))) ??
02:57hoecknote how Lau, in extend-protocol, uses destruction on the first argument to move (the actual "this" argument)
02:57hoeckright, or (foo [_] arg)
02:58hoeckor (foo [t] (:arg t))
02:59johnmn3in your first example there.. clojure knows that arg is a field on the record?
03:00johnmn3I see what you're saying about the destructuring there
03:01hoeckyeah, because the thing is defined in a defrecord context: (defrecord X [arg] P (foo [_] arg))
03:02johnmn3cool.. thanks hoeck!
03:09danlarkinI destruct my args all the time
03:09danlarkinthey're like nooooooooo and I'm like destructttttttttt
03:09hiredmanyour args are very destructive
03:10hiredmanarg(ument)s
03:21emptist(* 10 20)
03:21clojurebot*suffusion of yellow*
03:21Fossi:D
03:21pjstadig(* 1 1)
03:21clojurebot1
03:21danlarkin,(dinc 1)
03:21clojurebotjava.lang.Exception: Unable to resolve symbol: dinc in this context
03:21danlarkinWHAT
03:21pjstadigheeh
03:22pjstadig$(dinc 1)
03:22sexpbotDENIED!
03:22danlarkinsexpbot I hate you
03:23pjstadig$learn sexpbot and danlarkin are feuding
03:23sexpbotMy memory is more powerful than M-x butterfly. I wont forget it.
03:23drewr$(println "/me huggles danlarkin")
03:23sexpbot=> /me huggles danlarkin nil
03:23pjstadig$sexpbot
03:23sexpbotCommand not found. No entiendo lo que estás diciendo.
03:23danlarkin$(System/exit 1)
03:23sexpbotDENIED!
03:24Fossiwhat the hell is M-x butterfly?
03:24danlarkin$#=(System/exit 1)
03:24sexpbotCommand not found. No entiendo lo que estás diciendo.
03:25danlarkin$(list #=(System/exit 1))
03:25sexpbotEvalReader not allowed when *read-eval* is false.
03:26Fossii doubt you can break it *that* easily
03:28danlarkinthat was ingenious!
03:28pjstadig$*clojure-version*
03:28sexpbotCommand not found. No entiendo lo que estás diciendo.
03:28danlarkin$(clojure-version)
03:28sexpbot=> "1.2.0-master-SNAPSHOT"
03:29pjstadig$System
03:29sexpbotCommand not found. No entiendo lo que estás diciendo.
03:31danlarkin$(dotimes [_ 30] (doto (Thread. #((fn this [] (try :foo (finally (this)))))) .start))
03:31sexpbotDENIED!
03:32johnmn3$(read-string '(System/exit 1))
03:32sexpbotDENIED!
03:32johnmn3$(read-string '(+ 1 1 2))
03:32sexpbotDENIED!
03:34johnmn3$(future (inc 1))
03:34sexpbotDENIED!
04:13dysingersexpbot: $(+ 1 1)
05:36johnmn3is there a clojure.contrib that auto-resolves imports?
07:17hoeckjohnmn3: what do you mean by "auto-resolving" imports
07:30angermanif I have a set of functions f1,...,f4 and a value x. How'd I construct (x, f1(x), f2(f(1(x),....,f4(f3(f2(f1(x)))))
07:30angerman?
07:33Borkdudemaybe use (indexed [f1 f2 f3 f4]), comp and use (for [r (range 4)] (range r))
07:34Borkdudehmm, don't even have to use indexed
07:35Borkdude,(for [r (range 4)] (range r))
07:35clojurebot(() (0) (0 1) (0 1 2))
07:35angermanBorkdude: hmm that's right. I'm still wondering weather or not one could just use the last value.
07:35Borkdude,(doseq [r (range 5)] (range r))
07:35clojurebotnil
07:35hoeckwild guess: (reductions #(apply %2 %1) x [f1 f2 f3 f4]) ???
07:36Borkdudehmm
07:36angermanhoeck: that sounds not too bad
07:36Borkdudehoeck: that might be it
07:37angerman,(let [f #(%+1)] (reductions #(apply %2 %1) 1 [f f f f]))
07:37clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
07:37Borkdude,(let [f #(inc %)] (reductions #(apply %2 %1) 1 [f f f f]))
07:37clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
07:38Borkdude,(let [f #(inc %)] (reductions #(%2 %1) 1 [f f f f]))
07:38clojurebot(1 2 3 4 5)
07:38hoeck,(reductions #(apply %2 %1) x [f1 f2 f3 f4])
07:38clojurebotjava.lang.Exception: Unable to resolve symbol: x in this context
07:39hoeck,(reductions #(%2 %1) 10 [inc inc inc dec])
07:39clojurebot(10 11 12 13 12)
07:39Borkdudegreat :)
07:39hoeckright, the apply was wrong
07:39BorkdudeI'll have to save this example for my Twitter account @cleotd
07:39hoeckyes, reductions is cool, and its even in core now!
07:40angermanhm.
07:40BorkdudeI already had it scheduled, but this is a nice application of it
07:41angermanHm. #(%2 %1) is #(%2 %) :D
07:42Borkdudenot much improvement in readability imho;)
07:42angerman1 char saved on twitter :D
07:42Borkdudeangerman: haha that's true
07:45Borkdudeis there a set that allows for duplicate values, otherwise called a bag in clojure?
07:46angermanWhile I did hear about that bag structure from a fellow student. I still don't really get what I'd use it for
07:46Borkdudeangerman, Euler problem 5
07:46BorkdudeI have to remember that I need thrice a factor 2
07:47Borkdudelet me explain my problem some more
07:47Borkdudethe factors of 8 are [2 2 2]
07:48Borkdudethe factors of 4 are [2 2], so if I join the common factors of 8 and 4 I have to get [2 2 2]
07:50angermanso you basically have key:count?
07:50angermanwell of factor:mulitple
07:50Borkdudeangerman: I could do it like that
07:51BorkdudeI might as well do that
07:52Borkdudeis there a simple update, instead of update-in?
07:54Borkdudecan I do: (update-in map [factor] inc), without having to check if factor is already there
07:54Borkdudeand if it's not there, it will be inserted with default value 1
07:57BorkdudeI mean like this: (defn update-or-insert [m k f d]
07:57Borkdude (if (contains? m k)
07:57Borkdude (update-in m [k] f)
07:57Borkdude (assoc m k d)))
07:57Borkdude
07:58Borkdude(update-or-insert {} 3 inc 1) => {3 1}
07:58Borkdude(update-or-insert {3 1} 3 inc 1) => {3 2}
08:00ChousukeBorkdude: you could also wrap inc so that it handles nil.
08:02hoeckBorkdude: deftype rocks for such datastructure creations
08:02hoeckBorkdude: http://gist.github.com/410875
08:06BorkdudeChousuke: ok - hoeck: tnx, will look into it later.
08:06Borkdudegtg now
08:17angermanok, just a very qick and extemely stupid reality check.
08:17angermanAssume M to be a square Matrix.
08:18angermanif \lambda v = M v. v Is eigenvector for eigenvalue \lambda, no?
08:22moshisushihello! i wanna discuss side effects.. is it up to the programmer to make sure that side effects are avoided inside of transaction?
08:23angermanme shoots himself
08:24angermanjust in case anyone is going to use decomp-eigenvalue from incanter
08:25angermandon't try to get the eigenvectors using nth on the (:vectors part of the result). Your are going to get the rows of the eigenvector matrix instead of the eigenvetors you'd want. :/
08:35hoeckmoshisushi: right, the programmer takes care
08:40Chousukemoshisushi: you can use the io! macro to mark code blocks that do IO
08:40Chousukemoshisushi: if such code is executed in a transaction, an exception is thrown
08:41angermanhmm. Clojure + JReality + Incanter is quite some fun :D
09:19angermanwhat does "no dispetch macro for: p" mean?
09:20angermanI assue it chokes on `(let [#ps (. ~ev getPointSet)
09:20angermanI though #ps was for gensym
09:21angermanahh post
09:21angermannot pre
09:51moshisushiChousuke: ah
09:51moshisushiChousuke: because quoting the "programming clojure" book: In Clojure, side effects are
09:51moshisushiexplicit and unusual. do is one way to say “side effects to follow.”
09:52moshisushibut i would say that (defn foo [] (println "hello")) is a function that returns nil, and happens to have the side effect of printing
10:02Chousukemoshisushi: right.
10:03Chousukemoshisushi: though if you want to be precise, it's not a function, it's a procedure. :)
10:04Chousukeand its return value is irrelevant.
10:05moshisushiChousuke: ugh, i'm not quite sure i understand the difference :)
10:05Chousukethe point the book tries to make I think is that side-effects should be rare and isolated, not commonplace like in imperative and object-oriented languages.
10:06moshisushiChousuke: right. i come from a Haskell background so i just have to loosen up my approach to side effects :)
10:07moshisushiin that STM, there's just no way to sneak in an io operation in a transaction
10:07Chousukemoshisushi: a procedure is something that has side-effects. a function doesn't.
10:07Chousukebut usually people just say "function" and "pure function" :P
10:08Chousukeyeah, the type system takes care of that.
10:08Chousukebut clojure doesn't have that, so the programmer has more responsibility
10:09moshisushiChousuke: well there are benefits to not having to fight a type system too.. so i guess io! is sufficient :)
10:09Chousukeyeah.
10:10moshisushiChousuke: "defn is a macro that makes defining functions a little simpler."
10:10moshisushii think the terminology is a bit messed up :)
10:10Chousukehow so? :)
10:11Chousukeyou can define functions without defn
10:11moshisushiChousuke: yeah but you just said that defn creates procedures :)
10:11moshisushior well, procedures is maybe not part of the clojure lingo at all
10:12Chousukewell yeah, *I* make the distinction sometimes but most people don't
10:13moshisushiyeah ok hehe.. so defn is pretty much def:ing an implicit lambda function?
10:13Chousukeyeah
10:13Chousukehmm
10:14ChousukeI think clojurebot will complain to me if I try to demonstrate it
10:14Chousuke$(macroexpand '(defn foo [x] 1))
10:14Chousukehm, what happened to sexpbot's evaluator :P
10:14moshisushiChousuke: just paste it and i'll try for myself in emacs
10:15Chousukemoshisushi: well, try the above.
10:15moshisushiuser> (macroexpand '(defn foo [x] 1))
10:15moshisushi(def foo (clojure.core/fn ([x] 1)))
10:15Chousukemacroexpand is useful :)
10:15moshisushiyeah, a fn
10:15ChousukeC-c C-m does macroexpand in emacs I think
10:15Chousukehm
10:16moshisushiChousuke: yeah it does
10:16moshisushimuch cleaner too
10:17moshisushii.e, no unnecessary namespace stuff, it looks
10:17Chousukedid it expand to fn*?
10:17moshisushi(def foo (fn ([x] 1)))
10:18moshisushithat's the expansion with SLIME Macroexpansion
10:18Chousukehmm, I guess you have the pretty-printer working then
10:18moshisushiChousuke: probably.. i have a pre-packaged thing called Clojure Box
10:18moshisushiemacs+slime+whatnot
10:19ChousukeI wonder if there is a way to turn off pretty-printing for the macroexpand. sometimes it matters :)
10:19Chousukewell, the namespace-dequalification anyway
10:20Chousukesometimes you might want to generate code from a macro that explicitly does not have qualified symbols and that makes it hard to tell if you've succeeded or not
10:20moshisushiChousuke: if i use (macroexpand 'myfun) i don't get prettyprinting
10:20ChousukeI suppose that's good enough.
10:21moshisushiunless there's something in (def foo (clojure.core/fn ([x] 1))) that's also prettyprinted
12:32chouserI just added a var to my repl config so I can (set! *pprint* false) when necessary
12:49programblehm...
12:50kotaraksososososo
12:54chouserVC?
12:54chouseroh, sorry
13:00kotarakchouser: yeah, it's not perfect. But it has some nice things under its belt. :)
13:39replacamoshisushi: yeh, prettyprint is built into slime, but not included in the regular macroexpand
13:57moshisushireplaca: i see! thnx
14:12OForerohi
14:13OForeroI am wondering if there is any command that can reset a REPL (connected through Swank)
14:14OForeroinstead of having to stop and start it
14:38Borkdudehow do I create a sorted-map from a map?
14:39BorkdudeI have a function (factors), that takes a number and keeps a map of the factors found so far... is it better to use a sorted-map to begin with? I only need to have the end result sorted
14:40kotarakBorkdude: (into (sorted-map) the-map)
14:47Borkdudekotarak: do I have to return a sorted-map everywhere in the factors fun, or there a more clever way to do it?
14:47Borkdudehttp://gist.github.com/411154
14:47BorkdudeI could use an inner fn and then sort its return val
14:48kotarak(doc fnil)
14:48clojurebotI don't understand.
14:48kotarakpff
14:52kotarakBorkdude: well you can use a sorted-map to begin with.
14:52kotarakBorkdude: but don't ask me, what is better
14:53Borkdudekotarak: ah well, I only have to replace {} with (sorted-map)
14:53Borkdudenot too bad
14:59Borkdudeif you try this code: (doseq [in (repeatedly #(read-line)) :while in] (print in))
14:59Borkdudeis there any way to get out of this?
15:00kotarakno
15:01kotarakBorkdude: you can do (let [stop? (atom false)] (doseq [in (repeatedly #(read-line)) :while (and in (not @stop?))] (print in)))
15:01kotarakBorkdude: and reset! stop? to true from some other thread
15:15Borkdudekotarak: yes, tnx
15:27Borkdudebtw, I don't know why, but if I begin a line with ; in clojure-mode, type and press enter, the line gets indented 40 positions
15:43OForerolein help is failing with this message
15:43OForerohttp://paste.pocoo.org/show/217486/
15:43OForeroany idea of what could be broken_
15:43angermanhow do I join two lists?
15:50angermanhmm. ok. I had reduce and cons mixed up :/
15:53Raynes$(concat [1 2 3] [4 5 6])
15:53sexpbot=> (1 2 3 4 5 6)
15:53angerman$(concat '(1 2 3) '(4 5 6))
15:53sexpbot=> (1 2 3 4 5 6)
15:53angermanaye
16:04pedroteixeiraanyone knows how to call something like (apply new Class [arg1 arg2])
16:04pedroteixeira?
16:08pedroteixeirais "new" a normal function or macro, or is it a special reader macro?
16:10Raynes(doc new)
16:10clojurebotI don't understand.
16:10Raynespedroteixeira: It's a special form)
16:11pedroteixeiraok, thanks.. trying to figure it out how to instantiate a class with a Seq of args.
16:11pedroteixeirawill just use reflection for now..
16:11triyoyou can wrap the special form in fn form and then apply...
16:24BorkdudeIs (not (some pred ...)) the same as (every? pred ...), I guess so yes?
16:27chouserno
16:28chouserhm.
16:28triyohehe
16:28chouserno
16:29chouser,(not (some odd? [2]))
16:29clojurebottrue
16:29chouser,(every? odd? [2])
16:29clojurebotfalse
16:29chouser(not (some ...)) is the same as (not-any? ...)
16:37Borkdudechouser: of course, doh
16:37Borkdudeuseful to know, there is not-any
16:37Borkdudewith question mark
16:38BorkdudeOne more question, is :default and :else more or less the same in cond?
16:40chousersure, anything that's always true would work, including 'true'. But :else is idiomatic -- please use it.
16:40Borkdudeah yes, alright
16:42BorkdudeIf I find myself doing a lot of (first (filter pred coll)), should I use a different construct maybe?
16:47mabes,(source find-first)
16:47clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
16:47mabes,(doc find-first)
16:47clojurebot"clojure.contrib.seq-utils/find-first;[[pred coll]]; Returns the first item of coll for which (pred item) returns logical true. Consumes sequences up to the first match, will consume the entire sequence and return nil if no match is found."
16:48mabesBorkdude: ^ find-first does what you are doing
16:48Borkdudemabes, great, tnx
17:28OForerowhat will be the equivalent of overriding toString?
17:29OForeroI want to have a different print routine for one of my defined strings
17:41emptare there any free but complete book for latest clojure?
17:42RaynesThe closest thing to a 'book' around is the ociweb tutorial.
17:42RaynesThat's free, anyway.
17:43emptok I'll check to find if I've looked at it before
17:43RaynesOtherwise, you have The Joy of Clojure (7 chapters in the MEAP already).
17:43Rayneshttp://java.ociweb.com/mark/clojure/article.html
17:43sexpbot"Object Computing, Inc. - Java News Brief - March 2009"
17:43Borkdudeempt: I got a free ebook
17:43empthi Borkdude
17:43Borkdudeempt: from someone on Twitter, let me search his address
17:44Borkdudeempt: satish.talim@gmail.com, just send him a mail and he'll send you his ebook
17:45emptthank you and Raynes
17:45Borkdudeempt: don't know how good this ebook is, haven't read it
17:46emptthat's ok thanks
17:48OForerois there any way to make println behave differently for a self defined struct_
17:48OForero?
17:53riddochcOForero: Differently how?
17:54OForeroI have a stuation were structs reference eachothers .. and if I do println at the REPL ends up in a stack overflow
17:55OForeroI was wondering if I can then define a custom println (that does not do a deep print) for one of them
17:56riddochcAh, you want to set *print-length* or *print-level*
17:57riddochcThat controls a lot of the printing functions, including println. Generally helpful at the REPL.
17:58OForero##
17:59OForerodo I just def them_
18:03riddochcI think you want to use (set! *print-length* ...)
18:03riddochcThey're already def'd.
18:11ihodeshi all – is anyone familiar with String->java.util.Date->String kinda stuff?
18:13ihodesor could point to where i might find some nice info on it?
18:18ihodespeople are less chatty then they used to be?
18:21RaynesAt the moment.
18:39dnolenihodes: have you look at the Joda time Clojure wrapper?
18:40ihodesI have not–where is that at?
18:40dnolenihodes: http://github.com/clj-sys/clj-time
18:40ihodesoh nice, that looks like it may work
18:41ihodesthank you very much. i have an additional question, though. i'm having trouble calling static methods in clojure: i (import (java.text.DateFormat)) and then, for example, cannot for the life of me figure out how to call... getTimeZone, for instance.
18:41ihodesis there something i'm missing?
18:42dnolenDateFormat/getTimeZone
18:42ihodes(. DateFormat getTimezone) or (. java.text.DateFormat getTimezone) or (DateFormat/getTimeZone) all don't work
18:42ihodesjava.lang.NoSuchFieldException: getTimeZone (NO_SOURCE_FILE:17) is what i get
18:45dnolenihodes: getTimeZone is not a static method
18:46dnolentry (DateFormat/getDateInstnace)
18:46ihodescrap.... i'm sorry then :\ . I'll try that, then
18:47dnolenihodes: (. (DateFormat/getDateInstance) getTimeZone)
18:47dnolenworks for me
18:47dnolen,(. (java.text.DateFormat/getDateInstance) getTimeZone)
18:47clojurebot#<ZoneInfo sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]>
18:47quizmewhat is ->> ?
18:48Borkdude,(doc ->>)
18:48clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
18:48ihodesworks for me! thank you so much
18:48dnolen,(->> "last" (str "second") (str "first"))
18:48clojurebot"firstsecondlast"
18:50dnolen,(macroexpand '(->> "last" (str "second") (str "first")))
18:50clojurebot(str "first" (clojure.core/->> "last" (str "second")))
18:50dnolen,(macroexpand '(str "first" (clojure.core/->> "last" (str "second"))))
18:50clojurebot(str "first" (clojure.core/->> "last" (str "second")))
18:53leifwanyone familiar with clj-processing or know where I can find people that do?
18:53leifwI'm getting a segfault in X when I try to run one of the examples
18:53leifwI could swear I got it working once but never again
18:54dnolenliefw: what os are you on?
18:54leifwlinux
18:55leifwubuntu, kernel is 2.6.32
18:55leifwX version is 1.7.6
18:55dnolenhmm, I've only tried it on os x
18:55leifwdang
18:55leifwI really really want this working :-/
18:56leifwooh looks like it's somewhere in the intel drivers
18:56leifwblech
18:56dnolenfwiw, Penumbra is pretty nice if you want to do interactive graphics and it's known to work on windows/linux/os x
18:56leifwooh I'll have to check that out
18:57leifwthe eclipse plugin?
18:57dnolenhttp://github.com/ztellman/penumbra
18:58leifwaha
18:58leifwneato
18:59dnolenit's opengl, but penumbra makes it enjoyable/fun, comes with examples of Tetris (< 250 LOC) and Asteroids (< 500 LOC)
18:59leifwcool
18:59leifwI'll have to try that out
19:00dnolenon ubuntu, it "just worked" for me.
19:00dnolenwell under parallels anyway :)
19:00somniumdnolen: what video card?
19:00dnolenNVIDIA GeForce GT 330M
19:01somniumah
19:02somniumI never suspected open source intel drivers could crash X so often when I got this laptop :/
19:02quizmenew discovery for me: (for [x (range 2) y (range 3)] [x,y])
19:02quizme:)
19:02quizmednolen thanks
19:03dnolenquizme: np
19:10Borkdude,(for [x (range 10) y (range 5) :when (= y 4) :while (< x y) :let [p (* x y)]] p)
19:10clojurebot(0 4 8 12)
19:18dnolenI was impressed by this Haskell snippet: let rightTriangles' = [ (a,b,c) | c <- [1..10], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2, a+b+c == 24] , from learn you a haskell
19:18dnolen,(let [r (range 1 11)] (for [c r b r :while (< b c) a r :while (< a b) :when (and (= (+ (* a a) (* b b)) (* c c)) (= (+ a b c) 24))] [a b c]))
19:18clojurebot([6 8 10])
19:23Borkdude,(for [c (range 1 11) b (range 1 c) a (range 1 b)
19:23Borkdude :when (and (= (+ (* a a) (* b b)) (* c c))
19:23Borkdude (= (+ a b c) 24))]
19:23Borkdude [a,b,c])
19:23clojurebotEOF while reading
19:23Borkdudedamnit
19:24Borkdude,(for [c (range 1 11) b (range 1 c) a (range 1 b) :when (and (= (+ (* a a) (* b b)) (* c c)) (= (+ a b c) 24))] [a,b,c])
19:24clojurebot([6 8 10])
20:02riddochcHmmm... Var clojure.core/unquote is unbound.
20:09somnium,~42
20:09clojurebotjava.lang.IllegalStateException: Var clojure.core/unquote is unbound.
20:10somnium,(macroexpand '~42)
20:10clojurebot(clojure.core/unquote 42)
20:12somnium,(binding [unquote (fn [x] (* x x))] ~42)
20:12clojurebot1764
20:21riddochcHm. So it's only bound within a macro's backquoted list, for my purposes. Must be a local function in the macroexpansion, then.
21:07defnis it correct to use the term niladic these days?
21:09durka42can I set java.library.path for lein repl?
21:11durka42got it - $JAVA_OPTS
21:25somniumniladic?
21:36defnsomnium: i believe it comes from APL
21:36defnniladic, monadic, dyadic
21:36defn(computing) Of an operator or function in a program, having no arguments.
21:37defn^-niladic
21:41pastorni wanna try clojure out... is there a .deb somewhere that gives me all i need?
21:44pastornsilly me
21:44TheBusbyUbuntu 10.04 appears to have a something in the repo, more detail here: http://bit.ly/b1dO1l
21:44sexpbot"Clojure Programming/Getting Started - Wikibooks, collection of open-content textbooks"
21:44pastornthere was a 'clojure' package (apropos didn't say anything)
21:45pastornin the repl, is there a 'reload' command?
21:47TheBusby,(doc load-file)
21:47clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
21:49pastornhow do you program in clojure? i'm used to mostly doing haskell
21:49pastornso i write som stuff in gvim, alt-tab to the repl; :r to reload and test my new functions
21:49pastornthen back to the source file and write more stuff
21:50pastornis that the way you work when programming clojure as well?
21:50TheBusbyI use emacs, but I think clojurebox does that for Vi
21:50TheBusbynmind
21:50pastornTheBusby: nah, i'm pretty comfortable with the unix principle
21:50TheBusbythe link I provided earlier has a section on setting up clojure and vim
21:50pastorn(it should do one thing and do it well)
21:51pastornmy editor is my editor and the repl is the repl... also: don't know any of vims window splitting commands
21:52TheBusbymore details here if you're interested, http://kotka.de/projects/clojure/vimclojure.html
21:52sexpbot"Kotka : Projects : Clojure : VimClojure"
22:09pastornhang on here...
22:09pastorn(map + [1 2 3] [4 5 6])
22:09pastornthat doesn't make sense... that's zipwith
22:12pastornit feels weird that it takes three arguments :/
22:15tomojit's n-ary zipWith :)
22:15pastornhaha
22:15pastornthere's zipWith as well?
22:16tomojzipWith from haskell I meant
22:16pastornyeah
22:20pastornso where should i start reading to learn clojure? what's good? wikibooks?
22:20pastorn(the wikibooks doesn't seem to have a very consistent design :( )
22:20pastorn*wikibooks articles*
22:27pastornTheBusby: i can't get ,(doc load-file) to work
22:27pastorn,(doc Test.clj) <-- this doesn't work :(
22:27clojurebotjava.lang.ClassNotFoundException: Test.clj
22:28pastornalmost; i get "Unable to resolve var"
22:39TheBusbypastorn: does (doc use) work?
22:39TheBusbyload-file is clojure core, at least in 1.1.0
22:39pastornit seems to print some help stuff
22:40TheBusbyarg, brb
22:40pastorndo i need to declare a module name in the file for this to work?
22:41pastornthis is my file: http://paste.lisp.org/display/100334
22:42pastornreload that page now...
22:48defnpastorn: how do mean module name?
22:48defnas in a namespace?
22:48pastorndefn: something like that
22:49defnlike (ns pastorn.hello-world)
22:49pastornin haskell if you have i.e. Stack.hs, then the first line in that file should be "module Stack where"
22:49defnare you planning on reusing your hello [name] function in other places? ;)
22:49pastornso that when you import you write 'import Stack' and not 'import "Stack.hs"'
22:49defnpastorn: short answer is: it depends
22:50pastorndefn: no, i just wont clojure-repl to reload my file in which i've placed some new functions
22:50defn(load-file "myfile.clj")
22:50pastornjava.lang.Exception: Unable to resolve symbol: define in this context (Test.clj:7)
22:50defnerr i think, maybe im thinking elisp
22:52defnpastorn: are you using "define" somewhere in your Test.clj?
22:52pastornoh siht
22:52defn;)
22:52pastornyay!
22:52defngoing back to a movie, ill try and check back if you need anything
22:52defnciao
22:52pastorni've been playing around some in DrScheme, so i'm a bit damaged...
22:52defnhey no worries
22:52defnenjoy your clojure :)
22:53pastornhehe
23:00pastornwhat is this? no long comments?
23:01Raynespastorn: (comment comment goes here)
23:01pastornhaha
23:01pastornnasty :D
23:01RaynesYou can also comment out individual forms with #_.
23:02RaynesBut that's usually only useful for debugging.
23:02pastornRaynes: form = (expr) ?
23:02pastorn(+ 1 2 #_3) ;; cool
23:03Raynes$(println #_"this one just snuck in here." "ohai")
23:03Raynes$(println #_(meow) "ohai")
23:03sexpbot=> ohai nil
23:03sexpbot=> ohai nil
23:03pastornRaynes: what's the $?
23:04RaynesIt tells sexpbot to evaluate whatever is passed to it in parens. If you need to evaluate something that isn't in parens, you can use $eval (e.g $eval 'meow)
23:04RaynesWe also have clojurebot, which does evaluation as well with , as the prepend (e.g ,(println "hai"))
23:05pastorneval/apply are the same as the ones in scheme?
23:05RaynesNever used Scheme.
23:05pastornlooking here: http://java.ociweb.com/mark/clojure/article.html#Syntax
23:05sexpbot"Object Computing, Inc. - Java News Brief - March 2009"
23:05pastornthere's no lambda?
23:06Raynes$(apply + [1 2 3 4 5])
23:06sexpbot=> 15
23:06dysingerlike we need another bot in here :/
23:06pastornin haskell you're able to do 'map (\x -> x + x*x) [1,2,3,4])'
23:06pastorns/)'/'
23:06Raynes$((fn [x] (* x x)) 10)
23:06Raynesdysinger: Yeah, it's only been in here for around two months now.
23:06sexpbot=> 100
23:07Raynespastorn: fn is lambda.
23:07pastornoh, nice
23:07dysingerRaynes - why what's the point - we already have had clojurebot for years
23:07pastorn$(map (fn [x] (+ x (* x x)) [1 2 3 4 5])
23:07sexpbotEOF while reading
23:07pastorn$(map (fn [x] (+ x (* x x)) [1 2 3 4 5]))
23:08sexpbotDENIED!
23:08pastorn:(
23:08dysingerannoying
23:08pastorn,(map (fn [x] (+ x (* x x)) [1 2 3 4 5]))
23:08clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$map
23:08pastorn,(map (fn [x] (+ x (* x x))) [1 2 3 4 5])
23:08clojurebot(2 6 12 20 30)
23:08pastornthere we go :)
23:09Raynesdysinger: At least a few people thought the title scraping was useful, and sexpbot does do a few things that clojurebot doesn't. Doesn't matter, I'll take him out of here. I'm tired of all the remarks.
23:09pastorn,(map (+ %1 (* %1 %1)) [1 2 3 4 5])
23:09clojurebotjava.lang.Exception: Unable to resolve symbol: %1 in this context
23:09pastorn,(map #(+ %1 (* %1 %1)) [1 2 3 4 5])
23:09clojurebot(2 6 12 20 30)
23:10pastorni'll stop spamming now :)
23:10sexpbotBai!
23:10dysingerWe've all written bots
23:10dysingerI have also
23:10pastorncan you reload clojure code for running programs like in erlang or scheme?
23:10dysingerhaving several of them in the room is ... not needed
23:10dnolenpastorn: yup
23:11programblehaving you in the room is ... not needed
23:11programbleno offense
23:11programblebut it is true
23:11dysingerlol
23:11Raynesdysinger: Until yesterday, nobody seemed to care. Hell, people seemed to like him a little. It's alright. He's gone, wont be coming back.
23:11Raynes:)
23:11programbleso i think your argument proves useless
23:11pastorndnolen: and it doesn't involve weird hacks like in haskell (where you need to import the compiler to make it work)
23:11pastorn?
23:12dysingerprogramble: whatever
23:13dnolenpastorn: nope. everything you enter in the REPL in Clojure is compiled
23:13pastorndnolen: but what if it's a big nasty function that i need to have in a file?
23:14pastorncan the calls to that function be replaced with the new definition on runtime?
23:14dnolenpastorn: use an IDE that lets you send only that definition to the REPL
23:14dnolenpastorn: yes.
23:14pastornnice :)
23:16pastornyou're much friendlier in here than in #scheme :)
23:34programbledanlarkin and dysinger are butt-buddies, rite?
23:37programbledysinger: hello?
23:39dysingerprogramble: ignored
23:39dysingerwhat are you guys ? 12 ?
23:41programbledysinger: are you and danlarkin?
23:57ravagood eve
23:59ravaany way in emacs/swank-clojure to find out what line in the source file is causing the compile to blow?