#clojure log - May 01 2013

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

11:52 hyPiRion: ,(as-> x {} (assoc x :a 1) (assoc x :b (+ 1 (:a x))))

11:52 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

11:52 hyPiRion: well, well, well.

11:52 ,(as-> {} x (assoc x :a 1) (assoc x :b (+ 1 (:a x))))

11:52 clojurebot: {:b 2, :a 1}

11:53 llasram: Yeah, that ordering is weird

11:54 hyPiRion: yeah, I don't like it.

11:55 I suppose it's for making it usable within (-> ... (as-> x ..))

11:58 llasram: That makes some sense...

11:59 chouser_log: where is as-> from?

11:59 mpenet: clojure 1.5.x

12:01 chouser_log: ok, thanks.

12:05 gdev: chouser_log:) set log level to debug

12:09 chouser: heh, fixed, thanks. :-)

12:18 gdev: chouser:) the article you and Fogus posted on dr dobbs is on the front page, nice

12:18 also ishows up in the "most popular" side widget as well

12:19 chouser: ooh, nice.

12:20 jchauncey: anyone know of a good tutorial on thread-first thread-last macro usage?

12:23 gdev: if none exist, would you like to create one?

12:24 ucb: +1

12:25 gdev: jchauncey:) 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:27 ,(Integer/parseInt "1100100" 2)

12:27 clojurebot: 100

12:27 gdev: ,(Integer/parseInt "11001001" 2)

12:27 clojurebot: 201

12:29 gdev: ,(-> "oh hai" .toUpperCase (.replace "H" "B"))

12:29 clojurebot: "OB BAI"

12:29 papachan: hey

12:31 gdev: ,(->> (range 1 10) (filter even?) (reduce +))

12:31 clojurebot: 20

12:38 justin_smith: ,(+ (*) (*) (* (+ (*) (*)) (+ (*) (*) (*) (*)) (+ (*) (*) (*) (*) (*))))

12:38 clojurebot: 42

12:38 chouser: swearjure

12:40 gdev: ,(+ #_(clojurebot, what is the answer to the universe????) (*) (*) (* (+ (*) (*)) (+ (*) (*) (*) (*)) (+ (*) (*) (*) (*) (*))))

12:40 clojurebot: 42

12:42 justin_smith: ,(+ (+) (*) (+) (*) (+) (* (+ (*) (*)) (+ (*) (+) (*) (+) (*) (+) (*)) (+ (*) (+) (*) (+) (*) (+) (*) (+) (*))))

12:42 clojurebot: 42

12:42 shriphani: Hi, 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:43 mpenet: ,(java.util.Date. 1325376000)

12:43 clojurebot: #inst "1970-01-16T08:09:36.000-00:00"

12:44 mpenet: ,(java.util.Date. 1325376000000)

12:44 clojurebot: #inst "2012-01-01T00:00:00.000-00:00"

12:44 shriphani: ah. milliseconds.

12:44 mpenet: classic

12:55 gdev: clojurebot:) tell me about your mother

12:55 clojurebot: My mother? I'll tell you about my mother

12:56 AimHere: clojurebot: open the pod bay doors

12:56 clojurebot: I'm sorry, AimHere. I'm afraid I can't do that.

12:58 gfredericks: clojurebot: botstack

12:58 clojurebot: /me puts lazybot on his head and gropes blindly for a third bot to complete the stack.

13:07 muhoo: anyone else notice that some simple things take much longer to get working in clojure than in other languages?

13:07 like, 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:08 trinary: lots, but only because I have absolute no idea what I'm doing in clojure yet :)

13:08 muhoo: trinary: yeah, i figured that might explain a lot in my case as well

13:08 shriphani: is there a way to have 2 main classes ?

13:09 I know it is shitty design but I have two files that are more like individual scripts

13:09 but I would like to get 2 jars when I lein uberjar

13:12 technomancy: shriphani: you can just do `java -cp myjar.jar my.main1` and `java -cp myjar.jar my.main2`

13:12 sohail: so 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:14 dnolen: sohail: nrepl.el has taken over, slime support was basically not going anyway

13:15 shriphani: technomancy I don't see a .clj in those commands. (sorry I am a complete jvm noob).

13:15 sohail: dnolen, thanks, is nrepl as good as slime for lisp?

13:16 technomancy: shriphani: :main only affects what `java -jar ...` uses. with `java -cp ...` you can specify your own main.

13:16 sohail: ok, technomancy is doing it so I trust it is right

13:16 technomancy: sohail: nrepl.el is better in some ways and worse in others.

13:17 sohail: technomancy, par for the course. trying it now

13:17 shriphani: technomancy and lein compile will generate both mains ?

13:17 technomancy: sohail: 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:17 shriphani: `lein compile` will compile whatever you tell it to in :aot inside project.clj

13:18 sohail: technomancy, ah ok

13:18 technomancy: so as long as your mains are in there and have :gen-class directives you're good

13:18 shriphani: ah. I didn't know about aot. That was helpful. thanks.

13:19 sohail: any of you guys in toronto? there's osme sort of clojure thing today

