#clojure log - Mar 14 2012

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

0:00 spoon16: playing around with 4clojure this evening

0:01 why does recur expect two args here?

0:01 ,((fn [[f & r] x] (if r (recur r) f)) [1 2 3 4 5])

0:01 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 2 args, got: 1, compiling:(NO_SOURCE_PATH:0)>

0:01 dnolen: spoon16: your fn takes 2 args

0:01 cgag: looks like the function takes a vector and a scalar

0:01 spoon16: doesn't it take just one arg that gets destructured?

0:02 _ato: arg1: [f & r]

0:02 arg2: x

0:02 spoon16: does the destructuring not apply when using recur?

0:02 ohh

0:02 x shouldn't be there, was using it like let

0:02 thanks

0:10 justicefries: so, more of an inexperienced LISP question here than anything. is it kosher to have a SLIME server running on a production server?

0:10 or in production code, rather.

0:10 I have a feeling it would tempt me to be very dirty.

0:13 _ato: justicefries: myself I would only do that as a last resort if I couldn't debug the issue in a development environment

0:14 justicefries: _ato, that makes sense.

3:38 gtuckerkellogg: i have a hashmap, and want to disj every entry with a particular value. Any suggestions?

3:46 raek: gtuckerkellogg: perhaps into and map-cat?

3:46 stirfoo: (into {} (map #(if (foo? (% 1)) nil %) m))

3:46 raek: or just into map and filter

3:46 stirfoo: what he said

3:47 raek: ,(into {} (filter (fn [[k v]] (even? v)) {:a 1, :b 2}))

3:48 clojurebot: {:b 2}

3:48 gtuckerkellogg: ahh

3:50 amalloy: ,(into {} (filter (comp even? val) {:a 1 :b 2})) ;; perhaps slightly classier

3:50 clojurebot: {:b 2}

3:54 stirfoo: mine is shorter! (one of the few times you'll hear a man say that)

3:55 gtuckerkellogg: haha

4:00 raek: huh, I had no idea that conj accepts nil entries! ;-)

4:24 tomoj: nil entries?

4:25 raek: &(conj {} [:a 1] nil [:b 2] nil)

4:25 lazybot: ⇒ {:b 2, :a 1}

4:26 raek: I wasn't aware that (conj some-map nil) = some-map

4:49 amalloy: raek: please don't depend on that though, it only works because of a disgusting coincidence

4:50 specifically, because conj is willing to take a seq of map-entries, or a vector, or a map. the last clause (map) is the catch-all, so nil is treated as an empty map

5:56 Licenser: morning

6:05 Lajla: Licenser, what is your opinion on the parting push?

6:12 Licenser: parting push?

6:16 Lajla: Licenser, well, it's like a response to gasless FE pionered by parting

6:16 where you actually go one gate FE into another nexus before you make anythingh else

6:16 And then you mass sentries while you power to 8gate and just push with something that looks like a 6gate, hits slightly later but is not all in due to the third

6:17 And the 8 gates can also be used defensively, to protect what otherwise could be considered a risky third

6:17 Licenser: in that case I am al for it.

6:17 Lajla: Licenser, hmm, motivate.

6:17 Licenser: go Lajla go go go!

6:19 Fossi: yay for more sc2 talk in here :>

6:19 Lajla: Fossi, don't tell me you play that godawful game?

6:20 Anyway, I've been experimenting with a variation where I get 5 gates, 2 forges and a robo

6:20 And use them purely defensively or with warp prism tomfoolry

6:20 Fossi: i'm too busy these days :/

6:20 gotta play swtor ;)

6:20 Lajla: Fossi, well, as it looks, gasless FE might become obsolete since Parting discovered that getting a third that quickly is actually completely safe against it.

6:21 gtrak``: i still haven't beaten revenge of the titans :-(

6:39 anyone have a copy of the 'are we there yet' slides? link is down

6:39 ­HickeyJVMSummit2­009.­pdf

7:10 mindbender1:

7:17 _ato: gtrak``: Internet Archive's got it: http://wayback.archive.org/web/*/wiki.jvmlangsummit.com/images/a/ab/HickeyJVMSummit2009.pdf

7:17 gtrak``: oh thanks

9:42 dan_b: ooh, I like this Hickey HDD talk already

9:44 bsteuber: dan_b: HDD?

9:44 dan_b: hammock driven developement

9:44 bradwright: Hammock Driven Development

9:44 dan_b: I know it's an old talk, but I'm a new user

9:45 bsteuber: ah that one ^^

9:45 dreen: what talk is this?

9:45 dan_b: http://blip.tv/clojure/hammock-driven-development-4475586

9:45 dreen: kieferific

9:48 maacl: Does anyone know of an example of ClojureScript REPL setup that supports emacs like edit, history etc?

9:51 bsteuber: maacl: just start the repl command as an inferior lisp

9:52 uvtc: What does it mean to have "used <something> in anger"? (as in in the lein tut where it mentions using Ant or Maven in anger)

9:53 RickInGA: uvtc: to actually have used it to solve a real problem instead of just exploring it, trying examples

9:53 bsteuber: maacl: https://gist.github.com/2036624 this is how I do it

9:53 RickInGA: though in the lein tutorial, it may be punning, getting angry at ant or maven :)

9:54 maacl: bsteuber: Thanks a lot - is it OK if I skip the paredit part :-)

9:54 uvtc: RickInGA, Hm. Thanks.

9:55 bsteuber: sure ^^

9:55 maacl: probably you write lein instead of lein1, just note that it doesn't seem to work with lein2yet

9:56 RickInGA: bsteuber how would I invoke that? M-x clojurescript-repl ?

9:56 bsteuber: maacl: also you meed to be in the project directory when you start the command

9:56 maacl: bsteuber: Got that, thanks. Do you have any experience with how this interacts cljs-template?

9:56 bsteuber: RickInGA: I use (global-set-key [f6] 'clojurescript-repl)

9:57 maacl: no haven't tried cljs-template yet

9:57 RickInGA: bsteuber I am fairly new to emacs, what does global-set-key do, and how do I set it up?

9:57 uvtc: RickInGA, re. anger, perhaps using it work where you need to solve a problem with it and you're stuck with it.

9:57 bsteuber: but I do use lein2 with the rest of the project

9:58 maacl: bsteuber: Ok, I will give that a shot tonight, think it should work fine.

9:58 bsteuber: RickInGA: you just put both both commands in your .emacs, then F6 will always trigger the cljs repl

9:59 RickInGA: bsteuber I will try that, thanks a bunch!

9:59 bsteuber: having said that, I don't really use the cljs repl much ^^

9:59 I always hate to write full qualified names everywhere

10:00 so I usually just put my experiments in the main fn and hit refresh on the browser for exploring

10:00 but maybe I am doing something wrong ^^

10:03 RickInGA: bsteuber thanks a ton for the help. I think I still have a configuration issue though.

10:03 the repl launches, but when I try (+ 1 2) it hangs

10:05 bsteuber: RickInGA: even when you refresh the browser window?

10:06 RickInGA: did you follow https://github.com/emezeske/lein-cljsbuild/blob/0.1.2/doc/REPL.md ?

10:06 RickInGA: bsteuber: I don't know where to point the browser. If i go to localhost:9000 I get a message that says no xpc param provided to child iframe

10:06 bsteuber: no you go to the page where the js is loaded

10:06 which might be a noir view or just static html

10:08 RickInGA: bsteuber: THANKS

10:08 bsteuber: it works?

10:09 RickInGA: bsteuber I spent 8 hours on this yesterday! and sure it all makes sense in hindisght! thanks a bunch.

10:09 yep, working!

10:10 bsteuber: great

10:10 RickInGA: bsteuber you going to clojurewest?

10:10 bsteuber: I only spend some time using lein2 ^^

10:11 no it's a bit far from Germany ^^

10:11 RickInGA: I am using 1.7 with the new cljs templates

10:11 bsteuber: but maybe EuroClojure :)

