2012-03-17
| 02:04 | kab3wm | I'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:10 | Scriptor | kab3wm: pastebin the code in question? |
| 02:15 | kab3wm | Scriptor: http://pastebin.com/7VTfEuWe |
| 02:16 | kab3wm | I 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:34 | stirfoo | found another quirk in the reader: 0777/1 => 777, not 511 |
| 02:34 | ibdknox | kab3wm: use stencil instead of clostache |
| 02:35 | cemerick | redinger: ping |
| 02:35 | kab3wm | ibdknox: I will give it a shot, thank you |
| 02:35 | ibdknox | kab3wm: with mustache, I think it's also easier to do the header/footer pattern |
| 02:36 | ibdknox | it makes it pretty easy with the partial syntax {{> header.mustache}} |
| 02:36 | ibdknox | though what you're doing should work |
| 02:37 | ibdknox | the 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:37 | kab3wm | that sounds good too. I actually don't care how I do it, as long as I can get my content inbetween a layout :) |
| 03:25 | codemac | anyone here use overtone? I'm trying to get it set up on mac os x |
| 03:25 | codemac | I get the following whenever I run (use 'overtone.live) |
| 03:25 | codemac | http://dpaste.org/46tON/ |
| 05:00 | espringe | I 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:07 | AimHere | espringe > I'm slightly confused, since (println "\\0") appears to do what you want |
| 05:08 | espringe | AimHere: It prints 3 characters to the repl '\' '\' '0'. Is it possible for it to only print 2? |
| 05:08 | AimHere | It prints two characters when I do it (three including the newline) |
| 05:08 | espringe | (I need that, so someone can copy and paste the results from the repl and use it) |
| 05:08 | espringe | AimHere: what version of clojure? |
| 05:09 | AimHere | 1.3 |
| 05:09 | AimHere | 1.3.0 |
| 05:09 | espringe | user> "\\0" |
| 05:09 | espringe | "\\0" |
| 05:09 | espringe | clojure 1.3 too |
| 05:10 | AimHere | Oh, well that's different. |
| 05:11 | AimHere | When you return an object to the repl, then it gets printed as something which unambiguously identifies it, I think |
| 05:11 | AimHere | I imagine that's related to (pr "\\0") |
| 05:12 | espringe | If I start a new repl, and first thing do "\\0" it prints '\\0' |
| 05:13 | espringe | I am using jdk 7, i wonder if that could be it |
| 05:13 | AimHere | Nah, I think what you've got is the correct behaviour |
| 05:14 | AimHere | The 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:15 | AimHere | You want the string that's "for public consumption", as (doc print) puts it |
| 05:16 | espringe | AimHere: 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:16 | AimHere | ,(println "\\0") |
| 05:16 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT> |
| 05:16 | AimHere | Well can you not use the 'print' and 'println' functions to spit out what you're after? |
| 05:17 | espringe | Hmm, yeah probably |
| 05:17 | espringe | I can work with this |
| 05:18 | AimHere | THere'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:20 | espringe | Oh 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:21 | AimHere | I'd set fire to a kitten for a clojure stacktrace that mostly referred to the source file I'd just tried to run |
| 05:23 | espringe | Also, 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:24 | espringe | Note, the '.' at the start of that file. The normal backup #myfile.clj# is fine |
| 05:24 | espringe | it's the '.#myfile.clj' that asplodes things |
| 05:25 | AimHere | It usually goes away, if your file is saved and up to date |
| 05:27 | espringe | Can I tell it to put it somewhere else, it breaks my build and is increddible annoying |
| 05:28 | espringe | No offense to anyone, but when did this ever become an acceptable compile error: |
| 05:28 | espringe | "Unknown location: |
| 05:28 | espringe | error: java.lang.RuntimeException: java.lang.Exception: " |
| 05:28 | espringe | That's just ridiculous, I don't even get a line number. All I get is a stupid java exception |
| 05:29 | espringe | Clojure is cool and all, but I don't think I've used anything that's given half as bad errors |
| 05:30 | AimHere | http://www.emacswiki.org/emacs/AutoSave |
| 05:32 | espringe | AimHere: Awesome |
| 05:54 | stirfoo | (int (first "\0")) => 0 ; \0 is the NUL character 0x0, specified as an octal escape. |
| 07:03 | djpowell | I remember there being a clojure library for COM interop; unfortunately, COM is impossible to google. Does anyone know what it is? |
| 07:05 | djpowell | hmm, 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:38 | djpowell | is 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&artifactId=jacob&version=1.14.3&tab=FILES#tabs |
| 08:30 | y3di | is everyone here at the conference? |
| 08:30 | y3di | this place is gonna be empty today |
| 08:42 | prasad | what is the simplest way of getting a sequence of files in a directory? |
| 08:45 | raek | prasad: use the .listFiles method of the File class |
| 08:46 | raek | (.listFiles (io/file "some-directory")) |
| 08:46 | raek | it returns an array, which you can treat like a seq |
| 08:46 | gtuckerkellogg | i feel like an idiot, but... |
| 08:47 | gtuckerkellogg | ,(clojure.string/split "01234" #"") |
| 08:47 | clojurebot | ["" "0" "1" "2" "3" ...] |
| 08:48 | gtuckerkellogg | is there a split that will get rid of the leading "" in the resultant vector? |
| 08:48 | Chousuke_ | seq :P |
| 08:48 | Chousuke_ | ,(seq "foo") |
| 08:48 | clojurebot | (\f \o \o) |
| 08:48 | gtuckerkellogg | shit |
| 08:48 | Chousuke_ | oh, I guess you have to map str as well if you need strings |
| 08:48 | raek | what does it mean to split a string with the empty string as the separator? |
| 08:50 | gtuckerkellogg | so because emptiness comes before the start of the string, it matches it? |
| 08:51 | Chousuke_ | possibly |
| 08:56 | Bronsa | actually, you only need to map str |
| 08:56 | Bronsa | ,(map str "foo") |
| 08:56 | clojurebot | ("f" "o" "o") |
| 12:51 | gfredericks | why is my defrecord giving me a "Duplicate method name&signature in class file"? |
| 13:04 | romanandreg | ibdknox: are you there? |
| 13:12 | ibdknox | romanandreg: hey |
| 13:12 | romanandreg | ibdknox: hey, quick question about noir… what's the core difference btw a wrapper and middleware in noir.server.handler ns? |
| 13:13 | romanandreg | I realized they are both compojure middleware, but… there is something more, is it that wrappers add middleware on specific routes? |
| 13:13 | ibdknox | romanandreg: custom middleware gets applied to all routes, while a wrapper add it to a certain route |
| 13:13 | ibdknox | yep |
| 13:14 | romanandreg | ok… 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:14 | romanandreg | pull* |
| 13:14 | ibdknox | romanandreg: sure, but you shouldn't be using that directly |
| 13:14 | ibdknox | that ns is implementation detail |
| 13:15 | ibdknox | romanandreg: noir.server is the public side, and it is documented |
| 13:15 | romanandreg | ibdknox: yes… I just want to figure out the inner details of this functions, is more of learning experience rather than anything else |
| 13:15 | ibdknox | okidoke :) |
| 13:16 | romanandreg | ibdknox: great work btw… I didn't see the usage of binding in middleware like that |
| 13:17 | romanandreg | I didn't see before* |
| 13:17 | ibdknox | it's a useful pattern for making things specific to a request |
| 13:22 | romanandreg | ibdknox: yeah I see it as a way to do some sort of state monads without all the fuss… that's nice |
| 13:24 | gfredericks | why does implementing ISeq complain that the rest function doesn't exist? |
| 13:25 | romanandreg | ibdknox: oh, another quick question, what does the name variable "cur" stands for? |
| 13:25 | ibdknox | romanandreg: current |
| 13:26 | romanandreg | ibdknox: ok… so cur in parse-route, cur will be a compojure route right? |
| 13:29 | ibdknox | romanandreg: no that chain of things is dealing with a vector of params from defpage |
| 13:32 | technomancy | if 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:32 | technomancy | could use a few volunteers |
| 13:36 | romanandreg | ibdknox: ok I see, I think I understand now… may I suggest probably changing the cur var for page-params? |
| 13:36 | Frozenlock | technomancy: I doubt I could be of any help. Your talk might be interesting though. Where will it be? Will it be uploaded? |
| 13:36 | ibdknox | romanandreg: it's only one, and it's not deterministic |
| 13:37 | romanandreg | technomancy: I saw over twitter that you saw tavisrudd speech driven development demo :-) |
| 13:37 | technomancy | Frozenlock: 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:37 | technomancy | romanandreg: oh, have you seen it? |
| 13:38 | romanandreg | technomancy: I've been working with him here in Vancouver all clojure stuff, I couldn't go to the clj/west… |
| 13:38 | technomancy | oh, cool |
| 13:39 | technomancy | yeah, it's a lot of fun to watch |
| 13:39 | Frozenlock | technomancy: with actual storage cost, everything is worth being recorded :) |
| 13:39 | Frozenlock | Even me singing in the shower. Laaaalaaalaalalala laaaaaaa |
| 13:39 | romanandreg | technomancy: 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:40 | technomancy | romanandreg: "slap, twert" |
| 13:41 | romanandreg | ibdknox: 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:41 | gfredericks | technomancy: got a working version of reconstitutible iterate |
| 13:42 | technomancy | gfredericks: no kidding? sweet |
| 13:42 | technomancy | gist? |
| 13:42 | clojurebot | gist is paste |
| 13:43 | gfredericks | technomancy: yep, one sec |
| 13:43 | romanandreg | ibdknox: thanks for your help, cheers. |
| 13:45 | romanandreg | technomancy: can the swarm-coding be done remotely? |
| 13:45 | romanandreg | technomancy: is it just in place? |
| 13:45 | technomancy | romanandreg: my talk will be about doing it in a user group, but you could do it remotely for sure |
| 13:46 | romanandreg | technomancy: is that the normal thing you do in seajure? |
| 13:46 | gfredericks | technomancy: https://gist.github.com/2063360 |
| 13:46 | technomancy | romanandreg: yeah |
| 13:47 | technomancy | gfredericks: wild! |
| 13:48 | gfredericks | I don't know if there's any chance of it being too useful...but at least it was fun to write |
| 14:05 | justicefries | about to leave, but does anyone want beginningclojure.com? |
| 14:05 | justicefries | PM me. |
| 14:11 | tmciver | Is 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:11 | lazybot | ⇒ "The quick brown fox" |
| 14:13 | qbg | &(.replaceAll "The\nquick\nbrown\nfox." "\n" "") |
| 14:13 | lazybot | ⇒ "Thequickbrownfox." |
| 14:13 | qbg | &(.replaceAll "The\nquick\nbrown\nfox." "\w+" " ") |
| 14:13 | lazybot | java.lang.RuntimeException: Unsupported escape character: \w |
| 14:13 | qbg | &(.replaceAll "The\nquick\nbrown\nfox." "\\w+" " ") |
| 14:13 | lazybot | ⇒ " \n \n \n ." |
| 14:13 | Bronsa | ,(clojure.string/replace "The\nquick\nbrown\nfox." "\n" " ") |
| 14:13 | clojurebot | "The quick brown fox." |
| 14:13 | tmciver | qbg: very nice. Would that be considered the idiomatic way? |
| 14:14 | tmciver | and Bronsa ;) |
| 14:14 | qbg | &(.replaceAll "The\nquick\nbrown\nfox." "\\s+" " ") |
| 14:14 | lazybot | ⇒ "The quick brown fox." |
| 14:14 | qbg | There we go :) |
| 14:14 | Lajla | ##"I worship his shadow" |
| 14:14 | Lajla | Does it work like this ##"I worship his shadow" |
| 14:14 | Frozenlock | I don't see any add-to-list function. Should I write my own, or was it omitted by design? |
| 14:14 | Lajla | Baww |
| 14:14 | qbg | tmciver: It is really easy at least |
| 14:15 | tmciver | qbg: yes definitely. Good enough, thanks. |
| 14:15 | gfredericks | Frozenlock: you want to add to the end of a list specifically? |
| 14:15 | tmciver | ,(doc conj) ;; Frozenlock |
| 14:15 | clojurebot | "([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:16 | gfredericks | ,(conj [1 2 3] 8) |
| 14:16 | clojurebot | [1 2 3 8] |
| 14:16 | gfredericks | ,(conj '(1 2 3) 8) |
| 14:16 | clojurebot | (8 1 2 3) |
| 14:16 | tomoj | &(.replace "The\nquick\nbrown\nfox" "\n" " ") |
| 14:16 | lazybot | ⇒ "The quick brown fox" |
| 14:16 | tomoj | huh.. |
| 14:16 | Frozenlock | Well, I'm looking for something like `append'. After, perhaps, `add-to-list' |
| 14:16 | tomoj | I apparently don't know what "All" means |
| 14:17 | gfredericks | Frozenlock: if you need to add at the end specifically you should probably use vectors with conj |
| 14:17 | gfredericks | (instead of lists) |
| 14:17 | qbg | .replace is for charsequences |
| 14:17 | qbg | .replaceAll gives you regex power |
| 14:17 | Frozenlock | Yes, but conj doesn't work very well with two vector or list. |
| 14:17 | tomoj | aha |
| 14:17 | Frozenlock | ,(conj [1 2 3] [4 5 6]) |
| 14:17 | clojurebot | [1 2 3 [4 5 6]] |
| 14:17 | Bronsa | ,(concat [1 2 3] [4 5 6]) |
| 14:17 | clojurebot | (1 2 3 4 5 ...) |
| 14:17 | gfredericks | ,(apply conj [1 2 3] [4 5 6]) |
| 14:18 | clojurebot | [1 2 3 4 5 ...] |
| 14:18 | tmciver | qbg: but replaceAll doesn't seem to allow you to use \w |
| 14:18 | Frozenlock | Oh, concat :D |
| 14:18 | Frozenlock | Thanks! |
| 14:18 | qbg | tmciver: How so? |
| 14:18 | Frozenlock | I was wondering if the absence of such a function was to discourage some practice. |
| 14:18 | qbg | It takes strings, you have to escape the \ |
| 14:18 | tmciver | ,(.replaceAll "The\nquick\nbrown\nfox." "\w+" " ") |
| 14:18 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \w> |
| 14:19 | qbg | ,(.replaceAll "The\nquick\nbrown\nfox." "\\w+" " ") |
| 14:19 | clojurebot | " \n \n \n ." |
| 14:19 | qbg | &"\\w+" |
| 14:19 | lazybot | ⇒ "\\w+" |
| 14:19 | gfredericks | Frozenlock: there's not a function to add to the end of a list because it's inefficient |
| 14:19 | tmciver | qbg: hmm, that's the opposite effect I was looking for. |
| 14:20 | qbg | ,(.replaceAll "The\nquick\nbrown\nfox." "\\s+" " ") |
| 14:20 | clojurebot | "The quick brown fox." |
| 14:20 | tmciver | qbg: Ahh, I have to review regexs; \w is word? \s is whitespace? |
| 14:20 | qbg | Yes |
| 14:20 | tmciver | got it. Thanks again. |
| 14:21 | qbg | I made that error above, if you didn't notice it |
| 14:21 | tmciver | Yeah, that's what threw me. |
| 14:22 | qbg | Just a little TDD :p |
| 14:24 | qbg | ,(.replaceAll "The\nquick\nbrown\nfox." (.toString #"\s+") " ") |
| 14:24 | clojurebot | "The quick brown fox." |
| 14:24 | tmciver | ,(.toString #"\s+") |
| 14:24 | clojurebot | "\\s+" |
| 14:24 | tmciver | interesting |
| 14:24 | tmciver | a little verbose but good to know nonetheless. |
| 14:38 | tomoj | &(clojure.string/replace "The\nquick\nbrown\nfox." #"\s+" " ") |
| 14:38 | lazybot | ⇒ "The quick brown fox." |
| 14:40 | johnmn3 | So I asked around a while back about good companies to go with for collecting money from my clients. |
| 14:40 | johnmn3 | I ended up going with Google Checkout |
| 14:40 | johnmn3 | big mistake |
| 14:41 | qbg | johnmn3: Get screwed or something? |
| 14:41 | johnmn3 | they're doing audits over there, or something, and decided freeze my account until provide them with 4 documents |
| 14:42 | johnmn3 | a company catalog or brocure, inventory receipts or supplier contact information, ID or proof of address, and a copy of my professional license |
| 14:42 | johnmn3 | wtf? |
| 14:42 | johnmn3 | and now they're holding on to a $1000.00 and until I prove x, y, z, they're not giving it to me. |
| 14:43 | johnmn3 | and all these secondary requirements popped up /after/ the client paid. |
| 14:43 | foodoo | may I ask what your job is? |
| 14:44 | johnmn3 | I 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:45 | tomoj | I guess wildly that there is no good company for small merchants |
| 14:45 | johnmn3 | but the LLC is primarily geared toward building business-process automation solutions, using mostly clojure |
| 16:03 | jaley | can anyone enlighten me? what's with the -o and -e suffix naming convention in core.logic? this is apparently very difficult to google! |
| 16:03 | technomancy | it's a scheme thing IIUC |
| 16:04 | jaley | ohhhhh. it was driving me nuts while reading tutorials |
| 16:07 | llasram | jaley: 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:08 | jaley | llasram: ah, just fond this: http://stackoverflow.com/questions/9164051/why-do-minikanren-names-always-end-with-o |
| 16:08 | llasram | Oh, 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:09 | jaley | maaaaan... 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:10 | jaley | i thought the author was pig-latinising the function names or something |
| 16:12 | jaley | ; (defn ondcay ...) |
| 16:12 | tomoj | I wonder why it was decided to stick with minikanren's names |
| 16:13 | technomancy | tomoj: I asked him on the mailing list |
| 16:13 | technomancy | he was kind of evasive |
| 16:14 | tomoj | the second answer on that stackoverflow also suggests maybe we should just use ? since it's allowed here? |
| 16:14 | tomoj | instead of 'o' I mean |
| 16:15 | tomoj | oh |
| 16:15 | jaley | so what does the 'e' indicate? |
| 16:15 | tomoj | I didn't see your explanation llasram |
| 16:15 | tomoj | makes sense if you've read that, I suppose |
| 16:20 | dnolen | llasram: 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:21 | dnolen | tomoj: ? communicates predicate, relations aren't boolean. |
| 16:22 | tomoj | ah, right |
| 16:23 | tomoj | they aren't boolean? |
| 16:23 | dnolen | technomancy: I didn't think my answer was that evasive :) |
| 16:23 | dnolen | tomoj: nope |
| 16:24 | dnolen | jaley: it's not a Scheme thing really. It's a miniKanren thing. |
| 16:25 | tomoj | what does it mean that relations aren't boolean? |
| 16:26 | dnolen | tomoj: precisely that. they don't even return usuable values in the normal sense. |
| 16:32 | jaley | dnolen: just found section 1.5 of byrd :-) |
| 16:32 | dnolen | jaley: byrd's thesis is an excellent read |
| 16:33 | jonasen | dnolen: https://refheap.com/paste/1100 |
| 16:33 | jaley | dnolen: 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:36 | dnolen | jaley: 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:37 | dnolen | jonasen: I see where you going ... thinking about it. |
| 16:37 | jaley | dnolen: yeah.. personally I don't object to the convention, just wondered what i was missing |
| 16:37 | jonasen | dnolen: I'm sure there are better ways to do this. |
| 16:38 | jaley | dnolen: 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:38 | dnolen | jaley: yes, tho I'm not sure how many times I have to say they're not useful functions outside of run/run* |
| 16:39 | jaley | dnolen: probably for as long as it's the first thing people read? |
| 16:40 | dnolen | jaley: like I said, I'm all for brief note and a justification. |
| 16:48 | dnolen | https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer#wiki-Note_on_naming_conventions |
| 16:49 | true_droid | I'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:49 | true_droid | or it just appeared and then people got interested? |
| 16:50 | Raynes | Probably the latter. |
| 16:51 | dnolen | true_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:51 | TheBusby | embrace and extend hopefully :) |
| 16:52 | TimMc | true_droid: You cannot in the general case explain the popularity of languages or libraries in satisfying ways. |
| 16:52 | TimMc | It comes down to a well-written blog-post here, a nice build tool there... |
| 16:52 | true_droid | :) |
| 16:52 | true_droid | ok, thanks for the info! |
| 16:53 | dnolen | true_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:54 | true_droid | dnolen: I have a rather superficial interest in CLojure, but this one library is the one I hear most about |
| 16:54 | dnolen | true_droid: rest assured, it is not even remotely the most interesting thing about Clojure ;) |
| 16:56 | TimMc | true_droid: In this case, dnolen is a badass, so people were curious. :-) |
| 16:56 | true_droid | TimMc: Oh, I see |
| 16:56 | TimMc | (That's my story and I'm sticking with it.) |
| 16:56 | dnolen | :P |
| 16:57 | true_droid | dnolen: btw, I loved your post on abstraction in ClojureScript vs CoffeeScript |
| 16:57 | TimMc | It's really as good a reason as any. |
| 16:57 | dnolen | true_droid: that was fun post, I was surprised by the response. |
| 16:57 | true_droid | I can't convince my friends that it's useful yet, but it's definitely cool :) |
| 16:58 | dnolen | true_droid: welcome to the club :) |
| 16:59 | true_droid | dnolen: thanks! :) |
| 17:01 | true_droid | btw, I live in Ukraine |
| 17:02 | true_droid | it's kind of sad that all the cool events in programming are happening in the US mostly |
| 17:02 | true_droid | too far :( |
| 17:07 | ChibaPet | true_droid: ILC's in Japan this year, isn't it? |
| 17:07 | ChibaPet | Yeah, Kyoto. |
| 17:07 | dnolen | true_droid: what about EuroClojure? |
| 17:07 | ChibaPet | Look at some of the events here: http://alu.org/alu/home |
| 17:07 | jaley | dnolen: just saw the note - thanks! curiosity satisfied now :) |
| 17:08 | ChibaPet | Japan, Croatia, Russia, Denmark... |
| 17:09 | dnolen | refheap is cool |
| 17:10 | true_droid | Russia is more reachable, thanks for the links |
| 17:18 | Raynes | dnolen: Are you at C/W? |
| 17:19 | dnolen | Raynes: I'm not. |
| 17:19 | Raynes | Damn -- I was going to tell you to go tell people how cool refheap is. |
| 17:19 | dnolen | Raynes: haha :) I wish I could. |
| 17:19 | Raynes | I'm not there to represent. |
| 17:20 | Raynes | <3 |
| 17:34 | Raynes | http://dev.clojure.org/jira/browse/CLJ-918 Nice. RefHeap pastes have even made it to the jirasphere. |
| 17:35 | DerGuteMoritz | what's the deal with my clojurescript program trying to load /deps.js? |
| 17:35 | aperiodic | i just told some people |
| 17:35 | aperiodic | i don't think the paid very much attention, though |
| 17:36 | DerGuteMoritz | aperiodic: are you replying to me? |
| 17:37 | Raynes | I'm guessing it was a response to my saying I wish I could be at clojure/west to represent refheap. |
| 17:38 | dnolen | DerGuteMoritz: aperiodic: that usually means there's something wrong w/ your compilation settings. |
| 17:38 | DerGuteMoritz | ah :-) |
| 17:38 | DerGuteMoritz | dnolen: I use cljsbuild with a pretty bare bones config - any hints what I could go after? |
| 17:39 | DerGuteMoritz | (lein-cljsbuild that is) |
| 17:39 | dnolen | DerGuteMoritz: https://refheap.com/paste/1103 works for me. |
| 17:40 | DerGuteMoritz | dnolen: yep, that looks almost exactly like my project.clj except I use clojure 1.3.0 and no compiler settings ... odd |
| 17:41 | DerGuteMoritz | I 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:43 | DerGuteMoritz | no dice :-( |
| 17:43 | DerGuteMoritz | note that the code actually works |
| 17:44 | DerGuteMoritz | it just does that extra request |
| 17:44 | dnolen | DerGuteMoritz: not sure then, I saw that error and then I changed my compiler settings around and I didn't see it anymore. |
| 17:44 | DerGuteMoritz | myterious |
| 17:44 | DerGuteMoritz | +s |
| 17:44 | DerGuteMoritz | :-) |
| 17:44 | dnolen | DerGuteMoritz: deps.js is something GClosure looks for. |
| 17:45 | DerGuteMoritz | let me try turning on simple optimizations like you do |
| 17:45 | DerGuteMoritz | yep, that helped |
| 17:45 | DerGuteMoritz | ok, not sure what to make from that :-) |
| 17:47 | dnolen | DerGuteMoritz: if you figure it out let me know :) |
| 17:49 | DerGuteMoritz | dnolen: will do, thanks a lot! |
| 18:01 | DerGuteMoritz | woohooo those lein-cljsbuild traces make me feel like having huffed too much node.js! |
| 18:17 | Frozenlock | Weird... I added [lacij "0.7.0-SNAPSHOT"] in my :dev-dependencies (leiningen), but I can't use it... (use 'lacij) throws an error. |
| 18:17 | Frozenlock | And yes, I've- lein deps- |
| 18:17 | Frozenlock | Is there any other way I should load this library? |
| 18:18 | tmciver | Frozenlock: the namespace you use is probably something else, like (use 'lacij.core) |
| 18:20 | Frozenlock | lacij, lacij.core, lacij.graph.core... none of them works. |
| 18:20 | Frozenlock | Oh wait... do I need to start a new swank connection? |
| 18:20 | Frozenlock | When I add a new dependency, that is. |
| 18:21 | qbg | yeah |
| 18:22 | irc2samus | hi 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:22 | qbg | You mean varargs? |
| 18:22 | qbg | You need to box them in an array |
| 18:23 | irc2samus | like (MyClass. ["arg1" "arg2"]) or a Java array? |
| 18:23 | qbg | Java array |
| 18:23 | irc2samus | ok I'll try that thanks |
| 18:23 | qbg | into-array should prove useful |
| 18:24 | amalloy | i usually use into-array, but doesn't ##(doc make-array) work as well? |
| 18:24 | lazybot | ⇒ "([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:24 | amalloy | ah. no, because it only takes lengths, not init items. thanks lazybot! |
| 18:25 | raek | then there's 'to-array' and 'object-array' too... |
| 18:27 | irc2samus | I just tried to-array but it returns an array of Object, can I tell it to create an array of String? |
| 18:27 | dnolen | improving kibit https://refheap.com/paste/1105 |
| 18:28 | raek | irc2samus: I think you need to use into-array in that case |
| 18:28 | raek | (into-array String ...collection-of-elements...) |
| 18:30 | irc2samus | ah great, perfect thanks |
| 18:32 | qbg | dnolen: Nice. |
| 18:36 | qbg | dnolen: 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:36 | mdeboard | So, 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:36 | qbg | (other than sets being tricky) |
| 18:37 | dnolen | qbg: unification doesn't create more than result. only conde does. |
| 18:37 | dnolen | more than one |
| 18:43 | irc2samus | it seems to be the case but I'll just ask to be sure, is seq usable as a java List? |
| 18:44 | qbg | not all seqs |
| 18:44 | dnolen | ,(bases '()) |
| 18:44 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to java.lang.Class> |
| 18:44 | irc2samus | (seq ["foo" "bar"]) for List<String> |
| 18:44 | dnolen | ,(bases (class '())) |
| 18:44 | clojurebot | (clojure.lang.Obj clojure.lang.IPersistentList java.util.List clojure.lang.ISeq clojure.lang.Counted) |
| 18:45 | raek | ,(bases (class (lazy-seq nil))) |
| 18:45 | qbg | ,(bases (class (range))) |
| 18:46 | qbg | &(bases (class (range))) |
| 18:46 | lazybot | ⇒ (clojure.lang.Obj clojure.lang.ISeq clojure.lang.Sequential java.util.List clojure.lang.IPending) |
| 18:46 | clojurebot | (clojure.lang.Obj clojure.lang.ISeq clojure.lang.Sequential java.util.List clojure.lang.IPending ...) |
| 18:46 | clojurebot | (clojure.lang.Obj clojure.lang.ISeq clojure.lang.Sequential java.util.List clojure.lang.IPending ...) |
| 18:47 | qbg | Interesting |
| 18:47 | qbg | (.size (range)) |
| 18:47 | qbg | &(.size (range)) |
| 18:47 | lazybot | Execution Timed Out! |
| 18:49 | qbg | &(bases clojure.lang.ISeq) |
| 18:49 | lazybot | ⇒ #<Class[] [Ljava.lang.Class;@a9b899> |
| 18:50 | qbg | &(ancestors clojure.lang.ISeq) |
| 18:50 | lazybot | ⇒ #{clojure.lang.Seqable clojure.lang.IPersistentCollection} |
| 19:42 | hhutch | i'm new-ish to emacs/clojure-mode .. is there a way to do the equivalent of M-( and M-" with vectors and maps ? |
| 19:47 | irc2samus | guys how can I combine two (finite) sequences into a sequence of pairs? it seems clojure.zip isn't like python's zip |
| 19:47 | TimMc | ~zip |
| 19:47 | clojurebot | zip 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:48 | irc2samus | ah great, thanks :) |
| 19:48 | TimMc | That'll works for infinite sequences too. |
| 20:02 | technomancy | hhutch: paredit does that and a lot more |
| 20:07 | irc2samus | the last one (I hope) how can I create a sequence from a java Iterator? seq seems to work with Iterable only |
| 20:09 | TimMc | A lazy seq? |
| 20:10 | TimMc | I think iterators generally have a toList method, yeah? That gives you something seqable. |
| 20:11 | qbg | &(doc iterator-seq) |
| 20:11 | lazybot | ⇒ "([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly." |
| 20:11 | TimMc | Weird, why is that not part of seq? |
| 20:12 | qbg | No clue |
| 20:12 | qbg | Ah, actually |
| 20:12 | qbg | iterators are single use |
| 20:12 | TimMc | Oooh, fair point. |
| 20:13 | TimMc | seq only provides views onto things |
| 20:14 | irc2samus | yeah I have that but I'm writing a test and I'd like to go over both methods |
| 20:14 | irc2samus | in 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:15 | irc2samus | so it seems that with lazy-seq I need to implement the iteration mechanism, sort of |
| 20:15 | irc2samus | is this required to be infinte? I don't see how to stop it |
| 20:16 | TimMc | irc2samus: nil |
| 20:17 | mishadoff | hello |
| 20:18 | irc2samus | iterator-seq made the trick |
| 20:19 | irc2samus | so TimMc if I were using lazy-seq it would end when I return nil? how can I make a sequence of nils then? |
| 20:19 | JorgeB | what's the idiomatic way to get from [ {:key [elem1 elem2]}, {:key [elem3 elem4]} ] to {:key [elem1 elem2 elem3 elem4]} ? |
| 20:19 | JorgeB | array of maps to map of arrays |
| 20:20 | technomancy | ,(merge-with concat [ {:key [elem1 elem2]}, {:key [elem3 elem4]} ]) |
| 20:20 | JorgeB | merge-with? |
| 20:20 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: elem1 in this context, compiling:(NO_SOURCE_PATH:0)> |
| 20:20 | JorgeB | :) |
| 20:20 | technomancy | oh noes! |
| 20:22 | JorgeB | thanks, I'll try that |
| 20:28 | TimMc | irc2samus: (cons nil ...) is different from nil |
| 20:30 | irc2samus | ahh I see, there you're continuing the sequence |
| 20:30 | irc2samus | thanks |
| 20:40 | bpr | I 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:42 | weavejester | bpr: There were additional discussions. I think my current conclusion is that a websocket protocol would, in effect, need something different than Ring. |
| 20:42 | bpr | ok |
| 20:42 | weavejester | bpr: As HTTP and websockets are two different protocols, it doesn't make much sense to write a single interface for both. |
| 20:43 | bpr | esp. since HTTP is req/resp oriented and websockets are full-duplex streams |
| 20:43 | weavejester | bpr: Right :) |
| 20:44 | bpr | I 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:46 | bpr | that's interesting |
| 20:46 | technomancy | it's like a page and a half of adapter code |
| 20:47 | bpr | is it available on github or somewhere? I haven't worked with Netty before. |
| 20:48 | mishadoff | Is any good interface for lucene in clojure? |
| 20:48 | tomoj | bpr: which version of aleph did you try? |
| 20:48 | bpr | 0.2.1-alpha1, 0.2.1-beta1, 0.2.1-beta2, 0.2.1-SNAPSHOT |
| 20:48 | technomancy | bpr: https://github.com/heroku/pulse/blob/ventricle/src/drain/adapter.clj |
| 20:48 | bpr | nice, thanks technomancy |
| 20:49 | technomancy | sure |
| 20:49 | tomoj | where did you find 0.2.1-beta2? |
| 20:49 | technomancy | it's not production-hardened yet |
| 20:49 | technomancy | whatever that means |
| 20:49 | tomoj | but, I thought 1.3 was supposed to work in 0.2.1-beta1 |
| 20:50 | tomoj | I still haven't ever tried it, though, afaik.. |
| 20:51 | bpr | tomoj: 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:52 | bpr | tomoj, 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:52 | tomoj | it just hangs? |
| 20:52 | bpr | tomoj: yes |
| 20:53 | bpr | Aside from checking CPU usage to see if it's looping, I haven't poked around any deeper. |
| 20:54 | bpr | It's not looping btw. CPU usage was low. |
| 20:58 | bpr | https://refheap.com/paste/1181 https://refheap.com/paste/1182 |
| 20:59 | bpr | that's the project.clj and the main.clj |
| 20:59 | tomoj | strange |
| 21:00 | tomoj | maybe it's a ring interop problem? |
| 21:03 | bpr | https://refheap.com/paste/1183 <-- works |
| 21:03 | bpr | rather, that doesn't work |
| 21:03 | tomoj | https://github.com/tomo/alephtest |
| 21:03 | bpr | this does: https://refheap.com/paste/1184 |
| 21:03 | bpr | actually, reverse that |
| 21:03 | bpr | 1183 does work, and 1184 doesn't |
| 21:04 | tomoj | that is a demo of working websocket for me |
| 21:04 | tomoj | dunno if it's the ring stuff or what.. |
| 21:08 | tomoj | I mean, the ring-specific aleph stuff :) |
| 21:09 | DragonMaster1337 | Hiya. |
| 21:09 | bpr | tomoj, seems to work for me too |
| 21:10 | DragonMaster1337 | Has 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:11 | DragonMaster1337 | The app launches and works like it should. |
| 21:11 | DragonMaster1337 | No luck with navigating chrome to it either. |
| 21:12 | tomoj | bpr: maybe you should post on the aleph-lib google group if you haven't given up on aleph yet |
| 21:13 | tomoj | good luck |
| 21:22 | pandeiro | so clojure-jack-in runs lein deps automatically? |
| 21:24 | pandeiro | ...i didn't realize i could jump straight in and skip that step, pretty cool |
| 21:28 | Frozenlock | Yay... just discovered why my counter wasn't working http://thinkrelevance.com/blog/2008/09/16/pcl-clojure-chapter-6 |
| 21:28 | Frozenlock | (and I indeed looked for a setf command...) |
| 21:44 | yoklov | do people use clojure-project-mode? |
| 21:45 | yoklov | i see it in marmalade... |
| 21:45 | yoklov | actually never mind, it requires i use project mode, which i do not. |
| 22:01 | dabd | can 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:06 | gfredericks` | hmm |
| 22:06 | gfredericks` | "creating a def" isn't what you're talking about, since the var already exists |
| 22:07 | gfredericks` | 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:09 | gfredericks` | but try (alter-meta! #'clojure.contrib.duck-streams/foo-bar assoc :dynamic true) |
| 22:11 | dabd | gfredericks: it didn't work |
| 22:12 | gfredericks` | yeah it looks like it doesn't even work within the same ns |
| 22:12 | gfredericks` | so presumably the dynamicity is stored somewhere else and not changeable |
| 22:12 | gfredericks` | static dynamicity :) |
| 22:13 | gfredericks` | dabd so with-redefs doesn't work for what you're doing? |
| 22:13 | dabd | gfredericks: i don't know about with-redefs |
| 22:13 | dabd | going to look into doc |
| 22:14 | gfredericks` | dabd: it's for redeffing vars globally, rather than thread-locally |
| 22:14 | gfredericks` | the vars don't have to be dynamic |
| 22:15 | dabd | gfredericks: works great! thanks |
| 22:16 | gfredericks` | &"w00p" |
| 22:16 | lazybot | ⇒ "w00p" |
| 22:16 | dabd | what 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:17 | gfredericks` | oh this must be one of the libs that hasn't been updated for 1.3 yet |
| 22:17 | gfredericks` | oh wait |
| 22:17 | gfredericks` | duck-streams |
| 22:17 | gfredericks` | dabd: use clojure.java.io instead |
| 22:18 | gfredericks` | that's what duck-streams turned into |
| 22:21 | dabd | gfredericks: looks like it does not have a read-lines function |
| 22:21 | dabd | but it is ok |
| 22:24 | amalloy | dabd: just use ##(doc line-seq), and give it a reader that has the right encoding set |
| 22:24 | lazybot | ⇒ "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader." |
| 22:29 | gfredericks` | is there any resource that explains how binding conveyance works? i.e., under what circumstances it happens? |
| 22:40 | bpr | gfredericks`: what's binding conveyance? |
| 22:41 | pyninja | I'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:41 | pyninja | g inserted at all? |
| 22:42 | pyninja | I just realized you can't see it in the gist for some reason, but it's this character: 😊 |
| 22:45 | ivan | pyninja: this looks like a bug in Clojure. It's encoding your character wrong. Not surprising, given that it's outside the BMP. |
| 22:46 | ivan | \u1f60a will be interpreted as \u1f60 a by everything |
| 22:48 | ivan | this is probably right: |
| 22:48 | mefesto | pyninja: what version of clojure/data.json are you using? |
| 22:48 | ivan | gah. I can't paste the snowman into my client |
| 22:48 | ivan | simplejson gives '"\\ud83d\\ude0a"' |
| 22:48 | mefesto | data.json 0.1.3 contains this commit which might be relevant: https://github.com/clojure/data.json/commit/f0dd129f31b1f7cd26c3d9483696cade74d4e832 |
| 22:49 | pyninja | hm |
| 22:50 | pyninja | well i'm using clojure 1.2.1 |
| 22:55 | pyninja | well, i upgraded to clojure 1.3.0 and i got the same thing |
| 22:59 | pyninja | that commit does look like it should fix it, but how can i upgrade to the latest version of data.json itself? |
| 22:59 | mefesto | pyninja: are you using leiningen? |
| 22:59 | pyninja | oh i just realized that data.json doesn't come with clojure |
| 22:59 | pyninja | yeah, all i have to do is change [org.clojure/data.json "0.1.0"]. heh |
| 23:00 | mefesto | dunno if it'll make a difference for you but the commit switched from (.charAt s i) to (Character/codePointAt s i) |
| 23:00 | tomoj | cheshire encodes it to "\"😊\"" fwiw |
| 23:02 | pyninja | hm, i didn't know about cheshire. |