13:21 melipone: hello

13:22 technomancy: huh; there's one near seattle too tonight, but not seajure: http://www.meetup.com/SeaLang/events/112617852/

13:23 mindbender1: why can't we get a sparse thing in clojure

13:24 justin_smith: muhoo: rails and php are both tailored to the expectation you are making a webapp

13:24 muhoo: there are a few clojure frameworks that try to do somthing similar

13:24 melipone: my 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:25 sohail: technomancy, seajure nice name

13:25 nDuff: melipone: Which version of Clojure? Very old versions used earmuffs rather than ^:dynamic

13:25 sohail: so anyone here use clojure at work? web stuff?

13:26 Glenjamin: noidi: late response, but the problem is i want it to work for any value, i don't have a known list

13:26 melipone: it's clojure 1.5.0

13:26 clojure 1.5.1 sorry

13:27 nDuff: melipone: A reproducer would be helpful, then.

13:27 justin_smith: sohail: yeah, we have our own in house web orm framework

13:27 clojure backend, but regular js on the frontend because the frontend devs are not clojure guys

13:27 nDuff: melipone: (declare ^:dynamic myvar) (binding [myvar true] myvar) works for me.

13:28 melipone: nDuff: I have that in a file that I load with (require 'myfunctions)

13:28 nDuff: when I do it at the repl that works but not from a file

13:28 sohail: justin_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:29 asteve: what's the best library for date patterned time?

13:29 justin_smith: sohail: 1) performance 2) maintainability and ease of use of the resulting framework

13:29 asteve: I need to get today's date and yesterday's date

13:29 yyyyMMdd format

13:30 nDuff: melipone: well, can you gist a lein project or a minimal file?

13:30 Glenjamin: sohail: http://clojure.org/rationale is valid regardless of platform

13:30 gdev: today is 20130501 and yesterday was 20130430

13:30 justin_smith: (performance of resulting app + conveniences of language) - added time to develop our own orm > (performance of previous setup)

13:30 Glenjamin: asteve: maybe clj-time

13:30 gdev++

13:30 melipone: nDuff: okay. holdon

13:30 nDuff: melipone: May be a bit before I respond -- about to head downstairs to lunch.

13:31 sohail: Glenjamin, justin_smith thanks.

13:31 justin_smith, what did you use previously?

13:32 justin_smith: also: 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:32 sohail: php, then rails

13:35 sohail: justin_smith, I can understand your senior dev's pov :)

13:37 justin_smith: even 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:37 I guess I already said that

13:38 sohail: justin_smith, cool, thanks for sharing!

13:41 asteve: gdev: thanks, do you have a library that can give me that information on command? :)

13:41 Glenjamin: I'll look into clj-time; thanks

13:41 https://github.com/seancorfield/clj-time ?

13:41 Glenjamin: yup

13:44 gdev: asteve:) 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:44 asteve: hah

13:46 gdev: the 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:46 technomancy: haha; been there

13:47 gdev: technomancy:) i was just kidding, people really do that? wow

13:47 technomancy: well, 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:47 or it's buried somewhere else

13:48 gdev: the people that do that are standing right behind me aren't they, they heard everything ? foxpaw

13:51 tbaldridge: dnolan: 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:51 dnolen: that is

13:52 seancorfield: asteve: Glenjamin: canonical clj-time: https://github.com/clj-time/clj-time

13:52 Glenjamin: is there a workflow with clojure.test that doesn't involve me running "lein test" all the time manually?

13:52 gfredericks: tbaldridge: is that not what tabling is?

13:52 tbaldridge: haven't a clue what tabling is

13:52 asteve: seancorfield: thanks

13:53 Glenjamin: seancorfield: cool, is that new? the clojars page links back to the other repo

13:53 tbaldridge: gfredericks: it looks like it may be, I'll dig into it a bit.

13:53 gfredericks: tbaldridge: I was just hedging myself since I haven't used core.logic in months

13:54 seancorfield: Glenjamin: recent change to its own org, yes, to make it easier for a group collaboration

13:54 no new builds yet since it moved

13:55 tbaldridge: gfredericks: that's exactly what I was looking for it seems: http://twelf.org/wiki/Tabled_logic_programming

13:55 seancorfield: we should probably push clj-time 0.5.1 out to update clojars...

13:58 melipone: nDuff: are you back from lunch?

13:58 nDuff: the gist is at https://gist.github.com/Melipone/5496925

13:59 nDuff: the instructions to test are at the bottom of the file

14:00 naeg: how can I transform a function like this: http://pastebin.com/kCkSBAQP

14:00 gdev: ~nDuff

14:00 naeg: basically add another argument and pass that to the recursive function call inside that function

14:00 gdev: lol how did that space get in there

14:00 ~nDuff

14:00 clojurebot: Please 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:01 naeg: ok clojurebot

14:02 how can I transform a function in this manner: https://www.refheap.com/paste/14113

14:02 do I have to use macros for this?

14:02 micahmartin: In 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:04 naeg: macro sounds like the right approach

14:04 naeg: first time I really need them, usually manipulated functions using functions up to now