10:12 RickInGA: bsteuber Wann ich zum Deutchland gehen, ich wolle Sie ein beir kaufen

10:12 and forgive me, my german is terrible!

10:14 * gfredericks translates back into english: "Want if some germany get a hen, it would see a bear coffin."

10:14 RickInGA: hehe

10:14 mdeboard: rofl

10:14 gfredericks: RickInGA: it's terrible english too

10:14 RickInGA: hey, I live in Georgia, I am not expected to speak English well!

10:14 bsteuber: lol

10:15 don't worry, I'll have to buy a thousand beers when I ever go to a conj :)

10:15 mefesto: how do you pass the ring request to your view function using compojure routes? (GET "/my/url" {:as req} (my-view req)) ?

10:36 * gfredericks would like a (comp dorun map) in core

10:44 TimMc: gfredericks: You mean doseq?

10:45 or (comp doall map)

10:45 gfredericks: TimMc: no

10:45 similar functionality

10:45 doseq:myfun::for:map

10:45 TimMc: ...

10:45 bsteuber: gfredericks: yes I called that domap in some code

10:45 like CL's mapc

10:46 gfredericks: TimMc: the purpose is a syntactically succincter form of (doseq [x xs] (foo x))

10:46 TimMc: I see.

10:46 gfredericks: so I can say (domap foo xs)

10:46 point-free

10:46 it'd use dorun internally instead of doall, presuming you only want side effects

10:48 * gfredericks just stumbled across a (count (doall ...))

10:50 pjstadig: gfredericks: there's mapv in 1.4

10:50 gfredericks: ,*clojure-version*

10:50 clojurebot: {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}

10:50 gfredericks: ,(doc mapv)

10:50 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

10:51 gfredericks: hm. how is this different from map?

10:51 TimMc: (into [] (map ...))

10:52 gfredericks: oh

10:52 TimMc: AFAICS

10:52 gfredericks: ah so it forces it

10:53 that would be good for my former colleague who has sprinkled (doall (map ...)) all over his code

10:53 pjstadig: right, it's non-lazy

10:53 ,(doc filterv)

10:53 clojurebot: "([pred coll]); Returns a vector of the items in coll for which (pred item) returns true. pred must be free of side-effects."

10:53 pjstadig: ^ non-lazy filter

10:54 gfredericks: the "free of side-effects" requirement is curious there

10:54 I think I've had that discussion before though

10:54 it just seems starker in a non-lazy function

10:58 TimMc: Is filter eager by one?

11:10 gfredericks: how do I search for the word under the point?

11:11 drewr: C-s C-w C-s C-s C-s ...

11:12 gfredericks: drewr: thx

11:13 jsabeaudry: thanks, didn't know that one, nothing like a bit of emacs-fu to start the day

11:14 clgv: ,(source mapv)

11:14 clojurebot: Source not found

11:14 clgv: &*clojure-version*

11:14 lazybot: ⇒ {:major 1, :minor 3, :incremental 0, :qualifier nil}

11:28 TimMc: clgv: Neither bot does source, I think.

11:28 clgv: $source mapv

11:28 lazybot: Source not found.

11:28 octagon: haha i'm the 420th person in the room!

11:28 clgv: $source map

11:28 lazybot: map is http://is.gd/rSYDfR

11:28 octagon: and auspitious number

11:28 s/and/an/

11:30 lnostdal: the heck is up with recent aleph .. it forwards and stores or even caches, internally, thread bindings .. in-between requests or something

11:35 ieure: Can't let qualified name: jimmies.s3/foo

