#clojure logs

2013-05-01

11:52hyPiRion,(as-> x {} (assoc x :a 1) (assoc x :b (+ 1 (:a x))))
11:52clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:52hyPiRionwell, well, well.
11:52hyPiRion,(as-> {} x (assoc x :a 1) (assoc x :b (+ 1 (:a x))))
11:52clojurebot{:b 2, :a 1}
11:53llasramYeah, that ordering is weird
11:54hyPiRionyeah, I don't like it.
11:55hyPiRionI suppose it's for making it usable within (-> ... (as-> x ..))
11:58llasramThat makes some sense...
11:59chouser_logwhere is as-> from?
11:59mpenetclojure 1.5.x
12:01chouser_logok, thanks.
12:05gdevchouser_log:) set log level to debug
12:09chouserheh, fixed, thanks. :-)
12:18gdevchouser:) the article you and Fogus posted on dr dobbs is on the front page, nice
12:18gdevalso ishows up in the "most popular" side widget as well
12:19chouserooh, nice.
12:20jchaunceyanyone know of a good tutorial on thread-first thread-last macro usage?
12:23gdevif none exist, would you like to create one?
12:24ucb+1
12:25gdevjchauncey:) I think the examples http://clojuredocs.org/clojure_core/clojure.core/-%3E and http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E are pretty good
12:27gdev,(Integer/parseInt "1100100" 2)
12:27clojurebot100
12:27gdev,(Integer/parseInt "11001001" 2)
12:27clojurebot201
12:29gdev,(-> "oh hai" .toUpperCase (.replace "H" "B"))
12:29clojurebot"OB BAI"
12:29papachanhey
12:31gdev,(->> (range 1 10) (filter even?) (reduce +))
12:31clojurebot20
12:38justin_smith,(+ (*) (*) (* (+ (*) (*)) (+ (*) (*) (*) (*)) (+ (*) (*) (*) (*) (*))))
12:38clojurebot42
12:38chouserswearjure
12:40gdev,(+ #_(clojurebot, what is the answer to the universe????) (*) (*) (* (+ (*) (*)) (+ (*) (*) (*) (*)) (+ (*) (*) (*) (*) (*))))
12:40clojurebot42
12:42justin_smith,(+ (+) (*) (+) (*) (+) (* (+ (*) (*)) (+ (*) (+) (*) (+) (*) (+) (*)) (+ (*) (+) (*) (+) (*) (+) (*) (+) (*))))
12:42clojurebot42
12:42shriphaniHi, I have a question about clj-time. This is clearly not right: (clj-time-coerce/to-date 1325376000) => #inst "1970-01-16T08:09:36.000-00:00". What is the right routine to accomplish this ?
12:43mpenet,(java.util.Date. 1325376000)
12:43clojurebot#inst "1970-01-16T08:09:36.000-00:00"
12:44mpenet,(java.util.Date. 1325376000000)
12:44clojurebot#inst "2012-01-01T00:00:00.000-00:00"
12:44shriphaniah. milliseconds.
12:44mpenetclassic
12:55gdevclojurebot:) tell me about your mother
12:55clojurebotMy mother? I'll tell you about my mother
12:56AimHereclojurebot: open the pod bay doors
12:56clojurebotI'm sorry, AimHere. I'm afraid I can't do that.
12:58gfredericksclojurebot: botstack
12:58clojurebot/me puts lazybot on his head and gropes blindly for a third bot to complete the stack.
13:07muhooanyone else notice that some simple things take much longer to get working in clojure than in other languages?
13:07muhoolike, i'm working on a simple web app, prolly would take me a half hour in php, maybe a couple hours in rails (due to all the MVC BS), but it's taking days in clojure
13:08trinarylots, but only because I have absolute no idea what I'm doing in clojure yet :)
13:08muhootrinary: yeah, i figured that might explain a lot in my case as well
13:08shriphaniis there a way to have 2 main classes ?
13:09shriphaniI know it is shitty design but I have two files that are more like individual scripts
13:09shriphanibut I would like to get 2 jars when I lein uberjar
13:12technomancyshriphani: you can just do `java -cp myjar.jar my.main1` and `java -cp myjar.jar my.main2`
13:12sohailso ladies and gentlemen, I'm looking at https://github.com/vedang/clojure-emacs and it seems that for some reason, they are not supporting slime?
13:14dnolensohail: nrepl.el has taken over, slime support was basically not going anyway
13:15shriphanitechnomancy I don't see a .clj in those commands. (sorry I am a complete jvm noob).
13:15sohaildnolen, thanks, is nrepl as good as slime for lisp?
13:16technomancyshriphani: :main only affects what `java -jar ...` uses. with `java -cp ...` you can specify your own main.
13:16sohailok, technomancy is doing it so I trust it is right
13:16technomancysohail: nrepl.el is better in some ways and worse in others.
13:17sohailtechnomancy, par for the course. trying it now
13:17shriphanitechnomancy and lein compile will generate both mains ?
13:17technomancysohail: the inspector is the main thing I miss. the debugging stuff is a bit more work to set up, but with ritz it's pretty good.
13:17technomancyshriphani: `lein compile` will compile whatever you tell it to in :aot inside project.clj
13:18sohailtechnomancy, ah ok
13:18technomancyso as long as your mains are in there and have :gen-class directives you're good
13:18shriphaniah. I didn't know about aot. That was helpful. thanks.
13:19sohailany of you guys in toronto? there's osme sort of clojure thing today
13:21meliponehello
13:22technomancyhuh; there's one near seattle too tonight, but not seajure: http://www.meetup.com/SeaLang/events/112617852/
13:23mindbender1why can't we get a sparse thing in clojure
13:24justin_smithmuhoo: rails and php are both tailored to the expectation you are making a webapp
13:24justin_smithmuhoo: there are a few clojure frameworks that try to do somthing similar
13:24meliponemy question is I have (declare ^:dynamic myvar) in a file and then a (binding [myvar (memoize somefuntion)] ...) in a function. Why do I get an illegal state exception when I want to execute the function that says that myvar is non-dynamic?
13:25sohailtechnomancy, seajure nice name
13:25nDuffmelipone: Which version of Clojure? Very old versions used earmuffs rather than ^:dynamic
13:25sohailso anyone here use clojure at work? web stuff?
13:26Glenjaminnoidi: late response, but the problem is i want it to work for any value, i don't have a known list
13:26meliponeit's clojure 1.5.0
13:26meliponeclojure 1.5.1 sorry
13:27nDuffmelipone: A reproducer would be helpful, then.
13:27justin_smithsohail: yeah, we have our own in house web orm framework
13:27justin_smithclojure backend, but regular js on the frontend because the frontend devs are not clojure guys
13:27nDuffmelipone: (declare ^:dynamic myvar) (binding [myvar true] myvar) works for me.
13:28meliponenDuff: I have that in a file that I load with (require 'myfunctions)
13:28meliponenDuff: when I do it at the repl that works but not from a file
13:28sohailjustin_smith, why choose clojure if you have to reinvent stuff like web frameworks? (I'm not trying to be an ass, I'm just trying to understand - I love lisp)
13:29astevewhat's the best library for date patterned time?
13:29justin_smithsohail: 1) performance 2) maintainability and ease of use of the resulting framework
13:29asteveI need to get today's date and yesterday's date
13:29asteveyyyyMMdd format
13:30nDuffmelipone: well, can you gist a lein project or a minimal file?
13:30Glenjaminsohail: http://clojure.org/rationale is valid regardless of platform
13:30gdevtoday is 20130501 and yesterday was 20130430
13:30justin_smith(performance of resulting app + conveniences of language) - added time to develop our own orm > (performance of previous setup)
13:30Glenjaminasteve: maybe clj-time
13:30Glenjamingdev++
13:30meliponenDuff: okay. holdon
13:30nDuffmelipone: May be a bit before I respond -- about to head downstairs to lunch.
13:31sohailGlenjamin, justin_smith thanks.
13:31sohailjustin_smith, what did you use previously?
13:32justin_smithalso: the clojure orm / webapp framework was a senior devs weekend project - he would likely have gotten bored with web dev backend work without clojure being around, so management had reason to humor him :)
13:32justin_smithsohail: php, then rails
13:35sohailjustin_smith, I can understand your senior dev's pov :)
13:37justin_smitheven factoring in the extra time to develop our own infrastructure, clojure is now the company goto if possible because of the reduced development time / better performance
13:37justin_smithI guess I already said that
13:38sohailjustin_smith, cool, thanks for sharing!
13:41astevegdev: thanks, do you have a library that can give me that information on command? :)
13:41asteveGlenjamin: I'll look into clj-time; thanks
13:41astevehttps://github.com/seancorfield/clj-time ?
13:41Glenjaminyup
13:44gdevasteve:) it's still in pre-alpha release candidate -1 right now, got stuck on giving it a good name too which is usually the stage where my projects die
13:44astevehah
13:46gdevthe best way to see if a library will do what you need it to do is to go to where its hosted and open an issue saying it needs that feature
13:46technomancyhaha; been there
13:47gdevtechnomancy:) i was just kidding, people really do that? wow
13:47technomancywell, when you think it's not there but it turns out you didn't read the readme as well as you thought you did
13:47technomancyor it's buried somewhere else
13:48gdevthe people that do that are standing right behind me aren't they, they heard everything ? foxpaw
13:51tbaldridgednolan: does core.logic memoize relations? so that the result of (foo 42 lvar) is cached for all invocations of foo no matter their location? Or is there a way to do this?
13:51tbaldridgednolen: that is
13:52seancorfieldasteve: Glenjamin: canonical clj-time: https://github.com/clj-time/clj-time
13:52Glenjaminis there a workflow with clojure.test that doesn't involve me running "lein test" all the time manually?
13:52gfrederickstbaldridge: is that not what tabling is?
13:52tbaldridgehaven't a clue what tabling is
13:52asteveseancorfield: thanks
13:53Glenjaminseancorfield: cool, is that new? the clojars page links back to the other repo
13:53tbaldridgegfredericks: it looks like it may be, I'll dig into it a bit.
13:53gfrederickstbaldridge: I was just hedging myself since I haven't used core.logic in months
13:54seancorfieldGlenjamin: recent change to its own org, yes, to make it easier for a group collaboration
13:54seancorfieldno new builds yet since it moved
13:55tbaldridgegfredericks: that's exactly what I was looking for it seems: http://twelf.org/wiki/Tabled_logic_programming
13:55seancorfieldwe should probably push clj-time 0.5.1 out to update clojars...
13:58meliponenDuff: are you back from lunch?
13:58meliponenDuff: the gist is at https://gist.github.com/Melipone/5496925
13:59meliponenDuff: the instructions to test are at the bottom of the file
14:00naeghow can I transform a function like this: http://pastebin.com/kCkSBAQP
14:00gdev ~nDuff
14:00naegbasically add another argument and pass that to the recursive function call inside that function
14:00gdevlol how did that space get in there
14:00gdev~nDuff
14:00clojurebotPlease don't use pastebin.com: there are lots of annoying animated ads. Instead, try http://refheap.com, an ad-free pastebin written in Clojure.
14:01naegok clojurebot
14:02naeghow can I transform a function in this manner: https://www.refheap.com/paste/14113
14:02naegdo I have to use macros for this?
14:02micahmartinIn ClojureScript at runtime, I have the name of a var/field as a string. How do I set the value of that var/field to a non-literal?
14:04micahmartinnaeg: macro sounds like the right approach
14:04naegfirst time I really need them, usually manipulated functions using functions up to now
14:05meliponeprivmsg nDuff https://gist.github.com/Melipone/5496925
14:06micahmartinnaeg: does f already exist? Or are you going to pass the defn form into a macro?
14:07micahmartincuz if f already exists, you'll have to do some namespace tweaking to get rid of f and add f-
14:07naegmicahmartin: it does exist. I actually just want to make a debug version of a function
14:07naegi don't care how the function is called
14:08nDuffmelipone: (def ^:dynamic myvar nil)
14:08micahmartinIf the function in your code? Could you wrap it in a macro for the debugging episode?
14:08sveduboisI would like to create a fn in CLJS to recursively do this (written in JS):
14:08sveduboisvar model = new X.mesh();
14:08sveduboismodel.file = 'model.vtk';
14:08sveduboismodel.caption = 'Model';
14:08sveduboisI have written this one in CLJS, but it doesn't work. What am I doing wrong?
14:08sveduboishttps://www.refheap.com/paste/14115
14:09sveduboism/set-all! is a macro
14:09sveduboisthat I taken from internet
14:10svedubois(the macro works)
14:13justin_smithnaeg: is there a typo, should b be passed to the recursive call as you just said? or am I misreading
14:15naegjustin_smith: nope, the a is correct there. the b of the current function is then the a of the call before
14:16svedubois(def a (X/mesh.))
14:16svedubois#<[object Object]>
14:16Glenjaminsvedubois: in normal clojure that's a case for doto, not sure about cljs though
14:17sveduboisWhat is trying to render is "object Object.vtk"
14:18sveduboisand not each element of the meshes vector (def meshes [a b c d e])
14:18justin_smithnaeg: but b is never used, I am missing something there
14:19naegjustin_smith: that is because this is an (stupid) example :P
14:19justin_smithahh, ok!
14:19naegthe real function is more complicated, but the transformation is the same
14:20sveduboistypo (def meshes ["a" "b" "c" "d" "e"])
14:23Glenjaminis there a contains-in? somewhere?
14:26tieTYT2is there something like "and" but it returns true if all parameters are falsey?
14:26noidiGlenjamin, if the path to the nested collection is fixed, you could do something like this: (-> coll :keys :into :nested :colls (contains? :key))
14:27Bronsa(defn contains-in? [map ks] (boolean (get-in map ks false))) maybe?
14:27gfrederickstieTYT2: doubtful, but easy to write
14:27GlenjamintieTYT2: (not (or
14:27gfredericksoh right
14:27tieTYT2k, thought something might exist
14:27tieTYT2thanks
14:28gfredericks(defmacro nor [& xs] `(not (or ~@xs)))
14:28GlenjaminBronsa: yeah, i think the trick is the default value - just checking my structure to see if it'll ever be nil on purpose
14:29dnolentbaldridge: out of curiosity do you have a specific use case? BTW not so weird to ask that question in datomic since Prolog + Tabling takes you closer to Datalog ;)
14:32tbaldridgednolen: yeah, I have a type inferencer for Mjolnir built out using Datomic's datalog. Sadly I think my queries are a bit to complex for the "set at a time" model. So I'm thinking of other ways of attacking the problem.
14:32tbaldridgeDatomic rules: https://github.com/halgari/mjolnir/blob/datomic/src/mjolnir/ssa_rules.clj
14:33dnolentbaldridge: gotcha
14:35dnolentbaldridge: I do have a lot of perf enhancements in mind for that use case - esp. around conde / tabling - but need more free time ...
14:35tbaldridgednolen: don't we all :-)
14:37naegIf I'm in namespace A and I :use B in there, is it possible to modify a function inside B? like I would add another def to the end of the file for namespace B
14:38naegtried it with (with-bindings), but that would mean I'd have to define that function as dynamic, which I would prefer not to do
14:39akhudeknaeg: you should use (:require [library :refer :all]) rather than :use and to answer your question, you probably need something like (in-ns ..) or the like
14:45patchworkSo, if I declare a ref in a ns (def thing (ref {})), and two different libs use my ns without realizing, does the value of that ref get stomped between the two libs?
14:45patchworkAs in, is there a conflict if the two libs want two different values for the ref in that ns?
14:46gfredericksyes
14:46gfredericksthe ref only has one value at a time
14:47patchworkSo does that mean that declaring refs like that is usually a bad idea?
14:47patchworksince two libs can't use the same ns?
14:47patchworkand since they may not even realize?
14:47patchworkSeems like a problem
14:47TimMcpatchwork: If you want separate instances, create a fn that returns something with a brand new ref or atom or whatever.
14:48patchworkTimMc: So then I would have to pass that ref around everywhere, rather than just referring to a var in the ns?
14:48TimMcYeah.
14:48patchworkThat seems cumbersome for things like config etc
14:49patchworkWhere I would have to modify every function to take a new arg that only some of the functions actually care about
14:49patchwork(and usually the low level ones)
14:49patchworkIs that really what people do?
14:49technomancyconfig is usually a var.
14:50technomancyother things ... it depends.
14:50patchworktechnomancy: a dynamic var? So you just (def config …) again if you want to update something?
14:50TimMcpatchwork: You never re-def, except in the REPL.
14:51technomancyyou would recompile to update config during development, yes
14:51Glenjaminif you need config to change at runtime...
14:51Glenjamini don't have an end to that sentence.
14:51patchworkYeah, there are some values that change at runtime (not config, but other state)
14:52technomancydepends on the details
14:52gdevGlenjamin:) if you need config to change at runtime...you're going to have a bad time
14:52Glenjamini initially started with dynamic config, because i wanted some values to depend on others
14:52Glenjaminreplaced it with a (delay) hack, but at least it's contained
14:53patchworkSo, if I need values to change at runtime, and want them to work if many libs are referencing the same ns, what are my options?
14:53patchworkDo I just rebind everything continuously?
14:53Glenjamini'd say an atom, maybe behind a function - but i defer to the experts
14:54patchworkThanks for helping out, this is puzzling
14:54technomancy"your options are locals and vars" is a tautology; these are basically the only things in clojure.
14:54solussddoes anybody know why I dont see stdout printed to the repl when I start a webserver w/ ring from the repl?
14:54gfrederickspatchwork: for separate configs for separate clients, a dynamic var might work
14:55gfrederickspatchwork: that way the config is thread-local
14:55patchworkgfredericks: I like that, but what if I need to change some values mid-execution?
14:55technomancythis is a bit like asking "I need to store data, what's a good data base?"
14:55patchworkdo I need to nest every subsequent operation inside a (binding …) call?
14:56Glenjamincan you give an example of something that would change?
14:56gdevtechnomancy:) its a tautological dichotomy?
14:56gfredericksI agree with technomancy. this is a bit too hypothetical
14:56gfrederickstechnomancy: I was once in an org where a DB was chosen purely based on the fact that it _could_ store data
14:57technomancygfredericks: S3 is my favourite data base.
14:57gfredericksS-three
14:57technomancyclojurebot: all the nines
14:57clojurebotNo entiendo
14:57gdevmsexcel is my favorite db
14:57trptcolindatabass
14:57n_bI'm a fan of /dev/null as a NoSQL store
14:57Glenjaminam I a bad person for actually liking MS Access?
14:57gdevyes
14:57gdevand you should feel bad
14:58gfredericksyou feel bad and you should be bad
14:58patchworkSo, there are some expensive operations that occur from some values that come out of the db, so I want to store the result somewhere so I don't have to do it on every call
14:58patchwork(I guess this is kind of a cache issue, not a config)
14:58Glenjaminhttps://github.com/clojure/core.cache
14:58gdevGlenjamin:) sorry, I'm just projecting, I did MS Access programming with VBA for a whole year and loved it =D
14:58ppppaul/dev/null has fast writes
14:59gfredericksppppaul: does it have geo-spatial indexing?
14:59Glenjaminheh, there's plenty of bad usage of Access, but it's got a pretty good niche
14:59gdevthe logs of this chat isn't posted on the internet is it?
14:59ppppaulyes, but no
14:59Glenjamini like to think of it as SQLite with a built in gui and report builder
14:59ppppaul/dev/null has peace of mind
14:59gfredericksppppaul: what happens if the box my /dev/null is running on crashes?
14:59Glenjamingdev: fraid so http://clojure-log.n01se.net/
15:00patchworkGlenjamin: core.cache has the same problem, you have to def the cache somewhere
15:00ppppaul/dev/null has automatic distributed replication to all of your friends computers
15:00gfrederickslol
15:00gfredericksokay so let's talk privacy then
15:00n_bguarantees C only
15:00gfredericksand SOX compliance
15:00Glenjaminpatchwork: ah, i see - you probably want an atom
15:01gfrederickshow easy it is to change my schema in /dev/null?
15:01patchworkGlenjamin: But the atom has the same value for every lib that accesses it!
15:01Glenjaminoh, you want different values for each lib?
15:01patchworkThis is my conundrum
15:01patchworkGlenjamin: Yeah
15:01ppppauli name all of my atoms by their atomic mass
15:01gfredericksa dynamic var with an atom with a ref with an agent with a promise with a future
15:01solussdMy rule of thumb is, you only need an atom if you're dealing with multiple threads or state across repeated calls to a function
15:02gfredericksguys guys can we make a language with mutable nulls?
15:02patchworkSo if two libs access the same var, it should have the right value for that lib
15:02Glenjaminthen yeah, you either want to pass it around, or use a dynamic var with binding
15:02Glenjaminis this for a web app?
15:02patchworkOkay, dynamic var and binding
15:02ppppaulwhat will null mutate into?
15:02patchworkGlenjamin: It is a library that webapps could use
15:02ppppaulnull = 1
15:02Glenjaminthen i suggest you ship it with some middleware
15:03Glenjaminso i can do (wrap-your-lib {:config :options} app)
15:03Glenjaminand that takes care of the binding
15:04patchworkGlenjamin: Sure but there is functionality that could be used directly as a library as well
15:04Glenjaminthen you'll want some sort of (with-config {:config :options} ...) macro i guess
15:04Glenjaminor you could have a record which represents your app's config, and have callers pass it in
15:04patchworkI have that, but then if things need to change, I nest all subsequent operations inside another (with-config … )?
15:05patchworkOkay, just checking
15:05patchworkpass it around or bindings
15:05Glenjaminif it's likely to change, then i'd have it passed, if not, probably bindings
15:05Glenjamintry it, see what feels better
15:05ppppauli usually make my config a s3 object that my app requests on launch
15:06ppppaulhope s3 doesn't go down
15:06patchworkOkay, got it
15:06patchworkthanks all
15:07technomancys3 doesn't go down
15:07ppppaulpatchwork, your config could be read in by a file for any function that wants it
15:07technomancyit has "availability incidents"
15:07ppppaulthis is nuts, though...
15:07patchworkppppaul: I would rather not read a file every time I want to call a function!
15:07ppppaulyou could memoize the read
15:08ppppaulit could have a TTL
15:08patchworkI see now that I want these things to work independently of any global values
15:08patchworkI really have no way around just passing an extra arg to everything, rather than relying on a var for values to make something work
15:10ppppaulyou could use (bindings [....
15:11ppppaulbut, personally i find that a bit hair if it's all over my code
15:11ppppauli like passing around thread locals that have no global reference
15:11ppppaulmaybe 'thread local' is the wrong term
15:25sveduboisI am using the ClojureScript bREPL cljslein from https://github.com/laurentpetit/cljslein.
15:25sveduboisWhen I try to load files from resources/public, the browser gives me and error, that the files are not in the adress http://localhost:9000, although they are there.
15:25sveduboisHow I can add static resources to be served by the http server?
15:31stian_So every other website in the known universe works on my computer, but inexplicably clojurewerkz.org and everything under the same IP is blocked... (It's my private computer). No idea how this happened, any idea where I should look?
15:31stian_Traceroute uses the right IP but has no route to host.
15:36SegFaultAXseancorfield: Do people still use CFML? ;)
15:36sveduboisIs the function of PART 2 equivalent to the function of PART 1? https://www.refheap.com/paste/14116
15:43meliponehello! I have (ns xyz.foo (:require [xyz.bar :as abc])) I get the error that "namespace xyz.bar is not found"
15:43meliponeI know it's a leiningen question but nobody answered over there
15:43sveduboisbecause the function of PART 2 doesn't work...
15:44SegFaultAXmelipone: My guess is xyz.bar isn't in your classpath.
15:45meliponesorry, it's working now. something must have been wrong
15:46meliponeprivmsg segfaultax thanks!
15:46SegFaultAXmelipone: No problem. No need for a PM. :D
15:48tomojwhat's the use of a nullary :roles fn in friend?
15:49tomojI was thinking "oh, I can pass a function instead of a constant set of roles, great"
15:49tomojI guess I can give people random roles now
15:49mikerodIs there a simple way to get the name of a function? Example: (name-of (fn named-anon-fn [x] x)) ;= named-anon-fn
15:50amalloymikerod: no
15:51mikerod:(
15:51sveduboisAny suggestion about the function PART2 from https://www.refheap.com/paste/14116
15:51svedubois?
15:51amalloywhy do you care what a function's name is? that shouldn't ever affect your computation
15:54mikerodamalloy: You're right. This was just for testing purposes. I was making a function that took a series of predicate functions and wrapped each one with `clojure.test/is` so that I'd have details of what predicate failed.
15:55amalloy(str (class f)) has enough information for you to figure out where the function comes from, if it's just for manual inspection
15:55mikerod`clojure.test/is` uses unquote on the unevaluated form passed in though, so I was not getting an error message that could show me the actual function name. I was getting the name of the symbol bound to the predicate itself within the function.
15:55amalloy&(str (class ((fn a [] ((fn b [] b))))))
15:55lazybot⇒ "class sandbox10042$eval13915$a__13916$b__13917"
15:57mikerodamalloy: Thanks, that should be reasonable enough for the sort of test failure message I am trying to produce.
16:19TimMcamalloy: It matters when I'm computing a log message.
16:30tieTYT2https://www.refheap.com/paste/bbeab2dd238bc989adbeae183
16:30tieTYT2that keeps on telling me "No need to call RT.init() anymore" but it only runs correctly if I call RT.init()
16:34tieTYT2I guess the bottom of this has the solution, but it feels like a hack: http://dev.clojure.org/jira/browse/CLJ-1172
16:36tieTYT2i don't know what's wrong with RT.load, but it errors about not being able to find file paths that getResourceAsStream can find
16:37holohi
16:39SegFaultAXholo: Ahoy.
17:03tomojoh, I get it, you return a different nullary roles fn per user. so friend-oauth2 gives the same roles to everyone
17:48pl6306How do I write a map to stream? i.e. spit but to a stream instead of a file
17:48gfredericksrebinding *out* is one way
17:48technomancyare you sure spit doesn't work?
17:49pl6306I want to write it to memory stream compress it then send it via http post
17:53pl6306If i rebind *out* what do I use to print the object? prn?
17:55mindbender1Is there a faster way of tracing unmatched delimiter errors?
17:56hiredmanuse paredit
17:57mindbender1hiredman: thanks. Is there a way to enable it globally
18:00mindbender1laziness
18:08mchampinwho mchampin
18:09sohailok, dumbass question... with nrepl, I do C-c M-n to switch the repl to the namespace, but C-x C-e gives me unable to resolve 'symbol-in-namespace' error
18:18mchampinsohail: did you eval the ns declaration in your slime buffer too?
18:19sohailmchampin, it's in the right namespace, yeah
18:19technomancysohail: nrepl.el is annoying about refusing to run if you haven't done C-c C-k in the buffer already
18:20sohailtechnomancy, that was it
18:20technomancydoesn't matter if the namespace has been loaded another way; it has to be compiled explicitly through nrepl.el =(
18:22sohailtechnomancy, is nrepl an active project?
18:22technomancysohail: not extremely active
18:22technomancynrepl and nrepl.el are different though
18:22technomancynrepl.el has bursts of activity
18:22sohailI was thinking of nrepl.el, yeah
18:23technomancyI think there's a workaround for that nrepl.el "feature"
18:23technomancyhm; or maybe it's fixed in the latest version?
18:28justin_smiththat is pretty much why I am a swank-using dinosaur
18:29technomancyhe at least agreed it was a bad idea; I don't remember if the fix is in a release yet
18:30patchworkYep, still using swank as well
18:30patchworktried nrepl, still not there
18:30justin_smithjust because of the namespace annoyance, yeah?
18:31amalloyi'm sad i'll have to get off swank soon, since it doesn't work with 1.5
18:31technomancyamalloy: tcrayford fixed it
18:32amalloytechnomancy: damn. now i'm sad i'll have to figure out how to upgrade swank, instead
18:32tcrayfordI did?
18:32technomancyoops I wasn't supposed to tell you
18:32technomancyoop
18:32technomancyoops
18:32technomancytcrawley
18:32technomancythat's some serious nested russian-doll failures there
18:33justin_smith(.getNextException brain)
18:33technomancyheh
18:35tcrayfordtechnomancy: I'm sure dhh would be proud
18:35technomancyI had a workaround for the nrepl.el ns problem but I must have deleted it for some reason
18:35amalloytechnomancy: not supposed to tell because...? swank is deprecated?
18:35technomancythe only reason I can think of is that it was fixed
18:35technomancytcrayford: I'm not up on the latest rubby dramas; what is it now?
18:36technomancyamalloy: yeah, we're all conspiring to get you off it.
18:36technomancyRaynes is going to be pissed that I spilled the beans
18:36amalloytrue that
18:36tcrayfordtechnomancy: nothing really, just rails does some *weird* shit with nested fragment caching in 4.0 (it calculates md5s of subcaches, and uses them as cache keys so). It's called "russian doll caching" in ddh parlance
18:37tcrayfordalso note that feature was implemented by dhh parsing erb files using a regex (and this is in rails core)
18:37Raynestcrayford: Please stop fixing that shit.
18:37technomancysweet
18:37RaynesOh. tcrawley|away then?
18:37technomancyerb is the worst
18:37technomancyI tried to write an emacs mode for erb, but it's actually impossible to do well
18:37amalloytcrayford: that summary is like a russian doll of awfulness, itself
18:38technomancyso now I have to go around telling people to stop using my softwares
18:38technomancyand sometimes they don't listen
18:38tcrayfordtechnomancy: so you know how you're not meant to parse html using regex? You know how ruby is horrible to parse anyway! Let's do both at once!
18:38patchworkYou don't even need .rb files, just code straight in the template!
18:39technomancytcrayford: engineerinating
18:39tcrayfordenginurinating
18:42gdevis anyone preparing for Clojure cup? I'll definitely need a personal trainer and a montage
18:45callenparsing erb with...regex?
18:46tcrayfordcallen: in rails core? Yes. Understand that this is a thing. Understand it
18:46patchworkcallen: I don't see what could go wrong with that
18:46callenI knew better than that before I was old enough to rent an apartment.
18:46gdeverb? enterprise ruby bean?
18:46tcrayfordtrue story, in haskell land nobody actually uses regex anymore, so the regex libs aren't maintained well, because parsec is so damn good.
18:47callentcrayford: parsec is cheat mode.
18:47patchworkThat is the promised land
18:47xeqican't wait till everyone is using https://github.com/Engelberg/instaparse or better here
18:47callentcrayford: I've seen some neat parsing stuff for Clojure. Did you see that LL(1) one?
18:47callenoh, there's what I was thinking of.
18:48gdevguarantees in life: death taxes parsing errors
18:48tieTYT2is there an "interleave-by" function?
18:49tieTYT2I want to join this object by its id field and put the ones with null id in its own group
18:49tcrayfordgroup-by?
18:49tieTYT2well I have two collections
18:49tcrayfordtwo collections of maps?
18:49tieTYT2lists
18:50mthvedtcallen: the LL(1) one is kern
18:50callenmthvedt: good call, thank you.
18:50tcrayfordtieTYT2: paste some sample data or something?
18:51svedubois(apply create-sphere ["a" "b" "c"]) only creates one sphere for the first element (a), but not for the rest (b and c).How I can create one sphere for "each" element?
18:51tieTYT2(1 2 3 5) (2 3 4) -> ([1] [2 2] [3 3] [4] [5])
18:51tieTYT2something like that. Except each number is actually an object
18:52gdevlooks a problem i saw on 4clojure
18:52gdev*looks like
18:52sveduboisI am using this function: https://www.refheap.com/paste/14121
18:53tieTYT2in haskell, I think this might be a zip-with
18:54tieTYT2naw nm
18:57RaynestieTYT2: Sounds like you should have a map to update.
18:57RaynesThis is what a merge is for.
18:57tieTYT2hah I was just going to look for that
18:57tieTYT2because I can easily turn this into a map of {id obj}
18:57RaynesIt looks like you're wanting to merge two lists, which is meh.
18:57RaynesYeah, I'd look into building the data into maps.
18:58justin_smiththen that looks kind of like a group-by
18:58tieTYT2oh but I don't want to overwrite :T
18:59tieTYT2here's why I'm doing this: One list represents the db state, one list represents what it's about to change. I'm going to pass it to a program that knows how to figure out the changes that happened (eg: This one got added. This one had this field changed to x) But the program depends on the order of the elements lining up and they don't
18:59tieTYT2about to change=about to change to
19:00justin_smith,(group-by :obj [{:obj 1} {:obj 2} {:obj 2} {:obj 3} {:obj 4} {:obj 4}])
19:00clojurebot{1 [{:obj 1}], 2 [{:obj 2} {:obj 2}], 3 [{:obj 3}], 4 [{:obj 4} {:obj 4}]}
19:00justin_smithI think you can do what you want with that (?)
19:00tieTYT2nice that's useful
19:00tieTYT2but it seems like just a step
19:01tieTYT2merge would work if it didn't overwrite
19:01tieTYT2oh but i can probably use merge-with
19:01tieTYT2i could do merge-with vector me thinks, i'll try
19:02tieTYT2thanks for the help guys
19:05sveduboisAny advice about creating one sphere for "each" element with (apply create-sphere ["a" "b" "c"]) using this function ? https://www.refheap.com/paste/14121
19:09justin_smithare you looking for a definition for create-sphere? should "a" "b" "c" each result in a sphere?
19:09sveduboisYes
19:09sveduboisbut it creates only the sphere a
19:10justin_smith(defn create-spheres [& xs] (doseq [x xs] (create-mesh x))) ?? maybe? I think maybe you need to do something else to x before the create-mesh call, but that depends on how create-mesh is defined
19:10justin_smithor that is X/mesh
19:15sveduboisI use the name of a b c to load different mesh (X/mesh.)
19:18justin_smithok, yeah, so something like what I pasted above (I added an s to the name since it is for making an arbitrary number of them)
19:21svedubois(doseq [x ["a" "b" "c"]] (apply create-mesh x))
19:21sveduboisIt works
19:21sveduboisthanks
19:22justin_smiththe apply is not needed there
19:22justin_smith(doseq [x ["a" "b" "c"]] (create-mesh x))
19:23dobry-deni love the aesthetics of this language. even that simple expression
19:23justin_smiththere is a poetry to it
19:24dobry-denmy source code looks like silhouettes of spacecrafts
19:26n_btieTYT2: I think you can just do (map vector)
19:26n_b,(map vector '(1 2 3 4) '(1 2 3))
19:26clojurebot([1 1] [2 2] [3 3])
19:27n_boh, You want the ones after as well. >>
19:30tieTYT2n_b: yep, thanks though
19:50gf3Bodil: Oh hai, BODOL looks awesome btw. It's basically all of my hopes and dreams refined into a delightful little language.
19:52gdevcan you use BODOL in catnip?
20:27hyPiRionOh, there should be a #BODOL channel over here
20:31gdev,(#(= % %) (*)(*))
20:31clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval36$fn>
20:33scottj,(#(= %1 %2) (*)(*))
20:33clojurebottrue
20:33gdev,(#(= % %) (*))
20:33clojurebottrue
20:33amalloy,(= (*) (*)) ;; are we racing to make it simpler?
20:33clojurebottrue
20:36gdevgrats on being our swearjure race winner :)
20:36amalloyno, the winner would be ##(=)
20:36lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ-
20:36amalloyaw man, since when does = not accept no args?
20:36amalloyjust ,true then, i guess
20:38hyPiRion,(#(= *)) ;?
20:38clojurebottrue
20:38hyPiRionor just ##(= *) I guess.
20:38lazybot⇒ true
20:39amalloytrue is shorter though
20:39hyPiRiontrue enough
20:39metellus,(=) ; is this anything?
20:39clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ->
20:39gdev##(= * +)
20:39lazybot⇒ false
20:40gfredericksI can't remember if (=) ought to make sense or not
20:40hyPiRionno sense
20:40gfredericksI feel like this has been argued before
20:40hyPiRionyeah
20:40gfredericks,(distinct?)
20:40clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$distinct-QMARK->
20:40metellus,(identity)
20:40clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$identity>
20:40hyPiRiongfredericks: yeah, distinct? man.
20:41hyPiRion,(distinct? 1 2)
20:41clojurebottrue
20:41hyPiRion,(distinct 1 2) ; oh, a vector?
20:41clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$distinct>
20:41gfredericksyeah that bothers me too
20:42gfredericksespecially when you go the other way and get a silent true
20:42hyPiRionoh yeah
20:43gfrederickshuh. you could write a replacement clojure.core and put it out as a library.
20:43hyPiRionor just fork it
20:43gfredericksClojure Enterprise Edition would obviously have to be the name
20:43gdev,(#_(@#$%&*-+:;')(= * +))
20:43clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: %&*-+:>
20:43gfrederickshyPiRion: forking it means having to port all the libs
20:44hyPiRionoh dang, right
20:44gfredericksclj-http enterprise edition
20:44gfredericksI just realized that's a cool aspect of the minimal-special-forms approach
20:47gdevcant wait for the day i see on the mailing list "[ANN] enterprise ecommerce Clojure "
20:50hyPiRion"Swearjure-machine implemented on an FPGA" would be fun to watch too
21:20pppauli'm in need of some nice zipper tutorials
21:20pppaulclojure zippers or real zippers, both are good for me
21:20pppaulif anyone can link :)
21:21brehautpppaul: apparently http://www.haskell.org/haskellwiki/Zipper is good, but it confused me
21:21brehautpppaul: http://www.youtube.com/watch?v=1IYgSesN5Fg might help
21:22pppaulahahaha
21:22pppaulzipper simulation...
21:23brehautmusic by a dying gameboy
21:24xeqizippers are like a space suit
21:29pppaulthe second zipper video helped me out a lot… i am now confident that i can repair my coat
21:30amalloyinteresting, brehaut. do you happen to know what zipper's monad instance looks like? nothing makes a lot of sense to me, but that wiki page claims there's a monad instance for a zipper over a binary tree
21:31brehautamalloy: no idea sorry; zippers in haskell have remained opaque for me
21:31brehautalso in clojure
21:46gdevcould've sworn I saw a video by Alex Miller on tree editing with zippers
21:48gdeveven better, clojure conj video about zippers from Luke Vanderhart https://www.youtube.com/watch?v=6c4DJX2Xr3k
22:02gdevwhat a good book, code examples make me cringe though http://natureofcode.com/book/introduction/
22:03gdevand the part where he says "objects have functions"
22:07gdevbut the codes on github, so I might as well fork it and rewrite it in clojure instead of hanging around here talking to myself
22:44gdevlazybot: fortune
22:44lazybotDifficulty at the beginning usually means ease at the end...except in bed
22:45gdevso true
22:45gdevlazybot: fortune
22:45lazybotI thought you said you were going to go do something
22:46gdevokay -_-
22:51jcromartieI give up. I'm going back to Rails!
22:51jcromartiefor this
22:51jcromartieI'll stick Varnish in front of a few paths
22:51jcromartieand that will solve the performance issues
22:51jcromartiebut the paralysis and (self-imposed) NIH syndrome is too much for me
22:56uvtcHow can I remove one item from a vector? That is, I've got `[:a :b :m :n :b :x]` and I want to remove the first :b, and have remaining `[:a :m :n :b :x]`. If I do `(remove #{:b} [:a :b :m :n :b :x])` it of course removes *both* :b's... I just want to remove the first one I encounter.
22:57uvtcHm. I probably want to find the idx of the first :b, and then split on it ... hm.
22:59jcromartieremoving is something vectors are not good at
23:00jcromartiebut yeah
23:00uvtcjcromartie: right. I suppose I want to build a new vector but with that one item left out.
23:01jcromartie,(let [v [:a :b :c :d :e :f :g] idx 2] (vec (concat (take idx v) (drop (inc idx) v)))
23:01clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
23:01jcromartiederp
23:01metellusmaybe something with ##(partition-by #{:b} [:a :b :m :n :b :x])
23:01lazybot⇒ ((:a) (:b) (:m :n) (:b) (:x))
23:02jcromartie,(let [v [:a :b :c :d :e :f :g] idx 2] (vec (concat (take idx v) (drop (inc idx) v))))
23:02clojurebot[:a :b :d :e :f ...]
23:03uvtcjcromartie: Yes. Though, I don't yet know the index of the first :b. I think I first need to find all the indices where there's a :b. Something like (map #(= % :b) my-vec)...
23:03jcromartie,(.indexOf [:a :b :c :b] :b)
23:03clojurebot1
23:04jcromartiesort of undocumented, but that's the simplest
23:04uvtcjcromartie: heh
23:04uvtcjcromartie: thanks. :)
23:05jcromartie,(map-indexed identity [:a :b :c])
23:05clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$identity>
23:05jcromartieoh yeah
23:05jcromartie,(map-indexed vec [:a :b :c])
23:05clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$vec>
23:05jcromartie,(map-indexed vector [:a :b :c])
23:05clojurebot([0 :a] [1 :b] [2 :c])
23:06jcromartieHURRRR
23:06metellus,(split-with #(not (#{:b} %)) [:a :b :m :n :b :x])
23:06clojurebot[(:a) (:b :m :n :b :x)]
23:06metellususe that
23:06gdevlazybot: whatis this
23:06lazybotthis is i don't even
23:06uvtchehe
23:08uvtcOh, I was giggling at what lazybot said. metellus : /me looking at what you wrote...
23:13metellusuvtc: ##(let [[foo bar] (split-with (comp not #{:b}) [:a :b :m :n :b :x])] (concat foo (rest bar)))
23:13lazybot⇒ (:a :m :n :b :x)
23:19uvtcmetellus: Thanks.
23:19gdevlazybot: whatis (+2_2)
23:19lazybot(+2_2) is 5 for extremely large values of 2
23:39howdynihaodo a lot of people use eclipse with clojure?
23:41uvtchowdynihao: sure. A number of folks do.
23:41brehauthowdynihao: its probably the second or third most popular enviroment
23:41brehautbut its maintained and has good support
23:41howdynihaohttp://stackoverflow.com/questions/2352020/debugging-in-clojure is this the only ways to do debugging?
23:43howdynihaois the first emacs?
23:43brehautlikely yes
23:44howdynihaowhat would you say the second is if not eclipse?
23:44brehautccw and vi would be my guess for second
23:44brehautcemerick's survey might have numbers
23:44cemerickemacs > vi > eclipse IIRC
23:45howdynihaowhats ccw?
23:45brehauteclipse mode
23:45brehautcounter clockwise
23:48SegFaultAXWhoa did github just keel over?
23:48n_byup
23:49n_bBut I don't understand the surprise :P
23:49TimMcSegFaultAX: What did you do!
23:49uvtcWas about to ask the same thing.
23:49SegFaultAXhttp://www.downforeveryoneorjustme.com/github.com
23:49n_bmaybe their new arrays are buggy after all
23:51gdevclojurebot: whatis ur favorite IDE
23:51clojurebotqcon slides is http://qconlondon.com/london-2009/file?path=/qcon-london-2009/slides/RichHickey_PersistentDataStructuresAndManagedReferences.pdf
23:51gdevlazybot: whatis ur favorite IDE
23:51lazybotur is not a word! (╯°□°)╯︵ ┻━┻
23:52gdevlazybot: whatis your favorite IDE, sorry
23:52lazybotyour is better ┬──┬ ノ(°—°ノ) I'm fine
23:53SegFaultAXlazybot: You need a nap.
23:54gdevlazybot: fortune
23:54lazybot"oh hai"
23:54uvtcmetellus: re. dropping the first ocurrence of some item in vector; this may be clunky, but it makes sense to me: https://www.refheap.com/paste/14125
23:56pl6306How do I spawn another process from clojure (running on windows)? Thanks!
23:57SegFaultAXuvtc: That seems slow. Why not just subvec?
23:58n_bpl6306: (.new (Thread. #(some_fn))
23:58uvtcActually, it seems to me like there should be a very easy way to ask, "what's the index of the first $foo in this list?", but I'm not seeing it right now.
23:58SegFaultAXn_b: That's a thread, not a process.
23:58pl6306No I mean an OS process
23:59SegFaultAX,(.indexOf [1 2 3] 2)
23:59clojurebot1
23:59n_bYou mean like shelling out to something else?
23:59SegFaultAXuvtc: ^