#clojure log - Jan 24 2013

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

0:01 Rich_Morin: no, that didn't solve the problem.

0:02 somehow, I'm not getting a REPL

0:03 I can type "lein repl" into the shell and it all works. Perhaps I need to tell IDEA something ?!?!?

0:06 muhoo: if you get frustrated, just try lighttable instead

0:07 ibdknox: I need more hours in the day so I can get this next version out sooner :)

0:08 Rich_Morin: ibdknox: I'm really hoping that LT will save me from emacs and all the other envs - please keep slogging!

0:08 ibdknox: the next version is a huge step forward in just about every way

0:09 akhudek: Rich_Morin: ok, maybe it is that platform SDK thing. It's been so long ago since I set it up that I now forget. :-(

0:09 warz: im new to clojure and ive been using LT. its pretty good. lots of little quirks/bugs and things i wish it could do, but i like it so far. :)

0:10 tomoj: curious, what data structure are you using for the edited code, if that's not a secret?

0:10 ibdknox: warz: do you have a list of these quirks/bugs? 0.3.0 is focused entirely on experience (and a surprise)

0:10 akhudek: Rich_Morin: ah, I think that is just selecting the jvm you want to use

0:11 tomoj: (in light table)

0:11 akhudek: my system has 1.6 and 1.7, and I'm pretty sure I added 1.7 myself

0:11 ibdknox: tomoj: as it is stored in memory for display?

0:11 warz: ibdknox, i havent been keeping a list. i submitted a github issue or two, i think. theres something that i always come across but i cant think of it at the moment.

0:12 ibdknox: tomoj: I use the codemirror editor, which under the covers houses the lines in a nice B-Tree

0:12 warz: you responded to the issues i opened though

0:12 tomoj: oh

0:12 Rich_Morin: From http://pupeno.com/2011/07/30/getting-started-with-la-clojure-on-mac-os-x-a-visual-guide/, it appears that I need to assign an SDK in File < Project Structure, but it doesn't offer JSDK...

0:12 ibdknox: warz: well let me know as you run into more :)

0:12 tomoj: I didn't know js was involved

0:12 ibdknox: tomoj: the whole thing is CLJS

0:13 warz: ibdknox, i recall not being able to get rid of error popups, in the top right corner of the editor. also sometimes the syntax errors on the bottom left clip the left side of the editor window.

0:13 so i cant see the whole message.

0:13 tomoj: wow, nice

0:13 Rich_Morin: It offers JDK, IntelliJ IDEA Plugin SDK, and Android SDK.

0:14 warz: i was thinking, maybe an X circle on the errors in top left ot remove them

0:14 or something

0:14 ibdknox: warz: yeah the entire result/error thing as it exists has been completely redone to actually be inline so that won't happen anymore

0:14 warz: ah ok cool

0:14 Rich_Morin: akhudek: I think it wants me to specify a JDK ?!?!

0:15 and it isn't offering a default.

0:15 akhudek: Rich_Morin: yes, looks like you need to create an entry

0:15 warz: ibdknox, oh i was also thinking maybe somehow the ability to specify files to ignore in the open command popups

0:15 Rich_Morin: any clue about what should go in ti?

0:16 ibdknox: warz: also done in the new one :)

0:16 akhudek: Rich_Morin: you certainly have a jdk installed if you have lein, so just point it to the JDK directory

0:16 warz: leet

0:16 :D

0:16 rationalrevolt: does LT use a constant port number?

0:16 akhudek: on mac it's something like /Library/Java/JavaVirtualMachines/jdk1.7.0_06.jdk/Contents/Home

0:16 or /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

0:16 ibdknox: rationalrevolt: yeah, 8833 and 8834

0:16 akhudek: confusing that it doesn't come preconfigured with a default though

0:18 michaelr525: hello

0:18 warz: ibdknox, is it just you working on LT?

0:19 ibdknox: warz: on the code-side it is

0:19 warz: well gj man. well done. :)

0:19 and YC and all that, nice.

0:20 Rich_Morin: akhudek: well, that didn't solve it...

0:20 ibdknox: haha thanks. Long way to go, but this next one is a big step in the right direction

0:20 akhudek: Rich_Morin: did you also assign the platform in the project?

0:21 it might now be missing since there was no default

0:21 under project settings, select the project, then project sdk

0:21 Rich_Morin: not sure - do I have to pick a particular jar file in the Home directory?

0:23 that did it; thanks!

0:23 akhudek: glad you got it working :-)

0:24 Rich_Morin: (+ 1 2) => 3 +1!

0:24 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "+1">

0:37 rationalrevolt: (case 'yes 'yes "yes" 'no "no")

0:40 amalloy: the test clauses in case are not evaluated

0:42 muhoo: been bitten by that before. iirc java blows up if case tests arent constants, and clj silently does something else

0:43 amalloy: muhoo: not exactly

0:43 clojure just has a richer set of constants: foo is a perfectly valid constant, the symbol foo

0:43 so anything is a constant, if you choose not to eval it

0:45 muhoo: aye

1:21 tomoj: since truth_ is only used in emit :if, why not just emit inlined checks?

1:22 or is it the checks and not the function call that make truth_ a concern

1:26 amalloy: tomoj: well, using truth_ instead of inlining probably reduces code size too

1:27 tomoj: didn't think about that

1:28 but I wonder about the relative importance of the function call, the checks, and code size, in the motivation for safe-check?

1:28 er, safe-test?

2:28 michaelr525: ohpauleez: hi

2:28 ohpauleez: michaelr525: Hello

2:29 michaelr525: ohpauleez: is the pubsub in shoreleave a parallel to backbone events?

2:31 in the sense that it is used to wire the application components..

2:31 ohpauleez: I'm not sure how backbone events work, but in Shoreleave it is a declarative, generic event system. Functions can subscribe to DOM listeners, atoms can subscribe to functions, local storage can subscribe to functions

2:32 it's a protocol, so really - anything can subscribe to anything. And anything can publish

2:32 along the way, functions can send stuff to the server

2:32 yes, exactly, it's used to wire an app up. You essentially create the dataflows in your app

2:33 michaelr525: sounds good, but i need to try it in order to get a feeling.. I found a few examples using google. Is there something you consider a good example?

2:34 ohpauleez: haha, everyone sort of uses pubsub in a way I don't, but sadly, I haven't finished up the examples. That will change with the new shoreleave-baseline

2:36 michaelr525: ok

2:36 ohpauleez: this is what I point most people to: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/blob/master/src-cljs/depr/app.cljs

2:37 Robert wraps up some stuff to make the interface a little easier

2:37 and you should feel free to ping me on here or email me

2:37 I'm more than happy to help

2:37 michaelr525: ohpauleez: thanks :)

2:38 ohpauleez: np - good luck and have fun!

3:42 ucb: does the latest leiningen release work with drip?

4:12 minikomi: this may seem like a crazy question.. can someone tell me why ((apply comp '(inc inc inc)) 2) doesn't give the same result as ((comp inc inc inc) 2) ?

4:13 amalloy: 'inc is not inc

4:14 (apply comp (list inc inc inc)) would be fine

4:19 minikomi: sorry, do you mind pointing me in the right direction on the difference?

4:20 Chousuke: minikomi: you're quoting the list. including its contents

4:21 '(a b c) is a list of three symbols

4:21 minikomi: ah

4:21 thanks :)

4:21 Chousuke: in general, if you want a literal list, you should use a vector instead :P

4:22 that is, you example would work just fine if you did ((apply comp [inc inc inc]) 2)

4:22 minikomi: that's nicer, thanks

4:24 * minikomi makes mental note to try more data types before asking next time

4:26 michaelr525: what is a good file browser in emacs?

4:27 a side pane like in sublimetext2 could be cool :)