14:05 melipone: privmsg nDuff https://gist.github.com/Melipone/5496925

14:06 micahmartin: naeg: does f already exist? Or are you going to pass the defn form into a macro?

14:07 cuz if f already exists, you'll have to do some namespace tweaking to get rid of f and add f-

14:07 naeg: micahmartin: it does exist. I actually just want to make a debug version of a function

14:07 i don't care how the function is called

14:08 nDuff: melipone: (def ^:dynamic myvar nil)

14:08 micahmartin: If the function in your code? Could you wrap it in a macro for the debugging episode?

14:08 svedubois: I would like to create a fn in CLJS to recursively do this (written in JS):

14:08 var model = new X.mesh();

14:08 model.file = 'model.vtk';

14:08 model.caption = 'Model';

14:08 I have written this one in CLJS, but it doesn't work. What am I doing wrong?

14:08 https://www.refheap.com/paste/14115

14:09 m/set-all! is a macro

14:09 that I taken from internet

14:10 (the macro works)

14:13 justin_smith: naeg: is there a typo, should b be passed to the recursive call as you just said? or am I misreading

14:15 naeg: justin_smith: nope, the a is correct there. the b of the current function is then the a of the call before

14:16 svedubois: (def a (X/mesh.))

14:16 #<[object Object]>

14:16 Glenjamin: svedubois: in normal clojure that's a case for doto, not sure about cljs though

14:17 svedubois: What is trying to render is "object Object.vtk"

14:18 and not each element of the meshes vector (def meshes [a b c d e])

14:18 justin_smith: naeg: but b is never used, I am missing something there

14:19 naeg: justin_smith: that is because this is an (stupid) example :P

14:19 justin_smith: ahh, ok!

14:19 naeg: the real function is more complicated, but the transformation is the same

14:20 svedubois: typo (def meshes ["a" "b" "c" "d" "e"])

14:23 Glenjamin: is there a contains-in? somewhere?

14:26 tieTYT2: is there something like "and" but it returns true if all parameters are falsey?

14:26 noidi: Glenjamin, if the path to the nested collection is fixed, you could do something like this: (-> coll :keys :into :nested :colls (contains? :key))

14:27 Bronsa: (defn contains-in? [map ks] (boolean (get-in map ks false))) maybe?

14:27 gfredericks: tieTYT2: doubtful, but easy to write

