#clojure logs

2011-01-22

00:19amalloyEugene_: one of the articles i read that convinced me to try lisp was one in which the author founded his own company and was able to react more quickly to market changes than the competition because his language was better than theirs. getting a job isn't always necessary
00:19Eugene_paul grahm...
00:19Eugene_that was a long time ago though
00:20Eugene_there arent much opening for innovation anymore for a few people to do
00:20amalloyand clojure has good interop with java; if you're working on java and can solve a problem faster in clojure, you can do that and then dress it up pretty so it acts like java
00:20amalloyEugene_: you're right, all the good programs have already been written
00:21Eugene_i think its more realistic to push existing forward
00:21hoggarthhow do i flatten a list?
00:21hoggarth(max (1 2))
00:21hoggarthi want
00:21hoggarth(max 1 2)
00:21brehaut,(apply max '(1 2))
00:21clojurebot2
00:22mefesto,(flatten '(max (1 2)))
00:23clojurebot(max 1 2)
00:24amalloyheh. both correct answers to hoggarth's question, but i suspect brehaut is answering the question that was *intended* and mefesto is answering the question actually asked
00:24brehautamalloy: i think you are right :)
00:24mefestohah :)
00:24hoggarththanks guys
00:25brehautnurries
00:28doubleagentAny information on handling clojureql exceptions? Doesn't seem to be anything in tests/* or the website.
00:30brehautdoubleagent: i havent seen any. It appears (in my experience anyway) that in general its just letting the underlying server specific exceptions percolate up to the caller
00:31doubleagentbrehaut, thanks.
00:31brehautdoubleagent: it may be worth looking for information on clojure.contrib.sql and exception handling?
00:32hoggarthima need to try again
00:32hoggarthhow do i get the max value of a seq?
00:33hoggarth,(max (range 5)
00:33clojurebotEOF while reading
00:33hoggarth,(max (range 5))
00:33brehaut,(apply max (range 5))
00:33clojurebot(0 1 2 3 4)
00:33clojurebot4
00:33mefesto,(reduce max [1 2 3 4])
00:33clojurebot4
00:33mefesto(max (range 5))
00:33mefestooops :)
00:34brehauthoggarth: apply is afunction that takes a function a seq of arguments
00:34brehauthoggarth: it returns the result of that function applied to the seq of arguments
00:40amalloyhoggarth: brehaut is simplifying a little there. (apply f a b s), supposing that s is a vector like [1 3 4], is equivalent to (f a b 1 3 4)
00:40hoggarththanks guys!
00:40hoggartheuler #3
00:41hoggarth,(apply max (filter #(zero? (rem 600851475143 %)) (range 1 (Math/sqrt 600851475143))))
00:41clojurebotjava.lang.ExceptionInInitializerError
00:41amalloyie, it treats the last argument as a sequence, and "expands" it
00:42amalloy&(range 1 (double 10))
00:42sexpbot⟹ (1 2 3 4 5 6 7 8 9)
00:42amalloy&(range 1 2,5)
00:42sexpbot⟹ (1)
00:42amalloy&(range 1 2.5)
00:42sexpbot⟹ (1 2)
00:42amalloyhey, i didn't know that worked. neat
00:43brehauthuh the types of the range are curious
00:43mefestohmm
00:43mefesto&(range 1 5 0.5)
00:43sexpbot⟹ (1 1.5 2.0 2.5 3.0 3.5 4.0 4.5)
00:43brehaut&(range 1.0 10)
00:43sexpbot⟹ (1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0)
00:43brehautmefestos example shows the particular oddity
00:44amalloybrehaut: makes sense though
00:44brehautamalloy: it does
00:48doubleagentmy solution to #3 leverages a couple of massive functions
00:48doubleagentand then boils down to a one-liner
00:49hoggarthi'm new to clojure, so i spent at least twenty minutes figuring out how to sqrt
00:50brehautthe only euler solution i bothered to keep is for #18
00:50brehauthoggarth: do you know about clojuredocs.org?
00:51hoggarthi do now
00:51hoggarthso far i've found this the most useful
00:51hoggarthhttp://clojure.github.com/clojure/clojure.core-api.html
00:52brehauthoggarth: thats a more canonical resource, but, clojuredocs has a great cheatsheat and more examples
00:53hoggarthso the api has examples in curl
00:53hoggarthhttp://api.clojuredocs.org/
00:53hoggarthhow about with clojure?
00:53mefestooh that's cool. i didn't know they had a json api
00:54mefestohoggarth: probably need some combo of clj-apache-http and clojure.contrib.json
00:55mefestothen you could grab it with something like: (http/get url :as :json)
01:21gtechwhat do you guys use for debugging clojure?
01:25gtechcode
01:26brehauta repl + prn
01:26brehautbut im not a tool using simian
01:27gtechheh what's simian?
01:27zanesMoneky.
01:27zanes*Monkey
01:27zanesHe's making a joke.
01:27gtechand prn?
01:27gtechah I see
01:28brehautdinner calls anyway
01:28brehautlater
01:28gtechwhat is prn, and how do you deal without having any sort of line numbering in the stack traces?
01:31amalloygtech: prn is println, but with formatting to make it easy for computers to read, rather than humans
01:32amalloyand all my stack traces have line numbers
01:32amalloythat doesn't make them a lot more useful, tbh :P
01:32gtechI get (NO SOURCE FILE: 0)
01:33gtechah that's really tedious
01:34amalloygtech: i get that for eval'd code, but calls to functions that were defined in actual source files (rather than directly in the repl) should have line numbers
01:34gtechI understand you use (require <package-name>) to use a package, but say you have the source code on the machine, where would you put that code?
01:34amalloywhat are you using to get a repl?
01:35gtechclojure.jar
01:35gtechshould I use lein instead? it seems a lot slower
01:35amalloygtech: so doing it by hand from the command line, like java -cp clojure.jar clojure.repl or something?
01:36zanesI'm attempting to run lein deps on a project and it's complaining about a missing artifact: org.clojure:clojure-contrib:jar:1.1.0-master-SNAPSHOT
01:36zanesAm I doing something wrong here?
01:36gtechyeah, I have it running in emacs through the inferior-lisp command
01:36amalloyzanes: depending on a really old version of clojure-contrib
01:36amalloylast time i saw this, someone was running labrepl, which has a transitive dependency path to it
01:37zanesamalloy: The project appears to be depending on 1.2.0. I'm unclear on why I'm getting an error for 1.1.0-master-SNAPSHOT.
01:37amalloyzanes: labrepl depends on foobar, foobar depends on 1.1.0
01:37gtechamalloy: I have a bash script java -server \ -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888 \ -cp /home/gtech/opt/clojure/clojure.jar clojure.main
01:37zanesamalloy: Ah, I see the path. leiningen-run 0.3 is the culprit.
01:38gtechI was using that so I could attatch with jswat, which never quite worked either
01:38amalloygtech: lein isn't slower, as far as i know
01:38gtechwould it be preferable? and why?
01:38amalloyand using lein (or cake, which i prefer) will manage your dependencies and make your life generally much easier
01:38gtechcool, alright I'll pick up cake
01:39amalloythen just $ cake repl will get you a repl
01:39gtechso you normally use println and CDT for debugging?
01:39amalloygtech: i'm embarrassed to admit that i mostly use println :P
01:39amalloycdt is great but the learning curve was a bit steep for me
01:40gtechhaha okay
01:40zanesThis is weird. I thought usage of leiningen-run was pretty widespread?
01:41gtechso where do I put the cdt code though?
01:42gtechI mean I can throw the require in but where is the repl going to look for that package?
01:42amalloygtech: this is exactly what cake and lein do for you
01:43gtechkk so read through the cake documentation and all my fears will be quelled/
01:43amalloyhttp://georgejahad.com/clojure/emacs-cdt.html
01:44gtechamalloy: sweet thansk
01:44amalloyi'm actually not sure if cdt works this way, but in general cake projects have a project.clj file defining (among other things) the libraries on which your project depends
01:44amalloybefore the various cake commands do their work, they go fetch the required libraries from maven
03:11gtechamalloy: do you use the cake repl? for some reason in emacs whenever I make a malformed statement the repl becomes unresponsive
03:11amalloygtech: i use it on occasion, but usually swank/slime
03:12amalloyi think i'm using clojure-mode from elpa, and swank-clojure from...maybe also elpa? i can check
03:14amalloyno, looks like i installed swank-clojure myself
03:19amalloyi never tried to get M-x slime to work, fwiw; i just use cake swank and M-x slime-connect
05:22kumarshantanuhi, can anybody point me to an example on how to turn a java object into a map? e.g. :foo may lead to (.getFooFromFactory javaobj)
05:24kumarshantanuor maybe just on how to make an existing java class extend Clojure's map protocol (if IPersistentMap is a protocol)
05:47hoeck,(bean "foo")
05:47clojurebot{:empty false, :class java.lang.String, :bytes #<byte[] [B@36b1bb>}
05:48hoeckkumarshantanu: ^
05:49hoeckkumarshantanu: but bean returns a new map only
06:03robonoboWhat is the best lib for trig functions (cos, sin arcsin, ...)? Just use the java ones?
06:06Mimisbrunnrrobonobo: I think so yes
06:06Mimisbrunnrbut don't hold me to it
06:06Mimisbrunnrwiat
06:06Mimisbrunnrisn't there a clojure math package
06:07Mimisbrunnrin contrib
06:07Mimisbrunnrcheck clojure.contrib.math
06:07Mimisbrunnrshould be in there
06:07clojurebotCool story bro.
06:07Mimisbrunnr clojure.contrib.math
06:07MimisbrunnrCommon math functions for Clojure's numeric tower.
06:07Mimisbrunnryeah
06:07Mimisbrunnrcheers
06:08robonobonope
06:08robonoboonly numeric ones
06:08robonoboi did find a lib (clojure.contrib.generic.math-functions), but it seems to be dead
06:08robonoboi'll use Math/sin
08:16Gigarobyguys I need a hand with a macro
08:16GigarobyI need it to perform a (partial % item)
08:16Gigarobyon every function in the form
08:19Gigarobyso if I give the function something like (mymacro [item myitem] (foo arg (bar arg))) => ((partial foo item) arg ((partial bar item) arg)))
08:31raekGigaroby: so this would affect the first thing in every list?
08:31Gigarobyraek: just if the first thing is a function
08:32raekso you want to handle special forms and macros differently?
08:32raekin some simple cases, 'doto' might do what you want
08:33raekor even '->'
08:33raekbut I guess you want to insert the first argument in arbitrarily nested epressions
08:33Gigarobyraek: mmm the problem is the calls are going to be nested I guess
08:35raekif you're going to check whether the argument is a function, I think the easiest way is to check whether it is a special form or a macro (both those can be known at compile time)
08:36raekthere are probably some other "less magic" way of solving the problem
08:37Gigarobylike ?
08:37raekwhat problem are you trying to solve?
08:38raekyour question was about how to implement one specific solution. there might be more ways of solving the problem.
08:38Gigarobyraek: I'm just trying to do something like with-open
08:39fliebelI found zippers to be very useful for doing this kind of macro magic in a readable and concise manner. Just sayin'
08:39Gigarobybut the binding is gonna be the first arg of every function
08:39raek(let [item ..., i #(partial % item)] ((i foo) arg ((i bar) arg))) ; one solution without macros
08:41raekso the results of the expressions are not threaded together (like with ->) nor discarded (like with doto)?
08:42Gigarobyraek: not quite the same thing
08:42Gigarobyraek: but I may just found a solution I just gotta work on it
08:45raekone way to make the argument insertion more explicit could be to have the symbols of the functions of interest carry a special mark
08:46raeklike: (mymacro [item myitem] (!foo arg (!bar arg))) => (let [item myitem] (foo item arg (bar item arg)))
08:49pani_...
08:52Gigarobyraek: good idea but
08:53Gigarobyraek: I have to define the function with ! in front of it or I just put it into it when I call the macro
08:54kumarshantanurepeat question: how can i make a java object behave as a map?
09:04raekkumarshantanu: bean
09:04raekGigaroby: just in the maco, was my original thought
09:05Gigarobyraek: good idea really I'm working to see what I can do
09:05Gigarobyraek: is like the first real macro I try to do
09:06raekalso, you don't need to call partial, since you can inject the argument directly
09:13robonobohi everyone
09:13robonoboi'm trying to make a JPanel respond to a louseclick on it, but "(proxy [javax.swing.event.MouseInputAdapter] [] (.mouseClicked event (println "foo")))" doesn't seem to work
09:14robonoboit gives the error ""nth not supported on this type: Symbol
09:14raekrobonobo: you need to write the method signature too
09:15robonoboraek: what do you mean?
09:16robonoboah, found it
09:16raekthe forms inside the proxy form should look like (methodName [arg-foo arg-bar] ...code...)
09:16raekyou put the code directly in it
09:16robonoboyes
09:16robonoboit should have been (proxy [javax.swing.event.MouseInputAdapter] [] (.mouseClicked [event] (println "foo")))
09:17raekalso, I don't think you should have the dot in there
09:17raekI first though that was a method *call*
09:20robonoboraek: it gives an error if i do ...event MouseInput... in stead of woth a dot
09:20robonobos/woth/with
09:20sexpbot<robonobo> raek: it gives an error if i do ...event MouseInput... in stead of with a dot
10:09IvarTJWill clojure.jar be a dependency to compiled clojure classes?
10:10robonoboIvarTJ: if i'm not mistaken it will be
10:10robonobojust like you need to include 3rd party java libs to run your java apps
10:15IvarTJI might have to freshen up my familiarity with Java, but hopefully it is possible to compile clojure code to a single jar file with mostly just the JVM as a dependency concern for end users.
10:19raekIvarTJ: yes. a so called "uberjar". leiningen has a "lein uberjar" command for that.
10:29IvarTJAh, thanks, Leiningen looks useful.
10:36shortlordlet's say I want to write a function that executes other expressions, if a certain condition is true. How should I pass the expression to the executing function? syntax-quoted?
10:38raekshortlord: if you pass it to eval, just make the expression code look like any other code you would have written
10:38raek(eval '(+ 1 2))
10:39raeksyntax-quote will make all symbols namespace qualified. that will break for example let forms
10:40shortlordraek: nice, thx :)
10:53shortlordwhy is there a difference between (do (eval expr) true) and (do (eval expr))? Shouldn't the eval expression be evaluated in both cases?
11:15raekshortlord: yes it should.
11:16raekside-effects in lazy sequeces are delayed until they are needed, though
11:17shortlordraek: oh, I thought 'do' was explicitly created to execute expressions with side effects
11:18shortlordwhat should I use instead of do to execute the side effects in every case?
11:18raekclojure is not a lazy in general. only sequences can be lazy.
11:19raekdo evaluates the expressions and returns the value of the last one
11:19raekshortlord: what do you eval?
11:20pdk[10:53] <shortlord> why is there a difference between (do (eval expr) true) and (do (eval expr))? Shouldn't the eval expression be evaluated in both cases?
11:20pdkit is
11:20shortlordraek: a call to a function that itself calls a function which alters a ref
11:20raekanyway, to force side-effects of lazy sequences, 'dorun', 'doall' and 'doseq' can be used
11:20pdkdo only returns the value of the last expression evaluated in it under the assumption that the rest are inducing side effects instead
11:21pdkthat's its raison d'etre pretty much
11:21shortlordpdk: but that would mean that my function (which has side effects) should be executed, but nothing is happening
11:21raekshortlord: could you paste the code you are evaling somewhere?
11:22shortlordas soon as I remove the 'true' in the block, (do (eval expr)) returns a value (which is meaningless) and when I check the ref, it is changed
11:22shortlordraek: ok, just a sec
11:23raekshortlord: one common laziness gotcha is to use 'map' instead of 'doseq'
11:28shortlordraek: https://gist.github.com/791217
11:30dnolenshortlord: why do you feel the need to use eval instead of just calling those functions normally?
11:31shortlorddnolen: I want to execute them only if the condition in the execute2a function is met
11:31shortlordjust passing them to the execute function would already evaluate the argument, wouldn't it?
11:32pdk,(eval 1)
11:32clojurebotDENIED
11:32dnolenshortlord: you can pass the function without executing it
11:32raekshortlord: you can pass code around as functions.
11:32pdkif you write something like
11:32pdk(eval function-name)
11:32pdkit's only going to return the value of the symbol function-name you passed it
11:32pdkeval expects you to put in a form
11:32pdkso if i wanted eval to actually run function-name
11:32dnolen((fn[f] (f 1)) inc)
11:32pdki'd write (eval (function-name))
11:32dnolen,((fn[f] (f 1)) inc)
11:32clojurebot2
11:33dnolenshortlord: ^
11:33pdkwhich is completely redundant since (function-name) will do the same thing, wrapping it in eval doesn't cause it to be evaluated when it normally wouldn't be in that circumstance
11:33shortlordah
11:34pdke.g. if i write (if (true? some-var) 1 (eval 2))
11:34pdkit still won't run (eval 2) either way if the condition in the if was met to begin with
11:34raekshortlord: if you stick a # in front of the call, it will become an anonymous function which will perform that call when you invoke it
11:34dnolenshortlord: You will probably never need eval. Plus it's dog slow as it triggers compilation.
11:35pdkso in this case the evals as they're being used in the code you posted won't do what you intended them to do
11:35pdkand you'll get the same result as you intended anyway by saying (expr) vs (eval (expr))
11:40shortlordpdk: just removing eval and using (expr) instead causes the same behaviour as before, without 'true' in the 'do' expr, it runs the function with side effects, as soon as I put the 'true' back into the 'do' block, there is nothing happening anymore
11:44raekshortlord: I think a more common pattern would be to make a predicate function, perhaps (players-turn? player) and let the caller use it in an ordinary if expression
11:45raekif, unlike the usual functions, is a special forms and has special rules for argument evaluation
11:46dnolenshortlord: https://gist.github.com/791233/7665ef44cba0fb853bbea2dce99ef6fd7509eae7
11:48shortlorddnolen: but does that still work, if you put the (f) into a (do ... (f) ... true) ?
11:48shortlordbecause that's where it breaks for me
11:49dnolenshortlord: I'm not convinced you're seeing what you're think your seeing. (f) will get executed and true will be returned as the value.
11:49dnolenshortlord: if you wrap that in a do like you've shown ^
11:50raek,(println "hello")
11:50clojurebothello
11:50raek,(do (println "hello") true)
11:50clojurebothello
11:50shortlorddnolen: well, that's the problem. (f) is not executed. I'll paste the source code with your modified version
11:50clojurebottrue
11:51dnolenshortlord: why do you *think* it's not being executing. that is what proves to you that it doesn't *seem* to be executing.
11:51shortlordraek: the problem is that there are a lot of different calls that are only allowed if that predicate is met and that I need to return true and false, so wrapping everything in execute would be easier
11:53raekshortlord: you can use preconditions for ensuring that. (defn foo [player] {:pre [(players-turn? player)]} (...do stuff...))
11:53raekshortlord: which function do you pass as 'f'?
11:56pdkdang where are these sorts of tricks documented
11:57raekpdk: pre- and postconditions?
11:57dnolen,((fn [f] (do (println (f 1)) true)) inc)
11:57clojurebot2
11:57shortlordraek, pdk: https://gist.github.com/791243
11:57clojurebottrue
11:58dnolenshortlord: ^ your understanding of do is not right, that's a side-effect and returning true
12:00shortlorddnolen: I thought the whole purpose of do was to induce side-effects?
12:00Chousukeyou don't need it for them
12:00dnolenshortlord: what I mean is that your claim "do is not executing my function" is unlikely.
12:01raekthe purpose of do is to be able to evaluate multiple expressions in the place of one
12:01RaynesThe purpose of do is to allow for you to do more than one thing in a place where only one thing is expected. For example (if true (do (println "1") 1) ..). We can't print and return 1 without the do.
12:02shortlordraek, Raynes: well, but println is a side-effect, isn't it? pure functions that just return values would be useless in a do statement, because only the last value is returned, right?
12:03raekyes. having a pure function in any other place than the last is useless
12:05raekthe side-effects of a non-pure function happens when the function invocation is evaluated
12:05shortlordso I don't see where my understanding of 'do' is wrong. I have looked at the special forms page on clojure.org, but the explanation of 'do' is very short and it seems that my usage of it should be ok in this situation
12:05clojurebotc'est bon!
12:06shortlordraek: so that means that somehow by putting 'true' into my code, the function does not get invoked anymore?
12:06dnolenshortlord: no. that function will be invoked.
12:07raekno. it should be invoked. what makes you think it isn't?
12:07raek,(println "side-effect")
12:07clojurebotside-effect
12:07raek,(do (println "side-effect") 123)
12:07clojurebotside-effect
12:07clojurebot123
12:08shortlordraek: in the gist I've linked, I am checking the value of the ref after every call to execute, in the case where 'true' is not in the code, the ref changes, as soon as I put 'true' back in, the ref is not altered anymore, even though it should be
12:09shortlordapart from removing 'true', nothing is changed, the current-player is still the same, the dice-no is still the same, etc.
12:09dnolenshortlord: then there is a bug somewhere else
12:10shortlordI can toggle the change of the ref by adding and removing 'true', I have checked it several times, the behaviours without a true is expected, as soon as the true is reintroduced, nothing happens anymore
12:11raekshortlord: you are using for
12:11raekuse doseq there instead
12:11raekfor creates a lazy sequence
12:12raekthe steps of a lazy sequence are delayed until they are neede
12:12raekin this case, they were forced by the repl printing them
12:12dnolen,(let [x (ref [])] (do (dosync (alter x conj 1)) [x true]))
12:12clojurebot[#<Ref@f7cbd1: [1]> true]
12:13raekdoseq has the same syntax as for, but is used when you want to cause side-effects, rather than returning a lazy sequence
12:13raekso, steps in lazy sequences are not guaranteed to be executed when the lazy sequence is created.
12:14shortlordraek: oh god, you are right! thx so much, it works now :)
12:15raek,(take 3 (for [i (range 100)] (do (println i) i)))
12:15clojurebot0
12:15clojurebot1
12:15clojurebot2
12:15clojurebot3
12:15clojurebot4
12:15clojurebot5
12:15clojurebot6
12:15clojurebot7
12:15clojurebot8
12:15clojurebot9
12:15clojurebot10
12:15raekaw
12:15clojurebot11
12:15clojurebot12
12:15clojurebot13
12:15clojurebot14
12:15clojurebot15
12:15clojurebot16
12:15clojurebot17
12:15clojurebot18
12:15clojurebot19
12:15clojurebot20
12:15clojurebot21
12:15clojurebot22
12:15clojurebot23
12:15clojurebot24
12:15clojurebot25
12:15clojurebot26
12:15clojurebot27
12:15clojurebot28
12:15clojurebot29
12:15clojurebot30
12:15clojurebot31
12:15clojurebot(0 1 2)
12:15dnolenhah
12:15raekyeah, ranges come in chunks of 32...
12:15dnolenbitten by chunked
12:15raeksorry for that
12:18dedeibel:)
13:02phenom_anyone running aquamacs 2.1 ?
13:02technomancyzanes: sure (re: esk bugs)
13:03technomancyjust make sure they're present in source not just from repo.technomancy.us
13:04technomancymattrepl: for eval-in-project you can just assoc onto the project arg or hook the leiningen.classpath/get-classpath function
13:04technomancydepends on what you're trying to do
13:11pauldoo(doc separate)
13:11clojurebotGabh mo leithscéal?
13:12technomancyawesome... ran into a bug that only occurs when *err* is rebound to not spit anything out. =\ how are you supposed to debug that?
13:12pauldoo(what's the syntax for clojurebot?)
13:13raek,(doc separate)
13:13clojurebotGabh mo leithscéal?
13:13pauldoook - what does that mean? it doesn't do contrib?
13:14raekdunno
13:14raek&(doc separate)
13:14sexpbotjava.lang.Exception: Unable to resolve var: separate in this context
13:14mattrepltechnomancy: thanks
13:14raekthe bots probably don't have that namespace use'd
13:14pauldoohehe ok
13:14technomancymattrepl: what are you adding?
13:14LauJensenarbscht: Its been a week since you said the Weekly REPL would come out - Whats up ?
13:15raekI'd recommend clojuredocs.org
13:15mattrepltechnomancy: the crane plugin adds <project>/crane to the classpath
13:15pauldooraek: that's where I got it from, but I'm having real trouble figuring the syntax for my use/require. (havn't used anything form contrib yet)
13:16technomancymattrepl: for all tasks or just some?
13:16pauldooit's in clojure.contrib.seq / clojure.contrib.seq-utils <--- what's the difference?
13:17technomancyany reason it couldn't just be resources/crane?
13:17IvarTJPresumably the arguments in the clojure documentation marked with question marks are optional.
13:17raekpauldoo: (ns your-ns (:use [clojure.contrib.seq :only (separate)]))
13:17mattrepltechnomancy: more than just crane-specific. though maybe not all.. e.g, would want to add it for swank task
13:17pauldooraek: and if I'm not using a ns yet?
13:17technomancymattrepl: you would need a hook for that then
13:17raekpauldoo: (use '[clojure.contrib.seq :only (separate)])
13:18pauldoojava.io.FileNotFoundException: Could not locate clojure/contrib/seq__init.class or clojure/contrib/seq.clj on classpath: (NO_SOURCE_FILE:0)
13:18raeksame syntax, except you write use as a symbol instead of a keyword, plus you have to quote the whole thing.
13:18raekpauldoo: do you use leiningen?
13:18raek(or cake)
13:18pauldooraek: nop, just a repl so far
13:18raekpauldoo: then you need to include the contrib jar file in the classpath
13:18mattrepltechnomancy: yeah, that was the reason for using handler before. robert.hooke is useful
13:19raekhow you do that depends on how you start clojure
13:19technomancythe handler arg would only work for tasks you defined anyway
13:19pauldooraek: hm ok - perhaps that's my problem. I thought the jEdit clojure repl had contrib already in
13:19raekI recommend using lein or cake as soon as you need to have your code in more than one source file *or* as soon as you need an external jar
13:20pauldooraek: okidoke - I'll take a look at lein
13:20raekhttps://github.com/technomancy/leiningen
13:20raekif you create a new project, the project.clj file will include contrib by default.
13:21pauldooraek: I think I already have it installed via macports. it has been on my list to try out for a while
13:21mattrepltechnomancy: oh, that's right. I already have a hook in lein-crane for that purpose, had forgot
14:20T0mmy Centimeter by centimeter he watched his cock grow thicker,
14:21T0mmyspreading Christa's cunt ever wider in its wake. Both of her hands came
14:21T0mmydown to grip the base of his cock as she looked down in disbelief. At
14:21T0mmyleast six inches were outside of her now, and she had taken him nearly all
14:21T0mmythe way before. Curt opened his eyes and stared in disbelief. He was
14:21T0mmygrowing even faster this time! His cumming continued to make him buck
14:21T0mmylike a bronco as his shaft grew ever more horse-like. Thicker and longer
14:21T0mmy-twined with huge, thick veins- his erection plowed into Christa's tight
14:21T0mmybush like a dog trying to fit into a rabbit hole.
14:21T0mmy "Ahhh! Curt! Omigod ... you're goin' too ... far!"
14:21T0mmy Drastically, Curt tried to pull himself out of Christa before he
14:21T0mmyhurt her. Her moaning and bucking were intense and -just before he could-
14:21T0mmyhe felt himself hit a massive climax. Rigid, he watched as his cock
14:21T0mmyrocketed upwards in size, spreading her cunt lips and making her squeal
14:21T0mmyhalf in pain, half in ecstasy. His balls pumped and churned as they lay
14:21T0mmyheavy on his thighs. In shock he looked at them, tangled in their mass of
14:21T0mmypubic hair. Each was larger than a large grapefruit! His shaft had to be
14:21T0mmyat least three and a half inches across and nearly sixteen inches long!
14:21T0mmyThe spasm began to fade, but the tingling in his balls remained. Orgasm
14:21T0mmysubsiding, Curt felt his body grow limp in its wake.
14:21T0mmy Slowly, Christa pulled off of him and slumped next to him on her
14:21T0mmybed.
14:21T0mmy His massive rod stood up from his midsection like a bent flagpole.
14:21T0mmyGobs of his cum dripped from Christa's stretched cunt as she panted for
14:21T0mmybreath and rubbed her delicate hands over Curt's chest. Opening her eyes,
14:22T0mmyshe glanced at Curt's waist and shook her head slowly. "God, Curt... I
14:22T0mmydon't believe it." She smiled, and nuzzled the smaller man's neck -her
14:22T0mmyglistening breasts pressing against his chest. "Th' bigger th' better,
14:22T0mmyI've always said... I don't think I've Ever been this turned-on!"
14:22T0mmy Curt returned her smile and kissed Christa gently on the cheek.
14:23cobol_expertbrilliant
14:24jamiltronMan, what a time to pull up my IRC window and see what I've missed.
14:59C-Keenhi there!
15:00C-KeenDo I need to build clojure myself from sources with a jdk-1.5? I used lein to install clojure stable (I think) on a x86 openbsd 4.7 machine
15:01pdk`http://openports.se/lang/clojure C-Keen
15:02C-Keen(2010-12-09) Package added to openports.se,
15:02C-Keenthat is too new pdk`
15:02pauldooI've installed leiningen from macports, and getting really big errors from "lein deps" on a simple "hello world" project: https://gist.github.com/791409
15:03pauldoodoes leiningen need maven? Does it work ok with the default os x version of maven, or should I install another version from macports?
15:42peregrine81hey all when I run this code i get the error as shown in the pasteie http://pastie.org/1488103
15:42peregrine81I'm trying to setup a two dimensional data structure to represent a game board
15:43peregrine81I'm not quite certain as to why I cannot use a vector as a key for a hash-map
15:45mefesto,{[1 2] :a}
15:45clojurebot{[1 2] :a}
15:46mefestoi'm not sure where the error is coming from but i don't think this code is doing what you intend
15:46peregrine81okay...
15:46mefestonothing is updating your board since it's immutable
15:47peregrine81oh that makes sense
15:47mefesto'for acts like python's list comprehension
15:47peregrine81should I be creating a new map and merging it with board?
15:48mefesto,(for [x (range 5) y (range 5)] [x y])
15:48clojurebot([0 0] [0 1] [0 2] [0 3] [0 4] [1 0] [1 1] [1 2] [1 3] [1 4] ...)
15:49peregrine81,(range 1 4)
15:49clojurebot(1 2 3)
15:51mefestomaybe something like: (into {} (map (fn [[x y z] [[x y] z])) (range 1 5) (range 1 5) (make-percept)))
15:51mefestowhere make-percept creates your Percept with the default values
15:51peregrine81cool, lemme give that a shot
15:51mefestothat might not be the best way ... im just recovering from a nap :)
15:56mefestoperegrine81: this seems to work: http://pastie.org/1488141
15:56mefestoerr maybe not
15:58mefestoperegrine81: ok updated: http://pastie.org/1488141
15:59peregrine81mefesto: it did! thanks a ton
15:59qbgClojure 1.3 needs to be released so we can improve the shootout benchmarks
15:59peregrine81so the issue was I was trying to assoc something that did not exist.
16:00mefestoyeah pretty much
16:00mefestowell the results of your assoc were being thrown away
16:00peregrine81mefesto: it kind of works. I wanted to use for so I could get 11 12 13 14....
16:02mefestoupdated again: http://pastie.org/1488141
16:02mefestothen do (make-board 1 15)
16:02mefestoif i understand correctly
16:03peregrine81well i mean [1 1], [1 2], [1 3]
16:04peregrine81all possible permutations of the sets
16:24peregrine81mefesto: I got it to work by replacing the range 1 5 with my for x 1 2 3 4 5...
16:24peregrine81mefesto: thanks for your help!
16:24mefestonp :)
16:26Raynesmefesto: You're on a roll.
16:27mefestoRaynes: i'm sure my streak will end soon :)
16:28mefestoRaynes: i haven't been too active on here lately. i heard that there was some working going on with tryclojure?
16:28mefestohow's that stuff going?
16:28Raynesmefesto: apgwoz redesigned the site and it's using my own sandboxing library now.
16:29RaynesSomebody said they were working on an interactive tutorial a while back, but I never heard anything more from that
16:29mefestolooking at it now. looks good. you guys using compojure?
16:29Raynesmoustache
16:30RaynesNot for any particular reason. The site is very simple.
16:31mefestois it a separate java process per session?
16:31RaynesNo.
16:32mefestois it possible for different users to redef each others vars or that's what your sandboxing handles?
16:34Raynesmefesto: Each user gets a different namespace.
16:34RaynesThe possibility of clashes is fairly small.
16:35mefestocool stuff
16:36mefestois the sandbox part of the tryclojure project or separate?
16:36RaynesSeparate: http://github.com/Raynes/clojail
16:36Raynesamalloy and I's project.
16:53mefestoRaynes: pretty cool. on each request it re-executes upto the last 5 lines of text?
16:54RaynesRight.
17:04mefestoRaynes: you guys still looking for people to help out?
17:19Raynesmefesto: Sorry, had to run off.
17:20mefestonp, just been reading the code
17:20Raynesmefesto: There isn't very much else that needs to be done. The only thing left is an interactive tutorial, and that would be Javascript stuff.
17:26mefestooic, and you say that's the part that may or may not be currently addressed?
17:29Raynesmefesto: Right.
17:30mefestohas someone already written up the outline of the tutorial and it's just a matter of JavaScripting it or both?
17:32Raynesmefesto: We need a system like tryhaskell.org's. As a matter of fact, one could probably just steal most of it's code, since it uses the same Javascript console as I do.
17:32RaynesThe actual tutorial can be added after the fact.
18:36N8DawgHello
18:37N8DawgI'm not sure of the correct etiquette for this channel for please forgive me if i appear rude
18:37N8Dawgi had a clojure question...
18:38N8DawgIf I put the following into the REPL:
18:38N8Dawg(defmacro test1[] (clojure.core/partial + 1))
18:38N8Dawg(println ((test1) 1))
18:38N8DawgI get: #<CompilerException java.lang.ExceptionInInitializerError (scratch2.clj:434)>
18:38technomancyyou didn't say simon says
18:39technomancyanyway, you want defn instead of defmacro
18:39mefestoN8Dawg: you need to quote
18:39mefestoerr... or not even use a macro like technomancy says :)
18:39N8DawgI understand defn works, but i need a macro in this instance
18:39N8Dawgsurely a macro "should" be able to retrurn a function
18:40mefesto(defmacro test1 [] `(partial + 1))
18:48N8Dawg*duh* you're right it executes result of macro inline, it cant execute partial by definition
18:55mefestoRaynes: I'm trying to run tryclojure locally but am getting an error when call 'use: http://pastie.org/1488569
18:56mefestoi've copied the example.policy to ~/.java.policy
19:20scodeWhat is the current idiomatic way to generate API docs for clojure code? (I.e., which API doc generator is the de facto standard, if any?)
19:41raekscode: autodoc is used by many projects. marginalia is a new interesting tool too (I really like it myself).
19:42raekhttp://tomfaulhaber.github.com/autodoc/
19:42raekhttp://fogus.me/fun/marginalia/
20:26devnhttps://gist.github.com/791715
20:26devnIs it possible to do something like this? (oops, "(commands)" shouldnt be in quotes.
20:26devn)
20:27devnI want to split out the condp, but (condp = cmd) needs to be evaluated in the context of the let
20:30devnAny ideas?
20:37devnI've updated https://gist.github.com/791715 and need to run out for a bit, please feel free to edit the gist with any suggestions. Cheers!
20:46Raynesdevn: Your question makes very little sense to me.
20:52devnRaynes: heh, you can't break out the condp from inside the let just by extract it as a def
20:53devnextracting*
20:53RaynesYou're describing the problem in a very bizarre and confusing way.
20:53RaynesI think I get what you want here.
20:53RaynesYou want the condp bound to commands to be executed in the context of the let.
20:54devnright. I thought that was pretty clear from the example I gave above
20:54RaynesMy suggestion is to not do that. Sure you don't want a global dynamic earmuffed var that you can rebind with binding?
20:54devnlike with alter-var-root or something?
20:54Raynesdevn: The example was very clear, but the explanation of the example wasn't.
20:55RaynesWell, that wouldn't actually work either, because commands would already have been evaluated. You've got me there.
20:55devnmy apologies for the confusion
20:55RaynesShouldn't commands be a function if it needs arguments?
20:56devnit seems to me the only way to fix this is to rewrite condp
20:56RaynesOr rewrite commands, since what you're trying to do is weird.
20:56devn:)
20:56devnI will agree it is "weird"
20:56devnI'm just trying for clean code.
20:56devnI gotta run I'll be on in a few
20:57Raynes:p
21:06zoldarhello, I have problem with leinigen compiling my clojure source to .class files - in my previous project everything worked fine. At the current one, when I do 'lein compile', 'classes' directory remains empty. 'lein jar/uberjar' packs just .clj files from project's src directory. What may be the cause of that?
21:28technomancyzoldar: leiningen won't AOT anything unless you tell it which namespaces you want
21:29zoldarwith gen-class ?
21:29technomancyyou need to specify it in project.clj
21:30zoldarah
21:30technomancytry "lein help sample" if you have a recent version
21:30technomancyin particular the :aot part
21:30zoldarok, thanks
21:31technomancyyou can also do "lein compile :all" for a sanity check, but if you're using gen-class then :aot in project.clj is a good idea
21:41zoldar:aot did it for me, thanks again