4:27 (i've decided to give emacs another stab)

4:27 Iceland_jack: Dired

4:28 you're probably asking the wrong question, check out ido-mode

4:28 xumingmingv: and projectile also worthing trying

4:29 michaelr525: ido mode is cool but i would like to have a tree view of my project open..

4:29 arcatan: i've been using ido-mode for ages, but i only just learned, that if you type a file-name and wait for a sec, ido-mode will search the directory for the name

4:29 michaelr525: directory/file tree

4:29 arcatan: *the directory tree

4:30 Iceland_jack: michaelr525: Then look at dired

4:30 daimrod: michaelr525: there is dired and you could look at ECB.

4:30 lpetit: Hello, anyone here having the "New leiningen project" issue with Counterclockwise, and willing to help test the patch (should take no more than 5 mins)

4:31 michaelr525: ok, then dired, ecb, projectile i'll try these

4:32 lpetit: not everybody at the same time :)

4:32 michaelr525: hehe

4:35 how to exit M-x ido mode? (esc doesn't work)

4:35 ro_st: C-g

4:35 vijaykiran: michaelr525: or three-times esc :)

4:36 ro_st: C-g is get-me-the-hell-out-here

4:36 michaelr525: cool

4:40 dired doesn't seem to have directory structure mode..

4:45 clgv: lpetit: whats the issue? (link?)

4:46 lpetit: clgv: the issue is that when people start with 0.11.0 and an empty maven local cache, they have a problem: the leiningen-core version I've recently updated ccw to does not anymore add clojars repository to the list of default repositories, and the "New leiningen project" wizard fails miserably

4:47 clgv: so I've created a small patch , and would like someone to test it. The idea is simple. You first try to reproduce the problem. Quite easy = rename temporarily your ~/.m2/repository so that maven/lein thinks it's empty, then try to create a new leiningen project from eclipse

4:48 clgv: lpetit: until when do you need feedback. my experimental machine is at home ;)

4:49 lpetit: clgv: I want to release a 0.11.1 today

4:49 clgv: lpetit: damn. that's a too short time frame for me...

4:50 lpetit: I am pretty busy for an upcomming deadline

4:50 lpetit: clgv: no problem, I understand that you don't want to risk breaking your work machine :)

4:50 I'll just create a fresh environment here, np

4:52 clgv: lpetit: will the repl history settings be included in 0.11.1?

4:57 lpetit: clgv: no, just a quick patch, not including anything but the fix

4:58 clgv: lpetit: ah right you include new features in the beta releases first...

4:58 lpetit: right

6:26 michaelr525: ooh

6:26 crazy shit

6:27 ejackson: michaelr525: emacs ?

6:27 augustl: what do I do when I get "Exception in thread "main" java.lang.ClassNotFoundException:" for "lein run" when the entry in :main clearly exists and has a :gen-class? :)

6:28 michaelr525: ejackson: no, i gave up emacs after 5 minutes again ;)

6:30 ejackson: i mistakenly put remotes.clj with the namespace modern-cljs.remotes beside server.clj with the namespace my-project.server and 'require'd it from server.clj

6:30 got Exception in thread "main" java.lang.ClassNotFoundException: my-project.server

6:31 after 'lein run'

6:31 looks like it failed to compile but did it silently

6:31 augustl: doh, used main- not -main

6:49 ChongLi: is there any benefit to putting a mutable javascript array inside an atom and updating it with swap!?

6:58 luxbock: does a doc-string always come before the arg-list, or can I put it underneath one as well?

7:02 anars: luxbock: according to the source code (https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L272), the doc-string always comes before.

7:03 luxbock: alright

7:10 ejackson: luxbock: yes, otherwise it is just evaluated as a string literal as part of the body of the function

7:23 augustl: bleh, using rabbitmq I have to manually manage connections if the rabbitmq server goes down, boring

8:22 just took the business logic process down and up again without any of the clients noticing. Queues for RPC = <3

8:31 michaelr525: augustl: the clients are web requests?

9:48 augustl: michaelr525: late reply.. The client is a HTTP API that translates the incoming HTTP to stuff I RPC over a queue

9:48 and responds with http when the queue responds

9:52 michaelr525: augustl: and that HTTP API is waiting for an answer?

10:03 augustl: michaelr525: yeah, the rpc is done in a future, and I dereference it to make it synchronous so I can respond with HTTP

10:04 the alternative would be a nodejs stype event driven approach where the HTTP handling is also asynchronous

10:04 but a blocking call via deref works just fine

10:04 michaelr525: will probably blog about it soon :)

10:05 and perhaps release the rabbitmq-amqp wrapper as open source, if that's useful

10:05 michaelr525: augustl: yeah, i though that it sounds like a good use case for 'aleph' async response

10:05 augustl: it's just 88 lines of java interop though

10:06 michaelr525: hmm, what's aleph?

10:06 michaelr525: augustl: you didn't like longhr?

10:06 augustl: https://github.com/ztellman/aleph

10:07 augustl: michaelr525: longhr is the clojurewerkz one, right?

10:07 michaelr525: augustl: yup

10:07 augustl: to be honest I rarely feel that the clojure wrappers over java interopp adds any value, quite the contrary

10:07 I prefer to just do the interop myself

10:07 ..unless there's some useful feature it implements on top of the interop of course

10:08 michaelr525: ok

10:08 augustl: good :)

10:08 michaelr525: i can't really compare, i've just used longhr but never user the java api

