#clojure logs

2012-03-17

02:04kab3wmI'm having an issue where I expect a string to be returned and am getting a string, but it's surrounded by double quotes and parentheses. I'm new to Clojure and having a hard time googling this problem. I assume this is something simple but no amount of (pr (fn)), etc are getting rid of the quotes and parantheses.
02:10Scriptorkab3wm: pastebin the code in question?
02:15kab3wmScriptor: http://pastebin.com/7VTfEuWe
02:16kab3wmI tried to explain the problem a bit in the paste, but for a bigger picture, I am trying to get clostache ( mustache templates for clojure ) working with Noir. It works, except when I try to get layouts working too.
02:34stirfoofound another quirk in the reader: 0777/1 => 777, not 511
02:34ibdknoxkab3wm: use stencil instead of clostache
02:35cemerickredinger: ping
02:35kab3wmibdknox: I will give it a shot, thank you
02:35ibdknoxkab3wm: with mustache, I think it's also easier to do the header/footer pattern
02:36ibdknoxit makes it pretty easy with the partial syntax {{> header.mustache}}
02:36ibdknoxthough what you're doing should work
02:37ibdknoxthe only thing is you don't want it to end up escaped, so you'd want to do {{{content}}} which tells mustache to put exactly what you give it in there
02:37kab3wmthat sounds good too. I actually don't care how I do it, as long as I can get my content inbetween a layout :)
03:25codemacanyone here use overtone? I'm trying to get it set up on mac os x
03:25codemacI get the following whenever I run (use 'overtone.live)
03:25codemachttp://dpaste.org/46tON/
05:00espringeI want to have a string, whose contents are '\0' and when I print it to console, it writes those two characters. So I need to escape the slash, so I create it with "\\0" -- and the repl will print it out as '\\0'. I can verify it works with: (count (str "\\0")) which returns 2 as expected. However, how do I now print it out, in such a way that it only prints out two characters, not 3
05:07AimHereespringe > I'm slightly confused, since (println "\\0") appears to do what you want
05:08espringeAimHere: It prints 3 characters to the repl '\' '\' '0'. Is it possible for it to only print 2?
05:08AimHereIt prints two characters when I do it (three including the newline)
05:08espringe(I need that, so someone can copy and paste the results from the repl and use it)
05:08espringeAimHere: what version of clojure?
05:09AimHere1.3
05:09AimHere1.3.0
05:09espringeuser> "\\0"
05:09espringe"\\0"
05:09espringeclojure 1.3 too
05:10AimHereOh, well that's different.
05:11AimHereWhen you return an object to the repl, then it gets printed as something which unambiguously identifies it, I think
05:11AimHereI imagine that's related to (pr "\\0")
05:12espringeIf I start a new repl, and first thing do "\\0" it prints '\\0'
05:13espringeI am using jdk 7, i wonder if that could be it
05:13AimHereNah, I think what you've got is the correct behaviour
05:14AimHereThe repl is returning a string which is, in some sense, a , correct, representation of the object, so that if you feed it back to clojure, it should be able to recreate the object that was returned
05:15AimHereYou want the string that's "for public consumption", as (doc print) puts it
05:16espringeAimHere: Yeah, I can see its 'right' -- but it's not what I want. As the string I'm printing, is designed to be copy&pasted into another program
05:16AimHere,(println "\\0")
05:16clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
05:16AimHereWell can you not use the 'print' and 'println' functions to spit out what you're after?
05:17espringeHmm, yeah probably
05:17espringeI can work with this
05:18AimHereTHere's probably more output commands that spit out the public prettyprinted version. Someone's probably got a two line repl hack that'll do it too
05:20espringeOh btw, does anyone know if the cljs compile errors are better than the clojure ones? These ones make me want to set fire to my wrists
05:21AimHereI'd set fire to a kitten for a clojure stacktrace that mostly referred to the source file I'd just tried to run
05:23espringeAlso, does any know how to stop emacs making a stupid ass .#myfile.clj file? When ever it gets created, lein can't compile the project, and I have to delete it
05:24espringeNote, the '.' at the start of that file. The normal backup #myfile.clj# is fine
05:24espringeit's the '.#myfile.clj' that asplodes things
05:25AimHereIt usually goes away, if your file is saved and up to date
05:27espringeCan I tell it to put it somewhere else, it breaks my build and is increddible annoying
05:28espringeNo offense to anyone, but when did this ever become an acceptable compile error:
05:28espringe"Unknown location:
05:28espringe error: java.lang.RuntimeException: java.lang.Exception: "
05:28espringeThat's just ridiculous, I don't even get a line number. All I get is a stupid java exception
05:29espringeClojure is cool and all, but I don't think I've used anything that's given half as bad errors
05:30AimHerehttp://www.emacswiki.org/emacs/AutoSave
05:32espringeAimHere: Awesome
05:54stirfoo(int (first "\0")) => 0 ; \0 is the NUL character 0x0, specified as an octal escape.
07:03djpowellI remember there being a clojure library for COM interop; unfortunately, COM is impossible to google. Does anyone know what it is?
07:05djpowellhmm, it was probably just this: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Talking_to_Excel - an example of using a java lib to do it
07:38djpowellis there a way to download non-jar resources with lein? Eg, the DLLs for this project: http://www.mvnbrowser.com/artifact-details.html?groupId=net.sf.jacob-project&amp;artifactId=jacob&amp;version=1.14.3&amp;tab=FILES#tabs
08:30y3diis everyone here at the conference?
08:30y3dithis place is gonna be empty today
08:42prasadwhat is the simplest way of getting a sequence of files in a directory?
08:45raekprasad: use the .listFiles method of the File class
08:46raek(.listFiles (io/file "some-directory"))
08:46raekit returns an array, which you can treat like a seq
08:46gtuckerkelloggi feel like an idiot, but...
08:47gtuckerkellogg,(clojure.string/split "01234" #"")
08:47clojurebot["" "0" "1" "2" "3" ...]
08:48gtuckerkelloggis there a split that will get rid of the leading "" in the resultant vector?
08:48Chousuke_seq :P
08:48Chousuke_,(seq "foo")
08:48clojurebot(\f \o \o)
08:48gtuckerkelloggshit
08:48Chousuke_oh, I guess you have to map str as well if you need strings
08:48raekwhat does it mean to split a string with the empty string as the separator?
08:50gtuckerkelloggso because emptiness comes before the start of the string, it matches it?
08:51Chousuke_possibly
08:56Bronsaactually, you only need to map str
08:56Bronsa,(map str "foo")
08:56clojurebot("f" "o" "o")
12:51gfrederickswhy is my defrecord giving me a "Duplicate method name&signature in class file"?
13:04romanandregibdknox: are you there?
13:12ibdknoxromanandreg: hey
13:12romanandregibdknox: hey, quick question about noir… what's the core difference btw a wrapper and middleware in noir.server.handler ns?
13:13romanandregI realized they are both compojure middleware, but… there is something more, is it that wrappers add middleware on specific routes?
13:13ibdknoxromanandreg: custom middleware gets applied to all routes, while a wrapper add it to a certain route
13:13ibdknoxyep
13:14romanandregok… I'm adding some documentation to the noir.server.handler ns, would you like me to send a put request your way later in the day?
13:14romanandregpull*
13:14ibdknoxromanandreg: sure, but you shouldn't be using that directly
13:14ibdknoxthat ns is implementation detail
13:15ibdknoxromanandreg: noir.server is the public side, and it is documented
13:15romanandregibdknox: yes… I just want to figure out the inner details of this functions, is more of learning experience rather than anything else
13:15ibdknoxokidoke :)
13:16romanandregibdknox: great work btw… I didn't see the usage of binding in middleware like that
13:17romanandregI didn't see before*
13:17ibdknoxit's a useful pattern for making things specific to a request
13:22romanandregibdknox: yeah I see it as a way to do some sort of state monads without all the fuss… that's nice
13:24gfrederickswhy does implementing ISeq complain that the rest function doesn't exist?
13:25romanandregibdknox: oh, another quick question, what does the name variable "cur" stands for?
13:25ibdknoxromanandreg: current
13:26romanandregibdknox: ok… so cur in parse-route, cur will be a compojure route right?
13:29ibdknoxromanandreg: no that chain of things is dealing with a vector of params from defpage
13:32technomancyif anyone planning on attending my swarm coding talk would be up for helping facilitate a small group hacking together over SSH and emacs/vim, please let me know
13:32technomancycould use a few volunteers
13:36romanandregibdknox: ok I see, I think I understand now… may I suggest probably changing the cur var for page-params?
13:36Frozenlocktechnomancy: I doubt I could be of any help. Your talk might be interesting though. Where will it be? Will it be uploaded?
13:36ibdknoxromanandreg: it's only one, and it's not deterministic
13:37romanandregtechnomancy: I saw over twitter that you saw tavisrudd speech driven development demo :-)
13:37technomancyFrozenlock: it'll be way around in the back room. it's pretty interactive; I don't think it would make a lot of sense recorded.
13:37technomancyromanandreg: oh, have you seen it?
13:38romanandregtechnomancy: I've been working with him here in Vancouver all clojure stuff, I couldn't go to the clj/west…
13:38technomancyoh, cool
13:39technomancyyeah, it's a lot of fun to watch
13:39Frozenlocktechnomancy: with actual storage cost, everything is worth being recorded :)
13:39FrozenlockEven me singing in the shower. Laaaalaaalaalalala laaaaaaa
13:39romanandregtechnomancy: funny is when you pair program with him… he start talking his code words at you and you are having wtf moments all the time :-)
13:40technomancyromanandreg: "slap, twert"
13:41romanandregibdknox: uhmm, ok, well that was the best name I could think of besides cur, cur doesn't tell much even after seeing 3 other functions :-)
13:41gfrederickstechnomancy: got a working version of reconstitutible iterate
13:42technomancygfredericks: no kidding? sweet
13:42technomancygist?
13:42clojurebotgist is paste
13:43gfrederickstechnomancy: yep, one sec
13:43romanandregibdknox: thanks for your help, cheers.
13:45romanandregtechnomancy: can the swarm-coding be done remotely?
13:45romanandregtechnomancy: is it just in place?
13:45technomancyromanandreg: my talk will be about doing it in a user group, but you could do it remotely for sure
13:46romanandregtechnomancy: is that the normal thing you do in seajure?
13:46gfrederickstechnomancy: https://gist.github.com/2063360
13:46technomancyromanandreg: yeah
13:47technomancygfredericks: wild!
13:48gfredericksI don't know if there's any chance of it being too useful...but at least it was fun to write
14:05justicefriesabout to leave, but does anyone want beginningclojure.com?
14:05justicefriesPM me.
14:11tmciverIs there a standard way to remove newlines from the middle of a string or should I just do something like: ##(->> "The\nquick\nbrown\nfox." (re-seq #"\w+") (interpose " ") (apply str))
14:11lazybot⇒ "The quick brown fox"
14:13qbg&(.replaceAll "The\nquick\nbrown\nfox." "\n" "")
14:13lazybot⇒ "Thequickbrownfox."
14:13qbg&(.replaceAll "The\nquick\nbrown\nfox." "\w+" " ")
14:13lazybotjava.lang.RuntimeException: Unsupported escape character: \w
14:13qbg&(.replaceAll "The\nquick\nbrown\nfox." "\\w+" " ")
14:13lazybot⇒ " \n \n \n ."
14:13Bronsa,(clojure.string/replace "The\nquick\nbrown\nfox." "\n" " ")
14:13clojurebot"The quick brown fox."
14:13tmciverqbg: very nice. Would that be considered the idiomatic way?
14:14tmciverand Bronsa ;)
14:14qbg&(.replaceAll "The\nquick\nbrown\nfox." "\\s+" " ")
14:14lazybot⇒ "The quick brown fox."
14:14qbgThere we go :)
14:14Lajla##"I worship his shadow"
14:14LajlaDoes it work like this ##"I worship his shadow"
14:14FrozenlockI don't see any add-to-list function. Should I write my own, or was it omitted by design?
14:14LajlaBaww
14:14qbgtmciver: It is really easy at least
14:15tmciverqbg: yes definitely. Good enough, thanks.
14:15gfredericksFrozenlock: you want to add to the end of a list specifically?
14:15tmciver,(doc conj) ;; Frozenlock
14:15clojurebot"([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."
14:16gfredericks,(conj [1 2 3] 8)
14:16clojurebot[1 2 3 8]
14:16gfredericks,(conj '(1 2 3) 8)
14:16clojurebot(8 1 2 3)
14:16tomoj&(.replace "The\nquick\nbrown\nfox" "\n" " ")
14:16lazybot⇒ "The quick brown fox"
14:16tomojhuh..
14:16FrozenlockWell, I'm looking for something like `append'. After, perhaps, `add-to-list'
14:16tomojI apparently don't know what "All" means
14:17gfredericksFrozenlock: if you need to add at the end specifically you should probably use vectors with conj
14:17gfredericks(instead of lists)
14:17qbg.replace is for charsequences
14:17qbg.replaceAll gives you regex power
14:17FrozenlockYes, but conj doesn't work very well with two vector or list.
14:17tomojaha
14:17Frozenlock,(conj [1 2 3] [4 5 6])
14:17clojurebot[1 2 3 [4 5 6]]
14:17Bronsa,(concat [1 2 3] [4 5 6])
14:17clojurebot(1 2 3 4 5 ...)
14:17gfredericks,(apply conj [1 2 3] [4 5 6])
14:18clojurebot[1 2 3 4 5 ...]
14:18tmciverqbg: but replaceAll doesn't seem to allow you to use \w
14:18FrozenlockOh, concat :D
14:18FrozenlockThanks!
14:18qbgtmciver: How so?
14:18FrozenlockI was wondering if the absence of such a function was to discourage some practice.
14:18qbgIt takes strings, you have to escape the \
14:18tmciver,(.replaceAll "The\nquick\nbrown\nfox." "\w+" " ")
14:18clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \w>
14:19qbg,(.replaceAll "The\nquick\nbrown\nfox." "\\w+" " ")
14:19clojurebot" \n \n \n ."
14:19qbg&"\\w+"
14:19lazybot⇒ "\\w+"
14:19gfredericksFrozenlock: there's not a function to add to the end of a list because it's inefficient
14:19tmciverqbg: hmm, that's the opposite effect I was looking for.
14:20qbg,(.replaceAll "The\nquick\nbrown\nfox." "\\s+" " ")
14:20clojurebot"The quick brown fox."
14:20tmciverqbg: Ahh, I have to review regexs; \w is word? \s is whitespace?
14:20qbgYes
14:20tmcivergot it. Thanks again.
14:21qbgI made that error above, if you didn't notice it
14:21tmciverYeah, that's what threw me.
14:22qbgJust a little TDD :p
14:24qbg,(.replaceAll "The\nquick\nbrown\nfox." (.toString #"\s+") " ")
14:24clojurebot"The quick brown fox."
14:24tmciver,(.toString #"\s+")
14:24clojurebot"\\s+"
14:24tmciverinteresting
14:24tmcivera little verbose but good to know nonetheless.
14:38tomoj&(clojure.string/replace "The\nquick\nbrown\nfox." #"\s+" " ")
14:38lazybot⇒ "The quick brown fox."
14:40johnmn3So I asked around a while back about good companies to go with for collecting money from my clients.
14:40johnmn3I ended up going with Google Checkout
14:40johnmn3big mistake
14:41qbgjohnmn3: Get screwed or something?
14:41johnmn3they're doing audits over there, or something, and decided freeze my account until provide them with 4 documents
14:42johnmn3a company catalog or brocure, inventory receipts or supplier contact information, ID or proof of address, and a copy of my professional license
14:42johnmn3wtf?
14:42johnmn3and now they're holding on to a $1000.00 and until I prove x, y, z, they're not giving it to me.
14:43johnmn3and all these secondary requirements popped up /after/ the client paid.
14:43foodoomay I ask what your job is?
14:44johnmn3I just formed an LLC with my sister. I did some network administration remotely for a restaurant in NYC, which is what the 1000 is for.
14:45tomojI guess wildly that there is no good company for small merchants
14:45johnmn3but the LLC is primarily geared toward building business-process automation solutions, using mostly clojure
16:03jaleycan anyone enlighten me? what's with the -o and -e suffix naming convention in core.logic? this is apparently very difficult to google!
16:03technomancyit's a scheme thing IIUC
16:04jaleyohhhhh. it was driving me nuts while reading tutorials
16:07llasramjaley: core.logic is an implementation of a logic programming system developed in the book /The Reasoned Schemer/. My understanding is that the core.logic developers have opted to keep the API as close as possible to the one described there in order to ease portability of systems built on top of it, of which there is apparently at least one, and they do plan on tackling it
16:08jaleyllasram: ah, just fond this: http://stackoverflow.com/questions/9164051/why-do-minikanren-names-always-end-with-o
16:08llasramOh, nice. That makes it make even more sense. I was just about to say that I had no idea where the TRS names came from in the first place :-)
16:09jaleymaaaaan... it needs to be explained on the core.logic wiki. it was like listening to someone give a presentation making a clicking noise at the end of each sentence
16:10jaleyi thought the author was pig-latinising the function names or something
16:12jaley; (defn ondcay ...)
16:12tomojI wonder why it was decided to stick with minikanren's names
16:13technomancytomoj: I asked him on the mailing list
16:13technomancyhe was kind of evasive
16:14tomojthe second answer on that stackoverflow also suggests maybe we should just use ? since it's allowed here?
16:14tomojinstead of 'o' I mean
16:15tomojoh
16:15jaleyso what does the 'e' indicate?
16:15tomojI didn't see your explanation llasram
16:15tomojmakes sense if you've read that, I suppose
16:20dnolenllasram: I have a feeling ideas will flow in both directions between Clojure and Scheme implementations in the future. Just because people find it unfamiliar isn't a compelling reason to change thigns.
16:21dnolentomoj: ? communicates predicate, relations aren't boolean.
16:22tomojah, right
16:23tomojthey aren't boolean?
16:23dnolentechnomancy: I didn't think my answer was that evasive :)
16:23dnolentomoj: nope
16:24dnolenjaley: it's not a Scheme thing really. It's a miniKanren thing.
16:25tomojwhat does it mean that relations aren't boolean?
16:26dnolentomoj: precisely that. they don't even return usuable values in the normal sense.
16:32jaleydnolen: just found section 1.5 of byrd :-)
16:32dnolenjaley: byrd's thesis is an excellent read
16:33jonasendnolen: https://refheap.com/paste/1100
16:33jaleydnolen: if i'm the first person to say, "what's with the Os!?", then maybe it's no big deal, but I feel the tutorial could use a short FYI at the start. some people are easily distracted :-)
16:36dnolenjaley: I agree, I think the tutorial could have a note - and then at the end provide an advanced example of how you can mixing FP w/ LP for those people that are still skeptical about the convention.
16:37dnolenjonasen: I see where you going ... thinking about it.
16:37jaleydnolen: yeah.. personally I don't object to the convention, just wondered what i was missing
16:37jonasendnolen: I'm sure there are better ways to do this.
16:38jaleydnolen: if I presented some code to some group with "-zomg" affixed to every function name, I wonder how long until a hand is raised
16:38dnolenjaley: yes, tho I'm not sure how many times I have to say they're not useful functions outside of run/run*
16:39jaleydnolen: probably for as long as it's the first thing people read?
16:40dnolenjaley: like I said, I'm all for brief note and a justification.
16:48dnolenhttps://github.com/clojure/core.logic/wiki/A-Core.logic-Primer#wiki-Note_on_naming_conventions
16:49true_droidI'm curious, how did core.logic take off in CLojure? was it something people were interested in but had no support in other languages since Prolog
16:49true_droidor it just appeared and then people got interested?
16:50RaynesProbably the latter.
16:51dnolentrue_droid: it started off as an experiment to see if I could make miniKanren run faster under Clojure than Scheme. I presented it at a Clojure NYC meetup and rhickey liked it and suggested it get moved into contrib.
16:51TheBusbyembrace and extend hopefully :)
16:52TimMctrue_droid: You cannot in the general case explain the popularity of languages or libraries in satisfying ways.
16:52TimMcIt comes down to a well-written blog-post here, a nice build tool there...
16:52true_droid:)
16:52true_droidok, thanks for the info!
16:53dnolentrue_droid: I also wouldn't say that core.logic is particularly popular as far a Clojure libs go :) people find it interesting but we're all still figuring it out.
16:54true_droiddnolen: I have a rather superficial interest in CLojure, but this one library is the one I hear most about
16:54dnolentrue_droid: rest assured, it is not even remotely the most interesting thing about Clojure ;)
16:56TimMctrue_droid: In this case, dnolen is a badass, so people were curious. :-)
16:56true_droidTimMc: Oh, I see
16:56TimMc(That's my story and I'm sticking with it.)
16:56dnolen:P
16:57true_droiddnolen: btw, I loved your post on abstraction in ClojureScript vs CoffeeScript
16:57TimMcIt's really as good a reason as any.
16:57dnolentrue_droid: that was fun post, I was surprised by the response.
16:57true_droidI can't convince my friends that it's useful yet, but it's definitely cool :)
16:58dnolentrue_droid: welcome to the club :)
16:59true_droiddnolen: thanks! :)
17:01true_droidbtw, I live in Ukraine
17:02true_droidit's kind of sad that all the cool events in programming are happening in the US mostly
17:02true_droidtoo far :(
17:07ChibaPettrue_droid: ILC's in Japan this year, isn't it?
17:07ChibaPetYeah, Kyoto.
17:07dnolentrue_droid: what about EuroClojure?
17:07ChibaPetLook at some of the events here: http://alu.org/alu/home
17:07jaleydnolen: just saw the note - thanks! curiosity satisfied now :)
17:08ChibaPetJapan, Croatia, Russia, Denmark...
17:09dnolenrefheap is cool
17:10true_droidRussia is more reachable, thanks for the links
17:18Raynesdnolen: Are you at C/W?
17:19dnolenRaynes: I'm not.
17:19RaynesDamn -- I was going to tell you to go tell people how cool refheap is.
17:19dnolenRaynes: haha :) I wish I could.
17:19RaynesI'm not there to represent.
17:20Raynes<3
17:34Rayneshttp://dev.clojure.org/jira/browse/CLJ-918 Nice. RefHeap pastes have even made it to the jirasphere.
17:35DerGuteMoritzwhat's the deal with my clojurescript program trying to load /deps.js?
17:35aperiodici just told some people
17:35aperiodici don't think the paid very much attention, though
17:36DerGuteMoritzaperiodic: are you replying to me?
17:37RaynesI'm guessing it was a response to my saying I wish I could be at clojure/west to represent refheap.
17:38dnolenDerGuteMoritz: aperiodic: that usually means there's something wrong w/ your compilation settings.
17:38DerGuteMoritzah :-)
17:38DerGuteMoritzdnolen: I use cljsbuild with a pretty bare bones config - any hints what I could go after?
17:39DerGuteMoritz(lein-cljsbuild that is)
17:39dnolenDerGuteMoritz: https://refheap.com/paste/1103 works for me.
17:40DerGuteMoritzdnolen: yep, that looks almost exactly like my project.clj except I use clojure 1.3.0 and no compiler settings ... odd
17:41DerGuteMoritzI have set :output-to to a relative path to a directory above the project dir (i.e. starting with ".."); maybe that's the cause ... let me try
17:43DerGuteMoritzno dice :-(
17:43DerGuteMoritznote that the code actually works
17:44DerGuteMoritzit just does that extra request
17:44dnolenDerGuteMoritz: not sure then, I saw that error and then I changed my compiler settings around and I didn't see it anymore.
17:44DerGuteMoritzmyterious
17:44DerGuteMoritz+s
17:44DerGuteMoritz:-)
17:44dnolenDerGuteMoritz: deps.js is something GClosure looks for.
17:45DerGuteMoritzlet me try turning on simple optimizations like you do
17:45DerGuteMoritzyep, that helped
17:45DerGuteMoritzok, not sure what to make from that :-)
17:47dnolenDerGuteMoritz: if you figure it out let me know :)
17:49DerGuteMoritzdnolen: will do, thanks a lot!
18:01DerGuteMoritzwoohooo those lein-cljsbuild traces make me feel like having huffed too much node.js!
18:17FrozenlockWeird... I added [lacij "0.7.0-SNAPSHOT"] in my :dev-dependencies (leiningen), but I can't use it... (use 'lacij) throws an error.
18:17FrozenlockAnd yes, I've- lein deps-
18:17FrozenlockIs there any other way I should load this library?
18:18tmciverFrozenlock: the namespace you use is probably something else, like (use 'lacij.core)
18:20Frozenlocklacij, lacij.core, lacij.graph.core... none of them works.
18:20FrozenlockOh wait... do I need to start a new swank connection?
18:20FrozenlockWhen I add a new dependency, that is.
18:21qbgyeah
18:22irc2samushi guys! how can I call a Java class contructor that takes a variable list of arguments? I thought (MyClass. "arg1" "arg2") would be ok
18:22qbgYou mean varargs?
18:22qbgYou need to box them in an array
18:23irc2samuslike (MyClass. ["arg1" "arg2"]) or a Java array?
18:23qbgJava array
18:23irc2samusok I'll try that thanks
18:23qbginto-array should prove useful
18:24amalloyi usually use into-array, but doesn't ##(doc make-array) work as well?
18:24lazybot⇒ "([type len] [type dim & more-dims]); Creates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects f... https://refheap.com/paste/1104
18:24amalloyah. no, because it only takes lengths, not init items. thanks lazybot!
18:25raekthen there's 'to-array' and 'object-array' too...
18:27irc2samusI just tried to-array but it returns an array of Object, can I tell it to create an array of String?
18:27dnolenimproving kibit https://refheap.com/paste/1105
18:28raekirc2samus: I think you need to use into-array in that case
18:28raek(into-array String ...collection-of-elements...)
18:30irc2samusah great, perfect thanks
18:32qbgdnolen: Nice.
18:36qbgdnolen: Is there a reason why in core.logic (run* [q] (fresh [a b] (== #{a b} #{1 2}) (== [a b] q))) should only produce one result?
18:36mdeboardSo, I have watched Simple Made Easy several times, and this talk from PyCon 2012, while not as entertaining nor confidently delivered as rhickey's, is definitely in the same spirit. http://pyvideo.org/video/880/stop-writing-classes If you write Python and yearn for simplicity, give it a watch.
18:36qbg(other than sets being tricky)
18:37dnolenqbg: unification doesn't create more than result. only conde does.
18:37dnolenmore than one
18:43irc2samusit seems to be the case but I'll just ask to be sure, is seq usable as a java List?
18:44qbgnot all seqs
18:44dnolen,(bases '())
18:44clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to java.lang.Class>
18:44irc2samus(seq ["foo" "bar"]) for List<String>
18:44dnolen,(bases (class '()))
18:44clojurebot(clojure.lang.Obj clojure.lang.IPersistentList java.util.List clojure.lang.ISeq clojure.lang.Counted)
18:45raek,(bases (class (lazy-seq nil)))
18:45qbg,(bases (class (range)))
18:46qbg&(bases (class (range)))
18:46lazybot⇒ (clojure.lang.Obj clojure.lang.ISeq clojure.lang.Sequential java.util.List clojure.lang.IPending)
18:46clojurebot(clojure.lang.Obj clojure.lang.ISeq clojure.lang.Sequential java.util.List clojure.lang.IPending ...)
18:46clojurebot(clojure.lang.Obj clojure.lang.ISeq clojure.lang.Sequential java.util.List clojure.lang.IPending ...)
18:47qbgInteresting
18:47qbg(.size (range))
18:47qbg&(.size (range))
18:47lazybotExecution Timed Out!
18:49qbg&(bases clojure.lang.ISeq)
18:49lazybot⇒ #<Class[] [Ljava.lang.Class;@a9b899>
18:50qbg&(ancestors clojure.lang.ISeq)
18:50lazybot⇒ #{clojure.lang.Seqable clojure.lang.IPersistentCollection}
19:42hhutchi'm new-ish to emacs/clojure-mode .. is there a way to do the equivalent of M-( and M-" with vectors and maps ?
19:47irc2samusguys how can I combine two (finite) sequences into a sequence of pairs? it seems clojure.zip isn't like python's zip
19:47TimMc~zip
19:47clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
19:48irc2samusah great, thanks :)
19:48TimMcThat'll works for infinite sequences too.
20:02technomancyhhutch: paredit does that and a lot more
20:07irc2samusthe last one (I hope) how can I create a sequence from a java Iterator? seq seems to work with Iterable only
20:09TimMcA lazy seq?
20:10TimMcI think iterators generally have a toList method, yeah? That gives you something seqable.
20:11qbg&(doc iterator-seq)
20:11lazybot⇒ "([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly."
20:11TimMcWeird, why is that not part of seq?
20:12qbgNo clue
20:12qbgAh, actually
20:12qbgiterators are single use
20:12TimMcOooh, fair point.
20:13TimMcseq only provides views onto things
20:14irc2samusyeah I have that but I'm writing a test and I'd like to go over both methods
20:14irc2samusin case you're curious I'm writing a test for https://github.com/nathanmarz/storm which is written in Java but has its tests written in Clojure
20:15irc2samusso it seems that with lazy-seq I need to implement the iteration mechanism, sort of
20:15irc2samusis this required to be infinte? I don't see how to stop it
20:16TimMcirc2samus: nil
20:17mishadoffhello
20:18irc2samusiterator-seq made the trick
20:19irc2samusso TimMc if I were using lazy-seq it would end when I return nil? how can I make a sequence of nils then?
20:19JorgeBwhat's the idiomatic way to get from [ {:key [elem1 elem2]}, {:key [elem3 elem4]} ] to {:key [elem1 elem2 elem3 elem4]} ?
20:19JorgeBarray of maps to map of arrays
20:20technomancy,(merge-with concat [ {:key [elem1 elem2]}, {:key [elem3 elem4]} ])
20:20JorgeBmerge-with?
20:20clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: elem1 in this context, compiling:(NO_SOURCE_PATH:0)>
20:20JorgeB:)
20:20technomancyoh noes!
20:22JorgeBthanks, I'll try that
20:28TimMcirc2samus: (cons nil ...) is different from nil
20:30irc2samusahh I see, there you're continuing the sequence
20:30irc2samusthanks
20:40bprI see an interesting discussion of integrating websockets with Ring (https://groups.google.com/d/topic/ring-clojure/9qIosW--dt8/discussion). Does anyone know if there's been any progress on this since july '10?
20:42weavejesterbpr: There were additional discussions. I think my current conclusion is that a websocket protocol would, in effect, need something different than Ring.
20:42bprok
20:42weavejesterbpr: As HTTP and websockets are two different protocols, it doesn't make much sense to write a single interface for both.
20:43bpresp. since HTTP is req/resp oriented and websockets are full-duplex streams
20:43weavejesterbpr: Right :)
20:44bprI have tried using Aleph, but it doesn't seem to work with Clojure 1.3.0. At least I think that's what the issue I'm seeing is.
20:46bprthat's interesting
20:46technomancyit's like a page and a half of adapter code
20:47bpris it available on github or somewhere? I haven't worked with Netty before.
20:48mishadoffIs any good interface for lucene in clojure?
20:48tomojbpr: which version of aleph did you try?
20:48bpr0.2.1-alpha1, 0.2.1-beta1, 0.2.1-beta2, 0.2.1-SNAPSHOT
20:48technomancybpr: https://github.com/heroku/pulse/blob/ventricle/src/drain/adapter.clj
20:48bprnice, thanks technomancy
20:49technomancysure
20:49tomojwhere did you find 0.2.1-beta2?
20:49technomancyit's not production-hardened yet
20:49technomancywhatever that means
20:49tomojbut, I thought 1.3 was supposed to work in 0.2.1-beta1
20:50tomojI still haven't ever tried it, though, afaik..
20:51bprtomoj: yeah, that's what I thought too. When I do lein run (or clojure-jack-in) it doesn't seem to even finish the compile step.
20:52bprtomoj, Actually you're right. I saw mention of 0.2.1-beta2 somewhere and lein wasn't able to find an artifact for it.
20:52tomojit just hangs?
20:52bprtomoj: yes
20:53bprAside from checking CPU usage to see if it's looping, I haven't poked around any deeper.
20:54bprIt's not looping btw. CPU usage was low.
20:58bprhttps://refheap.com/paste/1181 https://refheap.com/paste/1182
20:59bprthat's the project.clj and the main.clj
20:59tomojstrange
21:00tomojmaybe it's a ring interop problem?
21:03bprhttps://refheap.com/paste/1183 <-- works
21:03bprrather, that doesn't work
21:03tomojhttps://github.com/tomo/alephtest
21:03bprthis does: https://refheap.com/paste/1184
21:03bpractually, reverse that
21:03bpr1183 does work, and 1184 doesn't
21:04tomojthat is a demo of working websocket for me
21:04tomojdunno if it's the ring stuff or what..
21:08tomojI mean, the ring-specific aleph stuff :)
21:09DragonMaster1337Hiya.
21:09bprtomoj, seems to work for me too
21:10DragonMaster1337Has anyone here had any problems with clojurescript one? I go into the root and run lein repl, then (go), this launches firefox, i type (js/alert "hello") but it doesnt get evaluated in the browser. Doesnt work doing starting from emacs either.
21:11DragonMaster1337The app launches and works like it should.
21:11DragonMaster1337No luck with navigating chrome to it either.
21:12tomojbpr: maybe you should post on the aleph-lib google group if you haven't given up on aleph yet
21:13tomojgood luck
21:22pandeiroso clojure-jack-in runs lein deps automatically?
21:24pandeiro...i didn't realize i could jump straight in and skip that step, pretty cool
21:28FrozenlockYay... just discovered why my counter wasn't working http://thinkrelevance.com/blog/2008/09/16/pcl-clojure-chapter-6
21:28Frozenlock(and I indeed looked for a setf command...)
21:44yoklovdo people use clojure-project-mode?
21:45yoklovi see it in marmalade...
21:45yoklovactually never mind, it requires i use project mode, which i do not.
22:01dabdcan i create a def outside of a namespace? I would like to add the ^dynamic declaration to a def in the clojure.contrib.duck-streams namespace.
22:06gfredericks`hmm
22:06gfredericks`"creating a def" isn't what you're talking about, since the var already exists
22:07gfredericks`you can probably just alter the metadata; I'm not 100% positive that will work, and even less positive that it won't be heavily frowned upon
22:09gfredericks`but try (alter-meta! #'clojure.contrib.duck-streams/foo-bar assoc :dynamic true)
22:11dabdgfredericks: it didn't work
22:12gfredericks`yeah it looks like it doesn't even work within the same ns
22:12gfredericks`so presumably the dynamicity is stored somewhere else and not changeable
22:12gfredericks`static dynamicity :)
22:13gfredericks`dabd so with-redefs doesn't work for what you're doing?
22:13dabdgfredericks: i don't know about with-redefs
22:13dabdgoing to look into doc
22:14gfredericks`dabd: it's for redeffing vars globally, rather than thread-locally
22:14gfredericks`the vars don't have to be dynamic
22:15dabdgfredericks: works great! thanks
22:16gfredericks`&"w00p"
22:16lazybot⇒ "w00p"
22:16dabdwhat i was trying to achieve was change the *default-encoding* used by read-lines function in that namespace. It assumes "UTF-8" but i'm trying to read an ISO-8859-15 file.
22:17gfredericks`oh this must be one of the libs that hasn't been updated for 1.3 yet
22:17gfredericks`oh wait
22:17gfredericks`duck-streams
22:17gfredericks`dabd: use clojure.java.io instead
22:18gfredericks`that's what duck-streams turned into
22:21dabdgfredericks: looks like it does not have a read-lines function
22:21dabdbut it is ok
22:24amalloydabd: just use ##(doc line-seq), and give it a reader that has the right encoding set
22:24lazybot⇒ "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."
22:29gfredericks`is there any resource that explains how binding conveyance works? i.e., under what circumstances it happens?
22:40bprgfredericks`: what's binding conveyance?
22:41pyninjaI'm having an issue with converting a unicode string to valid JSON: https://gist.github.com/654dba2509c948b6d43c The first character in the JSON output is http://www.fileformat.info/info/unicode/char/1f60a/index.htm, but the second seems to be invalid (http://www.fileformat.info/info/unicode/char/de0a/index.htm) and when I parse it with JSONKit (an Objective-C library) it says that character isn't valid unicode. Why is it bein
22:41pyninjag inserted at all?
22:42pyninjaI just realized you can't see it in the gist for some reason, but it's this character: 😊
22:45ivanpyninja: this looks like a bug in Clojure. It's encoding your character wrong. Not surprising, given that it's outside the BMP.
22:46ivan\u1f60a will be interpreted as \u1f60 a by everything
22:48ivanthis is probably right:
22:48mefestopyninja: what version of clojure/data.json are you using?
22:48ivangah. I can't paste the snowman into my client
22:48ivansimplejson gives '"\\ud83d\\ude0a"'
22:48mefestodata.json 0.1.3 contains this commit which might be relevant: https://github.com/clojure/data.json/commit/f0dd129f31b1f7cd26c3d9483696cade74d4e832
22:49pyninjahm
22:50pyninjawell i'm using clojure 1.2.1
22:55pyninjawell, i upgraded to clojure 1.3.0 and i got the same thing
22:59pyninjathat commit does look like it should fix it, but how can i upgrade to the latest version of data.json itself?
22:59mefestopyninja: are you using leiningen?
22:59pyninjaoh i just realized that data.json doesn't come with clojure
22:59pyninjayeah, all i have to do is change [org.clojure/data.json "0.1.0"]. heh
23:00mefestodunno if it'll make a difference for you but the commit switched from (.charAt s i) to (Character/codePointAt s i)
23:00tomojcheshire encodes it to "\"😊\"" fwiw
23:02pyninjahm, i didn't know about cheshire.