#clojure logs

2012-09-16

00:07abaranoskyCould any of you poin me in the right direction regarding this exception I'm seeing?
00:08abaranosky=> 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
00:08abaranoskygoogling the exception didn't give me anything
00:10tomojclojure.data extends protocols to interfaces
00:10tomojjava.util.{Map,List,Set}
00:11tomojhow might this be translated to cljs?
00:11tomojnaive way is to extend the protocol to every known implementation of IMap, ISequential, and ISet
00:12S11001001abaranosky: it's difficult to say without more context
00:13SgeoQuick question: What is the difference between importing a class and using only the class?
00:13Sgeouse'ing :only
00:13abaranoskyS11001001: I just wrote a defprotocol w/ one implementer, one method is called single-val-error
00:14akhudekSgeo: can you elaborate on what you mean by importing a class?
00:14S11001001Sgeo: the former means something :)
00:14Sgeo(import 'some.package.SomeClass)
00:14abaranoskyI found something: http://dev.clojure.org/jira/browse/CLJ-735
00:14Sgeovs (use '[some.package :only Class]) ; if I got the usage right
00:15akhudekSgeo: I wasn't aware that you could use the "use" form to import java classes. I've always just used import.
00:15S11001001Sgeo: you can't clojure.core/use classes; use is for ns bindings
00:16S11001001sometimes there are associated ns bindings like with protocols
00:16SgeoSo Clojure doesn't consider a Java class to be in a package .. namespace... blah
00:16SgeoIs this like the difference between fns and methods?
00:16S11001001Sgeo: clojure nses are totally separate from the java packages
00:17SgeoBut couldn't I use a class like some.package/Class?
00:17S11001001no
00:17SgeoWhich looks like some.package/something
00:17SgeoOh
00:18S11001001it's better this way
00:18abaranoskyfound 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
00:18SgeoHow can you use a class without importing it
00:18Sgeo?
00:18S11001001Sgeo: put a top-level (Class/forName "...") before your references in the .clj file
00:19SgeoO.O
00:19S11001001you could also have all the imports in another module which you require
00:20SgeoWhy can't I just refer to it in a fully qualified way if I've required the package?
00:20S11001001since the goal here is to get the classloader to wake up the relevant classes without adding ns entries for yourself
00:20S11001001Sgeo: you didn't require "the package"; nses are not java packages
00:20S11001001java packages don't really exist outside package-visibility terms, if you look at the vm and java.* apis
00:21S11001001now, 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
00:22S11001001but 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
00:23Sgeo"relevant class as the value"
00:23SgeoI thought the . form looks at the literal name given?
00:23S11001001. operates in fairyland
00:23Sgeo??
00:23lazybotSgeo: Uh, no. Why would you even ask?
00:23S11001001,(do (deftype blahblah []) (class blahblah))
00:23clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
00:23S11001001hah
00:23S11001001anyway
00:24Sgeolazybot, are you good at your job??
00:24lazybotSgeo: Uh, no. Why would you even ask?
00:27amalloyS11001001: 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
00:27S11001001amalloy: I didn't suggest that
00:28tomojwhy does (cljs.analyzer/analyze-file "cljs/core.cljs") return nil?
00:28SgeoIf I Class/forName a Java class, how do I refer to it?
00:29SgeoCan I do a fully-qualified thing then?
00:29S11001001Sgeo: yes
00:29amalloythen 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
00:29S11001001amalloy: that's for the case where there isn't a related deftype
00:30S11001001I don't know which situation Sgeo is in
00:30SgeoS11001001, the situation of trying to fully understand the difference between all these functions and how they work together
00:31amalloyS11001001: (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
00:31Sgeoamalloy, what about for the side-effect of bringing in x.y.Z?
00:31S11001001amalloy: merely referencing the class x.y.Z doesn't necessarily imply a load of it
00:31S11001001s,load,classload,
00:32S11001001this isn't typically observable in java.*, but crops up with third-party java libs
00:33amalloyS11001001: 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
00:34amalloyin 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
00:41S11001001amalloy: 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
00:57aperiodicin 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
01:01amalloyfully unqualified! that sounds exciting
01:10Raynesamalloy: What about the naked part?
01:10aperiodicheh
01:10aperiodicfully qualified
01:11aperiodicit's saturday night, guys. #clojure after-hours
01:11mpanfunny that, I just got followed by a drunk stranger most of the way home
01:12mpannice timing of you to mention that
01:13aperiodicprotip: don't leave your house
01:14aperiodicit's totally overrated and stuff
01:14uvtcaperiodic: Maybe not even safe there! : http://xkcd.com/742/
01:15mpanah the joys of a campus full of alcoholics
01:30akhudekdoes wrap-reload now work with compound routes of routes?
01:30akhudekerr not work
01:33akhudekdamn, it seems not
01:44akhudekthis is actually sort of surprising
01:45akhudekdo people who use compojure with bigger nested routes not use wrap-reload during development?
01:47mpanwhere's a recent list of examples of clojure being used in production?
01:47mpanI recall there was one from a year ago, but anything newer?
01:48akhudekmpan: not that I know of, maybe someone else know though
01:49akhudektwitter and prismatic are two though
01:49mpangoogle isn't showing anything tech related for "prismatic company"
01:49mpanand twitter uses pretty much everything these days, right?
01:50akhudekhttp://getprismatic.com/
01:50akhudekthere are some other clojure based startups too
01:50mpanshiny
01:52akhudekhttp://lonocloud.com/
01:53mpanso like, which parts of their system do these types of companies usually write in clj?
01:54akhudekprismatic has some blog posts about their usage
01:54akhudekseems like they use it for nearly everything
01:54akhudekeven high performance machine learning algorithms via macros and low level java arrays
02:09aperiodicwe're a still-in-beta startup (have a seed round) that uses clojure for roughly 2/3rds of our backend http://luckysort.com/
02:10mpanoh cool
02:10mpanis your web frontend also clojure?
02:11aperiodicno, that's all js
02:11aperiodicwe have a js wizard
02:11aperiodiche's great
02:11aperiodicthere's a decent page about it on the clojure dev wiki: http://dev.clojure.org/display/community/Clojure+Success+Stories
02:12akhudekaperiodic: that looks like a neat product and good team!
02:13mpancool, thank you!
02:13aperiodici'm using cljs a little on the side (https://github.com/aperiodic/c2-cljs-examples so far), but no production experience with that, really
02:15aperiodicakhudek: thanks!
02:36_ulisesmorning all
02:36mpanhello
02:37SgeoIt would be nice if we had a bot that would let us play with macros
02:38Sgeo,(do (use 'clojure.template) (macroexpand-1 '(do-template [a b] (+ a b) 1 2 3 4)))
02:38clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
02:38Sgeo&(do (use 'clojure.template) (macroexpand-1 '(do-template [a b] (+ a b) 1 2 3 4)))
02:38lazybot⇒ (do (+ 1 2) (+ 3 4))
02:38Sgeo,(+ 1 1)
02:38clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
02:38SgeoWho broke clojurebot and how?
02:38mpanthat error looks oddly familiar
02:39mpanfor future reference, what does it mean?
02:50l1xhey
02:51l1xhow 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 :(
02:52l1xi just would like to do some ruby .each like stuff where i can access the key and the value as well
02:55mpanyou can use map
02:55mpanmap will get you a seq of 2-vectors containing key, val
02:56l1xlike?
02:56mpan&(map pprint {0 [1 2 3], 1 [2 3 4], 2 [5 6 7]})
02:56l1xthis is not what i want
02:56l1xi need the keys and the values
02:57mpanthat's (indirectly) what you want
02:57mpanif you need the individual values, do destructuring or indexing
02:58l1xthis was my question, how to decompose (destruct) the nested map
02:58Sgeol1x, are you hoping to produce a value or do side-effects?
02:58mpanah ok, so there's two steps
02:58mpanmap gets you each of the pairs, and then you destructure the pairs w/ let or similar
02:58l1xSgeo: no just count the elements in the vectors
02:59l1xmpan: yep, i am just not sure how
02:59Sgeo&(let [[a b] [:key "val"]] (str "key: " a " val: " b))
02:59Sgeo..
02:59mpanhttp://clojure.org/special_forms look under the section on let
02:59mpanthe bot got netsplit :(
02:59SgeoOh
02:59scottj(map (fn [[k v]] [k (count v)]) {0 [1 2 3] 1 [2 3]}) => ([0 3] [1 2])
03:00mpanlike let and other binding forms let you do that sort of destructuring
03:00l1xmpan: thanks
03:01l1xperfect
04:40_ulisesto 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?
04:41_ulisesthis 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
04:57amalloy_ulises: that wouldn't inspire me to invent nil
04:58amalloy(get m k (fn [v] ...) (fn [not-found] ...)) is sufficient, right?
04:58_ulisesamalloy: I'm now wondering if I should be returning something else instead of nil when the key does not exist
04:58_ulisesamalloy: ah, see, I'm trying to only use and return functions everywhere
04:59amalloyi'm aware
05:00amalloyinstead 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
05:00_ulisesah, gotcha
05:01_ulisesI was now toying with the idea of returning EMPTY when the key doesn't exist, and (key value) otherwise
05:01_ulisesthen you're representing nil with EMPTY and can check with EMPTY?
05:01amalloyi don't know if that's the usual way to handle this in lambda calculus, but it seems as reasonable as anything else
05:01_uliseswhat I've seen so far is that NIL is equated to the EMPTY LIST
05:01_uliseswhich is unfortunate
05:02_ulisesthanks for the suggestion though, I'll definitely try it
05:02amalloyi 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
05:03_ulisesI reckon you can't without clashing with anything else in the language
05:03amalloy_ulises: yeah, i really enjoyed the Programming With Nothing post, and i was happy to see you'd ported it to clojure
05:03_uliseswhat 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
05:04_ulisesamalloy: yeah, it's a fun exercise and I'm now seeing how far I can push it
05:04amalloyall the way to infinity, guaranteed
05:04_ulisesexcellent then! I shall be entertained ad-infinitum
05:04mpanis this why some dialects intentionally have nil as empty-list?
05:05_ulisesmpan: no idea, perhaps?
05:08amalloyprobably it's nice to have a small number of primitive types
05:08amalloyif the empty list is falsey, you don't need booleans or a separate nil type
05:24_ulisesyikes, this is getting ugly
05:37_ulisesoh, 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.
05:41_ulisesthe 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.
05:41_ulisesthis is of course, wrong, since the reversing of entries means that older values for the same key will override newer values.
05:42_ulisesI 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
05:42_ulisesI'm taking votes/accepting feedback at this stage
05:44pistolpetequestion: 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.
05:45pistolpete(def testmap {:buildings {:1 {:apartment-building {}}, :2 {:apartment-building {}}, :3 {:apartment-building {}}}} )
05:45pistolpete(keys testy) ;; => (:buildings)
05:45pistolpete(first (keys testmap)) ;; => :buildings
05:45pistolpete
05:45pistolpete(contains? (keys testmap) :buildings) ;; => false...why?
05:46_ulises,(doc contains?)
05:46clojurebot"([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'."
05:46_ulises,(doc keys)
05:46clojurebot"([map]); Returns a sequence of the map's keys."
05:47_ulisespistolpete: contains? will check the presence of a key in a collection, not the value.
05:47_ulises,(contains? [1 1 1] 2)
05:47clojurebottrue
05:47_ulisesperhaps you could wrap keys in a set?
05:47pistolpeted'oh, thanks. I'll have to change how I'm thinking about this data.
05:47_ulises,(contains? (set (keys {:foo "" :bar ""})) :foo)
05:47clojurebottrue
05:48_ulises,(contains? (keys {:foo "" :bar ""}) :foo)
05:48clojurebotfalse
05:48_ulisesthere.
05:48pistolpetesweet! That's the solution. Thank you!!
05:48_ulisespistolpete: no worries; contains? is the source of confusion to many (including myself)
05:48_ulisespistolpete: I've seen the question and the answer so many times that now I remember :)
05:50pistolpete_ulises: hah, thanks. I need to make sure to remember that; most of my datastructures are maps
05:50tomoj&(contains? {:foo "" :bar ""} :foo)
05:50lazybot⇒ true
05:50pistolpete&(println test)
05:50lazybot⇒ #<core$test clojure.core$test@168be30> nil
05:50pistolpeteoops
05:53_ulisestomoj: +1
07:18aperiodic(inc tomoj) ; FYI, _ulises
07:18lazybot⇒ 3
07:26aperiodiclazybot: logs?
07:26aperiodicclojurebot: logs?
07:26clojurebotlogs is http://clojure-log.n01se.net/
08:05hyPiRionIs there any specific reason 'keep' doesn't take more than one collection as input?
08:06hyPiRionit's bugging me, as I kind of need that functionality.
08:32luxbockis 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
08:35polycosmhyPiRion: why don't you use a map to do that ?
08:37polycosm(just trying to understand what you mean)
08:39polycosm,(map (partial keep #(if (odd? %) %)) [(range 1 10) (range 10 20)])
08:39clojurebot((1 3 5 7 9) (11 13 15 17 19))
08:39hyPiRionpolycosm: I can use (remove nil? (map f c1 c2)), but why can't I just use (keep f c1 c2)
08:39hyPiRionWhat I'm basically asking, is why keep is limited to one collection only.
08:43augustlhttp://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
08:49polycosmhyPiRion: you can't use multiple cols with filter either, do yo
08:49polycosmshould it also be possible ?
08:54hyPiRionpolycosm: 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.
08:57nz-how do I set the clojurescript version with lein-cljsbuild?
09:57elliottwmorning all
09:58elliottwquick question: how do i turn a string into a symbol name (more specifically a function name)?
09:59elliottwi've tried things like (defn do-stuff [] "stuff!") (def data "do-stuff") (resolve (symbol data) but that doesn't seem to work
10:00polycosm((load-string "f") args) ?
10:01elliottwpolycosm jesus, i've been searching all over
10:01elliottwthanks, sorry for the noob-ish question
10:01polycosmbut that looks so unsafe
10:01elliottwpolycosm lol
10:02elliottwso what i'm trying to do is pass a bunch of function names as strings in noir from one page to another
10:02elliottweach function just takes in a few arguments and returns html (via hiccup)
10:02elliottwso to assemble a page, i just have a list of function names with args
10:04polycosmI 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:05rcgpolycosm, because it is actually unsafe...
10:05rcgyou are opening a barns door for injection attacks that way
10:05rcgimho
10:05elliottwi 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:06rcgbtw. i was just referring to using "load-string"
10:06polycosmwhy do you need to pass functions between webpages ?
10:07elliottwwell 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:08elliottweach function has a form when called with zero args, and result html when called with args
10:09elliottwso i can basically call a function with zero args, gather that data and call the function with the args someplace else
10:18no7hingi have troubles grokking this, but is there a post etc. out there that describes the route from multimethods to protocols?
10:19no7hing-but
10:20nz-clojurebot: logs?
10:20clojurebotlogs is http://clojure-log.n01se.net/
10:25sandbagsHi 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:27sandbagsor is there an alternative to 'apply' that is macro-safe?
10:27duck1123,(reduce #(and %1 %2) [true true false])
10:27clojurebotfalse
10:27Hodappokay, 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:28sandbagsduck1123: yes that works if you have a fixed number of parameters to and
10:28sandbagsduck1123: but not in the general case
10:28Hodappwhat in God's name is it doing?
10:28sandbagsduck1123: well, either that or you're above my pay grade
10:28duck1123sandbags: reduce will take them 2 at a time though
10:28sandbagsoic
10:29sandbagsnice bit of lateral thinking there
10:31sandbagsseems a bit of a weakness that you can't use a macro here
10:32sandbagsis 'and' a macro to allow for short-circuiting?
10:32duck1123yes
10:33duck1123otherwise, the second clause would be evaled before it was sent to and
10:33sandbagsyep
10:35sandbagsduck1123: 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:35gfredericksclojurebot?
10:35clojurebotclojurebot is amazing
10:35duck1123The comma is for the bot, and only used here
10:35gfrederickscommas are whitespace
10:36gfredericks,,,[,,,,8,,,7,,,5,,4,,],,,,
10:36clojurebot[8 7 5 4]
10:36sandbagsoh, neat :)
10:36duck1123,(println "hello, I'm a bot")
10:36clojurebothello, I'm a bot
10:36duck1123&(println "so am I")
10:36lazybot⇒ so am I nil
10:36sandbagsi didn't grok that clojurebot had evaluated your expression
10:36sandbagsthat's very neat
10:37gfrederickssandbags: the macro has to know its arguments at compile-time
10:38gfrederickssandbags: this is part of why people avoid needless macros
10:39sandbagsyes, it kind of breaks the fourth wall
10:40ivaraasen&(println "I have become")
10:40lazybot⇒ I have become nil
10:40ivaraasendestroyer of worlds.
10:41Hodappbut how much do compile-time and run-time differ in Clojure?
10:41gfrederickssignificantly from a macro's perspective
10:41ScriptorHodapp: in what sense?
10:41Hodapphmmm
10:41gfredericksat macro-expand time the code is still an s-exp data structure
10:41gfredericksat runtime it is bytecode
10:41duck1123in compile time, you don't have any of the runtime data. Your data is clojure code
10:42gfredericksthat part too
10:42gfredericks you don't know what the "value" of the arguments is
10:42gfredericksjust what they look like
10:42gfredericks,(macroexpand-1 '(and foo bar baz))
10:42clojurebot(clojure.core/let [and__2241__auto__ foo] (if and__2241__auto__ (clojure.core/and bar baz) and__2241__auto__))
10:42sandbagsso https://gist.github.com/7529c04e8836fe88b4d8 is my solution to writing a prefix function, any comments about style? Or a more idiomatic approach?
10:43duck1123wouldn't this be a job for reducers?
10:44sandbags(I'm starting to read Brian Marick's book Functional Programming for the Object-Oriented Programmer
10:45Scriptorsandbags: I would use apply instead of reduce in there
10:45sandbagsScriptor: see above discussion, 'and' being a macro means you can't simply 'apply'
10:46Scriptorah, now it all makes sense
10:46Scriptorplease excuse me while I wake up :)
10:47sandbagsduck1123: reducers appear to be a relatively new feature of clojure
10:47sandbagsduck1123: you mean http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html ?
10:48gfredericksyes
10:48sandbagsi think that's stretching my knowledge of clojure a little far right now
10:49Scriptorsandbags: you can also call (every? true? ...) on that
10:50duck1123(every? identity (map = [1 2 3] [1 2 3 4 5]))
10:50duck1123,(every? identity (map = [1 2 3] [1 2 3 4 5]))
10:50clojurebottrue
10:50ludstonQuestion: 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:50sandbagsah yeah, neat
10:50AimHereRead them all at the same time
10:51ludstonAimHere: Assuming I don't want to fork out $300 for a stack of books.
10:52sandbagsyes, yet another library to learn...
10:52AimHereDon't do that just to appease my bad jokes
10:52gfrederickssandbags: I don't think there's any reason to use reducers if you're not concerned about performance
10:52ludstonAimHere: I don't know man. It was a pretty convincing argument.
10:53gfredericksreducers might be pretty bad actually; I don't think it could short-circuit
10:53duck1123I thought that was one of the benefits of reducers
10:54gfredericksnot afaik
10:54duck1123you could have a reduce that'd stop at a certain point
10:54gfredericksbut if it's parallelized
10:54gfredericksand you have 20000 things
10:54gfredericksbroken into size 500 chunks
10:55gfredericksand only the 2nd item in your list is false
10:55gfredericksthen the first chunk short-circuits but the others will run I think
10:55duck1123ok, I've only half listened to Rich's talk, I haven't really looked into using them yet
10:55gfrederickswell I've WHOLE listened to Rich's talk and haven't really looked into using them yet
10:56gfredericks:)
11:23duck1123Is 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:39sandbagsah, Brians solution is simpler still (def prefix-of? (fn [candidate seq] (= (take (count candidate) seq) candidate)))
12:39sandbagsyes, i overcomplicated comparing item by item
12:41sandbags33..
12:51dfdI'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:51sandbagsi 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:56dfdAh, nevermind, this seems to have been the issue: http://jkndrkn.livejournal.com/264856.html
12:56dfdverra interesting...
12:56superparenyou can set -D in project.clj
12:57superparenor I assume a System/setProperty
13:38TimMcgfredericks: I *think* reducers allows you to specify a strategy for folding, and also provides a way to stop early.
13:39gfredericksTimMc: that would be cool
13:39gfredericksabort the other chunks before they finish?
13:39gfredericksI guess they aren't all necessarily running at once anyhow
13:39TimMcRight. This is just a vague impression/memory, anyhow.
13:47darklajidvim, 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:55SgeoI think the error monad may actually be more useful than a fixed maybe monad
13:55SgeoBecause then we could include exceptions as things that are usually "Left"
13:56duck1123Does 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:28TimMcduck1123: In the short term, can you use lein interactive?
14:51ro_stckirkend`: i'm here, pm'd yo
14:51ro_stu
15:05subversusb#e
15:52xeqiduck1123: this is late, but you can set :offline true https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L207
15:56bruceadamsduck1123: you can add "offline? true" into your leiningen project.clj
15:57bruceadamsit's an ugly approach for a temporary condition. there is a bug about this https://github.com/technomancy/leiningen/issues/678
16:14gfredericksanybody heard of a cljs bug for :when in a doseq?
16:16gfredericks(doseq [a [1 2 3] :when a] a) fails to compile
16:17gfredericksCLJS-366 apparently
17:14Hodappa 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:14Hodappthis must be why Lisp appeals to me.
17:14amalloyduck1123, 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:15gfredericksamalloy: wat
17:15gfrederickshow you short-circuit in regular reduce?
17:15amalloy(reduced 10) ;; a value meaning "i'm done, return 10"
17:15gfredericksthat is stinkin sweet.
17:16gfredericksI'm going to strive to use this in every function I write from now on.
17:16mpan,(reduced 10)
17:16clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reduced in this context, compiling:(NO_SOURCE_PATH:0)>
17:16mpan&(reduced 10)
17:16lazybotjava.lang.RuntimeException: Unable to resolve symbol: reduced in this context
17:17mpanis it special?
17:17gfredericksmpan: 1.5 only
17:17gfredericks,*clojure-version*
17:17clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
17:18mpanah thanks
17:19gfredericksno more "you can't use reduce for that"
17:19SgeoWhy not just use foldr and, in the function passed to it, not need the next value
17:20mpandoes that mean you can reduce over an infinite seq now?
17:20Sgeofoldr in Haskell can reduce over infinite sequences
17:20gfredericksmpan: sounds like it
17:20mpanyay
17:58Hodapphrmph. I am liking Clojure and Counterclockwise but it's regularly crashing Eclipse or just creating defunct REPLs
18:04Hodappthough this is doing a good job convincing me that I really should pick some other way than normal OOP to handle this.
18:05Hodappand 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:06Hodappas 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:08SonderbladeHodapp: ymmv, but imho eclipse always feels too heavy weight for clojure, a shell and a good editor is all you need :)
18:09HodappSonderblade: In CCW I'm able to swap in changes into the currently-running instance with one keystroke, and I find this very valuable
18:09HodappSonderblade: I attempted to use vim & nailgun & lein-tarsier and it was just all too clunky
18:10HodappIf I have the editor and the REPL separate then I must manually sync up the REPL with my code
18:11Hodappso, yes, Eclipse is heavy and unstable but this is the only approach I've found so far that let me work quickly
18:26akhudekHodapp: 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:26akhudekAs an IDE, Intellij is much nicer than Eclipse.
18:27casionor emacs + nrepl.el. which is awesome
18:28mpancan you explain that second part about lein please?
18:28luxbockI'm having trouble with a lot of the hotkeys of Emacs / paredit for using it on Windows
18:28luxbockthink I'll have to make make custom ones
18:28casionsuch as?
18:28mpanI'd be interested in trying a different feature-heavy IDE than Eclipse
18:28luxbockM-" { or [ don't work
18:29luxbockand a lot of the commands that use CM-
18:29casionusing alt, or escape as M?
18:29luxbockalt
18:29casiondoes esc work?
18:29luxbockI haven't actually tried that
18:30luxbockthough reaching for esc is not the greatest thing for work flow
18:30casionalso http://www.gnu.org/software/emacs/manual/html_node/emacs/Windows-Keyboard.html
18:30casioni much prefer esc personally
18:31luxbockI'm a complete beginner with both Emacs and Clojure
18:31scottjesc rocks. I like it so much I swap esc and spacebar.
18:31luxbockso it's going to take some time to get started :)
18:31luxbockthanks for the link, that looks like it might solve some of my problems
18:32casionluxbock: keep in mind that using esc as meta is 'latching'
18:32casionso you can hit esc, let go, then C-m
18:32casionnot esc-C-m at the same time
18:32luxbockoh
18:32luxbockI didn't know that
18:35casionluxbock: seems a lot of folks just map the windows key to meta in windows as well
18:36casionanyway, I like escape because I can hit it with my pinky easier than scrunching up to hit opt/alt
18:36luxbockyeah, I just installed Emacs two days ago so I'm still figuring things out
18:37casionalways can ask in #emacs too :)
18:38casionand 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:40casionSgeo: what's the purpose of using monads in clojure?
18:40SgeoIs there a way to do something conditionally based on whether or not a library is detectable?
18:40SgeoBetter yet, is there a _clean_ way to do so
18:40Sgeocasion, in many cases, convenience.
18:40casionSgeo: wouldn't find-ns do that?
18:41casionfor checking for a namespace's presence
18:41Sgeocasion, but hmm, is that a clean way to do it?
18:42SgeoThat is, what if my library ends up getting loaded in first
18:42casionthere's something that was in clojure-contrib too
18:42casionlet me see if I can find it
18:43Sgeoo.O olabini is here
18:44casionhttp://clojuredocs.org/clojure_contrib/clojure.contrib.find-namespaces
19:08oichmore 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:09friooich: if you do lsof -n -i TCP, can you see the java process (and is it holding the port you expect it to?)
19:13oichfrio 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:17frioif it's not in that list, then it's not running :)
19:17friowhich is why you won't be able to connect to it
19:17frioyou can confirm with ps ax or something i guess
19:20oichWell, 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:41mindbender2is there something similar to (pwd) in clojure.java.io which was in clojure.contrib.io?
19:42casionjust write it yourself (defn pwd [] (System/getProperty "user.dir"))
19:43mindbender2casion: ok thanks
20:32gfredericksman himera is the ultimate in silent-fail: it simply prints nil on any compile or read error
20:33mindbender2why 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:34gfredericksdoes it have a thread-local binding?
20:34mindbender2with binding form you mean?
20:34gfredericksyeah
20:34mindbender2no,
20:35gfredericksset! only works on vars with thread-local values
20:35mindbender2just direct set! within a fn
20:35gfrederickswhat var is this and why do you need to change it?
20:35mindbender2it's piggieback.clj that's the culprit
20:36gfredericksokay; I'm not familiar with that
20:36mindbender2trying to modify *cljs-repl-env*
20:36gfredericksyou can change a var's root value if you want
20:36gfrederickswith alter-var-root
20:36mindbender2ok thanks I'll try to modify the file and see what happens
20:38gfredericksnote you have to use a function there; so you might want clojure.core/constantly
20:38mindbender2I was about to mention that it required a fn thanks for poiting out
20:38mindbender2*pointing
21:16oichit 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:46ZEFRENCHACCENToich, last week
21:46ZEFRENCHACCENTI sawr a film
21:47matt_di'm watching a film right now
22:04oichmy problem with JDI doesn't happen in a different linux, so it's not ritz-nrepl
22:20oichthanks. I must reboot now.
23:03ivananyone else have problems with La Clojure locking up IDEA for 10+ seconds?
23:03taliosyou mean La Clojure -works-? ;-)
23:04taliosActualy, it was updated for 12. but that was a fork afaik.
23:04ivanwell, it can colorize Clojure source
23:04ivanI'm on 11 and the non-fork, I assume
23:05taliosany exceptions in your ~/.IntelliJ11/logs/idea.log file?
23:05talios( i think thats the path, for linux )
23:06frioooh
23:06friois idea 12 out?
23:06ivandon't see anything out of the ordinary in that log, but I also have threadDumps that show 20 different threads waiting for things
23:07ivanfrio: only EAP
23:08ivanI also have a CPU usage profile but I have no YourKit Java Profiler license
23:08ivannot that it's using any CPU while locked up