2013-08-30
| 00:03 | gdev | you put the util back in futile |
| 00:03 | futile | gdev: I'll take that as a complement. |
| 00:04 | futile | pun intended |
| 00:23 | futile | General question: What's a good way to save any kind of request (even POST requests), such that after you login, you can replay it exactly? |
| 01:15 | murtaza52 | hi, I have two pred fns - fn1 and fn2, I want to create a fn which returns true if any of these pred is true |
| 01:15 | murtaza52 | is there an idiomatic way to combine them |
| 01:16 | callen | (some? (map ...)) ? |
| 01:20 | murtaza52 | callen: how will some work, it takes only one pred |
| 01:29 | `cbp | murtaza52: maybe |
| 01:29 | `cbp | um |
| 01:30 | jkkramer | murtaza52: some-fn |
| 01:32 | `cbp | oh i didnt know about some-fn i was gonna suggest (map (comp (partial some true?) (juxt fn1 fn2))) :-) |
| 01:33 | `cbp | without the map i guess |
| 01:35 | murtaza52 | jkkramer: thanks |
| 01:41 | murtaza52 | needed hep regarding lighttable |
| 01:41 | murtaza52 | how do I see the doc of a fn in lightatble |
| 01:42 | murtaza52 | in repl I can do (doc some), however this doesnt work in lighttab;e |
| 02:55 | supersym | murtaza52: you first need to require clojure.repl namespace |
| 02:59 | murtaza52 | supersym: Yup this that. That displays it in the console, however is there an inbuilt way. |
| 03:03 | rurumate | Ok, I have a cloujurescript repl in emacs' inferior-lisp buffer connected to "lein trampoline cljsbuild repl-listen". How to get autocomplete working? Thanks! |
| 03:04 | murtaza52 | (take 3 (iterate + 1)) -> (1 1 1) |
| 03:04 | murtaza52 | shouldnt the output be (2 3 4) |
| 03:05 | murtaza52 | The doc for iterate says (f (f x)) |
| 03:05 | metellus | ,(+ (+ 1)) |
| 03:05 | clojurebot | 1 |
| 03:05 | rurumate | murtaza52: what is (+ (+ 1)) |
| 03:06 | rurumate | murtaza52: you mean (iterate inc 1) |
| 03:06 | murtaza52 | rurumate: thanks! |
| 03:06 | murtaza52 | ,(take 2 (iterate inc 1)) |
| 03:06 | clojurebot | (1 2) |
| 03:07 | ordnungswidrig | ,(take 3 #(partial (+ 1))) |
| 03:07 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: sandbox$eval167$fn__168> |
| 03:07 | ordnungswidrig | ,(take 3 (iterate #(partial (+ 1)))) |
| 03:07 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$iterate> |
| 03:08 | metellus | ,(take 3 (partial (+ 1))) |
| 03:08 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 03:08 | ordnungswidrig | ,(take 3 (iterate #(partial (+ 1)) 0)) |
| 03:08 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval283$fn> |
| 03:08 | ordnungswidrig | ,(take 3 (iterate #(partial (+ % 1)) 0)) |
| 03:08 | clojurebot | (0 1 2) |
| 03:10 | ordnungswidrig | ,(take 3 (iterate (partial (+ 1)) 0)) |
| 03:10 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 03:10 | rurumate | Is there a good emacs mode for editing clojurescript? |
| 03:10 | ordnungswidrig | rurumate: why not clojure-mode? |
| 03:11 | metellus | ordnungswidrig: &(take 3 (iterate (partial + 1) 0)) |
| 03:11 | rurumate | ordnungswidrig: autocomplete doesn't work, don't know why |
| 03:11 | metellus | ,(take 3 (iterate (partial + 1) 0)) |
| 03:11 | clojurebot | (0 1 2) |
| 03:11 | ordnungswidrig | metellus: thanks. I'm confused, early in the morning |
| 03:11 | ordnungswidrig | rurumate: ah. I don't know, never did much clojure-script. |
| 03:13 | TEttinger | why (partial + 1) ? it's the same as inc |
| 03:15 | SegFaultAX | Did I miss something? ##(take 3 (range)) |
| 03:15 | lazybot | ⇒ (0 1 2) |
| 03:15 | metellus | I assumed that the first was a toy example to show that iterate didn't do what the person expected |
| 03:16 | rurumate | is it possible to build fibonacci using iterate? |
| 03:17 | SegFaultAX | ,(take 10 (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))) |
| 03:17 | clojurebot | (0 1 1 2 3 ...) |
| 03:18 | rurumate | SegFaultAX: neat |
| 03:19 | TEttinger | ##(nth 100 (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))) |
| 03:19 | lazybot | java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.Number |
| 03:21 | rurumate | nth is the other way round |
| 03:21 | TEttinger | yeah, I was testing in privmsg. ##(nth (map first (iterate (fn [[a b]] [b (+ a b)]) [0N 1N])) 500) needs BigIntegers too |
| 03:21 | lazybot | ⇒ 139423224561697880139724382870407283950070256587697307264108962948325571622863290691557658876222521294125N |
| 03:21 | SegFaultAX | TEttinger: Just use +' |
| 03:21 | SegFaultAX | It will auto-promote |
| 03:21 | TEttinger | whaaaat |
| 03:22 | rurumate | oops |
| 03:22 | TEttinger | when did it stop autopromoting? |
| 03:22 | TEttinger | with normal ints I mean |
| 03:23 | rurumate | is this a performance thing? |
| 03:23 | SegFaultAX | 1.3 |
| 03:23 | SegFaultAX | I think |
| 03:23 | rurumate | +' is not on http://clojure.org/cheatsheet |
| 03:23 | TEttinger | yeah, http://clojuredocs.org/clojure_core/clojure.core/+' doesn't list it on 1.2 but yes on 1.3 |
| 03:23 | SegFaultAX | rurumate: So? |
| 03:24 | rurumate | SegFaultAX: I'm a cheat sheet guy, so this affects me |
| 03:24 | SegFaultAX | rurumate: Usually you don't need auto-promoting... until you do. |
| 03:24 | TEttinger | only if you need arbitrary precision |
| 03:24 | SegFaultAX | Like for cute one line demonstrations of fibonacci and factorial. |
| 03:26 | TEttinger | what's the typical way of demonstrating factorial? ##(reduce *' (range 1 100)) ? |
| 03:26 | lazybot | ⇒ 933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000N |
| 03:26 | SegFaultAX | TEttinger: Or apply *' |
| 03:26 | rurumate | +' is also not here: http://clojuredocs.org/quickref/Clojure%20Core |
| 03:26 | rurumate | is there any page that lists all core functions |
| 03:27 | SegFaultAX | rurumate: core.clj |
| 03:27 | TEttinger | rurumate, that is odd. people have been talking about fixing up clojuredocs, it's just not written in clojure |
| 03:28 | TEttinger | I think it's... django? |
| 03:28 | SegFaultAX | Rails |
| 03:28 | TEttinger | ouch |
| 03:28 | rurumate | at least there should be some document that's generated from core.clj somewhere |
| 03:28 | SegFaultAX | Ugly rails at that. |
| 03:28 | TEttinger | rurumate, there is |
| 03:29 | TEttinger | http://clojure.github.io/clojure/clojure.core-api.html |
| 03:29 | TEttinger | http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/+' since 1.0 |
| 03:29 | TEttinger | wait that's not right |
| 03:30 | TEttinger | + is claimed to be added in 1.2 |
| 03:30 | TEttinger | must have switched it with +' |
| 03:31 | SegFaultAX | No, that's right. |
| 03:31 | SegFaultAX | + was renamed to +' |
| 03:31 | TEttinger | yeah, makes sense |
| 03:31 | SegFaultAX | Because + isn't auto-promoting. |
| 03:31 | TEttinger | any more! |
| 03:40 | djcoin | SegFaultAX: Can't recall precisely the whole auto-promoting, it means converting an int to a double for example ? So with if you do (+ 1.0 3) you get an error ? |
| 03:41 | SegFaultAX | djcoin: Not quite |
| 03:41 | SegFaultAX | It means promoting integers to larger data types before overflow. |
| 03:41 | djcoin | Alright, thanks :) I had this in mind to |
| 03:41 | SegFaultAX | So like int to big int. |
| 03:41 | djcoin | too* |
| 04:24 | rhg135 | Can someone please explain the make-node argument to clojure.zip/zipper |
| 04:24 | rhg135 | I don't understand what it should return |
| 04:25 | SegFaultAX | Whoa http://www.davidgcohen.com/2013/08/29/a-shocking-accelerator-story-that-youll-need-to-read-twice/ |
| 04:25 | SegFaultAX | Don't stick your startup in crazy. |
| 04:28 | ucb | I'm in need of a lib to write a TCP/UDP server. I guess Aleph is the one to go for first. Are there any alternatives out there? |
| 04:30 | clgv | ucb: do you really need the TCP/UDP level directly or do you just want to build a non http/rest protocol for your software? |
| 04:30 | ucb | clgv: latter :) |
| 04:33 | clgv | ucb: oh right netty came to my mind - this is what aleph uses as well^^ |
| 04:34 | ucb | clgv: I did think of netty, but I'd rather not deal with the low levels until I absolutely have to. That's why I thought of aleph. IIRC there's a clojure wrapper for netty as well, right? |
| 04:34 | clgv | ucb: just to mention an unconvential idea. I built a message passing communication on top of RMI. after writing the RMI layer I didnt need to touch it at all but just exchange messages as clojure maps |
| 04:34 | ucb | that is a great idea |
| 04:35 | ucb | unfortunately I have to interface with python |
| 04:35 | clgv | ucb: oh right I didnt ask the platform question ;) |
| 04:35 | ucb | heh, no worries |
| 04:35 | ucb | I think I'll just go ahead and get started with aleph |
| 04:36 | clgv | usb: well I'd try aleph as high level library before testing a "pure" netty wrapper |
| 04:36 | ucb | thanks for the comments though |
| 04:36 | ucb | yeah |
| 04:37 | clgv | usb: another quick remark to the RMI idea. javas RMI also has options to expose a CORBA interface afaik, so that could be the cross-plattform option for that idea.. |
| 04:37 | clgv | but I dont know if anyone really wants to use corba these days ;) |
| 04:38 | ucb | heh |
| 04:39 | SegFaultAX | What are you building? |
| 04:40 | ucb | I'm writing a replacement for graphite's relays |
| 04:41 | clgv | ucb: what is graphite? |
| 04:41 | xsyn | http://www.huffingtonpost.com/2013/08/29/mindful-parenting-carla-naumburg_n_3825425.html |
| 04:41 | SegFaultAX | clgv: It's a stat collection service. |
| 04:41 | SegFaultAX | Very awesome. |
| 04:41 | ucb | clgv: http://graphite.wikidot.com/ |
| 04:41 | ucb | erk, probably not the most up to date, but you'll get the idea |
| 04:41 | SegFaultAX | rhg135: It creates new nodes from existing ones. |
| 04:42 | ucb | SegFaultAX: yeah. Thing is, the relays don't quite cope with our load unfortunately :( |
| 04:42 | clgv | usb: oh nice. just had a look at the screenshots of the web interface |
| 04:42 | SegFaultAX | ucb: Is this more than a statsd-esque aggregator? |
| 04:42 | SegFaultAX | How many measurements per second? |
| 04:42 | ucb | SegFaultAX: the relays? |
| 04:43 | SegFaultAX | h, relays. |
| 04:43 | ucb | IIRC we're doing a ~3K/s (can't remember from the top of my head) |
| 04:43 | SegFaultAX | Oh* |
| 04:43 | ucb | yeah, we're not replacing graphite, just the relays |
| 04:43 | SegFaultAX | statsd doesn't replace it, it's just a pre-aggregator. |
| 04:43 | SegFaultAX | It buckets measurements into 10 second intervals. |
| 04:44 | ucb | yes, sure |
| 04:44 | ucb | I guess I misinterpreted your question :) |
| 04:44 | rhg135 | I read that but is it OK to return just the sequence of children? |
| 04:44 | ucb | the relays only do re-routing |
| 04:44 | SegFaultAX | rhg135: Depends on what you're zippering I guess. |
| 04:44 | SegFaultAX | rhg135: Look at how the other zippers are implemented. |
| 04:45 | rhg135 | Where's some? |
| 04:45 | SegFaultAX | ucb: Sure. Still, that's a pretty decent volume. :) |
| 04:45 | SegFaultAX | rhg135: Look at the sauce for clojure.zip |
| 04:45 | rhg135 | K |
| 04:46 | SegFaultAX | ucb: How many caches? |
| 04:47 | SegFaultAX | And are you using prefix shards or something more complicated? |
| 04:47 | ucb | prefixed shards and we have 8 caches IIRC |
| 04:47 | ucb | I haven't worked on this for months, so the details are hazy :/ |
| 04:48 | ucb | oh, one thing that was a big bin in performance was to stop sending plain text to the relays |
| 04:48 | SegFaultAX | How granular are your retentions? |
| 04:48 | ucb | and instead pickled batches |
| 04:48 | SegFaultAX | Yea of course. |
| 04:48 | SegFaultAX | UDP all the things. |
| 04:48 | ucb | heh |
| 04:48 | ucb | we're using TCP |
| 04:48 | ucb | perhaps we should move to UDP |
| 04:48 | SegFaultAX | Ouch. |
| 04:48 | SegFaultAX | That doesn't help. |
| 04:49 | ucb | we're dropping data anyway :/ |
| 04:49 | SegFaultAX | I've often wondered if it would be viable to re-write carbon in whisper. |
| 04:49 | ucb | we're currently dropping (because the relays aren't coping) ~100/s |
| 04:49 | SegFaultAX | In clojure |
| 04:49 | ucb | it should be in principle |
| 04:50 | ucb | thing is, you might as well write it without preserving compatibility |
| 04:50 | SegFaultAX | I meant to say "write it in clojure and abandon whisper" |
| 04:50 | ucb | yeah |
| 04:50 | SegFaultAX | Honestly, this is basically riemann with history. |
| 04:50 | SegFaultAX | (Something I've been waiting for for a very long time) |
| 04:51 | SegFaultAX | aphyr y u no make riemann durable! |
| 04:51 | ucb | heh, we're fwding from riemann to graphite |
| 04:51 | ucb | also, crazy startup story that one |
| 04:51 | SegFaultAX | Hmm? |
| 04:52 | SegFaultAX | Isn't he at Factual? |
| 04:52 | SegFaultAX | Also, you're using Riemann is a frontend? I'm jelly, can I see your panel?!?!?! |
| 04:52 | ucb | Factual? what? |
| 04:52 | rhg135 | Ah now I get it. |
| 04:52 | SegFaultAX | I thought aphyr was working at Factual. |
| 04:52 | ucb | we don't have a dash in front of riemann, we're using it just for metrics and alerts for now |
| 04:52 | ucb | right, no idea |
| 04:53 | SegFaultAX | 01:28 < ucb> also, crazy startup story that one |
| 04:53 | SegFaultAX | Thought that was about aphyr |
| 04:53 | ucb | oh, right, no. It was about that blog you linked. |
| 04:53 | SegFaultAX | Oh dude, I know. Wtf. |
| 04:54 | SegFaultAX | I was in the founders den a few years back |
| 04:54 | SegFaultAX | That was pretty fun. |
| 04:54 | ucb | nice |
| 04:54 | SegFaultAX | You work in SF? |
| 04:54 | ucb | nope, I'm in the far north of UK |
| 04:54 | ucb | think North. North of that. |
| 04:54 | SegFaultAX | Far norf. FTFY |
| 04:55 | ucb | bloody esta |
| 04:56 | freiksenet | some clojure 'type inference' fun: http://techblog.zenrobotics.com/2013/08/clojure-puzzler-2.html#comment-form |
| 04:56 | SegFaultAX | Alright, off to bed. |
| 04:56 | SegFaultAX | Night! |
| 04:56 | ucb | night! |
| 04:57 | SegFaultAX | ucb: You should get approval (if you need it) to open source your graphite relay replacement. |
| 04:57 | SegFaultAX | That could be really really useful. |
| 04:57 | ucb | SegFaultAX: that's the plan |
| 04:58 | ucb | SegFaultAX: some bits of it are already open, like the pickler and the consistent hashing |
| 04:58 | SegFaultAX | Well that's built in. |
| 04:58 | ucb | I'm just putting things now into a /coherent/ application |
| 04:58 | SegFaultAX | Sweet. |
| 04:58 | ucb | (or at least trying to) |
| 05:17 | ucb | any suggestions? |
| 05:43 | lotia | freiksenet: Would love to get an explanation on why |
| 05:43 | lotia | freiksenet: regarding the puzzler to which you posted a link |
| 05:45 | vxn | I second that. The result is quite surprising. |
| 05:46 | Anderkent]away | it's because the compiler doesn't infer a common interface for :x and (fn [] ...) |
| 05:46 | Anderkent]away | in the return of if statement |
| 05:46 | Anderkent | thus it doesn't know what the interface of (if true :x (fn ...)) is, thus it cannot use it to locate the right Thread consturctor on compile time |
| 05:47 | clgv | Anderkent: you'd have to patch it to find the maximum common interface/subclass if that is possible |
| 05:48 | clgv | Anderkent: if that's doable you should file a ticket on jira. |
| 05:48 | Anderkent | clgv: don't think it is |
| 05:48 | Anderkent | not 'correctly' |
| 05:48 | Anderkent | or rather you'd need union types |
| 05:48 | clgv | Anderkent: but maybe worth a mailing list post |
| 05:48 | Anderkent | because say you have function(Runnable c) and function(IFn f) and function(Keyword k) |
| 05:49 | Anderkent | the most specific overload wins |
| 05:49 | clgv | Anderkent: oh I did not mean that |
| 05:49 | freiksenet | lotia: if type inference only unifies the class name |
| 05:49 | Anderkent | but you don't know which one the expression is |
| 05:49 | Anderkent | so you cannot decide which fn to use on compile time |
| 05:49 | Anderkent | you have to use reflection |
| 05:49 | clgv | I meant the inference that both keyword and fn are IFn |
| 05:49 | freiksenet | yeah, but the class is AFunction and Keyword |
| 05:50 | Anderkent | clgv: yes, but you'd have to check that Thread. has an IFn type an no Keyword / AFunction types |
| 05:50 | freiksenet | vars are unified even in weirder name, try (if identity (fn [] 1)) that won't unify |
| 05:50 | Anderkent | i.e. you must verify that the resolution is the most specific overload for either branch |
| 05:50 | freiksenet | so basically if statement gets 'known' type when both branches has same cals |
| 05:50 | freiksenet | class* |
| 05:50 | clgv | Anderkent: or does that inference work already and you only meant to show that it is not clear which thread constructor to resolve to? |
| 05:51 | Anderkent | no, it's clear which one it should resolve to in this case |
| 05:51 | Anderkent | because the only alternative to Runnable is ThreadGroup |
| 05:51 | Anderkent | but it's hard to solve in the generic case |
| 05:51 | freiksenet | it is all about how if works, not about thread |
| 05:51 | freiksenet | or rather how clojure 'inference' works with it |
| 05:52 | freiksenet | arcatan here can be more comprehensive than I, I guess |
| 05:52 | clgv | freiksenet: no. there is type inference for "if" in the case of primitives |
| 05:52 | Anderkent | yeah, and the type inference is local, i.e. you need to decide what type (if :x (fn ...)) is before you know you're putting it into Thread., I think |
| 05:52 | freiksenet | clgv: yes, I never denied that. but it works by comparing classes |
| 05:52 | Anderkent | though you could try to infer it top down |
| 05:53 | freiksenet | and it gives 'type' to if only if they match |
| 05:53 | clgv | freiksenet: ok^^ yeah the ancestors of the classes are not considered |
| 05:53 | freiksenet | it also works funky with vars |
| 05:53 | Anderkent | freiksenet: well that's because you can't know the type of the var |
| 05:53 | Anderkent | yuo don't know someone didnt just alter-var-root it |
| 05:54 | freiksenet | yeah, sure. |
| 05:54 | freiksenet | we'll have a bigger blog post on that subject on monday I think |
| 05:54 | arcatan | if someone writes it :P |
| 05:54 | arcatan | i guess i should |
| 05:55 | Anderkent | huh, keywords can't have metadata? |
| 06:13 | rurumate | How to resolve a function by string (java reflection style)? Say, I have this string "my.ns/foo" and there is a function foo in namespace my.ns, how to invoke foo? |
| 06:14 | Anderkent | rurumate: (resolve (symbol "clojure.core/+")) |
| 06:15 | Anderkent | that gives you the function, call it with another paren wrap |
| 06:16 | rhg135 | Why the symbol call? |
| 06:16 | Anderkent | resolve takes a symbol |
| 06:17 | rhg135 | I mean why use 2 args |
| 06:17 | rhg135 | O nvm |
| 06:17 | rhg135 | Derp lol |
| 06:17 | rurumate | Anderkent: it works with core namespaces, but not with a namespace I required |
| 06:18 | rcg | http://clojuredocs.org/clojure_core/1.2.0/clojure.core/read-string |
| 06:18 | rurumate | the require works, but the resolve returns nil.. |
| 06:18 | Anderkent | rurumate: can you post the exact steps you took to refheap? |
| 06:19 | rurumate | Anderkent: oops my bad, the function didn't exist (typo) |
| 06:19 | Anderkent | hah :P |
| 06:20 | rhg135 | They keep it interesting ;) |
| 06:20 | Anderkent | rcg: read-string is eval/evil, so don't. |
| 06:21 | rhg135 | Yup |
| 06:22 | rhg135 | It can eval code |
| 06:25 | clgv | Anderkent: it works with ^:const metadata on vars |
| 06:33 | Anderkent | clgv: right, because :const tells the compiler to substitute the value for any var references |
| 06:33 | clj_newb_2345 | where in the world can I find a quality tutorial on datalog? the theory and semantics |
| 06:37 | fredyr | clj_newb_2345: if you find one, let me know |
| 06:37 | fredyr | i've been looking as well |
| 06:38 | clj_newb_2345 | http://code.google.com/p/clojure-contrib/wiki/DatalogOverview has a borken link to "Functional Relational Programming" |
| 06:38 | clj_newb_2345 | let's dig up that paper |
| 06:38 | fredyr | http://www-users.cselabs.umn.edu/classes/Spring-2010/csci8211/Readings/datalog.pdf |
| 06:38 | fredyr | this one is the best i've found previously |
| 06:41 | clj_newb_2345 | https://github.com/richhickey/clojure-contrib/tree/2ede388a9267d175bfaa7781ee9d57532eb4f20f/src/main/clojure/clojure/contrib/datalog is really short |
| 06:41 | clj_newb_2345 | I'm just going ot read the src instead :-) |
| 06:41 | fredyr | :) |
| 06:43 | clgv | clj_newb_2345: this is new http://www.learndatalogtoday.org/ |
| 06:43 | clgv | clj_newb_2345: do yourself a favor and ignore the old clojure.contrib completely |
| 06:44 | clj_newb_2345 | clgv: datalog + datomic, nice! |
| 06:49 | clgv | clj_newb_2345: I am starting to use it myself since yesterday ;) |
| 06:52 | noncom | can i define another macro, instead of (ns) to create namespaces and use it instead of (ns) ? |
| 06:56 | clgv | noncom: not literally. but you can use data_readers.clj and tagged literals to approximate that |
| 06:58 | noncom | clgv: but i have looked into the source of (ns) - it is simply a macro, there is nothing that i couldn't write.. or not? at the end it refers to RT.load which does all the actual work anyway... |
| 06:59 | noncom | or you mean that a file won't be recognized as a namespace if there is no (ns) ? |
| 06:59 | clgv | noncom: the reason you can not write your own `ns` is a bootstrap problem |
| 06:59 | noncom | what do you mean? |
| 07:00 | clgv | you need to require the new namespace macro before using it |
| 07:01 | clgv | e.g. (require '[my.awesome.namespace :as m]) (m/my-ns ....) |
| 07:02 | Anderkent | Hm. What makes ns available before clojure is referred? |
| 07:02 | clgv | Anderkent: the compiler |
| 07:03 | noncom | alright, what if i have several namespaces defined with (ns) where i have (my-ns) and all the other namespaces defined with (my-ns)? |
| 07:03 | noncom | can't i make (my-ns) as available, as (ns) is? |
| 07:03 | clgv | noncom: ParsingException: WHAT? |
| 07:03 | Anderkent | if you can ensure the namespace that declares my-ns is loaded, you can do (full.namespace/my-ns ...) without requiring |
| 07:03 | Anderkent | but that's ... messy |
| 07:04 | clgv | yeah that works^^ |
| 07:04 | hyPiRion | You can probably dump it into clojure.core too, but that's even messier. |
| 07:04 | Anderkent | right |
| 07:04 | clgv | but then you could just use data literals with the normal ns and make sure the data_literal function is required |
| 07:04 | noncom | so i could make an invasive surgery and register it within 'clojure.core' ? |
| 07:04 | hyPiRion | I'd just... use ns |
| 07:05 | clgv | noncom: why do you want to do that anyway? (not that I havent been there already ;) ) |
| 07:05 | hyPiRion | noncom: well, yes. You can register it in clojure.core if you really want to |
| 07:06 | Anderkent | you can even (alter-var-root #'ns) if you *really* want to |
| 07:06 | clgv | Anderkent: btter use some hooking library to easily revert the hook ;) |
| 07:06 | noncom | heheh :) it turns out that i do not need an (ns) macro in the system. i do my own namespaces management and the (ns) macro is only used to require the custom ns-management system which then does all the work. hence, there is always the same (ns) macro call in each ns and it is simply useless to do it that way |
| 07:07 | Anderkent | that sounds like a bad idea |
| 07:07 | noncom | oh very cool, you suggest some really cool ways |
| 07:07 | Anderkent | noncom: we're in the daily wtf mode now |
| 07:08 | clgv | noncom: "your own namespace management" that sounds like duplicating efforts. I have been there for some configuration file format and realized alter that I am better of using regular clojure namespaces... |
| 07:08 | hyPiRion | Anderkent: alter-var-rooting ns would be suicide. Suddenly you require a namespace from a lib and the world blows up. |
| 07:08 | noncom | Anderkent: I understand what you mean, but for the purpose of the current task, I believe this is very good solution. I will use the "custom ns-management system" only in a limited area inside the program. |
| 07:09 | llasram | noncom: Hmmm. You could write a lein plugin which loads your alternate-ns form before loading any code. For applications, you could add a runtime loader stub like lein-otf's, but for first loading your alternate ns form |
| 07:09 | noncom | wow, one more way! |
| 07:10 | Anderkent | hyPiRion: I know, I was kidding. Really. |
| 07:10 | noncom | i understand why you people are sad about this, but i believe it is really worth in my case. and it will be an isolated case |
| 07:10 | hyPiRion | Anderkent: hah, good. |
| 07:10 | Anderkent | also, alter-var-rooting a macro in general doesnt seem like a good idea :P |
| 07:11 | hyPiRion | alter-var-rooting in general is dangerous |
| 07:11 | hyPiRion | Only exception is for memoizing |
| 07:12 | hyPiRion | Well, that's my take on it. You have to know what you're doing at least |
| 07:13 | Anderkent | eh, it has its uses. But mostly in 'this is a messy shortcut so that developers can have it a bit easier' kind of way |
| 07:13 | Anderkent | like a wipe state button :P |
| 07:13 | Anderkent | but i was going more towards the need to handle special macro args etc. yourself |
| 07:13 | clgv | noncom: no one is sad about the idea - just warning you for your own sake ;) |
| 07:14 | noncom | hehe :D... well.. after some time we shall see if it all was worth it :) |
| 07:17 | clgv | serious doubts over here ;) |
| 07:19 | noncom | clgv: could you tell me, how it turned out in your case? waht did you realize after you tried that? |
| 07:20 | rurumate | Can anyone help me with a macro? I'm trying to use another macro inside it, and the compiler doesn't like it.. https://www.refheap.com/18171 |
| 07:21 | clgv | noncom: I tried an own management for config namespaces since I splitted them into several files for reuse. ultimately I noticed that I needed more features which I simply get by using `def` and standard clojure namespaces... |
| 07:22 | rurumate | run-in-parallel should wrap each form in (future (form)), then call (dorun (map deref) forms) on the resulting list "forms" |
| 07:23 | hyPiRion | rurumate: macros aren't first class functions |
| 07:23 | hyPiRion | first class, rather |
| 07:23 | hyPiRion | So you cannot do (map first-class ...), you'd have to do (map #(first-class %) ...) |
| 07:24 | clgv | rurumate: just use (defmacro run-in-parallel [& forms] `(map deref ~(mapv (fn [x] `(future ~x)) forms))) |
| 07:24 | hyPiRion | (Either way, I don't see why you have a to-future macro, you could use future straight away) |
| 07:24 | rurumate | hmm |
| 07:25 | clgv | rurumate: the keypart is that `mapv` is run at macroexpansion time in this macro and builds the code snippets that wrap the forms into futures |
| 07:25 | rurumate | clgv: that works, nice |
| 07:25 | clgv | rurumate: I used `mapv` to get a vector as result so that clojure does not try to execute the first element as function |
| 07:26 | clgv | rurumate: writing macros bottom-up with macroexpand-1 usage at every step helps to get it right in a short time |
| 07:26 | rurumate | clgv: amazing, you're nesting the `s and ~s |
| 07:27 | rurumate | clgv: but shouldn't x# be used instead of x? |
| 07:27 | hyPiRion | You'll see it often when you're modifying the forms and reproduce them |
| 07:28 | clgv | rurumate: yeah that could be done in a function as well, e.g. (defn wrap-futures [forms] (mapv (fn [x] `(future ~x)) forms)) (defmacro run-in-parallel [& forms] `(map deref ~(wrap-futures forms)) |
| 07:28 | clgv | +) |
| 07:29 | hyPiRion | rurumate: ##(mapv (fn [x] `(future ~x)) '(this (should be) okay, you 'know)) |
| 07:29 | lazybot | ⇒ [(clojure.core/future this) (clojure.core/future (should be)) (clojure.core/future okay) (clojure.core/future you) (clojure.core/future (quote know))] |
| 07:29 | clgv | rurumate: no it should not be x#, since it is a parameter of the function used in mapv and not some gensym |
| 07:36 | poutsi | hey guys, just noticed what I think is a bug in how 1.5.1's REPL handles the timezone of a java.util.Calendar instance |
| 07:36 | poutsi | when evaluated it prints it out with the normal timezone offset instead of the DST one even though it's DST now |
| 07:36 | poutsi | so, bugs reports go where? the dev google group? |
| 07:38 | poutsi | just tried the same in the latest 1.6.0 snapshot and it's wrong there too |
| 07:39 | Anderkent | poutsi: which repl is that? clojure.main? lein repl? |
| 07:41 | poutsi | hoom, I'm still mostly at the point where lein is magic. But, I tried 1.5.1 with a lein repl and the snapshot jar I just fed to java -jar |
| 07:43 | llasram | poutsi: I'd be pretty flabbergasted if Clojure, lein, or any REPL layer was causing that |
| 07:43 | llasram | poutsi: gist? |
| 07:43 | poutsi | sec |
| 07:44 | poutsi | yup, the expected outcome is definitely me having a red face but let's see |
| 07:44 | Anderkent | well, I wouldn't be surprised if something adds a `print-method` for Calendar objects |
| 07:44 | Anderkent | they string pretty ugly |
| 07:45 | Anderkent | ,(str (java.util.Calendar/getInstance)) |
| 07:45 | clojurebot | "java.util.GregorianCalendar[time=1377861700537,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"Etc/UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2013,MONTH=7,WEEK_OF_YEAR=35,WEEK_OF_MONTH=5,DAY_OF_MONTH=30,DAY_OF_YEAR=242,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=5,AM_PM=0,HOUR=11,H... |
| 07:45 | Anderkent | ,(pr (java.util.Calendar/getInstance)) |
| 07:45 | clojurebot | #inst "2013-08-30T11:21:45.623+00:00" |
| 07:46 | llasram | Oh, that makes sense. I skipped learning the Java stdlib date-time stuff, and had forgotten a "Calendar" represents a date-time. You know, wth? |
| 07:47 | Anderkent | https://github.com/clojure/clojure/blob/clojure-1.5.1/src/clj/clojure/instant.clj#L169 |
| 07:47 | poutsi | https://gist.github.com/ilkka/6388908 |
| 07:47 | Ember- | fortunately finally in java 8 there's going to be a reasonable date api |
| 07:47 | Anderkent | I really wouldn't have guessed to look at instant.clj |
| 07:47 | Ember- | but in the mean time, use joda-time |
| 07:47 | Ember- | and clj-time wrapped on top of joda-time |
| 07:47 | Anderkent | anyway, it just calls (.format utc-format date) |
| 07:48 | poutsi | Ember-: I know, I just hit upon this by accident because of legacy stuff having nothing to do with clojure |
| 07:48 | Anderkent | also hahaha we too have a 'WTF SimpleDateFormat is NOT THREAD SAFE' comment somewhere in a couple of our projects |
| 07:49 | Anderkent | oh sorry it special cases Calendar |
| 07:50 | repsac | So I have task that I would like to rate limit, is there any good way to do so? |
| 07:50 | Anderkent | but still, it just asks String/format to pull out the timezone from Calendar... So if there's anything wrong with it it's javas fault |
| 07:50 | repsac | like if I could specify a minimum interval between executions in a while loop |
| 07:51 | Anderkent | repsac: core.async! :P |
| 07:51 | repsac | really? |
| 07:51 | repsac | Well it's kinda still alpha though |
| 07:51 | Anderkent | well, yes, it's easy with core.async, but there's simpler solutions too |
| 07:51 | Anderkent | The most obvious one is to just call thread/sleep in the while loop |
| 07:52 | clgv | repsac: you want something like a cron? |
| 07:52 | repsac | I guess, I was just thinking there would be some construct intended for this |
| 07:53 | repsac | clgv: well I have a task that I would like to not gets run more often than say once a minute |
| 07:53 | Anderkent | i.e. (while condition (let [start-time (time-millis-now) _ (do-work) end-time (time-millis-now)] (sleep (-> (+ start-time interval) (- end-time))))) |
| 07:54 | repsac | and I would also like to be able to interrupt the task |
| 07:54 | llasram | Anderkent, poutsi: ##(format "%1$tz" (java.util.Calendar/getInstance)) |
| 07:54 | lazybot | ⇒ "-0700" |
| 07:54 | llasram | What the heck is that doing? |
| 07:55 | Anderkent | pulling timezone out of the calendar, obviously! |
| 07:55 | llasram | haha |
| 07:55 | llasram | thanks :-p |
| 07:55 | repsac | Anderkent: Yeah that's along the lines I was thinking too. I guess I would interrupt the thread to break it out of its sleep? |
| 07:55 | Anderkent | repz - just set the condition to false |
| 07:55 | Anderkent | it will wake up on its own and exit when interval expires |
| 07:56 | llasram | woooow -- http://docs.oracle.com/javase/6/docs/api/java/util/Formatter.html#dt |
| 07:56 | repsac | yeah but I don't want it to wait for the sleep to expire :) |
| 07:56 | poutsi | shit, timezones are complicated (news, right) |
| 07:56 | Anderkent | repsac: eh. You could do that. But why bother? |
| 07:56 | repsac | i think (.interrupt thread) breaks it out though |
| 07:56 | poutsi | is "timezone" even the same as "current utc offset"? |
| 07:57 | poutsi | what I mean is, the format "%1$tz" bit pulls out +2 hours |
| 07:57 | repsac | well if a thread is active but sleeping for like 5 minutes I would not be abl e to shut down the VM gracefully |
| 07:57 | poutsi | but the current correct offset is +3 |
| 07:57 | Anderkent | poutsi: maybe your locale is misconfigured? :P |
| 07:57 | clgv | repsac: well you can make those threads backgroundthreads |
| 07:58 | repsac | mark it is a daemon? Or how do you make it background? |
| 07:58 | poutsi | Anderkent: possible, but I highly doubt it |
| 07:58 | Anderkent | repsac: you could also use agents and (shutdown-agents-now) to kill it :P |
| 07:59 | Anderkent | hm actually that doesnt make it easier |
| 07:59 | jkkramer | repsac: https://github.com/jkk/rate-gate |
| 07:59 | Anderkent | you still need to block in some thread while waiting to enqueue new job |
| 07:59 | llasram | Anderkent, poutsi: I'm seeing the same behavior. The SimpleDateFormat `Z` format accounts for DST, but for some reason String/format `tz` doesn't |
| 07:59 | jkkramer | there's a PR to use core.async i haven't merged yet |
| 07:59 | llasram | crazy |
| 08:00 | repsac | jkkramer: ooh nice |
| 08:00 | poutsi | llasram: let's just put it down to java datetime API madness and sweep it under the rug then :D |
| 08:00 | repsac | i'm guessing you wrote it? |
| 08:00 | Anderkent | llasram: poutsi: works for me: "2013-08-30T12:36:32.838BST" "2013-08-30T12:36:35.573+0100" |
| 08:00 | Anderkent | BST is in fact +1 |
| 08:00 | jkkramer | repsac: yes. no guarantees on its robustness or efficency :P |
| 08:00 | poutsi | Anderkent: do you observe DST? |
| 08:01 | Anderkent | poutsi: BST is summer time, GMT otherwise |
| 08:01 | llasram | Anderkent: For me I get actually *incorrect* tagged literals back out. With the SimpleDateFormat, the correct: "2013-08-30T07:36:20.371-0400", but Clojure print-method: #inst "2013-08-30T07:36:35.122-05:00" |
| 08:01 | poutsi | okay |
| 08:01 | repsac | jkkramer: hehe you need to work on your salesmanship :P I'll have a look at it though :) |
| 08:01 | llasram | So "same" time, but without the DST applied in print-method |
| 08:02 | llasram | And hence an hour off |
| 08:02 | Anderkent | wow that's weird |
| 08:02 | Anderkent | what about (format "%1$tFT%1$tT.%1$tL%1$tz" (Calendar/getInstance)) |
| 08:02 | Anderkent | that should be the same as print-method hopefully? |
| 08:02 | Anderkent | ,(format "%1$tFT%1$tT.%1$tL%1$tz" (Calendar/getInstance)) |
| 08:02 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: Calendar, compiling:(NO_SOURCE_PATH:0:0)> |
| 08:02 | poutsi | if I change that to %1$tZ I get the correct EEST :D |
| 08:02 | Anderkent | ,(format "%1$tFT%1$tT.%1$tL%1$tz" (java.util.Calendar/getInstance)) |
| 08:02 | clojurebot | "2013-08-30T11:39:21.334+0000" |
| 08:02 | poutsi | but with %1$tz it prints the incorrect +0200 offset |
| 08:02 | Anderkent | well that's no fun |
| 08:02 | llasram | Anderkent: Exactly, and hence wrong :-) |
| 08:02 | Anderkent | it's on gmt |
| 08:05 | jkkramer | ha: http://bugs.sun.com/view_bug.do?bug_id=6286592 |
| 08:05 | Anderkent | llasram: poutsi: how about ,(doseq [field [Calendar/ZONE_OFFSET Calendar/DST_OFFSET]] (.get (Calendar/getInstance) field) |
| 08:05 | llasram | jkkramer: Just found that too :-) |
| 08:05 | Anderkent | hrtabf |
| 08:05 | Anderkent | ah |
| 08:05 | Anderkent | you're on java 6? |
| 08:06 | llasram | Yes, which is a supported Clojure platform :-p |
| 08:06 | Anderkent | how silly! |
| 08:06 | Anderkent | really? It's not even supported by oracle anymore, is it. |
| 08:07 | poutsi | Anderkent: nil |
| 08:08 | Anderkent | yes, that's where hrtabf was from. I forgot to print them :D |
| 08:08 | Anderkent | but since you've found it already I figured you won't be running it |
| 08:08 | llasram | Anderkent: Yeah, yeah... Unfortunately my company is still on Debian squeeze for production, which doesn't have an openjdk 7 package. I need to get us to wheezy first |
| 08:08 | poutsi | ah |
| 08:09 | wazaaaaaaa | سمَـَّوُوُحخ ̷̴̐خ ̷̴̐خ ̷̴̐خ امارتيخ ̷̴̐خ |
| 08:09 | Anderkent | llasram: hm, you run raw debians rather than ubuntu lts? |
| 08:10 | llasram | Anderkent: I've thought about switching, but yah |
| 08:11 | Anderkent | hah, is that the turkish string that crashes osx apps? |
| 08:11 | Anderkent | yeah it is |
| 08:11 | Anderkent | nice. |
| 08:23 | clgv | llasram: manual openjdk instance is not that complicated... |
| 08:23 | clgv | s/instance/installation/ |
| 08:25 | llasram | clgv: I looked at backporting the packages, but a lot of dependencies had changed. I'd like to update, but because I'll also need to e.g. make sure our Hadoop cluster is stable under 7 too, I'm not personally in a huge rush |
| 08:25 | clgv | llasram: ah ok |
| 08:48 | hhenkel | Hi again, as I described yesterday I try to implement a producer/consumer application. My current plan is to have a config file (I found edn) where I describe the tasks that need to be executed. After reading the config file, I would like to create a Priority Queue which contains the tasks that need to be executed. A pool of threads should then take tasks of the queue and start them as soon as it is time to do so. |
| 08:48 | hhenkel | Currently I'm failing on such a simple task like looping over my config: http://paste2.org/vxUzyXVp |
| 08:49 | hhenkel | Anyone around who can give me some hints if that would be the correct way to do things? |
| 08:52 | Anderkent | hhenkel: you seem to have double () around println val? Other than that (and using one-armed if instead of when), looks ok |
| 08:52 | Anderkent | what is going wrong? |
| 08:54 | mdrogalis | Anderkent: 'armed'. Haven't heard that word used like that before. Neat. |
| 08:55 | yogthos | (defn init-queue [config] |
| 08:55 | yogthos | (doseq [[k v] config] |
| 08:55 | yogthos | (println k v) |
| 08:55 | yogthos | (if (map? v) |
| 08:55 | yogthos | (init-queue v)))) |
| 08:55 | yogthos | (init-queue config) |
| 08:55 | yogthos | is probably what you want? |
| 08:56 | hhenkel | Anderkent: I'm getting a null pointer on the second iteration. |
| 08:57 | hhenkel | Is edn and the way I use it a good idea or should I stick to properties? |
| 08:57 | Anderkent | hhenkel: did you fix the double paren? ((println :x)) will give you a null pointer |
| 08:57 | Anderkent | edn is fine for config |
| 08:57 | hhenkel | yogthos: I'll check that. |
| 08:58 | yogthos | it's not tail recursive, but presumably it shouldn't matter for config ;) |
| 08:59 | Anderkent | yogthos: clojure doesnt do tail recursion anyway |
| 08:59 | Anderkent | or rather, only explicit one (with recur) |
| 08:59 | yogthos | right and here you can't recur |
| 08:59 | hhenkel | Anderkent: You're right, the double brackets we're causing the issue. Could you explain why that resulted in a null pointer? |
| 08:59 | Anderkent | hhenkel: (println foo) returns nil. (nil) tries to call null as a function, which throws NPE |
| 09:00 | hhenkel | Anderkent: Ah, okay... ;) |
| 09:02 | hhenkel | Okay, yogthos stuff works fine so far. Now the question is how to add a new task to a queue? First I would have to create multiple tasks as a host could have multiple actions. In my past I used a object for that...how would I do it in clojure? |
| 09:04 | yogthos | it sounds like agents might be what you're looking for? http://clojure.org/agents |
| 09:04 | Anderkent | hhenkel: depends on what your queue is. If it's a ref, then you do (dosync (alter queue conj new-item)) |
| 09:04 | hhenkel | Is it correct to have a function that gives me a "task" map and that is added to a sorted map where I'm sorting by the "time" tag (start time) ? |
| 09:05 | clgv | do I have to tell datomic the type (entity) of a :db.type/ref attribute to be able to insert a complete data tree ? |
| 09:05 | hhenkel | yogthos: I asked for that yesterday and I was pointed to futures...but I realiesed I asked to early for that. |
| 09:05 | Anderkent | hhenkel: that soudns reasonable, but you probably want a sorted-set-by not sorted-map? |
| 09:06 | hhenkel | Anderkent: Yes, I meant that, sorry. That would would do the job as a "priority queue"? |
| 09:07 | yogthos | there's a few options |
| 09:08 | hhenkel | What I currently not getting is, how to work with immutable stuff. I got a map and I want to add or remove something. Do I have to assign the result of the adding / removing function to the old name/ref? |
| 09:08 | clgv | is it possible in datomic to add a tree of entities? |
| 09:09 | Anderkent | hhenkel: you use `alter` in a (dosync) block to do that, when you have to - clojure.org/refs |
| 09:09 | Anderkent | that will safely change the value in a ref, as long as the modifying function you give it has no side effects |
| 09:09 | Anderkent | usually a couple refs/atoms storing the state is all the mutability you will need |
| 09:13 | clgv | hhenkel: are you sure that you want to implement a priority queue based on clojure's primitive instead of using java.util.concurrent.PriorityQueue? |
| 09:14 | Anderkent | clgv: my impression was this is a toy project to familiarize oneself with clojure... In which case using j.u.c defeats the purpose :P |
| 09:14 | Anderkent | also, I wish there was a wrapper for j.u.c with nicer api |
| 09:15 | clgv | Anderkent: in that case yes. but for getting the job done j.u.c.PQ schould be used... |
| 09:15 | Anderkent | people keep saying that, but it's *really rare* that you need just a queue. j.u.c. is nice in java wolrd because everything is already mutable, so you just put a mutable queue in your state object and everything's fine |
| 09:16 | Anderkent | but if you want to use clojures primities anywhere, you can't put a mutable object in your state |
| 09:16 | hhenkel | Anderkent: Sorry for asking so basic stuff.... I do (def mymap {:text1 "123" :text2 "456"}), now I got mymap. mymap is a ref? How would I increment the values for example? |
| 09:17 | Anderkent | hhenkel: no, it's not a ref. It's a var. You create a ref with (def myref (ref {})). Then you can (dosync (alter my-ref into {:a 1})) to put stuff in, and @my-ref to get the 'current snapshot' out |
| 09:17 | Anderkent | all your modifications must happen in dosync blocks. Have you read www.clojure.org/refs ? |
| 09:18 | Anderkent | actually |
| 09:18 | Anderkent | start with http://clojure.org/concurrent_programming |
| 09:18 | Anderkent | it's better as an overview |
| 09:18 | `cbp | maybe you should get a book or tutorial first. Mutability and coordination are not things you just learn as you go :P. Clojure programming has a nice section on it |
| 09:19 | hhenkel | Anderkent: Yes I tried...but I find it quite confusing...so for sorting then I would also use the ref then? |
| 09:20 | Anderkent | hhenkel: no, you would put a sorted map into a ref |
| 09:20 | Anderkent | you can put anyhting in a ref, it's just a 'box' that makes things mutable |
| 09:20 | Anderkent | was the first or second link the confusing one? |
| 09:21 | clgv | hhenkel: condensed example ##(let [q (ref [])] (dotimes [i 10] (future (dosync (alter q conj i)))) @q) |
| 09:21 | lazybot | java.lang.SecurityException: You tripped the alarm! future-call is bad! |
| 09:21 | hhenkel | `cbp: I got a book...programming clojure - second edition. |
| 09:21 | Anderkent | nyahaha. |
| 09:21 | hhenkel | Anderkent: the one with refs |
| 09:21 | clgv | no threads? :( |
| 09:21 | Anderkent | hhenkel: try the http://clojure.org/concurrent_programming |
| 09:21 | Anderkent | it's a higher level overview |
| 09:22 | `cbp | hhenkel: that book has a section called State |
| 09:22 | Anderkent | clgv: also, your thing doesnt really demonstrate stuff, I'd expect q to be anyhwere between empty and all elems at @q |
| 09:22 | `cbp | prolly read that first, also notice it's the 5th section so you need a bit of background first :P |
| 09:22 | Anderkent | I found http://java.ociweb.com/mark/clojure/article.html useful when starting |
| 09:23 | Anderkent | but I didn't really read any book fully, just started hacking |
| 09:23 | Anderkent | and reading through clojure code |
| 09:23 | clgv | Anderkent: it demonstrates functionality. didnt say that `q` has to be filled completely... ;) |
| 09:23 | Anderkent | but I had a basic haskell background |
| 09:23 | clgv | it managed to get to 7 here ;) |
| 09:23 | Anderkent | clgv: not very useful when it prints []! |
| 09:23 | Anderkent | [1] for me :D |
| 09:23 | `cbp | basic haskell -> phd level stuff |
| 09:24 | Anderkent | haskell was the first real language I learned :P |
| 09:24 | hhenkel | Anderkent: I'll start more reading then... ;) |
| 09:24 | `cbp | I have no clue how people can read their own programs after writing them in haskell =P |
| 09:24 | hhenkel | Thanks all for the informations. |
| 09:25 | Anderkent | hhenkel: in general I'd avoid mutable state for the first couple days. You can probably write everything except the state manager in a style like this |
| 09:25 | Anderkent | (defn schedule-task [queue new-task] (...)) |
| 09:25 | clgv | hhenkel: another reading hint http://clojure-doc.org/articles/language/concurrency_and_parallelism.html |
| 09:25 | Anderkent | basically pass your state around and write the code that takes a state and returns a modified one |
| 09:26 | Anderkent | it gets a little tedious if your program grows, but for simple stuff it should be fine :P |
| 09:26 | clgv | `cbp: then consider the perl programs without strict mode ;) |
| 09:26 | noncom | hhenkel: first of all - why you want a ref? you simply want to mutate the map? |
| 09:27 | Anderkent | `cbp: it wasnt industrial haskell, it was simple haskell |
| 09:27 | Anderkent | no custom monads etc :P |
| 09:27 | clgv | noncom: if he wants to build a queue with clojure data structure used by different threads he needs either an atom or a ref |
| 09:27 | Anderkent | ref |
| 09:27 | Anderkent | atoms dont do it |
| 09:27 | Anderkent | without incredible ugliness :P |
| 09:28 | clgv | Anderkent: you meant my comment? |
| 09:28 | Anderkent | yes |
| 09:28 | Anderkent | you'd need to wrap the queue with something that stores 'last popped element' |
| 09:28 | noncom | clgv: oh right |
| 09:28 | clgv | ah right the retrieval of an element is not easy with atoms. |
| 09:29 | clgv | I mean combined modification and retrieval |
| 09:29 | Anderkent | or you'd need to do compare-and-set! manually in a loop |
| 09:29 | Anderkent | both options are terrible |
| 09:29 | clgv | Anderkent: easier with thread-local bindings then ;) |
| 09:29 | Anderkent | hm? how so? |
| 09:30 | Anderkent | a (swap!) that side effect on a thread-local? |
| 09:31 | Anderkent | ... that might work lol |
| 09:31 | clgv | yes it does. but that's not very idiomatic either |
| 09:40 | stuartsierra | TimMc: Getting back to DJSON-9 for a moment, I think I'm going to name the option :escape-js-separators |
| 09:43 | stuartsierra | Then I'll release a new version. |
| 09:45 | TimMc | stuartsierra: From :escape-separators? |
| 09:45 | TimMc | Sounds good. |
| 09:45 | stuartsierra | TimMc: yes |
| 09:45 | TimMc | /shipit |
| 09:47 | Anderkent | ooh |
| 09:47 | Anderkent | the macroexpansion in core.async |
| 09:47 | Anderkent | i want that pulled out to a separate lib |
| 09:49 | Anderkent | also, damn, that thing is hard to read |
| 09:50 | clgv | Anderkent: link? |
| 09:50 | Anderkent | well, basically this bit: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/ioc_macros.clj#L573 |
| 09:51 | Anderkent | except generalized so that you can intercept and stop expansion arbitrary forms |
| 09:54 | clgv | hehe |
| 09:56 | stuartsierra | data.json 0.2.3 is cooked |
| 10:06 | hhenkel | clgv: Thanks, I will look at that as well. |
| 10:07 | hhenkel | noncom: It was recommended if I want to use a sorted-by-map from multiple threads. |
| 10:11 | stuartsierra | Also closing DJSON-12 as either mistaken or unreproducible. |
| 10:25 | rigger | sheesh |
| 10:32 | shaunxcode | haha the swannodette gazette! I wish that were an actual printed periodical. I would totally pay for it. |
| 10:50 | noncom | hhenkel: yeah, sorry i overlooked that |
| 11:15 | mdrogalis | Anyone alive that's watched Design, Composition and Performance? I've a question. |
| 11:16 | `cbp | ~anyone |
| 11:16 | clojurebot | anyone is anybody |
| 11:16 | `cbp | :/ |
| 11:16 | `cbp | just ask the question? :P |
| 11:16 | hyPiRion | ~anyone |
| 11:16 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 11:17 | `cbp | =( |
| 11:17 | Anderkent | ~everyone |
| 11:17 | clojurebot | Gabh mo leithscéal? |
| 11:17 | futile | wat |
| 11:17 | mdrogalis | 37:42 of that video. What on earth is he talking about? |
| 11:19 | futile | simplicity is underappreciated |
| 11:19 | futile | (unrelated) |
| 11:20 | hyPiRion | clojurebot: forget anyone |is|<reply>anyone is anybody |
| 11:20 | clojurebot | I forgot that anyone is <reply>anyone is anybody |
| 11:22 | ToxicFrog | Design/best practices question. I am writing a program that can read and write data to/from various formats/sources. So the user might invoke it with --to=edn or --from=steam or the like. |
| 11:22 | futile | clojurebot should be rewritten in Rust |
| 11:23 | futile | you know, for concurrency |
| 11:23 | hyPiRion | futile: no, it should be rewritten in Node.js because it's async |
| 11:23 | futile | hyPiRion: Rust is the successor to Node.js tho |
| 11:23 | ToxicFrog | In lua, I'd just have, e.g., a data/ directory containing steam.lua, edn.lua, xml.lua, etc; when it sees --from or --to, it loads the file with the corresponding name. If it can't, it reports an error; if it can, the file returns a table of read/write functions. |
| 11:24 | ToxicFrog | In clojure, am I right in thinking that this sort of load-by-name is considered unheamy? |
| 11:24 | hyPiRion | futile: I am joking there. I'm writing a bot in Erlang, actually. I think it's a better fit for this sort of task. |
| 11:24 | futile | ToxicFrog: you can still do that in a Clojure project |
| 11:24 | edannenbe | how do i iterate over large (20^75 entries) seq? nth seems to be out of the question |
| 11:24 | futile | hyPiRion: elixir? |
| 11:24 | Anderkent | but you can just load all of them and dispatch to the right function based on the arg.. |
| 11:24 | ToxicFrog | futile: I know I can, I'm asking if that's considered a good way to do this |
| 11:24 | futile | ToxicFrog: oh, sorry |
| 11:24 | hyPiRion | futile: Erlang, I want to finally "get everything" it has. |
| 11:24 | Anderkent | I'd say don't unless you have a very good reason (for example they're very expensive to load or sth) |
| 11:24 | ToxicFrog | As opposed to, e.g., :requiring all of them and then having a map { format name => RW functions }\ |
| 11:24 | futile | hyPiRion: even the syntax!? |
| 11:25 | ToxicFrog | Anderkent: no, loading is expected to be quite cheap |
| 11:25 | futile | ToxicFrog: oh yeah I would use an intermediate name->thing map |
| 11:25 | `cbp | edannenbe: what do you mean 20^75 are you iterating through every atom in space or something? |
| 11:25 | coventry | edannenbe: unless you can come up with a non-inductive definition of the seq elements (a function), random access to the elements of a seq that long seems physically impossible. |
| 11:25 | ToxicFrog | So the only reason to avoid doing so is to avoid having to manually write out the whole map and the lengthy list of :requires |
| 11:25 | ToxicFrog | Unless clj has some way to say "load everything in this dir" |
| 11:26 | futile | ToxicFrog: it sounds like this is a question of whether convention-over-configuration is idiomatic in Clojure, and I would definitely say no |
| 11:26 | ToxicFrog | convention-over-configuration? |
| 11:26 | futile | ToxicFrog: oh boy |
| 11:26 | futile | ToxicFrog: ever used Rails? |
| 11:26 | ToxicFrog | But yes, this is mostly a conventions/best practices/idioms question. I know a bunch of ways to write this, but I want the code to be good, not just functional. |
| 11:26 | Anderkent | futile: the question is more like 'how is that relevant to what we're talking about' |
| 11:26 | ToxicFrog | I have not. |
| 11:27 | futile | Anderkent: whaa? |
| 11:27 | ToxicFrog | Anderkent: no, I genuinely have no idea what he means by that. I may know the concept under another name but I've never heard that phrase. |
| 11:27 | Anderkent | I don't see how 'convention over configuration' applies at all to the question of whether to dynamically load namespaces |
| 11:27 | hyPiRion | futile: The syntax is not that bad, imo. But I'm the guy who studies "Unconventional Machines: Design and Architecture", so I may not be the best to ask about syntax |
| 11:27 | `cbp | mdrogalis: I think he's referring to the new tendency of trying to make software development as easy and fast as possible. |
| 11:27 | Anderkent | ToxicFrog: it's just the approach of not letting people configure stuff, instead enforcing conventional locations for files etc. |
| 11:28 | TimMc | E.g. Maven. |
| 11:28 | Anderkent | youwahtnow |
| 11:28 | futile | Anderkent: I might have misunderstood. I thought his question was if it's bad practice to load up a file based on a string given from the cmdline. |
| 11:28 | TimMc | I guess Maven does allow that, but you really need to shovel on the XML. |
| 11:28 | Anderkent | but everyone loves xml |
| 11:28 | `cbp | ~guards |
| 11:28 | clojurebot | SEIZE HIM! |
| 11:28 | ToxicFrog | futile: that is basically what I was asking, yes. |
| 11:29 | Anderkent | it's like lisp! Except instead of parens you have <configuration><property name="foo!"> ... |
| 11:29 | futile | ToxicFrog: I've always found it much harder to work with code that does that kind of thing. |
| 11:29 | Anderkent | D: |
| 11:29 | futile | ToxicFrog: In 99.99% of cases like this, I always end up creating some kind of intermediary mapping. |
| 11:30 | ToxicFrog | And I'm mostly coming from Lua, where this is a common idiom (and makes it very easy to extend later - just create the file or, at runtime, add another entry to the module preload table) |
| 11:30 | edannenbe | coventry, it's a lazy seq generated by clojure.math.combinatorics , i would only need sequential access tho (ie from start to finish once) |
| 11:30 | futile | ToxicFrog: A colleague did something similar, passing data from ClojureScript to Clojure and letting the coincidence of similar data names be the thing that ties it in to actual code, and said it was 'elegant', and I couldn't disagree more. |
| 11:31 | futile | ToxicFrog: yeah "easy to work with" is the commonly cited benefit, but in practice I've found it actually makes it more inflexible to change and more likely to introduce subtle hard-to-track-down bugs |
| 11:32 | ToxicFrog | futile: OTOH, I find it extremely inelegant to have a big map of { "foo" data.foo/io "bar" data.bar/io } that you need to update every time you want to add support for a new data source. |
| 11:33 | futile | ToxicFrog: That's the solution I went with in my window manager. Before this decoupling it was extremely hard to change anything about the names or implementation, without breaking backwards compatibility for users. Afterwards, I'm now free to refactor the internals however I want. I think that's always the case no matter how big the map is. |
| 11:33 | Anderkent | ToxicFrog: use a multimethod to get an object fullfilling a protocol |
| 11:33 | futile | ToxicFrog: In other words, I agree that it seems a bit cumbersome up front, but the decoupling it gives you will save you tons of headache in the future. |
| 11:34 | ToxicFrog | How was it a backwards compatibility issue? |
| 11:34 | Anderkent | then you can add methods to the multimethod in the namespace that declares the stream |
| 11:34 | ToxicFrog | Anderkent: I haven't done anything with multimethods or protocols |
| 11:34 | ToxicFrog | Got docs? |
| 11:34 | Anderkent | http://clojure.org/multimethods http://clojure.org/protocols |
| 11:35 | Anderkent | you might not need the protocols if your interface is simple |
| 11:36 | Anderkent | then the only messy bit is ensuring that the namespaces are loaded |
| 11:37 | futile | ToxicFrog: To use your example, if you want to rename those files, your users now have to type something else. |
| 11:37 | futile | ToxicFrog: Imagine if you renamed one of the files and several users already had some scripts written that call this thing with certain arguments. They all have to go in and change all the scripts to use the new arguments. |
| 11:37 | ToxicFrog | Anderkent: interface is extremely simple, two functions per data format, take/return a list of maps. |
| 11:38 | futile | ToxicFrog: In my example, they started out calling the things SDWindowProxy and later when I decoupled the interface from the implementation they had to rename it to Window (much better name). |
| 11:39 | ToxicFrog | Aah. |
| 11:39 | coventry | edannenbe: Have you considered using first and rest? |
| 11:39 | coventry | ,(let [s (range)] (loop [i 10 s s rv []] (if (> i 0) (recur (dec i) (rest s) (conj rv (first s))) rv))) |
| 11:39 | clojurebot | [0 1 2 3 4 ...] |
| 11:40 | futile | Sometimes I feel like the only one in this channel that doesn't use clojure.math and clojure.logic |
| 11:40 | `cbp | Ive never used core.logic either |
| 11:41 | hyPiRion | futile: you forgot typed clojure |
| 11:41 | coventry | mdrogalis: It sounds like he's saying "Wire shit together with a thought for the people who'll use it," which sounds pretty reasonable. |
| 11:41 | futile | and clojure.async |
| 11:42 | futile | you can't spell "clojure" without #{\c \o \r \e} |
| 11:42 | Anderkent | clearly we need a project that puts logic, typed and async together |
| 11:42 | ToxicFrog | Anderkent: can I put (defmethods) for the same multimethod in different files? |
| 11:42 | futile | ToxicFrog: yes |
| 11:42 | Anderkent | ToxicFrog: yes |
| 11:42 | futile | ToxicFrog: that's a major benefit of them |
| 11:42 | clgv | ToxicFrog: yes, but you need to load those namespaces ^^ |
| 11:42 | futile | ToxicFrog: implementations can be completely hidden from the user if need be |
| 11:42 | Anderkent | but watch out for cyclic dependencies |
| 11:43 | futile | clgv: that bit is several times already. |
| 11:43 | futile | *us |
| 11:44 | clgv | futile: couldnt you use the default implemention to throw or log an error so that you notice you forgot to load some implementation? |
| 11:44 | ToxicFrog | Awesome. |
| 11:44 | futile | clgv: the trick I was told about for working around that is to make sure that any function which can produce multi-method-capable data comes from the same function which requires it |
| 11:44 | futile | *the same file |
| 11:44 | clgv | that's a good rule ^^ |
| 11:45 | futile | I haven't had a chance to put it into practice yet. |
| 11:45 | futile | But I like the idea. |
| 11:46 | edannenbe | coventry, still very green with clojure so no, gonna give it a try. thanks |
| 11:46 | Anderkent | ToxicFrog: https://www.refheap.com/18173 is a structure that works for me |
| 11:47 | coventry | No worries. Still green myself. There is probably a niftier way. |
| 11:49 | futile | If I'm ever on a team one day, I think a good idea would be to have the first line of a git commit msg be what it is, and the rest of the lines explain why. |
| 11:49 | ToxicFrog | Anderkent: excellent. Thanks. |
| 11:49 | futile | That would probably help for searching repos for specific changes, as well as understanding the rationale behind new/very-old ones. |
| 11:50 | Anderkent | futile: nah, best commits are the ones that go 'WIP' or 'almost done' or 'fuck.' |
| 11:50 | coventry | "Wrote a little code." |
| 11:50 | Anderkent | :D |
| 11:51 | Anderkent | 'maybe now?; |
| 11:51 | hyPiRion | Oh, I got a good commit from lein I think, let me hit it up |
| 11:51 | edannenbe | http://whatthecommit.com/ |
| 11:52 | hyPiRion | https://github.com/technomancy/leiningen/commit/ab080ec |
| 11:52 | llasram | hyPiRion: That is a pretty awesome commit |
| 11:53 | clgv | hyPiRion: harr! |
| 11:53 | futile | Anderkent: hey you've been reading my commits haven't you? https://github.com/sdegutis/zephyros/commits/master?page=11 |
| 11:53 | Anderkent | woo |
| 11:53 | Anderkent | i like |
| 11:53 | asteve | java.lang.NoSuchMethodError: clojure.lang.RT.mapUniqueKeys([Ljava/lang/Object;)Lclojure/lang/IPersistentMap; |
| 11:53 | Anderkent | My favourite one from the project I worked on |
| 11:53 | Anderkent | hm let me pull it up |
| 11:54 | llasram | futile: Remind me never to work with you professionally :-) |
| 11:54 | Anderkent | And where format-clojure went, rest vanished,for the small hours were rent with the screams of nightmare. |
| 11:54 | futile | llasram: to be fair, it looks more like this now: https://github.com/sdegutis/zephyros/commits/master?page=2 |
| 11:54 | asteve | https://groups.google.com/forum/#!msg/clojure-mongodb/1llpYuBgVA4/zbsI5xQiMnUJ says that my error is caused by trying to run code compiled on 1.4 or higher while running 1.3 |
| 11:54 | futile | :D |
| 11:54 | Anderkent | and the other: I am the emacs your whitespace god. You shall have no other formatters before me. |
| 11:54 | asteve | lein repl verifies that I'm running under 1.5.1: Clojure 1.5.1 |
| 11:55 | futile | Anderkent: ha! |
| 11:55 | asteve | I ran a lein clean and then lein compile; then the lein uberjar |
| 11:55 | asteve | how is it possible that I'm running 1.3? |
| 11:55 | Anderkent | asteve: do `lein deps :tree` |
| 11:55 | clgv | asteve: did you upgrade? do `lein clean` |
| 11:56 | asteve | clgv: I am in the midst of upgrading and I have run lein clean a few times |
| 11:56 | Anderkent | if you're pulling in an evil dependency it might be overriding the clojure version |
| 11:56 | asteve | Anderkent: so I should look for clojure in the tree? |
| 11:56 | clgv | asteve: maybe you have an aot compiled dependency |
| 11:56 | asteve | if I see 1.5.1 I'm safe? |
| 11:56 | clgv | for that project yes |
| 11:56 | Anderkent | I'm not sure how it marks up stuff being overriden |
| 11:56 | Anderkent | you can do |
| 11:56 | lnostdal | 137.35 |
| 11:57 | Anderkent | lein pom; mvn dependency:tree |
| 11:57 | hyPiRion | asteve: Lein should usually take the one you pick, if not you're working with a bad lib |
| 11:57 | Anderkent | to see which ones take precendence |
| 11:57 | asteve | https://gist.github.com/sannessa/375dc42f566cb2c81417 |
| 11:57 | Anderkent | hm, that should always give you 1.5.1 |
| 11:58 | Anderkent | how do you run your jar? |
| 11:58 | asteve | so, I'm attempting to upload the jar to a storm cluster |
| 11:58 | Anderkent | is it possible theres another clojure.jar on the classpath? |
| 11:58 | asteve | hmm |
| 11:59 | coventry | Maybe "DEBUG=true lein <args>", and look for an earlier clojure in the output? Lots of spew from that command, though. |
| 12:00 | Anderkent | asteve: I take it it only happens on the cluster and not locally |
| 12:00 | asteve | Anderkent: yes, I'm realizing that I may need to make changes to the cluster |
| 12:00 | Anderkent | if so I'd check stuff like CLASSPATH= or the -cp arg |
| 12:01 | Anderkent | you shouldnt have to. If it just runs java -jar your.uber.jar then you shuold be totally fine with something else using a different clojure |
| 12:01 | Anderkent | ah wait, it's not a remote machine, its like hadoop job processor |
| 12:01 | hyPiRion | asteve: interesting. Could you do [org.clojure/clojure "[1.5.1]"] and check if it changes anything? I would NOT recommend keeping it, just check what it does |
| 12:01 | Anderkent | I'd say just stop compiling your stuff :D |
| 12:02 | hyPiRion | also, add in `:pedantic? :abort` if you want to ensure the dependencies you specify is not overridden by the other dependencies |
| 12:02 | asteve | hyPiRion: it didn't change the tree output |
| 12:02 | Anderkent | hyPiRion: I'm pretty sure they're not being overriden, it's just an issue of the remote jvm running with a different clojure version |
| 12:03 | futile | Is it just me or does anyone else do a whole lot of talking to themselves in their own github issues? |
| 12:03 | Anderkent | i.e. he gets both the uberjarred 1.5.1 clojure and the already loaded 1.3 |
| 12:03 | hyPiRion | Anderkent: whacky |
| 12:03 | hyPiRion | futile: I do it all the time, and check out the Grenchman for same behaviour in our tooling God. |
| 12:04 | hyPiRion | It's super neat as a "todo" list |
| 12:04 | futile | lol 'Sorry about the name' |
| 12:04 | Anderkent | futile: I usually try to stop after 3 comments - https://github.com/marick/Midje/pull/237 https://github.com/lshift/cloverage/issues/21 |
| 12:04 | futile | Anderkent: you're JacekLach? |
| 12:04 | Anderkent | yup |
| 12:07 | asteve | ya, my problem is the remote is currently running nimbus and storm with clojure 1.2 and a very old version of storm |
| 12:07 | asteve | I'm not sure why I didn't think of this earleir :) |
| 12:07 | Anderkent | glad to be of use :) |
| 12:09 | mdrogalis | `cbp & coventry: That makes sense. :) Thanks guys. |
| 12:12 | asteve | Anderkent]away: thanks |
| 12:14 | sandbags | anyone know how quickly you get approved to post to the clojurescript group? |
| 12:15 | mdrogalis | Hold dnolen hostage |
| 12:15 | bbloom | sandbags: posts get approved very quickly & i believe you get real posting privledges after a few approved posts automatically |
| 12:16 | sandbags | bbloom: very quickly < 1d ish ? |
| 12:16 | sandbags | mdrogalis: heh ... i guess that'd be my plan B |
| 12:17 | sandbags | i'm kind of stuck so hoping my post would go through reasonably quick |
| 12:17 | bbloom | sandbags: there are a few volunteers, myself included. i get emails about posts to be approved & usually get around to them within 1 day, but almost every time, somebody else has already gotten to it |
| 12:17 | sandbags | bbloom: okay, thanks |
| 12:17 | sandbags | i appreciate nobodies paid to do it, just wanted to set my expectations appropriately |
| 12:17 | seangrov` | sandbags: Hasn't your post already gone through? |
| 12:17 | sandbags | seangrov`: i couldn't see it just now |
| 12:18 | bbloom | sandbags: there might be one guy who is much faster than the rest of us and if he goes on vacation or something then the rest of us might assume this anonymous person who beats us to the punch will take care of it :-) |
| 12:18 | bbloom | sandbags: i just published it for you :-P |
| 12:18 | sandbags | bbloom: oh well, there's service for you! thank you :) |
| 12:19 | sandbags | is it a function of inexperience that Clojure stack traces often seem like gibberish to me (in a way that I don't remember, e.g., Ruby stack traces seeming)? |
| 12:20 | bbloom | cemerick: rock on with the touch carrying! |
| 12:20 | bbloom | torch* rather |
| 12:20 | bbloom | cemerick: glad to see cljsbuild springing back to life |
| 12:20 | cemerick | I thought that was some kind of hipster football reference for a second. :-P |
| 12:21 | cemerick | bbloom: just housekeeping, for a little while. Getting the idle CPU util down is great to have, tho. |
| 12:21 | cemerick | I'll be putting an 0.3.3-SNAPSHOT out there for people to try, once I have clojars privs from Evan |
| 12:21 | nDuff | sandbags: they're messier than most, but with experience, they're manageable. |
| 12:21 | sandbags | cemerick: is cljsbuild using the FSEvents API on OSX? |
| 12:22 | nDuff | sandbags: ...there are also tools available to filter them down to something more useful. |
| 12:22 | sandbags | if not that's potentially something i could help with |
| 12:22 | cemerick | sandbags: that's for watching files? |
| 12:22 | sandbags | cemerick: yep |
| 12:22 | sandbags | it's as near zero-cpu as you're going to get on OSX |
| 12:22 | bbloom | sandbags: yeah, bad stack traces are a problem… but even if the stack traces were less ugly, they wouldn't be super useful considering laziness, loop/recur, etc. you're better off with tracing/logging anyway |
| 12:22 | nDuff | sandbags: ...see for instance https://github.com/mmcgrana/clj-stacktrace |
| 12:23 | sandbags | nDuff: thanks |
| 12:25 | edannenbe | coventry, do-seq seems to be the simple solution to my earlier problem |
| 12:25 | clgv | is there a best practices tutorial for datomic? for example when should you use different partitions for entities? |
| 12:25 | cemerick | sandbags: definitely a TODO, though cljsbuild will use the JDK facilities when available. Adding support for platform-specific stuff doesn't make a lot of sense IMO. https://github.com/emezeske/lein-cljsbuild/issues/229 is the relevant issue if you want to dig in. |
| 12:26 | cemerick | sandbags: Note that if the impact to the existing codebase is significant (defined by "gives cemerick the willies w.r.t. breakage" :-P), then it'll end up being a 2.x feature. |
| 12:27 | cemerick | As it stands, the fix I just put in for gh-219 is a significant improvement w.r.t. cljsbuild auto CPU utilization. I'm actually unconvinced by the need for inotify-style watching given the perf I'm seeing of the existing approach. |
| 12:29 | sandbags | cemerick: i'll go out on a limb and assume the Oracle guys are smart enough to base this WatchService on FSEvents when the JVM is on OSX |
| 12:30 | mercwithamouth | does anyone have fireplace working in vim? |
| 12:30 | sandbags | "The implementation that observes events from the file system is intended to map directly on to the native file event notification facility where available" seems promising |
| 12:30 | cemerick | sandbags: oh, probably. I just meant that I'd only want to see a WatchService-based impl, rather than 3 impls based on some non-JDK native lib approach. |
| 12:31 | sandbags | i only brought it up because polling is such a horrible solution most of the time |
| 12:31 | sandbags | esp if you ever work on any decent sized projects |
| 12:31 | sandbags | i implemented this for a ruby tool a while back although i suspect C modules are easier to integrate with Ruby than Clojure ... |
| 12:31 | cemerick | sandbags: well, make sure to give 0.3.3-SNAPSHOT a try, I just optimized the current polling approach significantly. |
| 12:32 | cemerick | Cut my `cljsbuild auto` CPU util from 40% to < 1%. |
| 12:32 | jlongster | dnolen: I'm still having some trouble extending your core.async example. Here's a concrete case: make the (task (.-readFile fs) ...) form take another task as an argument. I'd like for the errors from that task to be propagated up to the supervisor |
| 12:32 | cemerick | mercwithamouth: yes, though I'm not using it at the moment. |
| 12:32 | ambrosebs | mercwithamouth: ya |
| 12:33 | sandbags | cemerick: hrmm not sure what i'm on at the moment but the CPU hit seems relatively negligible |
| 12:33 | mercwithamouth | darn...i couldn't get it to work for me 2 weeks ago. |
| 12:33 | mercwithamouth | well...it's working for you all...i'll tinker with it again tonight. do you guys just go emacs? |
| 12:33 | mercwithamouth | or light table(really cool...) |
| 12:33 | sandbags | that said, my project is pretty teeny-tiny |
| 12:33 | cemerick | sandbags: if that's the case, then why bother with inotify? |
| 12:33 | dnolen | jlongster: sorry I wasn't suggesting using supervisor pattern, just do error propagation |
| 12:34 | sandbags | cemerick: matter of principle, not all projects are going to be tiny, and why use CPU you don't need to? |
| 12:34 | cemerick | mercwithamouth: Nope, been using vim for some months, though I'm using my own fork of fireplace at this point. |
| 12:35 | cemerick | sandbags: Meh. What's there, works. If someone can point at a big project that doesn't play nice with auto, then it'll be worthwhile. |
| 12:35 | mercwithamouth | cemerick: hmm fair enough. i could just open a terminal below and open repl up that way |
| 12:35 | sandbags | cemerick: since i spend a lot of time on battery these days CPU has suddenly become very important again :) on my Mac Pro at home I waste it with abandon! |
| 12:36 | sandbags | cemerick: btw it wasn't meant to be a criticism, i just saw a possible place i might contribute something ... which in the Clojure world is a rarity |
| 12:36 | jlongster | dnolen: since youre sending errors on the same channel as values, I still can't see how you'd propagate, but I'm prob just missing it. an example of the task as an argument would be great (no rush) |
| 12:37 | cemerick | sandbags: Of course, didn't take it as criticism. :-) Was just being clear about why my criteria might be for accepting a patch. I'm happy for all the help I can get! |
| 12:37 | sandbags | cemerick: roger that! |
| 12:37 | dnolen | jlongster: make something wires the tasks together via channels, (pipeline foo task1 task2 task3), this effectively how promises work |
| 12:37 | cemerick | s/why/what |
| 12:37 | jlongster | dnolen: sidenote, once we figure out the error handling pattern, I'm eager to port some of core.async's optimizations to js. can't wait! |
| 12:38 | dnolen | jlongster: pipeline should be able to do this though |
| 12:38 | jlongster | dnolen: oh yes yes, like `forward` in my example? https://gist.github.com/jlongster/6374643 that's basically the conclusion I came to |
| 12:38 | dnolen | (pipeline foo task1 (supervisor task2 ...) task3) |
| 12:38 | dnolen | jlongster: which way cooler than the promise patterns you see :) |
| 12:39 | jlongster | dnolen: omg, seriously. I'm really excited about it. |
| 12:39 | sandbags | btw guys i get about ~5000 warnings from cljsbuild relating to things having no effect as externs (externing jquery-1.10.2) |
| 12:39 | sandbags | should i be worried about those? |
| 12:39 | seangrov` | jlongster: You're crazy prolific, always hacking on something interesting |
| 12:40 | sandbags | here's a sample: https://gist.github.com/mmower/0b158420f02b0c5f7dd0 |
| 12:40 | jlongster | dnolen: it's nice to actually control the flow of things instead of doing a backwards-ass structure for promises |
| 12:40 | jlongster | seangrov`: hah, really? what makes you say that? |
| 12:40 | jlongster | I feel small in comparison to some of the guys here :) |
| 12:41 | seangrov` | This, your game programming, outlet, it was actually you that convinced me to do iOS dev with scheme (thoguh I used Chicken in the end instead of gambit), etc. etc. |
| 12:41 | jlongster | dnolen: wait, is pipeline an existing structure? that's something new right? |
| 12:41 | jlongster | it'd be nice of the core.async readme actually documented core.async |
| 12:41 | dnolen | jlongster: something new |
| 12:41 | dnolen | jlongster: that needs to be written |
| 12:42 | jlongster | seangrov`: oh nice! I just really enjoy to hacking on things. those things you mentioned have been over years time, so it's just here and there. glad to hear you're doing cool stuff! |
| 12:42 | dnolen | jlongster: would ben nice but core.async just provides a handful of primitives, just read cljs/core/async.cljs |
| 12:42 | jlongster | dnolen: ok, I'll attempt it but I'm sure I'll need your input |
| 12:42 | jlongster | (probably over the weekend, not during work today) |
| 12:43 | jlongster | at least sasy that in the README :) |
| 12:43 | jlongster | *say |
| 12:44 | jlongster | I say that as somewhat of an outsider to Clojure, of course |
| 12:44 | dnolen | jlongster: heh, it is alpha software after all, not sure if Rich is 100% API, though it sounds like that might be the case. |
| 12:44 | jlongster | true |
| 12:46 | sandbags | i found... well i can't say i found it more clear, but i had better questions, from reading the walkthrough.clj rather than the docs |
| 12:46 | sandbags | that reminds me, i have a question i wanted to post about one of the examples in the walkthrough |
| 12:50 | dnolen | jlongster: also even w/ the docs, it's not really enough to get your head around CSP style programming. The best resource is honestly reading Go code. |
| 12:50 | rasmusto | mercwithamouth: Are you using the latest fireplace (and leiningen)? |
| 12:51 | mercwithamouth | rasmusto: yup |
| 12:52 | rasmusto | mercwithamouth: I usually fire up a `lein repl :headless` in another terminal/screen, and then vim on a clj file, haven't had issues with connection |
| 12:52 | jlongster | dnolen: definitely, I just mean at least a list of available functions |
| 12:53 | rasmusto | mercwithamouth: what problem are you running into? (error message?) |
| 12:53 | jlongster | also is CSP really that mind bending? I find it the most natural/intuitive way to do async, much more than anything else (compared to FRP, promises, etc) |
| 12:53 | mercwithamouth | rasmusto: one sec |
| 12:53 | nDuff | Heh. |
| 12:54 | dnolen | jlongster: well I find it mostly natural, but thinking about potential deadlock requires a different frame of mind. |
| 12:55 | mercwithamouth | rasmusto: funny enough...it's working today -_-...before :Eval would give me a crazy message |
| 12:55 | jlongster | dnolen: good point |
| 12:55 | mercwithamouth | ahh i think my issue before was i didn't open a repl within the project |
| 12:55 | mercwithamouth | i'll admit i only played for 10 minutes and ran back to lighttable |
| 12:55 | rasmusto | mercwithamouth: ah, good to hear. Sometimes I will have to restart the repl or vim to get it out of some weird state |
| 12:56 | rasmusto | mercwithamouth: or do an explicit :Connect |
| 12:59 | `cbp | is there a way to have a map where i care about the order of the values and the values might repeat? |
| 13:00 | `cbp | Do I have to make sure the values are unique in the comparator or something? |
| 13:00 | mercwithamouth | rasmusto: yeah....it's definitely working now =P |
| 13:02 | `cbp | oh clojure-docs to the rescue |
| 13:03 | mercwithamouth | rasmusto: also it seems to be terminal vim only, not macvim, right? |
| 13:03 | sleetdrop | does ([5 10] 0) means get the first element? and why? |
| 13:03 | rasmusto | mercwithamouth: it should work if you use mvim with the right starting directory, (or do a :cd, and a :Connect) |
| 13:04 | rasmusto | ,([5 10] 0) |
| 13:04 | clojurebot | 5 |
| 13:04 | `cbp | sleetdrop: a vector is a function of its indexes |
| 13:04 | mercwithamouth | rasmusto: taking a look. |
| 13:05 | rasmusto | sleetdrop: a vector is a function on its "keys", which in this case are indices ^ |
| 13:05 | sleetdrop | thanks |
| 13:06 | rasmusto | sleetdrop: ,({:a 1 :b 2} :a) |
| 13:06 | rasmusto | ,({:a 1 :b 2} :a) |
| 13:06 | clojurebot | 1 |
| 13:06 | rasmusto | sleetdrop: the same is true of maps |
| 13:06 | sleetdrop | rasmusto:thanks |
| 13:07 | silasdavis | which is nicer: |
| 13:07 | silasdavis | (apply merge (map hash-map [[1 2] [3 4]] (repeatedly hash-map))) |
| 13:07 | silasdavis | or |
| 13:07 | silasdavis | (reduce #(into %1 {%2 {}}) {} [[1 2] [3 4]]) |
| 13:07 | silasdavis | ? |
| 13:07 | silasdavis | (/faster) |
| 13:07 | silasdavis | ,(reduce #(into %1 {%2 {}}) {} [[1 2] [3 4]]) |
| 13:07 | clojurebot | {[1 2] {}, [3 4] {}} |
| 13:07 | rasmusto | sleetdrop: you might see something like this: (:a {:a 1 :b 2}), this is just sugar for doing it the other way |
| 13:09 | hyPiRion | ,(reduce #(assoc %1 %2 {}) {} [[1 2] [3 4]]) |
| 13:09 | clojurebot | {[3 4] {}, [1 2] {}} |
| 13:10 | silasdavis | yes that is better |
| 13:11 | hyPiRion | oh lord, I am stupid |
| 13:11 | hyPiRion | ,(zipmap [[1 2] [3 4]] (repeatedly {})) |
| 13:11 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap> |
| 13:11 | hyPiRion | whap. |
| 13:11 | hyPiRion | ,(zipmap [[1 2] [3 4]] (repeat {})) |
| 13:11 | clojurebot | {[3 4] {}, [1 2] {}} |
| 13:12 | sleetdrop | rasmusto: I am new to lisp like language, to many things to remember. |
| 13:12 | noncom | are deftype and defrecord special in terms that they are not entirely written in clojure? |
| 13:12 | callen | sleetdrop: you'll eventually develop gills and breathe parens naturally, then you'll be pissed when you're not in the nice warm water. |
| 13:12 | callen | noncom: read the code. |
| 13:12 | `cbp | sleetdrop: the argument for clojure is that there are _less_ things to remember than other languages :P |
| 13:12 | callen | `cbp: it's just familiarity. |
| 13:12 | rasmusto | sleetdrop: http://clojure.org/cheatsheet will be very useful, bookmark it :) |
| 13:12 | ozzloy | i'm trying to bring my bluetooth back up without rebooting. i just woke from suspend and now bt is not coming up. i've tried rfkill unblock and service bluetooth restart to no avail. what do? what log can i check for clues? |
| 13:13 | ozzloy | ubuntu 12.04 |
| 13:13 | ozzloy | woops |
| 13:13 | ozzloy | wrong channel |
| 13:13 | hyPiRion | ozzloy: heh, wrong channel |
| 13:13 | rasmusto | ozzloy: have you tried (bluetooth) ? |
| 13:13 | `cbp | (get-in bluetooth [:logs]) |
| 13:14 | ozzloy | thanks y'all |
| 13:14 | sleetdrop | rasmusto:thanks |
| 13:29 | functionform | sleetdrop |
| 13:29 | functionform | "It get's better!" |
| 13:29 | functionform | gets |
| 13:30 | functionform | Before I used to think in loops, now i'm mapping/applying/reducing my way to one line glory. |
| 13:30 | functionform | took me maybe 2 months on off hours using 4clojure.com to get up to speed. seeing other answers is so informative. |
| 13:35 | clgv | ozzloy: I gave up on bluetooth under linux ;) |
| 13:45 | silmawien | is there a standard function for doing (if (coll? arg) arg [arg]) ? |
| 13:45 | coventry | With functions wrapping functions, it would be nice if you could get a parallel traceback of the source locations for the functions in the stack trace. Are there any tools which provide this information? Is it possible, in principle? |
| 13:46 | silmawien | i.e. convert non collection args to a 1-item collection |
| 13:49 | futile | seeing_is_believing seems like a really cool alternative to the nrepl.el workflow |
| 13:49 | futile | https://github.com/JoshCheek/seeing_is_believing |
| 13:50 | futile | (for Ruby though) |
| 13:50 | futile | I wonder, would this be so hard to do in Clojure? |
| 13:50 | callen | futile: it already exists, tools.trace |
| 13:50 | callen | just...use it. |
| 13:50 | futile | oh |
| 13:50 | futile | yeah but does it have its own lightning talk demo too? |
| 13:50 | futile | re: http://vimeo.com/72195902 |
| 13:51 | coventry | Didn't an early version of light table do this? (Don't know about later versions.) |
| 13:51 | bja | vim's slimv does this with <Leader>t |
| 13:51 | bja | presumably so does SLIME in emacs |
| 13:52 | callen | just tried to install a single and only package - cabal-dev, and it failed. |
| 13:54 | dnolen | silmawien: no such function exists, and in your case it seems like you want vector? not coll? |
| 13:57 | silmawien | dnolen: ok thanks, and yes that sounds right |
| 14:00 | `cbp | mm does lein upgrade work from 2.3.1 -> 2.3.2? It seems to just hang |
| 14:00 | tsantos | The clojure puzzler today sure is odd. I have no idea why the fail case is the fail case: http://techblog.zenrobotics.com/2013/08/clojure-puzzler-2.html |
| 14:01 | coventry | tsantos: I haven't followed it, but there was some discussion of it earlier today: http://clojure-log.n01se.net/#04:56 |
| 14:02 | callen | `cbp: worked for me. reinstall if you must. |
| 14:02 | upwardindex | I'm generating svgs using hiccup. The fact that I'm using identical ids for gradients is getting me in trouble, is there a workaround? |
| 14:02 | `cbp | callen: maybe its just a windows issue.. like usual |
| 14:03 | `cbp | Ill get a mac soon and stop complaining :P |
| 14:03 | tsantos | coventry: how did you search the chat history and generate a URL like that? |
| 14:04 | callen | `cbp: good call :) |
| 14:05 | `cbp | Oh it finished, well it only took it like 30 mins |
| 14:06 | coventry | tsantos: searched for zenrob, moused over the LH margin next to sender name, which displayed time of the message. Clicked on that. |
| 14:06 | tsantos | coventry: ah, thx |
| 14:13 | silasdavis | if I have a set which I generally don't care about the order of, what is the best way to consume it in a consistent order within a particular scope |
| 14:14 | silasdavis | so that (zipmap set (map func set)) |
| 14:14 | silasdavis | iterates set in the same order in both positions |
| 14:14 | silasdavis | ? |
| 14:16 | `cbp | silasdavis: that will work, it doesnt switch order every time you use it :P |
| 14:16 | silasdavis | `cbp, yeah i sort of know it will work, but it feels like a weak guarantee |
| 14:16 | silasdavis | I'd rather make it explicit |
| 14:16 | seangrov` | What do I want to test for vector, list, etc? I thought it was seq?, but that doesn't seem to work |
| 14:17 | seangrov` | ,(seq? [{"name" "test-a-riffic!", "source" "testing"}]) |
| 14:17 | clojurebot | false |
| 14:17 | silasdavis | I suppose I could (let [s (seq set)] (zipmap set (map func set))) |
| 14:17 | coventry | seangrov`: Ran into the same thing this morning. There is a sequable? in clojure.incubator. |
| 14:17 | silasdavis | uh except with s substituted |
| 14:17 | `cbp | silasdavis: seq is implicit though in both zipmap and map |
| 14:18 | `cbp | silasdavis: You could just add a comment :P |
| 14:18 | `cbp | "hey trust me this will work!" |
| 14:18 | `cbp | ..consistently! |
| 14:18 | dnolen | seangrov`: sequential? |
| 14:19 | rasmusto | sequibble |
| 14:19 | hyPiRion | a hash map or a set is not sequential, although they are seqable |
| 14:19 | coventry | dnolen: thanks. |
| 14:19 | seangrov` | dnolen: That works, thanks |
| 14:20 | `cbp | seangrov`: maybe this can help? https://github.com/yogthos/Selmer/blob/master/src/selmer/filters.clj#L39-L51 |
| 14:21 | dnolen | coventry: seangrov`: also CLJS has seqable?, but in this case I think what you really want is sequential? which is more specific. |
| 14:22 | seangrov` | `cbp dnolen: Yeah, sequential looks right - I want to guard against a few conditions. Got a bug with strings being passed rather than vectors/lists, and also with hashmaps, etc. |
| 14:22 | seangrov` | Converting to the erlang-style of "don't correct input, raise an error as soon as possible" |
| 14:22 | coventry | silasdavis: You don't need it, but you can use juxt for that kind of thing. |
| 14:22 | coventry | ,(into {} (map (juxt identity #(* % 2)) (range 10))) |
| 14:22 | clojurebot | {0 0, 1 2, 2 4, 3 6, 4 8, ...} |
| 14:23 | silasdavis | `cbp, it's implicit on each argument separably |
| 14:25 | `cbp | silasdavis: well referential transparency and all that (seq x) will always return the same thing given the same x |
| 14:25 | silasdavis | coventry, yes thanks I like that |
| 14:26 | cmatheson | i've been writing a network application in clojure/core.async, but i'm having to use the blocking versions of all the core.async functions/macros since java io is blocking. |
| 14:26 | cmatheson | which leaves me with the problem of multiple threads trying to write to the same socket at once |
| 14:27 | cmatheson | what is the proper clojurey way to avoid that? (normally i would just put a lock on the socket output stream) |
| 14:28 | dnolen | cmatheson: any reason to not use NIO |
| 14:28 | dnolen | cmatheson: or something else that provides non-blocking behavior like Netty? |
| 14:28 | cmatheson | dnolen: not really, i'm super unfamiliar with the java ecosystem and i wasn't really sure how to work with nio (seems like everyone uses netty) |
| 14:29 | cmatheson | maybe i should be using netty, does it play well with core.async? i guess it shouldn't matter that it has its own thread pool |
| 14:29 | swarthy | can anyone take a look at this 3 line paste and tell me if there is a better way https://www.refheap.com/18179 ? |
| 14:30 | dnolen | cmatheson: I don't see why there would be any issues using it w/ core.async, but I haven't tried it myself or anything. |
| 14:31 | justin_smith | swarthy: (defn in? [x xs] (some #{x} xs)) |
| 14:32 | justin_smith | or does the result explicitly have to be a boolean? |
| 14:32 | llasram | swarthy: `some` already returns the logical true predicate value, so you don't need the `not=` -- the value will already be either `true` or `nil` |
| 14:32 | cmatheson | dnolen: ok thanks, i'll look into switching to netty. i guess i could look at clojurescript/node too |
| 14:32 | justin_smith | ,(not (empty? (filter #{:a} [:a :b :c]))) |
| 14:32 | clojurebot | true |
| 14:32 | swarthy | justin_smith: and llasram: thanks! |
| 14:33 | hyPiRion | (doc empty?) |
| 14:33 | clojurebot | "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))" |
| 14:33 | justin_smith | llasram: it does not return true/false but the thing that was truthy/falsy |
| 14:33 | dnolen | cmatheson: there's also http://vertx.io/ |
| 14:34 | llasram | justin_smith: ##(some nil? [1 2 3 nil 5]) |
| 14:34 | lazybot | ⇒ true |
| 14:34 | justin_smith | llasram: ##(some #{:a} [:a :b :c]) |
| 14:34 | lazybot | ⇒ :a |
| 14:35 | llasram | justin_smith: Sure, if you do that. That's why I didn't advise them to use the set idiom :-) |
| 14:35 | hyPiRion | it returns the first truthy value when calling f on an element in the coll |
| 14:35 | cmatheson | dnolen: thanks. so many choices... |
| 14:39 | swarthy | so with regard to (doc empty?) I don't want nil if the item doesn't exist in the coll, I want false |
| 14:39 | hyPiRion | (boolean (seq ...)) |
| 14:40 | swarthy | excellent thank you |
| 14:40 | functionform | nil and false are both falsey |
| 14:40 | swarthy | but nil != false, how would I test for both cases |
| 14:40 | hyPiRion | but nil is not false |
| 14:41 | swarthy | hey hyPiRion, https://www.refheap.com/18179 |
| 14:42 | swarthy | if I take away 'boolean' func |
| 14:42 | swarthy | i get the opposite results |
| 14:42 | llasram | swarthy: You don't want the `seq` in there |
| 14:42 | hyPiRion | er, well, you'd only want (some #(= % elt) coll) there |
| 14:43 | swarthy | okay but if its not there then some returns nil |
| 14:43 | swarthy | when I want false |
| 14:43 | hyPiRion | oh right, that was the thing |
| 14:43 | hyPiRion | (boolean (some ...)) |
| 14:43 | xeqi | &(boolean (some {:d} [:a :b :c])) |
| 14:43 | lazybot | java.lang.RuntimeException: Map literal must contain an even number of forms |
| 14:43 | xeqi | &(boolean (some #{:d} [:a :b :c])) |
| 14:43 | lazybot | ⇒ false |
| 14:43 | swarthy | &(boolean (some #{:a} [:a :b :c])) |
| 14:43 | lazybot | ⇒ true |
| 14:44 | swarthy | excellent |
| 14:44 | xeqi | &(boolean (some #{nil} [nil])) |
| 14:44 | lazybot | ⇒ false |
| 14:44 | hyPiRion | ,(boolean (some #(= % nil) [nil])) |
| 14:44 | clojurebot | true |
| 14:44 | xeqi | (inc hyPiRion) |
| 14:44 | lazybot | ⇒ 21 |
| 14:45 | hyPiRion | the dangers of nil punning, brr |
| 14:45 | onr | Anyone here using IntelliJ IDEA? |
| 14:45 | xeqi | hyPiRion: the dangers of a type system that allows nils |
| 14:46 | swarthy | the only problem hyPiRion is that this: https://www.refheap.com/18179 doesn't work and I don't konw what I'm messing up |
| 14:46 | hyPiRion | swarthy: remove the seq again |
| 14:46 | swarthy | okay, so i have to have two tests then? |
| 14:46 | swarthy | because if i remove seq then look for a val not in seq |
| 14:46 | hyPiRion | nono, here's the thing |
| 14:47 | nDuff | onr: might be better to ask the real question. |
| 14:47 | nDuff | onr: if your real question is how popular IntelliJ is for Clojure, then we can point you at the survey. |
| 14:47 | hyPiRion | (some f coll) returns the first (f x) which is truthy, or nil otherwise |
| 14:47 | hyPiRion | boolean converts nil and false to false and anything else to true |
| 14:47 | onr | nDuff: you seem angry, maybe i should avoid intellij at all. |
| 14:48 | rasmusto | how do I do that bot thing? ~anyone ? |
| 14:48 | hyPiRion | swarthy: so (defn in? [x items] (boolean (some #(= x %) items))) is sufficient |
| 14:48 | onr | rasmusto: &(...) |
| 14:49 | nDuff | onr: Polling / popularity-contest questions are a good way to hurt signal/noise ratio on IRC. It's not really a matter of "angry". |
| 14:49 | justin_smith | ,"hello" |
| 14:49 | clojurebot | "hello" |
| 14:49 | swarthy | hyPiRion: excellent, thank you very much for your help. I understand what is happening now. |
| 14:49 | justin_smith | ##"hello" |
| 14:49 | rasmusto | onr: no, the canned response to "does anyone" questions |
| 14:49 | hyPiRion | no problem |
| 14:49 | xeqi | ~anyone |
| 14:49 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 14:49 | llasram | What's that work-around for the JVM suppressing SIGPIPE? |
| 14:50 | rasmusto | xeqi: ty |
| 14:50 | llasram | My process is hanging around, pretending to pump bytes to a `less` process I've already quit... |
| 14:51 | hyPiRion | llasram: I thought the JVM gave up when it got a sigpipe? In either case, you could use beckon to modify the signal handling. |
| 14:51 | onr | nDuff: i wouldn't care that much |
| 14:51 | nDuff | ...about what? IntelliJ? IRC etiquette? |
| 14:52 | hyPiRion | er, github's slow here, but https://github.com/hyPiRion/beckon should work, I *think* |
| 14:52 | hyPiRion | for handling signals, that is. |
| 14:52 | llasram | hyPiRion: Ooh, looks nice. Let's have a try... |
| 14:55 | llasram | hyPiRion: Ouch -- UnsupportedClassVersionError |
| 14:55 | hyPiRion | Boo |
| 14:55 | llasram | hyPiRion: *Now* I'm feeling some pain from still being on JVM 6 |
| 14:56 | hyPiRion | Yeah, sorry, I should compile those with 1.6, but I tend to forget from time to time |
| 14:56 | hyPiRion | sec. |
| 15:00 | silasdavis | is there a standard higher order function that just returns the second argument |
| 15:00 | silasdavis | (identity n) |
| 15:00 | lazybot | n has karma -1. |
| 15:00 | silasdavis | or soemthing |
| 15:01 | hyPiRion | #(second %&) is a cheap one |
| 15:06 | hyPiRion | llasram: try it now, with 0.1.1 |
| 15:07 | llasram | hyPiRion: Trying... |
| 15:07 | hyPiRion | If it doesn't work now I'll flip a table or two |
| 15:07 | silasdavis | hyPiRion, anything better than #(first %&) ? |
| 15:07 | hyPiRion | I wish |
| 15:08 | hyPiRion | not afaik |
| 15:08 | llasram | silasdavis: I've ended up carrying around functions I call arg0, arg1, and arg2. Not great, but not the end of the world either |
| 15:08 | llasram | hyPiRion: No exceptions! |
| 15:09 | llasram | Your tables are safe! |
| 15:09 | hyPiRion | wuhuu |
| 15:09 | swarthy | how would you use #(second %&) ? |
| 15:10 | Raynes | (ノಠ益ಠ)ノ彡┻━┻ |
| 15:10 | hyPiRion | ,(#(second %&) :one :two :three :etc) |
| 15:10 | clojurebot | :two |
| 15:10 | hyPiRion | (comp second list) also works. |
| 15:10 | llasram | &(reduce #(second %&) [1 2 3]) |
| 15:10 | lazybot | ⇒ 3 |
| 15:10 | llasram | ^^ THat's where I've wanted it |
| 15:10 | swarthy | Great, that makes sense. |
| 15:12 | amalloy | i dunno, #(second %&) seems like it would rarely be more readable than (fn [a b] b) |
| 15:12 | amalloy | especially if you can give meaningful names in the lambda |
| 15:12 | ztellman | callen: a logging library named after a paramilitary organization? |
| 15:14 | llasram | hyPiRion: And not only doesn't throw an exception, but also solves my SIGPIPE problem! |
| 15:14 | llasram | hyPiRion: Thank you muchly |
| 15:14 | swarthy | amalloy: as a newbie i agree. I made sense of that in a second, the other version required asking. Then again some things are not made for beginners. |
| 15:15 | hyPiRion | llasram: oh, no problem. I have no idea why I wrote that library in the first place, so good to see that it's useful for something :p |
| 15:15 | callen | ztellman: after a book about lumberjacks, but you know, I can go with that too. |
| 15:15 | callen | ztellman: that company isn't named Blackwater anymore, they're Xe now. |
| 15:16 | callen | they wanted something hippies couldn't pronounce. |
| 15:16 | ztellman | ha, I'm behind the times |
| 15:16 | ztellman | I had to go to a security convention in Vegas once, for work |
| 15:16 | callen | The library was an excellent excuse to abuse robert-hooke. |
| 15:16 | ztellman | they had dudes with what I assume were real submachine guns at each corner of the booth |
| 15:16 | TimMc | callen: Next they'll be named "Puppy Kisses". No one can protest against that! |
| 15:16 | callen | The Korma stuff is solid but I kinda need somebody to help me shake out the c.j.j parts. |
| 15:17 | ztellman | right next to the guy giving out free t-shirts if you touched an electric fence that had a little lemon slice attached to it by a string |
| 15:17 | ztellman | that was a weird time |
| 15:17 | callen | ztellman: not that uncommon in that sort of context, you just need a corporation with a manufacturer FFL or NFA stamps. |
| 15:20 | llasram | hyPiRion: So have we decided that single-component namespaces are ok? I thought the translation to packageless Java classes made them... unadvised, but beckon is no the first recent library I've seen do it |
| 15:20 | llasram | s,no,not, |
| 15:22 | tsantos | Paredit question: What's the command to delete the outer parens. Emacs won't let me ## ((+ 1 2)) |
| 15:22 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn |
| 15:22 | amalloy | tsantos: (|(+ 1 2)), M-r |
| 15:22 | coventry | tsantos M-r while on the second '(' |
| 15:23 | tsantos | thanks! It's been driving me nuts. |
| 15:24 | llasram | Or M-s if you just want to bust out the level outside the cursoor |
| 15:25 | amalloy | i usually forget to use M-s |
| 15:27 | tsantos | messing around with split and raise… I'm getting raise but split's behavior is very odd |
| 15:45 | hyPiRion | llasram: well, library.core is not something needed here, because the library itself is so small |
| 15:46 | hyPiRion | I guess multi-namespaces make more sense when working with larger projects, but when you have "library.core" only, I feel the ".core" is a bit useless |
| 15:47 | `cbp | isnt the issue with single part namespaces that you cant use them from java? |
| 15:47 | llasram | hyPiRion: My understanding was the `.core` was just a convention to have *something*. With just `library`, JVM clojure generates classes like `library$function-name`, right? Package-less and sad |
| 15:47 | llasram | (and globally visible without ability to explicitly import) |
| 15:50 | stuartsierra | yes |
| 15:50 | stuartsierra | Which is why you should use a package-prefix instead of naming everything 'core' |
| 15:56 | TimMc | I don't actually know what the issue is with single-segment namespaces, but I keep telling people not to use them. |
| 16:05 | futile | ztellman: your tuples lib looks generic enough to fit into the core lib as an implicit optimization when creating small vectors |
| 16:05 | futile | *to fit into clojure as |
| 16:06 | futile | tsantos: also M-s |
| 16:06 | amalloy | TimMc: the default package is just really hard to use, particularly from java |
| 16:07 | amalloy | so creating piles of classes that live in it is rude |
| 16:27 | ztellman | TimMc: was that for the readme, or the code itself? |
| 16:27 | hyPiRion | or the name or something |
| 16:27 | ztellman | yeah, to hell with that name |
| 16:28 | callen | https://github.com/rixmann/clojure.otp dis gon b gud |
| 16:29 | callen | TimMc: how does 'black.water' strike you? It used to be blackwater.core :P |
| 16:30 | ucb | callen: have you toyed with quasar/pulsar? |
| 16:30 | ucb | callen: it's got some behaviours as well |
| 16:32 | grassclip | anyone here want to answer a question? |
| 16:32 | ztellman | grassclip: ask and see |
| 16:34 | grassclip | so this works (get [10 20 30] 1) and returns 10. Is there something like that which works (get [10 20 30] [1 2]) which would return [10 20]? |
| 16:34 | ztellman | ,(map #(get [10 20 30] %) [10 20]) |
| 16:34 | clojurebot | (nil nil) |
| 16:34 | ztellman | whoops |
| 16:35 | ztellman | ,(map #(get [10 20 30] %) [0 1]) |
| 16:35 | clojurebot | (10 20) |
| 16:35 | grassclip | bingo. thanks a lot |
| 16:36 | hyPiRion | oh what, clojure otp |
| 16:36 | hyPiRion | that's ages ago tho |
| 16:37 | ucb | hyPiRion: pulsar/quasar has otp behaviours now IIRC |
| 16:37 | coventry | ,(map [10 20 30] [0 1]) |
| 16:37 | clojurebot | (10 20) |
| 16:37 | mattmoss | throwdown |
| 16:37 | hyPiRion | ah, neat. Not that I've felt the need for it though. |
| 16:39 | grassclip | cleaner one. thanks |
| 16:41 | ztellman | coventry wins |
| 16:53 | coventry | Where do I get my code golf trophy? |
| 16:53 | callen | ucb: not yet. |
| 17:00 | TimMc | ztellman: Not the name, the single-segment namespace. |
| 17:00 | TimMc | nag, nag, nag |
| 17:00 | ztellman | who's going to use this outside of clojure? |
| 17:00 | ztellman | that's my normal criteria: if it's only useful to clojure folk, a single segment namespace is ok |
| 17:02 | ztellman | see also byte-streams and potemkin |
| 17:02 | bbloom | i like that |
| 17:02 | bbloom | mainly b/c i hate multi-segment namespaces :-P |
| 17:02 | Raynes | You're a bad person. |
| 17:02 | bbloom | i try |
| 17:02 | stuartsierra | I'm just a sadist who likes making people type more. |
| 17:03 | bbloom | stuartsierra: i don't mind the typing, we got aliases for that. i mind navigating folders when authoring the library :-P |
| 17:03 | callen | bbloom: black.water is just black/water.clj, not much to navigate. |
| 17:03 | bbloom | src/extrathing/annoys.me |
| 17:04 | callen | ITT: bikeshedding |
| 17:04 | stuartsierra | bbloom: That's why I write everything in org-mode :P |
| 17:09 | cored | hello |
| 17:10 | cored | why is that there's use and require to load libraries ? it's seems the same to me, at least at the moment |
| 17:11 | callen | cored: well they're not identical, but they're not fully orthogonal either. |
| 17:11 | callen | cored: people have been mumbling about getting rid of use in favor :require :refer :all |
| 17:12 | cored | callen: getting rid, like removing it from the language? |
| 17:12 | callen | rkneufeld: kinky. |
| 17:23 | hyPiRion | cored: more like deprecating. It won't dissappear for some time I guess |
| 17:23 | cored | hyPiRion: I see |
| 17:37 | TimMc | ztellman: I *suppose*. |
| 17:37 | callen | lastlog ztellman |
| 17:37 | callen | sigh. |
| 17:37 | TimMc | bbloom: I use src/org/timmc/... just for you. |
| 17:37 | TimMc | At least I have short domain. |
| 17:39 | clj_newb_2345 | besides the people at relevance |
| 17:39 | clj_newb_2345 | has anyone else in the world managed to grok pedestal? |
| 17:40 | shaunxcode | if I ever get around to putting up my new blog I promise you an article on such grokage |
| 17:45 | futile | Go has an interesting solution to platform-specific code. |
| 17:45 | callen | clj_newb_2345: are you working on complicated bidirectional client/server web applications? |
| 17:45 | futile | I wonder how its pros/cons compare to feature-expressions. |
| 17:45 | clj_newb_2345 | callen: yes |
| 17:46 | callen | well. then Pedestal is potentially a credible solution but OTOH, if you want to build something like that but cannot understand Pedestal, then it might be time to simplify what you're trying to make. |
| 17:46 | callen | clj_newb_2345: #pedestal exists - you know. |
| 17:46 | clj_newb_2345 | by definition, aaaren't all websites either (1) static, (2) bi-directional web apps, or (3) should be [2], but the programmers suck |
| 17:46 | callen | no. |
| 17:47 | shaunxcode | I think what callen is saying is that if you are trying to grok clojure web dev period pedestal may not be the place to start directly. Pick up ring on its own, compojure etc. |
| 17:48 | callen | shaunxcode: thank you for interpreting. |
| 17:49 | gtrak | pedestal's overkill until you really need a cohesive uniform async and message-passing bus, imo? json-rpc works fine for our single-page app and is also flexible. |
| 17:50 | gtrak | rpc-style, anyway, not the spec specifically |
| 17:56 | clj_newb_2345 | http://www.learndatalogtoday.org/ is fucking badass |
| 17:56 | callen | gtrak: I'm of the same opinion. |
| 17:57 | gtrak | ours evolved to a compromise point between json-rpc and REST.. |
| 17:57 | callen | clj_newb_2345: oh man, that is cool and I need it! I have coworkers to teach datalog to! Thank you for sharing :) |
| 17:57 | gtrak | i guess we could implement it in pedestal just as well as in compojure, not sure. |
| 17:57 | clj_newb_2345 | someone else showed it to me last night |
| 17:57 | clj_newb_2345 | I didn't get a chance to start playing with it today, but it's awesome |
| 17:58 | callen | clj_newb_2345: I'm testing Datomic for something at work, so this is very useful. :D |
| 18:11 | futile | yeah I'm gonna be using Datomic soon at work too so http://www.learndatalogtoday.org/ might very well be helpful |
| 18:26 | clj_newb_2345 | datalog is fucking badass; why did no one team me datalog earlier? |
| 18:27 | seangrov` | clj_newb_2345: What're you using it for? |
| 18:29 | clj_newb_2345 | this is going to be my web 3.0 facebook/google killer |
| 18:29 | clj_newb_2345 | the exercises are so fun |
| 18:30 | gtrak | clj_newb_2345: have you considered php? |
| 18:30 | gtrak | it's really good for making websites :-) |
| 18:31 | tcrayford | anybody ever see an error like this out of clojure? "yeller.unique_priority_map.PersistentUniquePriorityMap cannot be cast to yeller.unique_priority_map.PersistentUniquePriorityMap" |
| 18:31 | tcrayford | ? |
| 18:31 | gtrak | classloader boundary? |
| 18:32 | tcrayford | I don't think so :/ |
| 18:32 | tcrayford | (unless I don't know what you mean by classloader boundary) |
| 18:33 | tcrayford | assuming test.generative doesn't do anything weird with classloaders, at the least |
| 18:33 | gtrak | huh |
| 18:34 | tcrayford | this results from just running the test.generative main script from the command line with lein |
| 18:34 | gtrak | I've only seen errors like that across classloaders.. is there anything special about the client code vs the called code? |
| 18:34 | tcrayford | something like this: |
| 18:34 | tcrayford | lein with-profile ci run -m clojure.test.generative.runner "test/yeller/unit/" |
| 18:34 | tcrayford | don't think so |
| 18:35 | tcrayford | it went away after a lein clean, lein compile *offending-source-file* |
| 18:36 | gtrak | interesting |
| 18:36 | gtrak | here's an example: http://stackoverflow.com/questions/2371967/java-getting-class-cast-exception-where-both-classes-are-exactly-the-same |
| 18:38 | tcrayford | yeah, that makes sense |
| 18:45 | futile | "In the last century, their race grew weary of such traditional names, therefore library authors resorted to creative means, such as naming them a sound that could only be pronounced audibly, or a color itself, as opposed to the name of the color." |
| 18:56 | clj_newb_2345 | anyone else wish core.match uses datomic style pattern matching? |
| 18:57 | callen | clj_newb_2345: if wishes were horses, beggars would ride. |
| 18:58 | gtrak | not if I wish for more wishes. they would be buried in horses. |
| 18:59 | TimMc | futile: imma name my next library c̷͉̖̤̟͔̰̮̓͌̿̐ľ͍͌̇ͤj̢͎̗͕̰̙̝̓ͥ͐̊̃ͨͣ.̩̟͎ͅc̵̖̞̞͍̓ͦ͊͌ͫo̙̠͈͉̣̺̖ͤr̲̳̒ͮ̈́͛ͅe̠͇̯͖͂́̌̀̾́ |
| 18:59 | futile | whoa |
| 18:59 | futile | impressive |
| 18:59 | clj_newb_2345 | atleast it'll be easier to google than something like "Go" or "A+" |
| 18:59 | TimMc | (I apologize to anyone who now has a messed-up terminal.) |
| 19:00 | TimMc | /clear will remove the offending line from view and C-l will refresh your screen |
| 19:00 | futile | It's really idiotic that we still use terminal emulators. |
| 19:00 | futile | Surely we can come up with a bette contract than VTxxx. It's the 2010s already. |
| 19:00 | callen | "idiotic" |
| 19:01 | callen | futile: by all means, invent another terminal protocol nobody will use. |
| 19:01 | bbloom | futile: my theory on that is that the BEST FEATURE of terminals is immutability. at least, in theory, your shell is a *log* |
| 19:01 | bbloom | futile: everybody else who has ever tried has made some sort of stupid object shell thing |
| 19:01 | callen | ^^ what this guy said. |
| 19:01 | futile | In order to write a GUI tool that supports "less", you need to emulate at least a VT100. |
| 19:01 | callen | futile: I'll collect my tears in a bucket for you. |
| 19:01 | futile | callen: I'm not saying I can do it. |
| 19:02 | callen | I need to write a bayesian filter that filters for conversation about doing actual 'things'. |
| 19:02 | futile | callen: yep, good old callen |
| 19:03 | bbloom | callen: if you try not saying anything, maybe the conversations you don't like will just scroll past you and your life will be better |
| 19:05 | coventry | clj_newb_2345: I have worked through the first part of the pedestal tutorial, and I think I grok it. It was tough going, though. I am planning to use it in a couple of weeks, after I've developed some backend components. |
| 19:05 | callen | bbloom: but the log is immutable :( |
| 19:06 | callen | I'm just asynchronously rotating to the IRC channel, checking to see if anybody's doing something other than complaining about things they didn't write, then cmd-tab'ing back to my work. |
| 19:07 | callen | I'm starting to understand why caboose exists. |
| 19:08 | clj_newb_2345 | why hasn't anyone written a clojure library that only shows me what I wnat to read? |
| 19:08 | clj_newb_2345 | it should use reinforcement learning by looking at how I respond to it |
| 19:08 | clj_newb_2345 | and use the webcam to read my facila expressions |
| 19:08 | clj_newb_2345 | for approval/disaproval |
| 19:08 | gtrak | I haven't ever used a clojure library that I didn't end up reading every line for |
| 19:09 | gtrak | I just do it upfront now |
| 19:10 | clj_newb_2345 | gtrak: what libraries have you used? |
| 19:10 | gtrak | uhh |
| 19:10 | gtrak | :-) |
| 19:12 | gtrak | compojure... friend... slingshot.. ring, clj-hadoop, cascalog, leiningen (ok I guess not all the way), tools.nrepl, data.csv, cheshire.. nothing too huge. |
| 19:12 | gtrak | but it adds up |
| 19:13 | gtrak | just looking through a single project.clj and seeing if I remember looking at the guts.. |
| 19:16 | coventry | clojure.core? :-) |
| 19:16 | gtrak | yea ofc |
| 19:16 | clj_newb_2345 | WOOT WOOT WOOT |
| 19:16 | clj_newb_2345 | finished datalog tutorial |
| 19:16 | clj_newb_2345 | where is the confetti ? |
| 19:16 | callen | I'm starting to understand why caboose exists. |
| 19:17 | callen | whoops, wrong term. |
| 19:17 | gtrak | clj_newb_2345: confetti is you get to read https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj |
| 19:17 | clj_newb_2345 | gtrak: I've already read all 128 characters used in that file |
| 19:18 | gtrak | quick, what's the md5sum? |
| 19:18 | clj_newb_2345 | 2392802482042 |
| 19:19 | clj_newb_2345 | as part of my training for mental mining bitcoin, I can do sha256 coins mentally too |
| 19:19 | clj_newb_2345 | the datomic tutorial now finally starts to make sense |
| 19:24 | clj_newb_2345 | holy shit datomic licensing is expensive |
| 19:25 | Raynes | Welcome to the wonderful world of proprietary software by people who have a need to make money. |
| 19:25 | bbloom | clj_newb_2345: you've clearly never seen an oracle price sheet |
| 19:25 | clj_newb_2345 | no |
| 19:25 | clj_newb_2345 | I tend to only use open source software |
| 19:25 | Raynes | bbloom: Expensive relative to <insert something here> |
| 19:25 | clj_newb_2345 | datomic starting license |
| 19:25 | bbloom | www.oracle.com/us/corporate/pricing/technology-price-list-070617.pdf |
| 19:25 | clj_newb_2345 | is more expensive than my macbook pro 17 |
| 19:25 | Raynes | Not necessarily expensive relative to <insert highest priced database ever>. |
| 19:25 | `cbp | so many mcchickens you can buy instead |
| 19:25 | Raynes | Mine too. |
| 19:25 | Raynes | Because mine was free. |
| 19:25 | s4muel | "In devops we are face fiscal cliff every year when Oracle license is up for renew." - @devops_borat |
| 19:25 | Raynes | Because my company owns my computer ;p |
| 19:26 | gtrak | $47k a cpu? |
| 19:27 | clj_newb_2345 | if someone wrote a datomic clone |
| 19:27 | clj_newb_2345 | woudl they get kicked from #clojure? |
| 19:27 | seangrov` | I wish thye were more evil abotu datomic |
| 19:28 | seangrov` | Wow, typos |
| 19:28 | bbloom | lol what a weird thought: "They make good software and I like them, but I wish they made good software and I *didn't* like them, so I could clone their software and be a hero" |
| 19:28 | seangrov` | But really, let me "scale up" a bit more and get good and locked-in, then ask me to pay |
| 19:29 | seangrov` | Otherwise I'm nervous about even getting started |
| 19:29 | gtrak | you'll have to pay in hardware if you use a bad architecture |
| 19:31 | clj_newb_2345 | alternatvely |
| 19:31 | clj_newb_2345 | they could make datomic ree |
| 19:31 | clj_newb_2345 | and charge for the support |
| 19:31 | clj_newb_2345 | like, say, Red Hat |
| 19:32 | sandbags | anyone here able to help with with my clojurescript+core.async problem https://gist.github.com/mmower/88353e592f169bef7df9 ? |
| 19:33 | sandbags | i'm kinda stuck and really have no idea what might be wrong |
| 19:33 | callen | I just used core.async blocking take and async put to make a safe (no global mutable state) test case. :) |
| 19:33 | callen | very pleasing. |
| 19:38 | sandbags | seems the problem is nothing to do with using <! inside a (loop ...) |
| 19:40 | sandbags | i don't see how this is working for anyone ... or what i am doing that's so horrendously stupid |
| 19:41 | dobry-den | Anderkent]away: return the rc in click-chan |
| 19:41 | dobry-den | sandbags: * |
| 19:42 | sandbags | ah, did i miscopy something... let me see |
| 19:42 | sandbags | yerp |
| 19:42 | sandbags | thanks dobry-den |
| 19:43 | sandbags | dobry-den: that certainly is more correct, but doesn't seem to have affected the error i am getting |
| 19:43 | abp | sandbags: you need (:require-macros [cljs.core.async.macros :as m :refer [go]]) |
| 19:44 | dobry-den | oh yeah |
| 19:44 | dobry-den | that got me for a while |
| 19:44 | sandbags | abp: that's odd, i seem to get getting "go" from cljs.core.async |
| 19:44 | sandbags | at least, i copied that from somewhere |
| 19:44 | sandbags | did it change? |
| 19:45 | dobry-den | sandbags: i wrote my first cljs app last week and this is what i've got https://github.com/danneu/speed-reader/blob/master/src/cljs/speed_reader/core.cljs |
| 19:45 | sandbags | ah, that seems to have eliminated the error i was seeing, thanks abp |
| 19:45 | dobry-den | i see that i have go from both async and macros. i imagine the :require 'go' i just forgot to take out |
| 19:45 | sandbags | how very odd |
| 19:46 | dobry-den | i imagine it catches most people |
| 19:46 | abp | sandbags: it's a macro, so you certainly need to use :require-macros in cljs |
| 19:47 | abp | probably cljs doesn't check if everything refer'd exists.. |
| 19:47 | sandbags | abp: interesting, so you need to know what are functions, and what macros |
| 19:47 | sandbags | presumably any macro you use must be require-macro'd? |
| 19:47 | futile | wat |
| 19:47 | dobry-den | that's how i see it |
| 19:48 | abp | at least I don't see go in https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async.cljs |
| 19:48 | sandbags | abp: it's most probable that (not knowing about require-macro) i was copying something else i had seen and just assumed i was doing it correctly |
| 19:48 | sandbags | seems a bit of a bind having to require func & macro separately |
| 19:48 | dobry-den | https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async/macros.clj |
| 19:49 | sandbags | hrmm... is don't see a macro predicate |
| 19:50 | abp | there we go http://dev.clojure.org/jira/browse/CLJS-569 |
| 19:51 | sandbags | anyway, abp, dobry-den many thanks |
| 19:51 | sandbags | at least i am debugging less inexplicable errors now :) |
| 19:52 | clj_newb_2345 | can datomic free edition be used in commercial products? |
| 19:52 | dobry-den | sandbags: i have various classes of cljs+async errors fresh in memory from using it last week |
| 19:52 | sandbags | :) |
| 19:54 | sandbags | dobry-den: you like domina? |
| 19:55 | dobry-den | yeah |
| 19:55 | dobry-den | not that i have many preferences. ive never even written a client-side js app before |
| 19:56 | dobry-den | i found it really easy to fake it til i made it with core.async though |
| 19:56 | sandbags | me either, i dislike JS so always try and ensure someone else writes it :) |
| 20:18 | mihneadb | how would I use enlive to select only the direct descendants of the given element? |
| 20:18 | mihneadb | something like (select elem [:> :a]) |
| 20:18 | mihneadb | ^ that one doesn't seem to work |
| 20:19 | mihneadb | it works when I go one up and I do (select parent-elem [:something :> :a]) |
| 20:22 | sandbags | okay i have my first cljs+core.async app working : i can go to bed a reasonably happy man! |
| 20:23 | sandbags | thanks again for your help abp and dobry-den |
| 20:25 | juliangindi | I've been reading a lot about Clojure and making my way through 4Clojure but can't seem to truly "grasp" the language. Any suggestions or advice? |
| 20:28 | gdev | how long have you been using it? |
| 20:30 | mihneadb | I want to do generate a map by applying a function over a sequence - should I use for, or something else? |
| 20:30 | juliangindi | I have been reading "Clojure Programming" and working with 4Clojure for a couple of weeks. I am looking for a larger "toy project" as well |
| 20:31 | llasram | mihneadb: There are a few common idioms depending on context. Usually either `reduce` or `(into {} (map ...)` |
| 20:31 | mihneadb | llasram: for the into version, I guess the mapped function has to return a two-value collection, right? |
| 20:31 | mihneadb | or should it be an actual map? |
| 20:32 | llasram | mihneadb: A sequence of pairs (as vectors), yeah |
| 20:32 | mihneadb | llasram: sweet, thank you |
| 20:34 | gdev | juliangindi, depending on how much time you dedicate to it, you should "get it" in about another month and a half |
| 20:34 | callen | god that test code was fucking sweet. |
| 20:34 | mihneadb | llasram: is there an easier way to make a vector out of two elements other than (vec (list 1 2)) ? |
| 20:35 | gdev | juliangindi, what are the primary languishes you code in? |
| 20:35 | llasram | mihneadb: ##(vector 1 2) |
| 20:35 | lazybot | ⇒ [1 2] |
| 20:35 | mihneadb | ah damn it |
| 20:35 | mihneadb | I was trying with vec |
| 20:35 | mihneadb | thanks! |
| 20:35 | juliangindi | I program primarily in Python and JS with Node |
| 20:36 | gdev | callen, I've been trying to document blackwater. we need to talk |
| 20:37 | callen | gdev: are you working from the current version? |
| 20:38 | callen | gdev: I added some documentation. |
| 20:38 | llasram | mihneadb: Oh, wait, or even just literally ##[1 2] |
| 20:38 | lazybot | ⇒ [1 2] |
| 20:38 | mihneadb | heh |
| 20:38 | mihneadb | nice |
| 20:38 | mihneadb | ty |
| 20:38 | mihneadb | I was trying to do something like #([% %]) |
| 20:38 | callen | gdev: I also changed the library substantially from 0.0.3 to 0.0.5 |
| 20:39 | llasram | mihneadb: Oh, yeah, for that one a somewhat-common idiom is ##(map #(-> [% %]) (range 5)) |
| 20:39 | lazybot | ⇒ ([0 0] [1 1] [2 2] [3 3] [4 4]) |
| 20:39 | mihneadb | (into {} (map #([% %]) [1 2 3])) << this wasn't working |
| 20:39 | gdev | callen, oh lol I haven't even set up my gitconfig upstream >_< |
| 20:39 | mihneadb | uh |
| 20:39 | mihneadb | ok |
| 20:39 | mihneadb | thanks llasram |
| 20:39 | callen | gdev: git remote add upstream git://github.com/bitemyapp/blackwater |
| 20:40 | gdev | callen, danke ;D |
| 20:41 | callen | gdev: I have the highest variance in code quality of libraries from early versions to later versions of anybody I know, you've really gotta keep up on those pulls while the library is still young. |
| 20:42 | mihneadb | llasram: and if I have two map results that I want to return as just one seq, what's the idiomatic way of doing it? |
| 20:43 | llasram | mihneadb: Not 100% certain what you mean. Maybe `juxt`? |
| 20:43 | llasram | &(map (juxt inc dec) (range 5)) |
| 20:43 | lazybot | ⇒ ([1 -1] [2 0] [3 1] [4 2] [5 3]) |
| 20:43 | mihneadb | llasram: I'm looking for the equivalent of append in scheme, I guess |
| 20:43 | mihneadb | ++ in haskell |
| 20:43 | gdev | callen, yeah I went ahead and set up a cron job to pull every hour =D |
| 20:44 | mihneadb | llasram: concat! |
| 20:44 | mihneadb | :D |
| 20:44 | llasram | Yep! |
| 20:45 | callen | gdev: that's...scary. |
| 20:45 | llasram | Interesting |
| 20:47 | dobry-den | What's the best way to (File. _) a folder that's in the same folder as the jar that's accessing it? |
| 20:47 | llasram | dobry-den: Just put the file in the JAR to begin with, so you can access it as a resource? |
| 20:47 | TimMc | Here is a thing I don't understand: If I run (#(%foo) 5 6 7) at the REPL, I get the expected exception. (Three, actually.) If I then hit enter again, I see "567". Why? |
| 20:48 | callen | gdev: so have you seen the current state of the code / docs? |
| 20:48 | gdev | callen, grokking out right meow |
| 20:49 | llasram | TimMc: Must be some sort of buffering in your REPL. In nrepl.el, I get (Exception, Exception, 5, 6, 7, Exception) |
| 20:49 | llasram | Which makes "sense" -- parse ends up in a funky state twice, sees 5 6 7 as separate forms, then exception again on the "unexpected" `)` |
| 20:50 | llasram | Right? |
| 20:50 | dobry-den | llasram: the idea is to drop blog.jar into a folder that also contains a 'posts' directory and it will serve them (markdown files) |
| 20:50 | mihneadb | is there some sort of pretty-print function in clojure? for json printing |
| 20:50 | gdev | callen, yeah, where them doc strangs at? |
| 20:50 | TimMc | llasram: Yeah, *that* seems legit. |
| 20:51 | llasram | mihneadb: You can pretty-print Clojure data with clojure.pprint/pprint |
| 20:51 | callen | gdev: well, they're not everywhere. |
| 20:51 | callen | gdev: just in the important parts. look at the README. https://github.com/bitemyapp/blackwater |
| 20:51 | mihneadb | llasram: I d like to pprint json data |
| 20:51 | gdev | callen, I'm gonna need them...everywhere |
| 20:51 | callen | gdev: I have no problem doing that - but why? |
| 20:51 | gdev | callen, wanted to use marginalia on it |
| 20:51 | callen | oh, margle-gargle. |
| 20:52 | llasram | mihneadb: cheshire's `generate-*` functions can take a `:pretty` option which pretty-prints the results |
| 20:52 | mihneadb | llasram: I was looking at data/json |
| 20:52 | mihneadb | thanks |
| 20:52 | callen | I'll do some more clean-up then. |
| 20:52 | gdev | callen, I'm a maintainer of that liberry so I'm kinda biased ya know ;D |
| 20:53 | callen | gdev: I didn't know that. I marg-i-nized Selmer :P |
| 20:54 | llasram | dobry-den: Hmm. Interesting. You can certainly use `io/resource` to get a `jar:` URL for a resource in your JAR. From there you could take the URL apart to find the path of the JAR |
| 20:54 | llasram | dobry-den: There might be a better solution though -- that seems relatively hacky |
| 20:57 | cmatheson | /exit |
| 20:58 | gdev | callen, yeah I saw that =D |
| 20:59 | gdev | juliangindi, are you Julian25 on github? |
| 20:59 | juliangindi | yes i am :) |
| 21:01 | gdev | juliangindi, what about on 4clojure? |
| 21:01 | callen | gdev: for the love of god, change the newlines to unix for `lein marg` |
| 21:01 | Raynes | lol |
| 21:01 | callen | gdev: nothing pisses me off faster than, "fatal: CRLF would be replaced by LF in docs/uberdoc.html" |
| 21:01 | gdev | callen, that will be in the next release at the end of the year #waterfall |
| 21:02 | juliangindi | gdev: I'm juliangindi on 4clojure…just started |
| 21:03 | callen | gdev: I might kill you. |
| 21:03 | gdev | Raynes, should I unassign you from this one? https://github.com/gdeer81/marginalia/issues/73 |
| 21:04 | callen | gdev: https://rawgithub.com/bitemyapp/blackwater/master/docs/uberdoc.html |
| 21:04 | xeqi | dobry-den: are you running the jvm from the directory the jar is in? |
| 21:04 | dobry-den | xeqi: No |
| 21:06 | dobry-den | I found solutions to get the path of a jar using .getClass(). is there a class that's always present in a Clojure app that I can rely on to call ClassName.getClass()? |
| 21:07 | callen | gdev: 0.0.6, marg docs are up. |
| 21:08 | gdev | callen, it's so...so beautiful. :') |
| 21:08 | callen | it's one of the simplest libraries I've ever written. :| |
| 21:08 | callen | I don't see why everything needed a doc string. |
| 21:08 | callen | It doesn't even really explain anything. |
| 21:08 | callen | If anything needed explained, it's that damn robert.hooke magic. |
| 21:08 | callen | most people won't understand wtf (add-hook ...) is. |
| 21:09 | gdev | callen, that's not marg's fault, its up to you to make it understandable ;) |
| 21:09 | callen | gdev: I'm just saying the literate approach isn't always the highest value thing in the world. |
| 21:09 | Raynes | gdev: Oh God yes please. |
| 21:11 | mihneadb | If you only need AOT for your uberjar, consider adding :aot :all into your |
| 21:11 | mihneadb | :uberjar profile instead. |
| 21:11 | mihneadb | how do I do this^ ? |
| 21:11 | mihneadb | I can't find a sample |
| 21:11 | mihneadb | only found :uberjar-name |
| 21:11 | TimMc | In your project map, add :profiles {:uberjar {:aot :all}} |
| 21:11 | mihneadb | thanks! |
| 21:11 | TimMc | or something like that? |
| 21:12 | gdev | Raynes, probably should close this issue since the lein plugin kinda obviates the need for a standalone command line version amirite? |
| 21:12 | TimMc | Or use lein-otf. :-D |
| 21:12 | mihneadb | TimMc: will look into it, thanks |
| 21:13 | callen | TimMc: pretty glad you made that :) |
| 21:13 | gdev | "otf is not a task, did you mean this? lein wtf" |
| 21:13 | xeqi | dobry-den: clojure.lang.RT ? |
| 21:15 | gdev | callen, well if you want it to be enterprise-ready it's gonna need a lot of documenstration =/ |
| 21:15 | TimMc | callen: How do you find it useful? |
| 21:17 | TimMc | I wrote it mainly because I find AOT overcomplicating and distasteful, but I don't actually have a practical use for it. |
| 21:20 | callen | TimMc: I just like the option of it handy. |
| 21:20 | callen | gdev: :| |
| 21:22 | qz_ | is there any idiomatic way to process sequences with lookahead/skip? say i have list of strings and need to merge strings starting with 'A' with next string? |
| 21:38 | TimMc | qz_: Something with (partition 2 1 (concat [nil] ... [nil])) and treating the last element specially. |
| 21:39 | qz_ | TimMc: but how do i skip element after merging? |
| 21:39 | callen | Selmer cheated by using an actual peek :P |
| 21:41 | dobry-den | xeqi: haha yes thanks. |
| 21:41 | TimMc | qz_: Or loop/recur with peeking. |
| 21:42 | dobry-den | (-> clojure.lang.RT .getProtectionDomain .getCodeSource .getLocation .getPath) |
| 21:42 | callen | ,(-> clojure.lang.RT .getProtectionDomain .getCodeSource .getLocation .getPath) |
| 21:42 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission getProtectionDomain)> |
| 21:42 | dobry-den | haha |
| 21:42 | dobry-den | jailed |
| 21:48 | TimMc | qz_: Did you understand the loop/recur suggestion? |
| 21:53 | qz_ | TimMc: reading about loop/recur, never used it before |
| 21:59 | dobry-den | qz_: so you want ["Apple" "Ace" "Bonk" "Animal" "Ancient"] -> ["AppleAce" "AnimalAncient"] |
| 22:01 | dobry-den | I meant to add a "?" |
| 22:01 | dnolen | doing sensible async error handling in JS/Node.js looks comical in comparison to this - http://gist.github.com/swannodette/6385166 |
| 22:02 | dobry-den | qz_: If that's what you want, check out partition-by (http://clojuredocs.org/clojure_core/clojure.core/partition-by) which will split a coll any time pred changes. |
| 22:05 | dobry-den | dnolen: tight |
| 22:06 | dnolen | dobry-den: yep, you can just use <? to convert an async error into an exception locally |
| 22:26 | dnolen | updated with some comments - http://gist.github.com/swannodette/6385166 |
| 22:27 | dnolen | converting async errors into exceptions looks like a sweet little pattern |
| 22:52 | SegFaultAX | Value of Values is just such a damn good talk. |
| 22:53 | bbloom | SegFaultAX: the new talk is out too: composition, design, & performance |
| 22:58 | SegFaultAX | bbloom: Yea, I watched it the other night. |
| 22:58 | SegFaultAX | bbloom: One of his more meta talks. Strange, but extremely enjoyable IMHO. |
| 22:59 | bbloom | yeah, saw it at clj/west, really liked it |
| 23:04 | dobry-den | How can I do something like this? (let [person {:name "Chuck"}] (read-string "[:h1 (:name person)]")) -> [:h1 "Chuck"] |
| 23:05 | TimMc | http://www.learndatalogtoday.org/chapter/3 suddenly introduces tuples, collections, and relationships all very suddenly. I was following the tutorial nicely up until that point. |
| 23:06 | SegFaultAX | dobry-den: You'll have to do eval. But why? |
| 23:07 | TimMc | Sounds like someone wants templating with databinding. |
| 23:07 | dobry-den | Yeah, that's it |
| 23:07 | dobry-den | SegFaultAX: thanks |
| 23:08 | TimMc | dobry-den: You probably do not want eval. |
| 23:09 | TimMc | Whenever you think you do, it's usually time to take a step back and think about how you've structured things. |
| 23:09 | SegFaultAX | (inc TimMc) |
| 23:09 | lazybot | ⇒ 46 |
| 23:10 | crocket | Does clojure provide such modularity concept as OSGi and Jigsaw? |
| 23:10 | dobry-den | TimMc: Basically I'm writing a blog system like Jekyll where index.hiccup has access to a 'config' map so index.hiccup can just contain "[:h1 (:title config)]" |
| 23:11 | SegFaultAX | dobry-den: If you're creating templates that need to be eval'd as normal code, why not just use eg Selmer? |
| 23:12 | TimMc | crocket: Ask nDuff about OSGi, I think. |
| 23:12 | crocket | OSGi is tied to JVM. |
| 23:12 | crocket | Clojure escaped JVM as ClojureScript. |
| 23:14 | TimMc | dobry-den: You'll also want to html-encode whatever value you get out of the data structure. |
| 23:16 | TimMc | I generally disrecommend hiccup because it does not HTML-encode values by default, which makes it unsuitable for general-purpose web development. |
| 23:20 | ddellacosta | can't get the basic first steps (http://palletops.com/doc/first-steps/) with pallet working. UnknownHostException ("ec2.ap-southeast-2.amazonaws.com") |
| 23:20 | ddellacosta | anyone have any experience with this? #pallet seems kinda dead |
| 23:20 | SegFaultAX | TimMc: Disrecommend? Is that a word? |
| 23:20 | TimMc | It is when I use it. |
| 23:21 | SegFaultAX | Heh |
| 23:21 | SegFaultAX | ddellacosta: I really have no idea how people use pallet. |
| 23:21 | SegFaultAX | The documentation is less than worthless. |
| 23:21 | ddellacosta | SegFaultAX: and here I thought I was going to make my AWS shizzle all efficient and stuff |
| 23:21 | SegFaultAX | ddellacosta: Ansible, yo. |
| 23:22 | dobry-den | ,(let [x 1] (eval (read-string "(+ 1 x)"))) |
| 23:22 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 23:22 | dobry-den | It does not see x in that context. |
| 23:23 | ddellacosta | SegFaultAX: hmm, bummer, I was hoping to do this in Clojure. *sigh* |
| 23:23 | SegFaultAX | ddellacosta: Totally not worth it IMHO. |
| 23:23 | tbatchelli_m | ddellacosta: http://palletops.com/doc/faq/jclouds-aws/ |
| 23:24 | llasram | dobry-den: AFAIK there's no way to e.g. `eval` with some sort of existing lexical context |
| 23:24 | SegFaultAX | That's a good example of how useless the docs are. |
| 23:24 | llasram | dobry-den: If you want to define something in normal code which is then available in an `eval`ed form, you need to e.g. hang it off a var w/in a namespace |
| 23:24 | SegFaultAX | Haha, the comment on that page is amazing. |
| 23:26 | SegFaultAX | ddellacosta: Anyway, the jvm startup time is just too damn slow when you're trying to rapidly iterate ops stuff. |
| 23:26 | ddellacosta | tbatchelli_m: thanks, but it barfed again. It just doesn't seem smart enough to properly construct a ec2 URL |
| 23:26 | SegFaultAX | Clojure makes for a really shitty scripting language. Ansible is really stupidly easy to get going. |
| 23:27 | SegFaultAX | Once you grok the core concepts, it goes really fast. |
| 23:27 | ddellacosta | SegFaultAX: I'm slowly, painfully starting to agree with you |
| 23:27 | ddellacosta | I really would rather use Pallet |
| 23:27 | SegFaultAX | Source: I've been head down in Ansible for the last 2 weeks straight. |
| 23:27 | SegFaultAX | ddellacosta: I wanted to as well. I mean not necessarily pallet, but at least something like it. |
| 23:27 | SegFaultAX | It doesn't appear to exist. |
| 23:28 | llasram | SegFaultAX: I'm not sure slow JVM startup is really a factor.... I mean, e.g. Puppet and Chef use persistent daemons to do all the heavy lifting |
| 23:28 | SegFaultAX | And after using chef and puppet for years, I came upon the glory of Ansible. And I've been quite happy. |
| 23:28 | SegFaultAX | llasram: Ansible is push based. |
| 23:28 | llasram | Somewhat unconvinced that that's a selling point :-) |
| 23:29 | SegFaultAX | llasram: It's /a/ selling point. It also lacks the soul-crushing complexity of Chef. |
| 23:29 | SegFaultAX | And the documentation doesn't make me want to slaughter kittens. |
| 23:30 | llasram | haha. Honestly haven't used Chef. Went with Puppet for semi-arbitrary reasons several years ago, and haven't had significant reason to re-evaluate |
| 23:30 | SegFaultAX | Anyway, Python is one of the de facto scripting languages in the ops world. Along with perl and bash. So it's a natural choice. |
| 23:32 | llasram | Hmm. So the ansible model is essentially sets actions to take on sets of systems, vs the puppet/chef model of declarative state? |
| 23:32 | SegFaultAX | llasram: Puppet is a significant improvement over Chef, but it's still very very complicated. |
| 23:32 | fkey | in clojurescript, is there a way to get at the parsed expression tree? i created a parser but was wondering if there is a more succinct way to do things... |
| 23:33 | SegFaultAX | llasram: Essentially yes, plays are just lists of tasks applied to sets of hosts. |
| 23:33 | SegFaultAX | llasram: With the (incredibly important) constraint that all operations are intended to be idempotent. |
| 23:33 | llasram | Hmm. Interesting. |
| 23:34 | SegFaultAX | llasram: Also, if you really must have an agent based CMDB, ansible has a pull mode. |
| 23:35 | SegFaultAX | But the default and most popular workflow is push based. |
| 23:36 | llasram | SegFaultAX: You've convinced me it might be of interest :-). I will definitely look more into it later |
| 23:37 | SegFaultAX | llasram: In fairness, if your infrastructure is already built around one of the other popular options (chef, puppet, salt, whatever) then whatevs. |
| 23:37 | SegFaultAX | But for building out new infrastructures, the relative simplicity is a huge win. |
| 23:38 | llasram | SegFaultAX: Indeed (re: already built), but there is always The Future (tm) |
| 23:48 | technomancy | I could never get over the facepalm of having a completely new language to learn with puppet, even if the design is otherwise better than chef. |
| 23:48 | SegFaultAX | Chef's DSL is equally wtf. |
| 23:49 | technomancy | the semantics are awful, but at least the syntax is widely understood |
| 23:49 | SegFaultAX | Well yea, I guess it's better that it reuses block syntax. |
| 23:49 | SegFaultAX | Ansible avoids both of those problems by using plain old YAML. |
| 23:49 | llasram | technomancy: In fairness, they tried to add an internal DSL version, but nobody used it, I assume because the external DSL is just much more compact. |
| 23:51 | technomancy | adding another option might be nicer when writing, but you still have to learn to read both |
| 23:51 | SegFaultAX | technomancy: What does Heroku use internally to manage infrastructure? |
| 23:52 | cemerick | YAML can be characterized as "plain old"? Hum. |
| 23:53 | llasram | technomancy: Eh. I think I'd prefer s-exps for everything at this point, but it's honestly not that much to keep around in your head. |
| 23:53 | technomancy | SegFaultAX: chef is used for some really low-level stuff (thankfully nothing I have to touch) but we have another system similar to what we expose to customers for managing apps running on "raw" ec2 nodes |
| 23:53 | SegFaultAX | cemerick: Fair. Code = Data = Code is a feature for ansible. |
| 23:53 | llasram | Now that I've offloaded all spacial reasoning to GPS devices, I've got pleeenty of room for extra programming language syntaxes |
| 23:54 | cemerick | SegFaultAX: I was only saying, it's not like YAML is ubiquitous or something. XML or JSON or INI can be "plain old", but...YAML? |
| 23:55 | SegFaultAX | technomancy: Neat. |
| 23:55 | TimMc | Why, back in my day... |
| 23:55 | SegFaultAX | cemerick: YAML is pretty common in the Ruby world. |
| 23:55 | SegFaultAX | Particularly in Ruby land. |
| 23:55 | SegFaultAX | Err Rails |
| 23:56 | cemerick | Not sure that counts for much. |
| 23:56 | SegFaultAX | cemerick: It's just a matter of perspective. I see yaml is being fairly common. In other spaces, other formats are more common. |
| 23:57 | llasram | TimMc: You had moose hides! Lucky you. In my day moose hadn't evolved yet and we needed to use mammoth hides, which of course you needed to shave first |
| 23:57 | xeqi | cemerick: I don't think I've ever touched an ini. they can't be "plain old" |
| 23:57 | SegFaultAX | Ansible uses INI. |
| 23:58 | SegFaultAX | For inventory files. |
| 23:58 | fkey | D: (cljs.reader/read-string ... ) is exactly what i needed lol |