11:35 :(

11:35 e.g. (defmacro with-foo [& body] `(let [foo "foo"] ~@body))

11:35 I _want_ to capture that symbol.

11:36 gfredericks: ieure: use ~'foo

11:36 and feel shameful about it

11:36 ieure: Man what a pain.

11:36 There is no shame in symbol capture.

11:36 When you want it.

11:37 gfredericks: ieure: how would you prefer it to work though?

11:37 backquote gotta have some way to know what to expand and what not to

11:39 ieure: gfredericks, I don't recall this being a problem with < 1.3.0.

11:40 gfredericks: I think it was the same then. And I don't know why you'd call it a "problem"

11:40 ieure: gfredericks, So… The way is used to, I suppose. Where I can capture any damn symbol I please.

11:40 gfredericks: but how does backquote know which one's you're capturing?

11:40 ieure: Why does it care?

11:40 CL doesn't.

11:40 clgv: ieure: you get that same error in 1.2(.1)

11:40 ieure: You want to avoid capture, use a gensym.

11:40 gfredericks: does CL qualify symbols for you?

11:49 joly: ,(println "Quick Test")

11:50 clojurebot: Quick Test

11:50 Bronsa: very responsive clojurebot

11:51 gfredericks: I didn't see anyone else jumping up to type "Quick Test"

11:51 bots do the jobs nobody else wants to do

11:54 fliebel: Quick Test

11:54 Recently on pepijndevos.nl: http://pepijndevos.nl/2012/03/13/thoughts-about-generating-stripboard-layouts.html

11:55 * fliebel hopes he'll get a snack as well if he says irrelevant stuff

11:56 mdeboard: What's the command to exit the repl again please

11:56 I have forgotted

11:57 metajack: C-d :)

11:57 mdeboard: Well fine

11:57 :P

11:57 metajack: (System/exit 0) :)

12:01 TimMc: fliebel: botsnack

12:01 fliebel: homnomnom, thanks, that was delicious

12:03 I feel like I should throw some sort of sandbox exception now...

12:03 &(system/exit 0)

12:03 lazybot: java.lang.RuntimeException: No such namespace: system

12:03 fliebel: &(System/exit 0)

12:03 lazybot: java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)

12:08 TimMc: fliebel: I think the most analogous thing would be if I gave you an unsafe but intriguing IRC command, such as /disco

12:08 mheld: hey y'all

12:08 TimMc: mheld: hey there

12:09 fliebel: mheld: botsnack :)

12:09 mheld: TimMc!

12:09 TimMc: mheld: What are you doing in this window, you're supposed to be over in screen window 2.

12:09 Totally wrong IRC network and everything.

12:09 mheld: haha

12:10 I happen to be in 5 rooms right now :-P

12:10 only one of which is in ccs

12:11 solussd: anyone have any experience using conjure on an actual website? I'm intrigued by a rails-like framework in clojure, but not sure if I should bet the farm on it (instead of just using rails) for a project at work

12:11 mheld: solussd: I'm working on some rails-ish extensions of noir

12:12 solussd: (I'm a huge rails-lover)

12:12 solussd: so I don't know if that'll sway your opinion in any way

12:19 gf3: guh

12:19 clojurescript testing

12:19 how does it work?

12:20 #magnets

12:21 muhoo: heh

12:22 TimMc: mheld: What kind of extensions?

12:22 Mass assignment? :-P

12:23 muhoo: for some reason, the idea of combining rails and noir makes me a little queasy.

12:23 TimMc: "drinking on the train"

12:23 muhoo: rather, i like noir, and rails makes me a little queasy.

12:23 mheld: TimMc: lein noir g scaffold user, lein noir g controller pages index about

12:24 TimMc: (defresource user)

12:24 muhoo: the whole idea of generated scaffold code in mvc stuff always felt like a hack to me.

12:24 TimMc: I've never been comfortable with scaffolding.

12:24 mheld: you don't really use scaffolding in production

12:24 TimMc: It strikes me as a lack of macros.

12:24 muhoo: like "this stuff is so verbose and spews files all over the place, let's write some helper code that does it for us"

12:25 napping: you prefer macros and their kin?

12:25 dan_b: if you have to generate code, your source language is insuifficiently expressive

12:25 I say that as someone working ona rails app on the screen next tothis one

12:25 napping: This may be the wrong channel, but security issues and such in rails always remind me of its antithesis: http://impredicative.com/ur/

12:25 muhoo: dan_b: thank you. i didn't feel comfortable stating it so strongly, but that is consistent with what i've experienced so far with rails, yii, etc.

12:25 TimMc: napping: Is that Ur/web?

12:26 napping: yes

12:27 dan_b: for the avoidance of doubt, I'm talking here about generated code which teh user is then expected to edit

12:27 yacc compiles to C, clojurescript compiles to js, I'm fine with that

12:27 mheld: ... you know that a user will have to create sourcecode at one point

12:28 so if you were creating a user model, you would still have to tell the framework how to render that model

12:28 scaffolding just automates the initialization

12:28 dan_b: but it's a one-short operation

12:28 mheld: hmm?

12:29 dan_b: if you customise that view, and then you want to use the generators again to add an extra field

12:29 napping: dan_b: let me misinterpret you too far - only JITed languages can be expressive

12:29 dan_b: ... you can't, without overwriting your changes

12:29 mheld: dan_b: so then make it without having it be destructive

12:29 I don't get what the problem is

12:29 muhoo: mheld: then maybe it's not a problem, for you anyway.

12:29 dan_b: how do you propose making it non-destructive?

12:30 mheld: dan_b: dunno yet, but it's a solveable problem

12:30 dan_b: I bet whatever the answer is it involves not having the user edit generated code, or having a strict protocol for which bits are user-editable and which bits are generator-updatable

12:31 which is sorta where we came in

12:31 mheld: why?

12:31 clojurebot: why not?

12:31 mheld: thanks clojurebot

12:31 why do things have to fit that way?

12:31 dan_b: because otherwise the generator has to be able to understand what your changes do in order to fix conflicts it creates

12:31 Turing-completeness etc etc

12:32 mheld: dan_b: why can't we make it in such a way that it's manageable for the generator to understand what we've created so far

12:32 technomancy: napping: ur looks awesome

12:32 napping: It's kinda rough around the edges, but certainly philosophically opposed to many common things

12:33 technomancy: if I were doing web work full time I'd be mining it for ideas

12:33 hint hint

12:33 napping: How would that work?

12:33 technomancy: hmm; no idea, that's the wonder of it.

12:34 muhoo: that mini-kanren post about routing components on a stripboard is interesting, but

12:34 frou: I may be off base, but think sounds a bit like the "partial class" that for example Visual Studio generates and keeps up to date as you are developing a GUI

12:34 muhoo: there are tools already that'll route components on a pcb, and i've used them to route on stripboard just as well

12:34 frou: you edit the other part of the partial class

12:34 muhoo: they apparently have some kind of topology algorithm already in them, plus libraries of the parts and their dimensons, etc

12:35 napping: It seems to be a thoroughly typeful approach, calculating CRUD pages from the type of a databae table and such

12:36 mheld: point being that these problems aren't unsurmountable and that ignoring them is lazy

12:36 napping: mheld: a strawman alternative - the generator takes a map of overrides

12:37 mheld: that could work, too

12:38 dan_b: frou: in short, you edit one "resource" and the computer manages another

12:41 frou: you and the computer are both working on the same unit, but the part where the initial and subsequent generated code goes is partitioned off and you don't edit it

12:41 this VS example may be very pedestrian.. I'm not familiar with ruby or rails

12:42 dan_b: what I said above about protocols to avoid u & c stepping on each others toes then

12:42 Wild_Cat: frou: isn't that stuff deprecated in favor of a declarative UI description language?

12:43 (something Java desperately needs as part of its stdlib)

12:43 mheld: you *could* migrateify that stuff

12:43 frou: yes, the XAML business. I stopped doing GUI stuff before that took hold

12:53 gf3: hey ibdknox, do you know how I can include google closure libraries with lein-cljsbuild?

13:04 dnolen: ejackson created a nice shiny new tutorial for core.logic - https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer

13:04 oops, meant to paste http://github.com/clojure/core.logic/wiki/A-Core.logic-Primer

13:09 devn: :( cljs-template wont install on lein 2 for me /cc ibdknox technomancy

13:16 ah, looks like 0.1.4 isn't on clojars yet

13:17 dnolen: anyone tried lein-navem?

13:19 TimMc: "navem"?

13:19 Is that a thing or a typo?

13:21 antares__: TimMc: that's a plugin that turns pom.xml into project.clj or something like that

13:21 devn: "lein-navem is a lein plugin that converts a maven pom.xml into a project.clj"

13:22 thickey: i've used it, but i wrote it, so i don't count

13:22 feedback welcome

13:22 devn: ha

13:26 mheld: I'm writing a macro and I want to defer a method call to be based off the arguments -- (defmacro thing [arg] `(do (~arg methodcall)))

13:26 is that kosher?

13:27 halarnold2000: he meant lein-nevam

13:28 bitrot: lein-navem was born a poor java child.

13:32 solussd: mheld: I've been looking at noir now for about an hour- do you believe it is suited for building a hateoas / REST api + frontend?

13:33 mheld: certainly looks up to the task...

13:34 mheld: definitely a REST api

13:34 and definitely a small web app

13:35 erm, by (defmacro thing [arg] `(do (~arg methodcall))) I meant (defmacro thing [arg] `(do (~arg/methodcall somevalue)))

13:35 solussd: mheld: how about a large web app? :D

13:35 dnolen: thickey: yeah it's super useful, especially for contrib authors where we rely on pom.xml. I'm trying to use it with lein2 on core.logic's pom.xml but I'm getting a null pointer exception

13:36 mheld: solussd: not sure

13:36 solussd: I've never built anything large with it

13:37 dnolen: thickey: https://gist.github.com/2038112

13:37 solussd: mheld: building a product demo in it for now- worst case scenario, I doubt I could waste much time with it-- everything is super straightforward

13:39 thickey: dnolen: I can recreate that here. i'll take a look, perhaps I'm presuming something will will be in the pom that's not there.

13:39 dnolen: thickey: thx, much!

13:50 h0x5f3759df: Hi, Is this the functional way of doing bfs in clojure? https://gist.github.com/ce8773ccc838f0a48100

13:58 mefesto: is there a function in compojure for redirects?

13:58 Raynes: mefesto: There is one in noir.

13:58 So probably not.

13:58 mefesto: ah

13:59 Raynes: Usually things that are in noir are in addition to what are in compojure and not duplicate functionality.

14:23 thickey: dnolen: give [lein-nevam "0.1.1"] a try

14:27 dnolen: thickey: sweet!

14:28 emezeske: btw, lein-cljsbuild *rocks*. have you looked much at the issues when using it with lein2?

14:29 emezeske: dnolen: thanks!

14:29 dnolen: I basically got it to the point where it would "sort of run" on lein2

14:30 dnolen: Hopefully next week I can switch to using lein2 for everything, in which case I'll probably fix the bugs

14:30 dnolen: emezeske: gotcha, most things seem to work but the REPL tasks do not.

14:31 emezeske: I also wonder if the trampoline bit couldn't be hidden behind lein-cljsbuild itself.

14:31 emezeske: dnolen: Ah, that's a bummer.

14:31 dnolen: Yeah, actually, lein2 adds some kind of aliasing, and I plan to hide the trampoline stuff with it

14:31 That's a long word to type

14:32 dnolen: emezeske: nice! I'm getting bit eager since I've got my JSConf presentation coming up :)

