#clojure logs

2013-01-24

00:01Rich_Morinno, that didn't solve the problem.
00:02Rich_Morinsomehow, I'm not getting a REPL
00:03Rich_MorinI can type "lein repl" into the shell and it all works. Perhaps I need to tell IDEA something ?!?!?
00:06muhooif you get frustrated, just try lighttable instead
00:07ibdknoxI need more hours in the day so I can get this next version out sooner :)
00:08Rich_Morinibdknox: I'm really hoping that LT will save me from emacs and all the other envs - please keep slogging!
00:08ibdknoxthe next version is a huge step forward in just about every way
00:09akhudekRich_Morin: ok, maybe it is that platform SDK thing. It's been so long ago since I set it up that I now forget. :-(
00:09warzim 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. :)
00:10tomojcurious, what data structure are you using for the edited code, if that's not a secret?
00:10ibdknoxwarz: do you have a list of these quirks/bugs? 0.3.0 is focused entirely on experience (and a surprise)
00:10akhudekRich_Morin: ah, I think that is just selecting the jvm you want to use
00:11tomoj(in light table)
00:11akhudekmy system has 1.6 and 1.7, and I'm pretty sure I added 1.7 myself
00:11ibdknoxtomoj: as it is stored in memory for display?
00:11warzibdknox, 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.
00:12ibdknoxtomoj: I use the codemirror editor, which under the covers houses the lines in a nice B-Tree
00:12warzyou responded to the issues i opened though
00:12tomojoh
00:12Rich_MorinFrom 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...
00:12ibdknoxwarz: well let me know as you run into more :)
00:12tomojI didn't know js was involved
00:12ibdknoxtomoj: the whole thing is CLJS
00:13warzibdknox, 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.
00:13warzso i cant see the whole message.
00:13tomojwow, nice
00:13Rich_MorinIt offers JDK, IntelliJ IDEA Plugin SDK, and Android SDK.
00:14warzi was thinking, maybe an X circle on the errors in top left ot remove them
00:14warzor something
00:14ibdknoxwarz: yeah the entire result/error thing as it exists has been completely redone to actually be inline so that won't happen anymore
00:14warzah ok cool
00:14Rich_Morinakhudek: I think it wants me to specify a JDK ?!?!
00:15Rich_Morinand it isn't offering a default.
00:15akhudekRich_Morin: yes, looks like you need to create an entry
00:15warzibdknox, oh i was also thinking maybe somehow the ability to specify files to ignore in the open command popups
00:15Rich_Morinany clue about what should go in ti?
00:16ibdknoxwarz: also done in the new one :)
00:16akhudekRich_Morin: you certainly have a jdk installed if you have lein, so just point it to the JDK directory
00:16warzleet
00:16warz:D
00:16rationalrevoltdoes LT use a constant port number?
00:16akhudekon mac it's something like /Library/Java/JavaVirtualMachines/jdk1.7.0_06.jdk/Contents/Home
00:16akhudekor /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
00:16ibdknoxrationalrevolt: yeah, 8833 and 8834
00:16akhudekconfusing that it doesn't come preconfigured with a default though
00:18michaelr525hello
00:18warzibdknox, is it just you working on LT?
00:19ibdknoxwarz: on the code-side it is
00:19warzwell gj man. well done. :)
00:19warzand YC and all that, nice.
00:20Rich_Morinakhudek: well, that didn't solve it...
00:20ibdknoxhaha thanks. Long way to go, but this next one is a big step in the right direction
00:20akhudekRich_Morin: did you also assign the platform in the project?
00:21akhudekit might now be missing since there was no default
00:21akhudekunder project settings, select the project, then project sdk
00:21Rich_Morinnot sure - do I have to pick a particular jar file in the Home directory?
00:23Rich_Morinthat did it; thanks!
00:23akhudekglad you got it working :-)
00:24Rich_Morin(+ 1 2) => 3 +1!
00:24clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "+1">
00:37rationalrevolt(case 'yes 'yes "yes" 'no "no")
00:40amalloythe test clauses in case are not evaluated
00:42muhoobeen bitten by that before. iirc java blows up if case tests arent constants, and clj silently does something else
00:43amalloymuhoo: not exactly
00:43amalloyclojure just has a richer set of constants: foo is a perfectly valid constant, the symbol foo
00:43amalloyso anything is a constant, if you choose not to eval it
00:45muhooaye
01:21tomojsince truth_ is only used in emit :if, why not just emit inlined checks?
01:22tomojor is it the checks and not the function call that make truth_ a concern
01:26amalloytomoj: well, using truth_ instead of inlining probably reduces code size too
01:27tomojdidn't think about that
01:28tomojbut I wonder about the relative importance of the function call, the checks, and code size, in the motivation for safe-check?
01:28tomojer, safe-test?
02:28michaelr525ohpauleez: hi
02:28ohpauleezmichaelr525: Hello
02:29michaelr525ohpauleez: is the pubsub in shoreleave a parallel to backbone events?
02:31michaelr525in the sense that it is used to wire the application components..
02:31ohpauleezI'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
02:32ohpauleezit's a protocol, so really - anything can subscribe to anything. And anything can publish
02:32ohpauleezalong the way, functions can send stuff to the server
02:32ohpauleezyes, exactly, it's used to wire an app up. You essentially create the dataflows in your app
02:33michaelr525sounds 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?
02:34ohpauleezhaha, 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
02:36michaelr525ok
02:36ohpauleezthis is what I point most people to: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/blob/master/src-cljs/depr/app.cljs
02:37ohpauleezRobert wraps up some stuff to make the interface a little easier
02:37ohpauleezand you should feel free to ping me on here or email me
02:37ohpauleezI'm more than happy to help
02:37michaelr525ohpauleez: thanks :)
02:38ohpauleeznp - good luck and have fun!
03:42ucbdoes the latest leiningen release work with drip?
04:12minikomithis 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) ?
04:13amalloy'inc is not inc
04:14amalloy(apply comp (list inc inc inc)) would be fine
04:19minikomisorry, do you mind pointing me in the right direction on the difference?
04:20Chousukeminikomi: you're quoting the list. including its contents
04:21Chousuke'(a b c) is a list of three symbols
04:21minikomiah
04:21minikomithanks :)
04:21Chousukein general, if you want a literal list, you should use a vector instead :P
04:22Chousukethat is, you example would work just fine if you did ((apply comp [inc inc inc]) 2)
04:22minikomithat's nicer, thanks
04:26michaelr525what is a good file browser in emacs?
04:27michaelr525a side pane like in sublimetext2 could be cool :)
04:27michaelr525(i've decided to give emacs another stab)
04:27Iceland_jackDired
04:28Iceland_jackyou're probably asking the wrong question, check out ido-mode
04:28xumingmingvand projectile also worthing trying
04:29michaelr525ido mode is cool but i would like to have a tree view of my project open..
04:29arcatani'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
04:29michaelr525directory/file tree
04:29arcatan*the directory tree
04:30Iceland_jackmichaelr525: Then look at dired
04:30daimrodmichaelr525: there is dired and you could look at ECB.
04:30lpetitHello, anyone here having the "New leiningen project" issue with Counterclockwise, and willing to help test the patch (should take no more than 5 mins)
04:31michaelr525ok, then dired, ecb, projectile i'll try these
04:32lpetitnot everybody at the same time :)
04:32michaelr525hehe
04:35michaelr525how to exit M-x ido mode? (esc doesn't work)
04:35ro_stC-g
04:35vijaykiranmichaelr525: or three-times esc :)
04:36ro_stC-g is get-me-the-hell-out-here
04:36michaelr525cool
04:40michaelr525dired doesn't seem to have directory structure mode..
04:45clgvlpetit: whats the issue? (link?)
04:46lpetitclgv: 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
04:47lpetitclgv: 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
04:48clgvlpetit: until when do you need feedback. my experimental machine is at home ;)
04:49lpetitclgv: I want to release a 0.11.1 today
04:49clgvlpetit: damn. that's a too short time frame for me...
04:50clgvlpetit: I am pretty busy for an upcomming deadline
04:50lpetitclgv: no problem, I understand that you don't want to risk breaking your work machine :)
04:50lpetitI'll just create a fresh environment here, np
04:52clgvlpetit: will the repl history settings be included in 0.11.1?
04:57lpetitclgv: no, just a quick patch, not including anything but the fix
04:58clgvlpetit: ah right you include new features in the beta releases first...
04:58lpetitright
06:26michaelr525ooh
06:26michaelr525crazy shit
06:27ejacksonmichaelr525: emacs ?
06:27augustlwhat 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? :)
06:28michaelr525ejackson: no, i gave up emacs after 5 minutes again ;)
06:30michaelr525ejackson: 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
06:30michaelr525got Exception in thread "main" java.lang.ClassNotFoundException: my-project.server
06:31michaelr525after 'lein run'
06:31michaelr525looks like it failed to compile but did it silently
06:31augustldoh, used main- not -main
06:49ChongLiis there any benefit to putting a mutable javascript array inside an atom and updating it with swap!?
06:58luxbockdoes a doc-string always come before the arg-list, or can I put it underneath one as well?
07:02anarsluxbock: according to the source code (https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L272), the doc-string always comes before.
07:03luxbockalright
07:10ejacksonluxbock: yes, otherwise it is just evaluated as a string literal as part of the body of the function
07:23augustlbleh, using rabbitmq I have to manually manage connections if the rabbitmq server goes down, boring
08:22augustljust took the business logic process down and up again without any of the clients noticing. Queues for RPC = <3
08:31michaelr525augustl: the clients are web requests?
09:48augustlmichaelr525: late reply.. The client is a HTTP API that translates the incoming HTTP to stuff I RPC over a queue
09:48augustland responds with http when the queue responds
09:52michaelr525augustl: and that HTTP API is waiting for an answer?
10:03augustlmichaelr525: yeah, the rpc is done in a future, and I dereference it to make it synchronous so I can respond with HTTP
10:04augustlthe alternative would be a nodejs stype event driven approach where the HTTP handling is also asynchronous
10:04augustlbut a blocking call via deref works just fine
10:04augustlmichaelr525: will probably blog about it soon :)
10:05augustland perhaps release the rabbitmq-amqp wrapper as open source, if that's useful
10:05michaelr525augustl: yeah, i though that it sounds like a good use case for 'aleph' async response
10:05augustlit's just 88 lines of java interop though
10:06augustlmichaelr525: hmm, what's aleph?
10:06michaelr525augustl: you didn't like longhr?
10:06michaelr525augustl: https://github.com/ztellman/aleph
10:07augustlmichaelr525: longhr is the clojurewerkz one, right?
10:07michaelr525augustl: yup
10:07augustlto be honest I rarely feel that the clojure wrappers over java interopp adds any value, quite the contrary
10:07augustlI prefer to just do the interop myself
10:07augustl..unless there's some useful feature it implements on top of the interop of course
10:08michaelr525ok
10:08augustlgood :)
10:08michaelr525i can't really compare, i've just used longhr but never user the java api
10:46djwonkwhy is (#({1 2})) not ok but (#(hash-map 1 2)) is?
10:46djwonk(I'm building up small pieces to see what is going haywire)
10:47djwonk,(#(hash-map 1 2))
10:47clojurebot{1 2}
10:47djwonk,(#({1 2}))
10:47clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>
10:49ejacksondjwonk: true (#{1 2} 2)
10:49ejackson,(#{1 2} 2)
10:49clojurebot2
10:50djwonkejackson: ok, so the {} is being treated as a function since it is in function position
10:50TimMc,'#({1 2}) ;; djwonk
10:50clojurebot(fn* [] ({1 2}))
10:50ejackson#{} is being treated as function, yes
10:51TimMc#{}?
10:51rasmusto,(#({1 2}) 2)
10:51clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval135$fn>
10:51TimMcejackson: You're using sets there.
10:52djwonkrasmusto: yes, that illustrates what is hanging me up
10:52ejacksoni was intending to... were we talking about maps... sorry
10:52ejacksonboth can be used as functions
10:52rasmustodjwonk: iirc you can't use map literals in anonymous functions, I might be wrong
10:52hyPiRion,(#(hash-map 1 2))
10:52clojurebot{1 2}
10:52TimMcrasmusto: No, that's not true.
10:53rasmustoTimMc: ah, T stand corrected
10:53rasmustoI*
10:53djwonkhyPiRion: yes, hash-map works for me, I was trying to understand what was going wrong
10:53hyPiRion,((constantly {1 2}))
10:53clojurebot{1 2}
10:53TimMcrasmusto: The only thing you can't write in a function literal is another function literal. :-)
10:53rasmustoTimMc: understood
10:53hyPiRion,(#(`[~@{1 2}] 0))
10:53clojurebot[1 2]
10:53hyPiRiongurr.
10:54hyPiRion,(#(`[{~1 ~2}] 0))
10:54clojurebot{1 2}
10:54TimMcLook what you've done, you've got hyPiRion started on swearjure again!
10:54hyPiRion:D
10:54ejacksonits a perlpocalypse
10:54ivaraasen:D
10:54rasmusto,(#({2 3}))
10:54clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>
10:54djwonkhyPiRion: my eyes!
10:54boodle,(class (#({1 2})))
10:54clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>
10:55rasmustoI think I'm confused now too
10:55ivaraasenswearjure is quite relaxing actually. a bit like white noise
10:55ejacksonrasmusto: what are you trying to do ?
10:56djwonk"Do not look into hash syntax inside function literal with remaining eye" http://ledmuseum.candlepower.us/sixth/bsl.gif
10:56augustlrasmusto: #(foo 1) expands to (fn [] (foo 1))
10:57djwonk,((fn [] {1 2}))
10:57clojurebot{1 2}
10:57djwonk,(#({1 2}))
10:57clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>
10:57djwonkeek
10:57djwonksomething isn't adding up
10:57ivaraasenhyPiRion: considering incorporating swearjure into the next issue of Spitposten
10:58djwonkmy conclusion: my mental understanding of #() is not correct
10:58hyPiRionivaraasen: hahah, sweet
11:02rasmustoyeah, that's been what I'm confused about :p
11:03hyPiRionoh, I love this
11:03hyPiRion,(#(`%%%) :ten)
11:03clojurebot:ten
11:03augustldjwonk: it expands to (fn [] ({1 2}))
11:03hyPiRion,(macroexpand '#(`%%%))
11:03clojurebot(fn* [p1__57#] ((quote p1__57__58__auto__) p1__57# p1__57#))
11:03hyPiRionThis one's mind boggling.
11:03augustlthat's why I said #(foo 1) expands to (fn [] (foo 1)) :)
11:03TimMcdjwonk: Evaluate this, then stare at it carefully: '#({1 2})
11:03rasmusto,(#(identity {1 2}))
11:04clojurebot{1 2}
11:04djwonkaugustl: thanks, I missed the outer parens!
11:04augustl^^
11:04rasmustoOkay, I'm back on track, thanks augustl
11:04djwonkTimMc: thanks
11:06augustlthe owls are not what they seem
11:06TimMcdjwonk: Now you should be able to figure out why this does what it does: ##(#())
11:06lazybot⇒ ()
11:07augustlyou can add hashtags and code clojure on twitter at the same time!
11:08djwonkhyPiRion: #(`%%%) is messed up
11:09hyPiRiondjwonk: I think it's a bug that `% resolves into that
11:09hyPiRionand yeah
11:09hyPiRion~hyPiRion
11:09hyPiRionHurm.
11:09djwonk,##(#())
11:09lazybot⇒ ()
11:09clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Nested #()s are not allowed>
11:10djwonkTimMc: Clojure 1.5 (on my machine) does not like, it complains just like clojurebot
11:10djwonkanyhow, I'm content now
11:10djwonkI will be swearing like hyPiRion
11:11hyPiRionNothing's like trying to understand swearjure
11:12hyPiRion,(#([`{~% ~@%&}] (+)) 1 2 3 4) ; swear all the things
11:12clojurebot{1 2, 3 4}
11:12ejacksonyuck
11:14gfrederickshyPiRion: ermahgerd
11:15gfredericksso #([`{~% ~@%&}] (+)) == c.c/hashmap
11:15hyPiRiongfredericks: almost, doesn't work for zero input
11:16hyPiRion,((#([`{~% ~@%&}](+)))
11:16clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
11:16hyPiRion,(#([`{~% ~@%&}](+)))
11:16clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval85$fn>
11:16hyPiRionthere.
11:17TimMcdjwonk: ## is the lazybot eval prefix.
11:18TimMc*inline eval
11:20djwonk,"##trick"
11:20clojurebot"##trick"
11:20hyPiRionoh humm
11:21djwonkTimMc: thanks
11:21hyPiRion,(println "foo ##(+ 1 2)")
11:21lazybot⇒ 3
11:21clojurebotfoo ##(+ 1 2)\n
11:21djwonkhyPiRion: that's what I was going for
11:23gfrederickshyPiRion: is there a github repo for this stuff yet?
11:23hyPiRion,(println "&|(str 1 2 " " 3 4)|&")
11:23lazybot⇒ "12 34"
11:23clojurebot&|(str 1 2 3 4)|&\n
11:24hyPiRiongfredericks: Hmm, TimMc has done something
11:24TimMcgfredericks: Here's my start: https://github.com/timmc/swearjure
11:25TimMcI'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:26gfredericksTimMc: are you going to submit a conj talk for this?
11:26gfrederickswhat is this code supposed to do? translate clojure to swearjure?
11:26TimMcHaha, no -- I want my nice suit to remain tomato-free.
11:27TimMcYeah, a limited subset of Clojure -> swearjure.
11:27gfredericksit'd have to emit a string, right?
11:27TimMcUnfortunately, yes.
11:28TimMcI'm not looking forward to the pretty-printing code.
11:28hyPiRionTimMc: Pretty-printing swearjure?
11:28TimMcSure, all that nice indentation.
11:28hyPiRionYou're missing the point, sir.
11:28TimMchaha
11:28hyPiRionWell, actually, it would kind of be nice
11:29hyPiRionAt least for debugging purposes, I suppose
11:30hyPiRionI have issues with vararg mapv though.
11:30hyPiRionTimMc: No breakthroughs for apply?
11:30TimMcNo sir.
11:30hyPiRionThen my master invention still lays at rest. For now.
11:31TimMcI think higher-order functions may be feasible, though.
11:32TimMcI 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:32hyPiRionReturning fns? I'd like to get partial
11:32TimMcThe API would contain normal fns, but the compiler would treat references to them as compiler specials.
11:33TimMchyPiRion: 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:34hyPiRionoh sweet. If I get partial I can simulate apply.
11:35ChongLiRoboVM
11:35ChongLithis seems really interesting
11:35TimMchyPiRion: True!
11:36ChongLianyone looked at it?
11:37ChongLitranslate java bytecode to native ARM
11:38ChongLideploy clojure apps to iphones!
11:50vojdohoy, i'm looking for resources on how to use noir with lighttable
11:50vojdany tips?
11:53hyPiRionAsking ibdknox would probably be a nice start. Even though he's not maintainer of noir anymore, he should have some tips.
11:53hyPiRion(If he's here, that is)
11:54ciphergothSo 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:55ciphergothHow do I test whether a var is shadowed by a binding, ie whether set! will throw an exception?
11:56vojdhyPiRion: true, i'll do that :)
11:57hyPiRionvojd: But to really answer your question, I think noir has some github examples up
11:57hyPiRionI know ibdknox has an example regarding a Noir blog for instance
12:02augustlare there any existing middlewares for doing plain http auth?
12:03yogthosvojd: just be aware that noir is mostly deprecated nowadays
12:03vojdyogthos: aha! what do you recommend instead of noir?
12:03hyPiRionaugustl: "plain" is probably not the word I'd do, but friend is good
12:03hyPiRion/s/do/use
12:03gfrederickswhat's a top-level fn?
12:03yogthosvojd: compojure+ring is the current recommended approach, I setup a template for getting started here http://www.luminusweb.net/
12:03gfredericksoh whoops
12:04augustlhyPiRion: cool, thanks
12:04hyPiRionvojd: +1 on what yogthos said, plus hiccup as rendering engine
12:04vojdyogthos: many thanks!
12:04arcatanhow do i test if a value is an element of a sequence?
12:04gfredericksarcatan: (some #{val} sequence)
12:05yogthosvojd: all the useful stuff from noir has been moved to lib-noir and that's actively maintained
12:05vojdyes 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:05yogthosvojd: no problem :)
12:05vojdbut i had no idea it was deprecated. so thanks :)
12:05arcatangfredericks: right, thanks
12:05stain_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:06hyPiRionstain_: I've looked and looked, but it currently seems like Antlr is your best bet.
12:07stain_uhrgh
12:08stain_well, thanks anyway :)
12:08stain_antlr is not quite EBNF either, is it
12:08hyPiRionstain_: I'm really bothered by it :(
12:08hyPiRionI think it is, but not sure.
12:08stain_but a bit easier to searc/replace your way into
12:08stain_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:08hyPiRionIt's better than Bison at least
12:09stain_hee, yeah
12:10craigbroragel
12:10craigbroragel = lexer/parser engine
12:12stain_but it does not to EBNF..?
12:14craigbrono, you would have to translate
12:19michaelr525hello
12:25michaelr525hmm.. looks like enfocus doesn't have the parallel of jQuery's 'on'
12:25Anderkentis there something like 'boolean?' ?
12:27hyPiRionAnderkent: boolean?
12:27hyPiRion,(boolean 12)
12:27clojurebottrue
12:28Anderkenti want to check whether x is a boolean
12:28Anderkentnot cast to boolean
12:28hyPiRion,(boolean? 12)
12:28clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: boolean? in this context, compiling:(NO_SOURCE_PATH:0)>
12:28hyPiRionoh, hum
12:29hyPiRion,(instance? true Boolean)
12:29clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Class>
12:29S11001001,(doc true?)
12:29hyPiRion,(instance? Boolean true)
12:29clojurebot"([x]); Returns true if x is the value true, false otherwise."
12:29clojurebottrue
12:29S11001001,(doc false?)
12:29clojurebot"([x]); Returns true if x is the value false, false otherwise."
12:30hyPiRionYou could use (instance? Boolean x).
12:31S11001001,(supers (class (fn [^Boolean x] (not x))))
12:31clojurebot#{clojure.lang.IMeta java.lang.Object java.util.Comparator java.lang.Runnable clojure.lang.Fn ...}
12:31S11001001,(drop 5 (supers (class (fn [^Boolean x] (not x)))))
12:31clojurebot(java.io.Serializable clojure.lang.IFn clojure.lang.AFunction clojure.lang.IObj clojure.lang.AFn ...)
12:32S11001001,(supers (class (fn [^Integer x] (not x))))
12:32clojurebot#{clojure.lang.IMeta java.lang.Object java.util.Comparator java.lang.Runnable clojure.lang.Fn ...}
12:35tiledHow can I convert a string "hello" to hello ? I mean without the quotation marks
12:35craigbrosymbol
12:36craigbro(symbol "hello")
12:36craigbromaybe that's not what you meant tho 8^)
12:36tiledit is, works, thank you
12:49tiledI want a function to return a different random int on each call; is there an easy way to do that?
12:49jeremyheilertiled, does it always have to be different?
12:50jeremyheiler,(rand-int 100)
12:50clojurebot77
12:50tiledbut that always return the same value
12:50jeremyheiler,(rand-int 100)
12:50clojurebot75
12:51tiledhmm
12:51seangrovetiled: What do you mean it always returns the same value?
12:51tiledmy fault, it doesn't
12:52hyPiRionBeware of the ##(repeat (rand-int 10)) trap.
12:52lazybotjava.lang.OutOfMemoryError: Java heap space
12:52hyPiRion&(repeat 10 (rand-int 10))
12:52lazybot⇒ (1 1 1 1 1 1 1 1 1 1)
12:52hyPiRionDangit lazybot, you shouldn't run out of space for that.
12:54seangrovehyPiRion: Raynes doesn't feed lazybot bot much, it's anemic
12:54AimHere&(repeatedly 10 #(rand-int 10))
12:54lazybot⇒ (2 2 8 4 4 9 1 5 2 2)
12:54hyPiRionseangrove: Yeah. You hear that, Raynes? Go patch this thing.
12:55tiled(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:59jeremyheilerwhat is io/slurp-resource? maybe it's caching it somehow
13:00jeremyheilerif i replace it with just slurp in my repl, then it works as expected.
13:01tiledhttp://www.luminusweb.net/noir-api/noir.io.html
13:01seangroveCan't tell if it's firefox or cljs, but the ff web console blows up with errors using cljs
13:01meowcakeI'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:02technomancymeowcake: maybe mapcat instead of map?
13:03meowcakeholy crap
13:03meowcakeI feel like an idiot
13:03meowcakeTHANK YOU TECHNOMANCY
13:03technomancyhaha; np
13:03seangrovemeowcake: We all go through it, I had the same question awhile ago
13:04meowcakeOh 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:04babilenmeowcake: or (apply concat ...) - I would recommend to use mapcat in most places where it makes it the intend clearer.
13:09jkkramer_tiled: sounds like you might be generating the response at compile time?
13:11dnolenseangrove: is this a new issue for you?
13:11seangrovednolen: No, just an observation about firefox's webconsole + cljs code
13:11dnolenseangrove: so not an issue in general w/ FF?
13:12seangroveDoesn't affect the running of the program, just a ton of warnings from FF
13:12seangroveNah, just an annoyance
13:12dnolenseangrove: weird
13:12seangroveWhich I've found is pretty standard for ff so far
13:12tiledoh you're right it works now thank you, I always make such stupid mistakes
13:12FrozenlockIf 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:15Frozenlock(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:24jkkramer_tiled: sgf files -- making a go app?
13:26tiledjkkramer_ nothing complicated, just for replaying a random pro game
13:26jkkramer_tiled: cool :)
13:48S11001001Frozenlock: use pop instead of last, unless they changed last (I really doubt it)
13:48S11001001Frozenlock: also assuming your vecs are vecs and not arbitrary seqs
13:49Frozenlock,(pop [:a 1])
13:49clojurebot[:a]
13:50S11001001what
13:50S11001001oh, right, the thing that goes with pop
13:50S11001001,(doc pop)
13:50clojurebot"([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:50dnolenpeek
13:50ChongLihmmm
13:50dnolen,(peek [:a 1])
13:50clojurebot1
13:50S11001001yeah what dnolen said
13:50seangrove,(doc peek)
13:50clojurebot"([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:50ChongLiGPU Process CPU usage goes from 20% to 100% when going from 55FPS to 60FPS
13:50dnolen,((jux peek pop) [1 2 3])
13:50ChongLidoes that seem right?
13:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: jux in this context, compiling:(NO_SOURCE_PATH:0)>
13:51dnolen,((juxt peek pop) [1 2 3])
13:51clojurebot[3 [1 2]]
13:51Frozenlock"much more efficient than last" Sold :P
13:51seangroveConfused why it's first for lists and last for vectors
13:52S11001001seangrove: I think because it's reversing the order of conjing
13:52Frozenlock,(let [r (sort-by peek (partition 2 (apply interleave [[:A :B :C :D] [4 3 2 1]])))] [(map first r)(map last r)])
13:52clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentStack>
13:52S11001001seangrove: which is push to end for vecs, to start for lists/lazyseqs/etc
13:52seangroveAh, I assumed it was a unified concept at a higher abstract level
13:52S11001001If 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:53AimHereIt's likely to just be the most efficient place to put or take the new element
13:53seangroveNah, the "contributing to cljs is deliberately difficult" thread was enough to sap my will to real the ml for a bit
13:54craigbrohah
13:55S11001001,(pop {:a 1 :b 2})
13:55clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IPersistentStack>
13:55S11001001eh
13:56dnolenseangrove: 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:56FrozenlockWould `first' be faster than `last' for an arbitrary seqs?
13:57seangrovednolen: Yeah, shouldn't have thought about the interface it was operating on rather than the underlying structure
13:57FrozenlockFor a list yes, but any seqs?
14:00S11001001Frozenlock: yes first is faster than last for anything built-in
14:00FrozenlockNice, I'll just swap the order of my vectors then.
14:06FrozenlockNice... my car won't start. I hate cold weather.
14:16ejacksonperhaps its lock is frozen ?
14:23warzhmm, how would i build leiningen from the git repo?
14:24Frozenlockejackson: Ouch
14:24bbloomwarz: i think you just use lein normally, but throw in a trampoline
14:24bbloomwarz: lein trampoline compile
14:25bbloombut there is a #leiningen where it might be better to ask
14:26FrozenlockCold... cars stop working, but the Internet carries on. I'm ok with that.
14:27jsabeaudryAm I correct to think that there are no syntax changes in 1.5? It's all bugfix and enhancements behind the covers?
14:27technomancywarz: see "bootstrapping" in the CONTRIBUTING file
14:39amalloywell, i was about to say there are never syntax changes in a new release of a lisp
14:40amalloybut 1.3 introduced record literals, 1.4 introduced tagged literals...
14:41amalloyjsabeaudry: 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:41Bronsaamalloy: 1.5 fixed reading +1/3
14:42amalloyreading that was a goal?
14:42Bronsa,-1/3
14:42clojurebot-1/3
14:42Bronsa,+1/3
14:42clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string: "+1">
14:49cemerickzby: ping
14:50cemerickzby: 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:51amalloycemerick: 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:52amalloy(wrap-keyword-params (wrap-nested-params (wrap-params handler))) is more clear
14:52gfredericksso comp would work well
14:53cemerickamalloy: the left-to-right ordering is meant for -> (which is what zby is using, anyway)
14:54cemerick(wrap-keyword-params (wrap-nested-params (wrap-params handler))) is wrong ;-)
14:58gfredericksis there any perf penalty for using an Integer instead of a Long?
14:59Raynes(type (+ (int 3) (int 3)))
14:59Raynes&(type (+ (int 3) (int 3)))
14:59lazybot⇒ java.lang.Long
15:02SegFaultAX&(type (+' 3 3))
15:03lazybot⇒ java.lang.Long
15:03gfredericks&(type (+' 1 (Long/MAX_VALUE)))
15:03lazybot⇒ clojure.lang.BigInt
15:03gfredericks&(type (+ 1 (Long/MAX_VALUE)))
15:03lazybotjava.lang.ArithmeticException: integer overflow
15:0516WAABC47cemerick - I am at home now :) I'll check the fix in a minute :)
15:12anarscan 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:17muhooumm, &&(BigInteger. 1)
15:17muhooumm, &(BigInteger. 1)
15:17muhoo&(BigInteger. 1)
15:17lazybotjava.lang.IllegalArgumentException: No matching ctor found for class java.math.BigInteger
15:17muhooyeah, that. why?
15:17hyPiRionmuhoo: ##(bigint 1)
15:17lazybot⇒ 1N
15:18muhoohthanks
15:18muhoo&(type (bigint 1))
15:18lazybot⇒ clojure.lang.BigInt
15:19muhoono
15:19Bronsa,(type (biginteger 1))
15:19clojurebotjava.math.BigInteger
15:19muhoobetter, thanks
15:19patrkrishi 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:20seangrove,(doc get)
15:20clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
15:20hyPiRionpatrkris: It should work out of the box then.
15:20amalloythen you're using it
15:20muhoowhy there is a bigint vs biginteger in the first place, is a question i won't wory about atm.
15:20patrkrisbut *clojure-version* says 1.4.0
15:20patrkrishyPiRion: ^
15:20hyPiRionpatrkris: refheap the project map
15:20hyPiRionor are you using `lein repl` outside of the project?
15:21patrkrishyPiRion: ok, I must have done something wrong before... now it works, sorry :)
15:22patrkrisby 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:22hyPiRionpatrkris: It will use the highest one
15:23patrkriscool, thanks
15:43Slotkenovhi there
15:43AtKaaZL.O.
15:49SlotkenovIs this the right place for clojure chat?
15:50ChongLiSlotkenov: yep
15:50hyPiRion,(println true)
15:50clojurebottrue\n
15:51Slotkenovcool, i'm new her, new to irc and new to clojure
15:51ChongLithat's great!
15:51ChongLiwe always want new people trying clojure
15:52S11001001,(if (Boolean. false) true false)
15:52clojurebottrue
15:52S11001001Delete all files?
15:53Slotkenovi've been reading clojure for almost a year now, so I know quite a lot about it, but never got my hands dirty
15:53ChongLinow is as good a time as any!
15:54Slotkenovtrying to change that now yeah
15:54Slotkenovrunning into a problem I havn't before though
15:54augustlweavejester isn't online, has the world ended?
15:55Slotkenovwhen 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:56ChongLihmm
15:56Slotkenovlooks like a problem in clojure itself, but thats probably not it...
15:56Slotkenovor is it?
15:56ChongLihave you tried blowing away your ~/.m2
15:56RaynesChances are those words have no meaning to him at this point.
15:57ChongLilein will re-download everything in there
15:57Slotkenovyes, tried that already
15:57RaynesOh, neat.
15:57RaynesYou're way on top of things Slotkenov.
15:57technomancySlotkenov: what's the context here? in a specific project or everywhere?
15:58Slotkenovwell, this is in a project, but that has just been created with lein new
15:58Slotkenovcan try it outside a project though
15:58zeussphinxSlotkenov: try outside a project and see if you get same error
15:58technomancyalso: how did you install leiningen?
15:59Slotkenovok, outside it works fine
15:59ChongLiand do you have any version of clojure installed by your OS package manager?
15:59Slotkenovso has to do something with the project
15:59SlotkenovI installed it a while back, with the sef installing batch i believe
15:59hyPiRionI feel like everyone's storming Slotkenov, trying to help him.
15:59ChongLihahaha
16:00Slotkenov:) a warm welcome
16:00hyPiRionlooks like people are fighting for the right to help him
16:00AtKaaZ,'true
16:01clojurebottrue
16:01ChongLiI'll yield to technomancy, seeing as he's the author of leiningen
16:01technomancyChongLi: I suspected OS-level package manager issues too, heh
16:01SlotkenovI removed the project, just to be sure. Now when I do lein new clojure, cd clojure, lein repl
16:01Slotkenovget the same exception again
16:02AtKaaZwhat was the name of the previous project?
16:02Slotkenovthe same; clojure
16:02hyPiRionSlotkenov: Oh right. Try to name it something else than clojure, and check.
16:02technomancyoh dear... we should probably blacklist that =\
16:02AtKaaZawesome
16:02Slotkenovoh.. would that be conflicting
16:02hyPiRionSlotkenov: Perhaps? :p
16:03technomancyhate to break it to you, but that name is taken =)
16:03AtKaaZtechnomancy: maybe it should check if projectname is the same as any included dependencies?
16:04Slotkenovyes, that was the problem
16:04Slotkenovthanks a bunch
16:04ChongLialso
16:04ChongLiwhat version are you running?
16:04ChongLileiningen 2 just came out recently
16:04ChongLiand it's very nifty
16:04technomancyAtKaaZ: the problem is looking at :dependencies doesn't tell you anything about the namespaces inside those jars
16:04Slotkenovis it? already did an upgrade
16:05technomancybut ... hm. you could inspect the search indices and see if there's a conflict there.
16:05ChongLilein --version
16:05technomancywouldn't have caught this particular one though since it's org.clojure
16:14AtKaaZ,(map println '(1))
16:14clojurebot(1\nnil)
16:14gfredericksis (.println System/err ...) the normal way to print to stderr? (binding [*out* *err*] ...) seems silly
16:15gfredericks(silly in the case of a single call at least)
16:16AtKaaZ(makes sense to me)
16:20Raynesgfredericks: I've always just used binding.
16:24hyPiRion,(binding [*out* *err*] (println :foo))
16:24clojurebot:foo\nnil
16:24hyPiRionwhat's up with clojurebot's newlines nowadays?
16:24AtKaaZflood protection maybe
16:25hyPiRionmaybe
16:28hiredmanhow does partial-map work?
16:28hiredmanhttps://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L2818
16:28hiredmanPMap has no fields
16:29rodnaphin core.logic how do i express not equal? something like (=/= x y) ?
16:29hiredman (map->PMap m) is called with an arg
16:29hiredman!= is disequality
16:29rodnaphhiredman: thanks a lot! do you know of any api docs for core.logic, my google fu fails me...
16:35weavejesterHi folks
16:35weavejesterIs Programming Clojure still one of the best beginning Clojure books?
16:36warzthe 2nd edition, with the white bird on the front?
16:37biff_tannenweavejester this page has some good recommendations https://groups.google.com/d/topic/clojure/lKLQ-bgetTU/discussion
16:37weavejesterYep
16:37warzi 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:37ChongLiI like clojure programming
16:37ChongLiClojure Programming
16:37ChongLirather
16:38warzi read the whole thing once through, and clojure still looks like some alien language to me. haha.
16:38ChongLithe o'reilly one
16:38ChongLiwarz: are you a lisp programmer?
16:38warzi think i need something like a clojure by example book or something
16:38warzno this is my first lisp
16:38ChongLiyou might do well with SICP
16:39ChongLiit starts right from the ground up with no knowledge of programming at all required
16:39ChongLiit's pretty amazing how quikly you'll learn lisp from it
16:42cemerickwarz: Perhaps try the first chapter of http://clojurebook.com (available free there)
16:44rodnaphin core.logic - if i know (likes x y) - how would i express a goal that (not (likes x y)) - ie. hates
16:46hiredmanthe non-recursive nature of featurec is a drag
16:46andres-vwarz: 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:47dnolenhiredman: partial-map is an implementation detail of featurec
16:47weavejesterbiff_tannen: Thanks for the link
16:48rodnaphin 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:49dnolenrodnaph: there's no support for negation at this time. negation is pretty tricky.
16:49AtKaaZdoes not likes mean hates? or is just somewhere in between?
16:49rodnaphdnolen: bummer... ok thanks for the info.
16:50dnolenrodnaph: if it's any consolation - negation is still a tricky/difficult problem for Prolog-like languages to this day.
16:50hiredmandnolen: right, I figured that out
16:51rodnaphdnolen: a little consolation, though it does make my problem of working out teams of people who get on with eachother a little trickier ;)
16:52hiredmandnolen: I want featurec to be recursive, the values acan be maps I want to partially unify with them
16:53dnolenhiredman: it's unsound to allow partial maps to leak into the system.
16:54hiredmansure, but is there someway to make featurec recursive like that? so submaps can be partially specificed?
16:54zby_homecemerick: I tried all kinds of ordering :
16:54zby_homehttps://gist.github.com/4628280
16:54dnolenhiredman: oh, right - hmm that's useful and not hard to implement
16:55dnolenhiredman: feel free to open an enhancement ticket and I will look into it.
16:55zby_homeah - sorry
16:55zby_homenow it is OK
16:55zby_homeI am just too tired
16:57hiredmanhttp://dev.clojure.org/jira/browse/LOGIC-108
16:57dnolenhiredman: sweet, thanks
16:57hiredmanI'll update it there if I figure out how to do it, which seems unlikely
16:59dnolenhiredman: heh, it's ok, I'll probably take a look tomorrow or Saturday.
16:59dnolenhiredman: you can do it now w/ multiple featurec calls of course, but that's a bit tedious
17:04hiredmandnolen: yeah, I noticed how tedious the multiple featurec calls is :)
17:04pandeirois lein deploy working differently now for clojars?
17:07technomancypandeiro: different from what?
17:07pandeirotechnomancy: my bad, forgot the command
17:07pandeirout works fine
17:09rodnaphcore.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:21dnolenrodnaph: I think you need a base case for when you hit the end of the list.
17:21dnolenrodnaph: you should look at membero
17:21amalloydnolen: he also needs (meno xs), not (meno y)
17:22rodnaphamalloy: won't that just infinitely recurse?
17:22amalloyoh, i misread it. sorry
17:22rodnaphdnolen: i had that, but it meant an empty list would be a success... but i'll keep working on it.
17:25dnolenrodnaph: 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:26rodnaphno problem, thanks for answering anyway! my questions probably don't quite make sense yet, heh.
18:41nbessiHello
18:44nbessiSorry to bother you but I'm little stuck with probably a basic problem. So if somebody has five minutes to help a noob...
18:45nbessiI'm looking to the best way to have a custom get behavior on hashmap
18:45nbessilike __getitem__ in Python
18:46brehautnbessi: back up a step. why are you wanting that?
18:47nbessiI want to define a record in a abstaction library to interface an business object framework
18:48brehauti seems like you might be trying to model your system like an OO system is all.
18:48nbessiI want to use be able to do lazy loading of relation
18:48nDuffnbessi: ...so, the direct answer is probably a suggestion to look an the implementation of bean in the standard library.
18:48weavejesternbessi: So kinda like an ORM?
18:49nDuffnbessi: ...the less-direct answer is that what you're doing smells likely to have a more idiomatic approach available.
18:49S11001001except to use something other than proxy
18:49S11001001like a function
18:49weavejesterIf you have lazy loading of data, the common Clojure solution is to use a ref
18:49weavejesterOr something deref-able, rather
18:50weavejesterOr a lazy seq, if there is more than one thing you want to retrieve.
18:50nDuffnbessi: anyhow, bean is at https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_proxy.clj#L372
18:50nbessiI'm new to clojure and I have writen this https://github.com/nbessi/carcajou
18:50nDuffnbessi: ...and shows you a custom implementation of APersistentMap
18:50augustlthis 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:50augustlabsolutely nothing relevant in it :)
18:51weavejesteraugustl: Try adding an explicit dependency for clj-stacktrace 0.2.5
18:51augustlweavejester: will do
18:51weavejesterOr use Ring 1.1.8, which I believe has that dependency
18:51weavejesteraugustl: It looks like you're running across a bug in clj-stacktrace 0.2.4
18:51augustlweavejester: I'm using [lein-ring "0.8.0"]
18:52nbessinDuff: Thanks
18:52weavejesteraugustl: Try 0.8.2 :)
18:52augustlseems 0.8.2 is the latest
18:52augustlweavejester: ^^
18:52augustlweavejester: btw, regarding the CSRF/XHR issue, I haven't been able to find any good sources there.
18:52weavejesteraugustl: I'll look it over tomorrow
18:52xeqicsrf/xhr issue?
18:53augustlxeqi: it's difficult to do POSTs with XHR where the body only is JSON when using weavejester's ring-anti-forgery
18:53augustlxeqi: https://github.com/weavejester/ring-anti-forgery/pull/11
18:53augustlit's just an enhancement for convenience, no security flaws :)
18:54xeqiah
18:54augustlcurrently 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:54augustlweavejester: awesome, got a proper stack trace now :)
18:54augustl"java.security.InvalidKeyException: Invalid AES key length: 8 bytes"
18:55augustlwhere's the type of keys you can give the cookie store documented?
18:55weavejesteraugustl: Oh, they need to be AES keys
18:55weavejesterWhich means 8, 12 or 16 bytes, I believe
18:56augustlI see
18:56weavejesterBest option is to randomly generate them with crypto-random or something.
18:56augustlso a string with 16 single byte characters should do? :)
18:57weavejesteraugustl: I think it needs to be a byte array, but yes...
18:57augustlah
18:57weavejesterAlthough keys should be randomly generated when possible.
18:57augustlpwgen -s to the rescue
18:58augustlnot sure what its entropy source is though, will use a proper generator for the production key :)
18:58augustlthis is just for dev
18:59nbessiI think your right my approachy is fishy I should probably use a multi args function that takes keyword suite
19:01augustlweavejester: 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:02nbessiIt is sometime hard to switch paradigm, thanks for the time, regards
19:20francisDoes 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:21TimMcfrancis: You want to find all defn statements in a file and makes them defn- statements?
19:22francisTimMc: Yes, but with the condition that they are only referenced within that file. (by grepping the project most likely)
19:23francisObviously this wouldn't catch all cases, but if you had a codebase where noone used private fns it could really help
19:24technomancyfrancis: 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:24technomancyhttps://github.com/Seajure/melange
19:27TimMcbrb, adding a project that depends on everything and has malicious code in its tests
19:30francistechnomancy: not really what I was asking, but very cool. If I have some time this weekend I'll see about getting it working.
19:31technomancyfrancis: you might also find slamhound relevant; it has logic for making changes to a namespace and seeing if the project will still compile
19:31technomancythough that's rather brute-force; you could probably come up with something smarter =)
19:32francistechnomancy: 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:33technomancyfrancis: yeah, I think some manual annotation is required
19:33technomancyI wish there were a fully-automated solution, but I'm just not seeing it
19:33technomancyfrancis: do you work with alex baranosky?
19:34francistechnomancy: yes
19:34technomancycool
19:43wei_what does this error mean? Can't change/establish root binding of: *cljs-ns* with set
19:43wei_I think it's nrepl-related. here's the context: https://gist.github.com/4630437
19:43wei_I'm trying to start a repl programmatically and upgrade it to a browser-repl
20:00devnAnyone have an nrepl config with syntax highlighting, proper indentation, arg hints, and paredit?
20:01technomancydevn: arg hints are just eldoc
20:02technomancyoh, but you have to turn it on after nrepl connects. hang on.
20:02technomancy(add-hook 'nrepl-connected-hook (defun add-clojure-mode-eldoc-hook () (add-hook 'clojure-mode-hook 'turn-on-eldoc-mode)))
20:02technomancynot sure what you're looking for; the rest of it should just work
20:03tomojI wondered why I no longer had arg hints
20:03tomojI was just M-.'ing all the time
20:07ninjuddtechnomancy: i just tried calling 'turn-on-eldoc-mode manually in a buffer that has nrepl running, and no luck
20:11technomancyhm; not sure then
20:11aphyrWhat's the best way to test code which invokes a function I have no control over?
20:11technomancywait, in the nrepl buffer or in clojure-mode?
20:11aphyre.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:12ninjuddtechnomancy: in the clojure file
20:12cbp`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:14technomancyaphyr: with-redefs?
20:15aphyrWhat the WHAT?
20:16aphyrtechnomancy: wow, yeah, that's exactly what I needed. Thanks.
20:16aphyrYeah, wow. Still discovering clojure.core I guess.
20:17technomancyit's not used much (at all, hopefully) outside tests
20:35devntechnomancy: one thing i seem to consistently run into with nrepl is that im not sure how the heck to restart it
20:35devnlike 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:35devnive tried nrepl-restart and stuff to no avail
20:37nDuffdevn: are you require'ing your namespaces?
21:21brainproxyrunning into an interesting issue with ring
21:22brainproxyso apparently Microsoft's xhr is super picky about whether there is a Last Modified header in a response
21:22brainproxyif not, it just assumes it can use a cached response
21:23brainproxyI've not seen any other clients behave in this way -- various browsers, programmatic things, curl, wget
21:23brainproxybut essentially, i can make a request to my ring-based web server, and it will go through the first time
21:24brainproxybut subsequent requests are never getting through, as the WinJS.xhr assumes it can reuse the last response
21:24akhudekbrainproxy: eww. I guess a custom middleware that always sets the last modified to "now" would work. Ugly though.
21:25brainproxyakhudek: yeah, pretty ugly
21:25amalloythat's not even a correct treatment of last-modified
21:25tomojyou mean because the first response doesn't have a Last-Modified?
21:25brainproxytomoj: from what I gather, yes
21:25tomojif it does, it fixes it?
21:26brainproxywell i'm not sure "fixes" it is the right way to put it
21:28tomojI mean, if the first response has a Last-Modified, the second goes through?
21:28tomojsecond request
21:28brainproxyi haven't modified ring yet
21:28brainproxymy app i mean
21:28brainproxybut after supper I will try a middleware approach per akhudek
21:28tomojoh, I vaguely remember some stuff about XHR caches and adding nonce query params to urls
21:29tomoj(doubtful that Last-Modified will help you)
21:29brainproxyyeah, but that's ... awful
21:29brainproxysetting last modified in the request definitely did not help
21:29brainproxyi mean if modified since
22:43milos_cohagenstupid 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:44TimMcmilos_cohagen: println
22:45milos_cohagendoh thx was using prn
22:45milos_cohagentyvm
23:01fbru02hey guys ... I was a user of slime and now nrepl and having some issues
23:08nDufffbru02: You're more likely to get a response if you ask a question. :)
23:09fbru02nDuff: fair enough , for example M-x eval buffer is not working anymore ... anybody seen that ?
23:10nDufffbru02: Is that what's bound to C-c C-k? Because that still works fine for me.
23:11fbru02nDuff: nice... didn't know the keys , wonder why doing it from the minibuffer doesn't work
23:12nDuffAhh -- C-c C-k is nrepl-load-current-buffer
23:12nDuffso it's not the same call as eval-buffer
23:17fbru02nDuff: 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:17fbru02in slime-swank I mean
23:17nDuff*nod*.
23:30tomojI can't use eval-buffer in slime-swank
23:30tomojthere is a slime-eval-buffer though
23:38fbru02tomoj: yes, maybe I was think wrong
23:51nDuffHrm..
23:58rationalrevoltWith 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:59nDuffrationalrevolt: passing the var object means it's involved in the lookup, and can be substituted/replaced.