14:27 Glenjamin: tieTYT2: (not (or

14:27 gfredericks: oh right

14:27 tieTYT2: k, thought something might exist

14:27 thanks

14:28 gfredericks: (defmacro nor [& xs] `(not (or ~@xs)))

14:28 Glenjamin: Bronsa: yeah, i think the trick is the default value - just checking my structure to see if it'll ever be nil on purpose

14:29 dnolen: tbaldridge: 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:32 tbaldridge: dnolen: 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:32 Datomic rules: https://github.com/halgari/mjolnir/blob/datomic/src/mjolnir/ssa_rules.clj

14:33 dnolen: tbaldridge: gotcha

14:35 tbaldridge: I do have a lot of perf enhancements in mind for that use case - esp. around conde / tabling - but need more free time ...

14:35 tbaldridge: dnolen: don't we all :-)

14:37 naeg: If 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:38 tried 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:39 akhudek: naeg: 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:45 patchwork: So, 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:45 As in, is there a conflict if the two libs want two different values for the ref in that ns?

14:46 gfredericks: yes

14:46 the ref only has one value at a time

14:47 patchwork: So does that mean that declaring refs like that is usually a bad idea?

14:47 since two libs can't use the same ns?

14:47 and since they may not even realize?

14:47 Seems like a problem

14:47 TimMc: patchwork: If you want separate instances, create a fn that returns something with a brand new ref or atom or whatever.

14:48 patchwork: TimMc: So then I would have to pass that ref around everywhere, rather than just referring to a var in the ns?

14:48 TimMc: Yeah.

14:48 patchwork: That seems cumbersome for things like config etc

14:49 Where I would have to modify every function to take a new arg that only some of the functions actually care about

14:49 (and usually the low level ones)

14:49 Is that really what people do?

14:49 technomancy: config is usually a var.

14:50 other things ... it depends.

14:50 patchwork: technomancy: a dynamic var? So you just (def config …) again if you want to update something?

14:50 TimMc: patchwork: You never re-def, except in the REPL.

14:51 technomancy: you would recompile to update config during development, yes

14:51 Glenjamin: if you need config to change at runtime...

14:51 i don't have an end to that sentence.

14:51 patchwork: Yeah, there are some values that change at runtime (not config, but other state)

14:52 technomancy: depends on the details

14:52 gdev: Glenjamin:) if you need config to change at runtime...you're going to have a bad time

14:52 Glenjamin: i initially started with dynamic config, because i wanted some values to depend on others

14:52 replaced it with a (delay) hack, but at least it's contained

14:53 patchwork: So, 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:53 Do I just rebind everything continuously?

14:53 Glenjamin: i'd say an atom, maybe behind a function - but i defer to the experts

14:54 patchwork: Thanks for helping out, this is puzzling

14:54 technomancy: "your options are locals and vars" is a tautology; these are basically the only things in clojure.

14:54 solussd: does anybody know why I dont see stdout printed to the repl when I start a webserver w/ ring from the repl?

14:54 gfredericks: patchwork: for separate configs for separate clients, a dynamic var might work

14:55 patchwork: that way the config is thread-local

14:55 patchwork: gfredericks: I like that, but what if I need to change some values mid-execution?

14:55 technomancy: this is a bit like asking "I need to store data, what's a good data base?"

14:55 patchwork: do I need to nest every subsequent operation inside a (binding …) call?

14:56 Glenjamin: can you give an example of something that would change?

14:56 gdev: technomancy:) its a tautological dichotomy?

14:56 gfredericks: I agree with technomancy. this is a bit too hypothetical

14:56 technomancy: I was once in an org where a DB was chosen purely based on the fact that it _could_ store data

14:57 technomancy: gfredericks: S3 is my favourite data base.

14:57 gfredericks: S-three

14:57 technomancy: clojurebot: all the nines

14:57 clojurebot: No entiendo

14:57 gdev: msexcel is my favorite db

14:57 trptcolin: databass

14:57 n_b: I'm a fan of /dev/null as a NoSQL store

14:57 Glenjamin: am I a bad person for actually liking MS Access?

14:57 gdev: yes

14:57 and you should feel bad

14:58 gfredericks: you feel bad and you should be bad

14:58 patchwork: So, 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:58 (I guess this is kind of a cache issue, not a config)

14:58 Glenjamin: https://github.com/clojure/core.cache

14:58 gdev: Glenjamin:) sorry, I'm just projecting, I did MS Access programming with VBA for a whole year and loved it =D

14:58 ppppaul: /dev/null has fast writes

14:59 gfredericks: ppppaul: does it have geo-spatial indexing?

14:59 Glenjamin: heh, there's plenty of bad usage of Access, but it's got a pretty good niche

14:59 gdev: the logs of this chat isn't posted on the internet is it?

14:59 ppppaul: yes, but no

14:59 Glenjamin: i like to think of it as SQLite with a built in gui and report builder

14:59 ppppaul: /dev/null has peace of mind

14:59 gfredericks: ppppaul: what happens if the box my /dev/null is running on crashes?

14:59 Glenjamin: gdev: fraid so http://clojure-log.n01se.net/

15:00 patchwork: Glenjamin: core.cache has the same problem, you have to def the cache somewhere

15:00 ppppaul: /dev/null has automatic distributed replication to all of your friends computers

15:00 gfredericks: lol

15:00 okay so let's talk privacy then

15:00 n_b: guarantees C only

15:00 gfredericks: and SOX compliance

15:00 Glenjamin: patchwork: ah, i see - you probably want an atom

15:01 gfredericks: how easy it is to change my schema in /dev/null?

15:01 patchwork: Glenjamin: But the atom has the same value for every lib that accesses it!

15:01 Glenjamin: oh, you want different values for each lib?

15:01 patchwork: This is my conundrum

15:01 Glenjamin: Yeah

15:01 ppppaul: i name all of my atoms by their atomic mass

15:01 gfredericks: a dynamic var with an atom with a ref with an agent with a promise with a future

15:01 solussd: My 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:02 gfredericks: guys guys can we make a language with mutable nulls?

15:02 patchwork: So if two libs access the same var, it should have the right value for that lib

15:02 Glenjamin: then yeah, you either want to pass it around, or use a dynamic var with binding

15:02 is this for a web app?

15:02 patchwork: Okay, dynamic var and binding

15:02 ppppaul: what will null mutate into?

15:02 patchwork: Glenjamin: It is a library that webapps could use

15:02 ppppaul: null = 1

15:02 Glenjamin: then i suggest you ship it with some middleware

15:03 so i can do (wrap-your-lib {:config :options} app)

15:03 and that takes care of the binding

15:04 patchwork: Glenjamin: Sure but there is functionality that could be used directly as a library as well

15:04 Glenjamin: then you'll want some sort of (with-config {:config :options} ...) macro i guess

15:04 or you could have a record which represents your app's config, and have callers pass it in

15:04 patchwork: I have that, but then if things need to change, I nest all subsequent operations inside another (with-config … )?

15:05 Okay, just checking

15:05 pass it around or bindings

15:05 Glenjamin: if it's likely to change, then i'd have it passed, if not, probably bindings

15:05 try it, see what feels better

15:05 ppppaul: i usually make my config a s3 object that my app requests on launch

15:06 hope s3 doesn't go down

15:06 patchwork: Okay, got it

15:06 thanks all

15:07 technomancy: s3 doesn't go down

15:07 ppppaul: patchwork, your config could be read in by a file for any function that wants it

15:07 technomancy: it has "availability incidents"

15:07 ppppaul: this is nuts, though...

15:07 patchwork: ppppaul: I would rather not read a file every time I want to call a function!

15:07 ppppaul: you could memoize the read

15:08 it could have a TTL

15:08 patchwork: I see now that I want these things to work independently of any global values

15:08 I 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:10 ppppaul: you could use (bindings [....

15:11 but, personally i find that a bit hair if it's all over my code

15:11 i like passing around thread locals that have no global reference

15:11 maybe 'thread local' is the wrong term

15:25 svedubois: I am using the ClojureScript bREPL cljslein from https://github.com/laurentpetit/cljslein.

15:25 When 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:25 How I can add static resources to be served by the http server?

15:31 stian_: 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:31 Traceroute uses the right IP but has no route to host.

15:36 SegFaultAX: seancorfield: Do people still use CFML? ;)

15:36 svedubois: Is the function of PART 2 equivalent to the function of PART 1? https://www.refheap.com/paste/14116

15:43 melipone: hello! I have (ns xyz.foo (:require [xyz.bar :as abc])) I get the error that "namespace xyz.bar is not found"

15:43 I know it's a leiningen question but nobody answered over there

15:43 svedubois: because the function of PART 2 doesn't work...

15:44 SegFaultAX: melipone: My guess is xyz.bar isn't in your classpath.

15:45 melipone: sorry, it's working now. something must have been wrong

15:46 privmsg segfaultax thanks!

15:46 SegFaultAX: melipone: No problem. No need for a PM. :D

15:48 tomoj: what's the use of a nullary :roles fn in friend?

15:49 I was thinking "oh, I can pass a function instead of a constant set of roles, great"

15:49 I guess I can give people random roles now

15:49 mikerod: Is there a simple way to get the name of a function? Example: (name-of (fn named-anon-fn [x] x)) ;= named-anon-fn

15:50 amalloy: mikerod: no

15:51 mikerod: :(

15:51 svedubois: Any suggestion about the function PART2 from https://www.refheap.com/paste/14116

15:51 ?

15:51 amalloy: why do you care what a function's name is? that shouldn't ever affect your computation

15:54 mikerod: amalloy: 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:55 amalloy: (str (class f)) has enough information for you to figure out where the function comes from, if it's just for manual inspection

15:55 mikerod: `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:55 amalloy: &(str (class ((fn a [] ((fn b [] b))))))

15:55 lazybot: ⇒ "class sandbox10042$eval13915$a__13916$b__13917"

15:57 mikerod: amalloy: Thanks, that should be reasonable enough for the sort of test failure message I am trying to produce.

16:19 TimMc: amalloy: It matters when I'm computing a log message.

16:30 tieTYT2: https://www.refheap.com/paste/bbeab2dd238bc989adbeae183

16:30 that keeps on telling me "No need to call RT.init() anymore" but it only runs correctly if I call RT.init()

16:34 I guess the bottom of this has the solution, but it feels like a hack: http://dev.clojure.org/jira/browse/CLJ-1172

16:36 i 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:37 holo: hi

16:39 SegFaultAX: holo: Ahoy.

17:03 tomoj: oh, I get it, you return a different nullary roles fn per user. so friend-oauth2 gives the same roles to everyone

17:48 pl6306: How do I write a map to stream? i.e. spit but to a stream instead of a file

17:48 gfredericks: rebinding *out* is one way

17:48 technomancy: are you sure spit doesn't work?

17:49 pl6306: I want to write it to memory stream compress it then send it via http post

17:53 If i rebind *out* what do I use to print the object? prn?

17:55 mindbender1: Is there a faster way of tracing unmatched delimiter errors?

17:56 hiredman: use paredit

17:57 mindbender1: hiredman: thanks. Is there a way to enable it globally

18:00 laziness

18:08 mchampin: who mchampin

18:09 sohail: ok, 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:18 mchampin: sohail: did you eval the ns declaration in your slime buffer too?

18:19 sohail: mchampin, it's in the right namespace, yeah

18:19 technomancy: sohail: nrepl.el is annoying about refusing to run if you haven't done C-c C-k in the buffer already

18:20 sohail: technomancy, that was it

18:20 technomancy: doesn't matter if the namespace has been loaded another way; it has to be compiled explicitly through nrepl.el =(

18:22 sohail: technomancy, is nrepl an active project?

18:22 technomancy: sohail: not extremely active

18:22 nrepl and nrepl.el are different though

18:22 nrepl.el has bursts of activity

18:22 sohail: I was thinking of nrepl.el, yeah

18:23 technomancy: I think there's a workaround for that nrepl.el "feature"

18:23 hm; or maybe it's fixed in the latest version?

18:28 justin_smith: that is pretty much why I am a swank-using dinosaur

18:29 technomancy: he at least agreed it was a bad idea; I don't remember if the fix is in a release yet

18:30 patchwork: Yep, still using swank as well

18:30 tried nrepl, still not there

18:30 justin_smith: just because of the namespace annoyance, yeah?

18:31 amalloy: i'm sad i'll have to get off swank soon, since it doesn't work with 1.5

18:31 technomancy: amalloy: tcrayford fixed it

18:32 amalloy: technomancy: damn. now i'm sad i'll have to figure out how to upgrade swank, instead

18:32 tcrayford: I did?

18:32 technomancy: oops I wasn't supposed to tell you

18:32 oop

18:32 oops

18:32 tcrawley

18:32 that's some serious nested russian-doll failures there

18:33 justin_smith: (.getNextException brain)

18:33 technomancy: heh

18:35 tcrayford: technomancy: I'm sure dhh would be proud

18:35 technomancy: I had a workaround for the nrepl.el ns problem but I must have deleted it for some reason

18:35 amalloy: technomancy: not supposed to tell because...? swank is deprecated?

18:35 technomancy: the only reason I can think of is that it was fixed

18:35 tcrayford: I'm not up on the latest rubby dramas; what is it now?

18:36 amalloy: yeah, we're all conspiring to get you off it.

18:36 Raynes is going to be pissed that I spilled the beans

18:36 amalloy: true that

18:36 tcrayford: technomancy: 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:37 also note that feature was implemented by dhh parsing erb files using a regex (and this is in rails core)

18:37 Raynes: tcrayford: Please stop fixing that shit.

18:37 technomancy: sweet

18:37 Raynes: Oh. tcrawley|away then?

18:37 technomancy: erb is the worst

18:37 I tried to write an emacs mode for erb, but it's actually impossible to do well

18:37 amalloy: tcrayford: that summary is like a russian doll of awfulness, itself

18:38 technomancy: so now I have to go around telling people to stop using my softwares

18:38 and sometimes they don't listen

18:38 tcrayford: technomancy: 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:38 patchwork: You don't even need .rb files, just code straight in the template!

18:39 technomancy: tcrayford: engineerinating

18:39 tcrayford: enginurinating

18:42 gdev: is anyone preparing for Clojure cup? I'll definitely need a personal trainer and a montage

18:45 callen: parsing erb with...regex?

18:46 tcrayford: callen: in rails core? Yes. Understand that this is a thing. Understand it

18:46 patchwork: callen: I don't see what could go wrong with that

18:46 callen: I knew better than that before I was old enough to rent an apartment.

18:46 gdev: erb? enterprise ruby bean?

18:46 tcrayford: true story, in haskell land nobody actually uses regex anymore, so the regex libs aren't maintained well, because parsec is so damn good.

18:47 callen: tcrayford: parsec is cheat mode.

18:47 patchwork: That is the promised land

18:47 xeqi: can't wait till everyone is using https://github.com/Engelberg/instaparse or better here

18:47 callen: tcrayford: I've seen some neat parsing stuff for Clojure. Did you see that LL(1) one?

18:47 oh, there's what I was thinking of.

18:48 gdev: guarantees in life: death taxes parsing errors

18:48 tieTYT2: is there an "interleave-by" function?

18:49 I want to join this object by its id field and put the ones with null id in its own group

18:49 tcrayford: group-by?

18:49 tieTYT2: well I have two collections

18:49 tcrayford: two collections of maps?

18:49 tieTYT2: lists

18:50 mthvedt: callen: the LL(1) one is kern

18:50 callen: mthvedt: good call, thank you.

18:50 tcrayford: tieTYT2: paste some sample data or something?

18:51 svedubois: (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:51 tieTYT2: (1 2 3 5) (2 3 4) -> ([1] [2 2] [3 3] [4] [5])

18:51 something like that. Except each number is actually an object

18:52 gdev: looks a problem i saw on 4clojure

18:52 *looks like

18:52 svedubois: I am using this function: https://www.refheap.com/paste/14121

18:53 tieTYT2: in haskell, I think this might be a zip-with

18:54 naw nm

18:57 Raynes: tieTYT2: Sounds like you should have a map to update.

18:57 This is what a merge is for.

18:57 tieTYT2: hah I was just going to look for that

18:57 because I can easily turn this into a map of {id obj}

18:57 Raynes: It looks like you're wanting to merge two lists, which is meh.

18:57 Yeah, I'd look into building the data into maps.

18:58 justin_smith: then that looks kind of like a group-by

18:58 tieTYT2: oh but I don't want to overwrite :T

18:59 here'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:59 about to change=about to change to

19:00 justin_smith: ,(group-by :obj [{:obj 1} {:obj 2} {:obj 2} {:obj 3} {:obj 4} {:obj 4}])

19:00 clojurebot: {1 [{:obj 1}], 2 [{:obj 2} {:obj 2}], 3 [{:obj 3}], 4 [{:obj 4} {:obj 4}]}

19:00 justin_smith: I think you can do what you want with that (?)

19:00 tieTYT2: nice that's useful

19:00 but it seems like just a step

19:01 merge would work if it didn't overwrite

19:01 oh but i can probably use merge-with

19:01 i could do merge-with vector me thinks, i'll try

19:02 thanks for the help guys

19:05 svedubois: Any 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:09 justin_smith: are you looking for a definition for create-sphere? should "a" "b" "c" each result in a sphere?

19:09 svedubois: Yes

19:09 but it creates only the sphere a

19:10 justin_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:10 or that is X/mesh

19:15 svedubois: I use the name of a b c to load different mesh (X/mesh.)

19:18 justin_smith: ok, 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:21 svedubois: (doseq [x ["a" "b" "c"]] (apply create-mesh x))

19:21 It works

19:21 thanks

19:22 justin_smith: the apply is not needed there

19:22 (doseq [x ["a" "b" "c"]] (create-mesh x))

19:23 dobry-den: i love the aesthetics of this language. even that simple expression

19:23 justin_smith: there is a poetry to it

19:24 dobry-den: my source code looks like silhouettes of spacecrafts

19:26 n_b: tieTYT2: I think you can just do (map vector)

19:26 ,(map vector '(1 2 3 4) '(1 2 3))

19:26 clojurebot: ([1 1] [2 2] [3 3])

19:27 n_b: oh, You want the ones after as well. >>

19:30 tieTYT2: n_b: yep, thanks though

19:50 gf3: Bodil: Oh hai, BODOL looks awesome btw. It's basically all of my hopes and dreams refined into a delightful little language.

19:52 gdev: can you use BODOL in catnip?

20:27 hyPiRion: Oh, there should be a #BODOL channel over here

20:31 gdev: ,(#(= % %) (*)(*))

20:31 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval36$fn>

20:33 scottj: ,(#(= %1 %2) (*)(*))

20:33 clojurebot: true

20:33 gdev: ,(#(= % %) (*))

20:33 clojurebot: true

20:33 amalloy: ,(= (*) (*)) ;; are we racing to make it simpler?

20:33 clojurebot: true

20:36 gdev: grats on being our swearjure race winner :)

20:36 amalloy: no, the winner would be ##(=)

20:36 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ-

20:36 amalloy: aw man, since when does = not accept no args?

20:36 just ,true then, i guess

20:38 hyPiRion: ,(#(= *)) ;?

20:38 clojurebot: true

20:38 hyPiRion: or just ##(= *) I guess.

20:38 lazybot: ⇒ true

20:39 amalloy: true is shorter though

20:39 hyPiRion: true enough

20:39 metellus: ,(=) ; is this anything?

20:39 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ->

20:39 gdev: ##(= * +)

20:39 lazybot: ⇒ false

20:40 gfredericks: I can't remember if (=) ought to make sense or not

20:40 hyPiRion: no sense

20:40 gfredericks: I feel like this has been argued before

20:40 hyPiRion: yeah

20:40 gfredericks: ,(distinct?)

20:40 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$distinct-QMARK->

20:40 metellus: ,(identity)

20:40 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$identity>

20:40 hyPiRion: gfredericks: yeah, distinct? man.

20:41 ,(distinct? 1 2)

20:41 clojurebot: true

20:41 hyPiRion: ,(distinct 1 2) ; oh, a vector?

20:41 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$distinct>

20:41 gfredericks: yeah that bothers me too

20:42 especially when you go the other way and get a silent true

20:42 hyPiRion: oh yeah

20:43 gfredericks: huh. you could write a replacement clojure.core and put it out as a library.

20:43 hyPiRion: or just fork it

20:43 gfredericks: Clojure Enterprise Edition would obviously have to be the name

20:43 gdev: ,(#_(@#$%&*-+:;')(= * +))

20:43 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: %&*-+:>

20:43 gfredericks: hyPiRion: forking it means having to port all the libs

20:44 hyPiRion: oh dang, right

20:44 gfredericks: clj-http enterprise edition

20:44 I just realized that's a cool aspect of the minimal-special-forms approach

20:47 gdev: cant wait for the day i see on the mailing list "[ANN] enterprise ecommerce Clojure "

20:50 hyPiRion: "Swearjure-machine implemented on an FPGA" would be fun to watch too

21:20 pppaul: i'm in need of some nice zipper tutorials

21:20 clojure zippers or real zippers, both are good for me

21:20 if anyone can link :)

21:21 brehaut: pppaul: apparently http://www.haskell.org/haskellwiki/Zipper is good, but it confused me

21:21 pppaul: http://www.youtube.com/watch?v=1IYgSesN5Fg might help

21:22 pppaul: ahahaha

21:22 zipper simulation...

21:23 brehaut: music by a dying gameboy

21:24 xeqi: zippers are like a space suit

21:29 pppaul: the second zipper video helped me out a lot… i am now confident that i can repair my coat

21:30 amalloy: interesting, 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:31 brehaut: amalloy: no idea sorry; zippers in haskell have remained opaque for me

21:31 also in clojure

21:46 gdev: could've sworn I saw a video by Alex Miller on tree editing with zippers

21:48 even better, clojure conj video about zippers from Luke Vanderhart https://www.youtube.com/watch?v=6c4DJX2Xr3k

22:02 what a good book, code examples make me cringe though http://natureofcode.com/book/introduction/

22:03 and the part where he says "objects have functions"

22:07 but 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:44 lazybot: fortune

22:44 lazybot: Difficulty at the beginning usually means ease at the end...except in bed

22:45 gdev: so true

22:45 lazybot: fortune

22:45 lazybot: I thought you said you were going to go do something

22:46 gdev: okay -_-

22:51 jcromartie: I give up. I'm going back to Rails!

22:51 for this

22:51 I'll stick Varnish in front of a few paths

22:51 and that will solve the performance issues

22:51 but the paralysis and (self-imposed) NIH syndrome is too much for me

22:56 uvtc: How 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:57 Hm. I probably want to find the idx of the first :b, and then split on it ... hm.

22:59 jcromartie: removing is something vectors are not good at

23:00 but yeah

23:00 uvtc: jcromartie: right. I suppose I want to build a new vector but with that one item left out.

23:01 jcromartie: ,(let [v [:a :b :c :d :e :f :g] idx 2] (vec (concat (take idx v) (drop (inc idx) v)))

23:01 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

23:01 jcromartie: derp

23:01 metellus: maybe something with ##(partition-by #{:b} [:a :b :m :n :b :x])

23:01 lazybot: ⇒ ((:a) (:b) (:m :n) (:b) (:x))

23:02 jcromartie: ,(let [v [:a :b :c :d :e :f :g] idx 2] (vec (concat (take idx v) (drop (inc idx) v))))

23:02 clojurebot: [:a :b :d :e :f ...]

23:03 uvtc: jcromartie: 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:03 jcromartie: ,(.indexOf [:a :b :c :b] :b)

23:03 clojurebot: 1

23:04 jcromartie: sort of undocumented, but that's the simplest

23:04 uvtc: jcromartie: heh

23:04 jcromartie: thanks. :)

23:05 jcromartie: ,(map-indexed identity [:a :b :c])

23:05 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$identity>

23:05 jcromartie: oh yeah

23:05 ,(map-indexed vec [:a :b :c])

23:05 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$vec>

23:05 jcromartie: ,(map-indexed vector [:a :b :c])

23:05 clojurebot: ([0 :a] [1 :b] [2 :c])

23:06 jcromartie: HURRRR

23:06 metellus: ,(split-with #(not (#{:b} %)) [:a :b :m :n :b :x])

23:06 clojurebot: [(:a) (:b :m :n :b :x)]

23:06 metellus: use that

23:06 gdev: lazybot: whatis this

23:06 lazybot: this is i don't even

23:06 uvtc: hehe

23:08 Oh, I was giggling at what lazybot said. metellus : /me looking at what you wrote...

23:13 metellus: uvtc: ##(let [[foo bar] (split-with (comp not #{:b}) [:a :b :m :n :b :x])] (concat foo (rest bar)))

23:13 lazybot: ⇒ (:a :m :n :b :x)

23:19 uvtc: metellus: Thanks.

23:19 gdev: lazybot: whatis (+2_2)

23:19 lazybot: (+2_2) is 5 for extremely large values of 2

23:39 howdynihao: do a lot of people use eclipse with clojure?

23:41 uvtc: howdynihao: sure. A number of folks do.

23:41 brehaut: howdynihao: its probably the second or third most popular enviroment

23:41 but its maintained and has good support

23:41 howdynihao: http://stackoverflow.com/questions/2352020/debugging-in-clojure is this the only ways to do debugging?

23:43 is the first emacs?

23:43 brehaut: likely yes

23:44 howdynihao: what would you say the second is if not eclipse?

23:44 brehaut: ccw and vi would be my guess for second

23:44 cemerick's survey might have numbers

23:44 cemerick: emacs > vi > eclipse IIRC

23:45 howdynihao: whats ccw?

23:45 brehaut: eclipse mode

23:45 counter clockwise

23:48 SegFaultAX: Whoa did github just keel over?

23:48 n_b: yup

23:49 But I don't understand the surprise :P

23:49 TimMc: SegFaultAX: What did you do!

23:49 uvtc: Was about to ask the same thing.

23:49 SegFaultAX: http://www.downforeveryoneorjustme.com/github.com

23:49 n_b: maybe their new arrays are buggy after all

23:51 gdev: clojurebot: whatis ur favorite IDE

23:51 clojurebot: qcon slides is http://qconlondon.com/london-2009/file?path=/qcon-london-2009/slides/RichHickey_PersistentDataStructuresAndManagedReferences.pdf

23:51 gdev: lazybot: whatis ur favorite IDE

23:51 lazybot: ur is not a word! (╯°□°)╯︵ ┻━┻

23:52 gdev: lazybot: whatis your favorite IDE, sorry

23:52 lazybot: your is better ┬──┬ ノ(°—°ノ) I'm fine

23:53 SegFaultAX: lazybot: You need a nap.

23:54 gdev: lazybot: fortune

23:54 lazybot: "oh hai"

23:54 uvtc: metellus: 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:56 pl6306: How do I spawn another process from clojure (running on windows)? Thanks!

23:57 SegFaultAX: uvtc: That seems slow. Why not just subvec?

23:58 n_b: pl6306: (.new (Thread. #(some_fn))

23:58 uvtc: Actually, 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:58 SegFaultAX: n_b: That's a thread, not a process.

23:58 pl6306: No I mean an OS process

23:59 SegFaultAX: ,(.indexOf [1 2 3] 2)

23:59 clojurebot: 1

23:59 n_b: You mean like shelling out to something else?

23:59 SegFaultAX: uvtc: ^

Logging service provided by n01se.net