#clojure logs

2013-10-08

00:07logic_progis cursive clojure open source ?
00:08coventrylogic_prog: No. http://cursiveclojure.com/eap.html
00:08logic_progcoventry: nice, thanks!
00:10TEttingercoventry, gfredericks, be careful with getInstanceFields. ##(let [gimme (fn [item] (map #(clojure.lang.Reflector/getInstanceField item %) (map (memfn getName) (.getFields (class item)))))] (gimme {:a 1}))
00:10lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Reflector is bad!
00:10TEttingerwell oh well.
00:10TEttingerit errors with cannot find a static field
00:10TEttingerIllegalArgumentException No matching field found: EMPTY for class clojure.lang.PersistentArrayMap clojure.lang.Reflector.getInstanceField (Reflector.java:271)
00:12coventryTEttinger: Thanks for the warning.
00:15TEttingerhm, .getFields seems to not return very many fields
00:16TEttinger,(count (.getFields (class (java.util.HashMap.))))
00:16clojurebot0
00:21TEttingeroh man...
00:22TEttingerit's only finding static public fields, because private fields have setters/getters
00:22TEttingerat least for java code
00:26amalloy,(count (.getDeclaredFields java.util.HashMap))
00:26clojurebot10
00:27amalloyTEttinger: (class (Foo.)) is silly in like all cases - just write Foo
00:27TEttingeritem is an argument?
00:27TEttingeroh
00:27TEttingerI took that later bit from earlier code
00:28TEttingeramalloy, but won't declared fields not include inherited ones?
00:29amalloyright. you have to walk up the inheritance tree for those, since they're not in .getFields or in .getDeclaredFields
00:31crocketHow does clojure provide modularity?
00:32eggheadfunctions, maps, protocols, namespaces
00:32crocketegghead, many languages provide that already.
00:33crocketI'm talking about OSGi's advanced modularity system.
00:38eggheadcrocket: anything in particular or just want to use the osgi classloader
00:38crocketegghead, Do clojure people plan to improve modularity to the level of OSGi?
00:39crocketclojure has already got out of JVM(ClojureScript).
00:39crocketI think clojure needs its own modularity
00:39eggheadyou'd have to be a little more clear about what you mean by modularity, I think
00:39eggheadif you mean 'standalone units of abstraction which can be composed with other abstract units' then ya it does that quite well
00:40crocketmultiple versions of the same library should be easy to handle
00:40crocketEach module needs to have a clear boundary.
00:40crocketOSGi provides service layer.
00:40eggheadyou're talking about package management then?
00:40crocketIt's clear that modules have versions.
00:40crocketIt's modularity.
00:43crocketegghead, How does clojure deal with multiple versions of the same lib?
01:08wei_is there a good thumbnail generation library?
01:08EchoBot1Echo: is there a good thumbnail generation library?
01:08mtpit's a little gauche to test "bots in a language" in the language's channel
01:08EchoBot1Echo: it's a little gauche to test "bots in a language" in the language's channel
01:09mtpespecially when they're bots like that
01:09EchoBot1Echo: especially when they're bots like that
01:16TEttinger`msg EchoBot1 die
01:16EchoBot1Echo: `msg EchoBot1 die
01:16logic_progis there a way to tell speedbar (maybe etags?) to show clojure functions defined with "defn" but not clojure functions defined with "defn-" ?
01:16EchoBot1Echo: is there a way to tell speedbar (maybe etags?) to show clojure functions defined with "defn" but not clojure functions defined with "defn-" ?
01:16EchoBot1Echo: die
01:17EchoBot1Echo: die
01:17TEttingertechnomancy, ops, kban?
01:17EchoBot1Echo: technomancy, ops, kban?
01:18Apage43what a heinous piece of software
01:18EchoBot1Echo: what a heinous piece of software
01:19indigoWow, first time I've seen this kind of crap
01:19EchoBot1Echo: Wow, first time I've seen this kind of crap
01:19TEttingereveryone, /ignore ?
01:19EchoBot1Echo: everyone, /ignore ?
01:23dcunit3dwei_: you could try using java.awt.BufferedImage
01:23EchoBot1Echo: wei_: you could try using java.awt.BufferedImage
01:24wei_looking at it now, thanks dcunit3d
01:24EchoBot1Echo: looking at it now, thanks dcunit3d
01:25jonasendnolen: ping
01:25EchoBot1Echo: dnolen: ping
01:25dnolenjonasen: pong
01:25EchoBot1Echo: jonasen: pong
01:25dcunit3dwei_: there is also this library https://github.com/mikera/imagez
01:25EchoBot1Echo: wei_: there is also this library https://github.com/mikera/imagez
01:26wei_wow, fairly recent. looks good.
01:26EchoBot1Echo: wow, fairly recent. looks good.
01:27wei_I think we need a second Echobot in here ;)
01:27EchoBot1Echo: I think we need a second Echobot in here ;)
01:28seangrov`wei_: Just a simple /ignore ;)
01:28EchoBot1Echo: wei_: Just a simple /ignore ;)
01:29nightfly/part
01:29EchoBot1Echo: /part
01:29logic_proghow is clojure-mode talking to speedbar ?
01:29EchoBot1Echo: how is clojure-mode talking to speedbar ?
01:29logic_progis it using etags, or iemnu?
01:29EchoBot1Echo: is it using etags, or iemnu?
01:29logic_proghow is clojure-mode providing the tags ?
01:29EchoBot1Echo: how is clojure-mode providing the tags ?
01:29logic_progjust ignored Echobot1.
01:29EchoBot1Echo: just ignored Echobot1.
01:30logic_progtesting again
01:30EchoBot1Echo: testing again
01:30dnolenjonasen: applied to master
01:30EchoBot1Echo: jonasen: applied to master
01:41jonasendnolen: thanks
01:41dnolenjonasen: np
01:42dcunit3ddoes the other bot have echobot ignored lol
01:44TEttingerdid someone kick echobot1?
01:45TEttingernope, I think he's logic_prog's
01:47crockethey
01:48TEttingercrocket: ?
01:48crocketHow does clojure handle multiple versions of the same lib?
01:49TEttingerthere's an option in lein to warn or abort on it, I'm not sure if you mean transitive deps or what
01:49crocketTEttinger, OSGi allows devs to deploy multiple versions of the same lib.
01:49crocketmodule loading
01:50crocketMultiple versions of a library can be loaded on the runtime.
01:51TEttingerhttp://bit.ly/clojureosgi <-- crocket
01:52crocketTEttinger, what about clojure outside JVM?
01:52crocketIs there a clojure specific way?
01:52TEttingereh?
01:52TEttingeryou mean clojurescript, or other java VMs?
01:53crocketTEttinger, clojurescript and clojure on .NET
01:53TEttingerthose have osgi?
01:53crocketno
01:53seangrov`crocket: There isn't a universal way, no. Clojure lets the host details show through a lot more than that.
01:53TEttingerhttps://github.com/aav/clojure.osgi here are some examples
01:53crocketSo clojure needs its own modularity.
01:55seangrov`crocket: Heh, before we get there, we need some way to write cross-runtime libraries ;)
01:55seangrov`This has been discussed on the ml before though
01:55TEttingercljx is the main proposal I think
01:55crocketseanaway, cross-runtime?
01:55seangrov`TEttinger: yeah, more or less feature expressions
01:55TEttingerclojure and clojurescript are subtly different
01:56crocketAlthough cross-runtime modularity is good, I had multiple versions of a library in mind.
01:56TEttingerand any usage of the host language is incompatible with other host languages
01:56TEttingeryeah, I think it's possible.
01:56crocketTEttinger, with what?
01:57TEttingermaybe not yet, but since lein uses maven, if maven can do it...
01:57crocketDoes clojure have a tool to load multiple versions of a library on the same JVM?
01:57crocketmaven is just a build tool
01:57TEttingerI think the issue is the same stuff on one classpath
01:57crocketIt doesn't help you with modularity.
02:06z15teaI like prismatic's plumbing. Not what you are looking for though
02:22seangrov`crocket: I believe this has been discussed on the ml before and isn't really possible in bigger apps
02:22crocketseanaway, ???
02:22lazybotcrocket: How could that be wrong?
02:23crocketseangrov`, Can you elaborate about it?
02:23seangrov`crocket: https://groups.google.com/forum/#!topic/clojure/WuS31RSiz_A
02:57TEttingercrocket, you saw https://github.com/Seajure/metaverse right?
02:57crocketSeajure?
02:57TEttingerseattle clojure group
02:57crocketwell
02:57TEttingerit was linked in that long ML exchange
02:58TEttingerwell, metaverse was
02:58TEttingerthis is the newer version by a bit
02:58TEttingerit's not a standard, but you can do it in pure clojure
02:59TEttingeronce libs start importing java or groovy or jruby or whatever, sane versioning goes out the window :)
03:00RaynesTEttinger: Metaverse is wild.
03:16gravenimagequit
03:16gravenimagequit
03:56crocketyo
04:00andyfingerhutAwake, but perhaps not fully alert
04:59logic_progis the dumbass echo bot gone yet?
04:59logic_proggood :-)
05:00echo-are`If a macro expands into a def expression, and I want to add meta data to the defined var, do I have to use an extra expression to add it? 'cause (def ^:meta-data ...) in the defmacro seems not functioning
05:02borkdudeis there a way in a for to generate two elements instead of one
05:02borkdudelike (for [i [1 2 3]] [i (inc i)]) and not have to 'flatten' the end result
05:02borkdude(probably not, but can't hurt to ask)
05:03amalloyecho-are`: `(def ^:foo bar) uses the typehint at macroexpansion time, rather than putting it on the code it outputs
05:03amalloy(and of course at macroexpansion time it's totally useless)
05:03amalloyyou want `(def ~(vary-meta bar assoc :meta-whatever true))
05:04amalloyborkdude: you can apply concat around the for, or add a second clause to the for iteration list
05:04echo-are`amalloy: Got it, thanks
05:04amalloy&(for [i [1 2 3], x [i (inc i)]] x)
05:04lazybot⇒ (1 2 2 3 3 4)
05:04borkdudeamalloy ah
05:06borkdudeamalloy in my actual production code I would need apply concat, I was afraid so ;)
05:06amalloyborkdude: nonsense. you can write any apply-concat as another step in the for
05:06borkdudeamalloy ok, I'm generating two datoms in the for
05:07amalloy(apply concat (for [x xs] (f x))) => (for [x xs, y (f x)] y)
05:07borkdudeamalloy what if the second thing isn't related to the first thing
05:07amalloyuh...so? what i just wrote is true for all f
05:08borkdudeas always, you are right and it saved me the apply concat :-) #needmorecoffee
05:19rurumate_is there a clojure client for levelDB yet?
05:21mpenetrurumate_: yes clj-leveldb I think from factual
05:24harjaDo you guys have any good decision procedure on when to use a function vs. a macro?
05:25rurumate_mpenet: thanks
05:25llasramharja: Write a function unless you really can't.
05:27harjallasram: Sounds reasonable. But the problem is that I'm seeing application for macros everywhere, like just expanding stuff in place to generate behaviors. But it's not clearly a good thing. It's just that when people get a hammer they seem to be searching for nails everywhere, and this is how I feel now :)
05:27echo-are`harja: There is a book On Lisp by Paul Graham for this topic, though that book is not for Clojure
05:28llasramharja: I think most people go through that when first exposed to macros :-)
05:29llasramharja: What do you mean in particular by "expanding stuff in place to generate behaviors"?
05:29harjaecho-are`: Thanks, I'm familiar with it. Haven't read it all the way through though. Do you happen to have page numbers I should refer to? :)
05:29llasramI certainly went through a phase of writing far more macros than necessary...
05:29echo-are`harja: Chapter 8, When to Use Macros might help
05:29llasramEh
05:30harjallasram: For example, I made an interface for accessing the entities in my system. I decided that the implementation should be Korma, but could be altered if I want to. All of the calls to the interface are macros that get expanded to Korma-queries
05:31harjaecho-are`: :) Thanks!
05:32llasramharja: How is it different than if the interface had been functions?
05:32harjallasram: https://www.refheap.com/282c285b56daef57a500ff798
05:33harjallasram: Exactly :)
05:33echo-are`harja: But Clojure's more focus on simplicity through decomposition subtly differs from CL's philosophy, do keep that in mind
05:34harjaecho-are`: Good point. Thanks.
05:35llasramOk, yeah. In my opinion those should definitely just be functions. You lose a lot of composability when you make something a macro
05:36harjallasram: Yeah. This is what I also discovered. So basically your simple advice should be at least good approximation on the "correct" answer :)
05:36andyfingerhutamalloy: Are latest versions of useful lib released as jars anywhere? I didn't see them on Clojars
05:37amalloyandyfingerhut: https://clojars.org/org.flatland/useful looks like the latest to me
05:37harjaThanks for the input guys!
05:37llasramharja: np!
05:38andyfingerhutamalloy: doh! I wasn't looking hard enough. Thanks.
05:38harjaMacros are just such a powerful tool for a newbie like me that just drank the kool-aid :)
05:39pavelpenevharja: I've been away from clojure for quite a while(I mostly hack on CL in my spare time now) but from what I can tell, lispers avoid macros if they can help it, and clojurians do so even more(favoring FP).
05:41pavelpenevI've written 3 or 4 useful macros for 4 years of usage of various dialects, but I've used many libraries that use them to good effect. Maybe examine existing code? Ask why should it this be a macro etc.
05:41pavelpenevharja: ^
05:57rurumate_I write a with-x macro for every Closeable x, at least
06:01rurumate_like this: https://www.refheap.com/19523
06:04opqdonutwhy not just use with-open?
06:05sm0ke,(= ::a :user/a); why is this false?
06:05clojurebotfalse
06:05sm0ke,::a
06:05clojurebot:sandbox/a
06:05sm0ke,(= ::a :sandbox/a); why is this false?
06:05clojurebottrue
06:05sm0keoh
06:06opqdonut,::a
06:06clojurebot:sandbox/a
06:06opqdonutyep
06:06sm0keis :: a special form?
06:06opqdonutyeah, kinda, it's part of the keyword syntax
06:06llasramIt's reader syntax
06:06sm0kewhat is it used for?
06:06opqdonutprivate symbols, basically
06:06Jardanamespaced keywords?
06:07opqdonutfor example if you have a queue for things and you want to have a marker in there
06:07opqdonutyou can use ::marker to be extra sure someone doesn't accidentally insert a marker
06:08sm0keok so i understand it just prefixes the keyword with current namespace
06:08opqdonutyep
06:08sm0kethanks
06:09ordnungswidrigopqdonut: you can also use (Object.) for marker objects. The instance is guaranteed to be unique :)
06:14opqdonutordnungswidrig: yeah, that's the java way, and it is more reliable
06:18rurumate_opqdonut: if it's closeable, yes
06:23sm0kewhy the following ##(do (identical? (String. "a") (String. "a")) (identical? "aa" "aa"))
06:23lazybot⇒ true
06:23sm0kewhat the
06:24sm0ke,(identical? (String. "a") (String. "a"))
06:24clojurebotfalse
06:24sm0keoh ok do returns last expression i see
06:24sm0keisnt "aa" and (String. "aa") the same thing?
06:25llasramsm0ke: They have *value* identity, but not *object* identity
06:26llasram##(let [a1 (String. "aa"), a2 (String. "aa")] [(= a1 a2) (identical? a1 a2)])
06:26lazybot⇒ [true false]
06:26sm0kellasram: yes but why ##(identical? "aa" "aa")
06:26lazybot⇒ true
06:26llasramsm0ke: Because string constants are interned and do have object identity
06:29CommandBotGreetings! Send me a PM and I'll echo it back to you. If it contains the word 'die', I'll die as a bonus!
06:29sm0kellasram: got it thanks
07:42Jardacan I redefine a library method?
07:42Jarda(or a function)
07:43Jardashould (defn foo/bar ...) work?
07:54llasramJarda: For testing?
07:54Jardallasram: no, I'm tryin to use https://github.com/seancorfield/clj-soap and need to infer a bit with the logic
07:55llasramOk. Then I'd use https://github.com/technomancy/robert-hooke
07:55harjapavelpenev: Thanks! That sounds like a good and solid approach to follow.
07:56Jardallasram: ok thanks
07:57harjaOh hi Jarda, do you guys use Clojure too nowadays?
07:57Jardaharja: hi! Nope, not working for Ecom anymore. More like a freelancer nowadays :)
07:58harjaJarda: Yeah, heard that you left. Did you go working for a startup?
07:59Jardaharja: well I do a lot of javascript coding for Flowplayer atm, but also working on own projects on the side
07:59harjaCool
08:12ThePawnBreakhello! I'm a clojure newbie; I'm trying to use the Raynes fs library; I added it to project.clj but I don't know how to import it; how do I know what argument to pass to the use function? thanks
08:13ThePawnBreakI tried (use 'me.raynes/fs) but it doesn't seem to work
08:13solussdyou can use the ns macro to load it:
08:13turbopapemaybe running lein deps ?
08:13ThePawnBreaklein downloaded it, I just don't know what its 'correct' name is
08:13solussd(use 'me.raynes.fs)
08:14turbopapeok, so it is a ns problem, as pointed by solussd
08:14ThePawnBreakthanks solussd ; it worked
08:14ThePawnBreakstill, where could I have found that name? "me.raynes.fs"
08:15solussdThePawnBreak: look at line 1 here: https://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj#L1
08:16ThePawnBreakthank you :)
08:16solussddocumentation or source code, really. the group and package name for it dont necessarily correspond to the namespaces
08:16solussdnp
08:18solussdI'm assuming you're playing with it using a repl. When you want to use it in a dource file, use the ns macro. E.g. at the top of the file: (ns (:require [raynes.me.fs :as fs])) and then you can use functions from it like this: (fs/expand-home "somearg")
08:18solussd*source
08:20ThePawnBreakis anything wrong with simply using it using "use"?
08:21turbopapeuse = require + ref, no ?
08:21ThePawnBreakI'm not sure I understand what you
08:21ThePawnBreakyou're asking
08:26llasram`use` is `require` + `refer`
08:27Zerker_Hello
08:27llasramThe problem with `use` is that w/o `:only` you have no control over the symbol pulled into your namespace. And with `:only` it's identical to `require` with `:refer`. So if we all just `require`, the world becomes simpler :-)
08:27solussduse 'refers' the symbols into your current namespace. It is usually frowned upon, bc it pollutes your current namespace with all the symbols from another
08:27Zerker_Would anyone be willing to give me ten minutes of their time for an informal interview? CS student, paper due in 9 hours, you know how it is ^-^
08:29solussdits nice to know where your functions are. Using require, like in my example above, you can give a namespace a "nickname", e.g. [raynes.me.fs :as fs]. Then, all of Raynes' fs stuff can be accessed under fs/
08:29solussdZerker_: in 2 hours, sure
08:37ThePawnBreaksolussd: is this how I should import clojure.string? (ns (:require [clojure.string :as st]))
08:37solussdyup
08:37ThePawnBreakit doesn't seem to work: (ns (:require [clojure.string :as st]))
08:37ThePawnBreakClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol clojure.lang.RT$1.invoke (RT.java:237)
08:37solussdoh
08:38solussdyou need to specify the namespace
08:38solussdas the first arg to ns
08:38solussde.g., (ns my.stuff (:require [clojure.string :as st]))
08:38solussdwhich would go at the top of a file at src/my/stuff.clj
08:41ThePawnBreaknow I have this at the top
08:41ThePawnBreak(ns core (:require [clojure.string :as st]))
08:41ThePawnBreak(ns core (:require [me.raynes.fs :as fs]))
08:41ThePawnBreakbut:
08:41ThePawnBreak(ns core (:require [clojure.string :as st]))
08:41ThePawnBreak(ns core (:require [me.raynes.fs :as fs]))
08:41ThePawnBreakcore=> fs.absolute-path
08:41ThePawnBreakCompilerException java.lang.ClassNotFoundException: fs.absolute-path, compiling:(/tmp/form-init2759071537655607159.clj:1:882
08:43solussdoh, combine those, also the name of your project should be the first component in the namespace: (ns myprojectname.core (:require [clojure.string :as st] [raynes.me.fs :as fs]))
08:43solussd*me.raynes
08:44ThePawnBreakis there any way to "restart" a REPL?
08:44ThePawnBreakto a clean state
08:45ThePawnBreakbesides closing it and opening another
08:45solussdwell, you could remove all the things aliased into it, but it's easier to just switch to a new namespace
08:46solussdtry: (ns my-new-namespace)
08:46solussdyour prompt will change and you'll have a "clean" repl/namespace
08:48solussdalso, accessing functions in a namespace is always done with a forward slash, e.g. me.raynes.fs/absolute-path
08:49ThePawnBreakeverything works now; thanks again, you've been very helpful
08:49solussdno problem, anytime
09:19pepijndevosI'm having math problems :(
09:20mdrogalispepijndevos: What's up?
09:20pepijndevosI'm trying to figure out how far I need to drive in a circle to move X cm sideways.
09:21pepijndevosI'm almost there, but my asin is going the wrong way.
09:21pepijndevospasting code...
09:22pepijndevoshttps://www.refheap.com/19532
09:22mdrogalisEh, sorry. That's out of my depth. :)
09:22mdrogalisMaybe try the math Stack Exchange.
09:23pepijndevosI think I'll figure it out eventually...
09:24pepijndevosSo the problem is that right now, it's like I'm facing sideways. so maybe I need to add 90 degrees to it. But maybe I just need to use another a?(sin|cos|tan)
09:25pepijndevosIn other wrods, if I say I have a turning radius of 10 cm, and want to move 1 cm sideways, it gives me 1.01.
09:43noncompepijndevos: the code looks too complicated for the task
09:43noncombetter avoid degrees at all, use radians.. only do degrees for input-output
09:43noncomwill save you a lot of confusion and make the code much prettier
09:44pepijndevosMath is complicated… haha. Well, I'm open to suggestions.
09:44noncomif i were you, i would first get rid of all the degrees stuff and work with radians
09:45noncomtry that, then see what code you get
09:45pepijndevosI mean… yes but.. that won;t solve the problem.
09:46pepijndevosdistance-after works fine. Its the (Math/asin (/ sideways radius)) part that is causing trouble.
09:49noncompepijndevos: https://www.refheap.com/19533
09:51noncomat least, multiplying angle with two pi seens strange
09:51noncomalso, why is it you divide sideways by radius?
09:52noncomasin is taken from the length of a x-axis segment and gives the angle which corresponds to the projection on the x-axis
09:53noncomah, your radius is not normalized, sorry i see
09:53pepijndevoswell, asin expects somethign between 0 and 1. So if I want to move 1 cm with a turning radius of 10, I plug in 0.1 to that function.
09:53noncomright, i missed that
09:53noncomso ,then to me what is strange seems the line 4 in myrefheap
09:54noncom(* angle two-pi radius)
09:54mishok13probably a stupid question and asked here hundreds of times, however: when I try to access resource from uberjar it fails with java.io.FileNotFoundException while when working from REPL everything works just fine
09:55pepijndevosI don't know about that, but what my code did was taking the degrees needed to turn, devide them by a full circle, and then take that much of the circunference of the radius.
09:55mishok13basically, the exception says that the path is path/to/uberjar.jar!public/resource.txt which is obviously not openable by io/file or io/reader
09:58mdrogalismishok13: clojure.java.io/resource
09:58mishok13yeah, I'm using exactly that
09:58mdrogalisHmph. Not sure then.
09:59pepijndevosSo since you use radians, that would be (* (/ degrees two-pi) (* two-pi radius)) right?
10:00pepijndevosnoncom, I did not quite parse that bit about the x-axis you said. Can you explain that?
10:01pepijndevosOh, i think I got it...
10:01noncomah, yes
10:01noncomwell, maybe then, if your radius is 10 and you get 10.1, then it is because you did not multiply 0.1 by 10 ?
10:02noncomor what result you expect?
10:02TimMcEverything becomes easier if you just use tau (2 pi).
10:02noncomuhh, i guess i mess up even more than you did :D
10:02TimMchttp://tauday.com/tau-manifesto
10:03noncomTimMc: ahaha yeah, i remember that one :)
10:03hyPiRionisn't like, degrees/2pi * 2pi / radius = degrees/radius? :)
10:05pepijndevosSo your car is facing north, or 0 deg. and you want to move sideways 1 cm. So you start turning, and at first you are driving almost north, 5deg or so. So it'd take you maybe 3cm to move sideways just 1 cm.
10:06pepijndevosBut the result I'm getting is like if I'm facing west, and turining away from where I want to go. So at first you move almost 1 cm sideways for every 1 cm you drive.
10:06noncomso you want the length of the arc
10:07pepijndevosultimately, yes
10:07pepijndevosdistance-after calculates the length of the arc to trun X degrees
10:14noncomso, the ultimate formula is (* two-pi r (/ (asin (/ x-dist r)) two-pi))
10:14noncom?
10:15noncomwhat boils down to (* r (asin (/ x-dist r)))
10:18pepijndevosbut it's stil facing the wrong way… I think I found something that works… hold on
10:19pepijndevoshttps://www.refheap.com/19534
10:20noncomhehe
10:21pepijndevosIt looks wrong, but works correctly.. seemingly
10:23pepijndevosI'll try on the robot, and if it works, I declare it mathematically, or at least empirically correct.
10:23noncomcool!
10:24pepijndevosit's fro this one: http://www.youtube.com/watch?v=h9_pNfebQf4
10:26noncomwow! that wat you did?
10:26pepijndevosyea
10:26noncompretty cool, are you using arduino?
10:27noncomor is it a different flavor of robot
10:27pepijndevosLEGO EV3
10:27pepijndevosRuns Clojure :)
10:28Morgawrnice
10:28Morgawrthat's pretty cool
10:28noncompersonally i think this is supa nice thing! probably we're gonna work with something like that in our company sometime
10:29noncombtw, if you're taking on lisp, probably you could write a self-assembling lego robot sometime!
10:29pepijndevos:)
10:30noncomyou could use opencv to identify lego pieces from cameras
10:30noncomand try to stack them according to some design, maybe controlled by some fancy ai thing..
10:30noncomalthough that'll require very precise servos
10:32clgvnoncom: evolutionary programming with LEGO :D
10:33clgvnoncom: evolving the code and the physical built that would be cool
10:35noncomyeah, but lego may come to be a little harder to handle than, say, plain cubes with magnets and stuff
10:36noncomthey bricks have these.. how you call them, idk, pins, which stack one in another to connect them
10:36noncomcomfortable for hands but i think not for autos
10:42cmajor7I am sure there were many discussions previously, but time goes on, software changes.. I am looking for a testing framework. Candidates are clojure.test, midje and speclj. What experiences do you guys have with these?
10:45tbaldrid_cmajor7: keep it super simple, go with clojure.test
10:45tbaldridgeI've tried both of the others and regretted it over time.
10:46coventryWhat are the drawbacks?
10:46cmajor7tbaldrid_: that's what I am afraid of. the other two look seductive, but add complexity..
10:46diogeneshey. noobie here. how can you transform a integer like 123 to a list '(1 2 3)?
10:47cmajor7tbaldrid_: I am also spoiled by using spock (groovy testing framework), hence "seductive"
10:47tbaldridgecmajor7: that's my only real complaint. clojure.test just creates defns. The source for all the constructs fits on a few lines. For both of the others, they look pretty perhaps, but they accomplish this via lots of macros.
10:47borkdudediogenes (seq (str 123))
10:47diogenesborkdude: thanks!
10:47borkdudediogenes actually that is a seq of chars, if you want to transform those into ints again, you probably know how
10:48noncom,(map int (str 123))
10:48clojurebot(49 50 51)
10:48noncomoh
10:48tbaldridgecmajor7: I also wonder if we don't really need with-redefs or "providing" if we structure our Clojure code correctly. Have each testable "thing" take its data sources as arguments, and now you don't need to redef any global vars.
10:48cmajor7tbaldridge: how would lots of macros behind the scene hurt? (curious)
10:48diogenesnoncom: that works better. thanks
10:49noncomdiogenes: but that's worng :)
10:49borkdude,(map #(Integer/parseInt (str %)) (str 123))
10:49clojurebot(1 2 3)
10:49noncomit gives bytes for the chars
10:49tbaldridgecmajor7: it hurts when the blow up. With Midje I'm often wondering what the code means. This is because Midje defines a DSL with different semantics from Clojure. Some parts of the code are run out of order, or even backwards.
10:49cmajor7tbaldridge: it does not seem I need to compose them myself, since they are "their" test primitives
10:50cmajor7tbaldridge: yea, I get this impression from the docs.. not very simple and .. not very clojure. hence looked at speclj..
10:50tbaldridgecmajor7: Midje is based on =>. How is that macro implemented?
10:51tbaldridgecmajor7: yeah, I like speclj more, but there's little community support. That's often a bad reason not to use something, though.
10:52tbaldridgecmajor7: so I wouldn't say I love clojure.test. It's just there's no better alternative, IMO.
10:52cmajor7tbaldridge: yea, that is my thinking exactly
10:53cmajor7tbaldridge: what would some disadvantages (if any) of clojure.test be that you can think of?
10:53iwilligdoes clojure.contrib.mock still exist ? I was looking at this page http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go and it seems like mock was never migrated to a namespace. Is that correct ?
10:53coventryWhat does clojure.test gain by putting the test body in the function metadata?
10:54maku_Has anyone used the OrientDB Wrapper: https://github.com/eduardoejp/clj-orient?
10:56tbaldridgecmajor7: I have a very minimalistic view of testing. All I need is assert and a way to name tests. Using that, I can built almost any other check that I need. For instance, the core.async CLJS source uses the 30 lines of code I wrote here: https://github.com/clojure/core.async/blob/master/src/test/cljs/cljs/core/async/test_helpers.clj
10:57tbaldridgecmajor7: that's all I really need from a test suite. And for that, clojure.test fits very well. Power through simplicity :-P
10:58cmajor7tbaldridge: that's cool, although is 43 lines :) so you chose not to use clojure.test here at all, or you compliment it with clojure.test?
10:59tbaldridgecmajor7: clojure.test doesn't exist in CLJS or it didn't at the time I wrote this
10:59cmajor7tbaldridge: oh.. missed the S part in CLJS
11:01cmajor7tbaldridge: I see. yea, I am convinced. "clojure.test" it is.
11:05cmajor7tbaldridge: on more "test" thing I am contemplating about: since in clojure we use repl pretty heavily, and it's a culture of constantly interacting with the code, do you see a true usefulness from "unit" tests? I do for things like libraries, but I feel that "integration" tests provide a lot more value and a lot less regression headache for "customer problem" solutions (not exactly general purpose libraries)? This is n
11:07coventryI generally test something in a repl, then stick it the test battery once it works. Guards against regressions.
11:07tbaldridgecmajor7: I agree, and core.async is a good example of this. There are about 700 lines of code behind the go macro, and yet I don't test any of the functions in that namespace. Instead I test the client API to the namespace. With enough tests, you can pin down failures purely on what tests are failing.
11:08tbaldridgeand you end up testing the library's specifications, and not the implementation of the library.
11:08tbaldridgecoventry: agreed, I test because I fear regression.
11:12mdrogalisAs it turns out, Simulant makes a pretty neat replacement for Curl tests.
11:14bbloombitemyapp: you're impacted by the ArraySeq/RestFn perf issue, right? https://groups.google.com/d/topic/clojure-dev/Gaz17qMfwrk/discussion
11:14bbloomwho else was on that list?
11:15mimieux9
11:28ambrosebsthoughts on potential Typed Clojure logo? https://raw.github.com/typed-clojure/typed-clojure.com/master/images/letterbox.png
11:30bbloomambrosebs: it's a tau? perfect :-P
11:31rurumate_has anyone ever got "goog.string.format is not a function" error?
11:31ambrosebsbbloom: yes! :D
11:31rurumate_(using latest clojurescript)
11:31rurumate_this error happens at runtime
11:32bbloomrurumate_: can you produce a minimal reproduction?
11:32jonasenrurumate_: are you using cljs.core/format?
11:32rurumate_jonasen: not yet
11:33jonasenrurumate_: ok, it has been removed from core
11:33jonasensomehow it messed up advanced optimizations
11:34rurumate_bbloom: I'm too stressed out right now, maybe on the weekend
11:35stuartsierracoventry: Re "What does clojure.test gain by putting the test body in the function metadata?" Originally I thought tests could be attached as metadata to the function they're testing. The `with-test` macro exists to support this. But the style never caught on.
11:35rurumate_jonasen, bbloom: try replacing format calls with goog.string.format, it should break at runtime
11:35coventryThanks, stuartsierra.
11:35stuartsierraI and others quickly discovered that mixing tests and source in the same file makes the source hard to read.
11:36bbloomi feel the same way about type annotations
11:37coventryI'm working on a code-walking/transformation library at the moment, and want it to be able to handle the clojure source code, so having the test bodies in the metadata is complicating my life a little.
11:37xeqitbaldridge: cemerick has built https://github.com/cemerick/clojurescript.test. Not that it helps for core.async since it doesn't fall under the contrib umbrella
11:39pepijndevosYou know, in math you can do these reorder things, like a + b = c to c - b = a. Would be neat to do that with clojure automagically.
11:39EchoBot1Echo: You know, in math you can do these reorder things, like a + b = c to c - b = a. Would be neat to do that with clojure automagically.
11:40EchoBot1Echo: help
11:40xeqitechnomancy: ^
11:40EchoBot1Echo: technomancy: ^
11:40ToxicFrogWhose fault is that?
11:40EchoBot1Echo: Whose fault is that?
11:41EchoBot1Echo: even sending private messages end up in #clojure
11:41bbloompepijndevos: what you're talking about is called symbolic programming. there are a few small projects to do things like that
11:41EchoBot1Echo: pepijndevos: what you're talking about is called symbolic programming. there are a few small projects to do things like that
11:41Gooderwhy I C-x C-e the code, it prompts ""No Lisp subprocess; see variable `inferior-lisp-buffer' ." ?
11:41EchoBot1Echo: why I C-x C-e the code, it prompts ""No Lisp subprocess; see variable `inferior-lisp-buffer' ." ?
11:41ToxicFrogTo the /ignore
11:41EchoBot1Echo: To the /ignore
11:41EchoBot1Echo: Fuck off, EchoBot1. :-)
11:41pepijndevosban dat filth
11:41EchoBot1Echo: ban dat filth
11:41bbloomi've already ignored it :-P
11:41EchoBot1Echo: i've already ignored it :-P
11:42pepijndevosme too, but it's still annoying
11:42EchoBot1Echo: me too, but it's still annoying
11:42Jardadie
11:42EchoBot1Echo: die
11:42EchoBot1Echo: die
11:42coventryGooder: You have to start a repl. Try running M-x nrepl-jack-in before the C-x C-e.
11:42EchoBot1Echo: Gooder: You have to start a repl. Try running M-x nrepl-jack-in before the C-x C-e.
11:43bbloomtechnomancy is on the west coast though. he might still be sleeping
11:43EchoBot1Echo: technomancy is on the west coast though. he might still be sleeping
11:43nDuff...do we really have any legitimate reason to allow clients from *.compute.amazonaws.com? I'd almost ban the whole subnet.
11:43pepijndevosbbloom, cool, thanks. Looking into that.
11:43EchoBot1Echo: ...do we really have any legitimate reason to allow clients from *.compute.amazonaws.com? I'd almost ban the whole subnet.
11:43EchoBot1Echo: bbloom, cool, thanks. Looking into that.
11:43Goodercoventry: in the terminal, run the `lein repl` firstly?
11:43EchoBot1Echo: coventry: in the terminal, run the `lein repl` firstly?
11:43hyPiRionbbloom: no, he was awake 40 mins ago
11:43EchoBot1Echo: bbloom: no, he was awake 40 mins ago
11:43TimMcnDuff: Sure, some people run bouncers.
11:43EchoBot1Echo: nDuff: Sure, some people run bouncers.
11:43pepijndevosI don;t know where lazybot runs
11:43EchoBot1Echo: I don;t know where lazybot runs
11:44coventryGooder: Wasn't what I was thinking of. Hold down Alt and press "x", then type "nrepl-jack-in", then return. A repl window should appear in a few seconds.
11:44EchoBot1Echo: Gooder: Wasn't what I was thinking of. Hold down Alt and press "x", then type "nrepl-jack-in", then return. A repl window should appear in a few seconds.
11:44TimMcThis is still the same host as CommandBot: ~nodebot@ec2-50-18-210-65.us-west-1.compute.amazonaws.com
11:44EchoBot1Echo: This is still the same host as CommandBot: ~nodebot@ec2-50-18-210-65.us-west-1.compute.amazonaws.com
11:44pepijndevosbbloom, do you know any good libsa that do this?
11:44EchoBot1Echo: bbloom, do you know any good libsa that do this?
11:45coventryGooder: http://clojure-doc.org/articles/tutorials/emacs.html#creating_a_project
11:45EchoBot1Echo: Gooder: http://clojure-doc.org/articles/tutorials/emacs.html#creating_a_project
11:45bbloompepijndevos: it's a very hard thing to do well. there is a mathematica/clojure bridge if you need something fancy. other than that, there are a lot of toy libraries to do it. if you only need the basics for polynomials, you can code it up yourself in ~1 hour
11:45EchoBot1Echo: pepijndevos: it's a very hard thing to do well. there is a mathematica/clojure bridge if you need something fancy. other than that, there are a lot of toy libraries to do it. if you only need the basics for polynomials, you can code it up yourself in ~1 hour
11:46pepijndevosbbloom, basically I just need to do the inverse of the sine/cosine stuff I did earlier. I could just use some brain cells t do it by hand...
11:46EchoBot1Echo: bbloom, basically I just need to do the inverse of the sine/cosine stuff I did earlier. I could just use some brain cells t do it by hand...
11:46Goodercoventry: okay, reading
11:46EchoBot1Echo: coventry: okay, reading
11:47pepijndevosit'd require less brain cells than writing a library
11:47EchoBot1Echo: it'd require less brain cells than writing a library
11:48coventryThere's probably a solver which would invert it numerically for you fast enough for your application.
11:48EchoBot1Echo: There's probably a solver which would invert it numerically for you fast enough for your application.
11:49seangrov`bbloom pepijndevos Wasn't espresso built for that during GSoC?
11:49EchoBot1Echo: bbloom pepijndevos Wasn't espresso built for that during GSoC?
11:50seangrov`pepijndevos: https://github.com/clojure-numerics/expresso
11:50EchoBot1Echo: pepijndevos: https://github.com/clojure-numerics/expresso
11:50pepijndevosthanks
11:50EchoBot1Echo: thanks
11:52pepijndevoshmmm, maybe using the even requires more brain cells than writing my function. Term rewriting is fancier though...
11:52EchoBot1Echo: hmmm, maybe using the even requires more brain cells than writing my function. Term rewriting is fancier though...
11:53indigoLooks like I found the source code
11:53EchoBot1Echo: Looks like I found the source code
11:53bbloomseangrov`: i wasn't following that closely, dunno
11:53EchoBot1Echo: seangrov`: i wasn't following that closely, dunno
11:54Goodercoventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot1Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot2Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot1Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot2Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot1Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot2Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot1Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot2Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot1Echo: Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot2Echo: Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot1Echo: Echo: Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot2Echo: Echo: Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot1Echo: Echo: Echo: Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot2Echo: Echo: Echo: Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54EchoBot1Echo: Echo: Echo: Echo: Echo: Echo: Echo: Echo: coventry: still fails. actually I use the default basic Steve Purcell's configs.
11:54papachan???
11:54EchoBot1Echo: ???
11:54lazybotpapachan: Yes, 100% for sure.
11:54EchoBot1Echo: papachan: Yes, 100% for sure.
11:54lazybotEchoBot1: How could that be wrong?
11:54EchoBot1Echo: EchoBot1: How could that be wrong?
11:54indigoKk, time to report this
11:54EchoBot1Echo: Kk, time to report this
11:55indigoIt's this code here: http://runnable.com/UkmUo7yLFrctAAKe/irc-echo-bot-with-node-irc-for-node-js
11:55EchoBot1Echo: It's this code here: http://runnable.com/UkmUo7yLFrctAAKe/irc-echo-bot-with-node-irc-for-node-js
11:55coventryGooder: Fails how?
11:55EchoBot1Echo: Gooder: Fails how?
11:56coventryindigo: How did you find that? Impressive.
11:56EchoBot1Echo: indigo: How did you find that? Impressive.
11:56indigocoventry: I can find anything
11:56EchoBot1Echo: coventry: I can find anything
11:56indigoAlso Google
11:56EchoBot1Echo: Also Google
11:56Goodercoventry: C-x C-e the clojure codes, it prompts : inferior-lisp-proc: No Lisp subprocess; see variable `inferior-lisp-buffer'
11:56EchoBot1Echo: coventry: C-x C-e the clojure codes, it prompts : inferior-lisp-proc: No Lisp subprocess; see variable `inferior-lisp-buffer'
11:56pepijndevoswth is a Node bot doing in #clojure?
11:56coventryindigo: OK, google is impressive. :-)
11:57coventryGooder: What about the result of the nrepl-jack-in?
11:58Gooder"Connected", a new buffer "*nrepl server*" created.
11:58hyPiRionthe fact that it's a node bot isn't the problem. The problem is that it echoed everything
11:59indigocoventry: I posted a topic on their Get Satisfaction forum
11:59indigohttp://support.runnable.com/runnable/topics/irc_spam_possibility_of_botnet
12:00indigoI mean, it does run through *their* servers
12:01Goodercoventry: I have to leave now, thank you for your helps.
12:01coventryGooder: Good luck.
12:02dsabaninhey guys
12:03dsabaninis there any particular meaning in using full java class names with namespace in type hints instead of relying on the short names after import?
12:03gfredericksI recall some kind of bug with macros that would force you to do that
12:04clojurebotNo entiendo
12:04gfredericksbut I don't think there's any intrinsic reason to
12:04clojurebotTitim gan éirí ort.
12:04gfrederickswill the bot respond to this too?
12:04gfredericksmaybe it was a random chance double hit
12:05dsabaninso I guess until I hit that bug (if I do), I'm going to use the short type hints
12:05dsabaninthanks
12:08gfredericksyeah the bug was pretty loud -- it was a ClassNotFound exception at compile time. so you shouldn't have to worry about it otherwise.
12:09coventryindigo: Thanks for doing that. I +1'd.
12:10indigoYeah no problem
12:10indigoThose guys need to get their shit together or else they're going to cause DoSes ;P
12:15TimMcSuch a hilariously bad idea.
12:15coventryWhy does Compiler/load bind RT.UNCHECKED_MATH to RT.UNCHECKED_MATH.deref()? Isn't that a no-op? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7054
12:16dnolencoventry: no, it was an atom and then it becomes a boolean
12:17NotAnEchoBotEcho: In audio signal processing and acoustics, a reflection of sound, arriving at the listener some time after the direct sound.
12:17coventrydnolen: Oh, got it. Thanks.
12:18wakeupHi all
12:20wakeupI have the following situation: I want to build a UNIX-daemon that starts some threads (services) and then idles/does nothing wrapped in a (try ... (finally ...)) form where the started threads should be killed softly in case the process gets kill'ed. How would you guys do this?
12:21wakeupI have tried something like (try (loop [] (Thread/sleep 999999) (recur)) (finally clean-up))
12:21TimMc"Killed softly"?
12:22wakeupTimMc: E.g. clean up after the started services.
12:24wakeupSimplified, how do I never return and just idle?
12:24TimMcwakeup: So if it gets a SIGTERM, it should pass that on to the services.
12:25wakeupTimMc: No actually not that invovled, the "services" are plain Thread
12:25Morgawrwakeup: if you want to wait undefinitely, just use a promise and deref on it
12:25wakeups
12:26TimMcwakeup: Metaphorically. :-)
12:26Morgawrthen you could have a signal handler (not sure how that works in clojure tbh) delivering the promise once a signal is received
12:26Morgawrand when the promise is delivered you clean everything and exit
12:26bjaanyone know offhand of the clj password hasher library that contains both bcrypt and scrypt hashers?
12:26bjaI thought I saw one and I apparently forgot to star it
12:27bjaweavejester/crypto-password
12:27bjanvm
12:28TimMcwakeup: That Thread/sleep can throw an InterruptedException, and I believe it *will* be thrown if the JVM gets an actual SIGTERM. You can handle it, ask your services to clean themselves up, and then return.
12:28wakeupSO you think looping a sleep is fine?
12:28TimMcHowever, there's probably some library out there that will do supervision better.
12:30tbaldrid_wakeup: or use core.async. The thread macro returns a channel that is closed when the thread crashes/finishes. Just alts!! over the channels and you can easily handle the termination of the threads. Add a common exception channel for the threads to send to on failure, and you have a fairly simple system.
12:31cmajor7tbaldridge: thanks! (for your thoughts on testing core.async). good to know I am not alone :)
12:31tbaldridgecmajor7: np
12:39seangrov`Is it even possible to figure out a Java api in an exploratory way? I looked through google-oauth-client's oauth1 namespace and javadocs, trying to piece together what had to be instantiated where and given to whom, and lost the thread. They have docs for the oauth2 stuff, read that, and realized I wouldn't have figured it out the oauth1 stuff for a long time if it's analogous to the oauth2 api.
12:45TimMcseangrov`: I once considered writing a program that would effectively tab-complete its way to any object you wanted by finding a type-checker-valid path through an API.
12:45TimMcBut I wouldn't recommend that approach for anything having to do with security. :-P
12:45joegallo_eclipse was very good at that for java apis
12:46technomancy"no no, I have *sheep* and I want *wheat*. anybody?"
12:47technomancyyou mean a BrickFactory?
12:47rasmusto:)
12:50coventryIs there a cleaner way to add multiple key/value pairs from one map to another than (reduce #(assoc %1 %2 (map1 %2)) map2 [:key :words])?
12:51rasmustocoventry merge and select-keys?
12:51coventryrasmusto: thanks.
12:52rasmusto,(merge {:a 1} (select-keys {:b 2 :c 3} [:b]))
12:52clojurebot{:b 2, :a 1}
12:52rasmustoremember that merge favors the rightmost map
12:52sm0keumm guys there is no mailbox concept in core.async? In cse of high message throughput what would be the strategy when working with core.async?
12:53coventryrasmusto: Thanks. That would have bitten me.
12:53sm0kei am kind of comparing this to actors in akka (scala) which have mailbox concepts which can be persistent too
12:54tbaldridgesm0ke: high message throughput? Explain. We have buffers in core.async.
12:55sm0ketbaldridge: umm oh i see...can a buffer be made to overflow on to disk?
12:55tbaldridgesm0ke: there aren't implementations that do that, but the protocol interface for buffers is super super simple and need not be thread safe. So writing your own wouldn't be that hard.
12:56tbaldridgesm0ke: this is all that is needed to create a buffer: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/buffers.clj
12:56tbaldridgenotice that none of these are thread-safe, core.async does locking so only one thread will call a buffer's methods at a time.
12:57sm0ketbaldridge: cool and awesome..i was just being a tool..i never used a persistent mailbox in akka anyways ;p
12:57tbaldridgesm0ke: that being said, unbounded message queues are a design bug, so often its better to explicitly define a size for a buffer.
12:58sm0ketbaldridge: yea specially if we can have sliding window kind of queue..it would be much better
12:59sm0keoh wow i found (chan (sliding-buffer 10))
13:00sm0kei couldnt seem to find any advantage of using actors at all
13:00sm0kethey are verbose
13:01sm0kethey need callbacks
13:15bitemyappbbloom: yes I've been impacted by that perf issue.
13:15bitemyappbbloom: I can't post to clojure-dev though
13:15bbloombitemyapp: if you got a moment, see if you can give alex some help by testing his updated patch
13:16bitemyappbbloom: I could send it through a side-channel, but not directly to that thread.
13:16bbloombitemyapp: no CA?
13:16bitemyappsigh, no.
13:16bitemyappI know, I know, I should.
13:16bitemyappI'd also have to dig up an old version of the templating stuff Yogthos and I worked on.
13:16bitemyappwe had a templating library whose main loop runtime was dominated by RestFn, not even kidding.
13:16tbaldridgeI thought non CA people can comment on JIRA though, perhaps you can do it that way?
13:16bitemyappand it was a quasi-reasonable implementation.
13:17bitemyapplazy-seq and recursion.
13:17bitemyappbbloom: if I can dig up my copy of YourKit and the offending code, I'll make certain it reaches Mr. Danger.
13:17bbloombitemyapp: k
13:17bitemyappthanks for making me aware he was hustling on this.
13:18bitemyappI hope he knows we appreicate what he's been doing to catch everything up.
13:19mdrogalisLooking for a new book. Anyone read anything good lately? Open ended.
13:19bitemyappseangrov`: I'll respond to the thread tonight, after I've had a chance to hum a bit.
13:19bitemyappmdrogalis: I've got a few options for you that are really good.
13:19mdrogalisFire away.
13:20bitemyappmdrogalis: 1. epic sci-fi, might've already read it, but leaves an impact - well known classic. 2. Very well characterized and enjoyable fantasy with well thought-out magic system, probably the best and most thrilling trilogy I've read in many years. 3. Naval historical fiction, 20 book series but you can drop in and out at will, you won't be compelled to proceed. Two protagonists that are both interesting.
13:21bitemyappmdrogalis: which do you want?
13:21bitemyappI can recommend CS/programming stuff too, if that's what you want, but I figured I'd just go for pure reading enjoyment.
13:21mdrogalisHm, none of those quite caught me. Bring on the nerd material.
13:22hyPiRionI can recommend "Hyperion" by Dan Simmons.
13:22bitemyappmdrogalis: Art of the Metaobject Protocol?
13:22bitemyapphyPiRion: are you named after the book?
13:22mdrogalishyPiRion recommends himself. D:
13:22technomancyI'm reading that now
13:22hyPiRionbitemyapp: no, although it's one of the better books I've read :p
13:22mdrogalisIll check that one out, thanks bitemyapp.
13:23bitemyappmdrogalis: AMOP is the book that brought aspect-oriented programming to Common Lispers. It's a common n+1 recommendation I make to people that already know Lisp.
13:24coventrymdrogalis: A Hellhound on His Trail. History of MLK's assassin, related as a thriller.
13:24bitemyappor (inc n) if you like. heh.
13:24mdrogalisbitemyapp: That's pretty neat. Still gotta check out LoL too.
13:24mdrogaliscoventry: Sweet, thanks.
13:24degbitemyapp: yes and no... CL had "before" and "after" mixins well before AMOP.... not quite full aspect-oriented, but definitely the seeds of the idea.
13:24bitemyappmdrogalis: LoL is more about macros and macros writing macros. A lot of people think of it as arcane/crazy, but I feel less like that's the case as I get older.
13:25bitemyappdeg: well sure, people were doing function decoration from afar, but it wasn't nearly as well formulated as what Kiczales was going for.
13:25turbopapeIf noir is deprecated, what is the replacement ?
13:25mdrogalisnoir-lib is the direct replacement
13:26degbitemyapp: The usual "if I see further it is because I stand on the shoulders of giants" (or however the quote goes)
13:26degBut, yes, I agree with you; just nitpicking
13:27bitemyappI love it when somebody rejects my PR to fix a bug, then when I go to use their thing again, the same Null Pointer Exception my PR was supposed to fix pops up, then I take a screenshot and paste the error into a github issue, and they're nowhere to be seen.
13:27bitemyappI need Knives over TCP/IP to become a thing.
13:27bitemyappSIG_STAB
13:27degCan a project's :main namespace come from one of its dependency libraries, or must it be defined directly in the project itself?
13:27rasmustoSIG_INTERNAL_BLEEDING
13:28technomancydeg: it should work; give it a try
13:28degtechnomancy: thx, will do.
13:29turbopapeok, compojure + lib-noir, I get it ...
13:30bitemyappturbopape: good, because I was questioning my sanity yesterday when I forgot to load the wrap-params middleware.
13:30bitemyappI derped when I should've not been an idiot.
13:31turbopapebitemyapp, yeah, seems weird to deprecate "noir" and to recommend "lib-noir" (on top of compojure...)
13:31bitemyappturbopape: no, it makes sense.
13:31technomancywell, the problem with noir was that it wasn't a library
13:31bitemyappturbopape: it had to made into a library from which people could pick and choose what they wanted.
13:32turbopapeok, I just pointed the fact that the message fro the website is confusing ... :)
13:32turbopapeexcuse my NOOBNESS :)
13:32bitemyappWeavejester is the one true Pope of "everything can be middleware!"
13:32indigoMiddleware ftw
13:32technomancyah; they finally got a deprecation notice on webnoir.org; good
13:33bitemyapptechnomancy: I had to bug the shit out of him, but yes.
13:33bitemyappI was practically banging on his door with pitchforks and a torch
13:33technomancyone of the upsides of living in SF, I suppose
13:33turbopape:)
13:33bitemyappluckily it wasn't physical harassment, but that option was under advisement.
13:33rasmustobitemyapp: is libnoir your pitched fork?
13:34bitemyapprasmusto: lib-noir is yogthos, Raynes, and the long tail of contributors. I just boss them around occasionally.
13:34rasmustoah, gotcha
13:34bitemyappI'm still trying to get them to stop using dynamic vars.
13:34xeqiI've been considering templating as middleware
13:34bitemyappso that lib-noir can become completely async-safe.
13:34bitemyappxeqi: I can tell you exactly how it could be done.
13:34bitemyappxeqi: if you care to know.
13:35xeqibitemyapp: I've done it in a small project
13:35bitemyappxeqi: it's super handy for testing, because then you can request context maps from handlers instead of rendering HTML.
13:35bitemyappxeqi: then your "controllers" roughly speaking, become testable.
13:35technomancyoh man
13:35technomancythat sounds like fun
13:35bitemyappDoesn't need to be middleware though.
13:35coventryIs there a more clojure-ish way to do (. Compiler/LINE_AFTER set 1), given that I've already bound LINE_AFTER in a (binding) form (so I assume (set!) is out)?
13:35bitemyapptechnomancy: old idea I stole from Pylons/Pyramid. I love it.
13:36bitemyapptechnomancy: I just make a mock request that asks for the JSON in the test cases.
13:36bitemyappit's proper "web" style to just use the content accept header to do this anyway.
13:36technomancyyeah, I've often wondered what a "proper" generalized content-accept system would look like in ring
13:36coventry(I'm porting Compiler/load to clojure. Don't suppose anyone knows of prior work along these lines?)
13:36technomancyI should have known the answer would be middleware
13:36technomancyit is always the answer
13:37bitemyapptechnomancy: I don't do it through middleware, but that's an option.
13:37bitemyapptechnomancy: I capture the request through a dirty macro and condition the behavior against the content of the request.
13:37xeqiit also leads to pure view functions that take a map of vars, which I like
13:37technomancyhuh, a map of vars?
13:37bitemyappxeqi: this only works nicely partly because Selmer is Django-style templating and naturally accepts an associative data structure to create the template rendering context.
13:38bitemyappwhich can just be returned as a map or JSON anyway.
13:38xeqitechnomancy: eh, associative data structure of names to values
13:38technomancysure
13:39xeqibitemyapp: how are you doing layout wrapping outside of a middleware?
13:39bitemyappxeqi: Selmer dude.
13:39bitemyappxeqi: learn it, love it, live it. https://github.com/yogthos/Selmer/
13:40bitemyappalso, since we're on the topic of middleware, https://github.com/weavejester/clout/ <--- really useful.
13:41technomancyisn't cloud part of compojure?
13:41technomancyclout
13:41xeqiah, do it at the template level when they are loaded by the view functions. thats a good idea
13:41bitemyappxeqi: :)
13:41xeqitechnomancy: if you want your middleware to use compojure
13:41technomancyhuh
13:42technomancymaybe I should try writing a web app that's more than 500 lines some day
13:42bitemyapptechnomancy: yeah but then hair sprouts from your knuckles and you turn into me.
13:43xeqiis there a good ring content negotation lib?
13:44bitemyappxeqi: https://github.com/rnewman/clj-conneg https://github.com/ngrunwald/ring-middleware-format
13:44bitemyappnothing super-holistic.
13:46TimMcbitemyapp: Is (2) written by the son of a well-known economist, by any chance?
13:49coventryWhat is the right way to refer to LispReader.ReaderException in clojure catch clause?
13:49degtechnomancy: fyi, :main from a library class works fine, as expected.
13:50xeqi,clojure.lang.LispReader$ReaderException
13:50clojurebotclojure.lang.LispReader$ReaderException
13:50coventryxeqi: Thanks.
13:50bitemyappTimMc: don't think so.
13:55coventryWhat's the right way to create a new Compiler/CompilerException for throwing? ##(clojure.lang.Compiler$CompilerException. "foo" 1 2 (Exception. "bar"))
13:55lazybotjava.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.Compiler$CompilerException
13:55coventryHuh, that's a different error message than I get in my repl. I get ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
13:56coventryOh, do I have to explicitly make the arguments ints?
13:56xeqi&*clojure-version*
13:56lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
13:57rasmusto##*clojure-version*
13:57rasmusto,*clojure-version*
13:57clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
13:58indigoLazybot is lazy, it's two versions behind ;P
13:58coventryGood to know. I generally choose between the two depending on where it is in my message text. :-)
13:59TimMcbitemyapp: Anyway, I'd be curious to hear that recommendation. I like well-founded magic systems.
14:00coventryOh, my repl is horked. Can create a CompilerException instance without problems in a new one.
14:02bitemyappTimMc: Mistborn
14:08coventryI'd be grateful if someone with java interop experience could take a look at https://www.refheap.com/19541 vs https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7034 The logic is pretty simple, it's the java interop expressions I'm likely to screw up.
14:22craigbroblurp
14:24dnolenjonasen: re: cljsfiddle.net so are you thinking about passing compiler warnings to the front end? Also if you have any suggestions about changing how we emit warnings to make them easier to report in cljsfiddle.net I'm all ears - I want to make the warnings usable by tools.
14:24coventryupdated so at least it compiles. :-) https://www.refheap.com/19541
14:34Fer__Hello, what's the reasoning behind making thread pools size = number of processors + 2. Google doesn't tell me much
14:35jtoyhow does one get ring/jetty to bind to 0.0.0.0 ?
14:37joegallo_Fer__: well, i mean, of course you want at least the number of processors. so that's a start. and then two better is like practically twice as good, no doubt. one wouldn't be nearly enough and three would be utter lunacy.
14:37joegallo_Q.E.D.
14:37clojurebotNo entiendo
14:38Fer__clojurebot: me neither
14:38clojurebotexcusez-moi
14:40jtoynm, isee
14:41technomancy"Two shall be the number of the counting, and the number of the counting shall be two. Five is right out."
14:43degIf my project includes a library twice (once directly, and once via another library); and if the included library has a top-level def of an atom; then what happens?
14:43degDoes java have some defined linker-like behavior, or is it just a window to disaster?
14:43coventrydeg: Depends on how you include. If you use require/use, and don't use :reload, it only gets executed once.
14:44Fer__=[
14:45technomancydeg: only an issue during development
14:45degHmm, that's good but makes it less clear what lossage I'm hitting. Probably I'll shout back in a few minutes when I've debugged further.
14:45degtechnomancy: what do you mean?
14:46technomancydeg: the atom will get reset back to the initial value whenever you reload, but reloading only happens in development
14:46coventrydeg: You can verify the number of times it's executing by putting a println in the included file.
14:46degI see; good idea.
14:46aaelonyfirst foray into clojurescript... I have clojurescript code that uses a data structure to create a visualization. Should my existing clj code (1) talk to the database and write the data out to file such that the cljs code can pick it up, or (2) should I attempt to make cljs talk directly to the database? What do people recommend?
14:47TimMcFer__: http://stackoverflow.com/questions/13834692/threads-configuration-based-on-no-of-cpu-cores
14:47TimMcThat doesn't tell you why a thread pool is cores + 2, but it does have some good discussion of how one might pick such a number.
14:57Fer__TimMc: thanks
15:00degI'm starting my project with lein ring-server headless. I have code in one .clj file, including a top-level println, that doesn't run when the project starts. (And, a println in another file, the one tagged :ring in the project.clj, does print, so it's not a stdout problem).
15:03coventryYay, my Compiler/load clone works with only minor modifications.
15:04degHmm, if I require the second file from the main file, then I see its println. Does lein ring only include files that are transitively required by the entry point?
15:06gfredericksdeg: yeah that sounds plausible
15:06deg(yeah, I know that sounds dumb. ... how could code be needed if its not called from the entry point. Full story, effectively, is that the other code is loading plug-ins that get registered in an atom owned by the main file)
15:07degAm I just barking up a path that can't work?
15:07gfredericksand you don't want to require it from the entry point because that seems like the wrong responsibility?
15:07degExactly.
15:08gfredericksso who cares about this? the entity starting the server?
15:08gfredericksif you could do this from your project.clj somehow would that feel better?
15:08degIn the fuller picture, the problem may go away, because there will be a diamond dependency that will fix the problem (I think). Full story is:
15:09degOne small project, "muxx" is a bit of compojure code that dispatches to multiple small websites.
15:09degEach website will be its own project and will register itself with muxx.
15:10degA deployment will be another tiny project that will just list all the websites that are deployed together on one site.
15:11degSo, if I made the main entry point be the deployment site, then all should work. But, since there will be multiple deployments, I'd rather not duplicate code and instead have the entry point always be in muxx.
15:11deg(end of typing)
15:11llasramdeg: `require` is a function -- you can provide config which lists the namespaces to `require`
15:14degllasram: I see, but not quite sure how to apply that. ...
15:14degI guess the deploy site could ask muxx to require each of the needed website namespaces. Yeah, a bit more plumbing than I'd like, but I can see that working, I think.
15:17piranhadnolen: are you by any chance here? I discovered one thing and I'm not sure if that's intended or not...
15:17dnolenpiranha: what's up?
15:18piranhadnolen: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L211 - this take-while here basically says 'this file can provide only single module'
15:18piranhaI just have a big file with lots of modules in there...
15:18piranhaand if I comment this take-while out, it gets in
15:19piranha(I'm still trying to join a gcc-modularized stuff with :libs option)
15:19piranhaso the question is if you think it would be harmful to remove this line
15:20dnolenpiranha: why do you have file with multiple modules?
15:21degllasram: gfredericks: (can IRC flag two folks?) Actually that doesn't, because the websites need to require the muxx ns to call its api. So, I can't require them back since cycles are not allowed.
15:21piranhadnolen: closure compiler has a mode to convert a lot of file using CommonJS modules into a single file using goog.provide/require
15:21degSo, looks like my only choice not to have my entry point in muxx, but rather in the deployment. Right? sigh.
15:22dnolenpiranha: and it can't convert them into separate files?
15:22piranhadnolen: at least I can't find how... it just spits them in the stdout
15:23llasramdeg: They're only not allowed when they're actually recursive. You can have `muxx` expose a function which when called causes it load other namespaces, even namespaces which themselves require `muux`.
15:23dnolenpiranha: I would investigate some more, or figure how to make Closure do the right thing. Dependency resolution in closure.clj assumes module -> file, I don't want to complicate that logic at all.
15:24piranhadnolen: oh... I see, maybe I can separate this stuff to small files
15:24dnolenpiranha: yes
15:25degllasram: Really? Wow. Why is that not considered to be a cycle?
15:25piranhadnolen: also, unrelated things - maybe you can suggest something... if a library gets compiled in advanced mode and something small is failing, what do you usually do to discover what it is?
15:25llasramdeg: Because it isn't a load-time cycle
15:25llasramThe `muxx` namespace is already loaded. Once fully loaded, it's free to cause other nses to be loaded which depend on it
15:26degllasram: cool. And, the run-time load will still cause one-time evaluation of all forms in the loaded namespace?
15:27llasramYep. `require` has the same effect at "run time".
15:28degThanks. This is going to be a fun API to define; loads of trampolining.
15:29degMight even become generally useful. My motivation is that I have some VERY lightly-used personal sites, and I want to deploy multiple sites onto one cloud-hosted site to reduce deployment costs.
15:30llasramOh -- in a way that using e.g. jetty as a multi-application container doesn't already support?
15:30jcromart_why the heck is clojure.xml even still there?
15:30deg???? OH. I didn't know jetty already had this support.
15:31degMy guess, then, is that I was just reinventing the wheel. Guess I should take a long pause and look at the jetty docs.
15:31jcromart_is there any reason hiccup would be inappropriate for generating XML?
15:31degBig thanks! You probably just saved me a few hours.
15:32llasramHah. I've never done it myself, but I know some people here do (e.g. amalloy IIRC)
15:32llasramAnyway, good luck :-)
15:33amalloywe've actually stopped doing it, llasram. too much arcane jetty weirdness for little benefit, given the server resources we have available
15:33degServes me right for trying to program web sites in Clojure without knowing the first thing about J2EE.
15:33degamalloy: Do you recommend that I wrestle jetty, or roll my own in Clojure?
15:33amalloymeh
15:34amalloyrolling your own version of jetty sounds kinda pointless
15:34degagreed, until you said "too much arcane jetty weirdness". Definitely 'meh' either way.
15:35amalloyi can't imagine why you would write it to have cycles, though, if you were going to do it. have the server namespace expose hooks, or functions that take a handler, or something. there's no reason at all it should know about the various handler namespaces
15:36degIdeally, yes. The only reason for the cycle is if I want the ring entry point to be in the server, then I needed (per above) some way to tell the loader to bring in the namespaces that will register with it.
15:36amalloyor have a -main function that calls (muxx/serve [{:sitename "foo" :handler f} {:sitename "bar" :handler g}])
15:36amalloyand -main requires the namespaces containing f and g itself
15:37Morgawrquestion.. how can I run a .clj file/script from the command line with lein? Like in clojure normally I can just do "clojure myscript.clj" and it will compile + execute the single file
15:37degYup. The only downside of that is that I then need to write a -main for each deployment. But, I'm being silly. I can reduce that down to one line of code.
15:37MorgawrI want to do the same with lein
15:37Morgawrwithout having to create a whole project
15:38degSo, yeah. Looks like choice 1 is to see if Jetty just does what I want. Choice 2 is to let the -main be the deployment. The hairy namespace cycles are a distant choice 3.
15:39jonasendnolen: re:warnings. I'm planning to start with the new error messages and see if I can highlight the offending code in CodeMirror. And yes, if I can easily pass warnings I'll do that too.
15:39degThanks all. Hitting the witching hour in my timezone. I think I've got my marching orders for tomorrow. g'nite all.
15:39jonasendnolen: I'm not a big fan of warnings in general.. I like that in golang there are no warnings, either the code compiles or it doesn't.
15:43noonianMorgawr: https://github.com/kumarshantanu/lein-exec
15:43Morgawrnoonian: thanks!
15:44meliponehello! I have a (print ".") in a loop statement before the recur but it does not print. Changing that to println works but I don't want that. What to do?
15:45joegallo_print doesn't flush
15:45joegallo_you need to flush
15:46meliponeha! thanks
15:47TimMcThere
15:47TimMcThere's also *flush-on-newline*, incidentally.
15:47TimMcIt's not quite what you're asking about, but it's worth knowing that it exists.
15:47meliponeTimMc: thanks
15:48TimMc(I don't think you can test it in the REPL, since the REPL seems to call flush...)
15:48dnolenpiranha: used to be quite hard, now you can use source maps
15:49dnolenjonasen: yes, but CLJS compilation model is a bit trickier because of things like browser REPL where you don't currently consistently know what has been defined
15:52jonasendnolen: yeah, I'm sure there are good reasons. That's why I said "in general" :)
15:54Morgawrbest way to remove all odd positions in an array?
15:54Morgawrlike I have [1 2 3 4 5] and I want to have [2 4] (content doesn't matter, it's the index that matters)
15:55jonasendnolen: When are you planning a new cljs release?
15:56jonasenany blocking issues?
15:56Morgawroh, looks like I want take-nth
15:56TimMcmelipone: Cancel that, you can test it in the REPL... I just made the mistake of using Thread directly, which doesn't convey *out*.
15:56sroyhi, new to clojure and I have a "import" question if anyone would like to help me
15:56TimMc(def nf (future (binding [*flush-on-newline* false] (loop [] (Thread/sleep 500) (println "foo") (recur)))))
15:56dnolenjonasen: not really, probably later in the week, did you land a change that cljsfiddle really needs or something? the alias thing?
15:57TimMcAnd then run (flush) after a few seconds.
15:57meliponeTimMc: ok
15:57jonasennah, no hurry.
15:58jonasenI did notice the alias issue there but it's not a big thing
15:58jcromart_Could I dispatch a multimethod based on set membership?
15:59jcromart_it's a little messy, I'll admit
15:59scriptorlooking at gensym, is the heart of its implementation based on AtomicInteger and incrementing it every time it's called?
16:01Fer__jcromart_: you can dispatch on anything! :P
16:01jcromart_I've kind of got it going now
16:01jcromart_but I mean can I specify a dispatch value and test if that value is a member of a set?
16:01jcromart_It's potentially ambiguous
16:01jcromart_which is a bit troubling
16:02namccartyscriptor: http://clojuredocs.org/clojure_core/clojure.core/gensym
16:02coventryscriptor: That's how I read it. Interesting that there's no checking for collision with existing symbols.
16:02namccartyexpand the source fold
16:02scriptornamccarty: yeah, I know how to use clojuredocs
16:02Fer__jcromart_: Sorry. I'm not following.
16:02scriptorI was looking at RT.java
16:02Fer__dispatch values are functions
16:03namccartyIt does indeed look like it has an atomic integer it is incrementing
16:03jcromart_Fer__: functions that return values, which must "isa?" the dispatch value in a defmethod
16:04scriptorcoventry: that surprised me too, maybe they get around it with the prefixing
16:06CreapI have a seq of functions that I want to apply to each item in a seq (the seq is a line-seq from a BufferedReader). I currently have (doseq [line (map parse-line lines)] (doseq [cb cbs] (cb line))))
16:06coventryjcromart_: You could probably get the effect you're looking for by representing the sets in (derive) relationships. Then you would get errors when the relationship was ambiguous.
16:06CreapI just have a feeling there is a more Clojure:ish way, this is my second day with Clojure..
16:07coventryCreap: (apply juxt cbs)?
16:07coventryThat will generate an unused vector of the results, though.
16:07Creapand the seq is lazy so it would be a no-op?
16:09CreapI noticed my first attempts were basically imperative programming within let macros, so now I'm making another attempt trying to dig into the list processing
16:09coventryNo, ((apply juxt cbs) line) should be eager.
16:11ToxicFrog(->> lines (map parse-lines) (map (apply juxt cbs)) ?
16:11TimMc&[(gensym) (gensym)]
16:11lazybot⇒ [G__85825 G__85826]
16:11TimMc&[(gensym) (gensym)]
16:11lazybot⇒ [G__85836 G__85837]
16:11ToxicFrog(doc apply)
16:11clojurebot"([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."
16:11TimMc&(let [g (gensym)] [g (= g 'G__85847)])
16:11lazybot⇒ [G__85847 true]
16:11ToxicFrogOh wait, juxt is not comp
16:12TimMccoventry: ^ Clojure's genysm just isn't very good.
16:12Creapwhat do you mean with "not comp"
16:13ToxicFrogCreap: given a line line and a set of callbacks f g h, do you want [(f line) (g line) (h line)], or (h (g (f line)))?
16:13Creapthe former
16:14ToxicFrogOh, then you do want juxt. Ignore my confusion!
16:14TimMcExtra credit: Come up with f, g, h such that (= ((comp f g h) 5) ((juxt f g h) 5))
16:15ToxicFrogI think (->> lines (map parse-lines) (map (apply juxt cbs)) will actually do what you want, then.
16:15hyPiRionTimMc: is that actually doable?
16:15TimMcI dunno.
16:16CreapI'm writing an IRC program, I just call this function with a seq of callbacks that will be invoked for each line, from a line-seq
16:16TimMchyPiRion: I think it is.
16:16hyPiRionyeah, I can see a way now I think
16:17coventry,(let [g (gensym) d (Integer/parseInt (re-find #"\d+" (str g))) g2 (symbol (str "G__" (inc d)))] ((juxt identity eval) `(let [~g2 (gensym)] ~g2)))
16:17clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
16:17coventryBah. My output was [(clojure.core/let [G__25216 (clojure.core/gensym)] G__25216) G__25218]
16:18TimMc&(let [f #(if (= % 7) [:hi 6 6] :hi) g inc h inc] (= ((comp f g h) 5) ((juxt f g h) 5)))
16:18lazybot⇒ true
16:18TimMcBAM
16:18TimMc^ Spoiler, sorry.
16:19TimMcAs for the general case... I *think* I have an answer for that as well.
16:19CreapToxicFrog: It just returns nil, I probably need doseq?
16:20coventry"Gensym collisions can be engineered." https://groups.google.com/forum/#!topic/clojure/-054P1u5M7o
16:20mtp"doseq uis"
16:20scriptorhah
16:21coventryCreap: Wrap it in (doall)
16:21scriptoryeah, I guess the only concern is that eventually someone might write a convoluted enough of a mess and runs into this problem
16:21llasramCreap: OR `dorun` if you don't care about the return values
16:22Creapyeah, that worked. cool
16:22scriptorI guess using a combination of microtime and a random integer would be a bit safer
16:22hyPiRionTimMc: Find f, g, h such that (= ((comp f g h) x) ((juxt f g h) x) [x x x])
16:22scriptoranyway, good to know I can implement gensym in my lisp in a minute
16:23hyPiRionnot sure if that's possible
16:23TimMchyPiRion: Oh, that's actually easy. I think.
16:23hyPiRionTimMc: not sure what h may be there.
16:26TimMcOh, nope. So much for that.
16:27`cbpyou can if it's [[x] [x] [x]] instead :P
16:28hyPiRionwell, there's one way I think
16:29coventryOops, there are a few more gensyms in the construction of that form, I guess. Have to inc it a couple more times: ##(let [g (->> (gensym) str (re-find #"\d+") (#(Integer/parseInt %)) inc inc inc (str "G__") symbol)] ((juxt identity eval) `(let [~g (gensym)] ~g)))
16:29lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
16:32TimMchyPiRion: You're gonna like this...
16:32TimMc&(let [gross (reify Object (equals [_ x] true)), f #(if (identical? % gross) [gross gross gross] gross), g (constantly gross), h (constantly gross), x 5/19] (= ((comp f g h) x) ((juxt f g h) x) [x x x]))
16:32lazybot⇒ true
16:32`cbpLOL
16:32hyPiRion(inc TimMc)
16:32lazybot⇒ 49
16:33llasram(inc TimMc)
16:33lazybot⇒ 50
16:33scriptor&(gensym)
16:33lazybot⇒ G__86045
16:34scriptor&(gensym)
16:34lazybot⇒ G__86055
16:34scriptorhmm
16:34hyPiRion&(let [sym (gensym) h #(with-meta % {sym true}) g #(if (-> % meta sym) (constantly %) %) f #(if (fn? %) [(%) (%) (%)] %) x 'foo] (= ((comp f g h) x) ((juxt f g h) x) [x x x]))
16:34TimMc(inc amalloy) ; who I learned that trick from, I think
16:34lazybot⇒ true
16:34lazybot⇒ 72
16:34hyPiRiondoesn't work for non iobjs though
16:39TimMchyPiRion: g can be identity, and f can take g's dispatch and avoid wrapping stuff in fns
16:40TimMcThat allows you to use a pipeline of n >= 2 fns.
16:40hyPiRionwehey, generalized.
16:46technomancyMorgawr: not sure if you found this, but a better solution than lein-exec is to use clojure.main
16:46technomancylein run -m clojure.main/main -i somefile.clj
16:46Morgawrtechnomancy: ah, that's nice too
16:46Morgawrthanks
16:58JanxSpiritwhat is the current recommended toolset for building REST services in Clojure? I'm thinking something lightweight like Scalatra, without MVC or presentation at all - Json, auth, content negotiation etc would all be great
17:01TimMchyPiRion: I had been thinking of using state and blocking, but juxt and comp evaluate the fns in opposing orders.
17:01TimMcIt would also be hard to achieve state separation.
17:02noonianJanxSpirit: on top of ring you could use compojure for routing, friend for auth, and there are ring middlewares for serializing different formats based on the content-type
17:03JanxSpiritnoonian - cool…so it's sort of mix and match the pieces you want. Are there any projects similar to Dropwizard for Java that group together the commonly used bits so they all play nicely?
17:04JanxSpiritmaybe it's not as much of a consideration for Clojure?
17:04katratxoJanxSpirit: http://clojure-liberator.github.io/liberator/ ?
17:04noonianJanxSpirit: I've never heard of Dropwizard, but I think luminus does something like that http://www.luminusweb.net/
17:06noonianJanxSpirit: luminus is basically a minimal project that has already put the pieces together, for what you want you would probably want to take out the code and dependencies for templating and what not
17:06noonianJanxSpirit: but for getting started, it might be wiser to start from something simpler like the compojure_app template
17:06noonianand just add in libraries as you need them
17:06JanxSpiritlooks like a similar idea - thanks noonian and katratxo
17:07JanxSpiritsounds like a plan
17:07JanxSpiritis there a standard json serializer? or a wrapper for Jackson or something? Not asking anyone to Google for me - I've looked around - just wondering if there's one that's preferred
17:09xeqiJanxSpirit: I perfer chesire
17:09xeqihttps://github.com/dakrone/cheshire
17:10JanxSpiritthanks xeqi
17:12technomancy"Discerning Clojure programmers prefer the freshness and exciting taste of Cheshire-brand JSON products."
17:13danlarkin...it's toasted
17:16noonianyeah, cheshire's got a sweet name and its api is a superset of the other json library thats in use think
17:18joegallo_cheshire's a pretty good library, but that dakrone is a bit of a pill -- not the nicest guy you'll ever meet
17:19joegallo_jk, he's totally the nicest guy you'll ever meet
17:19dakrone:)
17:20ThePawnBreakhow can I check whether a string is a digit/number?
17:23joegallo_,(every? #(Character/digit % 10) "123")
17:23clojurebottrue
17:23joegallo_,(every? #(Character/digit % 10) "12a")
17:23clojurebottrue
17:23joegallo_that's surprising...
17:24coventry,(binding [*read-eval* false] (number? (read-string "1e10")))
17:24clojurebottrue
17:24coventry,(binding [*read-eval* false] (number? (read-string "foo")))
17:24clojurebotfalse
17:24ThePawnBreak (remove number? "12gigi23")
17:24ThePawnBreak(\1 \2 \g \i \g \i \2 \3) -- could someone explain what's happening here?
17:24joegallo_ah, it returns the digits, not a boolean
17:24noonian,(#(try (Double. %) (catch Exception e nil)) "17")
17:24clojurebotnoonian: excusez-moi
17:24joegallo_,(every? #(Character/isDigit %) "123")
17:24clojurebottrue
17:24joegallo_,(every? #(Character/isDigit %) "12a")
17:24clojurebotfalse
17:24noonian,(#(try (Double. %) (catch Exception e nil)) "17")
17:24clojurebotnoonian: Titim gan éirí ort.
17:24noonianhmm
17:24ThePawnBreak,(remove number? "12gigi23")
17:24clojurebot(\1 \2 \g \i \g ...)
17:25ThePawnBreakthis is so awesome :)
17:25joegallo_ThePawnBreak: none of them are numbers, all of them are characters ;)
17:25noonian,((fn [n] (try (Double. n) (catch Exception e nil))) "17")
17:25clojurebotnoonian: excusez-moi
17:25noonianlol, why doesn't clojurebot like me?
17:25noonian,(+ 2 2)
17:25clojurebot4
17:25noonian,(Double "7")
17:25clojurebot#<RuntimeException java.lang.RuntimeException: Expecting var, but Double is mapped to class java.lang.Double>
17:25noonian,(Double. "7")
17:25clojurebot7.0
17:25noonian,(try (Double. "7"))
17:25clojurebot7.0
17:26noonian,(try (Double. "7") (catch Exception e nil))
17:26clojurebotnoonian: Huh?
17:26noonian,(try (Double. "7") (catch Exception e true))
17:26clojurebotnoonian: Gabh mo leithscéal?
17:26nooniandoesn't like catch
17:27seangrov`Is there still no built-in deep-merge for maps??
17:27lazybotseangrov`: Uh, no. Why would you even ask?
17:27ThePawnBreakhow can I get a string's length?
17:27noonian(count "1 2 3")
17:27noonian,(count "1 2 3")
17:27clojurebot5
17:27seangrov`Jesus, lazybot is uppity today
17:27awalker,(remove (set (map char (range 48 58))) "12gigi23")
17:27clojurebot(\g \i \g \i)
17:28TEttinger,(apply str (remove #(Character/isDigit %) "alpha123beta"))
17:28clojurebot"alphabeta"
17:28ThePawnBreakhere's what I came up with:
17:28ThePawnBreak(defn digit? [s]
17:28ThePawnBreak (if (> (count s) 1)
17:28ThePawnBreak false
17:28ThePawnBreak (number? (read-string s))))
17:28jared314can anyone point me to the source of clojure.core/import* ?
17:29TEttingerThePawnBreak, that will return true for 42
17:29ThePawnBreakI only care about strings
17:29coventryThePawnBreak: You'll need some exception handling for the reader complaining about unreadable forms.
17:30coventry,(read-string "(aonthun"))
17:30clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
17:30ThePawnBreakTEttinger: nope, it doesn't work at all for 42; count doesn't work on long
17:30ThePawnBreakhow the heck isn't this function in a library?
17:31nathanic,(re-matches #"\d" "4")
17:31clojurebot"4"
17:31TEttingersorry, "42"
17:31joegallo_maybe it's a less useful function than you think it is ;)
17:31coventryAlso, there was something about the reader being insecure earlier in the year, even with *read-eval* turned off.
17:31hiredmanhttp://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isDigit%28char%29
17:31joegallo_or your definition of library is too narrow, as hiredman is pointing out
17:32technomancyhiredman: I... wow.
17:32technomancywatch out for those Devanagari digits
17:32technomancythey get you every time
17:32amalloyTimMc: what the hell is this thing you're giving me credit for?
17:33hiredmantechnomancy: watch this
17:33dnolenjared314: you need to look in Compiler.java at ImportExpr
17:33hiredman,(Long/parseLong "३")
17:33clojurebot3
17:34jared314dnolen: thank you
17:34TimMc&(.getPort (java.net.URL. "http://google.com:६&quot;))
17:34lazybot⇒ 6
17:34TimMctechnomancy: ^
17:34technomancyoh dear
17:34TimMcProblem?
17:35TimMcamalloy: The reify-equals-constantly-true thing. You mentioned it in the context of cheat-y 4clojure answers.
17:35amalloyah
17:36TimMcYou inspired me to use it in production code!
17:36TimMc(Kidding.)
17:37TEttinger,(re-matches #"\p{Nd}" "\u0966")
17:37clojurebot"?"
17:37bitemyapphiredman: so...it's unicode aware?
17:37TEttinger##(re-matches #"\p{Nd}" "3")
17:37lazybot⇒ "3"
17:40tm3daHello, can anyone explain me why the following code throws StackOverflowError?
17:40tm3da
17:40tm3da(defn my-fn [a b]
17:40tm3da (swap! a #(assoc % :out [b]))
17:40tm3da (swap! b #(assoc % :in [a])))
17:40tm3da
17:40tm3da(my-fn (atom {}) (atom {}))
17:40mtpbecause it overflows the stack
17:41mtpcan you examine the backtrace and come up with an explanation as to why that might happen?
17:41TEttingerThePawnBreak, you would probably want to use (fn [s] (re-matches #"\p{Nd}" s)) for strings, or (fn [c] (Character/isDigit c)) for chars.
17:42TEttingerboth are unicode-aware.
17:42tm3daI will try.
17:42TEttingertm3da, use a pastebin for the stack trace?
17:42coventryFor safely reading numbers, this looks pretty cool: http://stackoverflow.com/a/2651056/1941213
17:42gfrederickstm3da: I'll give you a hint; that code executes without overflowing the stack
17:45ThePawnBreakTEttinger: thanks
17:45TEttingerI just should say, I have never used \p{Nd} before, but damn the whole \p set looks useful
17:46TEttingerthey're listed here http://www.regular-expressions.info/unicode.html
17:46TEttingeroh never mind, recommending \p{N} instead.
17:47Raynestechnomancy: Just got an email from a Sonian recruiter. Nostalgia.
17:47coventryThere's also clojure.tools.reader.impl.commons/match-number.
17:47technomancyRaynes: you're a hot commodity
17:47Raynestechnomancy: Well, I'm pretty sure it's random based on this guy seeing how many Clojure projects I have. :P
17:48technomancyRaynes: (sort-by (comp count :repos) (map tentacles/get-repos users)) ; clearly
17:48Raynestechnomancy: Clearly.
17:49technomancytentacles is some good stuff
17:49Raynestechnomancy: I doubt I'd be a first choice, given that one of their engineers really doesn't like me very much. :P
17:49TEttinger##[(re-matches #"\p{N}" "⁶") (re-matches #"\p{Nd}" "⁶")]
17:49lazybot⇒ ["⁶" nil]
17:50RaynesPossibly two.
17:50TEttingerRaynes, I don't dislike you in the slightest!
17:50Raynes<3
17:51technomancyRaynes: but have they considered http://p.hagelb.org/riker.gif?
17:51RaynesOnce or twice.
17:52RaynesTEttinger: What's your github username?
17:52TEttingertommyettinger , it's a mess
17:52TEttingerlots of old projects
17:52TEttingerlots of languages though
17:53TEttingerit doesn't have all my little scripts I write for utility, which are all clojure these days
17:54technomancyRaynes: weird; you mention recruiters and I cehck my mail fie minutes later and there are two recruiter emails in it
17:54technomancyare they in cahoots?
17:54bitemyapptechnomancy: the fire rises
17:55technomancyoh haha; one of them actually is Sonian
17:55technomancywelp.gif
17:56yedihas anyone played around with websockets in clojure
17:56s4mueli can't stop laughing at that riker pic.
18:00tm3daTEttinger: I've posted it here http://pastebin.com/Ep0Tqciw but still have no idea why is it happening.
18:01jeyedi: only a little but that was using Immutant: http://immutant.org/ (se two latest news entries)
18:03`cbp` tm3da: you are creating a circular reference
18:04cemericktechnomancy: it seems to be making the rounds
18:08tm3da`cbp`: I know I'm trying to have some graph structure in which each node knows its parent and its children and it has some cycles in it. Is there a better way to represent it?
18:08dcunit3di have a ui namespace where i want certain elements to redraw based on the value of atoms in another namespace. whats the best way to do that?
18:09dottedmagHow do the objects which are not Clojure functions nor Java functions work as functions? (such as :keyword in function position during evaluation).
18:09noonian.(fn? :foo)
18:09noonian,(fn? :foo)
18:09clojurebotfalse
18:09ucbdottedmag: IIRC they implement IFn
18:09noonian,(callable? :foo)
18:09clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: callable? in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:10dottedmag,(ifn? :foo)
18:10clojurebottrue
18:10dottedmagI see.
18:10dottedmagucb: thanks
18:10noonianah, thanks
18:13klokbask_core.async question: how do I cancel the process created by a go expression? the return value is the channel and not the process, as I understand it.
18:13gfredericks,((reify clojure.lang.IFn (invoke [me a b c d] (+ c d))) 1 2 3 4)
18:13clojurebot7
18:13gfredericksdottedmag: ^
18:14`cbptm3da: what you did is okish just don't try to print it :)
18:15`cbptm3da: try using a deftype for the same results but more idiomatic
18:15tm3da`cbp: thank you! It didn't occur to me that it can be caused by printing :)
18:18dottedmaggfredericks: and reify creates new object confirming to protocol(s)/interface(s) specified, right?
18:22tm3daJust out of my curiosity is in clojure a way how to print cyclic structures like it is in Common Lisp (*print-circle*)?
18:24`cbptm3da: *print-level* maybe
18:24nDufftm3da: If the CL printer emits something its reader can process back to the same structure, then no.
18:24nDufftm3da: ...but your question assumes CL knowledge not everyone here has.
18:24indigocoventry: Those guys replied and changed the channel name
18:25tbaldridgeklokbask_: you can't cancel processes. You could provide a channel and then have the process alt! on the channel, and exit early if it closes.
18:28tm3da`cbp: thanks
18:28dcunit3dla
18:28dcunit3dwoops
18:31tm3danDuff: yes, I should have formulated the question this way: Is in clojure way to print a cyclic structure? The CL part was only to better explain myself.
18:31nDufftm3da: again, are you printing it for human consumption, or consumption by the reader?
18:32nDufftm3da: which is to say, does it need to round-trip?
18:32nDuff...if you need round-tripping, I believe the answer is "no".
18:32tm3danDuff: just for human consumption
18:33nDufftm3da: ...so, first, it's actually tricky to get a cyclic structure in Clojure; we don't have cons cells here.
18:34TimMcAt least not mutable cons cells.
18:34nDufftm3da: ...beyond that, the answer `cbp gave you was on-point (in terms of limiting recursion depth).
18:35nDuffIt's not a great answer, but, well, it's not a common situation.
18:37tm3danDuff: thank you. I've just made it work with *print-level* :)
18:48technomancycyclic structures are technically possible with laziness, but you basically have to go out of your way to make them
19:05no7hingwhen i have multiple implemented protocols in a namespace, want one of them instantiated and def'ed in said namespace - what is the smartest way to call the functions on that instance from other namespaces?
19:07noonianno7hing: you should just be able to call them and the protocol's dispatch should call the correct implmentation
19:08noonianyou have to require the namespace with the protocol definition
19:08hyPiRionYou don't need mutable cons cells to get cyclic structures though, but you need unbound variables at least.
19:16scriptorhttps://github.com/clojure/tools.emitter.jvm
19:16scriptorhmmmmmmm
19:16scriptoram I late in everyone talking about this?
19:16no7hing@noonian this is the gist to my question https://gist.github.com/mhaemmerle/6893036
19:19no7hingi want to encapsulate the service behind namespace 'a' in the gist without a client needing to care about a concrete instance
19:19noonianno7hing: I commented on the gist, you need to explicitly implement the P protocol in your deftype
19:19no7hingobviously line 21 is the exact opposite
19:19no7hingsry, forgot that
19:19noonianI think the dynamic var part just makes it more confusing
19:21no7hingmaybe it's (my) the wrong take on it and i should just ditch protocols here
19:21noonianno7hing: I think the deftype is also missing a vector of fields
19:22no7hingsorry for supplying such a bad gist, i just wanted to illustrate the point behind the setup
19:23noonianno worries, I think what you are doing is fine, but from namespace b's perspective, it should just care about the functions described with the defprotocol
19:24noonianinstead of the dynamic var I'd just write functions that operate on some instance, and then whichever instance (an instance of Foo or Bar in this case) is passed in will be the one whos implementaion is used
19:25noonianyou can also use extend-protocol to give implementations of your protocol for already existing type, like clojure maps
19:26no7hingbut if i want to work with that same instance from multiple namespaces, to stay with the example e.g. from (ns c), then i'd have to store it somewhere
19:26noonianno7hing: you very rarely have store things like that
19:27nooniannormally, in (ns c) you would declare other functions, and whichever namespace you do stuff from you would require those functions from a, b, and c and then call them passing in a specific instance
19:28noonian(def foo (Foo.)) (fn-from-ns-b foo) (fb-from-ns-c foo)
19:29no7hingin this case it's a service-wrapper that's used from multiple places
19:32nooniando you have to create your instance at runtime because or credentials or something? I usually use an atom or dynamic var for the credentials in those cases and still make the object instances manually using those credentials
19:33noonianit would probably work the way you are doing it, but I still try to stay away from alter-var-root and using (binding [*blah* ...] ...) instead where I can
19:34no7hingbased on the configuration it would use either of the implementations - so at runtime
19:35no7hingi would write small wrapper functions that pass in the def'ed instance, but i thought there might be a better way
19:36no7hingthe way i got it in clojure land is that it's personal preference if an instance of e.g. a db driver is passed out to the user or wrapped inside the driver
19:36no7hingas in https://github.com/michaelklishin/welle/blob/master/src/clojure/clojurewerkz/welle/core.clj#L22 for example
19:39noonianyeah, although like in that example you usually set it to something concrete from a function or using a binding form (or macro that expands to one), instead of calling alter-var-root inline in your library code
19:39noonianthe alter-var-root won't affect other threads though, so make sure to call it before you spawn them
19:40no7hingare you sure about the last part?
19:40no7hingi thought binding would convert to a thread-local
19:42no7hingthanks for your extensive help!
19:43noonianno7hing: yep, Vars are thread local except for the initial root binding I believe
19:44noonianno7hing: if you want it to work across pools then you could use an atom instead
19:44noonianer, across threads
19:53no7hingthx
20:51FrozenlockAny advice on dealing with multiple domains with compojure?
20:53xeqiFrozenlock: what do you want to do with them?
20:55FrozenlockWell I'm hosting a website with compojure. Not really hard... run the server and forward traffic to the given port. But with multiple domains... it must be on a single compojure instance?
20:58xeqiare you wanting to serve the same site on multiple domains, or have multiple domains point to the same compojure app but be served different things?
20:59FrozenlockDifferent things.
21:00Frozenlockie I can't just run another server, because the port 80 and 443 are already taken by the first one.
21:01xeqiIf I was going to build an architecture this way, I'd use nginx, let it check the server name, and then forward to the right compojure app
21:02xeqibut you could check :server-name in the request and dispatch that way inside the compojure app
21:03FrozenlockAh, I'll look nginx, thanks!
21:03clojurebotCool story bro.
21:06ddellacostaFrozenlock: I've done it the latter way xeqi describes, with middleware, but I suspect getting the web server to handle it is a better solution.
21:06Frozenlockddellacosta: Yeah, it would even give me the opportunity to try the emacs webserver :p
21:19akurilinAm I correct to believe that you cannot do a comparison between a ratio and a double without explicitly coercing the former?
21:19akurilinOr I guess there's the == operator
21:20akurilinAlthough the docs say that = should also compare in a type-independent manner
21:25akurilinAm I interpreting the docs wrong?
21:27lunk,(= 5/2 2.5)
21:27clojurebotfalse
21:28gfredericksakurilin: slightly
21:28gfredericks= is type independent, but it won't compare exact numeric types to inexact numeric types
21:28gfredericksthe type independence refers to e.g., comparing longs and bigints, or lists and vectors
21:29akurilingfredericks, I'm just reading "compares numbers and collections in a type-independent manner" and == says "if nums all have the equivalent value (type-independent)"
21:29gfredericksthe distinction there does not sound obvious
21:29akurilingfredericks, I get what you're saying though.
21:29lunk,(== 5/2 2.5)
21:29clojurebottrue
21:30akurilingfredericks, so I'll just use == whenever I know I'm comparing non-integers from now on
21:30akurilinor at least one of the sides is a non-integer
21:30gfredericksanother difference is == can crash
21:31gfredericks,(== 3 nil)
21:31clojurebot#<NullPointerException java.lang.NullPointerException>
21:31gfredericksif you don't use numbers
21:31akurilinThat's fair. I like crashes.
21:31gfredericks:)
21:47logic_proghow big is clojure-mode + paredit + nrepl?
21:47logic_progI'm trying to understand why all efforts to rewrite an emacs-like editor in clojure has failed
21:48indigologic_prog: Emacs is too big to fail
21:49epicheroBecause nobody wants such a specific editor, efforts to write a new editor are huge efforts and it takes a community to flourish
21:49logic_progwhy does things liek eclipse, netbeans, intellij, and the such all have builtin editors then?
21:50epicheroBecause they have huge communities and millions in budget
21:50logic_progyeah; but everyhing I've read
21:50logic_progsaid clojure progs are 100x more producitive than java progs
21:50epicheroCool story
21:51epicheroThere are relatively few clojure programmers
21:51epicheroTake everything with a grain of salt
21:53uvtclogic_prog, I think there's a perception that Emacs is difficult. In reality, it's may be difficult to *program*, but it's pretty usable right OOTB. You just need to learn some key combos. I wrote up a little 10-minute tutorial article, if you're interested: <http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html&gt;.
21:53uvtcs/it's may be/it may be/
21:54epicheroi don't like emacs myself, but i have tuned evil mode and written hooks so i do it my own way
21:57epicheroIf you had a good team you might be able to crowdfund an emacs rewrite.
22:02uvtcMany have tried to rewrite Emacs in their language of choice ... so many, but none has succeeded.
22:02arrdemuvtc: yet. none have succeeded yet.
22:03uvtcarrdem, You're supposed to say, "tried and failed?" And then I make with the Dune quote. :)
22:03arrdemuvtc: sorry... it's been a few years since I last read Dune and that slipped my mind
22:04uvtcHehe. Sorry. Back to our regularly scheduled programming... :)
22:04arrdemuvtc: I see what you did there...
22:07uvtcI'd like to find an element of a sequence that matches some criteria. For instance, in a list of words, find the word that begins with "flu" ... is there a better way to do it than this: <https://gist.github.com/uvtc/6894751&gt;?
22:08arrdemuvtc: there's clojure.string/prefix?
22:08john2xuvtc: nice write up. why do I want to run it as "emacs &"?
22:08xeqi&(some (partial (re-find #"^flu")) ["florian" "fluid" "flack" "flask" "flan"])
22:08lazybotjava.lang.ClassCastException: java.util.regex.Pattern cannot be cast to java.util.regex.Matcher
22:08uvtcjohn2x, To send it to the background, so that you get your terminal window back. :)
22:09xeqibah
22:09uvtcack ... AFK for a moment ... thanks for the help. brb
22:10xeqi&(some #(re-find #"^flu" %) ["florian" "fluid" "flack" "flask" "flan"])
22:10lazybot⇒ "flu"
22:10xeqistill bah
22:10john2xbut why send it to the background where it can't be used?
22:10arrdemjohn2x: because he's implicitly using the X version of emacs I assume
22:12john2xoh ok. makes sense. I thought there was some cool trick I was missing. thanks :)
22:13mtpText Editor Users Hate him
22:14mtplearn how to write clojure using this one weird trick
22:16uvtcxeqi, Oh, nice. Thanks!
22:17uvtcjohn2x, Right. I'm running `emacs` from by terminal window running bash. Maybe I'll have to clarify that --- I just figure that's what everyone uses. :)
22:17uvtcmtp, hehehe :)
22:20TEttingerxeqi: ##(some #(re-find #"^flu\w+" %) ["florian" "fluid" "flack" "flask" "flan"]) ?
22:20lazybot⇒ "fluid"
22:21john2x:D so I guess using the GUI/X version of emacs is much more common? (as opposed to vim where terminal/gvim users are pretty-much 50-50) uvtc's writeup makes me want to give emacs a 2nd try this weekend.
22:22uvtcTEttinger, Ah, right. I wanted the whole word. Thanks. :)
22:23TEttingernp
22:53bergmarkI'm a bit of a clojure beginner and trying to debug a program. Is it expected that I get back nothing when I try to print the value of a lazy-sequence (such as the eturn from reduce)?
22:54bergmarkSorry I mean filter not reduce
22:54amehtabergmark: you might want to wrap the filter in a dosync
22:55arrdem,(doc dosync)
22:55clojurebot"([& exprs]); Runs the exprs (in an implicit do) in a transaction that encompasses exprs and any nested calls. Starts a transaction if none is already running on this thread. Any uncaught exception will abort the transaction and flow out of dosync. The exprs may be run more than once, but any effects on Refs will be atomic."
22:56uvtcamehta, You mean `doall`?
22:56arrdemuvtc: presumably...
22:56amehtauvtc: yeah thanks
22:57arrdemwow... pmap over map give me a 300x speedup 0.o
22:58bergmarkThanks to both of you. Its still printing nothing but presumably that means I've screwed up my filter pred.
22:59amalloyamehta: whoa, (dosync (filter ...) ...) is like never right, if that's what you're suggesting
22:59uvtcbergmark, one thing to keep in mind (which may or may not be relevant here), in the repl, expressions are evaluated eagerly --- since you presumably want to see what they evaluate to as you go. In your code, they are often lazy.
22:59amalloyoh, you said doall
22:59RaynesHow to tell your friend has gotten into category theory: [18:51:53] relrod: Raynes: so a profunctor is a bifunctor that is contravariant in the first argument and covariant in the second. *nod*
22:59amalloy(doall x) prints the same as just x, for all x
23:00amalloyusually you just want to be sure to use a print function from the pr family, such as prn, rather than one from the print family, such as println
23:01epicheroI like category theory in a way, i just don't like people who are really into it. It's like when mormons come to my door
23:01epicheroThey are good neighbors but i dont want to talk religion
23:01bergmarkamalloy: Thanks, I'll give prn a shot as well.
23:02TEttingerwhat's the predicate, bergmark?
23:02TEttingerheck, the line would be nice
23:05bergmarkprn seems to have done the trick. The filter was (filter #(= (get % "player_id") myId) state)
23:05TEttingerprn is just... pr with a newline?
23:05bergmarkstate is a seq of maps that were parsed from json, and I am trying to filter it to just the ones that applt to my id
23:06bbloomTEttinger: yup
23:06Raynes&(clojure.repl/source prn)
23:06lazybot⇒ Source not found nil
23:06Raynes$kill
23:06lazybotKILL IT WITH FIRE!
23:06uvtcAh, because `prn` flushes on newline?
23:06bbloom$source prn
23:06lazybotprn is http://is.gd/Xx0wYU
23:06bergmarkI was using println before, which apparently was not evaluating the lazy sequence?
23:06Raynesbbloom: lol
23:06Raynesbbloom: I forgot that even existed. Congratulations, you officially know more about my own bot than I do.
23:07bbloomRaynes: honestly, i wasn't sure WHICH bot was going to respond to that
23:07TEttinger,(prn [1 2 3])
23:07clojurebot[1 2 3]\n
23:07TEttinger,(println [1 2 3])
23:07clojurebot[1 2 3]\n
23:07TEttingerhm
23:07Raynesbbloom: best bot
23:07bbloom$lastseen bestbot
23:07bbloom$seen bestbot
23:07lazybotI have never seen bestbot.
23:07Raynes$seen bbloom
23:07lazybotbbloom was last seen talking on #clojure 1 second and 525 milliseconds ago.
23:07bbloom1.525 seconds ago?
23:07bbloomfeels like only yesterday
23:07TEttingerit's not hard to have that say what the last thng said was
23:08Rayneswat
23:08Raynes$logout
23:08lazybotYou've been logged out.
23:08Raynes$reload
23:08lazybotRaynes: It is not the case that you don't not unhave insufficient privileges to do this.
23:08Raynes<3 that text.
23:08bbloomi do not not don't can't read that not won't
23:09TEttingerwith some small changes, my bot does: TEttinger3 was last seen talking on #rgrd 3 hours and 9 minutes ago: after it timed out it responded again
23:09bbloomplease note: i have made no effort to have the correct number of negations in that sentence
23:09TEttingerif you want the source I have it lying around
23:11ucbis it possible to intern a var with meta-data?
23:12bbloom(doc alter-meta)
23:12clojurebotCool story bro.
23:12ucbI've tried something like (intern *ns* 'name (with-meta Thing {...})) but it doesn't seem to work
23:12bbloom(doc alter-meta!)
23:12clojurebot"([iref f & args]); Atomically sets the metadata for a namespace/var/ref/agent/atom to be: (apply f its-current-meta args) f must be free of side-effects"
23:12bbloom(doc reset-meta!)
23:12clojurebot"([iref metadata-map]); Atomically resets the metadata for a namespace/var/ref/agent/atom"
23:12bbloomucb: you can use those on #'some/var
23:13TEttingerRaynes: https://dl.dropboxusercontent.com/u/11914692/seen.clj
23:13ucbbbloom: cool, will try with that. I was hoping I could directly intern a var with meta-data.
23:15bbloomucb: i think you can… you just need to with-meta on the symbol
23:15bbloom(doc intern)
23:15clojurebot"([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var."
23:15bbloomucb: note the last sentence
23:15ucbooh
23:15ucbI've been doing it wrong then
23:17ucbbbloom: awesome. It worked. Thanks for making me notice the last sentence :)
23:17indigo(fire intern)
23:17indigo;P
23:22bitemyappindigo: harsh
23:23indigoHehe
23:23indigoI'm scared to put our intern's code into production
23:23indigoEven though he has an MS in CS
23:23arrdemindigo: just you try it...
23:28Raynesindigo: I'm younger than he is and have no degree. Want some code?
23:28arrdemRaynes: sometimes I'm really really jelly of that...
23:29RaynesJelly of my degrelessness?
23:29Raynesdegreelessness*
23:29indigoRaynes: I'm also younger than him and have an unrelated degree
23:29Raynesindigo: <3
23:29indigoBut I guess that's why he gets to be the intern ;)
23:29indigo:D
23:29Raynesarrdem: It was really easy to no get a degree.
23:29logic_progfor clojure libraries, we have hiccup for HTML, and garden for CSS -- is there any standard library for outputting SVG ?
23:30TEttingergah who keeps dropping these nodebots in here
23:30Rayneslogic_prog: SVG is XML.
23:30logic_progwhat does this mean?
23:31RaynesIt means you probably want an XML library and not an SVG library. For example, data.xml
23:31TEttingerhttps://github.com/pallix/tikkba ?
23:31RaynesSure, that works too.
23:32TEttingeralso for Raynes' approach, http://www.learningclojure.com/2010/10/generating-xml-to-make-svg-vector.html
23:32amalloybbloom: "atomically resets" is a strange phrase to use, in the docs for reset-meta!
23:33RaynesWith the caveat that that article uses old contrib and thus isn't particularly useful.
23:34TEttingerhttp://liebke.github.io/analemma/ then :-)
23:34bbloomamalloy: why?
23:34bbloom(doc reset!)
23:34clojurebot"([atom newval]); Sets the value of atom to newval without regard for the current value. Returns newval."
23:34amalloybbloom: what does "atomic" mean, in the context of "set this thing to x, ignoring what it was before"
23:35bbloomamalloy: i'd assume it implies that the metadata is a volatile or something like that
23:35amalloylike...you won't somehow end up with a corrupted pointer?
23:35bbloomisn't that a possibility in C? :-P
23:36bbloomheh: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AReference.java#L16 i guess it's just a normal field :-P
23:36bbloom*shrug*
23:36amalloywell, i don't think any of the C standards address multithreading at all. so anything at all is possible
23:36amalloyc++11 does, but nothing before that
23:36bbloommy guess is alter-meta! was written first and reset-meta! was involved a copy paste of the doc string :-P
23:37bbloomcopy paste: the original prototypical inheritance
23:44uvtcOk. I see that, in the source for lein-exec, the leiningen.exec/deps function does indeed use pomegranate: <https://github.com/kumarshantanu/lein-exec/blob/master/src/leiningen/exec.clj&gt;.
23:44uvtcOooof. Sorry, wrong channel.