2012-04-13
| 00:07 | kenneth | so i've narrowed it down |
| 00:07 | kenneth | https://gist.github.com/8df116ff0fbe53eef0a1 |
| 00:07 | kenneth | if i replace line 6 with the two lines commented out above, it doesn't work |
| 00:07 | kenneth | can't tell why |
| 00:08 | devn | FWIW i dont like using ->> in that context |
| 00:08 | devn | (dorun (pmap (map (line-seq (io/reader f ...))))) |
| 00:09 | devn | err, you know what i mean |
| 00:12 | kenneth | alright let me try it this way |
| 00:12 | andyfingerhut | partition is adding a level of nesting that the final map doesn't handle |
| 00:14 | andyfingerhut | sorry, I was confused there for a bit. What do you mean by 'it doesn't work'? The result is different? |
| 00:21 | kenneth | hmm, i though i was handling it with the two maps, andyfingerhut |
| 00:21 | kenneth | devn: here, tried it your way, and adding a with-open, https://gist.github.com/df78a51e447c3a7f80bf |
| 00:21 | kenneth | it's still printing nil |
| 00:22 | devn | what is printing nil? |
| 00:22 | devn | you dont have any (println) calls |
| 00:23 | kenneth | devn: i do, process-line printlns |
| 00:23 | kenneth | devn: pasted the whole code, same gist (reload) |
| 00:23 | devn | oh, sorry -- saw it was (str ...) earlier |
| 00:23 | kenneth | thanks for the help btw, much appreciated |
| 00:24 | devn | kenneth: not a problem :) |
| 00:25 | devn | kenneth: do you mean to process the file in parallel? or to process lines in parallel? |
| 00:26 | kenneth | i want to process the file in parallel, 10 threads at a time |
| 00:27 | kenneth | since there's some blocking i/o on the line processing, running 10 at a time ought to speed up the whole thing a lot |
| 00:30 | devn | kenneth: http://meshy.org/code/wf2-faster.clj |
| 00:30 | devn | that's pretty ancient, so type hints and so on have changed |
| 00:30 | devn | as have the libraries |
| 00:30 | jblomo | can i change the Details section of a Jira ticke? |
| 00:31 | jblomo | ticket |
| 00:31 | kenneth | devn: i think that's somewhat above my level right now |
| 00:31 | kenneth | :p |
| 00:31 | devn | kenneth: i felt the same way, but try to just skim it and look at the recipe |
| 00:33 | devn | kenneth: have you timed this without trying to parallelize it? |
| 00:33 | devn | are you optimizing prematurely? |
| 00:34 | kenneth | i have not timed it, but i don't think it's too premature |
| 00:34 | kenneth | the script is meant to process a 140M line file, and i've run a php version of the script before and it ran almost 10x faster with 10 instances running |
| 00:49 | kenneth | devn: do you have any idea why this works (map process-line (line-seq r)), but this doesn't: (pmap #(map process-line %) (partition 10 (line-seq r))) |
| 00:53 | Iceland_jack | kenneth: #(apply map process-line %) ? |
| 01:07 | kenneth | Iceland_jack: hmm, could you explain that, i'm not sure i get it |
| 01:09 | amalloy | kenneth: i think the reason you don't get it is that it's incorrect |
| 01:09 | kenneth | haha |
| 01:10 | Iceland_jack | Honest mistake amalloy |
| 01:10 | amalloy | anyway, your transformation to pmap looks fine except for the danger of using partition instead of partition-all |
| 01:11 | amalloy | compare ##(partition 2 [1 2 3 4 5]) to ##(partition-all 2 [1 2 3 4 5]) and make sure you're using the one you want |
| 01:11 | lazybot | (partition 2 [1 2 3 4 5]) ⇒ ((1 2) (3 4)) |
| 01:11 | lazybot | (partition-all 2 [1 2 3 4 5]) ⇒ ((1 2) (3 4) (5)) |
| 01:11 | amalloy | so at that point i'd ask you what you're doing that makes you think the pmap version doesn't work and the other does |
| 01:11 | amalloy | (it's probably laziness-related though) |
| 01:12 | kenneth | amalloy: actually, does partition X create a collection with X collections, or a collection of collections of size X? |
| 01:12 | muhoo | wow it's so weird dealing with a java api that has mutable state |
| 01:12 | amalloy | &(partition 2 (range 10)) |
| 01:12 | lazybot | ⇒ ((0 1) (2 3) (4 5) (6 7) (8 9)) |
| 01:13 | kenneth | oh shit. is there a way to do the opposite? split the collection in 10? |
| 01:13 | kenneth | also, here's what i'm doing: https://gist.github.com/df78a51e447c3a7f80bf |
| 01:13 | amalloy | well, one option would be to transpose the partitions: ##(apply map vector (partition 2 (range 10))) |
| 01:13 | lazybot | ⇒ ([0 2 4 6 8] [1 3 5 7 9]) |
| 01:14 | amalloy | that gets them out of order, of course, and has serious issues with incomplete partitions |
| 01:14 | kenneth | i see, then that's probably a little dangerous for a lazy partition with 140M items |
| 01:14 | amalloy | if i wanted to do this, i'd use https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L51 |
| 01:15 | amalloy | but you can't split into 10 equal-sized pieces lazily, how do you know how big to make the first one? |
| 01:15 | kenneth | hmm, good question. |
| 01:16 | kenneth | maybe i'm thinking about this the wrong way |
| 01:17 | kenneth | here's my use case: i'm processing a huge file, and for each line process there's some blocking i/o (database write), so i want to run 10 at a time in parallel |
| 01:18 | amalloy | you want seque |
| 01:18 | amalloy | &(doc seque) |
| 01:18 | lazybot | ⇒ "([s] [n-or-q s]); Creates a queued seq on another (presumably lazy) seq s. The queued seq will produce a concrete seq in the background, and can get up to n items ahead of the consumer. n-or-q can be an integer n buffer size, or an instance of java.util.concurrent ... https://refheap.com/paste/2072 |
| 01:19 | amalloy | so i think your function is just (defn process-in-parallel [items] (seque 10 (map process-blocking items))) |
| 01:21 | amalloy | though i wonder how that interacts with the chunkiness of map... |
| 01:21 | kenneth | oh, sweet! i think that's what i'm looking for |
| 01:21 | kenneth | mad kudos, amalloy :) you've cracked it i think |
| 01:22 | amalloy | yeah, i think that actually doesn't work well because of map chunking though |
| 01:23 | kenneth | oh? |
| 01:23 | amalloy | i guess line-seq probably doesn't produce a chunked sequence, so you're fine |
| 01:24 | amalloy | yeah |
| 01:24 | kenneth | so unrelated question: when i run `leon run` and it's done processing, it doesn't exit |
| 01:24 | kenneth | do i need to add some kind of exit statement at the end of my -main function? |
| 01:24 | amalloy | $google lein shutdown-agents threadpool |
| 01:24 | lazybot | [Issue #455: Shutdown agents after repl is disconnected ...] https://github.com/technomancy/leiningen/issues/455 |
| 01:25 | amalloy | well, i was looking for http://stackoverflow.com/questions/8695808/clojure-program-not-exiting-when-finishing-last-statement |
| 01:36 | jblomo | ahh thank you technomancy for a repl that works after being backgrounded :) |
| 02:16 | aperiodic | muhoo: got a link for that presentation? |
| 02:22 | aperiodic | is this is his strangeloop talk? |
| 02:25 | ibdknox | it was his ClojureWest talk |
| 02:26 | aperiodic | is that up? |
| 02:26 | aperiodic | i've been kicking myself for missing that since lynaghk told me about it |
| 04:02 | xumingmingv | a simple question, what type of thing is the *Exception* in a try/catch? https://gist.github.com/2374971 |
| 04:02 | xumingmingv | not a type hint, right? |
| 04:11 | samaaron | xumingmingv: I think it's just a java class |
| 04:12 | xumingmingv | a java class in clojure? seems not so clojure.. |
| 04:14 | samaaron | xumingmingv: Clojure is a parasitic language - it needs a host, and talking directly to the host language is idiomatic |
| 04:17 | Chousuke | You should call it symbiotic rather than parasitic :P |
| 04:17 | xumingmingv | samaaron: ah, thanks. is there any other similar usage? because i see type hint a lot, like ^Exception, but directly use Exception seems rare. |
| 04:18 | samaaron | xumingmingv: I think it's a fairly special case |
| 04:18 | Chousuke | xumingmingv: the exception class is just part of catch syntax |
| 04:19 | Chousuke | you have to specify what exceptions (or throwables) you want to catch |
| 04:19 | Chousuke | a type hint just tells the compiler what class you expect a value to be, so that reflection can be avoided |
| 04:21 | aperiodic | samaaron: ping |
| 04:21 | xumingmingv | Chousuke: thanks |
| 04:22 | samaaron | aperiodic: pong |
| 04:24 | aperiodic | so, i tried the quil 1.0.0 release, and it didn't solve that weird def/defn problem i was having |
| 04:25 | samaaron | aperiodic: ok, shame - so remind me about the issue |
| 04:25 | aperiodic | samaaron: it's summed up in the gist: https://gist.github.com/2341911 |
| 04:26 | aperiodic | in one line, once i instantiate this java class, nothing i def/defn in the namespace can be cast to the core language interfaces |
| 04:27 | aperiodic | i am rewriting that processing library to make it more palatable to use in clojure, and that'll remove the weird reflection stuff that it currently does to the applet that it's passed |
| 04:28 | aperiodic | which might solve this issue, but i don't know |
| 04:28 | samaaron | yeah, i'm staring at the code right now |
| 04:31 | aperiodic | my current plan is basically just "wow, that's a weird exception i don't understand, maybe if i remove this reflection stuff i don't understand either, everything will be better?" |
| 04:32 | aperiodic | so i was hoping you might have some sort of clue as to why this is happening, cause i don't :) |
| 04:37 | samaaron | aperiodic: not that it helps, but i might restructure your code like this: https://refheap.com/paste/2075 |
| 04:38 | aperiodic | oh, that is handy |
| 04:39 | aperiodic | (set-state!, that is) |
| 04:39 | samaaron | so I wonder what SimpleOpenNI does to the applet |
| 04:39 | samaaron | aperiodic: yeah, set-state! adds applet-specific state |
| 04:39 | samaaron | you can only call it once though :-) |
| 04:41 | aperiodic | heh, fair enough |
| 04:42 | aperiodic | the source for that SimpleOpenNI class is here: https://code.google.com/p/simple-openni/source/browse/trunk/SimpleOpenNI/src/p5_src/SimpleOpenNI.java |
| 04:43 | aperiodic | the part that is unfamiliar to me is the stuff going on in getMethodRef, but it's not obvious to me why that would cause the cast exceptions |
| 04:45 | clgv | "quil kinect" sounds interesting |
| 04:46 | amalloy | aperiodic: to me it sounds like that class is probably mucking up your classloader somehow |
| 04:46 | amalloy | but i don't really know anything about a cause or a solution to that problem |
| 04:47 | amalloy | you could probably verify by doing something like printing (.getClassLoader clojure.lang.IDeref) before and after the thing that breaks it |
| 04:47 | aperiodic | clgv: it's up on github (https://github.com/aperiodic/quil-kinect), but unfortunately right now you can only get the depth image out |
| 04:48 | aperiodic | oh man, classloaders, i've heard about these |
| 04:49 | clgv | classloaders are mysterious fun when using some javalibs ^^ |
| 04:49 | amalloy | they are deep magic. hopefully that's not the real problem |
| 04:50 | samaaron | aperiodic: sorry but i'm way out of my depth here - the code you've written seems good to me, but clearly the kinect lib must be doing some strange futzing |
| 04:51 | aperiodic | samaaron: no worries! thanks for giving it the look-see |
| 04:52 | aperiodic | yeah, i'd always that i wouldn't run into a classloader issue, since that's farther down the rabbit hole than i think i want to be |
| 04:52 | aperiodic | let me see if that's actually the case here |
| 04:52 | aperiodic | s/always/always hoped/ |
| 04:57 | clgv | aperiodic: what's the exception you encounter? |
| 04:58 | aperiodic | clgv: https://gist.github.com/2341911 |
| 04:59 | clgv | aperiodic: wow thats weird |
| 05:00 | aperiodic | yeah, so it's the same classloader before and after the thing that breaks it happens |
| 05:00 | aperiodic | clgv: right? |
| 05:00 | aperiodic | that's why i've been bugging sam to take a look at it for the past few days. i'm clueless. |
| 05:01 | clgv | aperiodic: as to classloaders - is the (-> (Thread/currentThread) .getContextClassLoader) still Clojure's DynamicClassLoader after importing? |
| 05:02 | clgv | you can also check if there are uncommon changes to the classloader hierarchy via .getParent |
| 05:03 | clgv | aperiodic: the only thing that gets executed when loading should be that static-block |
| 05:05 | aperiodic | so the classloader is always "#<AppClassLoader sun.misc.Launcher$AppClassLoader@535ff48b>" |
| 05:05 | clgv | in your Clojure repl? |
| 05:05 | aperiodic | in the slimv buffer, yeah |
| 05:05 | aperiodic | even when i don't import |
| 05:05 | aperiodic | which seems... impossible |
| 05:06 | clgv | in "lein repl" and CCWs repl I get Clojure's DynamicClassLoader |
| 05:07 | aperiodic | i blame my not knowing how to use swank well at all |
| 05:07 | aperiodic | i launched a lein repl and have the dynamic classloader |
| 05:07 | aperiodic | now to import the class |
| 05:07 | clgv | and the bug as well? |
| 05:10 | aperiodic | the classloader appears to be switched after the import, but before the functions in my namespace are called by quil |
| 05:11 | aperiodic | i printed out the classloader in a top-level statement, and then before and after instantiating a SimpleOpenNI object |
| 05:11 | aperiodic | only the top-level statement prints out the dynamic class-loader |
| 05:12 | clgv | so it breaks afte the constructor of the SimpleOpenNI? |
| 05:12 | aperiodic | no |
| 05:12 | aperiodic | it's already broken by that point |
| 05:13 | clgv | System.loadLibrary shouldnt break anything, I would guess |
| 05:13 | aperiodic | well, i wonder if it's an interaction with anything quil might be doing in, say, defsketch |
| 05:14 | wei_ | what's the good way to dynamically bind based on the value of a var? e.g. (binding [(symbol test-type "config") my-config] (do stuff)) |
| 05:14 | wei_ | that ^ gives me PersistentList cannot be cast to Symbol |
| 05:15 | wei_ | is it because binding is a macro? |
| 05:15 | clgv | wei_: yeah. and it expects a symbol or destructuring form there |
| 05:18 | aperiodic | clgv: this is what i'm seeing now: https://gist.github.com/2375349 |
| 05:22 | ibdknox | Video is recorded, blog post is written. Light Table will be making its debut tomorrow :) |
| 05:23 | wei_ | would it be better to use a dynamic var for that? *config*? |
| 05:24 | clgv | aperiodic: hmmm. (setup) is called from within the quil-applet, so I think the AppClassLoader can be expected since its the one of the applet - but that is my limited knowledge about classloaders guessing here |
| 05:24 | clgv | or is it different without the import? |
| 05:26 | aperiodic | it's still the AppClassLoader without the import |
| 05:27 | aperiodic | so is processing's classloader is stomping all over clojure's? |
| 05:27 | clgv | then it's probably not the spot to investigate |
| 05:28 | aperiodic | ok |
| 05:28 | aperiodic | huh |
| 05:29 | clgv | oh. you are printing the ClassLoader of clojure.lang.IDeref not the one of the current thread inside (setup) |
| 05:29 | clgv | the one of IDeref won't change |
| 05:31 | senthil | just learned about clojurescript, seems interesting |
| 05:32 | senthil | is it just a fun side project of clojure? |
| 05:33 | clgv | senthil: no it is maintained by the clojure team on github |
| 05:34 | aperiodic | clgv: if i print the current classloader, it's always the dynamic one, regardless of whether the class has been imported or the constructor has been called |
| 05:35 | aperiodic | it definitely seems like the constructor is the cause, since if i omit it, then the class cast exception does go away |
| 05:35 | senthil | clgv: how would you rate its popularity? (i'm new to clojure and want a benchmark) |
| 05:36 | clgv | senthil: there are often development questions about it here but the project itself claims it's in an alpha stage |
| 05:37 | ibdknox | it's gaining a lot of steam |
| 05:37 | twem2 | there is quite a buzz around clojurescript |
| 05:37 | aperiodic | clgv: i should go to sleep, though. thanks for your suggestions; i hope i can bug you about this later, if it's still an issue after i remove everything that looks fishy from the constructor |
| 05:38 | clgv | aperiodic: good luck. combination of quil with kinect sounds interesting |
| 05:40 | aperiodic | yeah, i'd really like to get this working, since processing is pretty much the only code i wrote that's not clojure these days |
| 06:01 | mccraig | cemerick: i've got a case in friend i would like to behave differently : wondering about your favoured approach : i'm using interactive-form workflow, but i would like ::friend/redirect-on-auth? meta to be set false afterwards, so the handler gets called |
| 06:02 | mccraig | i'm happy to do a pull-request… maybe modify interactive-form workflow to take more config if that works for you ? |
| 06:32 | senthil | clgv: ah |
| 06:33 | senthil | clgv: thx! |
| 06:33 | clgv | senthil: and like ibdknox said ;) |
| 06:33 | Fullmoon | Am I overlooking something, or are there no named captures in clojure regular expressions? Would be lovely with deconstruction |
| 06:34 | clgv | Fullmoon: Clojure's regular expression are implemented via Java's |
| 06:38 | Fullmoon | I see... hm... then, is it possible to create a map from a vector with restructuring? Let's say a re function returns the triplet ["k=v" "k" "v"], and I want to create {k: v} via restructuring, doesn't seem to be able easily, right? |
| 06:41 | clgv | Fullmoon: there is zipmap ##(doc zipmap) |
| 06:41 | lazybot | ⇒ "([keys vals]); Returns a map with the keys mapped to the corresponding vals." |
| 06:42 | clgv | Fullmoon: e.g. (zipmap [:kv :k :v] (re-find ...)) |
| 06:56 | Fullmoon | clgv: Nice! |
| 06:58 | mccraig | cemerick: did it that way. pull request in the post |
| 07:08 | dsabanin | hi guys |
| 07:08 | dsabanin | I wonder what's the best and the simplest way to put clojure app in production? |
| 07:09 | dsabanin | I tried nohup lein trampoline run & but for some reason my noir app stops right away once I do that |
| 07:20 | samaaron | ls |
| 07:45 | cemerick | mccraig: thanks, comment added |
| 07:55 | mccraig | cemerick: oops, sorry: sent u a new pull-request |
| 08:35 | gfredericks | jure |
| 09:50 | huangjs | any chance that I can use swank with clojurescript? |
| 10:12 | Borkdude | I was wondering about macro's, is this one "idiomatic" Clojure? https://gist.github.com/2377114 |
| 10:15 | fliebel | Borkdude: Looks fine, although I always forget what stuff like ~' does. |
| 10:16 | Borkdude | fliebel: I want literaly the symbol args, and not a qualified symbol |
| 10:16 | fliebel | Maybe that should be a gensym instead? I forgot the syntax for that too, I think it's symbol# |
| 10:16 | Borkdude | fliebel, yes how? |
| 10:16 | fliebel | &`(foo bar#) |
| 10:16 | lazybot | ⇒ (clojure.core/foo bar__6687__auto__) |
| 10:17 | Borkdude | ah tnx |
| 10:17 | Borkdude | https://gist.github.com/2377114 |
| 10:18 | fliebel | Borkdude: Why define an adder in the first place?? |
| 10:18 | lazybot | fliebel: What are you, crazy? Of course not! |
| 10:18 | Borkdude | fliebel: good question, I just want an example of a customly defined macro, instead of showing one that's already present in clojure |
| 10:18 | Borkdude | fliebel: to show to students, but I can't think of a good example right now |
| 10:18 | fdaoud | define an adder? |
| 10:18 | fliebel | Borkdude: If you want to over-engineer things, you should first define adder as a function, and the def-adder as a macro. |
| 10:19 | fliebel | I don't know, maybe?? |
| 10:19 | lazybot | fliebel: What are you, crazy? Of course not! |
| 10:19 | Borkdude | fliebel: don't undestand your suggestion |
| 10:19 | fdaoud | anything with two question marks?? |
| 10:19 | lazybot | fdaoud: What are you, crazy? Of course not! |
| 10:19 | Borkdude | ?? |
| 10:19 | lazybot | Borkdude: Uh, no. Why would you even ask? |
| 10:20 | Borkdude | fliebel: Any suggestions for a different macro that is not too difficult to understand, welcome. |
| 10:23 | fliebel | Borkdude: I improved that for you :D https://gist.github.com/2377174 |
| 10:24 | fliebel | Borkdude: I think some control flow is very powerful. |
| 10:25 | Fullmoon | What is the function that returns for (1 2 3) (a b c) all combinations? I mean 1a 1b 1c 2a 2b 2c.. ? |
| 10:26 | fliebel | Fullmoon: Woudl a for loop do? ##(for [l '[a b c] n [1 2 3]] (str l n)) |
| 10:26 | lazybot | ⇒ ("a1" "a2" "a3" "b1" "b2" "b3" "c1" "c2" "c3") |
| 10:26 | pbalduino | morning |
| 10:28 | Borkdude | fliebel: tnx. |
| 10:28 | Fullmoon | fliebel: Sure, but I could swear that there was a function that did just that.. or was that in Haskell perhaps.. hm |
| 10:28 | Borkdude | fliebel: what about this one, https://gist.github.com/2377228 |
| 10:28 | fliebel | Borkdude: nice... |
| 10:29 | fliebel | Fullmoon: Maybe it was called permuations, and lived in contrib. |
| 10:29 | jkkramer | Fullmoon: there's https://github.com/clojure/math.combinatorics |
| 10:29 | babilen | Fullmoon: Something like lazy-cross from https://github.com/flatland/useful/blob/develop/src/useful/seq.clj ? |
| 10:29 | babilen | Fullmoon: (or just cross if you don't need lazyness) |
| 10:30 | Fullmoon | Ah interesting, thanks |
| 10:30 | fliebel | Borkdude: You could go full ruby style. There was this aprils fool joke, with had all these different if statements, to read like english. |
| 10:31 | TimMc | never go full ruby |
| 10:32 | S11001001 | a version of let that provides setq for each binding |
| 10:33 | fliebel | TimMc: As an example of how to define things like whenever and notwithstanding in Clojure ;) |
| 10:33 | Borkdude | fliebel: do you have a link? |
| 10:33 | fliebel | $doc setq |
| 10:33 | fliebel | Borkdude: I'm googling. Was on HN. |
| 10:34 | S11001001 | fliebel: http://www.xach.com/clhs?q=setq |
| 10:36 | fliebel | Borkdude: Found! http://nathan.ca/2012/04/introducing-sdfry-the-modern-programming-language/ |
| 10:37 | Borkdude | fliebel: tnx :) |
| 10:38 | fliebel | (assuming (= 1 2) (+ 2 2)) => ??? |
| 10:38 | lazybot | fliebel: How could that be wrong? |
| 10:40 | pbalduino | fliebel: have you any code sample of this sdfry? |
| 10:40 | fdaoud | I guess lazybot doesn't like multiple question marks, right?? |
| 10:40 | lazybot | fdaoud: Uh, no. Why would you even ask? |
| 10:41 | fliebel | pbalduino: Look at the publishing dat |
| 10:41 | timvisher | hey folks |
| 10:41 | pbalduino | fliebel: thx ;-) |
| 10:42 | timvisher | could anyone point me to why the haskell folks consider full currying vs. partial applicability to be important? |
| 10:43 | fliebel | Borkdude: You could implement prolog! (def foo 2) (def foo 3) => No |
| 10:44 | Borkdude | fliebel: haha, then I would first have to explain prolog to them |
| 10:45 | fliebel | Borkdude: Prolog is just a programming language that talks back to you, and has a soul. |
| 10:45 | Borkdude | logic doesn't have soul |
| 10:46 | fliebel | Borkdude: Then how do we explain that robots in storage stand together, instead of where we left them? ;) |
| 10:46 | Borkdude | fliebel: lol |
| 10:46 | Borkdude | fliebel: maybe because of magnetic forces? |
| 10:47 | clgv | fliebel: "I Robot"? ;) |
| 10:47 | S11001001 | timvisher: because point-free programming is cool, and calling partial over and over is tedious |
| 10:48 | Borkdude | fliebel: clgc I actually have that Asimov book here, but I never read it |
| 10:48 | fliebel | Can someone point me to the difference between the two itseld? |
| 10:53 | fliebel | ah http://stackoverflow.com/questions/218025/what-is-the-difference-between-currying-and-partial-application |
| 10:54 | fliebel | Hey, that'd be nice for a macro. exploding a function to pieces, and the stick it back together again. |
| 11:03 | ibdknox | And here it is! http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept/ |
| 11:04 | TimMc | Blah, can't play the video. |
| 11:04 | ibdknox | aw |
| 11:04 | ibdknox | that's the best part! |
| 11:04 | TimMc | Not your fault, Adobe's. |
| 11:05 | ibdknox | ah |
| 11:05 | ibdknox | Can a few kind souls vote the HN post up from here: http://news.ycombinator.com/newest |
| 11:05 | ibdknox | I have it on good authority what activates the voting ring nonsense is the direct link |
| 11:05 | ibdknox | TimMc: I added lots of pictures! |
| 11:05 | ibdknox | TimMc: does youtube work for you? I uploaded it there too |
| 11:06 | fliebel | Borkdude: https://gist.github.com/2377464 |
| 11:09 | pandeiro | ibdknox: is there a crate/jayq syntax that lets me create and bind html elements at the same time? |
| 11:09 | ibdknox | (crate/html ...) |
| 11:09 | TimMc | I figured out the vimeo link (http://vimeo.com/40281991) but it wants me to log in to download... |
| 11:10 | Borkdude | ibdknox: I vote |
| 11:10 | Borkdude | d |
| 11:10 | ibdknox | thanks :) |
| 11:10 | ibdknox | TimMc: youtube: http://www.youtube.com/watch?v=H58-n7uldoU |
| 11:10 | pandeiro | ibdknox: sorry those will be DOM elements though right? no way to have them as jq selectors? |
| 11:10 | Borkdude | fliebel: cool |
| 11:11 | ibdknox | pandeiro: not sure I understand |
| 11:11 | ibdknox | TimMc: fwiw, everything I cover in the video is in the post too I think |
| 11:11 | Borkdude | ibdknox: it already made its way in to the @newsycombinator twitter account |
| 11:11 | pandeiro | ibdknox: me neither :) |
| 11:11 | pandeiro | sorry let me get my throughts straight |
| 11:12 | Borkdude | gotta go, bye folks |
| 11:13 | scriptor | hah, I was just about to paste the light table link |
| 11:13 | jimduey | ibdknox: Nice work on light table. Having a fn be the smallest unit of code rather than files is something I've wanted for a long time. |
| 11:14 | clgv | ibdknox: ah you carried on the ideas of code bubbles. interesting |
| 11:14 | ibdknox | jimduey: we built code bubbles for VS over a weekend |
| 11:14 | ibdknox | people were mostly uninterested at MS |
| 11:14 | jimduey | You did code bubbles? I thought that was a great idea. |
| 11:14 | ibdknox | they saw value in the debugging case, but not much else |
| 11:14 | ibdknox | ah, no some guy from brown did the original in Eclipse |
| 11:15 | ibdknox | the day after it came out, I got a few of our devs together and made it happen for VS :) |
| 11:15 | clgv | ibdknox: is that "Light Table" running in a browser for ClojureScript only? |
| 11:15 | ibdknox | that was a neat little project |
| 11:15 | ibdknox | clgv: actually it's JVM clojure |
| 11:15 | scriptor | damn, the real-time evaluation think seems really slick |
| 11:16 | TimMc | ibdknox: thanks |
| 11:16 | clgv | ibdknox: but the rendered game is cljs? |
| 11:16 | ibdknox | clgv: ah yeah |
| 11:17 | ibdknox | TimMc: didn't you post stuff on reddit last time? |
| 11:17 | TimMc | yeah |
| 11:17 | clgv | ibdknox: you have the running demo as a github project, I guess? |
| 11:17 | ibdknox | clgv: I haven't released the code |
| 11:17 | ibdknox | I'm not sure what to do about it quite yet |
| 11:18 | ibdknox | my prototype is decently robust, but it has a lot of rough edges and isn't necessarily that useful in practice (it doesn't even let you save :) |
| 11:18 | clgv | ibdknox: oh ok. a live testing would have been great ;) |
| 11:18 | timvisher | S11001001: recommend anything i could read on point-free programming? |
| 11:18 | ibdknox | clgv: I agree, unfortunately, trying to put that on the internet would be a disaster ;) |
| 11:19 | clgv | ibdknox: maybe in some months ;)= |
| 11:19 | TimMc | ibdknox: Yes, and I'll probably post this one as well unless someone beats me to it. |
| 11:19 | ibdknox | TimMc: as you are far more familiar there, should you believe it merit's it - feel free to plop it on there :) |
| 11:20 | timvisher | Raynes: should tryclj.com be down? |
| 11:21 | jsabeaudry | Is there a way to have an incremental "lein uberjar" so that not everything is recompiled everytime when only 1 file changed? |
| 11:23 | S11001001 | timvisher: http://www.haskell.org/haskellwiki/Pointfree |
| 11:23 | ibdknox | lol: 880 people on the site right now |
| 11:24 | TimMc | ibdknox: It's more a matter of my internet connection and reddit both being up at the same time. :-( |
| 11:25 | ibdknox | TimMc: haha |
| 11:25 | ibdknox | the differences between HN and reddit traffic are interesting |
| 11:25 | scriptor | TimMc: tried http://www.downforeveryone.com/? |
| 11:28 | timvisher | S11001001: thanks! |
| 11:30 | scriptor | wait, is the light table demo up anywhere? |
| 11:31 | ibdknox | scriptor: couldn't put it up as a website, the world would've destroyed that server in seconds |
| 11:32 | ibdknox | plus the real-time bit of it sucks with latency |
| 11:32 | scriptor | ah, cool |
| 11:33 | hhutch | ibdknox: this is very very cool |
| 11:35 | ibdknox | hhutch: :) |
| 11:37 | ibdknox | in its completed state it would address the "getting an env set up for Clojure" issue nicely |
| 11:37 | ibdknox | you'd just download a jar, run it, and open a browser |
| 11:39 | scriptor | ibdknox: have you thought about how lein/cake integration would work? |
| 11:39 | ibdknox | I don't think you'd need to do anything special really :) |
| 11:40 | hhutch | ibdknox: so it is clj->cljs stack, I can't wait to play with it :) |
| 11:40 | ibdknox | I would just use lein like I do with vim |
| 11:40 | ibdknox | there are lots of things I didn't talk about in that post/video though |
| 11:40 | scriptor | you're a vimclojure user? |
| 11:40 | ibdknox | like the idea of having access to all of the projects on your machine |
| 11:40 | ibdknox | scriptor: yessir |
| 11:42 | Bronsa | ibdknox light table seems insananely cool. |
| 11:42 | Bronsa | *insanely |
| 11:45 | TimMc | Bronsa: insananananananana |
| 11:46 | ibdknox | lol |
| 11:46 | Bronsa | lol |
| 11:48 | dnolen | ibdknox: impressive! |
| 11:49 | ibdknox | :) |
| 11:52 | pbostrom | ibdknox, I'll add to the chorus that this is indeed awesome. You're a pretty prolific dev, just curious, when do you find time to get all this stuff done? 20% time at work? nights and weekends? |
| 11:54 | TimMc | ibdknox: Got a question for you over on the reddit page: http://www.reddit.com/r/programming/comments/s80qs/_/ |
| 11:54 | scriptor | time machine |
| 11:54 | ibdknox | TimMc: just answered :) |
| 11:54 | TimMc | That fast! |
| 11:55 | ibdknox | pbostrom: it was nights and weekends until fairly recently :) |
| 11:59 | ibdknox | wow |
| 12:00 | dnolen | ibdknox: ? |
| 12:00 | ibdknox | 200+ points in an hour - didn't expect that |
| 12:01 | lynaghk | ibdknox: if you think that's a lot of points, you should try pinball =P |
| 12:01 | ibdknox | hahaha |
| 12:01 | ibdknox | I *love* pinball |
| 12:02 | dnolen | ibdknox: haha, it's a pretty sick video - definitely something that resonates - our tools could be way better. |
| 12:02 | autodidakto | Oooo, ooo, wutcha playin? |
| 12:02 | devn | ibdknox: i want light table. i want it so bad. |
| 12:03 | devn | ibdknox: awesome work man. |
| 12:03 | hoeck1 | and the top comment is of course: 'the smalltalk guys did this stuff back in the 80ties' |
| 12:03 | scriptor | of course |
| 12:03 | autodidakto | That's what she said |
| 12:03 | scriptor | I guess this is how normal programmers feel when the top comment is about lisp doing it already |
| 12:04 | hoeck1 | I'm wondering if such environments will succeed this time (hoping so) |
| 12:04 | dnolen | hoeck1: sometimes it takes a long time for old ideas to really catch on. |
| 12:04 | dnolen | hoeck1: at JSConf I presented right before Dan Ingalls. It was a Lisp Smalltalk double whammy. |
| 12:04 | autodidakto | dnolen: link! |
| 12:05 | dnolen | autodidakto: whenever JSConf releases the videos |
| 12:05 | autodidakto | gotcha |
| 12:05 | hoeck1 | dnolen: maybe, also the hardware is way better now than 20 years ago, big screens and such |
| 12:06 | dnolen | hoeck1: heh, that too. GCs come a long way, people actually know how to make dynamic languages fast at runtime, etc. |
| 12:07 | ibdknox | we needed a lot of things to happen before something like this could come into being and actually catch on, I think |
| 12:07 | ibdknox | we needed more programmers and bigger programs, for one thing |
| 12:08 | scriptor | would this eventually be a stand-alone editor or be integrated into existing stuff? |
| 12:08 | hoeck1 | ibdknox: would you use a lib to render clojure datastructures directly to html, for example in order to render the code in lighttable? |
| 12:09 | hoeck1 | If shuch a thing would exist? |
| 12:09 | lynaghk | ibdknox: I think there's a lot of value for something like LightBox in just debugging and exploring other people's code. When I was diving into core.logic a while back I would have loved to just see a visual trace of the execution paths and values. |
| 12:09 | autodidakto | dnolen: which video were you talking about just now? |
| 12:09 | ibdknox | scriptor: I'm not sure how it could be integrated, putting it *in* something kind of defeats the point |
| 12:09 | ibdknox | hoeck1: not sure I understand, like to show results? |
| 12:10 | ibdknox | I have a little ipad prototype that lets you drag things around and code - it does something sort of like that |
| 12:10 | dnolen | autodidakto: my Lisp presentation at JSConf, and Dan Ingall's far, far superior one on Lively Kernel. |
| 12:10 | scriptor | true, I was trying to think of any editor that could let you completely change its behavior like that |
| 12:10 | ibdknox | lynaghk: totally |
| 12:10 | muhoo | is "lein cljsbuild auto" required in order to use cljs-template built projects? |
| 12:10 | ibdknox | muhoo: no |
| 12:10 | devn | ibdknox: everyone in the office is saying "minority report" |
| 12:11 | devn | i dont want that necessarily, but fwiw, that seems to be a common response to seeing it |
| 12:11 | dnolen | lynaghk: one dream I've had for a long time - a tracer that can graphically show the core.logic search nodes. Mozart/Oz has this. |
| 12:12 | lynaghk | dnolen: the thing that scared me away from that project is getting the data/internals. If we can figure out a nice way to do that for core.logic traces or general clojure execution debugging, I'd be happy to kick together some UIs. |
| 12:12 | ibdknox | devn: haha, a bit :) |
| 12:13 | dnolen | lynaghk: that would be beautiful. |
| 12:13 | hoeck1 | ibdknox: http://pastehtml.com/view/bun1zr4o7.html |
| 12:13 | dnolen | lynaghk: I just need to think some about how to get the hooks in there. |
| 12:14 | lynaghk | dnolen: Sure. Maybe in a month I'll take a week or two off and go on holiday somewhere to hack on funsies projects only. |
| 12:14 | hoeck1 | ibdknox: needs more work, currently a dead and unreleased project |
| 12:14 | ibdknox | gah |
| 12:14 | ibdknox | does anyone remember how to make lists in HN markup? |
| 12:14 | ibdknox | I seem to have done it wrong |
| 12:14 | ibdknox | lol |
| 12:16 | wink | wow, |
| 12:16 | wink | that looks ace |
| 12:20 | cemerick | ibdknox: nice presentation :-) |
| 12:21 | ibdknox | cemerick: you should've seen me, I was doing the voiceovers and at the very end iMovie adjusted all my clip lengths - I didn't notice until about halfway through. Not a happy camper. Hopefully I don't sound angry in the last few clips lol |
| 12:22 | lynaghk | ibdknox: have you tried ScreenFlow? |
| 12:22 | cemerick | ibdknox: seriously, screenflow :-) |
| 12:22 | lynaghk | It's $100, but it's an AWESOME piece of screencasting software |
| 12:22 | ibdknox | I haven't |
| 12:22 | ibdknox | oh |
| 12:22 | ibdknox | hm |
| 12:22 | ibdknox | might need to look into that then |
| 12:22 | lynaghk | and since you're killing it on HN every few weeks now, might be worth it |
| 12:23 | cemerick | ibdknox: does lighttable mean I'm 5 days further away from medical record salvation? ;-) |
| 12:25 | ibdknox | cemerick: yeah... got distracted. Though for good reason - needed some time to think. A YC company magically appeared doing the same thing, so had to figure out what course corrections needed to happen :) |
| 12:25 | cemerick | Huh. Well, don't be swayed just by the brand. |
| 12:26 | ibdknox | not at all |
| 12:26 | ibdknox | the problem is they have a serious head start |
| 12:26 | ibdknox | I think I've come up with a clever way to win though :) |
| 12:26 | ibdknox | Same problem, just a different way to get there |
| 12:26 | cemerick | good :-) |
| 12:29 | ibdknox | lol I was actually worried I didn't do a good job selling it |
| 12:30 | ibdknox | in the video at least |
| 12:30 | ibdknox | I kind of glossed over the last bit, which I think is by far the most interesting |
| 12:31 | dnolen | ibdknox: you could probably do a KickStarter for LightTable and retire. |
| 12:31 | ibdknox | lol |
| 12:31 | RickInGA | ibdknox: don't listen to dnolen, you should never retire, just keep building things for the rest of us to use |
| 12:31 | wink | only if it's not clojure-only though :P |
| 12:31 | ibdknox | I thought about it, but I'm not sure. What people don't know (and probably isn't that apparent) is that implementation isn't necessarily that interesting to me |
| 12:32 | ibdknox | wink: I'd build it for JS |
| 12:32 | wink | :( |
| 12:32 | ibdknox | that's easily worth millions done correctly - VS was a billion dollar business :) |
| 12:32 | wink | ok, JS means money, but doesn't make me happy :P |
| 12:32 | ibdknox | haha |
| 12:32 | ibdknox | me neither :p |
| 12:32 | ibdknox | I'm really a designer by trade |
| 12:33 | wink | ibdknox: you just reused noir's CSS, right? :P |
| 12:33 | lynaghk | ibdknox: your coding hobby seems to be working out |
| 12:33 | ibdknox | not graphic, but in general - the design of things, whether they be code, interfaces, products, whatever |
| 12:33 | ibdknox | that's what's interesting to me |
| 12:33 | ibdknox | wink: every damn time ;) |
| 12:34 | wink | unique enough to instantly recognize it |
| 12:34 | lynaghk | ibdknox: have you met Bret Victor? That was the impression I got from reading his stuff, Magic Ink in particular. That's up there with Tufte, in my book. |
| 12:34 | muhoo | ibdknox: if you don't like implementation, there's enough money in this for you to hire a team to do that part |
| 12:35 | ibdknox | lynaghk: I haven't, though I probably should. I think he's the closest example to a person I'd like to be like |
| 12:35 | ibdknox | it's one of the reasons I want to make sure I end up at StrangeLoop |
| 12:35 | muhoo | but then you'd be stuck doing icky business crap, not necessarily fun. |
| 12:36 | lynaghk | ibdknox: yeah, I feel similarly. We'll have to get him to spill the beans on all the secret cool stuff he must have worked on in Apple R&D. |
| 12:36 | ibdknox | yeah :D |
| 12:37 | wkmanire | ibdknox: I'm watching your presentation. Neat ideas. |
| 12:37 | cemerick | muhoo: the business crap *is* the fun part a lot of the time for some of us ;-) |
| 12:38 | wkmanire | ibdknox: I'm always hesitant to mess with new IDEs because I'm addicted to emacs keybindings. Namely for movement, "copy and paste", deleting lines etc... |
| 12:38 | dnolen | ibdknox: you should definitely try to get into StrangeLoop, I wouldn't sell your talk as ClojureScript specific. I think you have a lot to say - Clojure/Script just made implementing it easy (though that's worth mentioning) |
| 12:38 | wkmanire | ibdknox: Even IDEs that have emacs keybindings always fall short in that regard, for me at least. |
| 12:39 | muhoo | cemerick: it takes a special kind of person to actually enjoy dealing with vc's, making pitches, managing people, dealing with accounting stuff, hiring, interviewing, dealing with lawyers, dealing with the press, etc. |
| 12:40 | dnolen | ibdknox: ahaha https://twitter.com/tlberglund/status/190839949921234944 |
| 12:40 | RickInGA | ibdknox: does light table do macro expansion? |
| 12:40 | lynaghk | muhoo: that's *startup* crap. Good business is just meeting people, convincing them you can solve their problems, and then high fiving and taking their money |
| 12:40 | RickInGA | dnolen: haha |
| 12:41 | rickbeerendonk | lynaghk is right :) |
| 12:41 | muhoo | lynaghk: true, but if you were starting up a company to make a new ide, that'd be your life for 5 years or so |
| 12:42 | ibdknox | dnolen: lolol |
| 12:42 | muhoo | or more if it succeeds |
| 12:46 | ibdknox | RickInGA: not a visual of it, though it could be added in |
| 12:46 | ibdknox | I haven't decided what I'm going to do with this yet, but if I ultimately carried it forward, I'd write it in such a way that new elements for the canvas could be really easily added |
| 12:47 | ibdknox | there's lots I didn't talk about in that post and they'd require some interesting extensibility mechanisms to make them possible |
| 12:50 | pandeiro | ibdknox: do you use any additional abstraction on top of jayq/js for custom events? |
| 12:50 | ibdknox | nope |
| 12:51 | pandeiro | so your webapps follow the controller-less noir approach? |
| 12:51 | pandeiro | sorry i mean client-side apps |
| 12:55 | ibdknox | yeah, I mostly use statemachines and such |
| 12:56 | mrb_bk | dnolen: fucking with cljs today |
| 12:56 | dnolen | mrb_bk: sweet! |
| 12:57 | mrb_bk | dnolen: yeah it's "hack day" here, playing with a client side parser for a quick NLP experiment |
| 12:57 | dnolen | mrb_bk: nice, it's still pretty wild west - you're a brave soul. |
| 12:58 | mrb_bk | dnolen: i ain't scurred |
| 12:59 | mrb_bk | actually i'm a little scurred |
| 13:00 | dnolen | mrb_bk: ha, thought so. |
| 13:00 | RickInGA | ibdknox: sorry for slow response, 2 yr. old nephew visiting the office today... re:macro expasion, I was thinking of your function that showed the functions that were called and the values they were passed, might apply to macros too |
| 13:00 | gfredericks | my group is having spooki issues with the compiler crashing while trying to read input files |
| 13:00 | ibdknox | RickInGA: totally could make it happen |
| 13:02 | pandeiro | ibdknox: i think the answer to my unclear questions earlier about crate/jayq lies in jayq.core/->selector ... hadn't really understood that until now, that's why i was doing weird things with partials and on/delegate/etc |
| 13:12 | sadger | hello clojarians or whatever the term is. I'm trying to get started with clojure and vim any suggestions the best way to integrate with using a repl, i tried some clojure-vim plugins that use the nailgun server but they seem a little outdated especially when using the contrib since it has been split up |
| 13:19 | dnolen | sadger: there's a few VIM users have you looked at the getting started confluence pages for vim? |
| 13:19 | sattvik | sadger: Well, there are two major options: VimClojure, which uses nailgun and is maintained, and SLIMV, which uses the same swank-clojure back-end as does Emacs. |
| 13:20 | sadger | do you have a link dnolen ? |
| 13:21 | dnolen | sadger: http://dev.clojure.org/display/doc/Getting+Started+with+Vim, comments seem informative |
| 13:21 | sadger | thank you |
| 13:22 | sadger | perhaps my issue was not with the nailgun server but how I can use the latest contrib with nailgun |
| 13:22 | dnolen | ibdknox: it looks like you're well on way to doubling your HN karma w/in 24 hours ;) |
| 13:22 | sadger | from what I understand you add the jars to the classpath of the nailgun server and it can then use them in the repl |
| 13:22 | ibdknox | lol |
| 13:23 | wkmanire | How can I pull the doc string of a function from the REPL? |
| 13:23 | dnolen | sadger: sadly can't offer more help - I used Emacs & Sublime Text 2 for my Clojuring. |
| 13:23 | sattvik | sadger: Are you using Leiningen? That's probably the easiest way to deal with the classpath issues. |
| 13:23 | ibdknox | dnolen: I'm still surprised to be honest - I figured people would see Clojure and be like "meh, doesn't work for me" |
| 13:23 | sadger | dnolen: emacs is the devil! ha ha, thanks anyway |
| 13:24 | ibdknox | sadger: https://github.com/ibdknox/lein-nailgun |
| 13:24 | sadger | sattvik: Not at the moment, I think I used an old way to install clojure, just run the jar etc, so then nailgun didnt work because of that |
| 13:24 | ibdknox | sadger: run that in any leiningen project, it will include all your classpath and such for you |
| 13:24 | ibdknox | and you'll be good to go |
| 13:24 | wkmanire | nvm |
| 13:24 | wkmanire | doc |
| 13:24 | jkrueger | i have successfully migrated people to emacs with one of the vi modes |
| 13:25 | sadger | right ok I will have a look at this later on this evening, appreciate your help guys |
| 13:25 | sadger | jkrueger: vi mode isn't vim though! |
| 13:25 | ibdknox | For those interested, there have been approximately 17,000 uniques to the site. Hovering at a constant 850 +/- 50 people since I posted it |
| 13:25 | ibdknox | it has been a little over 2 hours |
| 13:25 | RickInGA | sadger: all clojure getting started instructions should begin "install leiningen" |
| 13:26 | sadger | RickInGA: I will probably learn that shortly, from what I gather it just used to be run from the jar |
| 13:26 | dnolen | ibdknox: nice. btw, if we can get this column stuff into 1.5, we should push to adapt the CLJS analyzer for that and make it a real stand alone contrib lib. |
| 13:26 | sadger | But appreciate the help guys I will go make some dinner and be back and fix it perhaps :) |
| 13:27 | sattvik | ibdknox: Is that the best/most maintained version of lein-nailgun? It's actually kind of confusing to figure out which version is the one to use. |
| 13:27 | ibdknox | dnolen: I agree, I didn't want to take the time to do that quite yet, but absolutely. We'd need to change a couple things (the names of functions have . prepended) |
| 13:27 | ibdknox | sattvik: I use Clojure all the time and I only use VIM (for now), so it's a decent bet :) |
| 13:28 | RickInGA | ibdknox: you may be diehard vim for now, but if that guy that's working on it ever finishes lightbox, I bet even you will switch |
| 13:29 | sadger | RickInGA: I saw that it looks pretty, vim all the way |
| 13:29 | ibdknox | RickInGA: I dunno, not really a fan of the guy to be honest. ;) And I would totally add vimbindings |
| 13:29 | sadger | ibdknox: do you use pentadactyl or vimperator? |
| 13:29 | jimduey | ibdknox: That bodes well for having VIM keybindings in light table. |
| 13:29 | sadger | integrate vim as the editor |
| 13:29 | sadger | sorted |
| 13:29 | sadger | :) |
| 13:29 | ibdknox | sadger: vim's UI layer isn't powerful enough |
| 13:30 | ibdknox | jimduey: there's actually a vim plugin for codemirror |
| 13:30 | ibdknox | and emacs one too |
| 13:30 | sadger | sattvik: aww |
| 13:30 | sadger | ooops |
| 13:30 | sadger | wrong person damn autocomplete |
| 13:30 | ibdknox | I'm sure with some more work they could be dramatically improved :) |
| 13:30 | sadger | and so they should be, I have seen sort of vim embedded in eclipse |
| 13:31 | sadger | basically gvim stripped of the bars |
| 13:31 | scriptor | the bars? |
| 13:31 | sadger | toolbars |
| 13:31 | sadger | that you can remove anyway |
| 13:31 | scriptor | ah |
| 13:31 | scriptor | so, like vim in a console? |
| 13:32 | sadger | yeah essentially just the pane where you edit text in eclipse is vim |
| 13:32 | sadger | but you lose all the eclipse mouseover and completion etc |
| 13:32 | sadger | so |
| 13:32 | sadger | not really worth it |
| 13:32 | sadger | a better plugin just adds vim keystrokes |
| 13:40 | dnolen | ibdknox: heh some heavyweights retweeting Light Table, just saw one from Ajaxian founder then retweeted by Paul Irish from Google. |
| 13:40 | ibdknox | dnolen: I suck at twitter |
| 13:40 | ibdknox | Don't even really know how to figure that out in a reasonable manner |
| 13:40 | ibdknox | lol |
| 13:40 | ibdknox | I just look through everything every once in a while |
| 13:41 | scriptor | it's getting several tweets a minute |
| 13:41 | dnolen | ibdknox: between Paul Irish & Dion Almaer that's showing up in like 50,000 twitter streams. |
| 13:41 | ibdknox | sweet :D |
| 13:42 | ibdknox | I guess we can call it viral :) It's staying at over 1000 people now |
| 13:42 | ibdknox | hopefully we'll get some new Clojure devs! |
| 13:44 | scriptor | shoulda plugged the irc channel! |
| 13:44 | pandeiro | ibdknox: i think you took down vimeo too or something b/c i still can't watch the demo |
| 13:44 | scriptor | although it'd just be a stream of people joining and asking for the demo/source |
| 13:44 | scriptor | video works fine for me |
| 13:45 | pandeiro | huh lemme try firefox |
| 13:45 | scriptor | hmm, using chrome on osx 10.6.something |
| 13:45 | scriptor | here |
| 13:45 | pandeiro | oops i forgot i didn't have flash installed :) |
| 13:45 | pandeiro | just set up this OS |
| 13:46 | pandeiro | i thought chromium had flash builtin though |
| 13:46 | scriptor | don't think so |
| 13:47 | pandeiro | how many more years til youtube and vimeo & co will be embeddable with video tags? |
| 13:48 | dnolen | ibdknox: haha, did you have a chat with al3x about Clojure? |
| 13:48 | ibdknox | yeah at ClojureWest |
| 13:49 | ibdknox | I told him fundamentally there are two differences, one that matters short term and one that matters long term |
| 13:49 | ibdknox | short - overall complexity of the language is much lower (the book for Scala is huge) |
| 13:49 | ibdknox | long - you simply can't create the same level of abstraction in Scala |
| 13:50 | ibdknox | the latter is by far the most important, because that's all programming is |
| 13:53 | ibdknox | dnolen: ^ |
| 13:54 | ibdknox | He seemed to really like our community |
| 13:55 | irc2samus | hi guys, why does partition and partition-all return an infinite list of empty lists when you pass zero as argument? |
| 13:55 | irc2samus | I mean, I understand the idea of "if you partition on chucks of zero elements..." but isn't it useless? and dangerous |
| 13:56 | dnolen | ibdknox: I pretty much agree w/ your analysis. |
| 13:56 | AimHere | irc2samus, it's kindof the logical behaviour, and clojure sequences are all about infinite lists of things |
| 13:56 | AimHere | It's no more dangerous than ANY use of the iterate function, for instance |
| 13:57 | RickInGA | I went to a Scala user group meeting last week, where they showed a demo of lift. Made me like Noir even more |
| 13:57 | irc2samus | AimHere: it's way different, with partition and partition-all you're not generating anything, you're splitting |
| 13:58 | AimHere | You can split up an infinite sequence with partition just as easily as a finite one |
| 13:58 | irc2samus | I suppose if you ask to partition an infinte list you'll get another infinite one, but that has nothing to do with the size of each chunk |
| 13:58 | irc2samus | in fact I would never expect to get an infinite list when partitioning a finite one |
| 13:58 | AimHere | What behaviour would you like instead, that wouldn't surprise the programmer? |
| 13:58 | irc2samus | an error |
| 13:58 | mknoszlig | irc2samus: unless the chunk size is 0 :) |
| 13:59 | irc2samus | but that's the point, partitioning by zero is an error |
| 13:59 | AimHere | It's not an error |
| 13:59 | AimHere | It's the logical behaviour |
| 13:59 | irc2samus | I don't see how that ebhaviour could be more useful that actually failing |
| 13:59 | irc2samus | no it's not |
| 14:00 | mknoszlig | irc2samus: chunk size -1 would be an error, i'd agree there ... for chunk size 0 an empty seq sounds logical... |
| 14:00 | AimHere | Sure it is. you partition your set into (/ count #{ ... } n) sets of size n; if n = 0, it's obvious what you get |
| 14:01 | irc2samus | it sounds like an error, this is programming not set theory and here if you want an infinite sequence of empty lists you'll ask for that right? |
| 14:01 | irc2samus | using this method to achieve that isn't actually useful |
| 14:01 | AimHere | (partition 0 <foo>) is one way of asking for that |
| 14:01 | irc2samus | and pretty much will happen on actual errors |
| 14:02 | irc2samus | AimHere: you're missing the point, that is not the way to do it it is instead A way to do it (now) which I find useless and dangerous |
| 14:02 | irc2samus | will you really do that in your code? |
| 14:03 | mknoszlig | irc2samus: fwiw, using -1 returns the empty list |
| 14:03 | irc2samus | my point is, it's more important to prevent possible errors that to follow philosohical reasonings about what "makes sense" |
| 14:03 | irc2samus | and also, it "makes sense" as a logical reasoning, not as a programming one |
| 14:04 | AimHere | I think not violating programmer expectations is the way to prevent possible errors |
| 14:04 | mknoszlig | irc2samus: i'd say that's a matter of opinion... |
| 14:04 | irc2samus | sure it is, but I wonder if there's actually a valid use for it |
| 14:04 | irc2samus | as for expectations, I would expect an error |
| 14:04 | AimHere | And if you keep your functions logically consistent, then it's easy to build up a fair set of expectations |
| 14:04 | AimHere | You're basing your expectations on what you get from other programming languages though |
| 14:05 | irc2samus | specially since code that generates that value might end up getting zero and that would definitely be unexpected |
| 14:05 | irc2samus | it's not about other languages, it's about a useless feature imho |
| 14:06 | irc2samus | which WIL cause bugs if you don't guard against |
| 14:06 | irc2samus | *WILL |
| 14:06 | mknoszlig | irc2samus: the utility of the feature is determined by context i'd say... |
| 14:06 | AimHere | So guard against them yourself, if you're worried |
| 14:07 | irc2samus | I would like to see an actual example of its usage |
| 14:07 | irc2samus | AimHere: you're proving my point |
| 14:07 | AimHere | Why? |
| 14:07 | clojurebot | AimHere: because you can't handle the truth! |
| 14:07 | irc2samus | (fwiw this isn't important to me, I noticed it and am curious but nothing else) |
| 14:08 | AimHere | I mean, if you've got code that barfs on an infinite stream of empty lists, you guard against it |
| 14:09 | irc2samus | AimHere: because that infinite list shouldn't be there in the first place, no one will expect that |
| 14:09 | irc2samus | not even you guys, you've reasoned it after I asked, but even the guess for -1 was incorrect |
| 14:09 | dnolen | irc2samus: there are many functions that don't validate inputs. |
| 14:09 | irc2samus | that's definitely not meeting expectations |
| 14:09 | irc2samus | it seems so |
| 14:10 | AimHere | When you asked, you stated what happened, so it's a bit unfair to accuse us of not getting it |
| 14:10 | ibdknox | dnolen: lol I just got asked if I want a phd :p |
| 14:11 | dnolen | ibdknox: HAHA |
| 14:11 | dnolen | ibdknox: why not man? |
| 14:12 | dnolen | ibdknox: hammock time on someone else's dime I say. |
| 14:12 | ibdknox | but being a student sucks :p lol |
| 14:12 | ibdknox | dnolen: that *is* true |
| 14:13 | dnolen | ibdknox: WHOA, props from Avi Bryant! |
| 14:13 | dnolen | ibdknox: you blowing up man! |
| 14:13 | dnolen | ibdknox: don't forget the small people, k? |
| 14:14 | RickInGA | ibdknox: I knew I should have gotten your autograph when I had the chance! |
| 14:14 | ibdknox | haha |
| 14:14 | ibdknox | funny what such a short amount of time can do |
| 14:33 | wkmanire | Help, newb question. (def m { :wat "wat" }). (m :wat) returns the same value as (:wat m). |
| 14:33 | wkmanire | I read that :wat is a function that looks itself up in a map. |
| 14:33 | zakwilson | Yes, that is intended behavior. |
| 14:33 | wkmanire | That made sense |
| 14:33 | wkmanire | but are maps functions that take keys? |
| 14:33 | wkmanire | as well as a data syntax? |
| 14:33 | Bronsa | yes |
| 14:33 | wkmanire | Ah... ok |
| 14:33 | wkmanire | Thanks. |
| 14:34 | zakwilson | Keywords are special here. A string key won't look itself up in a map. |
| 14:35 | jondot1 | hi all. is there any way to improve error reporting from clojure? im trying to figure out where is my error but i get a blunt stack trace |
| 14:36 | dnolen | jondot1: 1.3 has better stack traces but no tools I know of expose it. |
| 14:36 | wkmanire | zakwilson: (def m { "wat" "wat!" }). (m "wat") -> "wat!". ("wat" m) -> java.lang.ClassCastException |
| 14:36 | wkmanire | understood. |
| 14:36 | jondot1 | i see. i was wondering if there is a debug or verbose flag to turn on |
| 14:37 | zakwilson | Also, I think the compiler optimizes the keyword-as-a-function case, so (:wat m) is faster than (m :wat) |
| 14:37 | wkmanire | I sure hope my learning curve starts getting exponential pretty soon. |
| 14:37 | wkmanire | zakwilson: That's good to know. |
| 14:37 | zakwilson | It might. What's your background? |
| 14:37 | dnolen | jondot1: I suggest bugging the maintainers of the particular tool you use - better, submit a patch |
| 14:38 | wkmanire | zakwilson: OOP. |
| 14:38 | wkmanire | zakwilson: .Net, Javascript, Python etc... |
| 14:38 | jondot1 | dnolen: well currently using compojure |
| 14:38 | wkmanire | zakwilson: Very little Java |
| 14:38 | dnolen | jondot1: even better would be patch to Clojure that exposes this stuff as a rich map so tools can present whatever they want. |
| 14:39 | wkmanire | zakwilson: I'm working out of cemerick's book. |
| 14:39 | lynaghk | cemerick: I just added friend 0.4.0 to my clojure 1.3 project and am getting an unzip error. |
| 14:39 | wkmanire | I'm chomping at the bit to get the point that I can start a web app with clojure and clojurescript. |
| 14:39 | zakwilson | wkmanire: well... you have a bit to learn then. Clojure is pretty different. |
| 14:40 | wkmanire | I just watched a slide show illustrating how clojurescript uses the closure compiler in advanced comp mode. |
| 14:40 | ibdknox | wkmanire: have you looked at my overtone-ipad thing? |
| 14:40 | wkmanire | I've used google's closure before so all in all, very enticing. |
| 14:40 | ibdknox | there's a video of me building it |
| 14:40 | wkmanire | ibdknox: Have not. |
| 14:40 | ibdknox | and it's an easy project to get started with |
| 14:40 | ibdknox | even easier now that cljs-template exists |
| 14:41 | ibdknox | wkmanire: http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/ |
| 14:41 | wkmanire | ibdknox: I was just about to ask for the link. Thank you! |
| 14:43 | wkmanire | zakwilson: Functional programming is like an alien planet to me, not just clojure. I'm understanding everything I'm reading so far though. |
| 14:43 | wkmanire | This channel has been excellent at answering all of my questions too. |
| 14:44 | wkmanire | zakwilson: I have a feeling that the experience is going to be like learning chess. You learn the rules quickly but it takes a long time to get good at the game. |
| 14:44 | zakwilson | wkmanire: glad to hear it. Python, JS and many .NET languages support some degree of FP, but it's not the default paradigm. |
| 14:44 | sadger | wkmanire: I know it's probably a bit of a tangent but learn you a haskell is very good at intro level to the functional way of thinking |
| 14:44 | sadger | wkmanire: The joy of clojure has a section on thinking functionally actual |
| 14:44 | sadger | actually* |
| 14:44 | wkmanire | sadger: Yeah, I've gone through lyah once. Haskell was a bit too hardcore for my spare time. |
| 14:45 | sadger | wkmanire: get your hands on the joy of clojure |
| 14:45 | wkmanire | The plan is to get my footing with clojure and then pick up Haskell after not everything about it is differnet. |
| 14:45 | wkmanire | different* |
| 14:45 | wkmanire | to me that is. |
| 14:45 | scriptor | wkmanire: it's definitely worth a reread, but you have to go through it slowly and not just read through the whole thing in one go |
| 14:45 | AimHere | SICP has a fun way of dealing with FP. They introduce you to programming, and don't bother doing anything imperative until about page 160 or so |
| 14:46 | scriptor | one trick I found really useful was to try and implement a function when it describes one, before it shows you the source |
| 14:46 | AimHere | And even then, it's a kind of necessary evil to make some problems easier |
| 14:46 | zakwilson | Haskell is very mathy. That's not to say it isn't practical, but Clojure is entirely focused on practical concerns where Haskell is also focused on research. |
| 14:46 | wkmanire | Yeah, and I'm not a researcher. |
| 14:46 | wkmanire | I have bills to pay. |
| 14:46 | wkmanire | :D |
| 14:46 | wkmanire | I was recommended clojure by several people in #python. |
| 14:46 | zakwilson | I've written a little non-trivial Haskell. I ported most of it to Clojure. It was the right decision. |
| 14:46 | wkmanire | So far it's been great. |
| 14:46 | sadger | wkmanire: maybe they wanted rid of you :D |
| 14:46 | ibdknox | Clojure ftw |
| 14:47 | wkmanire | sadger: Probably, I babble a lot. |
| 14:47 | sadger | wkmanire: Might I suggested going to #php I hear it's great |
| 14:47 | wkmanire | But I'm (arguably) good at Python. |
| 14:47 | sadger | my typing is fail |
| 14:47 | wkmanire | Its fun being a newb again. |
| 14:47 | wkmanire | It's* |
| 14:47 | sadger | my fail typing is contagious it seems |
| 14:47 | zakwilson | Though if I wanted to transcode some structured text data, I think I might still reach for Haskell. Parsec just makes it so easy. |
| 14:47 | wkmanire | sadger: We've just met and you're already telling me to go to hell? |
| 14:47 | Wild_Cat | wkmanire: remember, #python is watching you. :p |
| 14:48 | sadger | wkmanire: in some way yes |
| 14:48 | sadger | ha ha |
| 14:48 | sadger | I jest |
| 14:48 | wkmanire | Wild_Cat: Yes, I'm sure it is. |
| 14:48 | emezeske | ibdknox: I'd just like to state for the record that, wow. (re light table). |
| 14:48 | sadger | I am a java programmer (well use it in my research) but starting with haskell and now clojure probably left haskell for the same reasons as wkmanire |
| 14:48 | ibdknox | emezeske: :) |
| 14:49 | zakwilson | ibdknox: are you making cool toys instead of working on libraries to make my life easier? |
| 14:49 | ibdknox | maybe |
| 14:49 | ibdknox | :p |
| 14:49 | zakwilson | This is not acceptable. |
| 14:49 | emezeske | zakwilson: his cool toy might also make your life easier |
| 14:49 | ibdknox | I was thinking of mocking up meteor, how about that? |
| 14:49 | RickInGA | zakwilson: he is making cool toys to make your life easier |
| 14:49 | sadger | is raynes still making a lyah style book about clojure? |
| 14:50 | ibdknox | sadger: yeah |
| 14:50 | sadger | not heard about it in ages |
| 14:50 | sadger | see I know him from dreamincode |
| 14:50 | ssideris_ | emezeske: light table? |
| 14:50 | sadger | or OF him at least |
| 14:50 | emezeske | ssideris_: Yeah |
| 14:50 | zakwilson | Oh, I see. That's a code editor. I was thinking of a homebuilt MS surface clone or some such when I heard "light table". |
| 14:51 | Wild_Cat | how do hexadecimal escape codes work in Clojure? I want a string that contains a NUL character, how do I do that? |
| 14:51 | RickInGA | I was talking to somebody the other day who wants to do Clojure on a Surface table, not sure exactly what he had in mind, but I bet it will be cool |
| 14:51 | zakwilson | This might be acceptable. I like Emacs and Slime... but it doesn't really have anything on a Lisp Machine from 30 years ago. |
| 14:52 | ibdknox | RickInGA: I have lots of thoughts there |
| 14:52 | ibdknox | if only microsoft would give me a surface... ;) |
| 14:52 | hiredman | *shrug* |
| 14:52 | RickInGA | ibdknox: actually, I think he said he was submitting a proposal to you, GSOC, his name was Eric Caspray |
| 14:52 | ibdknox | oh yeah |
| 14:52 | ibdknox | he did |
| 14:52 | hiredman | I played with a surface a little, it was not very impressive |
| 14:53 | zakwilson | I thought you could buy them. |
| 14:53 | ibdknox | hiredman: because of the software though, right |
| 14:53 | ibdknox | ? |
| 14:53 | ibdknox | zakwilson: they're like 10k |
| 14:53 | ibdknox | don't care *that* muc |
| 14:53 | hiredman | the whole thing |
| 14:53 | zakwilson | That's like two prototypes. |
| 14:53 | ibdknox | haha |
| 14:53 | hiredman | it was in a little table |
| 14:53 | zakwilson | I'm curious - did that work? |
| 14:53 | hiredman | at some the NERD cetner |
| 14:53 | hiredman | center |
| 14:53 | ibdknox | if I could have a drafting table sized surface... |
| 14:53 | ibdknox | that would be awesome |
| 14:53 | solussd | ibdknox: do you pronounce sqlkorma s-q-ljorma, or sequalkorma ? :) |
| 14:54 | solussd | *korma |
| 14:54 | ibdknox | solussd: it's just korma |
| 14:54 | solussd | crap, right. :) |
| 14:54 | ibdknox | sqlkorma only because I couldn't get korma.com :) |
| 14:54 | hiredman | but, like, I navigate and do everything via the keyboard, which lets me swizzle stuff around as good as the surface, and I can do it without looking |
| 14:54 | RickInGA | that's what you get for naming things pinot, noir and korma... already taken |
| 14:55 | wkmanire | ibdknox: http://www.internic.ma |
| 14:55 | wkmanire | The kor domain is available. |
| 14:55 | locojay | hi sry it's my first clojure day. why do i get a list of objects when doing json-str on a clojure map. |
| 14:55 | ibdknox | wkmanire: haha, not sure I care that much :) |
| 14:55 | locojay | using clojure via zmq to talk to some python code via json. |
| 14:55 | wkmanire | :D |
| 14:56 | ibdknox | hiredman: I want both. In no way would I try to replace the keyboard with it |
| 14:56 | ibdknox | hiredman: for the very things you're talking about |
| 14:56 | wkmanire | ibdknox: Besides, if you tell someone kor.ma, they're going to remember you having said "korma.com" |
| 14:56 | ibdknox | yeah |
| 14:56 | zakwilson | I rarely remember domains anymore. I google things. |
| 14:57 | zakwilson | "clojure korma" gets me what I want. |
| 14:57 | ssideris_ | wow@light table (just watched the video) |
| 14:57 | ibdknox | zakwilson: me too |
| 14:57 | ibdknox | lol |
| 14:58 | ssideris_ | so does it exist at all? |
| 14:58 | zakwilson | And now I'm looking at light table when I should be finishing learning Django. |
| 14:58 | ssideris_ | even as a prototype? |
| 14:59 | zakwilson | (and why would I do that? because it has a bunch of pre-built apps so I can get certain kinds of client work done really fast) |
| 14:59 | RickInGA | zakwilson: Django? |
| 14:59 | ssideris_ | oh it does |
| 14:59 | zakwilson | RickInGA: are you asking what it is? Why I would use it? If I'm crazy? |
| 15:00 | RickInGA | zakwilson: I am putting together a 'real quick' thing, and I am doing it in C#, becuase my clojure skills are not there yet. I already regret that decision. I want my clojre data structures! |
| 15:00 | ssideris_ | ibdknox == cgrand? |
| 15:00 | ibdknox | == chris Granger |
| 15:00 | ssideris_ | this is an amazing prototype |
| 15:01 | ssideris_ | I really really like the drafting table metaphor |
| 15:01 | zakwilson | RickInGA: I understand. I default to Clojure when it makes sense. I don't think it really does for a generic brochure website + cms + e-store. Using something already built and customizing as little as possible makes sense to me. |
| 15:01 | raek | cgrand = Christophe Grand |
| 15:01 | ssideris_ | I think it would take a lot of work to make the navigation easy for drafting tables, but it would really be worth it |
| 15:01 | ssideris_ | where do I enlist to help with this? ;-) |
| 15:02 | ibdknox | once I figure out what in the world I'm going to do with it |
| 15:02 | zakwilson | Sell it on ebay! |
| 15:02 | RickInGA | zakwilson: yeah, I think the issue is, I can still get work done in C#, I just can't enjoy it anymore :) |
| 15:02 | ibdknox | I thought it would make a splash, but I didn't expect it to drain the water from the pool :p |
| 15:02 | muhoo | never underestimate the power of a good idea, perfectly timed |
| 15:02 | zakwilson | RickInGA: I know what you mean. I felt that way last time I used Rails. |
| 15:03 | zakwilson | Every step of the way, I was thinking "this is not simple". |
| 15:03 | wkmanire | I'm reading about destructuring. (def v [1 2 3]). In the expression (let [[x _ z] v]) (+ x z)), "_" just the goto variable name for place holders or does it have a special meaning syntactically? |
| 15:03 | alexyakushev | 625 points in 3 hours for Light Table post on HN. That is pure win. |
| 15:03 | ssideris_ | ibdknox: the other obvious thing (altough I |
| 15:03 | wkmanire | is "_" just the.... |
| 15:04 | eggsby | hey light table |
| 15:04 | raek | wkmanire: it isn't treated specially |
| 15:04 | ssideris_ | ibdknox: the other obvious thing (altough I'm sure you're being bombarded with ideas) is examples from clojuredocs along with the online help |
| 15:04 | eggsby | ibdknox: is this inspird from that bret victor talk? :p |
| 15:04 | zakwilson | Oh, good. It's above "a year with mongodb". Die, mongodb, die. |
| 15:04 | raek | it's just a convention |
| 15:04 | wkmanire | raek: If it is used repeatedly is it going to be reassigned? |
| 15:04 | ibdknox | eggsby: some, more from my time on VS |
| 15:04 | raek | wkmanire: you cannot mutate local variables in clojure |
| 15:04 | wkmanire | raek: Same as destructuring (let [[x x x] v]... |
| 15:04 | wkmanire | ? |
| 15:04 | eggsby | it looks very cool either way ibdknox |
| 15:05 | wkmanire | raek: I know that. |
| 15:05 | raek | &(let [[_ _] [1 2]] _) |
| 15:05 | lazybot | ⇒ 2 |
| 15:05 | ibdknox | 30k uniques |
| 15:05 | wkmanire | lazybot gave my client a character it couldn't interpret. |
| 15:05 | muhoo | "You release an album, one you quite like, and you wake up the next morning to find the entire rock press has sewn its tongue to the back of your trousers" -- review of "OK Computer", 1997 |
| 15:05 | ibdknox | so far |
| 15:05 | solussd | ibdknox: light table looks awesome- where do you find the time for noir, korma, table table, etc ? |
| 15:06 | ssideris_ | ibdknox: and search to include clojars. with the option of loading the libs with pomegranade. I think I'm having a nerdgasm |
| 15:06 | ibdknox | still averaging 800+ |
| 15:06 | ibdknox | solussd: I'm quickly running out of it haha :) |
| 15:06 | wkmanire | raek: Ok, I've got it. Thank you for the clarification. |
| 15:06 | jondot1 | whats the correct construct to say "I want to map in parallel, but only return a subset of the mapped-on collection" ? |
| 15:07 | zakwilson | Combine pmap and filter in the appropriate manner. |
| 15:09 | jondot1 | zakwilson: you mean filter identity pmap (and return nil from pmap) ? |
| 15:09 | zakwilson | jondot1: I don't know what you're trying to do, so... maybe. |
| 15:11 | solussd | wait a tick… 1. the ability to generate or load code at runtime coupled with centralized repos (clojars/maven) and potentially runtime dependency management/fetching (reader + pomegranate)… did we give clojure programs everything they need to construct skynet? |
| 15:11 | jondot1 | zakwilson: well im validating a list of items, using pmap. however i'd like items that are not valid by definition not to appear in the result list |
| 15:11 | zakwilson | Maybe you want to filter it first. Maybe you have a big collection and you need to chunk your pmap (I wrote a library function for that - see https://github.com/zakwilson/zutil-clj) |
| 15:11 | Wild_Cat | other question: I have a string with a significant number of literal double quotes and backslashes inside it. I don't suppose Clojure supports "nicer" forms of quotation, e.g. Python's raw strings or single-quoted/triple-quoted strings? |
| 15:12 | zakwilson | So what you really want is a parallel version of filter. |
| 15:13 | wkmanire | solussd: It still doesn't have my boots, my jacket or my motorcycle. |
| 15:14 | jondot1 | zakwilson: yes |
| 15:15 | zakwilson | jondot1: (filter identity (pmap ...)) is probably the easiest route to that. Be advised that pmap doesn't work very well if the sequence is long and f is fast. |
| 15:16 | Null-A | ibdknox: are you planning to implement light table? |
| 15:16 | jondot1 | zakwilson: yes, is what i'm doing currently. hoping to verify that its good enough |
| 15:17 | zakwilson | jondot1: see my above link if you don't get a roughly linear speedup from pmap over map. |
| 15:17 | zakwilson | (specifically zpmap in util.clj) |
| 15:20 | wkmanire | Wow. This is addictive. |
| 15:20 | wkmanire | You get a piece of code you don't understand and you just start (doc foo) and re-reading. |
| 15:20 | wkmanire | eventually it makes sense. |
| 15:21 | Null-A | wkelly: clojuredocs.org |
| 15:21 | Null-A | wkmanire: * |
| 15:21 | wkmanire | Null-A: tab completion failure. |
| 15:21 | Null-A | aigh |
| 15:22 | Null-A | clojure code is actually really readable even without comments I find |
| 15:22 | wkmanire | Null-A: Perhaps if you're familiar with the different FP strategies and core library functions. |
| 15:22 | wkmanire | I know neither. he he he |
| 15:22 | wkmanire | So these docstrings are awesome |
| 15:22 | wkmanire | I wish I had a REPL like this in VB.Net land. |
| 15:23 | Null-A | FP is definitely a big learning curve |
| 15:23 | Null-A | it'll change the way you write in all programming languages |
| 15:23 | Null-A | my python looks more like clojure code now |
| 15:23 | cduffy | Is there a way to terminate a sequence generated through iterate? I notice that returning nil doesn't. |
| 15:24 | Null-A | cduffy: (take 5 (iterate inc 0)) |
| 15:24 | Null-A | it's a lazyseq |
| 15:24 | Null-A | if your logic for termination is a function, you can use take-while |
| 15:24 | jkrueger | cduffy: or in your case (take-while (complement nil?) (iterate ...)) |
| 15:26 | cduffy | Null-A: ...yar, I realize that; just seems a shame to put the burden on the consumer |
| 15:26 | Null-A | cduffy: did jkrueger's solution meet your criteria? |
| 15:27 | cduffy | Nicely. |
| 15:30 | zakwilson | wkmanire: you think (doc ...) is awesome? Try Slime. Go to a symbol, C-c C-d C-d and you have its docs in a buffer. |
| 15:31 | wkmanire | zakwilson: Does this work from an inferior-lisp buffer? |
| 15:31 | AimHere | Aha |
| 15:31 | zakwilson | Want to see where it's used? There are a bunch of cross-reference functions for that too. |
| 15:31 | AimHere | (doc ...) works from inferior lisp |
| 15:32 | AimHere | I didn't know about C-c C-d C-d until now |
| 15:32 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT> |
| 15:32 | S11001001 | AimHere: try M-. on a function name |
| 15:32 | AimHere | So I was annoyed that (doc ... ) didn't work in slime |
| 15:32 | wkmanire | zakwilson: What is slime exactly? |
| 15:32 | zakwilson | wkmanire: Slime has its own repl buffer. |
| 15:32 | wkmanire | zakwilson: I was able to install clojure-mode. |
| 15:32 | zakwilson | wkmanire: slime is... an IDE of sorts based on Emacs and the idea of talking to a running Lisp process. |
| 15:32 | AimHere | Slime is a lisp mode for emacs, able to handle multiple lisps |
| 15:32 | wkmanire | zakwilson: But I wasn't able to get the slime plugin installed. I'm unfortunately learning clojure from a windows box. |
| 15:32 | wkmanire | not slime |
| 15:32 | wkmanire | swank |
| 15:33 | AimHere | Lisp mode as in inferior-lisp, not a lisp programming mode |
| 15:33 | zakwilson | The server component is called Swank, and there's a Clojure port of that. |
| 15:33 | zakwilson | https://github.com/technomancy/swank-clojure <-- read all about it. I know nothing about using it on Windows. |
| 15:33 | lynaghk | cemerick: ping |
| 15:33 | zakwilson | I'd answer questions, but I must be off to the store before it closes. |
| 15:34 | wkmanire | zakwilson: Yeah, that won't install for me. |
| 15:34 | cemerick | lynaghk: pong |
| 15:34 | wkmanire | zakwilson: I already spoke with technomancy about it, he isn't sure why its failing either. |
| 15:34 | wkmanire | zakwilson: I'll pick your brain another day, you'll permit me that is. |
| 15:34 | wkmanire | :D |
| 15:34 | wkmanire | Have fun at the market. |
| 15:34 | wkmanire | if you'll permit me |
| 15:34 | zakwilson | wkmanire: there may be alternative ways to make it work, like using leiningen. I'll be back in half an hour or so, but I'm no expert on this. |
| 15:35 | lynaghk | cemerick: I'm just kicking the tires on friend 0.0.4. I think the credential-fn option in friend/authenticate isn't getting called. |
| 15:35 | wkmanire | zakwilson: Okeydokey. |
| 15:35 | wkmanire | My english grammar is going to hell. man. What is happening to me? I'm not just making typos, I'm literally forgetting entire words. |
| 15:35 | lynaghk | cemerick: moving the key to the first (and only) workflow works, but it doesn't get called if it's at the toplevel map. |
| 15:35 | emezeske | wkmanire: No problemo, signor. |
| 15:35 | scriptor | that's not grammar, wkmanire, :p |
| 15:36 | wkmanire | emezeske: señor? |
| 15:36 | wkelly | scriptor: case in point! |
| 15:36 | cemerick | lynaghk: Hrm, ok. Note that the app used in the lib's functional tests uses a top-level :credential-fn. |
| 15:36 | emezeske | wkmanire: Ah, si, si. |
| 15:36 | cemerick | Not that that's a bulletproof example. :-) |
| 15:37 | scriptor | wkmanire: signor is italian, I think |
| 15:37 | cemerick | lynaghk: is the usage small enough to paste? |
| 15:37 | lynaghk | cemerick: yeah, that's where I'm taking it from. If you put a "throw" in it though, everything runs fine, which suggests that it's not getting called. |
| 15:37 | cemerick | whoa |
| 15:37 | wkmanire | emezeske: Tá tentando falar em español comigo? |
| 15:37 | wkmanire | emezeske: ÇD |
| 15:38 | lynaghk | cemerick: yeah, let me whittle together a minimal example. |
| 15:38 | emezeske | wkmanire: No recuerdo mucho espanol, para quiero comprehendo tu |
| 15:39 | wkmanire | emezeske: Yeah, same here. |
| 15:39 | emezeske | ^_^ |
| 15:39 | wkmanire | emezeske: But that was portuguese, not spanish. :P Now if only I could speak clojure. |
| 15:39 | RickInGA | yo tambien |
| 15:39 | cemerick | lynaghk: FWIW, changing the :credential-fn in mock-app to this dumps all the credentials to *out* during the tests: |
| 15:39 | cemerick | (comp (partial creds/bcrypt-credential-fn users) #(do (println %) %)) |
| 15:40 | emezeske | wkmanire: I always fail at telling the difference :( |
| 15:42 | wkmanire | emezeske: Well, I made a typo in my sentence to you. It should have been espanhol. Portuguese doesn't use ñ, and as far as I know spanish doesn't use ç, or at least not often. |
| 15:42 | lynaghk | cemerick: https://refheap.com/paste/2098 |
| 15:42 | wkmanire | emezeske: But the indefinite verb forms are the same, -ir, -er, -ar, so sometimes it can be really difficult to tell if you don't understand the sentences. |
| 15:43 | cemerick | lynaghk: so what happens when you try to log in? |
| 15:43 | lynaghk | cemerick: that returns 302. If the credential-fn was actually called, it should return 500 |
| 15:44 | lynaghk | er, 400. |
| 15:47 | cemerick | lynaghk: fiddling w/ your paste now |
| 15:48 | lynaghk | cemerick: thanks. |
| 15:51 | RickInGA | I had a situation that I couldn't figure out how to solve without mutating state... I built a little slide show that showed each picture for 5 seconds and then when it got to the end, it started the loop over |
| 15:52 | RickInGA | I set a variable that had the index to display, and incremented it each time |
| 15:52 | RickInGA | I figured there was some way to do it with vector and cycle, but I wasn't sure how |
| 15:53 | lynaghk | cemerick: inside friend.clj#authenticate* the credential-fn isn't being used anywhere |
| 15:54 | lynaghk | cemerick: at least, the default you've provided isn't. Presumably the kwarg map config is getting processed downstream as part of the request. |
| 15:54 | cemerick | lynaghk: yeah, it's only used in workflows; the top-level is available via the config attached to the request via ::auth-config |
| 15:57 | cemerick | oh, hah |
| 15:58 | cemerick | lynaghk: handler/site needs to be outside of friend/authenticate; no params are being parsed out |
| 15:58 | lynaghk | cemerick: ah! |
| 15:58 | lynaghk | cemerick: yeah, I was just looking at that stuff. Thanks |
| 15:59 | cemerick | handler/site or handler/api should generally be the last bit of middleware you apply. |
| 15:59 | lynaghk | site includes file serving from public, yeah? |
| 15:59 | lynaghk | it's been a while since I've been on the, er, serverside = ) |
| 15:59 | cemerick | nope |
| 15:59 | cemerick | site ~= session, cookies, params |
| 16:00 | cemerick | api is just params |
| 16:00 | ibdknox | noir ftw :p |
| 16:01 | ibdknox | that was obligatory |
| 16:01 | cemerick | I'll bet this is going to be a common oversight. Maybe friend/authenticate should just compose in the param middlewares. |
| 16:01 | lynaghk | ibdknox: I'm actually using a noir-free fork of Fetch on this project =P |
| 16:01 | wkmanire | I have to admit, I really don't like the way certain expressions can end with "))))))". |
| 16:01 | cemerick | ibdknox: see, now you need to swap out noir's ad-hoc auth stuff :-P |
| 16:02 | wkmanire | If your editor doesn't do paren matching for you, it could be really difficult to deal with that. |
| 16:02 | gfredericks | wkmanire: well see that's where you're wrong. you DO like it. |
| 16:02 | emezeske | wkmanire: You need to have your editor match parens. Oh, and rainbow parens are helpful too. |
| 16:02 | wkmanire | emacs matches parens thanfully. |
| 16:02 | wkmanire | thankfully* |
| 16:02 | ibdknox | lynaghk: whyyyyy |
| 16:02 | gfredericks | also I think it's true that any instance of )))))) can be flattened with ->> |
| 16:03 | gfredericks | though that would probably be obnoxious |
| 16:03 | wkmanire | emezeske: rainbow parens == different color for each level of nesting? |
| 16:03 | emezeske | wkmanire: yeah |
| 16:03 | Iceland_jack | aka Lisp on acid |
| 16:03 | lynaghk | ibdknox: I wanted to use it as a super minimal API layer. All of my apps are static files |
| 16:03 | wkmanire | technomancy: I really really like your clojure-mode, and rainbowparens sound sexy.... |
| 16:03 | ibdknox | ah |
| 16:03 | wkmanire | :D |
| 16:04 | wkmanire | gfredericks: what is ->>? |
| 16:04 | gfredericks | wkmanire: a macro that, along with ->, can clean up deeply nested s-expressions |
| 16:04 | lynaghk | ibdknox: yeah. Once instant literal stuff gets sorted out in CLJS I might make a proper public fork and contribute back, if you'd be willing to take those patches. I think Fetch should work without Noir though. |
| 16:05 | gfredericks | (foo (bar baz (bang (gee (whiz (man)))))) becomes (->> (man) (whiz) (gee) (bang) (bar baz) (foo)) |
| 16:05 | jkkramer | ,(->> (range) (filter even?) (map inc) (take 5)) |
| 16:05 | clojurebot | (1 3 5 7 9) |
| 16:05 | wkmanire | gfredericks: What does that do? curry them together? |
| 16:05 | Iceland_jack | wkmanire: it's just list manipulation |
| 16:05 | gfredericks | it sticks each form at the end of the next form |
| 16:05 | wkmanire | Is this used commonly? |
| 16:05 | gfredericks | I think so |
| 16:06 | wkmanire | Is it reserved for special circumstances? |
| 16:06 | lancepantz | ibdknox: dude, i may have missed the conversation, but light table looks amazing |
| 16:06 | solussd | ibdknox: ok, so bret victor's video was inspiring, light table looks like it couple become real for clojure… so… when?! :D |
| 16:06 | lynaghk | cemerick: so basicially this app is going to have a login route and then an authorization required fetch route to serve XHR. From the CLJS I should just be able to POST to the former, and on success use the latter as usual. Does that sound reasonable? |
| 16:06 | gfredericks | wkmanire: nope; it's a macro, so it works at the syntactic level |
| 16:06 | gfredericks | the only concern is readability |
| 16:06 | cemerick | lynaghk: assuming you've got the session middleware up in front (via handler/site or otherwise), yes |
| 16:07 | lynaghk | cemerick: awesome. Thanks again for putting this library out there. I'm glad I saved this part of the project to the end, because the timing worked out = P |
| 16:08 | wkmanire | gfredericks: Thanks for the explanation. And what is ->? |
| 16:08 | gfredericks | wkmanire: inserts in the second position (first argument) instead of at the end |
| 16:08 | gfredericks | ,(-> 8 inc dec (+ 10) str) |
| 16:08 | clojurebot | "18" |
| 16:08 | gfredericks | I guess that example would do the same thing with ->> :/ |
| 16:09 | wkmanire | Wow, that knocked out most of the parens. |
| 16:09 | gfredericks | ,(-> 8 inc dec (+ 10) (str "foo")) |
| 16:09 | clojurebot | "18foo" |
| 16:09 | Iceland_jack | ,(->> 8 inc dec (+ 10) (str "foo")) |
| 16:09 | clojurebot | "foo18" |
| 16:09 | gfredericks | yeah; whenever you would have a list with a single element you can leave the list part out entirely and the macro adds it back for you |
| 16:09 | zakwilson | -> often feels like method chaining. |
| 16:10 | gfredericks | yeah |
| 16:10 | gfredericks | and ->> ends up being more useful with collections, due to the argument orders in the api |
| 16:10 | gfredericks | ,(->> [1 34 8] (map inc) (filter even?) (clojure.string/join " -- ")) |
| 16:10 | clojurebot | "2" |
| 16:11 | wkmanire | Well, I need to write some notes and then hang up clojure for the day. Otherwise I won't get anything else done. I haven't had this much fun with learning a new language in a long time. |
| 16:11 | zakwilson | I agree, and Clojure wasn't my first Lisp. |
| 16:11 | cemerick | lynaghk: Sure; ping me if you hit any further bumps. :-) |
| 16:12 | lynaghk | cemerick: will do. |
| 16:12 | lynaghk | thanks |
| 16:12 | wkmanire | How do I leave a message on the lazy bot? |
| 16:12 | wkmanire | I've forgotten. |
| 16:12 | lancepantz | paging amalloy |
| 16:12 | amalloy | $help mail |
| 16:12 | lazybot | amalloy: Send somebody a message. Takes a nickname and a message to send. Will alert the person with a notice. |
| 16:13 | wkmanire | $mail zakwilson I had to take off. Hopefully you'll be able to help me get swank working another day. |
| 16:13 | lazybot | Message saved. |
| 16:14 | wkmanire | later folks. |
| 16:15 | kasterma | I am trying to understand (some #{2} [2 3 4]), practical clojure doesn't seem to have #{} and I don't know how to google for it. |
| 16:15 | gfredericks | #{} is a set |
| 16:15 | gfredericks | clojure sets are also functions that return the argument if the argument is in the set |
| 16:16 | gfredericks | &[(#{2} 2) (#{2} 1) (#{3 4 5} 5)] |
| 16:16 | lazybot | ⇒ [2 nil 5] |
| 16:16 | kasterma | Ahh, thx, gfredericks! Explains it all. |
| 16:16 | gfredericks | (some #{2} [2 3 4]) is essentially equiv to (some #(= % 2) [2 3 4]) |
| 16:16 | gfredericks | for that purpose anyways |
| 16:17 | kasterma | That is the purpose I had, and now I realize I should have (class #{2}) |
| 16:17 | kasterma | That would have given me the answer. |
| 16:20 | lancepantz | ibdknox: will you create a lighttable channel where we can all harass you about it in the same place? |
| 16:21 | edw | technomancy: Do you know if clojure-jack-in works with lein2? |
| 16:24 | gfredericks | how do I give defaults when destructuring a map? |
| 16:24 | gfredericks | oh it's :or not :defaults I bet |
| 16:28 | Null-A | lancepantz: i harassed him first |
| 16:28 | Null-A | he still hasn't answered my question |
| 16:31 | edw | technomancy: clojure-jack-in does not work with lein2, is that correct? |
| 16:31 | Null-A | Interactive development is not realistically feasible in most languages besides clojure because you need strong support for concurrency if you're going to have one thread executing your program and another thread changing state while the program is running |
| 16:31 | llasram | edw: Works fine for me |
| 16:31 | edw | Huh. |
| 16:32 | llasram | edw: Are you using the new lein-swank plugin? |
| 16:32 | Null-A | Once this IDE gets developed, Clojure will have yet another compelling argument why to use it |
| 16:32 | edw | llasram: What is "new"? |
| 16:32 | edw | 1.5? 1.4? |
| 16:33 | llasram | Well, maybe it was just new-to-me. I was running swank-clojure with lein1, running lein-swank 1.4 now |
| 16:33 | llasram | (with lein2) |
| 16:34 | edw | OK, I'm hacking at clojure-mode.el let me configure it with a specific lein binary so I can switch between 1.7 and 2, and it's dying when I run lein2. |
| 16:34 | llasram | ? |
| 16:34 | llasram | clojure-swank-command didn't work? |
| 16:35 | llasram | Er, setting it, it being a variable and all |
| 16:36 | livingston | is there any way to get a backquoted expression to read a symbol without a namesapce short of this mess `(~'x) |
| 16:37 | gfredericks | probably not...what do you need it to "read a symbol" for? |
| 16:38 | livingston | symbols as data |
| 16:38 | dnolen | livingston: then why not '[x] ? |
| 16:38 | gfredericks | it's not easy to do because it's not normally what you want to do when defining macros, which is backquote's most common use |
| 16:39 | gfredericks | so without knowing your higher-level purpose it's hard to suggest anything else |
| 16:39 | livingston | dnolen: because I need to have some other things evaluated and spliced in with ~ and ~@ |
| 16:39 | livingston | yeah it's not for a macro, I just need to cons up some s-expressions as data |
| 16:39 | dnolen | livingston: no, there's no way to clean that up since syntax-quote is generally used for macros, and ~' is not the common case. |
| 16:40 | livingston | is there a way to specify the null or no namespace e.g. what you might expect if this was legal: /x |
| 16:41 | dnolen | livingston: not in a syntax-quoted expression. |
| 16:42 | livingston | most of my symbols are ns qualified, I just have a few "special" ones that don't need a ns, but I might have to give them one to avoid this :( |
| 16:42 | scriptor | hmm, getting some weird indenting issues with vimclojure |
| 16:42 | livingston | the reader accepts it, but is "?" a valid namespace? as in ?/x |
| 16:42 | gfredericks | livingston: maybe it'd be easier to de-qualify them with clojure.walk afterwards? |
| 16:43 | scriptor | it seems to keep adding an extra level of indentation, but only when there shouldn't be any identation at all |
| 16:43 | dnolen | livingston: the guarantees are enumerated here http://clojure.org/reader |
| 16:43 | dnolen | you can't depend on behavior not explicitly described there. |
| 16:43 | livingston | gfredericks: I can. and will if I must. I'm just trying to do as little as possible and make the reader work for me, so that I don't have something I have to maintain |
| 16:44 | gfredericks | I wonder if backquote being turned into a macro would help out this situation |
| 16:45 | livingston | so it looks like the namespace "?" is valid, as I'm reading the constraints on symbols. |
| 16:47 | livingston | this could be a huge sweeping re-write, but in the long run it might actually help a lot... *sigh* not the thing to discover friday afternoon. |
| 16:47 | gfredericks | at least it's friday the 13th |
| 16:47 | hiredman | https://github.com/hiredman/syntax-quote |
| 16:48 | gfredericks | ,(read-string "[~foo ~@bar]") |
| 16:48 | clojurebot | [(clojure.core/unquote foo) (clojure.core/unquote-splicing bar)] |
| 16:49 | gfredericks | hiredman: why do you def your own versions of those ^? |
| 16:50 | hiredman | no, I have differently named things |
| 16:50 | livingston | gfredericks: oh so it is |
| 16:51 | hiredman | and it wouldn't really matter if you did, because the current implementation of syntax quote is in the reader |
| 16:51 | hiredman | so the macroexpander wouldn't get a chance to do anything |
| 16:51 | gfredericks | the purpose is to get ` without the symbol expansion, right? |
| 16:51 | gfredericks | maybe not |
| 16:51 | gfredericks | I don't know what this is for |
| 16:51 | hiredman | ,[(clojure.core/unquote-splicing [1])] |
| 16:51 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote-splicing> |
| 16:52 | livingston | yes backtick with no symbol expansion would be ideal in this case. |
| 16:52 | gfredericks | hiredman: if the usage didn't include a literal backtick I would think it could work |
| 16:53 | gfredericks | ,'(foo ~bar ~@baz) |
| 16:53 | clojurebot | (foo (clojure.core/unquote bar) (clojure.core/unquote-splicing baz)) |
| 16:53 | gfredericks | macro just has to process that ^ |
| 16:53 | gfredericks | but again that doesn't seem to be the purpose of this lib |
| 16:54 | hiredman | the problem is expansion |
| 16:54 | hiredman | e.g. if you are just passing this through the reader macros will not get expanded |
| 16:55 | hiredman | so you may as well just write a pre processor |
| 16:55 | hiredman | which is really what you should be doing anyway |
| 16:55 | lynaghk | cemerick: woo, I have it all working now. I feel like I'm hacking around your framework and/or HTTP though---I'm using the "interactive-form" workflow with :redirect-on-auth? false (just serving "success: true" JSON on the POST /login route) and my own handler that serves "success: false" JSON on failure. |
| 16:55 | hiredman | before you actually start in on the data you scan it for pattern X and change it to pattern Y |
| 16:56 | gfredericks | I don't understand, but I don't want to bother you further about it |
| 16:57 | cemerick | lynaghk: That may be a common workflow for non-refreshing frontends, for all I know. |
| 16:57 | cemerick | You should just use HTTP codes to indicate success and failure, though. :-) |
| 16:57 | hiredman | gfredericks: are you talking to me? |
| 16:57 | gfredericks | hiredman: yes, sorry |
| 16:57 | cemerick | anyway, it's hardly hacking around HTTP or the library, though. |
| 16:58 | hiredman | the purpose of my syntax-quote is to rewrite syntax-quote as a macro so it could/can be moved out of the reader |
| 16:59 | lynaghk | cemerick: yeah, I have no idea what non-refreshing frontends do. I kind of get the impression everyone just hacks it together somehow, but I'll dig into it and see what's what. |
| 16:59 | lynaghk | cemerick: and yeah, status codes sound good. If only because they're a great excuse to look at http://httpcats.herokuapp.com/ |
| 17:00 | cemerick | that's the only way I use 'em :-) |
| 17:01 | gfredericks | hiredman: and I was talking about isolating the sexp-templating part of the functionality and trying to implement that by itself. as far as I understand things it could be done with a macro that's compatible with the unquote syntax; if that's what you were objecting to, then I don't understand why "the reader macros will not get expanded" -- everything I'm thinking of happens after read-time |
| 17:02 | kenneth | hey, so i |
| 17:03 | kenneth | so i'm working on a clojure script to process and import a massive dataset into a mongo db, and i have a simple php script that does the same thing to benchmark it against |
| 17:03 | kenneth | it runs orders of magnitude slower: the php script did 100k items in 12s, clojure has been running for 15min on 100k items and is still not done. what am i doing wrong? |
| 17:03 | kenneth | https://gist.github.com/df78a51e447c3a7f80bf |
| 17:04 | hiredman | kenneth: you are doing it sequentially |
| 17:05 | kenneth | (also couldn't figure out how to use cli params on a `lein run` so i had to hardcode the filename in the script) |
| 17:05 | kenneth | hiredman: in php i'm doing it all in one big while loop, sequentially, i even tried to parallelize in clojure using (seque 50 …) |
| 17:05 | hiredman | seque does not parallelize |
| 17:06 | hiredman | (doc seque) |
| 17:06 | clojurebot | "([s] [n-or-q s]); Creates a queued seq on another (presumably lazy) seq s. The queued seq will produce a concrete seq in the background, and can get up to n items ahead of the consumer. n-or-q can be an integer n buffer size, or an instance of java.util.concurrent BlockingQueue. Note that reading from a seque can block if the reader gets ahead of the producer." |
| 17:06 | franks42 | Need some help understanding what it would take to implement a meta-data protocol for classes/deftype... (http://dev.clojure.org/jira/browse/CLJ-304) |
| 17:07 | hiredman | kenneth: clojure.data.json is also the *slowest* clojure json library I've seen |
| 17:07 | franks42 | Is the idea to define an interface/protocol to meta-data for the java.lang.Class class and store the meta-data map in a java-annotation? |
| 17:08 | y3di | omg this granger do some cool shit again |
| 17:08 | kenneth | hiredman: i thought that that would let the new seq get ahead of the current item by 50, ie. it'd always process 50 concurrently, ie. wouldn't wait for item 1 to be finished processing before starting 50 |
| 17:08 | hiredman | kenneth: no |
| 17:10 | kenneth | hmm, crap. okay might have to revisit that, then. do you think that's why my performance is laughably bad? |
| 17:10 | franks42 | chouser: are you around? would you mind to momment on http://dev.clojure.org/jira/browse/CLJ-304 ? |
| 17:13 | septomin | so is ibdknox's thing real or just a faked demo (trollface) |
| 17:13 | hiredman | kenneth: I think mongo is junk, so who cares how fast you can write to it |
| 17:13 | dnolen | septomin: real. |
| 17:14 | dnolen | kenneth: regardless of hiredman's opinion of Mongo, it's very hard to say w/o profiling. If you can't load the data as fast as PHP something is up. |
| 17:14 | kenneth | hiredman: i quite like mongo. it can be a bitch to scale effectively. |
| 17:14 | kenneth | either way, though, mongo is not the issue in this case, since the same php script that does the same query on the same file runs 100x faster |
| 17:14 | hiredman | https://github.com/dakrone/cheshire note the SPEED section |
| 17:15 | hiredman | kenneth: if it doesn't scale well then what is the point? just use a nice sql database |
| 17:16 | hiredman | you just gave up the power of the relational model for nothing |
| 17:17 | kenneth | that's a huge controversial debate and there's good points on either side. for us, the trade off was worth it, and we've managed to scale quite effectively, even though there was some pain |
| 17:17 | hiredman | *shrug* |
| 17:18 | kenneth | but we serve > 1B requests a month on mongo effectively, so it works out alright |
| 17:18 | hiredman | so? |
| 17:18 | gfredericks | ,(/ 1000000000 (* 30.5 24 3600)) |
| 17:18 | clojurebot | 379.47783849423195 |
| 17:19 | kenneth | https://github.com/mmcgrana/clj-json -- is this a good option? |
| 17:19 | Wild_Cat | we have Mongo running 2500+ queries per second and it works out all right. |
| 17:20 | dnolen | kenneth: it uses jackson so it's pretty fast. |
| 17:21 | kenneth | ok script just finished, 13m in clojure, 12s in php |
| 17:21 | kenneth | gonna try to use the other json lib |
| 17:21 | dnolen | kenneth: you can keep trying libs or profile. |
| 17:21 | kenneth | dnolen: i have no idea how to profile clojure. do you have a link / direction? |
| 17:22 | dnolen | kenneth: http://visualvm.java.net/ |
| 17:22 | dnolen | kenneth: you can attach to the Clojure process. |
| 17:23 | dnolen | kenneth: if a sequential Clojure version doesn't take < 12s then something is wrong. |
| 17:23 | pjstadig | kenneth: you want to parse JSON on JVM Clojure? |
| 17:24 | jsabeaudry | kenneth, keep us updated, I'm still trying to figure out why ajax request on my local server take up to 200ms for trivial stuff and the JSON might play a role |
| 17:26 | dnolen | kenneth: also there's no guarantee that monger itself is tuned for perf. looks like they use clojure contrib JSON. |
| 17:34 | kenneth | ok, is there an efficient way to keep a mutable count of how many items have been processed? |
| 17:35 | dnolen | kenneth: use an atom. |
| 17:35 | cemerick | Man, this JDK 1.5 thing is getting to be a real drag. |
| 17:36 | ibdknox | what'd I miss? |
| 17:36 | cemerick | ibdknox: REPL stuffs killing on 1.6, and bombing hard on 1.5. |
| 17:37 | ibdknox | :( |
| 17:37 | ibdknox | septomin: totally fake, I'm pretty sure he has the most elaborate mirror setup you've ever seen. |
| 17:38 | dnolen | ibdknox: :P |
| 17:38 | septomin | i heard there was actually a guy in a box behind the screen, moving the variables around |
| 17:39 | ibdknox | these are not the vars you are looking for |
| 17:39 | septomin | so are you working on this "for real" then? |
| 17:40 | ibdknox | I'm not sure to be honest |
| 17:40 | ibdknox | I'm a bit surprised at the response |
| 17:40 | ibdknox | and I've got lots of interesting people to talk to it sounds like |
| 17:40 | septomin | it's just a thing that seems obvious we should have and yet don't |
| 17:41 | septomin | that tends to get people interested! |
| 17:41 | ibdknox | :) |
| 17:42 | alexyk | what's the status of incanter? I see some pull requests merged but not much activity from @liebke |
| 17:45 | kenneth | ,(deref (atom 10)) |
| 17:45 | clojurebot | 10 |
| 17:48 | raek | kenneth: it's even more efficient if you can manage to keep the count in a function parameter or a loop binding and recur |
| 17:48 | raek | but then it's not really mutable |
| 17:48 | kenneth | dnolen: hmm, visualvm seems to be a GUI app. is there anything CLI? i'm running this on a fire walled server cluster with no GUI |
| 17:49 | dnolen | kenneth: I'm only familiar with VisualVM and YourKit |
| 17:50 | arohner | kenneth: there's jconsole, which has some of the same functionality, but not a complete replacement |
| 17:50 | arohner | X forwarding is another option |
| 17:51 | amalloy | kenneth: most reasonable profilers connect to remote apps. so you probably want to forward a port through the firewall and run the gui remotely |
| 17:53 | kenneth | ok i'll give that a shot |
| 17:53 | kenneth | your kit any good? |
| 17:54 | dnolen | kenneth: your use of dorun is suspect. you probably want doseq. Your script might be thrashing in GC if it's that slow. |
| 17:54 | kenneth | (doc dorun) |
| 17:54 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil." |
| 17:54 | kenneth | (doc doseq) |
| 17:54 | clojurebot | "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil." |
| 17:55 | dnolen | kenneth: also you should start the script with the server flag set and a good amount of memory. |
| 17:57 | kenneth | (doc doall) |
| 17:57 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time." |
| 17:57 | dnolen | kenneth: https://gist.github.com/e0fb72743c3c9d94d646 |
| 17:59 | dnolen | kenneth: http://groups.google.com/group/clojure/msg/1b45c27dc4627b99 |
| 18:01 | kenneth | hmm |
| 18:01 | dnolen | kenneth: if that gist doesn't work for you after giving the JVM a reasonable amount of memory and setting the -server flag - then I'd take serious look at a profiler. |
| 18:02 | dnolen | kenneth: whenever people show up asking why Clojure is orders of magnitude slower than X it boils down to 2 things. |
| 18:02 | dnolen | 1) GC thrashing |
| 18:02 | dnolen | 2) Reflection |
| 18:02 | hiredman | (also using line-seq when you where advised against it) |
| 18:03 | pipeline | that particular example |
| 18:03 | pipeline | is one of the places old school CL implementations are good |
| 18:03 | pipeline | you never doubt how much one function implementation versus another conses in cmucl |
| 18:03 | pipeline | but we're on the jvm, so, live with jvm tools :\ |
| 18:04 | alexyk | so anybody using in canter nowadays here? |
| 18:06 | kenneth | ok, so i've got it down to executing the whole thing minus the mongo part both in clj/php. clj does it in 2.3s, php in 1.2s. seems acceptable |
| 18:07 | dnolen | kenneth: did you try CongoMongo? |
| 18:08 | kenneth | i did not, will try |
| 18:08 | hiredman | kenneth: how are you timing this? |
| 18:08 | kenneth | `time php …` |
| 18:08 | kenneth | `leon repl; (time (import-file "…"))` |
| 18:10 | dnolen | kenneth: and how are you running the Clojure? |
| 18:12 | kenneth | dnolen: what do you mean? |
| 18:12 | kenneth | also i haven't figured out how to do the server flag / set max memory yet, trying to look that up. lein doesn't like flags on the cli, and uberjar gives me a jar that exceptions out when run (can't find importer.core) |
| 18:19 | dnolen | kenneth: if you're using lein run - you're probably seeing the cost of starting JVM compiling all of Clojure and your script - then running it. so the actually time spent doing work is probably a small slice of 2.3s. |
| 18:20 | kenneth | well i'm doing (time …) in clojure in the repl |
| 18:20 | kenneth | `time lein run` is actually 7.5s or so, with 5s of start the hvm |
| 18:20 | kenneth | dnolen: ^ |
| 18:20 | dnolen | kenneth: ah k. |
| 18:27 | kenneth | congomongo doesn't seem to support upsert |
| 18:27 | kenneth | does it? |
| 18:32 | mdeboard | Is clojure-hadoop the standard lib for working with hadoop still? |
| 18:33 | amalloy | of course it does |
| 18:33 | amalloy | it's true by default iirc |
| 18:34 | jayunit100 | http://en.wikipedia.org/wiki/JSONP this makes me think about macros |
| 18:36 | jayunit100 | mdeboard : Unless your doing something complex you don't really need a custom lib for doing hadoop via clojure - i would consider using the standard lib and calling the java functions. They are easily callable from clojure b/c the m/r api is pretty simple. Alternatively, use streaming. |
| 18:36 | mdeboard | Eh I like the ease of the defjob abstraction |
| 18:37 | mdeboard | Streaming isn't an option |
| 18:45 | sritchie | mdeboard: have you used cascalog? |
| 18:45 | kenneth | if the doc says: ([collection old new {:upsert true, :multiple false, :as :clojure, :from :clojure}]) |
| 18:45 | kenneth | is the correct syntax (update! :collection {old…} {…} :upsert true) |
| 18:45 | kenneth | or (update! :collection {old…} {…} {:upsert true}) |
| 18:45 | sritchie | it's a much higher level abstraction over Hadoop |
| 18:46 | sritchie | jayunit100: even for simple stuff, it's much easier than setting all these damned formats, etc -- |
| 18:46 | sritchie | tuples and tuples |
| 18:46 | sritchie | tuples and taps, ratehr |
| 18:46 | sritchie | rather* |
| 18:46 | mdeboard | sritchie: Well, I'm just learning about Hadoop and mapreduce jobs in general. I know what Cascalog is and what it does, but I'm still fumbling around with general concepts of hadoop |
| 18:47 | sritchie | mdeboard: cascalog sort of protects you from all of that jank |
| 18:47 | sritchie | and eases you in slowly :) |
| 18:47 | sritchie | but go for it, good to get a handle on the low level |
| 18:47 | mdeboard | sritchie: In what way? |
| 18:47 | sritchie | you don't have to cast your problem in terms of manipulations of key-value pairs |
| 18:48 | sritchie | you can use tuples of multiple fields, group on those fields without writing custom comparators, etc |
| 18:48 | sritchie | it's really hard to do that stuff in MR |
| 18:48 | sritchie | also, you can use any clojure function and data structure out of the box w/ cascalog |
| 18:48 | mdeboard | Yeah, I'm trying to parse some log files as an exercise, it's kind of hurting my brain |
| 18:49 | sritchie | mdeboard: I definitely recommend cascalog for that |
| 18:49 | sritchie | got an example, 1 sec |
| 18:49 | kenneth | excellent, switching to congomongo fixes the performance issues |
| 18:49 | kenneth | i have the whole thing running in 14s, which is almost as good as php's 12s |
| 18:49 | sritchie | https://gist.github.com/7627b0c9cdf4c9e551b7 |
| 18:49 | sritchie | mdeboard: ^^ |
| 18:49 | mdeboard | I started with cascalog but it kind of seemed like I was missing something so I went for a dive into lower level stuffs |
| 18:50 | mdeboard | hm |
| 18:50 | mdeboard | huh |
| 18:50 | mdeboard | sritchie: Thanks, this is actually really helpful |
| 18:51 | sritchie | np |
| 18:51 | sritchie | happy to help w/ anything |
| 18:51 | sritchie | feel free to head over to #cascalog |
| 18:52 | bbloom | i'm going through some #clojure logs looking for a faster way to build sorted sets. in particular i found this conversation: http://clojure-log.n01se.net/date/2010-02-04.html#11:01 |
| 18:53 | bbloom | i'd like to be able to quickly save/load reasonably large sorted sets for a database-index-like operation i'm doing |
| 18:54 | bbloom | i can use transients or something when loading vectors, which is much faster, but it doesn't seem like there is an efficient way to load pre-sorted data |
| 18:56 | kenneth | if anybody can find more stuff to critique in my new code: https://gist.github.com/df78a51e447c3a7f80bf |
| 18:56 | kenneth | i have the performance to be almost as good as the equivalent php script, but not completely. i'm okay with this though |
| 18:57 | hiredman | bbloom: have you considered using an embedded sql server? |
| 18:57 | kenneth | i'd be interested in hearing if you have any ideas of how to implement parallelism / concurrency, so i can process, say, 10 lines at a time |
| 18:58 | bbloom | hiredman: nope. once my datastructures are in memory, everything is fast and simple & nice… the issue is loading a saved sorted-set is slower than i'd like |
| 19:00 | bbloom | ideally, i'd like to serialize the internal structure of the sorted-set… so that no rebalancing etc needs to happen on load |
| 19:00 | hiredman | bbloom: sure, but switching to something like derby or hsqldb (which can persist data to disk) might be easier than figuring out how to store a sorted set |
| 19:01 | jayunit100 | i want to try cascalog to we need a query language thats more dynamic than hive. |
| 19:02 | bbloom | hiredman: and bring along a lot of other stuff i don't want or need :-P |
| 19:03 | hiredman | *shrug* |
| 19:04 | gfredericks | I am using the aleph http client and having trouble when the request has a body; the effect is that the result channel gets nil enqueued for some reason |
| 19:04 | gfredericks | no explicit failure that I can tell |
| 19:09 | devn | how can I scroll to the bottom of the page using clojurescript + google closure? |
| 19:19 | dnolen | bbloom: you could re-implement PersistentTreeMap in Clojure and support that. would simplify getting that into ClojureScript as well ;) |
| 19:19 | bbloom | dnolen: haha i was just thinking about that |
| 19:20 | bbloom | i'm reading PersistentTreeMap.java |
| 19:20 | dnolen | bbloom: it's not crazy amount of code and we definitely want that in CLJS :D |
| 19:22 | bbloom | dnolen: yeah, looks like this file is 1,000 lines and doesn't have any real dependencies |
| 19:22 | wei_ | I'm sending a series of http requests, and I want to block until either I receive a response (via callback function) or 1 second has passed. what's the clojurey way to do this? |
| 19:22 | bbloom | what I really need is a way to get to the private red black tree & the private constructor which accepts such a tree node |
| 19:23 | wei_ | the callback function lives inside a proxy- so I think that complicates things a bit |
| 19:24 | bbloom | dnolen: cljs just got persistent hash maps right? no one is working on persistent tree maps? |
| 19:24 | dnolen | bbloom: so probably means 450 lines of CLJ tops ;) |
| 19:25 | dnolen | bbloom: yes mmarcyk is working on PHMs. We still need to assess. |
| 19:25 | dnolen | bbloom: probably stick w/ ObjMap for small sizes and bump up to PHM when update time dominates ObjMaps |
| 19:26 | bbloom | makes sense |
| 19:27 | bbloom | is there any stance for or against migration of core data structures form java to clj ? |
| 19:27 | bbloom | from* java |
| 19:28 | bbloom | ignoring cljs for a moment |
| 19:28 | dnolen | bbloom: not really beyond low priority since we already have them working in Java. |
| 19:28 | bbloom | makes sense. and we'd expect the perf to be comparable? i've gotten good perf out of clj, but don't know relative to java "natively" |
| 19:29 | dnolen | bbloom: case where you might get more response - new better stuff. Like RRB-Tree in CLJ |
| 19:29 | wei_ | ^ just looping back.. I think I can do that with a promise |
| 19:29 | dnolen | bbloom: perf should be competitive, all the tools are there to accomplish this, see gvec.clj |
| 19:30 | dnolen | gvec.clj is a bit of complex case since gvec can store types beyond objects. But it shows competitive perf w/ Java is possible. |
| 19:30 | eggsby | aleph looks interesting |
| 19:30 | dnolen | bbloom: certainly if you want to get something into CLJ I think it would need to be as fast as if you'd written it Java. |
| 19:31 | bbloom | dnolen: what exactly is this gvec file? |
| 19:31 | bbloom | what uses it? |
| 19:31 | dnolen | bbloom: clj/clojure/gvec.clj |
| 19:31 | bbloom | yeah, i have it open |
| 19:31 | bbloom | but i also have PersistentVector.java open |
| 19:31 | bbloom | :-) |
| 19:31 | dnolen | bbloom: nothing uses it, but people can use it if space dominates. |
| 19:33 | dnolen | bbloom: a gvec of bytes, char will be much smaller than the standard PV |
| 19:33 | bbloom | ah, i see vector-of |
| 19:34 | bbloom | interesting |
| 19:42 | bbloom | dnolen: I could also just do a little bit of evil reflection to get at the Node implementation and the constructor i'd need… heh |
| 19:44 | bbloom | it's a shame that the serialization format wouldn't really be general enough. the reader would need to be able to read the comparator |
| 19:44 | bbloom | for a sorted-set, that is |
| 19:46 | bbloom | => (binding [*print-dup* true] (println (sorted-set-by #(compare (:foo %1) (:foo %2))))) |
| 19:46 | bbloom | #=(clojure.lang.PersistentTreeSet/create []) |
| 19:46 | bbloom | sadly loses information |
| 19:46 | hiredman | (hypersqldb...) |
| 19:47 | bbloom | heh |
| 19:49 | bbloom | hiredman: i have a very particular query pattern that i'm optimizing for. i got much better results out of intersecting zsets on redis than i did out of postgres. i'm getting comparable results in memory with clojure, avoiding the complexity of another networked server for durability |
| 19:49 | dnolen | bbloom: thus I think constructing a new type to do this better instead of trying to bend what exists to your will. |
| 19:49 | dnolen | bbloom: it's an interesting idea to explore, I think has some neat implications for CLJS, higly optimized loading of data structures. |
| 19:50 | dnolen | bbloom: but trying to reuse the existing data structures for this is a waste of time IMO. |
| 19:50 | Raynes | I am in West Hollywood. :D |
| 19:50 | bbloom | dnolen: the issue is that i don't want to throw out some of the really nice core libraries that are hard coded against clojure.lang.Sorted — subseq for example |
| 19:51 | bbloom | although i just started thinking about this |
| 19:51 | bbloom | i guess i could implement Sorted :-P |
| 19:51 | dnolen | bbloom: yep |
| 19:51 | dnolen | bbloom: your new thing can interop with everything because that's how Clojure was designed. |
| 19:51 | bbloom | :-) |
| 19:51 | amalloy | hey Raynes, welcome |
| 19:52 | Raynes | amalloy: :D |
| 19:55 | bbloom | dnolen: i think i'm just gonna ignore optimizing loads for now & see how far i can get without it… if it gets too slow, i'll investigate rewriting PersistentTreeMap&Set in clj. If I do that, I'll make sure it runs on cljs. Note that there are a lot of "IF"s in that sentence |
| 19:56 | muhoo | what is #= and where is it documented? |
| 19:56 | dnolen | bbloom: sounds like a plan ;) |
| 19:56 | dnolen | muhoo: it's not documented and probably won't be. |
| 19:58 | muhoo | what does/did it do though? |
| 19:59 | bbloom | my understanding is that it's a reader macro used by *print-dup* for ensuring the loaded type matches the printed one |
| 19:59 | muhoo | ah, thanks |
| 19:59 | bbloom | ,(binding [*print-dup* true] (print-str {})) |
| 19:59 | clojurebot | "#=(clojure.lang.PersistentArrayMap/create {})" |
| 20:19 | muhoo | why would one use ::foo instead of :foo? |
| 20:20 | muhoo | i understand what's different-- ::foo is really :user/foo-- , but my question is, why would you use it? |
| 20:21 | dnolen | muhoo: to prevent clashes. |
| 20:21 | dnolen | muhoo: keywords are also used to create hierachies for multimethods. |
| 20:22 | muhoo | thanks |
| 21:03 | kenneth | whoops |
| 21:03 | kenneth | accidentally added 10 million records to the wrong db |
| 21:03 | kenneth | damnit congomongo |
| 21:07 | muhoo | damn hammer keeps hitting me in the thumb :-) |
| 21:18 | rhc | sorry for the noob question, but how do you switch from the repl buffer to the clojure buffer in emacs? i'm trying C-c C-z like this says https://github.com/technomancy/swank-clojure/blob/master/README.md |
| 21:18 | kasterma | C-x b is the switch buffer function. |
| 21:19 | rhc | ah, thanks |
| 21:19 | rhc | figured it was finally time to learn emacs :) |
| 21:25 | muhoo | it's good to know emacs, but you can use clojure from a bunch of other editors/ide's too, fyi |
| 21:28 | muhoo | huh, that's weird. org.openid4java:openid4java-consumer:jar:0.9.6 supposedly depends on org.apache.maven:super-pom:pom:2.0, but super-pom 2.0 is not in maven central? |
| 21:30 | kenneth | woohoo |
| 21:30 | kenneth | all this work has paid off |
| 21:31 | kenneth | my clojure importer is getting like 2x the performance than the php script did |
| 21:31 | septomin_ | kenneth: what were the main bottlenecks? |
| 21:32 | kenneth | in clojure or php? |
| 21:32 | septomin_ | in the clojure version |
| 21:32 | kenneth | i was getting 100x worse in clojure when i started |
| 21:32 | kenneth | the json parsing library i was using was ridiculously slow |
| 21:33 | kenneth | (data.json from contrib) |
| 21:33 | muhoo | oh, that's old. you've switched to cheshire? |
| 21:33 | kenneth | no, using clj-json |
| 21:33 | muhoo | supposdely cheshire is e'en better |
| 21:33 | kenneth | seemed equivalent from the mechmark on cheshire's page |
| 21:34 | kenneth | the other thing was monger is also ridiculously slow |
| 21:34 | kenneth | no idea why, but switched it for congomongo |
| 21:34 | kenneth | and had to rewrite some funky code, i think i was not understand (seque …) right |
| 21:34 | kenneth | so i'm doing it sequentially now, instead of attempting to parallelize |
| 21:34 | muhoo | great, good to know! |
| 21:37 | alex_baranosky | if I want to call a private function I can just access the var |
| 21:37 | kenneth | this is the final code btw. i'm sure i could probably shave off a couple more issues if i tried, but i don't know enough to—https://gist.github.com/df78a51e447c3a7f80bf |
| 21:37 | alex_baranosky | that approach seems to be failing me when trying to use a private macro |
| 21:38 | gfredericks | alex_baranosky: if you do it that way you end up calling the macro as a function, right? |
| 21:38 | gfredericks | at runtime rather than compile-time? |
| 21:38 | gfredericks | ,(#'and false false true) |
| 21:38 | clojurebot | true |
| 21:38 | alex_baranosky | yeah I figured... Is there any way to get at this code without copy-n-paste? |
| 21:39 | alex_baranosky | ,(#'let [x 3] x) |
| 21:39 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0)> |
| 21:39 | gfredericks | you might be able to def a local macro that defers to the other one |
| 21:39 | alex_baranosky | let me try that |
| 21:40 | gfredericks | or maybe there are some plumbing commands for macroexpansion that you could call manually... :/ |
| 21:40 | gfredericks | alex_baranosky: be careful that you pay attention to the first two args, which are special |
| 21:40 | gfredericks | &env and &form I think? |
| 21:40 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: env in this context |
| 21:41 | alex_baranosky | don't see &env and &form being useful here |
| 21:41 | gfredericks | alex_baranosky: right but the first two args to a macro are those two things |
| 21:41 | gfredericks | thus ##(#'and false false true) |
| 21:41 | lazybot | ⇒ true |
| 21:41 | gfredericks | whereas ##(and false false true) |
| 21:41 | lazybot | ⇒ false |
| 21:42 | alex_baranosky | oh, funky |
| 21:42 | alex_baranosky | I see |
| 21:43 | alex_baranosky | gfredericks, there seems to always be something new to learn |
| 21:43 | gfredericks | so you could maybe pass them through (though not sure which order), but since your private macro probably doesn't use them it probably doesn't matter |
| 21:43 | gfredericks | alex_baranosky: heck yes there does. |
| 21:44 | muhoo | sorry for the stupid question, but why not make the macro public then? |
| 21:44 | alex_baranosky | I didn't realize you could call a macro as a function like that |
| 21:44 | gfredericks | usually I learn by saying something and then amalloy corrects me |
| 21:44 | gfredericks | muhoo: probably not his code |
| 21:44 | alex_baranosky | yeah, dude's a machine |
| 21:44 | alex_baranosky | not my code |
| 21:44 | alex_baranosky | I could copy and paste |
| 21:44 | alex_baranosky | but I hate doing that |
| 21:44 | alex_baranosky | plus, I'm learning stuff now :D |
| 21:45 | gfredericks | calling a macro as a function might be secret unsupported behavior; but if you're trying to call private things that's probably not something you care about |
| 21:45 | alex_baranosky | I'm doing somethign wrong |
| 21:45 | gfredericks | wut ur macro look like |
| 21:46 | alex_baranosky | (defmacro defnilsafe2 [a b c] |
| 21:46 | alex_baranosky | (list #'incubator/defnilsafe nil nil a b c)) |
| 21:46 | gfredericks | I think if you remove the word list it'll work |
| 21:46 | gfredericks | you're probably trying to emit code that calls the other macro, when you really want to actually call the other macro |
| 21:46 | gfredericks | and return the result of that from your macro |
| 21:46 | alex_baranosky | that makes sense, since it is happening at compile time |
| 21:47 | alex_baranosky | BAM! |
| 21:47 | gfredericks | BAM! |
| 21:47 | alex_baranosky | thanks |
| 21:47 | alex_baranosky | that did the trick |
| 21:47 | gfredericks | ~bam |
| 21:47 | clojurebot | Pardon? |
| 21:47 | gfredericks | clojurebot: bam is BAM! |
| 21:47 | clojurebot | Ack. Ack. |
| 21:47 | gfredericks | ~bam |
| 21:47 | clojurebot | bam is BAM! |
| 21:47 | muhoo | emiril iin the house |
| 21:47 | gfredericks | hmmm |
| 21:47 | gfredericks | I've forgotten how to make him leave off the first part |
| 21:47 | alex_baranosky | feels great to learn that new piece of Clojure tonight |
| 21:48 | gfredericks | clojurebot: forget bam |
| 21:48 | clojurebot | Gabh mo leithscéal? |
| 21:48 | alex_baranosky | do you know if &form or &env comes first? |
| 21:48 | gfredericks | nope |
| 21:48 | gfredericks | easy to find out though now that I think about it |
| 21:48 | muhoo | cloujurebot never forgets :-) |
| 21:48 | gfredericks | form then env |
| 21:49 | alex_baranosky | I'm adding nilsafe arrows to the swiss-arrows project |
| 21:49 | gfredericks | wtharetheswiss-arrows |
| 21:49 | alex_baranosky | final macro: (defmacro defnilsafe2 [docstring non-nilsafe nilsafe] |
| 21:49 | alex_baranosky | (#'incubator/defnilsafe &form &env docstring non-nilsafe nilsafe)) |
| 21:50 | alex_baranosky | gfredericks, https://github.com/rplevy/swiss-arrows |
| 21:51 | gfredericks | oh man I've wanted some tricked out arrows before |
| 21:51 | alex_baranosky | I'm falling in love with the diamond wand |
| 21:53 | gfredericks | oh crap that diamond wand is slick |
| 21:54 | gfredericks | I was imagining you'd give an index but that was a terrible idea |
| 21:55 | alex_baranosky | I feel like it makes code like this clearer: https://github.com/marick/Midje/blob/master/src/midje/ideas/facts.clj#L80 |
| 21:55 | alex_baranosky | I don't think it is the normal solution, but sometimes ->>/-> aren't as easy to read imo |
| 21:56 | gfredericks | yeah I think otherwise you'd use an outer (->) with a single ->> on the fourth line |
| 21:56 | alex_baranosky | or wrap a funciton in #( ... % ...) |
| 21:56 | gfredericks | yeah it's ewy :( |
| 21:56 | alex_baranosky | and even then in long forms like that it becomes confusing where the arguments are getting put |
| 21:57 | gfredericks | <<- looks interesting too |
| 21:57 | muhoo | i am very glad to have <> for cases where i can't gerrymander the args i want to thread into the first or last |
| 21:57 | muhoo | though, i have to say, rhickey seems to have put a LOT of work into making functions threadable by either first or last arg |
| 21:58 | gfredericks | there are some things arrows can buy. for everything else, there's the diamond wand. |
| 21:58 | alex_baranosky | I agree I do -> then ->>, then -<> when the first two don't look clean |
| 22:00 | gfredericks | welp. I'm using this from now on. |
| 22:01 | alex_baranosky | I just submitted a pull requesto adda nilsafe wand, -?<> |
| 22:01 | gfredericks | -<?> will have some other behavior presumably |
| 22:01 | gfredericks | perhaps questionable behavior |
| 22:02 | alex_baranosky | -?< would fork to a random path |
| 22:02 | gfredericks | yeah I was just thinking of a randomized version |
| 22:04 | gfredericks | lisp has existed for decades but we still don't have vertical lists |
| 22:29 | jayunit100 | howcome you cant dereference a list outside a macro ? |
| 22:29 | jayunit100 | @(list 3) |
| 22:29 | jayunit100 | ,@(list 3) |
| 22:29 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IDeref> |
| 22:30 | jayunit100 | ooops i meant |
| 22:32 | jayunit100 | the thingy where you "unlist" a list... i.e. bring all its elements up one level. |
| 22:32 | gfredericks | splice-unquote? |
| 22:32 | alex_baranosky | you can |
| 22:32 | jayunit100 | splicing yup |
| 22:32 | alex_baranosky | it just has to be done inside of syntax quote: |
| 22:32 | gfredericks | ,`(foo bar ~@[4 5 3] haha) |
| 22:32 | clojurebot | (sandbox/foo sandbox/bar 4 5 3 ...) |
| 22:32 | alex_baranosky | ,`(~@[1 2 3]) |
| 22:32 | clojurebot | (1 2 3) |
| 22:32 | jayunit100 | hmm okay i was doing ' |
| 22:33 | alex_baranosky | ' is quote |
| 22:33 | jayunit100 | (~@'(list 3)) |
| 22:33 | jayunit100 | ,(~@'(list 3)) |
| 22:33 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote-splicing> |
| 22:33 | alex_baranosky | quote is much less complicated |
| 22:33 | alex_baranosky | ,'foo |
| 22:33 | clojurebot | foo |
| 22:33 | jayunit100 | ,(~@(qoute (list 3))) |
| 22:33 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: qoute in this context, compiling:(NO_SOURCE_PATH:0)> |
| 22:33 | yoklov | ,`(~@'(list 3)) |
| 22:33 | clojurebot | (list 3) |
| 22:34 | yoklov | ,`(~@(list 3)) |
| 22:34 | clojurebot | (3) |
| 22:34 | jayunit100 | Ah oops okay |
| 22:34 | alex_baranosky | misspelled quote there jayunit100 |
| 22:34 | jayunit100 | :) |
| 22:34 | jayunit100 | yup |
| 22:36 | jayunit100 | Why do we need that syntax quote. |
| 22:36 | jayunit100 | I mean, in a normal macro it makes sense, but in this case, I would think that the splicer should still work |
| 22:36 | jayunit100 | macro or not, splice should... splice ? right. |
| 22:37 | ibdknox | it is |
| 22:37 | ibdknox | what does that splice turn into? |
| 22:37 | ibdknox | (list 3) => 3 :) |
| 22:37 | gfredericks | syntax quote and normal quote are two different kinds of quoting |
| 22:37 | gfredericks | the difference between them is independent of whether or not you're using them in a macro |
| 22:38 | gfredericks | syntax quote has splicing, normal quote doesn't |
| 22:38 | ibdknox | ~@(list 3) => list 3 |
| 22:38 | clojurebot | No entiendo |
| 22:38 | ibdknox | and then you wrap it in parens |
| 22:38 | ibdknox | causing it to execute |
| 22:40 | ibdknox | nm, that's not really true |
| 22:51 | alex_baranosky | ibdknox, so how far is LightTable from being usable :) |
| 22:52 | gfredericks | and what will be the monthly cost for using HeavyTable |
| 22:54 | alex_baranosky | also, will it come with paredit? |
| 23:00 | yoklov | wait, syntax-quote is different than quote? |
| 23:00 | yoklov | i thought it was just like quasiquote |
| 23:00 | yoklov | (from scheme) |
| 23:00 | yoklov | oh, it also resolves symbols? |
| 23:01 | gfredericks | resolves symbols and does the insertion thing and also the foo# symbols |
| 23:01 | gfredericks | &['foo# `foo#] |
| 23:01 | lazybot | ⇒ [foo# foo__6774__auto__] |
| 23:01 | yoklov | oh, didn't know the foo# only worked in syntax quote |
| 23:03 | yoklov | still makes lists though. |
| 23:04 | yoklov | (unlike rackets syntax-quote, which make syntax objects, which are like lists but the compiler yells at you _much_ more) |
| 23:05 | gfredericks | that sounds...strange |
| 23:23 | yoklov | its really annoying, to be honest. it's for hygene, i guess. |
| 23:26 | yoklov | another reason i'm happy to be writing clojure :p |
| 23:53 | muhoo | ibdknox: congratulations, you win HN today |