14:32 emezeske: dnolen: Oh? Talking about clojurescript there?

14:32 dnolen: emezeske: being able to manage client side library dependencies this way is pretty slick coming from copy-paste JS workflows.

14:32 emezeske: yes

14:33 emezeske: dnolen: Nice!

14:33 jsabeaudry: Is the clojure/java mmap the same as the posix one? Will that call the mmap in the file_operations of my kernel module?

14:33 emezeske: dnolen: Glad to hear that it's useful. It's cool that it works that way

14:38 dnolen: emezeske: I might poke around in lein-cljsbuild to see I can help out with lein2 compat, would be nice to show a simple workflow to curious folks.

14:38 technomancy: in lein 1.6, only the trampoline task can trampoline, but I think now any task that writes to the trampoline file will be trampolined

14:39 just check the leiningen.trampoline-file system property

15:01 muhoo: after playing around with clojure, having to do actual paid work in php makes me want to cry.

15:01 emezeske: dnolen: Cool. I doubt the repl problem is anything super hard to fix

15:01 technomancy: Ooh, very cool

15:02 tmciver: muhoo: ain't that the truth.

15:02 muhoo: tmciver: https://refheap.com/paste/1064

15:02 i'm sure there's a 1liner in clj that'd do that.

15:03 Twey: muhoo: http://lukeplant.me.uk/blog/posts/why-learning-haskell-python-makes-you-a-worse-programmer/

15:03 (applies to Clojure just as well)

15:03 muhoo: i should play around with pharen some more

15:03 tmciver: muhoo: yeah, but then you wouldn't have that cool deeply-nested look!

15:05 muhoo: "don't bother improving yourself, unless you have the freedom to improve your environment accordingly." <-- that is the key right there

15:06 that's actually quite deep, as well as quite depressing.

15:06 it's true about not just programming, but anything.

15:08 Vinzent: Is it possible somehow to alter static var?

15:09 muhoo: well to hel with that. i've shut down most of my customers, am taking some months off to learn clojure, and will see if i can make a living with that instead. if not, back to the java/php salt mines for me.

15:20 llasram: Vinzent: What do you mean by "static var"?

15:20 muhoo: Wow. I wish you hopeful luck :-)

15:21 Vinzent: llasram, a var with :static true in its metadata, see e.g. map, filter and other clojure.core functions

15:23 llasram: Ah, ok. I believe :static was only meaningful for pre-release versions of 1.3. I'm not entirely confident it had no impact in 1.2, but it does have no impact on the 1.3 compiler

15:25 Vinzent: llasram, well, when I'm trying to alter it, I'm getting "Evaluation aborted" and then swank connection just closes.

15:27 llasram: Vinzent: Just double-checked -- all the 1.3 compiler code handling :static metadata is commented-out. So whatever is going wrong, doesn't have anything to do with the Var being :static

15:28 TimMc: Twey: "The other C++ guys on the team still look at my code like it's got legs" is pretty excellent.

15:32 Vinzent: llasram, hm, then probably the swank server uses map, so when I alter it things break down. Thanks.

15:32 llasram: Well, `map' is a pretty fundamental operation :-)

15:32 What are you trying to do with it anyway?

15:37 Vinzent: oh, I'm just playing with contracts

15:37 zakwilson: Do most people just use clojure.test for testing, or is there something more fancy that's worth a look?

15:38 Vinzent: zakwilson, midje totally worths a look

15:38 zakwilson: Wow. It has an infomercial.

15:39 llasram: haha. Midje lets you do a lot of nice stuff, but I haven't quite figured out some details of workflow around it

15:44 In order to run individual tests from Emacs, you need to compile the test namespace file, so that it creates the namespace etc, does any init, etc. But compiling the file runs all the tests. It just feels slightly off to me, but there's probably

15:44 some easy solution I just haven't realized yet

15:45 TimMc: `fogus: Does Marginalia have a mechanism for hooking in and adding/modifying the HTML for a var based on metadata?

15:46 Vinzent: llasram, hm, what do you mean? With clojure.test you also have to compile ns first, no?

15:47 llasram: Vinzent: Sure, but deftest just squirrels off the actual test code to run later. Midge `facts' run their test content when evaluated

15:48 Vinzent: llasram, yes, but what's the problem with that?

15:48 llasram: You can't compile a midje testing namespace without running all tests it contains :-)

15:48 zakwilson: ibdknox: if I'm noir-ifying an existing project, what version should I use? The latest alpha, or is that too likely to blow up in my face?

15:49 Vinzent: yes, but... what's the problem with that? :)

15:50 llasram: It just doesn't usually seem like what I want. Of the set {run all tests, run tests all in a single namespace, run a single test}, "run tests in a single namespace" is the one I use the least

15:51 zakwilson: Running the test when evaluated sounds good except when I want to set up some state before running the test.

15:51 `fogus: TimMc: It does not

15:52 Vinzent: llasram, but you don't forced to do so. You can also run individual tests from emacs, having your buffer compiled once, or you can use lein midje --lazytest

15:52 zakwilson, you can do it with midje's background form

15:52 llasram: zakwilson: Midje actually has really nice support for setup and teardown and advanced variants thereof.

15:52 what Vinzent said :-)

15:53 zakwilson: Ok, I'll try it.

15:53 llasram: Vinzent: You can run individual tests, but only *after* you run all the tests by compiling the namespace. It's not a huge issue -- it just feels kind of clunky to me personally

15:54 Vinzent: And I have not yet tried lazytest, but I keep meaning to

15:55 technomancy: side-effects at compile-time make me frown-facey =(

15:57 ieure: Is it possible to let a symbol in a different namespace?

15:57 technomancy: ieure: let only applies to locals

15:57 ieure: Example: I'm writing a test for code which uses an agent in its namespace to store state, and I want to alter the state for the test.

15:57 technomancy: maybe you're thinking of binding?

15:58 ieure: technomancy, Isn't that only for thread locals?

15:58 technomancy: it's for thread-local "changes" to dynamic vars, yes

15:58 if it's for testing you might find with-redefs more to your liking

15:59 Vinzent: llasram, oh, ok, I see. I just never, you know, paid attention to it - imo it's handy to run save, compile and run your tests with a single keystroke. Also, as far as I know, Brian Marick, the author of midje, keeps his tests in the same file with source code, so it makes even more sense in such case.

16:01 ieure, by the way, I believe in midje you could write something like (provided (deref your-agent) => some-value) :)

16:02 ieure: Vinzent, Nice, but I don't want to port my tests.

16:03 TimMc: `fogus: Would you accept a pull request for an experimental mechanism for Marginalia hooks/plugins, should one exist? I have an idea for fancy documentation for Overtone libs. :-)

16:03 ieure: technomancy, I can't use bind or with-redefs on syms in a different ns, either.

16:03 llasram: ieure: You totes can use with-redefs on symbols from other namespaces

16:04 TimMc: `fogus: I haven't written anything, but I'm going to a hackfest-ish thing tonight and will probably propose something of the sort.

16:04 ieure: llasram, Can you point me to some example then, please?

16:04 Vinzent: ieure, why can't you, are they private or what?

16:04 gozala: Hi folks I'm trying to learn about clojure protocols

16:04 and types

16:04 ieure: Vinzent, Nothing is private.

16:05 gozala: is there something like extend-type default in clojure ?

16:05 dnolen: damn takeoutweight got Clojure running on iOS via clojure-scheme

16:05 technomancy: ieure: should be able to actually

16:05 dnolen: gozala: yes extend-type Object

16:05 technomancy: ieure: also, start thinking in terms of vars, not symbols

16:05 gozala: dnolen: thanks!

