#clojure logs

2010-11-26

02:19LajlaChousuke, ajattelet että olen kanavahullu, kylläkö? =(
03:10LauJensenMorning all
03:15mduerksenMorning. Good to see I'm not the only one in a europian timezone :)
03:31sthuebnermduerksen: no, you're not ;-)
04:21mduerksensthuebner: german, right?
04:23LauJensenmduerksen: thats Herr Huebner to you :)
04:26AWizzArdThere are several germans here, mduerksen
04:26AWizzArdSome of them btw in #Clojure.de too (:
04:29bartjis there any advantage to returning multiple values from functions
04:29mduerksenOh wow, I didn't realize there was another channel for germany! :)
04:30bartjalso, can someone please confirm that Clojure does not support returning multiple values from functions
04:34mduerksenbartj: what do you mean exactly by multiple values? A function can return a tuple of values, of course
04:35bartjmduerksen, I mean in Perl, Python you can do something like a,b = func(c)
04:35bartjmduerksen, of course, you can return a tuple of values
04:36bartjI was just curious to know why some languages support it specifically
04:36bartjalso, if it was not possible for languages which treat functions as first class objects
04:38timrodbartj, if you do a,b = func(c) in python, func returns a tuple which is "destructured" into a and b
04:38mduerksenbartj: well, similar to your perl example, you could write something like this: (let [a b] (func c))
04:38_atoneed an outer vector for the let: (let [[a b] (func c)] ...)
04:38_atobut yeah, that's virtually exactly the same as what python is doing
04:38mduerksen_ato: thanks
04:40bartjhmm, so you have to explicitly destructure it in Clojure, right ?
04:40_atohuh? not more than you have to do with Python
04:40timrodyes, just like you have to in python (and afaik in perl, but I'm not sure)
04:43_mstare you thinking multiple return values ala common lisp?
04:43_atoperhaps perl is weirder, due to the contexts stuff, but the principle is the same isn't it, you're just returning an array and then destructuring it?
04:45bartj_mst, I am afraid, I don't know CL
04:45bartjok thanks, guys
04:45_mstcommon lisp's slightly different in how it handles multiple return values, in that if you're not interested in anything but the first one you can just pretend the others don't exist
04:46_atohow do you get at the other values?
04:46_mstfor instance (setq foo (gethash :somekey my-hash)) would just bind the value taken from the hash to that var
04:46_mstif you want the other values things start to look an awful lot like destructuring:)
04:47_mstexcept usually you wouldn't bother, because you'd have to type multiple-value-bind and by the time you've finished typing that out you've generally lost interest...
04:47_atoah, so it's a special purpose "let" for multiple return values?
04:47_mstyup
04:47_atoick
04:55sthuebnermduerksen: yepp, german ;-)
04:58DeranderI want to learn ocaml
04:59Derandersorry, random.
05:07samxIf a specify a keyword in a namespace, like: (ns my.long.namespace) (def a { ::foo 10 }).. And then try to use it from another namespace with using an :as, such as: (ns my-namespace (:require [my.long.namespace :as mln])) (:mln/foo mln/a).. That does not seem to work, so that I'll have to do (:my.long.namespace/foo mln/a).. Can I get the one using a namespace alias to work somehow?
05:10_atosamx: try ::mln/foo
05:10samxthx
05:11_ato:: means resolve in current namespace (which includes resolving aliases)
06:12sandGorgonhi guys.. i was looking for solutions on how to recur on exception and I found this http://stackoverflow.com/questions/1879885/clojure-how-to-to-recur-upon-exception - I dont get why you need the macro. You can make do with the function only right ?
06:22TordmorsandGorgon: The macro is there to wrap the passed form(s) into a function call. You'd have to do that yourself without it. So you can do without the macro only in so far as you could do without any macro.
06:25sandGorgonTordmor, by passed form - do you mean the "body" that needs to be executed ? I'm still a little unclear on what the macro is wrapping and how
06:25Tordmoryes
06:26sandGorgonso if the body was, in fact, a function - then you dont need a macro. right ?
06:29Tordmoryes
06:29sandGorgonthanks
07:45jegbI use leiningen, emacs, and slime for compojure development. I use 'lein swank' from the console, and connect from emacs. This works fine. However, when I get an exception, the stack trace goes in the console. I would obviously like to get it in a slime debug buffer (sldb), so that I can inspect the frames, etc. How do I do this?
07:46bartjI need to show the complete stack-trace of tail-recursive calls to my colleague
07:46bartjthis example from http://stackoverflow.com/questions/33923/what-is-tail-recursion is very appropriate
07:46bartjbut, it is in python; can I do the same in Clojure
07:47bartjI mean show that the intermediate variables are not all stored on the stack!
07:52bartjoh well, I found the scheme explaination on the same page - http://stackoverflow.com/questions/33923/what-is-tail-recursion/33931#33931 much better
07:53bartjthanks
08:43sandGorgona functional programming question - two functions need to be called one after the other (second doesnt use the return value of first, insofar as that is simply a status that the first function has successfully executed). Would you use "do" ?
08:44stuartsierrayes
08:44stuartsierraBut remember that most forms like fn, defn, and let all have an "implicit do"
08:45opqdonutthat's not functional programming ;)
08:45stuartsierratrue
08:46mduerksennonetheless required from time to time :)
08:49mduerksensandGorgon: you should always be aware of which form have an "implicit do" and which don't. I already fell into that trap with "if"
08:51sandGorgonmduerksen, trap with an "implicit do" ? you mean you assumed "if" had one ?
08:53mduerksensandGorgon: yes, i had used an "if" without using the else form, then added some code afterwards that i wanted to be evaluated as well. that's where i discovered the "when" macro ;)
08:53sandGorgonah... thanks guys
08:53mduerksenyou should use "when" if you don't need the else form
08:54sandGorgonyup.. figured that one out
09:36Guest18523clojure? long-polling? comet?
10:13serp__how do I remove an element from a set?
10:14AWizzArdserp__: disj
10:14AWizzArd,(disj #{10 20 30} 30)
10:14clojurebot#{10 20}
10:14serp__tyvm
10:21pppaulcan i use curl in clojure?
10:22stuartsierralibcurl the library or curl the command-line program?
10:27pppaullibcurl
10:27pppaulor the commandline too
10:27pppaultool
10:28pppauli guess libcurl would be preferred
10:29cemerickstuartsierra: morning :-)
10:30cemerickWe're good to go on hudson; I'm about to start my writeup of the whole process and the outstanding policy / process issues.
10:30cemerickDo you have any open questions/issues on the clojure + classic contrib builds?
10:32stuartsierramorning
10:32stuartsierraI just pushed updates to "classic contrib" that builds from the base POMs.
10:33stuartsierraWhat about providing for "alternate path to clojure.jar" in the contrib base pom?
10:34cemerickright, right
10:35cemerickstuartsierra: You'll want to use >= 0.0.20 of the pom.oss-deploy POM, and take a look at the hudson configuration in the build.poms job. The post-maven build step + disabling the maven release plugin's auto-push prior to the nexus deploy is a must-have IMO.
10:38stuartsierraI used pom.contrib as the parent of clojure-contrib/modules/parent
10:39serp__I have a function (f [x y]) I want to do (f (f (f (f a p) q) r) s). is there a "better" way to do this than with reduce?
10:40magnet_serp__, of teeworlds? :)
10:40stuartsierraserp__: reduce *is* the better way
10:40serp__magnet_: maaaybe :S
10:40magnet_serp__, small world
10:40magnet_:)
10:40serp__:P
10:42stuartsierracemerick: Just pushed contrib/modules/parent/pom.xml with parent pom.contrib:0.0.19
10:43cemerickright, sorry, 0.0.20 is the current snapshot
10:45stuartsierraupdating config in hudson now to match build.poms
10:47pppaulhey, can someone tell me if libcurl is in clojure?
10:47abedrastuartsierra: you know we decided yesterday that anyone who breaks the build has to sort out and eat the butter popcorn jelly beans at the office
10:48serp__stuartsierra: all right thanks
10:48stuartsierraabedra: I don't break builds, I break heads.
10:49abedrastuartsierra: me email says that you have to eat the butter popcorn AND the black licorice ones
10:49kryftOo, black licorice
10:49abedras/me/my
10:49abedra:)
10:51cemerickstuartsierra: does this look right? https://gist.github.com/c9a316b66f78e4a9cbef
10:51stuartsierrapppaul: libcurl is written in C, you can call it from Clojure if you have JNI or JNA bindings to it
10:51stuartsierracemerick: there's more to it than that
10:51stuartsierrahang on
10:52stuartsierracemerick: https://github.com/clojure/clojure-contrib/blob/60e7162a5a29615cae3e6d494a3653c34b6ddb66/modules/parent/pom.xml#L60
10:53cemerickstuartsierra: what's the why the default profile dep instead of just having the clojure dep with a parameterized version in the top-level deps?
10:55stuartsierracemerick: as I recall, that was how I tried to do it the first time. It didn't work.
10:55stuartsierraI think if you want to override the dep in a profile, that dep has to be part of a profile to begin with.
10:59stuartsierracemerick: Any idea what this means? http://build.clojure.org/job/clojure-contrib/275/console
10:59stuartsierraIt says "You can't push to git://github.com/richhickey/clojure-contrib.git" but that isn't configured anywhere as the repo.
11:00stuartsierraoh, wait, it is set wrong...
11:01cemerickstuartsierra: first, that should be a POST build step, not pre
11:02cemerickstuartsierra: it's trying to push @ richhickey/contrib.git because that's origin in the hudson job's workspace.
11:03cemerickI strongly suggest checking off "Wipe out workspace" in the Advanced section of the job's SCM config area.
11:04stuartsierracemerick: ok, trying again
11:06cemerickstuartsierra: We have a general hudson configuration problem. Getting everything we want on every job is going to be a PITA, nevermind sane change mgmt over time.
11:07cemerickI don't have any solutions on that topic at the moment. I was hoping for a baseline-hudson-job-config plugin or somesuch, but haven't found one yet.
11:08stuartsierraYeah, that's annoying.
11:09stuartsierraFor now we'll just have to get one right and make sure to copy that config everywhere.
11:10stuartsierraMaking sure old projects are kept up-to-date will be the hard part.
11:12cemerickstuartsierra: yeah; we've only 2 jobs that are OSS-capable so far, and it's already irritating.
11:12stuartsierraok, updated clojure-contrib Hudson config, failed for a different reason
11:13stuartsierrahttp://build.clojure.org/job/clojure-contrib/277/console
11:13cemerickI saw.
11:14cemerickstuartsierra: I'm not clear on what actually failed.
11:15stuartsierracemerick: "Authentication failed: The host was not known and was not accepted by the configuration: build.clojure.org"
11:15stuartsierrabut what does that mean ?
11:15cemerickright, that's what I mean, I don't understand that.
11:15cemerickstuartsierra: is this the first time you've tried deploying a snapshot to OSS for contrib?
11:16stuartsierraah
11:16stuartsierrawait
11:16stuartsierrathe top-level contrib POM has a <repository>
11:17cemerickShouldn't all of the deployments failed if that's the problem?
11:17stuartsierracemerick: no, because they inherit from modules/parent, not the top-level pom
11:17cemerickah
11:18cemerickstuartsierra: FYI, IIUC, the groupId must be org.clojure. That's what our creds have privs to release (perhaps that doesn't apply to snapshots).
11:19stuartsierraoh piffle
11:19stuartsierraThat probably means changing the artifactId of every module.
11:20cemerickstuartsierra: Maybe I'm wrong; but if so, then we'd be able to deploy releases of other projects' artifacts...
11:20stuartsierraright… unless it's a prefix match
11:20stuartsierradoubtless that's too much to hope for
11:21cemerickWe need to set up a dummy project for testing deployments and such. I've been using build.poms for that, but that's got to end.
11:21stuartsierraGood point.
11:21cemerickWe should set up a project and hudson job just for stuff like experimenting with groupId, etc.
11:22stuartsierraWith just enough code to test things like plugins and AOT-compilation.
11:24serp__how do I change a root binding? I want to set the root binding of *out* to the *out* in the current thread
11:25stuartsierra(doc alter-var-root)
11:25clojurebotDENIED
11:25cemerickstuartsierra: no parent defined in the top level POM
11:25stuartsierraserp__: well, alter-var-root is what you want
11:25cemerickDude, it's not your day. :-P
11:25stuartsierrayeah
11:25stuartsierraok
11:26cemerickThis is sorta water under the bridge at this point, but: why the separate parent pom, and not just point modules back at the top-level?
11:27stuartsierraNo big reason, seemed easier at the time.
11:27stuartsierraOk, take #279
11:34cemerickshazam
11:34stuartsierraThank you, ladies and gentlemen, I'll be here all week.
11:35stuartsierraN.B.: This is building on Clojure 1.2.0. Can't build on 1.3.0-master-SNAPSHOT because it's not deployed to OSS.
11:36cemerickright.
11:36cemerickOne thing at a time :-)
11:36cemerickstuartsierra: OK, contrib pom 0.2.0-SNAPSHOT has the clojure.jar system dep. It looks good here with my local nrepl checkout. See how it fares on your end.
11:36cemerickI'm going to be logging off of irc in ~20 min. Ping me on email if there's an issue. Look for that process writeup later today.
11:39stuartsierraWill do.
11:39stuartsierraHeading out to lunch in a few minutes myself.
11:44stuartsierracemerick: process writeup can go on the dev.clojure.org wiki
11:46cemerickstuartsierra: Of course.
11:53stuartsierracemerick: Can't build clojure-contrib with "mvn -Dclojure.jar ..."
11:53stuartsierra"ClassNotFoundException: clojure.lang.Compile"
11:53cemerickhrm
11:54serp__why is (alter-var-root *out* (constantly *out*)) wrong?
11:54stuartsierracemerick: Why <dependencyManagement> in the alternate profile?
11:55stuartsierraInstead of just <dependencies>
11:55stuartsierra?
11:55stuartsierraserp__: You need the Var #'*out*
11:55serp__aha..
11:56serp__ty
11:58stuartsierracemerick: This seems to work in the pom.contrib: https://gist.github.com/716954
12:01cemerickstuartsierra: yeah, that's better -- I'm actually more confused as to why it's working as-is for me locally.
12:02stuartsierrayeah, dunno
12:03stuartsierraTry running "mvn -Dclojure.jar=… clojure:repl" and see what version string it prinst out.
12:04cemerickas expected, 1.1 when I use that jar…
12:05cemerickanyway
12:05cemerickstuartsierra: dep mgmt eliminated on HEAD
12:06stuartsierraGot it, works for me.
12:09replacastuartsierra: did you see I made a couple of hacks to c.c.java-utils?
12:10stuartsierrareplaca: no, sorry
12:11replacastuartsierra: It wasn't loading right after file and as-str had been removed cause other stuff used them
12:11stuartsierraI'm just maintaining the build.
12:11stuartsierraI do not want to maintain everything else.
12:11replacastuartsierra: it seems obviously like the right thing to me, so I just went ahead and did it
12:11stuartsierraI actually want everything else to die as quickly as possible.
12:12replacastuartsierra: I second that. It's a bear now
12:12stuartsierraok, I really am going to lunch
12:12replacaenjoy!
12:26anonymouse89I'm having some trouble with clojure.xml/parse. The file I'm parsing does not have a root binding so xml/parse throws an exception. How do I get around this? Is there a way to concat InputStream's to add <root> and </root>?
14:31jweiss_what exactly are variables like *print-meta* (from clojure.core ns) that i can do set! on them. but it doesn't work for anything that i create using def or defvar.
14:31jweiss_,(set! (defvar x 1) 2)
14:31clojurebotjava.lang.Exception: Unable to resolve symbol: defvar in this context
14:32jweiss_,(set! (clojure.contrib.def/defvar x 1) 2)
14:32clojurebotDENIED
14:32jweiss_bah
14:37stuartsierraThose Vars are given thread-local bindings in the REPL
14:39jweiss_aha, that explains a lot
15:11stuartsierraBOOM: http://dev.clojure.org/jira/browse/CLJ-681
15:56joshua__How do I match just the first <div class="some_class"> with an enlive selector?
15:58raek(-> ... (select [:.some_class]) first) ?
16:00raekit might be possible to do that with just a selector, but I haven't looked very deepl into that yet
16:05hugodcemerick: you could always configure hudson jobs with pallet :)
16:06patrkrisHi folks. I've been out of the Clojure loop for a while. Tell me, has cake won over leiningen?
16:06maaclIs there a safe variant of read-string that will only read data (i.e. no function/macro calls)?
16:06Raynespatrkris: It hasn't 'won'. Leiningen is still very popular.
16:07Raynespatrkris: I don't think they're really competing for blood though.
16:07RaynesCake has grown quite a bit though, so I definitely suggest checking it out. I use it myself.
16:07patrkrisRaynes: I know. :) But I don't know what to choose. Maybe it doesn't matter much.
16:08RaynesIt's really down to which feature set you like more. Just check out the READMEs and you should be able to make an informed decision.
16:09stuartsierraAnd then switch to Maven when you need it.
16:09patrkrisRaynes: Thanks. You wouldn't happen to know about a 'repository' of cake task libraries?
16:09joshua__I figured your way would work raek, but it felt wrong for there not to be built in support for it. Turns out there was. This works as I wanted: (def *project-selector* [[:.project html/first-child]])
16:09joshua__html being enlive-htim :as html
16:12raekah, so it matches every element with the project class that is the first of its kind which among other project class sibling elements?
16:12raekmy code snipped would select the first element with the project class that occurs in the document
16:37maaclIs there a safe variant of read-string that will only read data structures?
16:40joshua__Is there a difference?
16:41raekjoshua__: maacl's question or mine?
16:42raekmaacl: you can disable the #= reader macro by rebinding *read-eval*
16:42raekmaacl: (defn safe-read-string [s] (binding [*read-eval* false] (read-string s)))
16:42joshua__yours
16:42raekok
16:43maaclah - thanks raek
16:43raekif element E1 and E2 has E3 as their parent element, then first-child will only select E1 in that case
16:44raekbut if E1 and E2 are not siblings, both will be selected, I tihnk
16:45joshua__<project 1><project 2></project 2><project 3></project 3></project 1> would have my code select project 2?
16:47raekI think so, but I haven't tested it
16:47raekshould be fairly easy to test... one moment please...
16:47joshua__I'll test it right now and get back to you. Going to test it using w3schools.
16:49LOPP#= ?
16:49joshua__Looks like it is selecting project 1.
16:50serp__I want to append sequences to eachother, but I can't find the function append.. am I doing this wrong?
16:51joshua__Well, it looks like it is selecting all three of them with how css selectors work.
16:51joshua__since the first one contains the other two.
16:52LOPPwhat's #=
16:54joshua__Should be able to select sub-projects with something like [[:.project first-child :.project first-child]] if it maps back to css selectors, but I haven't tested it. If you ended up seeing something different let me know.
16:55joshua__Everything is working for me now though.
16:57joshua__`(find-doc "#=")
16:59joshua__Came up with something about how it is the EvalReader.
17:00dmart_#=(Integer. 12)
17:00dmart_&(Integer. 12)
17:00sexpbot⟹ 12
17:00dmart_it evals the stuff after the #=
17:00dmart_s/stuff/form/ I guess?
17:02LOPP&(doc read-string)
17:02sexpbot⟹ "([s]); Reads one object from the string s"
17:02stuartsierra#= does read-time evaluation
17:03LOPPreally?
17:03LOPPhow is that useful?
17:03stuartsierrain rare cases for data serialization
17:03dmart_I've found it useful for quick serialization / reading back
17:05dmart_&(str "#=(java.util.Date. \"" (.toString (java.util.Date.)) "\")")
17:05sexpbot⟹ "#=(java.util.Date. \"Fri Nov 26 14:05:29 PST 2010\")"
17:05LOPPok, what now?
17:06dmart_if you passed that string to read-string in with read-eval true, you'd get a new Date object equal to the one printed out
17:07LOPPso read-string evals the string?
17:08dmart_well, type it in the repl and see what happens
17:08dmart_read-string is sort of analogous to eval in javascript I guess?
17:09dmart_if that helps
17:10patrkrisRaynes: is it possible to have the non-dev dependencies in the class path when invoking a custom task?
17:13Raynespatrkris: re cake task libraries: There is a list of plugins in the wiki on the cake github page. re non-dev dependencies: that is what bake is for, if I understand your question properly.
17:13patrkrisRaynes: Thanks. I'll take a look at bake.
17:19patrkrisRaynes: I looked through the wiki but didn't find an explanation of bake. Is it available anywhere?
17:21patrkrisRaynes: Ah... it's just using bake inside your task? I'll give it a try.
18:54jjido_can you generate a not-so-random sequence of numbers? i.e. a sequence that looks random but is partially sorted.
19:02jjido_,(letfn [(shuffle [s] (flatten (swap (split s (int (rand (count s)))))))] (shuffle [1 2 3 4 5 6]))
19:02clojurebotjava.lang.Exception: Unable to resolve symbol: swap in this context
19:03jjido_,(letfn [(shuffle [s] (flatten (reverse (split s (int (rand (count s)))))))] (shuffle [1 2 3 4 5 6]))
19:03clojurebotjava.lang.Exception: Unable to resolve symbol: split in this context
19:03jjido_,(letfn [(shuffle [s] (flatten (reverse (split-at s (int (rand (count s)))))))] (shuffle [1 2 3 4 5 6]))
19:03clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
19:03jjido_,(letfn [(shuffle [s] (flatten (reverse (split-at (int (rand (count s))) s))))] (shuffle [1 2 3 4 5 6]))
19:03clojurebot(3 4 5 6 1 2)
19:03jjido_,(letfn [(shuffle [s] (flatten (reverse (split-at (int (rand (count s))) s))))] (shuffle [1 2 3 4 5 6]))
19:03clojurebot(2 3 4 5 6 1)
19:04jjido_,(letfn [(shuffle [s] (flatten (reverse (split-at (int (rand (count s))) s))))] (shuffle (range 10)))
19:04clojurebot(5 6 7 8 9 0 1 2 3 4)
19:05jjido_how do I repeat that n times on the result?
19:07jjido_,(letfn [(shuffle [s _] (flatten (reverse (split-at (int (rand (count s))) s))))] (reduce (partial shuffle (range 10)) (range 3))
19:07clojurebotEOF while reading
19:07jjido_,(letfn [(shuffle [s _] (flatten (reverse (split-at (int (rand (count s))) s))))] (reduce (partial shuffle (range 10)) (range 3)))
19:07clojurebotjava.lang.IllegalArgumentException: Wrong number of args (3) passed to: sandbox$eval724$shuffle
19:08jjido_,(doc reduce)
19:08clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item...
19:08raekjjido_: in what way should it be random and sorted?
19:08jjido_raek: I am not very particular...
19:10jjido_,(letfn [(shuffle [s _] (flatten (reverse (split-at (int (rand (count s))) s))))] (reduce (partial shuffle) (range 10) (range 3)))
19:10clojurebotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$partial
19:10jjido_,(letfn [(shuffle [s _] (flatten (reverse (split-at (int (rand (count s))) s))))] (reduce shuffle (range 10) (range 3)))
19:10clojurebot(3 4 5 6 7 8 9 0 1 2)
19:11jjido_,(letfn [(shuffle [s _] (flatten (reverse (split-at (int (rand (count s))) s))))] (reduce shuffle (range 10) (range 3)))
19:11clojurebot(3 4 5 6 7 8 9 0 1 2)
19:12raekjjido_: also, there is a rand-int function
19:12jjido_raek: thanks
19:13Raynes&(sort (repeatedly 30 #(rand-int 10000000)))
19:13sexpbot⟹ (38797 128400 1347904 1415320 1583404 1589076 1676210 1777652 2381785 2512796 2552871 3177841 4076783 4195345 4439859 4894263 5045857 5247199 5491817 5519674 5768961 5826224 5864209 6255536 8033027 8782210 8935694 9001985 9481409 9584555)
19:13jjido_Raynes: nope that is much too sorted
19:13RaynesI have no clue what you're asking for anyway. ;p
19:14raek,(let [[l r] ((juxt take drop) 3 (range 10))] (concat r l))
19:14clojurebot(3 4 5 6 7 8 9 0 1 2)
19:15jjido_raek: that is cleaner
19:15raek,(let [[l r] (split-at 3 (range 10))] (concat r l))
19:15clojurebot(3 4 5 6 7 8 9 0 1 2)
19:15raekeven better.
19:16raek(although, in the other example I got to use juxt)
19:16jjido_and for the repeat?
19:16jjido_I want to shuffle again
19:18slyrus_so... any good blog posts on migrating one's code to clojure 1.3?
19:18raek(letfn [(random-swap [coll] (let [[l r] (split-at (random-int (count coll) coll)] (concat r l)))] (nth (iterate random-swap (range 20)) 5))
19:18raek,(letfn [(random-swap [coll] (let [[l r] (split-at (random-int (count coll) coll)] (concat r l)))] (nth (iterate random-swap (range 20)) 5))
19:18clojurebotUnmatched delimiter: ]
19:19raek,(letfn [(random-swap [coll] (let [[l r] (split-at (random-int (count coll) coll))] (concat r l)))] (nth (iterate random-swap (range 20)) 5))
19:19clojurebotjava.lang.Exception: Unable to resolve symbol: random-int in this context
19:19raek,(letfn [(random-swap [coll] (let [[l r] (split-at (rand-int (count coll) coll))] (concat r l)))] (nth (iterate random-swap (range 20)) 5))
19:19clojurebotjava.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$rand-int
19:19raek,(letfn [(random-swap [coll] (let [[l r] (split-at (rand-int (count coll)) coll)] (concat r l)))] (nth (iterate random-swap (range 20)) 5))
19:19clojurebot(4 5 6 7 8 9 10 11 12 13 ...)
19:21raekjjido_: ^^
19:21jjido_raek: great!
19:24jjido_huh, I need to mix in something else. The swaps tend to cancel each other quickly
19:24raekhow curious... the swap parts operation is only "rolling" the sequence
19:25raekand the composition of two of those could be seen as one "swap"
19:25jjido_when playing cards I also interleave to shuffle
19:25raekif you think of the sequence as a ring, then the sorted order will never be broken (except of the 20 -> 0 discontinouity...)
19:26jjido_yes
19:26raekwhat you go here would be something that is know as a "Norwegian shuffle" in Sweden.
19:27jjido_can't be good ;) ;)
19:27raekmost probably, it is known as a "Swedish shuffle" in Norway too :-)
19:28raekanyway, if you modify the swap code to reverse on of the halves, it would randomize it a bit more
19:28jjido_yes I just tried that
19:28raek(concat r l) -> (concat r (reverse l))
19:36jjido_Oh well... That was to test a sorting algorithm. My optimisation does not help much more with partially sorted data as compared to random. Kind of bad.
19:45slyrus_technomancy: around?
19:54raekdoes someone recall how to make swank-clojure listen for only one connection and then stop listening?
19:55Raynesraek: Doesn't not passing dont-close do that? However, that would be the default.
19:57raekno, but it used to, I think...
19:57raeknow I can connect to the same port multiple times
19:57raek(and to my friend's swank server too)
19:58raeksince I'm not alone on my server, I thought it might be time to tighten up the security...
19:59raekhrm... is there any stop-repl fn in swank-clojure?
20:08raekthe source of the current version of swank-clojure does not contain "dont-close" at all... :/
20:13slyrus_,(case nil nil 3)
20:13clojurebotjava.lang.NullPointerException
20:14slyrus_huh?
20:21raek,(case nil 1 2)
20:21clojurebotjava.lang.IllegalArgumentException: No matching clause:
20:21raekweird
20:27slyrus_seems bogus to me
20:33joshua__I have a question.
20:34joshua__Is this comic (http://xkcd.com/627/) appropriate for even questions asked to the people of this channel?
21:08mister_roboto~seen cermick
21:08clojurebotHuh?
21:15Raynes$seen cemerick
21:15sexpbotcemerick was last seen quitting 4 days and 2 hours ago.
21:20KirinDaveDamn, why hasn't anyone told me about lamina?
21:20KirinDaveThis is pretty cool.
21:46jimdagemhi
21:49replacaKirinDave: I think's Zach has been discussing it on Jira
21:49KirinDaveIt's pretty neat.
21:49KirinDaveAnd gloss is something I was writing awhile ago but never finished, for plt-scheme.
21:49KirinDaveVery useful.
21:49replacathe boy's on a roll :)
21:53KirinDaveThank you so much, clojurebot
21:53replacahiredman: you here?
21:54jimdagemis clojurebot written in clojure?
21:54replacaIt seems to have started doing that when someone (or at least me) checks something into contrib
21:54replacajimdagem: yup
21:54replacajimdagem: https://github.com/hiredman/clojurebot
21:57RaynesNo way. It's written in Haskell, of course.
21:58jimdagemlol
21:58Raynes$botsnack
21:58sexpbotRaynes: Thanks! Om nom nom!!
21:59jimdagemcan anyone provide or direct me to a good compare-and-contrast of Haskell and Clojure?
22:19Rayneswooby: This keyboard is fantastic. <3
22:20danlarkinwhich keyboard?
22:21RaynesDas ultimate.
22:21RaynesHe gave me one at the conj.
22:21RaynesI switched to it last night. Used to use the same keyboard you use, iirc. MS ergo 4000?
22:22danlarkinmoving past the weirdness of you knowing which keyboard I use, yes
22:23RaynesThe reason I wanted to try a Das is because of your discussion with technomancy and others a couple of months ago. Just happened to remember.
22:24danlarkinI enjoy the split
22:24RaynesYeah, the split was always nice.
22:33_atothe Das is great, I use it as well
22:36_atoI can't use ergonomics, I never learned to type in the "proper" way. I type fast and without looking, just I inevitably end up trying to reach across the split
22:36Raynes_ato: I always did that with my other keyboard!
22:37RaynesI'm a two-three finger typer. Never learned to type properly.
22:37RaynesNot counting my thumb.
22:37leifwif I didn't bring my laptop everywhere and move it around my house all the time, I'd still be using the kinesis I got a few years back
22:37leifwthose things are fantastic
22:38_atoI'm a full five fingeer typist, but just learnt by typing a heck of a lot rather than by doing formal lessons
22:38leifwbut you have to be a traditional typist for it to make sense
22:38RaynesIt looks neat. Not sure I'd be able to tolerate it.
22:38leifwthe main nice bit is that it brings all the pinky keys to the thumb
22:38leifwwhich is particularly good for emacs
22:39Raynes_ato: Well, so am I, if you count hitting the 'enter' key with my pinky. ;)
22:40RaynesAnd, of course, capslock which is control.
22:44_atoyeah, I do the capslock control thing as well. My brother actually swaps caps-lock and backspace, hits control with his palm (which doesn't usually work too well on a laptop)
22:45_atoso if I use his computer inevitably end up deleting everything I'm trying to work on :p
22:45hippiehunterwhat is the correct order for accessing a field in a map/record/whatever, (:field instance) or (instance :field) ? it looks to my noob eyes like both work but I'm sure there is a preferred way
22:46hippiehunteralso das ultimate S ftw
22:47_atohippiehunter: (:field instance) has the benefit of working when instance is nil
22:47hippiehunterdoes it just return nil as a result?
22:47_atoyep
22:48_atohehe, I guess other people might say that (instance :field) has the benefit of barfing when instance is nil :p
22:56hippiehunteris try catch the best way to interact with java exceptions from clojure?
23:03_atohippiehunter: yes
23:15hippiehunteris there a better way to debug in clojure (aside from just not making bugs)? I'm using netbeans and enclojure and the breakpoint fidelity is very low. I seem to be able to step on/break on about 1/4 of the lines
23:25leifwdunno, I usually just use a repl and this macro:
23:25leifw(defmacro dbg
23:25leifw [x]
23:25leifw `(let [x# ~x]
23:25leifw (binding [*out* *err*] (println '~x "=" x#))
23:25leifw x#))
23:26leifw
23:26leifwsorry about the big paste
23:26leifwforgot whose blog I got that from but it's nice
23:32_atohippiehunter: see also: http://stackoverflow.com/questions/2352020/debugging-in-clojure
23:46hippiehunteras far as I can tell, dotrace doesnt interact well with jetty could just be that I'm using it wrong though
23:47hippiehunternever mind I figured it out
23:56ossarehanyone done much with hiccup? I've a loop which returns two nodes which are at the same level in the DOM as eachother and I'm struggling to understand how this should be returned.
23:56ossareh(for [data data-list]
23:57ossareh(do [:tr [:td (:msg data)]] [:tr [:td (:othermsg data)]]))
23:57ossarehnaturally that only returns the last <tr/>
23:57ossarehand I'm stumped on how to get both back.
23:58_mstmaybe try replacing "do" with "list"?
23:58_mstI think lists get automatically flattened (although it's been a little while since I used hiccup)
23:59ossarehnailed it _mst !
23:59ossarehthanks
23:59ossarehclojurebot: give _mst props