#clojure log - Sep 16 2012

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

0:07 abaranosky: Could any of you poin me in the right direction regarding this exception I'm seeing?

0:08 => Caused by: java.lang.IllegalArgumentException: No single method: single_val_error of interface: clj_schema.validation.ErrorReporter found for function: single-val-error of protocol: ErrorReporter

0:08 googling the exception didn't give me anything

0:10 tomoj: clojure.data extends protocols to interfaces

0:10 java.util.{Map,List,Set}

0:11 how might this be translated to cljs?

0:11 naive way is to extend the protocol to every known implementation of IMap, ISequential, and ISet

0:12 S11001001: abaranosky: it's difficult to say without more context

0:13 Sgeo: Quick question: What is the difference between importing a class and using only the class?

0:13 use'ing :only

0:13 abaranosky: S11001001: I just wrote a defprotocol w/ one implementer, one method is called single-val-error

0:14 akhudek: Sgeo: can you elaborate on what you mean by importing a class?

0:14 S11001001: Sgeo: the former means something :)

0:14 Sgeo: (import 'some.package.SomeClass)

0:14 abaranosky: I found something: http://dev.clojure.org/jira/browse/CLJ-735

0:14 Sgeo: vs (use '[some.package :only Class]) ; if I got the usage right

0:15 akhudek: Sgeo: I wasn't aware that you could use the "use" form to import java classes. I've always just used import.

0:15 S11001001: Sgeo: you can't clojure.core/use classes; use is for ns bindings

0:16 sometimes there are associated ns bindings like with protocols

0:16 Sgeo: So Clojure doesn't consider a Java class to be in a package .. namespace... blah

0:16 Is this like the difference between fns and methods?

0:16 S11001001: Sgeo: clojure nses are totally separate from the java packages

0:17 Sgeo: But couldn't I use a class like some.package/Class?

0:17 S11001001: no

0:17 Sgeo: Which looks like some.package/something

0:17 Oh

0:17 * Sgeo headpains

0:18 S11001001: it's better this way

0:18 abaranosky: found my issue: when I refactored to a protocl-based design, I missed one fn call, and forgot to change the args passed -- the error message is indeed criptic

0:18 Sgeo: How can you use a class without importing it

0:18 ?

0:18 S11001001: Sgeo: put a top-level (Class/forName "...") before your references in the .clj file

0:19 Sgeo: O.O

0:19 S11001001: you could also have all the imports in another module which you require

0:20 Sgeo: Why can't I just refer to it in a fully qualified way if I've required the package?

0:20 S11001001: since the goal here is to get the classloader to wake up the relevant classes without adding ns entries for yourself

0:20 Sgeo: you didn't require "the package"; nses are not java packages

0:20 java packages don't really exist outside package-visibility terms, if you look at the vm and java.* apis

0:21 now, if, as a consequence of :require-ing a ns, you know that a classload will be implied (such as if the class is from a deftype in said module), then it's safe to make a fully-qualified reference

0:22 but if you're deftype-ing, you should already be able to access the class as an ns entry, as deftype is defined to add a public ns entry that just so happens to have the relevant class as the value

0:23 Sgeo: "relevant class as the value"

0:23 I thought the . form looks at the literal name given?

0:23 S11001001: . operates in fairyland

0:23 Sgeo: ??

0:23 lazybot: Sgeo: Uh, no. Why would you even ask?

0:23 S11001001: ,(do (deftype blahblah []) (class blahblah))

0:23 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

0:23 S11001001: hah

0:23 anyway

0:24 Sgeo: lazybot, are you good at your job??

0:24 lazybot: Sgeo: Uh, no. Why would you even ask?

0:27 amalloy: S11001001: Class/forName to load a deftype seems perverse. it will work in exactly the cases where an ordinary (fully-qualified) reference to it would, i think

0:27 S11001001: amalloy: I didn't suggest that

0:28 tomoj: why does (cljs.analyzer/analyze-file "cljs/core.cljs") return nil?

0:28 Sgeo: If I Class/forName a Java class, how do I refer to it?

0:29 Can I do a fully-qualified thing then?

0:29 S11001001: Sgeo: yes

0:29 amalloy: then i don't understand "put a top-level (Class/forName "...") before your references in the .clj file", or the thing after it about putting imports in another module

0:29 S11001001: amalloy: that's for the case where there isn't a related deftype

0:30 I don't know which situation Sgeo is in

0:30 Sgeo: S11001001, the situation of trying to fully understand the difference between all these functions and how they work together

0:31 amalloy: S11001001: (Class/forName "x.y.Z") is literally not ever any better than x.y.Z, except in the case where you have the class available at runtime but not at compile time. since those are basically the same in clojure, this is very rare

0:31 Sgeo: amalloy, what about for the side-effect of bringing in x.y.Z?

0:31 S11001001: amalloy: merely referencing the class x.y.Z doesn't necessarily imply a load of it

0:31 s,load,classload,

0:32 this isn't typically observable in java.*, but crops up with third-party java libs

0:33 amalloy: S11001001: evidence or source? as far as i know, if you have a handle to a Class object, which is what x.y.Z resolves to, the class has been loaded

0:34 in java projects, this sort of Class/forName is used mainly for a sort of dynamic linking, so that you can get at runtime a class you didn't know about at compile time

0:41 S11001001: amalloy: ho hum. My source is me, running into side-effecty :import in the past, which I can't reproduce (at least in 1.4.0). So I guess Sgeo go with amalloy's suggestion of referencing the fqn to load

0:57 aperiodic: in clojure code, a naked fully unqualified java class reference will result in the class being loaded. source: me needing to use a Class/forName to get around not having a class that was being gen-classed in a different namespace that was being compiled later

1:01 amalloy: fully unqualified! that sounds exciting

1:10 Raynes: amalloy: What about the naked part?

1:10 aperiodic: heh

1:10 fully qualified

1:11 it's saturday night, guys. #clojure after-hours

1:11 mpan: funny that, I just got followed by a drunk stranger most of the way home

1:12 nice timing of you to mention that

1:13 aperiodic: protip: don't leave your house

1:14 it's totally overrated and stuff

1:14 uvtc: aperiodic: Maybe not even safe there! : http://xkcd.com/742/

1:15 mpan: ah the joys of a campus full of alcoholics

1:30 akhudek: does wrap-reload now work with compound routes of routes?

1:30 err not work

1:33 damn, it seems not

1:44 this is actually sort of surprising

1:45 do people who use compojure with bigger nested routes not use wrap-reload during development?

1:47 mpan: where's a recent list of examples of clojure being used in production?

1:47 I recall there was one from a year ago, but anything newer?

1:48 akhudek: mpan: not that I know of, maybe someone else know though

1:49 twitter and prismatic are two though

1:49 mpan: google isn't showing anything tech related for "prismatic company"

1:49 and twitter uses pretty much everything these days, right?

1:50 akhudek: http://getprismatic.com/

1:50 there are some other clojure based startups too

1:50 mpan: shiny

1:52 akhudek: http://lonocloud.com/

1:53 mpan: so like, which parts of their system do these types of companies usually write in clj?

1:54 akhudek: prismatic has some blog posts about their usage

1:54 seems like they use it for nearly everything

1:54 even high performance machine learning algorithms via macros and low level java arrays

2:09 aperiodic: we're a still-in-beta startup (have a seed round) that uses clojure for roughly 2/3rds of our backend http://luckysort.com/

2:10 mpan: oh cool

2:10 is your web frontend also clojure?

2:11 aperiodic: no, that's all js

2:11 we have a js wizard

2:11 he's great

2:11 there's a decent page about it on the clojure dev wiki: http://dev.clojure.org/display/community/Clojure+Success+Stories

2:12 akhudek: aperiodic: that looks like a neat product and good team!

2:13 mpan: cool, thank you!

2:13 aperiodic: i'm using cljs a little on the side (https://github.com/aperiodic/c2-cljs-examples so far), but no production experience with that, really

2:15 akhudek: thanks!

2:36 _ulises: morning all

2:36 mpan: hello

2:37 Sgeo: It would be nice if we had a bot that would let us play with macros

2:38 ,(do (use 'clojure.template) (macroexpand-1 '(do-template [a b] (+ a b) 1 2 3 4)))

2:38 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

2:38 Sgeo: &(do (use 'clojure.template) (macroexpand-1 '(do-template [a b] (+ a b) 1 2 3 4)))

2:38 lazybot: ⇒ (do (+ 1 2) (+ 3 4))

2:38 Sgeo: ,(+ 1 1)

2:38 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

2:38 Sgeo: Who broke clojurebot and how?

2:38 mpan: that error looks oddly familiar

2:39 for future reference, what does it mean?

2:50 l1x: hey

2:51 how can i iterate over this map {0 [1 2 3], 1 [2 3 4], 2 [5 6 7]} i am trying to decompose it but no success :(

2:52 i just would like to do some ruby .each like stuff where i can access the key and the value as well

2:55 mpan: you can use map

2:55 map will get you a seq of 2-vectors containing key, val

2:56 l1x: like?

2:56 mpan: &(map pprint {0 [1 2 3], 1 [2 3 4], 2 [5 6 7]})

2:56 l1x: this is not what i want

2:56 i need the keys and the values

2:57 mpan: that's (indirectly) what you want

2:57 if you need the individual values, do destructuring or indexing

2:58 l1x: this was my question, how to decompose (destruct) the nested map

2:58 Sgeo: l1x, are you hoping to produce a value or do side-effects?

2:58 mpan: ah ok, so there's two steps

2:58 map gets you each of the pairs, and then you destructure the pairs w/ let or similar

2:58 l1x: Sgeo: no just count the elements in the vectors

2:59 mpan: yep, i am just not sure how

2:59 Sgeo: &(let [[a b] [:key "val"]] (str "key: " a " val: " b))

2:59 ..

2:59 mpan: http://clojure.org/special_forms look under the section on let

2:59 the bot got netsplit :(

2:59 Sgeo: Oh

2:59 scottj: (map (fn [[k v]] [k (count v)]) {0 [1 2 3] 1 [2 3]}) => ([0 3] [1 2])

3:00 mpan: like let and other binding forms let you do that sort of destructuring

3:00 l1x: mpan: thanks

3:01 perfect

4:40 _ulises: to all functional gurus here, how would you implement the concept of nil using functions? would it be a function that takes an arbitrary number of parameters and does nothing?

4:41 this is in reference to my church-numerals FizzBuzz I posted a few days ago; I'm now implementing hashtables and, of course, it gets tricky when you want to GET the value for a key and the key is not in the table

4:57 amalloy: _ulises: that wouldn't inspire me to invent nil

4:58 (get m k (fn [v] ...) (fn [not-found] ...)) is sufficient, right?

4:58 _ulises: amalloy: I'm now wondering if I should be returning something else instead of nil when the key does not exist

4:58 amalloy: ah, see, I'm trying to only use and return functions everywhere

4:59 amalloy: i'm aware

5:00 instead of returning either the map's value (some function), or a function that somehow represents nil, instead ask the caller to pass you two continuations: one to be called with the value if there is one, and one to be called if no value is present for that key

5:00 _ulises: ah, gotcha

5:01 I was now toying with the idea of returning EMPTY when the key doesn't exist, and (key value) otherwise

5:01 then you're representing nil with EMPTY and can check with EMPTY?

5:01 amalloy: i don't know if that's the usual way to handle this in lambda calculus, but it seems as reasonable as anything else

5:01 _ulises: what I've seen so far is that NIL is equated to the EMPTY LIST

5:01 which is unfortunate

5:02 thanks for the suggestion though, I'll definitely try it

5:02 amalloy: i haven't studied church numerals at all, but it seems like the way you encode numbers makes it different to invent a separate nil value without conflicting with, say, zero

5:03 _ulises: I reckon you can't without clashing with anything else in the language

5:03 amalloy: _ulises: yeah, i really enjoyed the Programming With Nothing post, and i was happy to see you'd ported it to clojure

5:03 _ulises: what I've seen is that it generally clashes with the empty list; this is somewhat not that unfortunate since that means you can conj items to NIL as well as EMPTY

5:04 amalloy: yeah, it's a fun exercise and I'm now seeing how far I can push it

5:04 amalloy: all the way to infinity, guaranteed

5:04 _ulises: excellent then! I shall be entertained ad-infinitum

5:04 mpan: is this why some dialects intentionally have nil as empty-list?

5:05 _ulises: mpan: no idea, perhaps?

5:08 amalloy: probably it's nice to have a small number of primitive types

5:08 if the empty list is falsey, you don't need booleans or a separate nil type

5:24 _ulises: yikes, this is getting ugly

5:37 oh, hum, here's another one. I'm using lists as a backend for hashtables. I'm storing key-value pairs as a pair (k v) inside a node in a the list. Of course this has horrible performance, but I'm not caring about this right now.

5:41 the question is: PUT will CONJ to the list, effectively overriding already existing keys, which is fine, however the way REMOVE has been implemented, it'll return a new hashtable (a LIST) with the first pair that matches the key removed. That is fine, except that the new list is reversed in the process of removing the matching key-value pair.

5:41 this is of course, wrong, since the reversing of entries means that older values for the same key will override newer values.

5:42 I see 2 solutions here: 1) reverse the new LIST before returning it in REMOVE or 2) REMOVEing the key inside PUT before putting the new value for the key

5:42 I'm taking votes/accepting feedback at this stage

5:44 pistolpete: question: I'm trying to compare a keyword value to a value that I'm trying to pull out of a map (one of the keys)...but I'm confused by its behavior.

5:45 (def testmap {:buildings {:1 {:apartment-building {}}, :2 {:apartment-building {}}, :3 {:apartment-building {}}}} )

5:45 (keys testy) ;; => (:buildings)

5:45 (first (keys testmap)) ;; => :buildings


5:45 (contains? (keys testmap) :buildings) ;; => false...why?

5:46 _ulises: ,(doc contains?)

5:46 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

5:46 _ulises: ,(doc keys)

5:46 clojurebot: "([map]); Returns a sequence of the map's keys."

5:47 _ulises: pistolpete: contains? will check the presence of a key in a collection, not the value.

5:47 ,(contains? [1 1 1] 2)

5:47 clojurebot: true

5:47 _ulises: perhaps you could wrap keys in a set?

5:47 pistolpete: d'oh, thanks. I'll have to change how I'm thinking about this data.

5:47 _ulises: ,(contains? (set (keys {:foo "" :bar ""})) :foo)

5:47 clojurebot: true

5:48 _ulises: ,(contains? (keys {:foo "" :bar ""}) :foo)

5:48 clojurebot: false

5:48 _ulises: there.

5:48 pistolpete: sweet! That's the solution. Thank you!!

5:48 _ulises: pistolpete: no worries; contains? is the source of confusion to many (including myself)

5:48 pistolpete: I've seen the question and the answer so many times that now I remember :)

5:50 pistolpete: _ulises: hah, thanks. I need to make sure to remember that; most of my datastructures are maps

5:50 tomoj: &(contains? {:foo "" :bar ""} :foo)

5:50 lazybot: ⇒ true

5:50 pistolpete: &(println test)

5:50 lazybot: ⇒ #<core$test clojure.core$test@168be30> nil

5:50 pistolpete: oops

5:53 _ulises: tomoj: +1

7:18 aperiodic: (inc tomoj) ; FYI, _ulises

7:18 lazybot: ⇒ 3

7:26 aperiodic: lazybot: logs?

7:26 clojurebot: logs?

7:26 clojurebot: logs is http://clojure-log.n01se.net/

8:05 hyPiRion: Is there any specific reason 'keep' doesn't take more than one collection as input?

8:06 it's bugging me, as I kind of need that functionality.

8:32 luxbock: is there a way for me to disable *nREPL error* from popping up on Emacs when nREPL raises an exception? I would be alright with getting all of that information in the background without having to close that buffer every time

8:35 polycosm: hyPiRion: why don't you use a map to do that ?

8:37 (just trying to understand what you mean)

8:39 ,(map (partial keep #(if (odd? %) %)) [(range 1 10) (range 10 20)])

8:39 clojurebot: ((1 3 5 7 9) (11 13 15 17 19))

8:39 hyPiRion: polycosm: I can use (remove nil? (map f c1 c2)), but why can't I just use (keep f c1 c2)

8:39 What I'm basically asking, is why keep is limited to one collection only.

8:43 augustl: http://stackoverflow.com/questions/12443236 - feel free to chip in.. Trying to figure out how to be able to execute a "python" process when the python scripts are packaged in a .jar file (resoufces) and isn't available directly on the file system

8:49 polycosm: hyPiRion: you can't use multiple cols with filter either, do yo

8:49 should it also be possible ?

8:54 hyPiRion: polycosm: Well, for filter and remove, there's not much semantics in what you should return then (the first collection? all of them?). keep, on the other hand, will always return the computed value if it's non-nil.

8:57 nz-: how do I set the clojurescript version with lein-cljsbuild?

9:57 elliottw: morning all

9:58 quick question: how do i turn a string into a symbol name (more specifically a function name)?

9:59 i've tried things like (defn do-stuff [] "stuff!") (def data "do-stuff") (resolve (symbol data) but that doesn't seem to work

10:00 polycosm: ((load-string "f") args) ?

10:01 elliottw: polycosm jesus, i've been searching all over

10:01 thanks, sorry for the noob-ish question

10:01 polycosm: but that looks so unsafe

10:01 elliottw: polycosm lol

10:02 so what i'm trying to do is pass a bunch of function names as strings in noir from one page to another

10:02 each function just takes in a few arguments and returns html (via hiccup)

10:02 so to assemble a page, i just have a list of function names with args

10:04 polycosm: I don't know the specifics of noir and clojure stuffs but in any other language you probably shouldn't do that (anyone, please correct me if I'm wrong)

10:05 rcg: polycosm, because it is actually unsafe...

10:05 you are opening a barns door for injection attacks that way

10:05 imho

10:05 elliottw: i kind of thought this lisp thing was all about passing function names as args, it's just that in this case, it seems hard to pass funciton names between webpages

10:06 rcg: btw. i was just referring to using "load-string"

10:06 polycosm: why do you need to pass functions between webpages ?

10:07 elliottw: well i don't. it just seemed like the easiest thing to do. i have a bunch of functions that produce html. the input from one page will determine which functions should be run to product the html, so why not just pass a list of functions

10:08 each function has a form when called with zero args, and result html when called with args

10:09 so i can basically call a function with zero args, gather that data and call the function with the args someplace else

10:13 * Hodapp ponders the notion of how only side effects, not necessarily functions, can cause the problems discussed... with the exception of maybe code that never terminates, and ties up a CPU.

10:18 no7hing: i have troubles grokking this, but is there a post etc. out there that describes the route from multimethods to protocols?

10:19 -but

10:20 nz-: clojurebot: logs?

10:20 clojurebot: logs is http://clojure-log.n01se.net/

10:25 sandbags: Hi guys. Does anyone know how I can use 'apply' with 'and'. I looked up one trick for using macros here #(and %) but it doesn't seem to work with 'and'

10:27 or is there an alternative to 'apply' that is macro-safe?

10:27 duck1123: ,(reduce #(and %1 %2) [true true false])

10:27 clojurebot: false

10:27 Hodapp: okay, I really wish I could edit Clojure code in Eclipse without pegging the CPU usage so much that, for instance, I can't repeat a key as fast as elsewhere in the system.

10:28 sandbags: duck1123: yes that works if you have a fixed number of parameters to and

10:28 duck1123: but not in the general case

10:28 Hodapp: what in God's name is it doing?

10:28 sandbags: duck1123: well, either that or you're above my pay grade

10:28 duck1123: sandbags: reduce will take them 2 at a time though

10:28 sandbags: oic

10:29 nice bit of lateral thinking there

10:31 seems a bit of a weakness that you can't use a macro here

10:32 is 'and' a macro to allow for short-circuiting?

10:32 duck1123: yes

10:33 otherwise, the second clause would be evaled before it was sent to and

10:33 sandbags: yep

10:35 duck1123: what's the , at the start of your expression doing? I've just looked up Clojure syntax and can't see a comma pattern

10:35 gfredericks: clojurebot?

10:35 clojurebot: clojurebot is amazing

10:35 duck1123: The comma is for the bot, and only used here

10:35 gfredericks: commas are whitespace

10:36 ,,,[,,,,8,,,7,,,5,,4,,],,,,

10:36 clojurebot: [8 7 5 4]

10:36 sandbags: oh, neat :)

10:36 duck1123: ,(println "hello, I'm a bot")

10:36 clojurebot: hello, I'm a bot

10:36 duck1123: &(println "so am I")

10:36 lazybot: ⇒ so am I nil

10:36 sandbags: i didn't grok that clojurebot had evaluated your expression

10:36 that's very neat

10:37 gfredericks: sandbags: the macro has to know its arguments at compile-time

10:38 sandbags: this is part of why people avoid needless macros

10:39 sandbags: yes, it kind of breaks the fourth wall

10:40 ivaraasen: &(println "I have become")

10:40 lazybot: ⇒ I have become nil

10:40 ivaraasen: destroyer of worlds.

10:41 Hodapp: but how much do compile-time and run-time differ in Clojure?

10:41 gfredericks: significantly from a macro's perspective

10:41 Scriptor: Hodapp: in what sense?

10:41 Hodapp: hmmm

10:41 gfredericks: at macro-expand time the code is still an s-exp data structure

10:41 at runtime it is bytecode

10:41 duck1123: in compile time, you don't have any of the runtime data. Your data is clojure code

10:42 gfredericks: that part too

10:42 you don't know what the "value" of the arguments is

10:42 just what they look like

10:42 ,(macroexpand-1 '(and foo bar baz))

10:42 clojurebot: (clojure.core/let [and__2241__auto__ foo] (if and__2241__auto__ (clojure.core/and bar baz) and__2241__auto__))

10:42 sandbags: so https://gist.github.com/7529c04e8836fe88b4d8 is my solution to writing a prefix function, any comments about style? Or a more idiomatic approach?

10:43 duck1123: wouldn't this be a job for reducers?

10:44 sandbags: (I'm starting to read Brian Marick's book Functional Programming for the Object-Oriented Programmer

10:45 Scriptor: sandbags: I would use apply instead of reduce in there

10:45 sandbags: Scriptor: see above discussion, 'and' being a macro means you can't simply 'apply'

10:46 Scriptor: ah, now it all makes sense

10:46 please excuse me while I wake up :)

10:47 sandbags: duck1123: reducers appear to be a relatively new feature of clojure

10:47 duck1123: you mean http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html ?

10:48 gfredericks: yes

10:48 sandbags: i think that's stretching my knowledge of clojure a little far right now

10:49 Scriptor: sandbags: you can also call (every? true? ...) on that

10:50 duck1123: (every? identity (map = [1 2 3] [1 2 3 4 5]))

10:50 ,(every? identity (map = [1 2 3] [1 2 3 4 5]))

10:50 clojurebot: true

10:50 ludston: Question: Out of all of the books on clojure, which one is a must-read for someone who knows CL, but doesn't know very much about concurrency?

10:50 sandbags: ah yeah, neat

10:50 AimHere: Read them all at the same time

10:51 ludston: AimHere: Assuming I don't want to fork out $300 for a stack of books.

10:52 sandbags: yes, yet another library to learn...

10:52 AimHere: Don't do that just to appease my bad jokes

10:52 gfredericks: sandbags: I don't think there's any reason to use reducers if you're not concerned about performance

10:52 ludston: AimHere: I don't know man. It was a pretty convincing argument.

10:53 gfredericks: reducers might be pretty bad actually; I don't think it could short-circuit

10:53 duck1123: I thought that was one of the benefits of reducers

10:54 gfredericks: not afaik

10:54 duck1123: you could have a reduce that'd stop at a certain point

10:54 gfredericks: but if it's parallelized

10:54 and you have 20000 things

10:54 broken into size 500 chunks

10:55 and only the 2nd item in your list is false

10:55 then the first chunk short-circuits but the others will run I think

10:55 duck1123: ok, I've only half listened to Rich's talk, I haven't really looked into using them yet

10:55 gfredericks: well I've WHOLE listened to Rich's talk and haven't really looked into using them yet

10:56 * gfredericks makes some kind of face

10:56 gfredericks: :)

11:23 duck1123: Is there a way to silence the repeatability check? The Apache repo is down at the moment and I simply want to silence those checks until it's back up, but if I comment out that line, I get the repeatability failure

12:39 sandbags: ah, Brians solution is simpler still (def prefix-of? (fn [candidate seq] (= (take (count candidate) seq) candidate)))

12:39 yes, i overcomplicated comparing item by item

12:41 33..

12:51 dfd: I'm having trouble getting my JSON out of CouchDB, which has a field with (what seems to be) acceptable UTF-8 Japanese, without getting mangled. Anyone had any issues like this with clutch? When I look directly at the JSON from CouchDB, it seems fine.

12:51 sandbags: i wonder why it didn't occur to me to just compare the sequences directly since i'd previously made the leap to (take (count candidate) seq) before I realised that map will automatically only use the length of the shorter seq

12:56 dfd: Ah, nevermind, this seems to have been the issue: http://jkndrkn.livejournal.com/264856.html

12:56 verra interesting...

12:56 superparen: you can set -D in project.clj

12:57 or I assume a System/setProperty

13:38 TimMc: gfredericks: I *think* reducers allows you to specify a strategy for folding, and also provides a way to stop early.

13:39 gfredericks: TimMc: that would be cool

13:39 abort the other chunks before they finish?

13:39 I guess they aren't all necessarily running at once anyhow

13:39 TimMc: Right. This is just a vague impression/memory, anyhow.

13:47 darklajid: vim, vimclojure, nailgun. I guess I still don't understand what's going on behind the scenes. What are the requirements for classpath settings here?

13:55 Sgeo: I think the error monad may actually be more useful than a fixed maybe monad

13:55 Because then we could include exceptions as things that are usually "Left"

13:56 duck1123: Does leiningen have a work offline mode? It's hitting a down server on every run for every one of my deps. And I'm running midje over and over

14:28 TimMc: duck1123: In the short term, can you use lein interactive?

14:51 ro_st: ckirkend`: i'm here, pm'd yo

14:51 u

15:05 subversus: b#e

15:52 xeqi: duck1123: this is late, but you can set :offline true https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L207

15:56 bruceadams: duck1123: you can add "offline? true" into your leiningen project.clj

15:57 it's an ugly approach for a temporary condition. there is a bug about this https://github.com/technomancy/leiningen/issues/678

16:14 gfredericks: anybody heard of a cljs bug for :when in a doseq?

16:16 (doseq [a [1 2 3] :when a] a) fails to compile

16:16 * gfredericks thumbs through jira

16:17 gfredericks: CLJS-366 apparently

17:14 Hodapp: a lot of algebraic rules and other assorted syntactic nonsense for a system I'm re-implementing in Clojure... just collapsed down into a handful of functions in my head.

17:14 this must be why Lisp appeals to me.

17:14 amalloy: duck1123, gfredericks: in 1.5 you can short-circuit a reduce (but not a fold), whether or not you use reducers or just clojure.core/reduce

17:15 gfredericks: amalloy: wat

17:15 how you short-circuit in regular reduce?

17:15 amalloy: (reduced 10) ;; a value meaning "i'm done, return 10"

17:15 gfredericks: that is stinkin sweet.

17:16 I'm going to strive to use this in every function I write from now on.

17:16 mpan: ,(reduced 10)

17:16 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reduced in this context, compiling:(NO_SOURCE_PATH:0)>

17:16 mpan: &(reduced 10)

17:16 lazybot: java.lang.RuntimeException: Unable to resolve symbol: reduced in this context

17:17 mpan: is it special?

17:17 gfredericks: mpan: 1.5 only

17:17 ,*clojure-version*

17:17 clojurebot: {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}

17:18 mpan: ah thanks

17:19 gfredericks: no more "you can't use reduce for that"

17:19 Sgeo: Why not just use foldr and, in the function passed to it, not need the next value

17:19 * Sgeo ducks

17:20 mpan: does that mean you can reduce over an infinite seq now?

17:20 Sgeo: foldr in Haskell can reduce over infinite sequences

17:20 gfredericks: mpan: sounds like it

17:20 mpan: yay

17:58 Hodapp: hrmph. I am liking Clojure and Counterclockwise but it's regularly crashing Eclipse or just creating defunct REPLs

18:04 though this is doing a good job convincing me that I really should pick some other way than normal OOP to handle this.

18:05 and I'm finding that in a lot of cases it's easier this way, in that I'll just wrap a function in some form of a 'let' and all of what would normally be mutable ends up here

18:06 as I've lost track of the number of times when I see classes existing just to provide a function with a closure or partial application

18:08 Sonderblade: Hodapp: ymmv, but imho eclipse always feels too heavy weight for clojure, a shell and a good editor is all you need :)

18:09 Hodapp: Sonderblade: In CCW I'm able to swap in changes into the currently-running instance with one keystroke, and I find this very valuable

18:09 Sonderblade: I attempted to use vim & nailgun & lein-tarsier and it was just all too clunky

18:10 If I have the editor and the REPL separate then I must manually sync up the REPL with my code

18:11 so, yes, Eclipse is heavy and unstable but this is the only approach I've found so far that let me work quickly

18:26 akhudek: Hodapp: You could try Intellij + La Clojure. It doesn't sync up with lein or nrepl, but I find lein pom works with it well enough (just import the pom as a maven project).

18:26 As an IDE, Intellij is much nicer than Eclipse.

18:27 casion: or emacs + nrepl.el. which is awesome

18:28 mpan: can you explain that second part about lein please?

18:28 luxbock: I'm having trouble with a lot of the hotkeys of Emacs / paredit for using it on Windows

18:28 think I'll have to make make custom ones

18:28 casion: such as?

18:28 mpan: I'd be interested in trying a different feature-heavy IDE than Eclipse

18:28 luxbock: M-" { or [ don't work

18:29 and a lot of the commands that use CM-

18:29 casion: using alt, or escape as M?

18:29 luxbock: alt

18:29 casion: does esc work?

18:29 luxbock: I haven't actually tried that

18:30 though reaching for esc is not the greatest thing for work flow

18:30 casion: also http://www.gnu.org/software/emacs/manual/html_node/emacs/Windows-Keyboard.html

18:30 i much prefer esc personally

18:31 luxbock: I'm a complete beginner with both Emacs and Clojure

18:31 scottj: esc rocks. I like it so much I swap esc and spacebar.

18:31 luxbock: so it's going to take some time to get started :)

18:31 thanks for the link, that looks like it might solve some of my problems

18:32 casion: luxbock: keep in mind that using esc as meta is 'latching'

18:32 so you can hit esc, let go, then C-m

18:32 not esc-C-m at the same time

18:32 luxbock: oh

18:32 I didn't know that

18:35 casion: luxbock: seems a lot of folks just map the windows key to meta in windows as well

18:36 anyway, I like escape because I can hit it with my pinky easier than scrunching up to hit opt/alt

18:36 luxbock: yeah, I just installed Emacs two days ago so I'm still figuring things out

18:37 casion: always can ask in #emacs too :)

18:38 and there's lots of starter kits out there that can help, such as https://github.com/technomancy/emacs-starter-kit and https://github.com/overtone/emacs-live

18:38 * Sgeo ponders how he would implement the error monad

18:40 casion: Sgeo: what's the purpose of using monads in clojure?

18:40 Sgeo: Is there a way to do something conditionally based on whether or not a library is detectable?

18:40 Better yet, is there a _clean_ way to do so

18:40 casion, in many cases, convenience.

18:40 casion: Sgeo: wouldn't find-ns do that?

18:41 for checking for a namespace's presence

18:41 Sgeo: casion, but hmm, is that a clean way to do it?

18:42 That is, what if my library ends up getting loaded in first

18:42 casion: there's something that was in clojure-contrib too

18:42 let me see if I can find it

18:43 Sgeo: o.O olabini is here

18:44 casion: http://clojuredocs.org/clojure_contrib/clojure.contrib.find-namespaces

19:08 oich: more of a java question, but I'm trying to get ritz-nrepl to work and it can't connect to the socket. I'm using fedora 17 with either jdk 1.7 or jdk 1.5. I get the same result using jdb with selinux disabled and iptables rules flushed. Do you have any idea what the problem could be?

19:09 frio: oich: if you do lsof -n -i TCP, can you see the java process (and is it holding the port you expect it to?)

19:13 oich: frio no I don't see it but it could start and fail between invocations of lsof I guess. Using java -agentlib:jdwp etc. I can get a test java class to suspend and wait for jdb to attach. Then trying to attach it fails in the same way as ritz-nepl

19:17 frio: if it's not in that list, then it's not running :)

19:17 which is why you won't be able to connect to it

19:17 you can confirm with ps ax or something i guess

19:20 oich: Well, ritz-nrepl clearly runs because it produces an error message. It's not connecting, which is maybe why lsof doesn't show a socket for the process?

19:41 mindbender2: is there something similar to (pwd) in clojure.java.io which was in clojure.contrib.io?

19:42 casion: just write it yourself (defn pwd [] (System/getProperty "user.dir"))

19:43 mindbender2: casion: ok thanks

20:32 gfredericks: man himera is the ultimate in silent-fail: it simply prints nil on any compile or read error

20:33 mindbender2: why is using set! to alter global dynamic vars in my repl throwing IllegalStateException. It's preventing my repl from being piggiebacked. I'm using 1.4

20:34 gfredericks: does it have a thread-local binding?

20:34 mindbender2: with binding form you mean?

20:34 gfredericks: yeah

20:34 mindbender2: no,

20:35 gfredericks: set! only works on vars with thread-local values

20:35 mindbender2: just direct set! within a fn

20:35 gfredericks: what var is this and why do you need to change it?

20:35 mindbender2: it's piggieback.clj that's the culprit

20:36 gfredericks: okay; I'm not familiar with that

20:36 mindbender2: trying to modify *cljs-repl-env*

20:36 gfredericks: you can change a var's root value if you want

20:36 with alter-var-root

20:36 mindbender2: ok thanks I'll try to modify the file and see what happens

20:38 gfredericks: note you have to use a function there; so you might want clojure.core/constantly

20:38 mindbender2: I was about to mention that it required a fn thanks for poiting out

20:38 *pointing

21:16 oich: it seems like my problem running ritz-nrepl is a problem with using the jdi connector that it uses. Is anyone using ritz-nrepl and has it working?

21:46 ZEFRENCHACCENT: oich, last week

21:46 I sawr a film

21:47 matt_d: i'm watching a film right now

22:04 oich: my problem with JDI doesn't happen in a different linux, so it's not ritz-nrepl

22:20 thanks. I must reboot now.

23:03 ivan: anyone else have problems with La Clojure locking up IDEA for 10+ seconds?

23:03 talios: you mean La Clojure -works-? ;-)

23:04 Actualy, it was updated for 12. but that was a fork afaik.

23:04 ivan: well, it can colorize Clojure source

23:04 I'm on 11 and the non-fork, I assume

23:05 talios: any exceptions in your ~/.IntelliJ11/logs/idea.log file?

23:05 ( i think thats the path, for linux )

23:06 frio: ooh

23:06 is idea 12 out?

23:06 ivan: don't see anything out of the ordinary in that log, but I also have threadDumps that show 20 different threads waiting for things

23:07 frio: only EAP

23:08 I also have a CPU usage profile but I have no YourKit Java Profiler license

23:08 not that it's using any CPU while locked up

Logging service provided by n01se.net