16:05 does that also works on clojurescript

16:06 or I need extend-type default there instead ?

16:06 technomancy: ,(binding [clojure.core/*assert* false] true)

16:06 clojurebot: true

16:06 dnolen: gozala: no, but js/Object might work in the future. for now you need extend-type default

16:07 gozala: dnolen: thanks

16:07 Vinzent: ieure, then what's the problem? just :use it and write (with-redefs [your-agent temp-value] ...)

16:07 ieure: Vinzent, I think I was getting tripped up with vestigal code.

16:08 technomancy: ieure: generally symbols are uninteresting after compile-time

16:10 llasram: ieure: https://refheap.com/paste/1066 if still relevant

16:10 ieure: llasram, Thanks, I appreciate it.

16:13 Vinzent: dnolen, by the way, could you guys please include 'case' in cljs? I've read your answer on stackoverflow, but as I understand on of the goals of cljs is to be as compatible with clojure as possible, right? Including case (as an alias for (condp = ...)) would both improve portabilty of code and reduce confusion of clojure developers moving to cljs. Please correct me if I understand it wrong.

16:19 TimMc: Vinzent: I think performance characteristics are included in the definitions of some things like 'case'.

16:19 It may be that JS doesn't support that kind of language construct?

16:20 aperiodic: with leiningen 1.7, is there a way to programatically generate an uberjar from inside the project?

16:21 Vinzent: TimMc, yes, it's exactly the case. But slower working code is better than not working code at all?

16:22 technomancy: aperiodic: no, the project process should be basically unaware that it's running from within leiningen

16:23 gfredericks: Vinzent: it might be considered misleading; but this kind of thing could be solved by a library that defines the missing functions, right?

16:23 technomancy: you might be able to rig up some kind of higher-order task that kept a socket open and would allow the project to invoke leiningen tasks, but you're getting into pretty serious I N C E P T I O N territory there

16:24 TimMc: Vinzent: Make a lib called close.enough and put a case macro in it. :-P

16:24 Vinzent: gfredericks, sure, but the point here is that you can't just take you clojure file and use it with clojurescript. (Maybe my understanding is wrong and it's not a goal for cljs at all?)

16:24 TimMc, ^^

16:24 gfredericks: Vinzent: that is not a goal

16:25 at least not for whole applications

16:25 TimMc: Not a *primary* goal for sure.

16:26 gfredericks: Vinzent: I expect they try to keep things the same as long as it's a natural thing to do, but not to do anything too awkward for that sake

16:26 aperiodic: technomancy: i just want to generate a fresh uberjar and stick it in hadoop's CP for testing, so i guess the better way to implement that would be to modify the test task

16:26 Vinzent: oh, ok. I've just seen all this code sharing features in cljsbuild, and it made me think that it's an important one

16:26 gfredericks: Vinzent: I think it's cool for tools like that to try to stretch what's possible in that direction, but most stuff could be done outside of the core language

16:27 Vinzent: gfredericks, yeah, this makes sense.

16:27 `fogus: TimMc: Propose away. We're always looking for ways to make Lein more awesome. :-)

16:27 gfredericks: I think fake-clojure-for-cljs would be an interesting lib to start :)

16:30 * gfredericks imagines faking out java interop just to be obscene

16:31 gfredericks: (System/exit) could try to close the browser window

16:33 Vinzent: gfredericks, hah, sounds interesting :)

16:35 TimMc: gfredericks: In Mozilla browsers, you *can* interop with Java.

16:35 gfredericks: TimMc: stop that's obscene

16:36 * gfredericks imagines an eval-in-clj function for cljs

16:36 TimMc: Problem?

16:36 clojurebot: People have a problem and think "Hey! I'll use a regular expression!". Now they have two problems....

16:37 TimMc: That too.

16:37 Applets are the way of the future.

16:37 amalloy: clojurebot: any more trite overused quotes?

16:37 clojurebot: It's greek to me.

16:37 TimMc: :-D

16:38 gfredericks: clojurebot: greek?

16:38 clojurebot: No entiendo

16:39 gfredericks: now he's just being clever

17:00 yoklov: well, this is probably the weirdest piece of code i've ever written

17:00 https://github.com/thomcc/unlambda-clj/blob/master/src/unlambda_clj/core.clj

17:04 cjfrisz: clojurebot: Are you really cleverbot?

17:04 clojurebot: Gabh mo leithscéal?

17:07 dnolen: Vinzent: sounds like rhickey agrees w/ you, so we'll probably see case in CLJS soon.

17:07 juhu_chapa: -quit

17:07 Vinzent: dnolen, oh, that's a good news!

17:07 TimMc: Huh, I wouldn't have expected that.

17:08 dnolen: TimMc: I think lang compat trumps everything else.

17:10 TimMc: I mean, I'm happy -- just surprised. :-)

17:13 amalloy: that doesn't sound like what rich has said before about porting large apps from clj to cljs - ie, i got the impression he doesn't think language compatibility trumps all else

17:15 adding case costs basically nothing, though, so i'm glad he decided to emphasize compatibility

17:15 clojurebot: Huh?

17:15 dnolen: amalloy: large apps involve host-y stuff - but the core language bits should just work.

17:18 anyone see any problems w/ CLJS using Google Closure HEAD?

17:21 gozala: anyone cares to explain what's wrong with

17:21 (def foo (if (resolve 'foo) foo :fallback))

17:24 Vinzent: gozala, mm, isn't it the same as defonce?

17:24 dnolen: gozala: side note, resolve is kind of a last resort thing.

17:25 gozala: Vinzent: I did not knew about defonce

17:25 thanks

17:25 dnolen: what's idiomatic way to check if something is defined then ?

17:26 dnolen: gozala: checking if something is defined is not very idiomatic.

17:26 rahcola: how do you eval code in a buffer to user ns when using emacs+slime?

17:26 or do you guys use some other way of working?

17:27 dnolen: rahcola: C-c C-k, for compile file

17:27 rahcola: that is, when the code in the buffer is in some ns foo.bar or something

17:27 Raynes: dnolen: I've had valid reasons for doing that before.

17:27 gozala: dnolen: I see

17:27 dnolen: Raynes: I didn't say there weren't valid reasons, just that it's a sign of doing something unusual

17:27 gozala: dnolen: so what I'm trying to do is to define my abstraction via protocol

17:28 tmciver: rahcola: you can C-c C-l to eval the file and then I'd C-c M-p to change the repl's ns to said file's ns.

17:28 Raynes: Anyways, to actually answer the question, bound?

17:28 gozala: and since I need to use Object in clojure and default in clojurescript

17:28 I need to see if default is defined

17:28 cjfrisz: tmciver: I love when you guys answer questions I didn't think to ask

17:28 ohpauleez: Is there a reason Clojure's google-closure-jar doesn't include the theird-party?

17:28 third*

17:28 rahcola: tmciver: will new defs made in the repl get added to the file's ns?

17:28 gozala: or is there some more idiomatic way to do that ?

17:29 rahcola: i would like to take a defn from the file, and test it in the repl while not messing with the file's ns

17:29 tmciver: rahcola: yes, if you def them once you're in that ns; not before (I don't think).

17:29 dnolen: gozala: there's no good way to resolve the differences between Clojure and CLJS protocols. I would warn that trying to build something at the level of the runtime is bound to break.

17:30 gozala: emezeske and others are thinking about source transformation support in the meantime. CL style compile flags have come up, but I haven't seen any movement.

17:32 gozala: dnolen: what is the best way to define your own purely clojure based & new data structure then ?

17:32 dnolen: gozala: define it twice once for Clojure once for CLJS. deftypes will often be polluted with host specific information.

17:32 gozala: I was assuming if I just start from scratch there should be a way to define it so that it works in both worlds

17:33 dnolen: gozala: what matters is the code that will *use* the deftype can remain the same.

17:34 rahcola: tmciver: the C-c M-p was a good tip, thanks. any ease way to "clean" the file's ns, make it have only the defs in the file?

17:35 gozala: dnolen: well I guess I have to break it first to learn more, thanks!

17:35 dnolen: gozala: yes, cheers :)

17:35 TimMc: gozala: Maps. Lots of maps.

17:36 dnolen: TimMc: heh, and +1

17:36 gozala: TimMc: sorry I don't get it

17:36 dnolen: gozala: if you just program around maps you can avoid all these tricky decisions.

17:36 TimMc: gozala: Most of the time, structured data can be represented very easily as maps.

17:37 {:type :foo, :amount 6, :class :gold}

17:37 dnolen: that was my point of about it being an unwise use of time trying to get a deftype to work across CLJ and CLJS

17:37 gozala: TimMc: dnolen In fact what I'd like to do is try to port my js lib

17:37 https://github.com/Gozala/streamer

17:37 so I started with defining Deferred protocol

17:38 and then I'd like to define type that would implement regular sequence protocols

17:38 tmciver: rahcola: I'm not sure, but I don't think so. Everything I know about swank-clojure I learned from technomancy in here and from: https://github.com/technomancy/swank-clojure

17:39 technomancy: pssh; I don't know anything about swank

17:39 gozala: so yeah I'll be playing with maps but I need to get there first :)

17:39 tmciver: OK, I take it back. technomancy taught me nothing about swank ;)

17:40 technomancy: but yeah, I would like to have some way of doing ns-unmap. currently there's nothing exposed from slime.

17:40 tmciver: technomancy: yes, that would be a cool feature.

17:40 technomancy: oh wait, I lied

17:40 I just got a pull request for that

17:40 let me push to clojars

17:40 metajack: How does C-c M-p help you faster than (in-ns 'foo.bar)? Mine doesn't get prefilled or anything, nor does it seem to get it from the file i'm in.

17:40 technomancy: metajack: it has completion

17:41 metajack: technomancy: ah, nm. i was already in that namespace, so it has a slightly different behavior then

17:41 technomancy: also, it should be pre-filled if the current buffer's ns is different from what the repl's currently in

17:41 rahcola, tmciver: C-c C-l should clear the given ns now under 1.5.0-SNAPSHOT

17:42 ohpauleez: ibdknox: THANK YOU for goog-jar

17:42 I was just making one and thought, "Wait, How did Chris get around this?"

17:43 rahcola: technomancy: have to test that right away, after i'm done with this rabbit hol...feature

17:43 technomancy: rahcola: let me know; I haven't tried it myself =)

17:44 rahcola: nasty things happen when your tests use names that are no longer valid, but yet still defined

17:45 technomancy: we call that "getting slimed"

17:46 probably not a good sign when your development tool has an entire class of mistake named after it but WHATEVER

17:46 gozala: dnolen: I have another mystery to solve now

17:47 if I use extend-type on Object it works

17:47 but if I (def foo Object)

17:47 rahcola: always nice to know what hit you

17:47 gozala: and then do (extend-type foo … it does not

17:48 with exception Unable to resolve classname: default

17:48 Am I missing something ?

17:49 dnolen: gozala: you need a symbol that represents a class

18:01 rahcola: technomancy: what version of leiningen does swank-clojure 1.5.0-SNAPSHOT require?

18:02 technomancy: rahcola: it won't work with 1.6.2 or older

18:03 actually that's not right; it should work

18:03 rahcola: the swank task disappeared when I did lein plugin install 1.5.0-SNAPSHOT

18:03 with the swank-clojure in there :)

18:03 technomancy: yeah you need to use lein-swank now

18:03 wait cripes

18:04 lein-swank doesn't let you override the swank version used in 1.x

18:04 let me fix that

18:04 rahcola: and do I also need to upgrade clojure-mode?

18:04 because clojure-jack-in seems to use lein swank

18:06 technomancy: no, clojure-mode can be left alone

18:10 rahcola: got "Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.

18:10 from clojure-jack-in

18:10 technomancy: rahcola: ok, lein-swank 1.4.4-SNAPSHOT will only specify its preferred version of swank-clojure if you haven't already got one

18:11 which lein version?

18:12 rahcola: 1.7.0

18:12 but I do not have any :plugins entries

18:12 technomancy: you should be able to put [lein-swank "1.4.4-SNAPSHOT"] in :plugins

18:13 rahcola: trying that now

18:13 technomancy: oh, but you want it user-level

18:13 I guess lein plugin install lein-swank 1.4.4-SNAPSHOT would probably work

18:22 sjl: anyone know how I can build or clauses dynamically with Korma? This doesn't work: http://cljbin.com/paste/4f6119dee4b04ca9bce903d9

18:23 rahcola: technomancy: ok, got lein-swank 1.4.4-SNAPSHOT working using :plugins

18:24 but load file does not seems to clear the ns

18:24 btw, is plugin install still the prefered way for installing dev stuff like swank on leiningen?

18:25 Twey: TimMc: Haha, indeed :þ

18:25 TimMc: That's pretty much how people look at all my code, I think.

18:26 technomancy: rahcola: "lein plugin install" is the preferred way to install plugins that are intended to address user convenience issues in leiningen 1.x, yes

18:26 some plugins are necessary for builds to succeed (lein-midje, lein-tar, etc) and must go in :plugins in project.clj

18:29 rahcola: hmm.. seems that we should update our project.clj, got lein-midje in :dev-deps

18:30 technomancy: well if you want to support versions of leiningen older than 1.7 then you still need dev-deps

18:30 rahcola: its a hobby project, and I'm itching to go for 2.0 :)

18:32 technomancy: cool

18:37 metajack: sjl: query needs to be generated from one of the * functions. like select*

18:38 sjl: metajack: yeah, I did that

18:38 metajack: I can modify it after initial generation fine, e.g. by reducing where clauses onto it to get dynamic ANDed queries

18:39 metajack: oh you need (exec) at the end too

18:39 sjl: metajack: yes, I already have that too

18:39 metajack: the issue is that I can't seem to do something like (apply or [vector of predicates generated at runtime])

18:40 metajack: sjl: https://github.com/ibdknox/Korma/blob/master/src/korma/sql/engine.clj#L314-321 that doesn't look promising for or queries

18:41 there is an or predicate though

18:43 hmm. the or predicate works the other way I think. like (where {:ticket [or 1 2]}). at least that's how in and > and the others work

18:44 augustl: if I use clojure to build a project, can I consider that project free software? Real question: is the/a JVM considered free?

18:47 also, will clojure run on JVM's such as JamVM, dalvik, etc? (As you can tell, I'm new to jvm :)

18:47 sjl: metajack: yeah, but I need to a) use like, not in and b) build the field names at runtime, not the values

18:48 metajack: i can't get any sensible output for the or operators

18:48 sjl: ibdknox: ping?

18:49 metajack: sjl: i suspect this is not implemented yet, or it's opaque enough only ibdknox knows. most of this stuff i've figured out from code reading, but this is beyond me at the moment.

18:49 sjl: metajack: yeah, that's what I'm beginning to fear

18:49 aperiodic: augustl: haven't tried it myself, but i've heard that clojure is quite slow on dalvik due to its garbage collector

18:50 augustl: aperiodic: I see

19:22 slyrus: technomancy: I assume I need lein1 to build lein2?

19:26 technomancy: slyrus: if you're building from git, yes

19:26 but the preview2 release will self-install itself

19:28 slyrus: ok, yeah, I just pulled from git. thanks.

19:30 mefesto: anyone know how to paste to refheap with emacs? i've installed the refheap lib from marmalade. I'm guessing I (setq refheap-user x) (setq refheap-token y) and that's it?

19:31 that was it :)

20:19 dnolen: broken Node.js support in CLJS finally fixed

20:20 emezeske: dnolen: woot!

21:24 amalloy: mefesto: btw, setq is like clojure's let, in that it accepts pairs

21:24 aw, i just missed him

21:30 johnmn3: I'm having trouble with circular namespace dependencies

21:31 Suppose I have a bunch of gui functions in space.gui

21:31 and a bunch of logic that gets fired off if someone presses a button in space.actions

21:32 qbg: johnmn3: It is easiest to just refactor the code to eliminate the circularity

21:32 johnmn3: so like, the Fire button has an action that calls space.actions/asplode

21:33 but, in space.actions/aslplode, you want it to affect some change in the gui, in space.gui

21:33 like space.gui/place-explosion

21:34 now I have each calling each other.

21:34 qbg: Indirecting through a message bus is one technique

21:34 johnmn3: I did have everything in one file, which worked

21:35 Now I'm trying to break it up by functional areas and I'm trying to figure out how to organize it.

21:36 p_l: anyone can recommend me an online resource for learning clojure? I have previous Common Lisp experience, but now I have two projects that have to live in Java (one is a module called from a java app, another *has* to use RMI), and Clojure looks like least-effort approach...

21:36 amalloy: johnmn3: don't mutate the gui from the action, then. return a data structure representing changes you want the gui to make

21:36 johnmn3: qbg: That. I've also, in the past, decided to pass all the state through every function, and let it pick pieces out of keys

21:36 amalloy: p_l: www.4clojure.com is one option

21:37 johnmn3: how would that work?

21:37 p_l: amalloy: thanks

21:38 johnmn3: which function generates the datastructure, space.gui/button or space.action/asplode or space.gui/place-explosion?

21:38 and how does it get passed around, I'm confused.

21:39 amalloy: my suggestion was asplode, probably

21:39 johnmn3: Do you mean, like send the state into the space.action function and have it return the modified state to the main namespace?

21:40 amalloy: button calls asplode, looks at the data structure returned, and makes gui changes if necessary

21:40 johnmn3: so that space.action doesn't have to call into our main namespace?

21:40 right

21:40 amalloy: eg, asplode returns {:place-explosion ...}

21:41 johnmn3: I just can't send the swing gui into the action function and have it return a modified gui. right, I'd have to use a safe datastructure

21:41 qbg: Alternatively, if in MVC you have the controller depend on the model and the view (with the model and view not depending on each other), there is no circularity

21:41 johnmn3: qbg: that's actually what I'm trying to do

21:42 I have three namespaces and the control functions sit between them. However, how can I let buttons in the view call functions in the control namespace?

21:43 qbg: The controller registers callbacks in the view

21:44 The dependency on the controller that the view has is injected by the controller

21:44 johnmn3: so I'm using seesaw.

21:44 and normally youd do: (button :action (action :handler #(stuff...

21:45 how do you do call backs in swing?

21:45 qbg: .addEventListener

21:45 johnmn3: ah

21:46 oooh k

21:46 qbg: You should be able to indirect the action through an atom containing command -> fn mappings

21:46 (if you don't want to drop down to straight swing)

21:47 johnmn3: just founed seesaw.core/listen

21:47 found

21:48 qbg: I've never used seesaw, so I can't give the best advice on that end

21:48 johnmn3: so I think you solved my riddle

21:48 'listen is the ticket, I think

21:51 gtuckerkellogg: i know it's short already, but is there a better alternative to (partition 2 (interleave l1 l2))?

21:51 qbg: &(map vector (range 0 10) (range 10 20))

21:51 lazybot: ⇒ ([0 10] [1 11] [2 12] [3 13] [4 14] [5 15] [6 16] [7 17] [8 18] [9 19])

21:51 qbg: Is that basically what you want?

21:53 Looks like it

21:55 TimMc: gtuckerkellogg: And if this is for a function f that consumes both... (map f l1 l2)

21:59 gtuckerkellogg: l2 is a list of sets, i want to filter out empty sets before stuffing them into a hash-map

22:00 what i have now is (into {} (filter not-empty (partition 2 (interleave l1 l2)))

22:00 where not-empty is (fn [[_ v]] (not= v #{}))

22:00 TimMc: &(doc filter)

22:00 lazybot: ⇒ "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."

22:01 TimMc: Hmm, not multi-arity.

22:01 sjl: gtuckerkellogg: (comp seq second) instead of not-empty?

22:02 gtuckerkellogg: or I'd probably use remove instead of filter and use (comp empty? second) to be more clear

22:02 TimMc: Ooh, good call.

22:02 sjl: "remove elements where the second item is empty"

22:02 TimMc: Suddenly readable.

22:03 gtuckerkellogg: oh that's nice

22:03 or (comp empty? val), I suppose, since it's destined or a hashmap

22:04 sjl: &(val [:a :b])

22:04 lazybot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry

22:04 sjl: gtuckerkellogg: yeah, I don't think you can use val on a pair

22:04 gtuckerkellogg: :(

22:07 simard: I'd like to let power users use clojure as a scripting language for my app, but I need to make sure this code will be confined somehow in a part of the JVM where it has no access whatever to library functions or to memory outside what is allocated to it, for obvious reasons. Has anyone here done that before ?

22:07 mdeboard: simard: Yes, https://github.com/flatland/clojail

22:07 sjl: simard: sounds like you're looking for https://github.com/flatland/clojail

22:07 simard: I love this place :D

22:08 mdeboard: I love WINNING

22:08 simard: so, let me ask the phony question, is that quite safe ?

22:09 as long as policy is properly defined, that is

22:09 amalloy: i wonder what makes that a phony question? you're not actually asking it, or you don't actually want an answer, or only phony people would ask it, or...

22:09 sjl: &(str "I hope so")

22:09 lazybot: ⇒ "I hope so"

22:10 mdeboard: Maybe simard's first language isn't English, and he meant a word that translates roughly to "phony" in English but could also mean "obvious"

22:11 simard: mdeboard: that sounds correct :)

22:11 I guess I'll have to look up for that word again.

22:11 mdeboard: voila

22:12 RickInGA: simard here is a lecture about it from clojure conj 2011 http://blip.tv/clojure/anthony-grimes-clojail-life-in-the-clojure-prison-5919720

22:15 TimMc: $mail samaaron <3 <3 <3

22:15 lazybot: Message saved.

22:15 TimMc: I have a new toy: (demo 30 (pan2 (apply + (sin-osc [(mouse-y:kr 50 500) (mouse-x:kr 50 500)]))))

22:15 simard: RickInGA: thanks, I'll definitely spend 45 minutes on this, and I'll remember to not think that JScheme could have been a proper choice for this.

22:21 sjl: is there a ceil function hiding somewhere in 1.3+'s core?

22:22 TimMc: &(Math/ceil 4.5)

22:22 lazybot: ⇒ 5.0

22:22 sjl: &(Math/ceil (/ 2 3))

22:22 lazybot: ⇒ 1.0

22:22 sjl: perfect, thanks

22:30 ibdknox: sjl: you pinged?

22:30 RickInGA: if I install lein-newnew does lein new stop working?

22:30 ibdknox: RickInGA: all the functionality of the original new should still be there :)

22:31 sjl: ibdknox: yeah, I'm trying to do something like this in Korma: (-> some-query (apply or [{:name [like "foo"]} {:username [like "foo"]}]))

22:31 ibdknox: basically building an or clause at runtime instead of hardcoding it in

22:32 ibdknox: sjl: let me verify but that should be fine as long as you call pred-or instead of or

22:32 sjl: ibdknox: is that possible?

22:33 ibdknox: Hmm, I tried it with pred-or but it didn't work either.

22:33 ibdknox: well, you'd need to quote like

22:34 what was the error you got?

22:34 RickInGA: ibdknox lein nor new <proj> is working for me, but lein new <proj> is not. is there a template I need to specify for a 'normal' clojure project?

22:34 sjl: hmm, I don't remember, let me find it again

22:35 ibdknox: sjl: this worked for me: (sql-only (select :blah (where (apply fns/pred-or [{:name "cool"} {:cool "woot"}]))))

22:35 pandeiro: i want to slurp a binary file from a url and save it to disk, do i need java for that?

22:35 ibdknox: RickInGA: hm, no that should just work :(

22:35 sjl: ibdknox: well first it can't find the like symbol

22:36 ibdknox: yeah it doesn't exist

22:36 though it you put it in the where

22:36 it should be ok

22:36 RickInGA: ibdknox I deleted newnew from plugins and then lein new <proj> worked….

22:36 ibdknox must be something in my configuration that is causing a confligct

22:37 ibdknox: RickInGA: hm :/ maybe we can take a look tomorrow, not sure I can necessarily fix it, but maybe

22:37 sjl: I think you just need to wrap the where around there actually

22:38 you can still use or

22:38 though if those maps come from outside of the where clause

22:38 you'll need to quote the like

22:38 simard: amalloy: how do you advise I use clojail, in a different process and/or thread from my main application ? I want as much security as I can get from it, and I don't care about restarting it if it gets screwed up.

22:38 ibdknox: sjl: {:name ['like "woot"]}

22:39 amalloy: running it in a separate jvm process would be best, and if you figure out how to do that please make it a library and let us know :P

22:39 RickInGA: ibdknox the good news is, I can reproduce it! I just reinstalled newnew and I am crashing again :)

22:39 tomoj: I thought this should work: (io/copy (io/input-stream url) (io/output-stream filepath))

22:39 but it seems to not copy the whole thing?

22:39 e.g. (io/copy (io/input-stream "http://www.google.com/logos/2012/yoshizawa12-hp.jpg") (io/output-stream "/tmp/doodle.jpg"))

22:39 ibdknox: RickInGA: hah, at least it's consistent ;)

22:39 tomoj: where io is clojure.java.io

22:39 simard: amalloy: I guess process intercommunication might be a bit of a problem right .. :)

22:40 amalloy: seriously though, don't use clojail to monitor artificial hearts or anything. it will break

22:41 simard: no, it's for a game, but code typed by the user might run on the server, so I don't want to create a backdoor with that.

22:41 RickInGA: i doublt clojure will break as many hearts and perl has!

22:43 amalloy: the main issue is that we don't have reliable ways to cordon off memory usage or thread usage

22:43 tomoj: simard: you might look into running inside lxc

22:43 seems like you could even allow filesystem access etc there

22:44 pandeiro: tomoj: thanks it's as easy as (spit f (slurp url)), apparently

22:44 tomoj: pandeiro: really?

22:44 don't think that should work on some binary files

22:45 pandeiro: tomoj: i haven't tested the files yet but they were written at least

22:45 sjl: ibdknox: ok, cool, I think I got it working now

22:45 ibdknox: I don't suppose there's a way to do this that's not relying on fragile internal stuff?

22:46 ibdknox: sjl: it doesn't rely on any internal stuff

22:46 this totally works:

22:46 sjl: (sql-only (select :blah (where (apply or [{:name [like "cool"]} {:cool "woot"}]))))

22:46 sjl: ibdknox: (use [korma.internal.sql :only (pred-or)])

22:46 ibdknox: you don't have to use that

22:46 :)

22:47 simard: tomoj: interesting, but that's Linux only I presume

22:47 ibdknox: also you should use 0.3.0-beta5

22:47 sjl: ibdknox: ah, I used what the README told me to use.

22:48 ibdknox: yeah, I'll update all of those soon. 0.3.0 is stable

22:48 just general improvements happening here or there

22:48 metajack: any idea how to track this compile exception down? the code works fine used from the repl, but fails with doing lein compile: https://gist.github.com/b9f0e8f9b36cef6bfe3e

22:49 ibdknox: metajack: you're calling (:use ..) on geohash.core

22:49 metajack: ibdknox: I'd also appreciate a new release. It took me a little while to realize that stuff was pretty different in the non-beta version :)

22:50 ibdknox: unfortunately I'm of little time as of late

22:50 metajack: ibdknox: It's pulled in via require actually

22:50 why would that cause a NullPointerException on compile though?

22:51 ibdknox: metajack: what is this: guzzle.utils.index_all_tickets

22:52 metajack: it's a namespace with :gen-class and a single function -main. it pulls in a few things and does a small job

22:53 lein has :aot [guzzle.daemon guzzle.utils.index_all_tickets]

22:54 if i take out gen-class the code works fine, but for some reason it doesn't want to compile. i swear i've done exactly this several times before and never had a problem.

22:56 amalloy: a namespace with underscores in its name sounds extremely dangerous

22:56 metajack: sorry, it's dashes

22:56 simard: amalloy: a basic question, when using clojail, does the jvm security policy need to be applied to the whole application, or just to the part that is running clojail ?

22:56 metajack: i typoed that line

22:57 the source file has underscores, but the ns is dashes. this is the correct way i believe

22:58 amalloy: just the clojail part; clojail takes care of moving into and out of the protected mode

22:59 simard: amalloy: good, because in my client/server setup, I decided I would use clojail only on the client side, not on the server side, therefore if the JVM crashes or whatever bad happens to the client does not affect the server, as long as I do my job properly in designing the protocol between the client and the server

23:02 tomoj: simard: right..

23:02 I was thinking server side

23:02 why use clojail client side?

23:03 simard: tomoj: I initially asked for the server side, so you were right about that

23:03 daaku: i'm trying to write a macro that emits numerous deftest forms, and looks like the output i'm getting is a list of lists like ((deftest foo ..) (deftest bar ..)) -- i'm not sure what's the most appropriate way to fix it. more info here: https://gist.github.com/5aab7cd49761b27e1c39

23:03 simard: I changed my mind midway .. :)

23:04 tomoj: because the scripts the user will right will only run while the user is online, according to the new gameplay redesigned 5 minutes ago .. :)

23:04 right = write

23:05 aperiodic: well, as long as you're designing a protocol between the client and the server for this scripting, you can just enforce everything in the protocol

23:06 simard: exactly

23:06 security is on server side anyway, commands sent by the client to the server are authorized or rejected by the server before being translated to predefined function calls.

23:06 aperiodic: so what's the point of using clojail, then?

23:08 simard: the initial idea was to run that code server side, but not anymore. the remaining reason is that, well, I might have said power users but I really meant gamers, so using clojail is a good way to safeguard their code to avoid client crash

23:08 I want to build a DSL above clojure to help them script the game

23:08 but I don't want them to run into trouble too often

23:09 now that absolute security is not really needed, clojail sounds fine for the job.

23:09 aperiodic: does that make sense ?

23:10 aperiodic: ah, right, clojail lets you set execution time ceilings

23:11 metajack: fyi, fixing the refer-clojure issue for geohash made the compile succeed. It seems it's not really a warning at all :)

23:12 RickInGA: this core.logic primer is fantastic! bit.ly/ymYvrd

23:27 amalloy: daaku: (cons `do (...))

23:46 srid: has anyone written a clojure wrapper for the evernote api?

23:48 daaku: amalloy: ah! that worked. makes a lot of sense now that i think about it.

Logging service provided by n01se.net