#clojure logs

2012-03-14

00:00spoon16playing around with 4clojure this evening
00:01spoon16why does recur expect two args here?
00:01spoon16,((fn [[f & r] x] (if r (recur r) f)) [1 2 3 4 5])
00:01clojurebot#<CompilerException java.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 2 args, got: 1, compiling:(NO_SOURCE_PATH:0)>
00:01dnolenspoon16: your fn takes 2 args
00:01cgaglooks like the function takes a vector and a scalar
00:01spoon16doesn't it take just one arg that gets destructured?
00:02_atoarg1: [f & r]
00:02_atoarg2: x
00:02spoon16does the destructuring not apply when using recur?
00:02spoon16ohh
00:02spoon16x shouldn't be there, was using it like let
00:02spoon16thanks
00:10justicefriesso, more of an inexperienced LISP question here than anything. is it kosher to have a SLIME server running on a production server?
00:10justicefriesor in production code, rather.
00:10justicefriesI have a feeling it would tempt me to be very dirty.
00:13_atojusticefries: myself I would only do that as a last resort if I couldn't debug the issue in a development environment
00:14justicefries_ato, that makes sense.
03:38gtuckerkelloggi have a hashmap, and want to disj every entry with a particular value. Any suggestions?
03:46raekgtuckerkellogg: perhaps into and map-cat?
03:46stirfoo(into {} (map #(if (foo? (% 1)) nil %) m))
03:46raekor just into map and filter
03:46stirfoowhat he said
03:47raek,(into {} (filter (fn [[k v]] (even? v)) {:a 1, :b 2}))
03:48clojurebot{:b 2}
03:48gtuckerkelloggahh
03:50amalloy,(into {} (filter (comp even? val) {:a 1 :b 2})) ;; perhaps slightly classier
03:50clojurebot{:b 2}
03:54stirfoomine is shorter! (one of the few times you'll hear a man say that)
03:55gtuckerkellogghaha
04:00raekhuh, I had no idea that conj accepts nil entries! ;-)
04:24tomojnil entries?
04:25raek&(conj {} [:a 1] nil [:b 2] nil)
04:25lazybot⇒ {:b 2, :a 1}
04:26raekI wasn't aware that (conj some-map nil) = some-map
04:49amalloyraek: please don't depend on that though, it only works because of a disgusting coincidence
04:50amalloyspecifically, 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
05:56Licensermorning
06:05LajlaLicenser, what is your opinion on the parting push?
06:12Licenserparting push?
06:16LajlaLicenser, well, it's like a response to gasless FE pionered by parting
06:16Lajlawhere you actually go one gate FE into another nexus before you make anythingh else
06:16LajlaAnd 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
06:17LajlaAnd the 8 gates can also be used defensively, to protect what otherwise could be considered a risky third
06:17Licenserin that case I am al for it.
06:17LajlaLicenser, hmm, motivate.
06:17Licensergo Lajla go go go!
06:19Fossiyay for more sc2 talk in here :>
06:19LajlaFossi, don't tell me you play that godawful game?
06:20LajlaAnyway, I've been experimenting with a variation where I get 5 gates, 2 forges and a robo
06:20LajlaAnd use them purely defensively or with warp prism tomfoolry
06:20Fossii'm too busy these days :/
06:20Fossigotta play swtor ;)
06:20LajlaFossi, well, as it looks, gasless FE might become obsolete since Parting discovered that getting a third that quickly is actually completely safe against it.
06:21gtrak``i still haven't beaten revenge of the titans :-(
06:39gtrak``anyone have a copy of the 'are we there yet' slides? link is down
06:39gtrak``­HickeyJVMSummit2­009.­pdf
07:10mindbender1
07:17_atogtrak``: Internet Archive's got it: http://wayback.archive.org/web/*/wiki.jvmlangsummit.com/images/a/ab/HickeyJVMSummit2009.pdf
07:17gtrak``oh thanks
09:42dan_booh, I like this Hickey HDD talk already
09:44bsteuberdan_b: HDD?
09:44dan_bhammock driven developement
09:44bradwrightHammock Driven Development
09:44dan_bI know it's an old talk, but I'm a new user
09:45bsteuberah that one ^^
09:45dreenwhat talk is this?
09:45dan_bhttp://blip.tv/clojure/hammock-driven-development-4475586
09:45dreenkieferific
09:48maaclDoes anyone know of an example of ClojureScript REPL setup that supports emacs like edit, history etc?
09:51bsteubermaacl: just start the repl command as an inferior lisp
09:52uvtcWhat does it mean to have "used <something> in anger"? (as in in the lein tut where it mentions using Ant or Maven in anger)
09:53RickInGAuvtc: to actually have used it to solve a real problem instead of just exploring it, trying examples
09:53bsteubermaacl: https://gist.github.com/2036624 this is how I do it
09:53RickInGAthough in the lein tutorial, it may be punning, getting angry at ant or maven :)
09:54maaclbsteuber: Thanks a lot - is it OK if I skip the paredit part :-)
09:54uvtcRickInGA, Hm. Thanks.
09:55bsteubersure ^^
09:55bsteubermaacl: probably you write lein instead of lein1, just note that it doesn't seem to work with lein2yet
09:56RickInGAbsteuber how would I invoke that? M-x clojurescript-repl ?
09:56bsteubermaacl: also you meed to be in the project directory when you start the command
09:56maaclbsteuber: Got that, thanks. Do you have any experience with how this interacts cljs-template?
09:56bsteuberRickInGA: I use (global-set-key [f6] 'clojurescript-repl)
09:57bsteubermaacl: no haven't tried cljs-template yet
09:57RickInGAbsteuber I am fairly new to emacs, what does global-set-key do, and how do I set it up?
09:57uvtcRickInGA, re. anger, perhaps using it work where you need to solve a problem with it and you're stuck with it.
09:57bsteuberbut I do use lein2 with the rest of the project
09:58maaclbsteuber: Ok, I will give that a shot tonight, think it should work fine.
09:58bsteuberRickInGA: you just put both both commands in your .emacs, then F6 will always trigger the cljs repl
09:59RickInGAbsteuber I will try that, thanks a bunch!
09:59bsteuberhaving said that, I don't really use the cljs repl much ^^
09:59bsteuberI always hate to write full qualified names everywhere
10:00bsteuberso I usually just put my experiments in the main fn and hit refresh on the browser for exploring
10:00bsteuberbut maybe I am doing something wrong ^^
10:03RickInGAbsteuber thanks a ton for the help. I think I still have a configuration issue though.
10:03RickInGAthe repl launches, but when I try (+ 1 2) it hangs
10:05bsteuberRickInGA: even when you refresh the browser window?
10:06bsteuberRickInGA: did you follow https://github.com/emezeske/lein-cljsbuild/blob/0.1.2/doc/REPL.md ?
10:06RickInGAbsteuber: 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:06bsteuberno you go to the page where the js is loaded
10:06bsteuberwhich might be a noir view or just static html
10:08RickInGAbsteuber: THANKS
10:08bsteuberit works?
10:09RickInGAbsteuber I spent 8 hours on this yesterday! and sure it all makes sense in hindisght! thanks a bunch.
10:09RickInGAyep, working!
10:10bsteubergreat
10:10RickInGAbsteuber you going to clojurewest?
10:10bsteuberI only spend some time using lein2 ^^
10:11bsteuberno it's a bit far from Germany ^^
10:11RickInGAI am using 1.7 with the new cljs templates
10:11bsteuberbut maybe EuroClojure :)
10:12RickInGAbsteuber Wann ich zum Deutchland gehen, ich wolle Sie ein beir kaufen
10:12RickInGAand forgive me, my german is terrible!
10:14RickInGAhehe
10:14mdeboardrofl
10:14gfredericksRickInGA: it's terrible english too
10:14RickInGAhey, I live in Georgia, I am not expected to speak English well!
10:14bsteuberlol
10:15bsteuberdon't worry, I'll have to buy a thousand beers when I ever go to a conj :)
10:15mefestohow do you pass the ring request to your view function using compojure routes? (GET "/my/url" {:as req} (my-view req)) ?
10:44TimMcgfredericks: You mean doseq?
10:45TimMcor (comp doall map)
10:45gfredericksTimMc: no
10:45gfrederickssimilar functionality
10:45gfredericksdoseq:myfun::for:map
10:45TimMc...
10:45bsteubergfredericks: yes I called that domap in some code
10:45bsteuberlike CL's mapc
10:46gfredericksTimMc: the purpose is a syntactically succincter form of (doseq [x xs] (foo x))
10:46TimMcI see.
10:46gfredericksso I can say (domap foo xs)
10:46gfrederickspoint-free
10:46gfredericksit'd use dorun internally instead of doall, presuming you only want side effects
10:50pjstadiggfredericks: there's mapv in 1.4
10:50gfredericks,*clojure-version*
10:50clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
10:50gfredericks,(doc mapv)
10:50clojurebot"([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:51gfrederickshm. how is this different from map?
10:51TimMc(into [] (map ...))
10:52gfredericksoh
10:52TimMcAFAICS
10:52gfredericksah so it forces it
10:53gfredericksthat would be good for my former colleague who has sprinkled (doall (map ...)) all over his code
10:53pjstadigright, it's non-lazy
10:53pjstadig,(doc filterv)
10:53clojurebot"([pred coll]); Returns a vector of the items in coll for which (pred item) returns true. pred must be free of side-effects."
10:53pjstadig^ non-lazy filter
10:54gfredericksthe "free of side-effects" requirement is curious there
10:54gfredericksI think I've had that discussion before though
10:54gfredericksit just seems starker in a non-lazy function
10:58TimMcIs filter eager by one?
11:10gfrederickshow do I search for the word under the point?
11:11drewrC-s C-w C-s C-s C-s ...
11:12gfredericksdrewr: thx
11:13jsabeaudrythanks, didn't know that one, nothing like a bit of emacs-fu to start the day
11:14clgv,(source mapv)
11:14clojurebotSource not found
11:14clgv&*clojure-version*
11:14lazybot⇒ {:major 1, :minor 3, :incremental 0, :qualifier nil}
11:28TimMcclgv: Neither bot does source, I think.
11:28clgv$source mapv
11:28lazybotSource not found.
11:28octagonhaha i'm the 420th person in the room!
11:28clgv$source map
11:28lazybotmap is http://is.gd/rSYDfR
11:28octagonand auspitious number
11:28octagons/and/an/
11:30lnostdalthe heck is up with recent aleph .. it forwards and stores or even caches, internally, thread bindings .. in-between requests or something
11:35ieureCan't let qualified name: jimmies.s3/foo
11:35ieure:(
11:35ieuree.g. (defmacro with-foo [& body] `(let [foo "foo"] ~@body))
11:35ieureI _want_ to capture that symbol.
11:36gfredericksieure: use ~'foo
11:36gfredericksand feel shameful about it
11:36ieureMan what a pain.
11:36ieureThere is no shame in symbol capture.
11:36ieureWhen you want it.
11:37gfredericksieure: how would you prefer it to work though?
11:37gfredericksbackquote gotta have some way to know what to expand and what not to
11:39ieuregfredericks, I don't recall this being a problem with < 1.3.0.
11:40gfredericksI think it was the same then. And I don't know why you'd call it a "problem"
11:40ieuregfredericks, So… The way is used to, I suppose. Where I can capture any damn symbol I please.
11:40gfredericksbut how does backquote know which one's you're capturing?
11:40ieureWhy does it care?
11:40ieureCL doesn't.
11:40clgvieure: you get that same error in 1.2(.1)
11:40ieureYou want to avoid capture, use a gensym.
11:40gfredericksdoes CL qualify symbols for you?
11:49joly,(println "Quick Test")
11:50clojurebotQuick Test
11:50Bronsavery responsive clojurebot
11:51gfredericksI didn't see anyone else jumping up to type "Quick Test"
11:51gfredericksbots do the jobs nobody else wants to do
11:54fliebelQuick Test
11:54fliebelRecently on pepijndevos.nl: http://pepijndevos.nl/2012/03/13/thoughts-about-generating-stripboard-layouts.html
11:56mdeboardWhat's the command to exit the repl again please
11:56mdeboardI have forgotted
11:57metajackC-d :)
11:57mdeboardWell fine
11:57mdeboard:P
11:57metajack(System/exit 0) :)
12:01TimMcfliebel: botsnack
12:01fliebelhomnomnom, thanks, that was delicious
12:03fliebelI feel like I should throw some sort of sandbox exception now...
12:03fliebel&(system/exit 0)
12:03lazybotjava.lang.RuntimeException: No such namespace: system
12:03fliebel&(System/exit 0)
12:03lazybotjava.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
12:08TimMcfliebel: I think the most analogous thing would be if I gave you an unsafe but intriguing IRC command, such as /disco
12:08mheldhey y'all
12:08TimMcmheld: hey there
12:09fliebelmheld: botsnack :)
12:09mheldTimMc!
12:09TimMcmheld: What are you doing in this window, you're supposed to be over in screen window 2.
12:09TimMcTotally wrong IRC network and everything.
12:09mheldhaha
12:10mheldI happen to be in 5 rooms right now :-P
12:10mheldonly one of which is in ccs
12:11solussdanyone 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:11mheldsolussd: I'm working on some rails-ish extensions of noir
12:12mheldsolussd: (I'm a huge rails-lover)
12:12mheldsolussd: so I don't know if that'll sway your opinion in any way
12:19gf3guh
12:19gf3clojurescript testing
12:19gf3how does it work?
12:20gf3#magnets
12:21muhooheh
12:22TimMcmheld: What kind of extensions?
12:22TimMcMass assignment? :-P
12:23muhoofor some reason, the idea of combining rails and noir makes me a little queasy.
12:23TimMc"drinking on the train"
12:23muhoorather, i like noir, and rails makes me a little queasy.
12:23mheldTimMc: lein noir g scaffold user, lein noir g controller pages index about
12:24mheldTimMc: (defresource user)
12:24muhoothe whole idea of generated scaffold code in mvc stuff always felt like a hack to me.
12:24TimMcI've never been comfortable with scaffolding.
12:24mheldyou don't really use scaffolding in production
12:24TimMcIt strikes me as a lack of macros.
12:24muhoolike "this stuff is so verbose and spews files all over the place, let's write some helper code that does it for us"
12:25nappingyou prefer macros and their kin?
12:25dan_bif you have to generate code, your source language is insuifficiently expressive
12:25dan_bI say that as someone working ona rails app on the screen next tothis one
12:25nappingThis may be the wrong channel, but security issues and such in rails always remind me of its antithesis: http://impredicative.com/ur/
12:25muhoodan_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:25TimMcnapping: Is that Ur/web?
12:26nappingyes
12:27dan_bfor the avoidance of doubt, I'm talking here about generated code which teh user is then expected to edit
12:27dan_byacc compiles to C, clojurescript compiles to js, I'm fine with that
12:27mheld... you know that a user will have to create sourcecode at one point
12:28mheldso if you were creating a user model, you would still have to tell the framework how to render that model
12:28mheldscaffolding just automates the initialization
12:28dan_bbut it's a one-short operation
12:28mheldhmm?
12:29dan_bif you customise that view, and then you want to use the generators again to add an extra field
12:29nappingdan_b: let me misinterpret you too far - only JITed languages can be expressive
12:29dan_b... you can't, without overwriting your changes
12:29mhelddan_b: so then make it without having it be destructive
12:29mheldI don't get what the problem is
12:29muhoomheld: then maybe it's not a problem, for you anyway.
12:29dan_bhow do you propose making it non-destructive?
12:30mhelddan_b: dunno yet, but it's a solveable problem
12:30dan_bI 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:31dan_bwhich is sorta where we came in
12:31mheldwhy?
12:31clojurebotwhy not?
12:31mheldthanks clojurebot
12:31mheldwhy do things have to fit that way?
12:31dan_bbecause otherwise the generator has to be able to understand what your changes do in order to fix conflicts it creates
12:31dan_bTuring-completeness etc etc
12:32mhelddan_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:32technomancynapping: ur looks awesome
12:32nappingIt's kinda rough around the edges, but certainly philosophically opposed to many common things
12:33technomancyif I were doing web work full time I'd be mining it for ideas
12:33technomancyhint hint
12:33nappingHow would that work?
12:33technomancyhmm; no idea, that's the wonder of it.
12:34muhoothat mini-kanren post about routing components on a stripboard is interesting, but
12:34frouI 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:34muhoothere are tools already that'll route components on a pcb, and i've used them to route on stripboard just as well
12:34frouyou edit the other part of the partial class
12:34muhoothey apparently have some kind of topology algorithm already in them, plus libraries of the parts and their dimensons, etc
12:35nappingIt seems to be a thoroughly typeful approach, calculating CRUD pages from the type of a databae table and such
12:36mheldpoint being that these problems aren't unsurmountable and that ignoring them is lazy
12:36nappingmheld: a strawman alternative - the generator takes a map of overrides
12:37mheldthat could work, too
12:38dan_bfrou: in short, you edit one "resource" and the computer manages another
12:41frouyou 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:41frouthis VS example may be very pedestrian.. I'm not familiar with ruby or rails
12:42dan_bwhat I said above about protocols to avoid u & c stepping on each others toes then
12:42Wild_Catfrou: isn't that stuff deprecated in favor of a declarative UI description language?
12:43Wild_Cat(something Java desperately needs as part of its stdlib)
12:43mheldyou *could* migrateify that stuff
12:43frouyes, the XAML business. I stopped doing GUI stuff before that took hold
12:53gf3hey ibdknox, do you know how I can include google closure libraries with lein-cljsbuild?
13:04dnolenejackson created a nice shiny new tutorial for core.logic - https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer
13:04dnolenoops, meant to paste http://github.com/clojure/core.logic/wiki/A-Core.logic-Primer
13:09devn:( cljs-template wont install on lein 2 for me /cc ibdknox technomancy
13:16devnah, looks like 0.1.4 isn't on clojars yet
13:17dnolenanyone tried lein-navem?
13:19TimMc"navem"?
13:19TimMcIs that a thing or a typo?
13:21antares__TimMc: that's a plugin that turns pom.xml into project.clj or something like that
13:21devn"lein-navem is a lein plugin that converts a maven pom.xml into a project.clj"
13:22thickeyi've used it, but i wrote it, so i don't count
13:22thickeyfeedback welcome
13:22devnha
13:26mheldI'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:26mheldis that kosher?
13:27halarnold2000he meant lein-nevam
13:28bitrotlein-navem was born a poor java child.
13:32solussdmheld: 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:33solussdmheld: certainly looks up to the task...
13:34mhelddefinitely a REST api
13:34mheldand definitely a small web app
13:35mhelderm, by (defmacro thing [arg] `(do (~arg methodcall))) I meant (defmacro thing [arg] `(do (~arg/methodcall somevalue)))
13:35solussdmheld: how about a large web app? :D
13:35dnolenthickey: 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:36mheldsolussd: not sure
13:36mheldsolussd: I've never built anything large with it
13:37dnolenthickey: https://gist.github.com/2038112
13:37solussdmheld: 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:39thickeydnolen: 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:39dnolenthickey: thx, much!
13:50h0x5f3759dfHi, Is this the functional way of doing bfs in clojure? https://gist.github.com/ce8773ccc838f0a48100
13:58mefestois there a function in compojure for redirects?
13:58Raynesmefesto: There is one in noir.
13:58RaynesSo probably not.
13:58mefestoah
13:59RaynesUsually things that are in noir are in addition to what are in compojure and not duplicate functionality.
14:23thickeydnolen: give [lein-nevam "0.1.1"] a try
14:27dnolenthickey: sweet!
14:28dnolenemezeske: btw, lein-cljsbuild *rocks*. have you looked much at the issues when using it with lein2?
14:29emezeskednolen: thanks!
14:29emezeskednolen: I basically got it to the point where it would "sort of run" on lein2
14:30emezeskednolen: Hopefully next week I can switch to using lein2 for everything, in which case I'll probably fix the bugs
14:30dnolenemezeske: gotcha, most things seem to work but the REPL tasks do not.
14:31dnolenemezeske: I also wonder if the trampoline bit couldn't be hidden behind lein-cljsbuild itself.
14:31emezeskednolen: Ah, that's a bummer.
14:31emezeskednolen: Yeah, actually, lein2 adds some kind of aliasing, and I plan to hide the trampoline stuff with it
14:31emezeskeThat's a long word to type
14:32dnolenemezeske: nice! I'm getting bit eager since I've got my JSConf presentation coming up :)
14:32emezeskednolen: Oh? Talking about clojurescript there?
14:32dnolenemezeske: being able to manage client side library dependencies this way is pretty slick coming from copy-paste JS workflows.
14:32dnolenemezeske: yes
14:33emezeskednolen: Nice!
14:33jsabeaudryIs the clojure/java mmap the same as the posix one? Will that call the mmap in the file_operations of my kernel module?
14:33emezeskednolen: Glad to hear that it's useful. It's cool that it works that way
14:38dnolenemezeske: 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:38technomancyin 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:39technomancyjust check the leiningen.trampoline-file system property
15:01muhooafter playing around with clojure, having to do actual paid work in php makes me want to cry.
15:01emezeskednolen: Cool. I doubt the repl problem is anything super hard to fix
15:01emezesketechnomancy: Ooh, very cool
15:02tmcivermuhoo: ain't that the truth.
15:02muhootmciver: https://refheap.com/paste/1064
15:02muhooi'm sure there's a 1liner in clj that'd do that.
15:03Tweymuhoo: http://lukeplant.me.uk/blog/posts/why-learning-haskell-python-makes-you-a-worse-programmer/
15:03Twey(applies to Clojure just as well)
15:03muhooi should play around with pharen some more
15:03tmcivermuhoo: yeah, but then you wouldn't have that cool deeply-nested look!
15:05muhoo"don't bother improving yourself, unless you have the freedom to improve your environment accordingly." <-- that is the key right there
15:06muhoothat's actually quite deep, as well as quite depressing.
15:06muhooit's true about not just programming, but anything.
15:08VinzentIs it possible somehow to alter static var?
15:09muhoowell 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:20llasramVinzent: What do you mean by "static var"?
15:20llasrammuhoo: Wow. I wish you hopeful luck :-)
15:21Vinzentllasram, a var with :static true in its metadata, see e.g. map, filter and other clojure.core functions
15:23llasramAh, 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:25Vinzentllasram, well, when I'm trying to alter it, I'm getting "Evaluation aborted" and then swank connection just closes.
15:27llasramVinzent: 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:28TimMcTwey: "The other C++ guys on the team still look at my code like it's got legs" is pretty excellent.
15:32Vinzentllasram, hm, then probably the swank server uses map, so when I alter it things break down. Thanks.
15:32llasramWell, `map' is a pretty fundamental operation :-)
15:32llasramWhat are you trying to do with it anyway?
15:37Vinzentoh, I'm just playing with contracts
15:37zakwilsonDo most people just use clojure.test for testing, or is there something more fancy that's worth a look?
15:38Vinzentzakwilson, midje totally worths a look
15:38zakwilsonWow. It has an infomercial.
15:39llasramhaha. Midje lets you do a lot of nice stuff, but I haven't quite figured out some details of workflow around it
15:44llasramIn 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:44llasramsome easy solution I just haven't realized yet
15:45TimMc`fogus: Does Marginalia have a mechanism for hooking in and adding/modifying the HTML for a var based on metadata?
15:46Vinzentllasram, hm, what do you mean? With clojure.test you also have to compile ns first, no?
15:47llasramVinzent: Sure, but deftest just squirrels off the actual test code to run later. Midge `facts' run their test content when evaluated
15:48Vinzentllasram, yes, but what's the problem with that?
15:48llasramYou can't compile a midje testing namespace without running all tests it contains :-)
15:48zakwilsonibdknox: 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:49Vinzentyes, but... what's the problem with that? :)
15:50llasramIt 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:51zakwilsonRunning the test when evaluated sounds good except when I want to set up some state before running the test.
15:51`fogusTimMc: It does not
15:52Vinzentllasram, 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:52Vinzentzakwilson, you can do it with midje's background form
15:52llasramzakwilson: Midje actually has really nice support for setup and teardown and advanced variants thereof.
15:52llasramwhat Vinzent said :-)
15:53zakwilsonOk, I'll try it.
15:53llasramVinzent: 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:54llasramVinzent: And I have not yet tried lazytest, but I keep meaning to
15:55technomancyside-effects at compile-time make me frown-facey =(
15:57ieureIs it possible to let a symbol in a different namespace?
15:57technomancyieure: let only applies to locals
15:57ieureExample: 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:57technomancymaybe you're thinking of binding?
15:58ieuretechnomancy, Isn't that only for thread locals?
15:58technomancyit's for thread-local "changes" to dynamic vars, yes
15:58technomancyif it's for testing you might find with-redefs more to your liking
15:59Vinzentllasram, 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:01Vinzentieure, by the way, I believe in midje you could write something like (provided (deref your-agent) => some-value) :)
16:02ieureVinzent, Nice, but I don't want to port my tests.
16:03TimMc`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:03ieuretechnomancy, I can't use bind or with-redefs on syms in a different ns, either.
16:03llasramieure: You totes can use with-redefs on symbols from other namespaces
16:04TimMc`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:04ieurellasram, Can you point me to some example then, please?
16:04Vinzentieure, why can't you, are they private or what?
16:04gozalaHi folks I'm trying to learn about clojure protocols
16:04gozalaand types
16:04ieureVinzent, Nothing is private.
16:05gozalais there something like extend-type default in clojure ?
16:05dnolendamn takeoutweight got Clojure running on iOS via clojure-scheme
16:05technomancyieure: should be able to actually
16:05dnolengozala: yes extend-type Object
16:05technomancyieure: also, start thinking in terms of vars, not symbols
16:05gozaladnolen: thanks!
16:05gozaladoes that also works on clojurescript
16:06gozalaor I need extend-type default there instead ?
16:06technomancy,(binding [clojure.core/*assert* false] true)
16:06clojurebottrue
16:06dnolengozala: no, but js/Object might work in the future. for now you need extend-type default
16:07gozaladnolen: thanks
16:07Vinzentieure, then what's the problem? just :use it and write (with-redefs [your-agent temp-value] ...)
16:07ieureVinzent, I think I was getting tripped up with vestigal code.
16:08technomancyieure: generally symbols are uninteresting after compile-time
16:10llasramieure: https://refheap.com/paste/1066 if still relevant
16:10ieurellasram, Thanks, I appreciate it.
16:13Vinzentdnolen, 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:19TimMcVinzent: I think performance characteristics are included in the definitions of some things like 'case'.
16:19TimMcIt may be that JS doesn't support that kind of language construct?
16:20aperiodicwith leiningen 1.7, is there a way to programatically generate an uberjar from inside the project?
16:21VinzentTimMc, yes, it's exactly the case. But slower working code is better than not working code at all?
16:22technomancyaperiodic: no, the project process should be basically unaware that it's running from within leiningen
16:23gfredericksVinzent: it might be considered misleading; but this kind of thing could be solved by a library that defines the missing functions, right?
16:23technomancyyou 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:24TimMcVinzent: Make a lib called close.enough and put a case macro in it. :-P
16:24Vinzentgfredericks, 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:24VinzentTimMc, ^^
16:24gfredericksVinzent: that is not a goal
16:25gfredericksat least not for whole applications
16:25TimMcNot a *primary* goal for sure.
16:26gfredericksVinzent: 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:26aperiodictechnomancy: 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:26Vinzentoh, ok. I've just seen all this code sharing features in cljsbuild, and it made me think that it's an important one
16:26gfredericksVinzent: 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:27Vinzentgfredericks, yeah, this makes sense.
16:27`fogusTimMc: Propose away. We're always looking for ways to make Lein more awesome. :-)
16:27gfredericksI think fake-clojure-for-cljs would be an interesting lib to start :)
16:31gfredericks(System/exit) could try to close the browser window
16:33Vinzentgfredericks, hah, sounds interesting :)
16:35TimMcgfredericks: In Mozilla browsers, you *can* interop with Java.
16:35gfredericksTimMc: stop that's obscene
16:36TimMcProblem?
16:36clojurebotPeople have a problem and think "Hey! I'll use a regular expression!". Now they have two problems....
16:37TimMcThat too.
16:37TimMcApplets are the way of the future.
16:37amalloyclojurebot: any more trite overused quotes?
16:37clojurebotIt's greek to me.
16:37TimMc:-D
16:38gfredericksclojurebot: greek?
16:38clojurebotNo entiendo
16:39gfredericksnow he's just being clever
17:00yoklovwell, this is probably the weirdest piece of code i've ever written
17:00yoklovhttps://github.com/thomcc/unlambda-clj/blob/master/src/unlambda_clj/core.clj
17:04cjfriszclojurebot: Are you really cleverbot?
17:04clojurebotGabh mo leithscéal?
17:07dnolenVinzent: sounds like rhickey agrees w/ you, so we'll probably see case in CLJS soon.
17:07juhu_chapa-quit
17:07Vinzentdnolen, oh, that's a good news!
17:07TimMcHuh, I wouldn't have expected that.
17:08dnolenTimMc: I think lang compat trumps everything else.
17:10TimMcI mean, I'm happy -- just surprised. :-)
17:13amalloythat 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:15amalloyadding case costs basically nothing, though, so i'm glad he decided to emphasize compatibility
17:15clojurebotHuh?
17:15dnolenamalloy: large apps involve host-y stuff - but the core language bits should just work.
17:18dnolenanyone see any problems w/ CLJS using Google Closure HEAD?
17:21gozalaanyone cares to explain what's wrong with
17:21gozala(def foo (if (resolve 'foo) foo :fallback))
17:24Vinzentgozala, mm, isn't it the same as defonce?
17:24dnolengozala: side note, resolve is kind of a last resort thing.
17:25gozalaVinzent: I did not knew about defonce
17:25gozalathanks
17:25gozaladnolen: what's idiomatic way to check if something is defined then ?
17:26dnolengozala: checking if something is defined is not very idiomatic.
17:26rahcolahow do you eval code in a buffer to user ns when using emacs+slime?
17:26rahcolaor do you guys use some other way of working?
17:27dnolenrahcola: C-c C-k, for compile file
17:27rahcolathat is, when the code in the buffer is in some ns foo.bar or something
17:27Raynesdnolen: I've had valid reasons for doing that before.
17:27gozaladnolen: I see
17:27dnolenRaynes: I didn't say there weren't valid reasons, just that it's a sign of doing something unusual
17:27gozaladnolen: so what I'm trying to do is to define my abstraction via protocol
17:28tmciverrahcola: 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:28RaynesAnyways, to actually answer the question, bound?
17:28gozalaand since I need to use Object in clojure and default in clojurescript
17:28gozalaI need to see if default is defined
17:28cjfrisztmciver: I love when you guys answer questions I didn't think to ask
17:28ohpauleezIs there a reason Clojure's google-closure-jar doesn't include the theird-party?
17:28ohpauleezthird*
17:28rahcolatmciver: will new defs made in the repl get added to the file's ns?
17:28gozalaor is there some more idiomatic way to do that ?
17:29rahcolai would like to take a defn from the file, and test it in the repl while not messing with the file's ns
17:29tmciverrahcola: yes, if you def them once you're in that ns; not before (I don't think).
17:29dnolengozala: 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:30dnolengozala: 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:32gozaladnolen: what is the best way to define your own purely clojure based & new data structure then ?
17:32dnolengozala: define it twice once for Clojure once for CLJS. deftypes will often be polluted with host specific information.
17:32gozalaI was assuming if I just start from scratch there should be a way to define it so that it works in both worlds
17:33dnolengozala: what matters is the code that will *use* the deftype can remain the same.
17:34rahcolatmciver: 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:35gozaladnolen: well I guess I have to break it first to learn more, thanks!
17:35dnolengozala: yes, cheers :)
17:35TimMcgozala: Maps. Lots of maps.
17:36dnolenTimMc: heh, and +1
17:36gozalaTimMc: sorry I don't get it
17:36dnolengozala: if you just program around maps you can avoid all these tricky decisions.
17:36TimMcgozala: Most of the time, structured data can be represented very easily as maps.
17:37TimMc{:type :foo, :amount 6, :class :gold}
17:37dnolenthat was my point of about it being an unwise use of time trying to get a deftype to work across CLJ and CLJS
17:37gozalaTimMc: dnolen In fact what I'd like to do is try to port my js lib
17:37gozalahttps://github.com/Gozala/streamer
17:37gozalaso I started with defining Deferred protocol
17:38gozalaand then I'd like to define type that would implement regular sequence protocols
17:38tmciverrahcola: 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:39technomancypssh; I don't know anything about swank
17:39gozalaso yeah I'll be playing with maps but I need to get there first :)
17:39tmciverOK, I take it back. technomancy taught me nothing about swank ;)
17:40technomancybut yeah, I would like to have some way of doing ns-unmap. currently there's nothing exposed from slime.
17:40tmcivertechnomancy: yes, that would be a cool feature.
17:40technomancyoh wait, I lied
17:40technomancyI just got a pull request for that
17:40technomancylet me push to clojars
17:40metajackHow 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:40technomancymetajack: it has completion
17:41metajacktechnomancy: ah, nm. i was already in that namespace, so it has a slightly different behavior then
17:41technomancyalso, it should be pre-filled if the current buffer's ns is different from what the repl's currently in
17:41technomancyrahcola, tmciver: C-c C-l should clear the given ns now under 1.5.0-SNAPSHOT
17:42ohpauleezibdknox: THANK YOU for goog-jar
17:42ohpauleezI was just making one and thought, "Wait, How did Chris get around this?"
17:43rahcolatechnomancy: have to test that right away, after i'm done with this rabbit hol...feature
17:43technomancyrahcola: let me know; I haven't tried it myself =)
17:44rahcolanasty things happen when your tests use names that are no longer valid, but yet still defined
17:45technomancywe call that "getting slimed"
17:46technomancyprobably not a good sign when your development tool has an entire class of mistake named after it but WHATEVER
17:46gozaladnolen: I have another mystery to solve now
17:47gozalaif I use extend-type on Object it works
17:47gozalabut if I (def foo Object)
17:47rahcolaalways nice to know what hit you
17:47gozalaand then do (extend-type foo … it does not
17:48gozalawith exception Unable to resolve classname: default
17:48gozalaAm I missing something ?
17:49dnolengozala: you need a symbol that represents a class
18:01rahcolatechnomancy: what version of leiningen does swank-clojure 1.5.0-SNAPSHOT require?
18:02technomancyrahcola: it won't work with 1.6.2 or older
18:03technomancyactually that's not right; it should work
18:03rahcolathe swank task disappeared when I did lein plugin install 1.5.0-SNAPSHOT
18:03rahcolawith the swank-clojure in there :)
18:03technomancyyeah you need to use lein-swank now
18:03technomancywait cripes
18:04technomancylein-swank doesn't let you override the swank version used in 1.x
18:04technomancylet me fix that
18:04rahcolaand do I also need to upgrade clojure-mode?
18:04rahcolabecause clojure-jack-in seems to use lein swank
18:06technomancyno, clojure-mode can be left alone
18:10rahcolagot "Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.
18:10rahcolafrom clojure-jack-in
18:10technomancyrahcola: ok, lein-swank 1.4.4-SNAPSHOT will only specify its preferred version of swank-clojure if you haven't already got one
18:11technomancywhich lein version?
18:12rahcola1.7.0
18:12rahcolabut I do not have any :plugins entries
18:12technomancyyou should be able to put [lein-swank "1.4.4-SNAPSHOT"] in :plugins
18:13rahcolatrying that now
18:13technomancyoh, but you want it user-level
18:13technomancyI guess lein plugin install lein-swank 1.4.4-SNAPSHOT would probably work
18:22sjlanyone know how I can build or clauses dynamically with Korma? This doesn't work: http://cljbin.com/paste/4f6119dee4b04ca9bce903d9
18:23rahcolatechnomancy: ok, got lein-swank 1.4.4-SNAPSHOT working using :plugins
18:24rahcolabut load file does not seems to clear the ns
18:24rahcolabtw, is plugin install still the prefered way for installing dev stuff like swank on leiningen?
18:25TweyTimMc: Haha, indeed :þ
18:25TweyTimMc: That's pretty much how people look at all my code, I think.
18:26technomancyrahcola: "lein plugin install" is the preferred way to install plugins that are intended to address user convenience issues in leiningen 1.x, yes
18:26technomancysome plugins are necessary for builds to succeed (lein-midje, lein-tar, etc) and must go in :plugins in project.clj
18:29rahcolahmm.. seems that we should update our project.clj, got lein-midje in :dev-deps
18:30technomancywell if you want to support versions of leiningen older than 1.7 then you still need dev-deps
18:30rahcolaits a hobby project, and I'm itching to go for 2.0 :)
18:32technomancycool
18:37metajacksjl: query needs to be generated from one of the * functions. like select*
18:38sjlmetajack: yeah, I did that
18:38sjlmetajack: I can modify it after initial generation fine, e.g. by reducing where clauses onto it to get dynamic ANDed queries
18:39metajackoh you need (exec) at the end too
18:39sjlmetajack: yes, I already have that too
18:39sjlmetajack: the issue is that I can't seem to do something like (apply or [vector of predicates generated at runtime])
18:40metajacksjl: https://github.com/ibdknox/Korma/blob/master/src/korma/sql/engine.clj#L314-321 that doesn't look promising for or queries
18:41metajackthere is an or predicate though
18:43metajackhmm. 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:44augustlif I use clojure to build a project, can I consider that project free software? Real question: is the/a JVM considered free?
18:47augustlalso, will clojure run on JVM's such as JamVM, dalvik, etc? (As you can tell, I'm new to jvm :)
18:47sjlmetajack: yeah, but I need to a) use like, not in and b) build the field names at runtime, not the values
18:48metajacki can't get any sensible output for the or operators
18:48sjlibdknox: ping?
18:49metajacksjl: 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:49sjlmetajack: yeah, that's what I'm beginning to fear
18:49aperiodicaugustl: haven't tried it myself, but i've heard that clojure is quite slow on dalvik due to its garbage collector
18:50augustlaperiodic: I see
19:22slyrustechnomancy: I assume I need lein1 to build lein2?
19:26technomancyslyrus: if you're building from git, yes
19:26technomancybut the preview2 release will self-install itself
19:28slyrusok, yeah, I just pulled from git. thanks.
19:30mefestoanyone 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:31mefestothat was it :)
20:19dnolenbroken Node.js support in CLJS finally fixed
20:20emezeskednolen: woot!
21:24amalloymefesto: btw, setq is like clojure's let, in that it accepts pairs
21:24amalloyaw, i just missed him
21:30johnmn3I'm having trouble with circular namespace dependencies
21:31johnmn3Suppose I have a bunch of gui functions in space.gui
21:31johnmn3and a bunch of logic that gets fired off if someone presses a button in space.actions
21:32qbgjohnmn3: It is easiest to just refactor the code to eliminate the circularity
21:32johnmn3so like, the Fire button has an action that calls space.actions/asplode
21:33johnmn3but, in space.actions/aslplode, you want it to affect some change in the gui, in space.gui
21:33johnmn3like space.gui/place-explosion
21:34johnmn3now I have each calling each other.
21:34qbgIndirecting through a message bus is one technique
21:34johnmn3I did have everything in one file, which worked
21:35johnmn3Now I'm trying to break it up by functional areas and I'm trying to figure out how to organize it.
21:36p_lanyone 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:36amalloyjohnmn3: don't mutate the gui from the action, then. return a data structure representing changes you want the gui to make
21:36johnmn3qbg: 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:36amalloyp_l: www.4clojure.com is one option
21:37johnmn3how would that work?
21:37p_lamalloy: thanks
21:38johnmn3which function generates the datastructure, space.gui/button or space.action/asplode or space.gui/place-explosion?
21:38johnmn3and how does it get passed around, I'm confused.
21:39amalloymy suggestion was asplode, probably
21:39johnmn3Do you mean, like send the state into the space.action function and have it return the modified state to the main namespace?
21:40amalloybutton calls asplode, looks at the data structure returned, and makes gui changes if necessary
21:40johnmn3so that space.action doesn't have to call into our main namespace?
21:40johnmn3right
21:40amalloyeg, asplode returns {:place-explosion ...}
21:41johnmn3I 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:41qbgAlternatively, 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:41johnmn3qbg: that's actually what I'm trying to do
21:42johnmn3I 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:43qbgThe controller registers callbacks in the view
21:44qbgThe dependency on the controller that the view has is injected by the controller
21:44johnmn3so I'm using seesaw.
21:44johnmn3and normally youd do: (button :action (action :handler #(stuff...
21:45johnmn3how do you do call backs in swing?
21:45qbg.addEventListener
21:45johnmn3ah
21:46johnmn3oooh k
21:46qbgYou should be able to indirect the action through an atom containing command -> fn mappings
21:46qbg(if you don't want to drop down to straight swing)
21:47johnmn3just founed seesaw.core/listen
21:47johnmn3found
21:48qbgI've never used seesaw, so I can't give the best advice on that end
21:48johnmn3so I think you solved my riddle
21:48johnmn3'listen is the ticket, I think
21:51gtuckerkelloggi know it's short already, but is there a better alternative to (partition 2 (interleave l1 l2))?
21:51qbg&(map vector (range 0 10) (range 10 20))
21:51lazybot⇒ ([0 10] [1 11] [2 12] [3 13] [4 14] [5 15] [6 16] [7 17] [8 18] [9 19])
21:51qbgIs that basically what you want?
21:53qbgLooks like it
21:55TimMcgtuckerkellogg: And if this is for a function f that consumes both... (map f l1 l2)
21:59gtuckerkelloggl2 is a list of sets, i want to filter out empty sets before stuffing them into a hash-map
22:00gtuckerkelloggwhat i have now is (into {} (filter not-empty (partition 2 (interleave l1 l2)))
22:00gtuckerkelloggwhere not-empty is (fn [[_ v]] (not= v #{}))
22:00TimMc&(doc filter)
22:00lazybot⇒ "([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:01TimMcHmm, not multi-arity.
22:01sjlgtuckerkellogg: (comp seq second) instead of not-empty?
22:02sjlgtuckerkellogg: or I'd probably use remove instead of filter and use (comp empty? second) to be more clear
22:02TimMcOoh, good call.
22:02sjl"remove elements where the second item is empty"
22:02TimMcSuddenly readable.
22:03gtuckerkelloggoh that's nice
22:03gtuckerkelloggor (comp empty? val), I suppose, since it's destined or a hashmap
22:04sjl&(val [:a :b])
22:04lazybotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry
22:04sjlgtuckerkellogg: yeah, I don't think you can use val on a pair
22:04gtuckerkellogg:(
22:07simardI'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:07mdeboardsimard: Yes, https://github.com/flatland/clojail
22:07sjlsimard: sounds like you're looking for https://github.com/flatland/clojail
22:07simardI love this place :D
22:08mdeboardI love WINNING
22:08simardso, let me ask the phony question, is that quite safe ?
22:09simardas long as policy is properly defined, that is
22:09amalloyi 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:09sjl&(str "I hope so")
22:09lazybot⇒ "I hope so"
22:10mdeboardMaybe 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:11simardmdeboard: that sounds correct :)
22:11simardI guess I'll have to look up for that word again.
22:11mdeboardvoila
22:12RickInGAsimard here is a lecture about it from clojure conj 2011 http://blip.tv/clojure/anthony-grimes-clojail-life-in-the-clojure-prison-5919720
22:15TimMc$mail samaaron <3 <3 <3
22:15lazybotMessage saved.
22:15TimMcI have a new toy: (demo 30 (pan2 (apply + (sin-osc [(mouse-y:kr 50 500) (mouse-x:kr 50 500)]))))
22:15simardRickInGA: 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:21sjlis there a ceil function hiding somewhere in 1.3+'s core?
22:22TimMc&(Math/ceil 4.5)
22:22lazybot⇒ 5.0
22:22sjl&(Math/ceil (/ 2 3))
22:22lazybot⇒ 1.0
22:22sjlperfect, thanks
22:30ibdknoxsjl: you pinged?
22:30RickInGAif I install lein-newnew does lein new stop working?
22:30ibdknoxRickInGA: all the functionality of the original new should still be there :)
22:31sjlibdknox: yeah, I'm trying to do something like this in Korma: (-> some-query (apply or [{:name [like "foo"]} {:username [like "foo"]}]))
22:31sjlibdknox: basically building an or clause at runtime instead of hardcoding it in
22:32ibdknoxsjl: let me verify but that should be fine as long as you call pred-or instead of or
22:32sjlibdknox: is that possible?
22:33sjlibdknox: Hmm, I tried it with pred-or but it didn't work either.
22:33ibdknoxwell, you'd need to quote like
22:34ibdknoxwhat was the error you got?
22:34RickInGAibdknox 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:34sjlhmm, I don't remember, let me find it again
22:35ibdknoxsjl: this worked for me: (sql-only (select :blah (where (apply fns/pred-or [{:name "cool"} {:cool "woot"}]))))
22:35pandeiroi want to slurp a binary file from a url and save it to disk, do i need java for that?
22:35ibdknoxRickInGA: hm, no that should just work :(
22:35sjlibdknox: well first it can't find the like symbol
22:36ibdknoxyeah it doesn't exist
22:36ibdknoxthough it you put it in the where
22:36ibdknoxit should be ok
22:36RickInGAibdknox I deleted newnew from plugins and then lein new <proj> worked….
22:36RickInGAibdknox must be something in my configuration that is causing a confligct
22:37ibdknoxRickInGA: hm :/ maybe we can take a look tomorrow, not sure I can necessarily fix it, but maybe
22:37ibdknoxsjl: I think you just need to wrap the where around there actually
22:38ibdknoxyou can still use or
22:38ibdknoxthough if those maps come from outside of the where clause
22:38ibdknoxyou'll need to quote the like
22:38simardamalloy: 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:38ibdknoxsjl: {:name ['like "woot"]}
22:39amalloyrunning 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:39RickInGAibdknox the good news is, I can reproduce it! I just reinstalled newnew and I am crashing again :)
22:39tomojI thought this should work: (io/copy (io/input-stream url) (io/output-stream filepath))
22:39tomojbut it seems to not copy the whole thing?
22:39tomoje.g. (io/copy (io/input-stream "http://www.google.com/logos/2012/yoshizawa12-hp.jpg&quot;) (io/output-stream "/tmp/doodle.jpg"))
22:39ibdknoxRickInGA: hah, at least it's consistent ;)
22:39tomojwhere io is clojure.java.io
22:39simardamalloy: I guess process intercommunication might be a bit of a problem right .. :)
22:40amalloyseriously though, don't use clojail to monitor artificial hearts or anything. it will break
22:41simardno, 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:41RickInGAi doublt clojure will break as many hearts and perl has!
22:43amalloythe main issue is that we don't have reliable ways to cordon off memory usage or thread usage
22:43tomojsimard: you might look into running inside lxc
22:43tomojseems like you could even allow filesystem access etc there
22:44pandeirotomoj: thanks it's as easy as (spit f (slurp url)), apparently
22:44tomojpandeiro: really?
22:44tomojdon't think that should work on some binary files
22:45pandeirotomoj: i haven't tested the files yet but they were written at least
22:45sjlibdknox: ok, cool, I think I got it working now
22:45sjlibdknox: I don't suppose there's a way to do this that's not relying on fragile internal stuff?
22:46ibdknoxsjl: it doesn't rely on any internal stuff
22:46ibdknoxthis totally works:
22:46ibdknoxsjl: (sql-only (select :blah (where (apply or [{:name [like "cool"]} {:cool "woot"}]))))
22:46sjlibdknox: (use [korma.internal.sql :only (pred-or)])
22:46ibdknoxyou don't have to use that
22:46ibdknox:)
22:47simardtomoj: interesting, but that's Linux only I presume
22:47ibdknoxalso you should use 0.3.0-beta5
22:47sjlibdknox: ah, I used what the README told me to use.
22:48ibdknoxyeah, I'll update all of those soon. 0.3.0 is stable
22:48ibdknoxjust general improvements happening here or there
22:48metajackany 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:49ibdknoxmetajack: you're calling (:use ..) on geohash.core
22:49metajackibdknox: 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:50ibdknoxunfortunately I'm of little time as of late
22:50metajackibdknox: It's pulled in via require actually
22:50metajackwhy would that cause a NullPointerException on compile though?
22:51ibdknoxmetajack: what is this: guzzle.utils.index_all_tickets
22:52metajackit's a namespace with :gen-class and a single function -main. it pulls in a few things and does a small job
22:53metajacklein has :aot [guzzle.daemon guzzle.utils.index_all_tickets]
22:54metajackif 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:56amalloya namespace with underscores in its name sounds extremely dangerous
22:56metajacksorry, it's dashes
22:56simardamalloy: 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:56metajacki typoed that line
22:57metajackthe source file has underscores, but the ns is dashes. this is the correct way i believe
22:58amalloyjust the clojail part; clojail takes care of moving into and out of the protected mode
22:59simardamalloy: 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:02tomojsimard: right..
23:02tomojI was thinking server side
23:02tomojwhy use clojail client side?
23:03simardtomoj: I initially asked for the server side, so you were right about that
23:03daakui'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:03simardI changed my mind midway .. :)
23:04simardtomoj: 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:04simardright = write
23:05aperiodicwell, 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:06simardexactly
23:06simardsecurity 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:06aperiodicso what's the point of using clojail, then?
23:08simardthe 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:08simardI want to build a DSL above clojure to help them script the game
23:08simardbut I don't want them to run into trouble too often
23:09simardnow that absolute security is not really needed, clojail sounds fine for the job.
23:09simardaperiodic: does that make sense ?
23:10aperiodicah, right, clojail lets you set execution time ceilings
23:11metajackfyi, fixing the refer-clojure issue for geohash made the compile succeed. It seems it's not really a warning at all :)
23:12RickInGAthis core.logic primer is fantastic! bit.ly/ymYvrd
23:27amalloydaaku: (cons `do (...))
23:46sridhas anyone written a clojure wrapper for the evernote api?
23:48daakuamalloy: ah! that worked. makes a lot of sense now that i think about it.