10:46 djwonk: why is (#({1 2})) not ok but (#(hash-map 1 2)) is?

10:46 (I'm building up small pieces to see what is going haywire)

10:47 ,(#(hash-map 1 2))

10:47 clojurebot: {1 2}

10:47 djwonk: ,(#({1 2}))

10:47 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>

10:49 ejackson: djwonk: true (#{1 2} 2)

10:49 ,(#{1 2} 2)

10:49 clojurebot: 2

10:50 djwonk: ejackson: ok, so the {} is being treated as a function since it is in function position

10:50 TimMc: ,'#({1 2}) ;; djwonk

10:50 clojurebot: (fn* [] ({1 2}))

10:50 ejackson: #{} is being treated as function, yes

10:51 TimMc: #{}?

10:51 rasmusto: ,(#({1 2}) 2)

10:51 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval135$fn>

10:51 TimMc: ejackson: You're using sets there.

10:52 djwonk: rasmusto: yes, that illustrates what is hanging me up

10:52 ejackson: i was intending to... were we talking about maps... sorry

10:52 both can be used as functions

10:52 rasmusto: djwonk: iirc you can't use map literals in anonymous functions, I might be wrong

10:52 hyPiRion: ,(#(hash-map 1 2))

10:52 clojurebot: {1 2}

10:52 TimMc: rasmusto: No, that's not true.

10:53 rasmusto: TimMc: ah, T stand corrected

10:53 I*

10:53 djwonk: hyPiRion: yes, hash-map works for me, I was trying to understand what was going wrong

10:53 hyPiRion: ,((constantly {1 2}))

10:53 clojurebot: {1 2}

10:53 TimMc: rasmusto: The only thing you can't write in a function literal is another function literal. :-)

10:53 rasmusto: TimMc: understood

10:53 hyPiRion: ,(#(`[~@{1 2}] 0))

10:53 clojurebot: [1 2]

10:53 hyPiRion: gurr.

10:54 ,(#(`[{~1 ~2}] 0))

10:54 clojurebot: {1 2}

10:54 TimMc: Look what you've done, you've got hyPiRion started on swearjure again!

10:54 hyPiRion: :D

10:54 ejackson: its a perlpocalypse

10:54 ivaraasen: :D

10:54 rasmusto: ,(#({2 3}))

10:54 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>

10:54 djwonk: hyPiRion: my eyes!

10:54 boodle: ,(class (#({1 2})))

10:54 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>

10:55 rasmusto: I think I'm confused now too

10:55 ivaraasen: swearjure is quite relaxing actually. a bit like white noise

10:55 ejackson: rasmusto: what are you trying to do ?

10:56 djwonk: "Do not look into hash syntax inside function literal with remaining eye" http://ledmuseum.candlepower.us/sixth/bsl.gif

10:56 augustl: rasmusto: #(foo 1) expands to (fn [] (foo 1))

10:57 djwonk: ,((fn [] {1 2}))

10:57 clojurebot: {1 2}

10:57 djwonk: ,(#({1 2}))

10:57 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>

10:57 djwonk: eek

10:57 something isn't adding up

10:57 ivaraasen: hyPiRion: considering incorporating swearjure into the next issue of Spitposten

10:58 djwonk: my conclusion: my mental understanding of #() is not correct

10:58 hyPiRion: ivaraasen: hahah, sweet

11:02 rasmusto: yeah, that's been what I'm confused about :p

11:03 hyPiRion: oh, I love this

11:03 ,(#(`%%%) :ten)

11:03 clojurebot: :ten

11:03 augustl: djwonk: it expands to (fn [] ({1 2}))

11:03 hyPiRion: ,(macroexpand '#(`%%%))

11:03 clojurebot: (fn* [p1__57#] ((quote p1__57__58__auto__) p1__57# p1__57#))

11:03 hyPiRion: This one's mind boggling.

11:03 augustl: that's why I said #(foo 1) expands to (fn [] (foo 1)) :)

11:03 TimMc: djwonk: Evaluate this, then stare at it carefully: '#({1 2})

11:03 rasmusto: ,(#(identity {1 2}))

11:04 clojurebot: {1 2}

11:04 djwonk: augustl: thanks, I missed the outer parens!

11:04 augustl: ^^

11:04 rasmusto: Okay, I'm back on track, thanks augustl

11:04 djwonk: TimMc: thanks

11:06 augustl: the owls are not what they seem

11:06 TimMc: djwonk: Now you should be able to figure out why this does what it does: ##(#())

11:06 lazybot: ⇒ ()

11:07 augustl: you can add hashtags and code clojure on twitter at the same time!

11:08 djwonk: hyPiRion: #(`%%%) is messed up

11:09 hyPiRion: djwonk: I think it's a bug that `% resolves into that

11:09 and yeah

11:09 ~hyPiRion

11:09 Hurm.

11:09 djwonk: ,##(#())

11:09 lazybot: ⇒ ()

11:09 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Nested #()s are not allowed>

11:10 djwonk: TimMc: Clojure 1.5 (on my machine) does not like, it complains just like clojurebot

11:10 anyhow, I'm content now

11:10 I will be swearing like hyPiRion

11:11 hyPiRion: Nothing's like trying to understand swearjure

11:12 ,(#([`{~% ~@%&}] (+)) 1 2 3 4) ; swear all the things

11:12 clojurebot: {1 2, 3 4}

11:12 ejackson: yuck

11:14 gfredericks: hyPiRion: ermahgerd

11:15 so #([`{~% ~@%&}] (+)) == c.c/hashmap

11:15 hyPiRion: gfredericks: almost, doesn't work for zero input

11:16 ,((#([`{~% ~@%&}](+)))

11:16 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

11:16 hyPiRion: ,(#([`{~% ~@%&}](+)))

11:16 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval85$fn>

11:16 hyPiRion: there.

11:17 TimMc: djwonk: ## is the lazybot eval prefix.

11:18 *inline eval

11:20 djwonk: ,"##trick"

11:20 clojurebot: "##trick"

11:20 hyPiRion: oh humm

11:21 djwonk: TimMc: thanks

11:21 hyPiRion: ,(println "foo ##(+ 1 2)")

11:21 lazybot: ⇒ 3

11:21 clojurebot: foo ##(+ 1 2)\n

11:21 djwonk: hyPiRion: that's what I was going for

11:23 gfredericks: hyPiRion: is there a github repo for this stuff yet?

11:23 hyPiRion: ,(println "&|(str 1 2 " " 3 4)|&")

11:23 lazybot: ⇒ "12 34"

11:23 clojurebot: &|(str 1 2 3 4)|&\n

11:24 hyPiRion: gfredericks: Hmm, TimMc has done something

11:24 TimMc: gfredericks: Here's my start: https://github.com/timmc/swearjure

11:25 I'm currently pondering how to handle function calls, since calls to top-level fns have to be handled specially. (An additional first arg, the vector of top level fns, needs to be passed in.)

11:26 gfredericks: TimMc: are you going to submit a conj talk for this?

11:26 what is this code supposed to do? translate clojure to swearjure?

11:26 TimMc: Haha, no -- I want my nice suit to remain tomato-free.

11:27 Yeah, a limited subset of Clojure -> swearjure.

11:27 gfredericks: it'd have to emit a string, right?

11:27 TimMc: Unfortunately, yes.

11:28 I'm not looking forward to the pretty-printing code.

11:28 hyPiRion: TimMc: Pretty-printing swearjure?

11:28 TimMc: Sure, all that nice indentation.

11:28 hyPiRion: You're missing the point, sir.

11:28 TimMc: haha

11:28 hyPiRion: Well, actually, it would kind of be nice

11:29 At least for debugging purposes, I suppose

11:30 I have issues with vararg mapv though.

11:30 TimMc: No breakthroughs for apply?

11:30 TimMc: No sir.

11:30 hyPiRion: Then my master invention still lays at rest. For now.

11:31 TimMc: I think higher-order functions may be feasible, though.

11:32 I want the input to the swearjure compiler to be runnable, stand-alone, but I suspect that some fancier features will require the use of a shim API.

11:32 hyPiRion: Returning fns? I'd like to get partial

11:32 TimMc: The API would contain normal fns, but the compiler would treat references to them as compiler specials.

11:33 hyPiRion: Yes, and I think it may be possible for a swearjure letfn form to return a fn, but I'm not clear on that yet.

11:34 hyPiRion: oh sweet. If I get partial I can simulate apply.

11:35 ChongLi: RoboVM

11:35 this seems really interesting

11:35 TimMc: hyPiRion: True!

11:36 ChongLi: anyone looked at it?

11:37 translate java bytecode to native ARM

11:38 deploy clojure apps to iphones!

11:50 vojd: ohoy, i'm looking for resources on how to use noir with lighttable

11:50 any tips?

11:53 hyPiRion: Asking ibdknox would probably be a nice start. Even though he's not maintainer of noir anymore, he should have some tips.

11:53 (If he's here, that is)

11:54 ciphergoth: So I have a variable which is properly global in the live app, but which I shadow with a binding in tests. As part of our test system, I need to call alter-var-root on it, but where it's shadowed I need to call set!

11:55 How do I test whether a var is shadowed by a binding, ie whether set! will throw an exception?

11:56 vojd: hyPiRion: true, i'll do that :)

11:57 hyPiRion: vojd: But to really answer your question, I think noir has some github examples up

11:57 I know ibdknox has an example regarding a Noir blog for instance

12:02 augustl: are there any existing middlewares for doing plain http auth?

12:03 yogthos: vojd: just be aware that noir is mostly deprecated nowadays

12:03 vojd: yogthos: aha! what do you recommend instead of noir?

12:03 hyPiRion: augustl: "plain" is probably not the word I'd do, but friend is good

12:03 /s/do/use

12:03 gfredericks: what's a top-level fn?

12:03 yogthos: vojd: compojure+ring is the current recommended approach, I setup a template for getting started here http://www.luminusweb.net/

12:03 gfredericks: oh whoops

12:04 augustl: hyPiRion: cool, thanks

12:04 hyPiRion: vojd: +1 on what yogthos said, plus hiccup as rendering engine

12:04 vojd: yogthos: many thanks!

12:04 arcatan: how do i test if a value is an element of a sequence?

12:04 gfredericks: arcatan: (some #{val} sequence)

12:05 yogthos: vojd: all the useful stuff from noir has been moved to lib-noir and that's actively maintained

12:05 vojd: yes i'm all in for hiccup. i did some stuff in noir about a year ago and thought i should go back to it

12:05 yogthos: vojd: no problem :)

12:05 vojd: but i had no idea it was deprecated. so thanks :)

12:05 arcatan: gfredericks: right, thanks

12:05 stain_: anyone know of a way to use a EBNF-based grammar? I looked at fnparse, but as far as I understand I would have to reformulate the EBNF rules using Clojure code

12:06 hyPiRion: stain_: I've looked and looked, but it currently seems like Antlr is your best bet.

12:07 stain_: uhrgh

12:08 well, thanks anyway :)

12:08 antlr is not quite EBNF either, is it

12:08 hyPiRion: stain_: I'm really bothered by it :(

12:08 I think it is, but not sure.

12:08 stain_: but a bit easier to searc/replace your way into

12:08 well. EBNF itself does not have a proper grammar, so they can't agree on what is the definition symbol.. ::= or = or :: or what

12:08 hyPiRion: It's better than Bison at least

12:09 stain_: hee, yeah

12:10 craigbro: ragel

12:10 ragel = lexer/parser engine

12:12 stain_: but it does not to EBNF..?

12:14 craigbro: no, you would have to translate

12:19 michaelr525: hello

12:25 hmm.. looks like enfocus doesn't have the parallel of jQuery's 'on'

12:25 Anderkent: is there something like 'boolean?' ?

12:27 hyPiRion: Anderkent: boolean?

12:27 ,(boolean 12)

12:27 clojurebot: true

12:28 Anderkent: i want to check whether x is a boolean

12:28 not cast to boolean

12:28 hyPiRion: ,(boolean? 12)

12:28 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: boolean? in this context, compiling:(NO_SOURCE_PATH:0)>

12:28 hyPiRion: oh, hum

12:29 ,(instance? true Boolean)

12:29 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Class>

12:29 S11001001: ,(doc true?)

12:29 hyPiRion: ,(instance? Boolean true)

12:29 clojurebot: "([x]); Returns true if x is the value true, false otherwise."

12:29 true

12:29 S11001001: ,(doc false?)

12:29 clojurebot: "([x]); Returns true if x is the value false, false otherwise."

12:30 hyPiRion: You could use (instance? Boolean x).

12:31 S11001001: ,(supers (class (fn [^Boolean x] (not x))))

12:31 clojurebot: #{clojure.lang.IMeta java.lang.Object java.util.Comparator java.lang.Runnable clojure.lang.Fn ...}

12:31 S11001001: ,(drop 5 (supers (class (fn [^Boolean x] (not x)))))

12:31 clojurebot: (java.io.Serializable clojure.lang.IFn clojure.lang.AFunction clojure.lang.IObj clojure.lang.AFn ...)

12:32 S11001001: ,(supers (class (fn [^Integer x] (not x))))

12:32 clojurebot: #{clojure.lang.IMeta java.lang.Object java.util.Comparator java.lang.Runnable clojure.lang.Fn ...}

12:35 tiled: How can I convert a string "hello" to hello ? I mean without the quotation marks

12:35 craigbro: symbol

12:36 (symbol "hello")

12:36 maybe that's not what you meant tho 8^)

12:36 tiled: it is, works, thank you

12:49 I want a function to return a different random int on each call; is there an easy way to do that?

12:49 jeremyheiler: tiled, does it always have to be different?

12:50 ,(rand-int 100)

12:50 clojurebot: 77

12:50 tiled: but that always return the same value

12:50 jeremyheiler: ,(rand-int 100)

12:50 clojurebot: 75

12:51 tiled: hmm

12:51 seangrove: tiled: What do you mean it always returns the same value?

12:51 tiled: my fault, it doesn't

12:52 hyPiRion: Beware of the ##(repeat (rand-int 10)) trap.

12:52 lazybot: java.lang.OutOfMemoryError: Java heap space

12:52 hyPiRion: &(repeat 10 (rand-int 10))

12:52 lazybot: ⇒ (1 1 1 1 1 1 1 1 1 1)

12:52 hyPiRion: Dangit lazybot, you shouldn't run out of space for that.

12:54 seangrove: hyPiRion: Raynes doesn't feed lazybot bot much, it's anemic

12:54 AimHere: &(repeatedly 10 #(rand-int 10))

12:54 lazybot: ⇒ (2 2 8 4 4 9 1 5 2 2)

12:54 hyPiRion: seangrove: Yeah. You hear that, Raynes? Go patch this thing.

12:55 tiled: (str "/sgf/" (+ 1 (rand-int 700)) ".sgf"))) always return a different value but (io/slurp-resource (str "/sgf/" (+ 1 (rand-int 700)) ".sgf")) always opens the same file

12:59 jeremyheiler: what is io/slurp-resource? maybe it's caching it somehow

13:00 if i replace it with just slurp in my repl, then it works as expected.

13:01 tiled: http://www.luminusweb.net/noir-api/noir.io.html

13:01 seangrove: Can't tell if it's firefox or cljs, but the ff web console blows up with errors using cljs

13:01 meowcake: I'm new to Clojure and I'm using map across a list of lists. In return, I get one list that contains multiple lists of maps. I've been trying to figure out how to get all those lists of maps into a single list of all the maps. Would somebody be able to point me in the right direction?

13:02 technomancy: meowcake: maybe mapcat instead of map?

13:03 meowcake: holy crap

13:03 I feel like an idiot

13:03 THANK YOU TECHNOMANCY

13:03 technomancy: haha; np

13:03 seangrove: meowcake: We all go through it, I had the same question awhile ago

13:04 meowcake: Oh man, I spent about an hour trying to figure this out in all sorts of dumb ways... I love this language and really appreciate the quick (and simple) answer. :)

13:04 babilen: meowcake: or (apply concat ...) - I would recommend to use mapcat in most places where it makes it the intend clearer.

13:09 jkkramer_: tiled: sounds like you might be generating the response at compile time?

13:11 dnolen: seangrove: is this a new issue for you?

13:11 seangrove: dnolen: No, just an observation about firefox's webconsole + cljs code

13:11 dnolen: seangrove: so not an issue in general w/ FF?

13:12 seangrove: Doesn't affect the running of the program, just a ton of warnings from FF

13:12 Nah, just an annoyance

13:12 dnolen: seangrove: weird

13:12 seangrove: Which I've found is pretty standard for ff so far

13:12 tiled: oh you're right it works now thank you, I always make such stupid mistakes

13:12 Frozenlock: If I have two vector that I want to reorder in function of one of those two, is there a trivial function to do it? For example, sort this with the second vector: [[:A :B :C :D] [4 3 2 1]] -----> [[:D :C :B :A] [1 2 3 4]]

13:15 (sort-by last (partition 2 (apply interleave [[:A :B :C :D] [4 3 2 1]]))) go towards it, but I'm not sure if there's a more elegant way to do it.

13:24 jkkramer_: tiled: sgf files -- making a go app?

13:26 tiled: jkkramer_ nothing complicated, just for replaying a random pro game

13:26 jkkramer_: tiled: cool :)

13:48 S11001001: Frozenlock: use pop instead of last, unless they changed last (I really doubt it)

13:48 Frozenlock: also assuming your vecs are vecs and not arbitrary seqs

13:49 Frozenlock: ,(pop [:a 1])

13:49 clojurebot: [:a]

13:50 S11001001: what

13:50 oh, right, the thing that goes with pop

13:50 ,(doc pop)

13:50 clojurebot: "([coll]); For a list or queue, returns a new list/queue without the first item, for a vector, returns a new vector without the last item. If the collection is empty, throws an exception. Note - not the same as next/butlast."

13:50 dnolen: peek

13:50 ChongLi: hmmm

13:50 dnolen: ,(peek [:a 1])

13:50 clojurebot: 1

13:50 S11001001: yeah what dnolen said

13:50 seangrove: ,(doc peek)

13:50 clojurebot: "([coll]); For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil."

13:50 ChongLi: GPU Process CPU usage goes from 20% to 100% when going from 55FPS to 60FPS

13:50 dnolen: ,((jux peek pop) [1 2 3])

13:50 ChongLi: does that seem right?

13:50 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: jux in this context, compiling:(NO_SOURCE_PATH:0)>

13:51 dnolen: ,((juxt peek pop) [1 2 3])

13:51 clojurebot: [3 [1 2]]

13:51 Frozenlock: "much more efficient than last" Sold :P

13:51 seangrove: Confused why it's first for lists and last for vectors

13:52 S11001001: seangrove: I think because it's reversing the order of conjing

13:52 Frozenlock: ,(let [r (sort-by peek (partition 2 (apply interleave [[:A :B :C :D] [4 3 2 1]])))] [(map first r)(map last r)])

13:52 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentStack>

13:52 S11001001: seangrove: which is push to end for vecs, to start for lists/lazyseqs/etc

13:52 seangrove: Ah, I assumed it was a unified concept at a higher abstract level

13:52 S11001001: If your next question is "why doesn't last special-case" then there is a ~100 post thread on clojure google group arguing about this you can read :)

13:53 AimHere: It's likely to just be the most efficient place to put or take the new element

13:53 seangrove: Nah, the "contributing to cljs is deliberately difficult" thread was enough to sap my will to real the ml for a bit

13:54 craigbro: hah

13:55 S11001001: ,(pop {:a 1 :b 2})

13:55 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IPersistentStack>

13:55 S11001001: eh

13:56 dnolen: seangrove: peek and pop are fns based on IPersistentStack, so it's whatever operations are most efficient for the particular data type that implements that.

13:56 Frozenlock: Would `first' be faster than `last' for an arbitrary seqs?

13:57 seangrove: dnolen: Yeah, shouldn't have thought about the interface it was operating on rather than the underlying structure

13:57 Frozenlock: For a list yes, but any seqs?

14:00 S11001001: Frozenlock: yes first is faster than last for anything built-in

14:00 Frozenlock: Nice, I'll just swap the order of my vectors then.

14:06 Nice... my car won't start. I hate cold weather.

14:16 ejackson: perhaps its lock is frozen ?

14:23 warz: hmm, how would i build leiningen from the git repo?

14:24 Frozenlock: ejackson: Ouch

14:24 bbloom: warz: i think you just use lein normally, but throw in a trampoline

14:24 warz: lein trampoline compile

14:25 but there is a #leiningen where it might be better to ask

14:25 * ejackson apologises to Frozenlock... it was too tempting.

14:26 Frozenlock: Cold... cars stop working, but the Internet carries on. I'm ok with that.

14:27 jsabeaudry: Am I correct to think that there are no syntax changes in 1.5? It's all bugfix and enhancements behind the covers?

14:27 technomancy: warz: see "bootstrapping" in the CONTRIBUTING file

14:39 amalloy: well, i was about to say there are never syntax changes in a new release of a lisp

14:40 but 1.3 introduced record literals, 1.4 introduced tagged literals...

14:41 jsabeaudry: afaik there are no changes to the reader in 1.5. but your question is quite a false dichotomy: it's perfectly possible for there to be no syntax changes, and yet many things which are neither bugfixes nor behind-the-scenes/performance enhancements

14:41 Bronsa: amalloy: 1.5 fixed reading +1/3

14:42 amalloy: reading that was a goal?

14:42 Bronsa: ,-1/3

14:42 clojurebot: -1/3

14:42 Bronsa: ,+1/3

14:42 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string: "+1">

14:49 cemerick: zby: ping

14:50 zby: anyway, whenever you see this: you're applying the middleware in the wrong order: should be wrap-keyword-params wrap-nested-params wrap-params

14:51 amalloy: cemerick: i think a left-to-right ordering may not be very helpful, because a lot of people will be applying them in reverse order with ->

14:52 (wrap-keyword-params (wrap-nested-params (wrap-params handler))) is more clear

14:52 gfredericks: so comp would work well

14:53 cemerick: amalloy: the left-to-right ordering is meant for -> (which is what zby is using, anyway)

14:54 (wrap-keyword-params (wrap-nested-params (wrap-params handler))) is wrong ;-)

14:58 gfredericks: is there any perf penalty for using an Integer instead of a Long?

14:59 * gfredericks doesn't know the implications of clojure's long/double preference

14:59 Raynes: (type (+ (int 3) (int 3)))

14:59 &(type (+ (int 3) (int 3)))

14:59 lazybot: ⇒ java.lang.Long

15:02 SegFaultAX: &(type (+' 3 3))

15:03 lazybot: ⇒ java.lang.Long

15:03 gfredericks: &(type (+' 1 (Long/MAX_VALUE)))

15:03 lazybot: ⇒ clojure.lang.BigInt

15:03 gfredericks: &(type (+ 1 (Long/MAX_VALUE)))

15:03 lazybot: java.lang.ArithmeticException: integer overflow

15:05 16WAABC47: cemerick - I am at home now :) I'll check the fix in a minute :)

15:12 anars: can I have lein-ring 0.8.2 use clojure 1.4 instead of clojure 1.2.1, which it pulls in automatically when I run 'lein deps'?

15:17 muhoo: umm, &&(BigInteger. 1)

15:17 umm, &(BigInteger. 1)

15:17 &(BigInteger. 1)

15:17 lazybot: java.lang.IllegalArgumentException: No matching ctor found for class java.math.BigInteger

15:17 muhoo: yeah, that. why?

15:17 hyPiRion: muhoo: ##(bigint 1)

15:17 lazybot: ⇒ 1N

15:18 muhoo: hthanks

15:18 &(type (bigint 1))

15:18 lazybot: ⇒ clojure.lang.BigInt

15:19 muhoo: no

15:19 Bronsa: ,(type (biginteger 1))

15:19 clojurebot: java.math.BigInteger

15:19 muhoo: better, thanks

15:19 patrkris: hi folks. how do I use Clojure 1.5 when running `lein repl'? i have already included clojure 1.5.0-RC2 in project.clj

15:20 seangrove: ,(doc get)

15:20 clojurebot: "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."

15:20 hyPiRion: patrkris: It should work out of the box then.

15:20 amalloy: then you're using it

15:20 muhoo: why there is a bigint vs biginteger in the first place, is a question i won't wory about atm.

15:20 patrkris: but *clojure-version* says 1.4.0

15:20 hyPiRion: ^

15:20 hyPiRion: patrkris: refheap the project map

15:20 or are you using `lein repl` outside of the project?

15:21 patrkris: hyPiRion: ok, I must have done something wrong before... now it works, sorry :)

15:22 by the way, since lein-ring has clojure 1.2 as a dependency, will it use that or clojure 1.5 specified in my projects project.clj?

15:22 hyPiRion: patrkris: It will use the highest one

15:23 patrkris: cool, thanks

15:43 Slotkenov: hi there

15:43 AtKaaZ: L.O.

15:49 Slotkenov: Is this the right place for clojure chat?

15:50 ChongLi: Slotkenov: yep

15:50 hyPiRion: ,(println true)

15:50 clojurebot: true\n

15:51 Slotkenov: cool, i'm new her, new to irc and new to clojure

15:51 ChongLi: that's great!

15:51 we always want new people trying clojure

15:52 S11001001: ,(if (Boolean. false) true false)

15:52 clojurebot: true

15:52 S11001001: Delete all files?

15:53 Slotkenov: i've been reading clojure for almost a year now, so I know quite a lot about it, but never got my hands dirty

15:53 ChongLi: now is as good a time as any!

15:54 Slotkenov: trying to change that now yeah

15:54 running into a problem I havn't before though

15:54 augustl: weavejester isn't online, has the world ended?

15:55 Slotkenov: when running lein repl I get the following excepion: Exception in thread "main" java.lang.ExceptionInInitializerError at clojure.main.<clinit>(main.java:20) Caused by: java.lang.RuntimeException: Unable to resolve symbol: defn in this context, compiling:(clojure/core.clj:3)

15:56 ChongLi: hmm

15:56 Slotkenov: looks like a problem in clojure itself, but thats probably not it...

15:56 or is it?

15:56 ChongLi: have you tried blowing away your ~/.m2

15:56 Raynes: Chances are those words have no meaning to him at this point.

15:57 ChongLi: lein will re-download everything in there

15:57 Slotkenov: yes, tried that already

15:57 Raynes: Oh, neat.

15:57 You're way on top of things Slotkenov.

15:57 technomancy: Slotkenov: what's the context here? in a specific project or everywhere?

15:58 Slotkenov: well, this is in a project, but that has just been created with lein new

15:58 can try it outside a project though

15:58 zeussphinx: Slotkenov: try outside a project and see if you get same error

15:58 technomancy: also: how did you install leiningen?

15:59 Slotkenov: ok, outside it works fine

15:59 ChongLi: and do you have any version of clojure installed by your OS package manager?

15:59 Slotkenov: so has to do something with the project

15:59 I installed it a while back, with the sef installing batch i believe

15:59 hyPiRion: I feel like everyone's storming Slotkenov, trying to help him.

15:59 ChongLi: hahaha

16:00 Slotkenov: :) a warm welcome

16:00 hyPiRion: looks like people are fighting for the right to help him

16:00 AtKaaZ: ,'true

16:01 clojurebot: true

16:01 ChongLi: I'll yield to technomancy, seeing as he's the author of leiningen

16:01 technomancy: ChongLi: I suspected OS-level package manager issues too, heh

16:01 Slotkenov: I removed the project, just to be sure. Now when I do lein new clojure, cd clojure, lein repl

16:01 get the same exception again

16:02 AtKaaZ: what was the name of the previous project?

16:02 Slotkenov: the same; clojure

16:02 hyPiRion: Slotkenov: Oh right. Try to name it something else than clojure, and check.

16:02 technomancy: oh dear... we should probably blacklist that =\

16:02 AtKaaZ: awesome

16:02 Slotkenov: oh.. would that be conflicting

16:02 hyPiRion: Slotkenov: Perhaps? :p

16:03 technomancy: hate to break it to you, but that name is taken =)

16:03 AtKaaZ: technomancy: maybe it should check if projectname is the same as any included dependencies?

16:04 Slotkenov: yes, that was the problem

16:04 thanks a bunch

16:04 ChongLi: also

16:04 what version are you running?

16:04 leiningen 2 just came out recently

16:04 and it's very nifty

16:04 technomancy: AtKaaZ: the problem is looking at :dependencies doesn't tell you anything about the namespaces inside those jars

16:04 Slotkenov: is it? already did an upgrade

16:05 technomancy: but ... hm. you could inspect the search indices and see if there's a conflict there.

16:05 ChongLi: lein --version

16:05 technomancy: wouldn't have caught this particular one though since it's org.clojure

16:14 AtKaaZ: ,(map println '(1))

16:14 clojurebot: (1\nnil)

16:14 gfredericks: is (.println System/err ...) the normal way to print to stderr? (binding [*out* *err*] ...) seems silly

16:15 (silly in the case of a single call at least)

16:16 AtKaaZ: (makes sense to me)

16:20 Raynes: gfredericks: I've always just used binding.

16:24 hyPiRion: ,(binding [*out* *err*] (println :foo))

16:24 clojurebot: :foo\nnil

16:24 hyPiRion: what's up with clojurebot's newlines nowadays?

16:24 AtKaaZ: flood protection maybe

16:25 hyPiRion: maybe

16:28 hiredman: how does partial-map work?

16:28 https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L2818

16:28 PMap has no fields

16:29 rodnaph: in core.logic how do i express not equal? something like (=/= x y) ?

16:29 hiredman: (map->PMap m) is called with an arg

16:29 != is disequality

16:29 rodnaph: hiredman: thanks a lot! do you know of any api docs for core.logic, my google fu fails me...

16:35 weavejester: Hi folks

16:35 Is Programming Clojure still one of the best beginning Clojure books?

16:36 warz: the 2nd edition, with the white bird on the front?

16:37 biff_tannen: weavejester this page has some good recommendations https://groups.google.com/d/topic/clojure/lKLQ-bgetTU/discussion

16:37 weavejester: Yep

16:37 warz: i bought it and it's still above my head, i think. thats just because i think clojure is difficult for me, coming from C-like languages.

16:37 ChongLi: I like clojure programming

16:37 Clojure Programming

16:37 rather

16:38 warz: i read the whole thing once through, and clojure still looks like some alien language to me. haha.

16:38 ChongLi: the o'reilly one

16:38 warz: are you a lisp programmer?

16:38 warz: i think i need something like a clojure by example book or something

16:38 no this is my first lisp

16:38 ChongLi: you might do well with SICP

16:39 it starts right from the ground up with no knowledge of programming at all required

16:39 it's pretty amazing how quikly you'll learn lisp from it

16:42 cemerick: warz: Perhaps try the first chapter of http://clojurebook.com (available free there)

16:44 rodnaph: in core.logic - if i know (likes x y) - how would i express a goal that (not (likes x y)) - ie. hates

16:46 hiredman: the non-recursive nature of featurec is a drag

16:46 andres-v: warz: Just to add another one to your list that I think is great and helps to ignite the right state of mind: "The Little Schemer"

16:47 dnolen: hiredman: partial-map is an implementation detail of featurec

16:47 weavejester: biff_tannen: Thanks for the link

16:48 rodnaph: in core.logic - if i know (likes x y) - how would i express a goal that (not (likes x y)) - ie. hates. beginner question i know, but any tips dnolen? thanks

16:49 dnolen: rodnaph: there's no support for negation at this time. negation is pretty tricky.

16:49 AtKaaZ: does not likes mean hates? or is just somewhere in between?

16:49 rodnaph: dnolen: bummer... ok thanks for the info.

16:50 dnolen: rodnaph: if it's any consolation - negation is still a tricky/difficult problem for Prolog-like languages to this day.

16:50 hiredman: dnolen: right, I figured that out

16:51 rodnaph: dnolen: a little consolation, though it does make my problem of working out teams of people who get on with eachother a little trickier ;)

16:52 hiredman: dnolen: I want featurec to be recursive, the values acan be maps I want to partially unify with them

16:53 dnolen: hiredman: it's unsound to allow partial maps to leak into the system.

16:54 hiredman: sure, but is there someway to make featurec recursive like that? so submaps can be partially specificed?

16:54 zby_home: cemerick: I tried all kinds of ordering :

16:54 https://gist.github.com/4628280

16:54 dnolen: hiredman: oh, right - hmm that's useful and not hard to implement

16:55 hiredman: feel free to open an enhancement ticket and I will look into it.

16:55 zby_home: ah - sorry

16:55 now it is OK

16:55 I am just too tired

16:57 hiredman: http://dev.clojure.org/jira/browse/LOGIC-108

16:57 dnolen: hiredman: sweet, thanks

16:57 hiredman: I'll update it there if I figure out how to do it, which seems unlikely

16:59 dnolen: hiredman: heh, it's ok, I'll probably take a look tomorrow or Saturday.

16:59 hiredman: you can do it now w/ multiple featurec calls of course, but that's a bit tedious

17:04 hiredman: dnolen: yeah, I noticed how tedious the multiple featurec calls is :)

17:04 pandeiro: is lein deploy working differently now for clojars?

17:07 technomancy: pandeiro: different from what?

17:07 pandeiro: technomancy: my bad, forgot the command

17:07 ut works fine

17:09 rodnaph: core.logic: i'm trying to write a goal that asserts there's a man in a list - https://www.refheap.com/paste/8933 - but the results are pairs of results and fresh vars - seems i've really misunderstood something...

17:21 dnolen: rodnaph: I think you need a base case for when you hit the end of the list.

17:21 rodnaph: you should look at membero

17:21 amalloy: dnolen: he also needs (meno xs), not (meno y)

17:22 rodnaph: amalloy: won't that just infinitely recurse?

17:22 amalloy: oh, i misread it. sorry

17:22 rodnaph: dnolen: i had that, but it meant an empty list would be a success... but i'll keep working on it.

17:25 dnolen: rodnaph: I would help more but a bit tied up at the moment. It's a little bit trickier to do than membero but only a little bit.

17:26 rodnaph: no problem, thanks for answering anyway! my questions probably don't quite make sense yet, heh.

18:41 nbessi: Hello

18:44 Sorry to bother you but I'm little stuck with probably a basic problem. So if somebody has five minutes to help a noob...

18:45 I'm looking to the best way to have a custom get behavior on hashmap

18:45 like __getitem__ in Python

18:46 brehaut: nbessi: back up a step. why are you wanting that?

18:47 nbessi: I want to define a record in a abstaction library to interface an business object framework

18:48 brehaut: i seems like you might be trying to model your system like an OO system is all.

18:48 nbessi: I want to use be able to do lazy loading of relation

18:48 nDuff: nbessi: ...so, the direct answer is probably a suggestion to look an the implementation of bean in the standard library.

18:48 weavejester: nbessi: So kinda like an ORM?

18:49 nDuff: nbessi: ...the less-direct answer is that what you're doing smells likely to have a more idiomatic approach available.

18:49 S11001001: except to use something other than proxy

18:49 like a function

18:49 weavejester: If you have lazy loading of data, the common Clojure solution is to use a ref

18:49 Or something deref-able, rather

18:50 Or a lazy seq, if there is more than one thing you want to retrieve.

18:50 nDuff: nbessi: anyhow, bean is at https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_proxy.clj#L372

18:50 nbessi: I'm new to clojure and I have writen this https://github.com/nbessi/carcajou

18:50 nDuff: nbessi: ...and shows you a custom implementation of APersistentMap

18:50 augustl: this is a dull stack trace to debug.. https://www.refheap.com/paste/8940 Getting it when I set :session in a ring response (using ring.middleware.session)

18:50 absolutely nothing relevant in it :)

18:51 weavejester: augustl: Try adding an explicit dependency for clj-stacktrace 0.2.5

18:51 augustl: weavejester: will do

18:51 weavejester: Or use Ring 1.1.8, which I believe has that dependency

18:51 augustl: It looks like you're running across a bug in clj-stacktrace 0.2.4

18:51 augustl: weavejester: I'm using [lein-ring "0.8.0"]

18:52 nbessi: nDuff: Thanks

18:52 weavejester: augustl: Try 0.8.2 :)

18:52 augustl: seems 0.8.2 is the latest

18:52 weavejester: ^^

18:52 weavejester: btw, regarding the CSRF/XHR issue, I haven't been able to find any good sources there.

18:52 weavejester: augustl: I'll look it over tomorrow

18:52 xeqi: csrf/xhr issue?

18:53 augustl: xeqi: it's difficult to do POSTs with XHR where the body only is JSON when using weavejester's ring-anti-forgery

18:53 xeqi: https://github.com/weavejester/ring-anti-forgery/pull/11

18:53 it's just an enhancement for convenience, no security flaws :)

18:54 xeqi: ah

18:54 augustl: currently I would have a form encoded body where the JSON was in one of the parameters, instead of just having the json directly in the body

18:54 weavejester: awesome, got a proper stack trace now :)

18:54 "java.security.InvalidKeyException: Invalid AES key length: 8 bytes"

18:55 where's the type of keys you can give the cookie store documented?

18:55 weavejester: augustl: Oh, they need to be AES keys

18:55 Which means 8, 12 or 16 bytes, I believe

18:56 augustl: I see

18:56 weavejester: Best option is to randomly generate them with crypto-random or something.

18:56 augustl: so a string with 16 single byte characters should do? :)

18:57 weavejester: augustl: I think it needs to be a byte array, but yes...

18:57 augustl: ah

18:57 weavejester: Although keys should be randomly generated when possible.

18:57 augustl: pwgen -s to the rescue

18:58 not sure what its entropy source is though, will use a proper generator for the production key :)

18:58 this is just for dev

18:59 nbessi: I think your right my approachy is fishy I should probably use a multi args function that takes keyword suite

19:01 augustl: weavejester: regarding the csrf/xhr thing, it would seem that using the random token for XHR to is safest, since for all we know in HTML6 you can set arbitrary headers from a <form>

19:02 nbessi: It is sometime hard to switch paradigm, thanks for the time, regards

19:20 francis: Does anyone know of a tool that finds public functions/defs and makes them private? Or some suggestions as to the libaries one would use to make such a thing?

19:21 TimMc: francis: You want to find all defn statements in a file and makes them defn- statements?

19:22 francis: TimMc: Yes, but with the condition that they are only referenced within that file. (by grepping the project most likely)

19:23 Obviously this wouldn't catch all cases, but if you had a codebase where noone used private fns it could really help

19:24 technomancy: francis: not exactly, but I have some code that can scan clojuresphere and tell you which projects depend on yours and will run their tests so you can see if changes you are going to make will break them

19:24 https://github.com/Seajure/melange

19:27 TimMc: brb, adding a project that depends on everything and has malicious code in its tests

19:30 francis: technomancy: not really what I was asking, but very cool. If I have some time this weekend I'll see about getting it working.

19:31 technomancy: francis: you might also find slamhound relevant; it has logic for making changes to a namespace and seeing if the project will still compile

19:31 though that's rather brute-force; you could probably come up with something smarter =)

19:32 francis: technomancy: RE: slamhound - I'm still not sure how to fix the macro/quoting issue other than to prompt the user and ask them to check what deps should be there.

19:33 technomancy: francis: yeah, I think some manual annotation is required

19:33 I wish there were a fully-automated solution, but I'm just not seeing it

19:33 francis: do you work with alex baranosky?

19:34 francis: technomancy: yes

19:34 technomancy: cool

19:43 wei_: what does this error mean? Can't change/establish root binding of: *cljs-ns* with set

19:43 I think it's nrepl-related. here's the context: https://gist.github.com/4630437

19:43 I'm trying to start a repl programmatically and upgrade it to a browser-repl

20:00 devn: Anyone have an nrepl config with syntax highlighting, proper indentation, arg hints, and paredit?

20:01 technomancy: devn: arg hints are just eldoc

20:02 oh, but you have to turn it on after nrepl connects. hang on.

20:02 (add-hook 'nrepl-connected-hook (defun add-clojure-mode-eldoc-hook () (add-hook 'clojure-mode-hook 'turn-on-eldoc-mode)))

20:02 not sure what you're looking for; the rest of it should just work

20:03 tomoj: I wondered why I no longer had arg hints

20:03 I was just M-.'ing all the time

20:07 ninjudd: technomancy: i just tried calling 'turn-on-eldoc-mode manually in a buffer that has nrepl running, and no luck

20:11 technomancy: hm; not sure then

20:11 aphyr: What's the best way to test code which invokes a function I have no control over?

20:11 technomancy: wait, in the nrepl buffer or in clojure-mode?

20:11 aphyr: e.g. I've got a function that calls postal.core/send-message, but since it's not a dynamic var I can't re-bind it in my tests

20:12 ninjudd: technomancy: in the clojure file

20:12 cbp`: I just use emacs live, on windows at least, since I couldn't get anything to run properly on windows, it wouldn't even connect to nrepl

20:14 technomancy: aphyr: with-redefs?

20:15 aphyr: What the WHAT?

20:16 technomancy: wow, yeah, that's exactly what I needed. Thanks.

20:16 * technomancy makes magic sparkle jazz hands motion

20:16 aphyr: Yeah, wow. Still discovering clojure.core I guess.

20:17 technomancy: it's not used much (at all, hopefully) outside tests

20:35 devn: technomancy: one thing i seem to consistently run into with nrepl is that im not sure how the heck to restart it

20:35 like if i update project.clj and nrepl-jack-in, it seems to allow me to start a new nrepl session, but if i go to eval a form i get something like: "No such namespace"

20:35 ive tried nrepl-restart and stuff to no avail

20:37 nDuff: devn: are you require'ing your namespaces?

21:21 brainproxy: running into an interesting issue with ring

21:22 so apparently Microsoft's xhr is super picky about whether there is a Last Modified header in a response

21:22 if not, it just assumes it can use a cached response

21:23 I've not seen any other clients behave in this way -- various browsers, programmatic things, curl, wget

21:23 but essentially, i can make a request to my ring-based web server, and it will go through the first time

21:24 but subsequent requests are never getting through, as the WinJS.xhr assumes it can reuse the last response

21:24 akhudek: brainproxy: eww. I guess a custom middleware that always sets the last modified to "now" would work. Ugly though.

21:25 brainproxy: akhudek: yeah, pretty ugly

21:25 amalloy: that's not even a correct treatment of last-modified

21:25 tomoj: you mean because the first response doesn't have a Last-Modified?

21:25 brainproxy: tomoj: from what I gather, yes

21:25 tomoj: if it does, it fixes it?

21:26 brainproxy: well i'm not sure "fixes" it is the right way to put it

21:28 tomoj: I mean, if the first response has a Last-Modified, the second goes through?

21:28 second request

21:28 brainproxy: i haven't modified ring yet

21:28 my app i mean

21:28 but after supper I will try a middleware approach per akhudek

21:28 tomoj: oh, I vaguely remember some stuff about XHR caches and adding nonce query params to urls

21:29 (doubtful that Last-Modified will help you)

21:29 brainproxy: yeah, but that's ... awful

21:29 setting last modified in the request definitely did not help

21:29 i mean if modified since

22:43 milos_cohagen: stupid q.. if i have expr which evaluates to a string with newlines in it, and the repl displays value, how can i have the repl print the string value with actual newlines instead of '\n' chars

22:44 TimMc: milos_cohagen: println

22:45 milos_cohagen: doh thx was using prn

22:45 tyvm

23:01 fbru02: hey guys ... I was a user of slime and now nrepl and having some issues

23:08 nDuff: fbru02: You're more likely to get a response if you ask a question. :)

23:09 fbru02: nDuff: fair enough , for example M-x eval buffer is not working anymore ... anybody seen that ?

23:10 nDuff: fbru02: Is that what's bound to C-c C-k? Because that still works fine for me.

23:11 fbru02: nDuff: nice... didn't know the keys , wonder why doing it from the minibuffer doesn't work

23:12 nDuff: Ahh -- C-c C-k is nrepl-load-current-buffer

23:12 so it's not the same call as eval-buffer

23:17 fbru02: nDuff: thanks man , will look more into methods nampesaced with nrepl... before in slime you could use eval-buffer I guess not the case anymore

23:17 in slime-swank I mean

23:17 nDuff: *nod*.

23:30 tomoj: I can't use eval-buffer in slime-swank

23:30 there is a slime-eval-buffer though

23:38 fbru02: tomoj: yes, maybe I was think wrong

23:51 nDuff: Hrm..

23:58 rationalrevolt: With ring, can some one help me understand why passing a var to run-jetty allows me to reload code and have it reflect immediately? (run-jetty #'handler {:port 8080 :join? false})

23:59 nDuff: rationalrevolt: passing the var object means it's involved in the lookup, and can be substituted/replaced.

Logging service provided by n01se.net