#clojure log - Feb 25 2014

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

0:05 escherize: ,(+ 3 4)

0:05 clojurebot: 7

0:22 TravisD: Out of curiosity, why is the IRC network graph a tree? Seems like the network should have redundancy

0:53 pcn: Dunno.

0:54 But usually even if you have redundancy, you treat the current reachable nodes as a DAG to prevent cycles

1:21 noprompt: dnolen_: if you're around i wanted to get your thoughts on some architecture around om and routing.

1:31 quizdr: if loop's last call is typically a recur, and if the last item returned from a defmacro is a code list, then it isn't really possible to generate this list inside a (non-quoted) loop inside defmacro, right?

1:32 noprompt: what?

1:32 clojurebot: what is seq

1:33 pcn: how?

1:33 clojurebot: with style and grace

1:33 pcn: tell me something good?

1:34 noprompt: quizdr: are you asking if you can generate a list with loop/recur inside the body of a macro?

1:36 pcn: Does anyone know if there's a way with lamina.core/receive-all to say... well... not all, but say, 1023?

1:36 at a time?

1:36 Or if there's another way to simply listen on a port and send off up to N messages, but no more at a time?

1:36 quizdr: noprompt actually i guess you could have a "do" prior to the "loop" and then close the "do" parenthesis after the loop

1:38 noprompt: quizdr: or just (cons 'do (list-of-stuff...))

1:39 quizdr: word.

2:02 noprompt: today's lesson: don't swap!, reset! or bang fucking anything inside a go block. ever.

2:03 and by "anything ever" i mean only when you know what you're doing.

2:03 haha.

2:04 abp: noprompt: what happened? :)

2:04 noprompt: abp: we had some code that was manipulating a piece of global state inside a go block making it really hard to test.

2:05 abp: actually a few go blocks.

2:05 abp: the solution was to just pull the state change out and have the go blocks return the next state.

2:05 abp: now all the parts can be extracted and tested.

2:06 abp: noprompt: ah, isn't that more like problems with scattered state manipulation and insufficient testing tools

2:06 noprompt: abp: definitely. but doing that in a go block definitely ampflifies that.

2:06 abp: noprompt: right, sounds about how to program clojure, but good to hear it pays again. ;P

2:07 noprompt: abp: the funny thing is, i'm sure it started off as "we'll just do this now and later we'll refactor it"

2:07 abp: "later" ended up being weeks later and then we were like "omg, this is a monster"

2:07 abp: fortunately, one of the nice things about clojure is that it's not hard to fix.

2:08 took about 20mins once i figured out the problem.

2:08 abp: noprompt: yep, changing clojure code bases of a few thousand lines is totally trivial.

2:08 noprompt: love it when new requirements arive and have to change like ten lines

2:09 noprompt: seems like it could even make "temporary hacks" viable

2:10 noprompt: abp: well the codebase is only around 1200 lines and this part probably only a hundred.

2:10 abp: still it was a nasty little knot we managed to make.

2:10 abp: haha no kidding.

2:12 abp: noprompt: well, i think this atom was the equivalent of a singleton in an oop program, considering how core.async centralizes logic. thinking of how often refactored even those out in the days it's no wonder clojure doesn't make it any better

2:12 *how often i

2:12 noprompt: abp: singleton state is good though for clojure programs imho.

2:12 sm0ke_: ,[#inst]

2:13 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

2:13 sm0ke_: how do i use tagged literals?

2:13 noprompt: abp: better to have a single container for your state then a whole bunch of little stateful boxes.

2:13 abp: noprompt: yeah but only when applying centralized and decoupled mutation vs unrestrained

2:13 noprompt: that's for sure

2:14 noprompt: abp: god, just look at a ruby test suite... "we gotta setup the world! half of this test is line noise!"

2:14 abp: noprompt: that's where my metaphor breaks ;)

2:15 noprompt: yeah it's mocking the tests *and* you :)

2:16 noprompt: but i never wrote any ruby, just java, c++ and the likes

2:16 noprompt: abp: well i can't speak to those languages but i can't imagine it's any better.

2:17 abp: i guess it all depends on your design right? if the code is bad the tests are probably bad too.

2:20 SegFaultAX: Random JAX-RS question if anyone happens to know: can a resource returned by a sub-resource locator contain additional @Path directives?

2:20 amalloy: pcn: (receive-all (take* 1023 ch) f)?

2:20 SegFaultAX: I'm assuming it's just a normal resource, but the Jersey documentation doesn't have an example of doing that from what I can see.

2:24 Oh they totally do. Sweet.

2:25 abp: noprompt: right. probably in every language the case. clojure makes understanding that easier, at least for me but harder to go back to those languages or even think about architecture for them :)

2:25 noprompt: abp: i'm just happy i get to write it 90% of the time for a living.

2:34 abp: noprompt: for me it's more like 50% but increasing. :) mostly legacy maintenance besides

3:04 quizdr: is there a way to see the full expansion of all macros in a form, including subforms, as they are seen by the compiler?

3:06 ambrosebs: quizdr: if you want to see exactly what the JVM compiler sees, see jvm.tools.analyzer. https://github.com/clojure/jvm.tools.analyzer#syntax-from-ast

3:06 quizdr: thanks

3:08 ambrosebs: quizdr: note that the form is implicitly evaluated.

3:08 amalloy: ambrosebs: how does c.j.t.a/macroexpand compare to clojure.tools.macro/mexpand-all?

3:09 aside from implicitly evaluating, which seems pretty terrible to me

3:09 quizdr: this jvm analyzer is a bit lower level than I want for my purpose. i just want to expand all macros in a form and see the final code.

3:10 ambrosebs: quizdr: I only recommended it because you wanted "as seen by the compiler".

3:10 quizdr: i'll play with it, thanks

3:11 amalloy: quizdr: like i said, clojure.tools.macro/mexpand-all

3:11 ambrosebs: amalloy: I assume mexpand-all just expands macros?

3:11 amalloy: ambrosebs: yeah

3:11 ambrosebs: amalloy: that's probably exactly what quizdr wants.

3:11 quizdr: amalloy sorry i missed that message of yours

3:12 ambrosebs: amalloy: j.t.a does the whole shebang.

3:12 amalloy: quizdr: you're forgiven, since i addressed it to ambrosebs

3:14 ambrosebs: j.t.a expands other things like :inline metadata

3:14 quizdr: amalloy forgive me again, but how do I access it? I'm trying (require ['clojure.tools.macro :as mm] )

3:14 ambrosebs: should just be used for static analysis

3:14 amalloy: quizdr: it's a library. you have to depend on it

3:14 quizdr: ah

3:15 i guess that will be my project tomorrow.

3:16 ambrosebs: fwiw you can also disable implicit evaluation in j.t.a.

3:17 it's on by default for side effects like `ns` and `def`.

3:17 otherwise the analyzer leaves your code in a weird state.

3:18 tools.analyzer.* has similar caveats.

3:19 amalloy: ah, if you can disable it that's fine, and reasonable given that you'll want to run it on a whole ns

3:19 ambrosebs: but there's no implicit evaluation in t.a.

3:19 amalloy: for a macroexpander it seemed crazy, since you expand one form

3:19 ambrosebs: amalloy: Yes, it's a whole trip and back around again just to expand a macro :P

3:19 amalloy: the readme makes it sound like a flaw in the approach that they haven't worked out a solution for yet

3:20 ambrosebs: amalloy: well if you know what you're doing, you're free to disable it.

3:20 amalloy: I don't know all the implications of not evaluating the ast TBH.

3:22 amalloy: again, I'd only recommend j.t.a if you *really* want to know what Compiler.java is giving you :)

3:22 an excellent tool for that.

3:23 amalloy: yep. thanks for clarifying

3:38 ggherdov: hi folks, congrats for being accepted at GSoC

3:41 ambrosebs: yay!

3:42 ggherdov: hehe

4:13 sm0ke: any elegant solution to dispatch on string conforming to a particular format, like abc$xyz:[optional].(madatorypart)

4:16 although regex can be used

4:20 BartAdv: hey there, any lein-droiders here? I'm asking if anyone tried LightTable with it, or is it *just* impossible at the moment?

4:21 ddellacosta: sm0ke: you can do that with a multimethod

4:22 sm0ke: not sure what you meant by elegant otherwise

4:26 sm0ke: ddellacosta: well there can be a dsl in which i can write exactly what i wrote above

4:27 ddellacosta: which will capture all the [] () parts in the variable name inside them

4:27 edbond: sm0ke, use regexp + core.match

4:28 sm0ke: core.match is no good that a multimethod

4:28 the problem is with regex and group capturing

4:28 its work.

4:29 its a nice idea for a library though

4:30 sveri: hi, I have this small test: http://pastebin.com/bwDfZevP when I execute it, the "for" part is never reached, is it because "mails" is a lazy-seq?

4:30 sm0ke: with a macro like (let-match [#super/reg abc$xyz:[optional].(madatorypart) str] )

4:30 now inside the let-match i have bindings for optional and madatorypart

4:30 if they match!

4:33 more like (let-match [#super/reg abc$xyz[:#optional].(#madatorypart) str] )

4:33 where all #... are variable to be binded

4:35 blah i will use a regex i guess

4:35 ddellacosta: sm0ke: seems like you'd be better off writing something w/instaparse

4:36 sm0ke: ddellacosta: actually a macro and data_readers.clj converting it to a regex should be enough

4:36 edbond: instaparse may be slow, if regexp is very simple and there is no special cases I would use regexp

4:37 ddellacosta: sm0ke, edbond: depends on how complex of a dsl it is. Agree in general a regexp is better if simple and the dsl is small.

4:41 wth do I have to do to use a deftype in a different namespace? I'm doing what Alex Miller suggests here but it's not working for me: http://tech.puredanger.com/2010/06/30/using-records-from-a-different-namespace-in-clojure/

4:42 has this changed?

4:42 I realized it works quite differently in ClojureScript

4:44 sm0ke: ddellacosta: i did that few weeks back, key is the import

4:44 seems to work

4:45 ddellacosta: sm0ke: seriously? I just keep getting "Exception in thread "main" java.lang.ClassNotFoundException: my.name.space.MyType, compiling:(core.clj:1:1)"

4:45 sm0ke: ddellacosta: hurm. weird. what about wen you out the ns in :aot?

4:45 put*

4:47 ddellacosta: sm0ke: it expects to find it in a directory like my/name/space/MyType it seems...but it is setup like my/name/space.clj <- deftype is in this file

4:47 sveri: hm, it seems like i cannot execute for statements in midjes facts in general, someone used midje here already?

4:48 ddellacosta: sveri: never had that problem with Midje, are you sure you're just not forgetting about lazy evaluation? Have you tried doall before your for calls?

4:48 sm0ke: ddellacosta: a protocol is prefixed by the current ns

4:48 ddellacosta: sm0ke: but that's how Alex Miller has it set up in the article I linked to above, so I'm not sure why that would matter unless it's changed

4:48 sm0ke: I don't know what you mean by that

4:48 sm0ke: I'm talking about a type

4:49 sm0ke: ddellacosta: sorry i mean Record

4:49 shouldbe the same for Type i guess

4:49 sveri: ddellacosta: please look at: http://pastebin.com/bwDfZevP its really short, where would i put that doall? i already tried some places, but could not succeed

4:49 sm0ke: ,(defrecord Some (foo [this]))

4:49 clojurebot: #<AssertionError java.lang.AssertionError: No fields vector given.>

4:50 sm0ke: ,(defprotocol Some (foo [this]))

4:50 clojurebot: Some

4:50 sm0ke: ,(deftype Sometype [x] Some (foo [this] x))

4:50 clojurebot: sandbox.Sometype

4:50 sm0ke: see

4:50 sandbox is the namespace

4:50 ddellacosta: sm0ke: I understand all of that

4:50 sm0ke: ,(import 'sanbox.Sometype)

4:50 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: sanbox.Sometype>

4:51 ddellacosta: sm0ke: but it's not helping me load one namespace's type in another

4:51 sm0ke: eh

4:51 ddellacosta: do you have - ?

4:51 ddellacosta: sveri: in front of for. (doall (for [...] ...))

4:51 sm0ke: import would require to change it to _

4:52 ddellacosta: sm0ke: where? What does that have to do with it?

4:52 sm0ke: anywhere in ns, its typically what peopple do..my-namespace

4:52 ddellacosta: sm0ke: and...?

4:53 sveri: ddellacosta: thank you, it works now in a different setup, seems like i have two problems, however, thank you very much

4:53 sm0ke: some for import it needs to be changed to (:import my_namesapce.MyType)

4:53 so*

4:53 wth

4:53 ddellacosta: sm0ke: ah, okay, that could be an issue, thanks

4:54 sveri: great, glad to hear it

4:55 sm0ke: I could hug you, that did it, thanks!

4:56 sm0ke: :P

4:56 ddellacosta: didn't know about underscores in import...only thought it was applicable for directory naming.

4:57 sm0ke: import translates to java directly i guess, and java doesnt like - in name resolution

4:57 ddellacosta: sm0ke: yeah, good to know...will make a note of that.

4:58 sm0ke: clojure handles a lot of crap in function naming etc, i have seen names like func! converted to funcBANG or something like that

4:58 legacy.

4:59 ddellacosta: sm0ke: yeah, I guess I'm surprised it doesn't do that as well in import calls, but I suppose it makes sense--that is one place where "the Java leaks through."

5:00 what I think would make more sense is if deftype/defrecord worked the same way as ClojureScript, where you can simply require the type/record

5:00 since they are supposed to be java-independent features

5:00 but I suppose there must be some legacy reasons for that

5:01 sm0ke: i would like to try clojurescript sometime

5:01 ddellacosta: sm0ke: it's easy to try, you should! Just use dnolen's mies template to get going, it's super quick

5:01 sm0ke: lein new mies <project-name>

5:02 sm0ke: yea, my perception is that clojurescript is really superior like ahead of time, compared to traditional javascript based front end development

5:02 ddellacosta: I've really grown to love ClojureScript. Especially with Om, sablono and core.async, it's just magical

5:03 sm0ke: omg it's a different world. I would be really depressed if I had to take a JS front-end development job at this point

5:03 sm0ke: or really, anything not CLJS if it was front-end

5:03 unless it was something like fay or elm perhaps

5:04 sm0ke: nice

5:05 hmm i hear a lot about om, need to check it out sometime, although hoplon also looks interesting

5:06 ddellacosta: sm0ke: yeah, been meaning to check out hoplon but Om fits our development to-a-T right now, so been putting it off

5:06 sm0ke: but there is a lot of great stuff happening in CLJS. I definitely think it is *way* ahead of the curve for front-end app development

5:07 sm0ke: so i hear

5:11 ddellacosta: wow, so you also have to require the namespace *before* you import the type? Lame...

5:12 sm0ke: is it?

5:12 try without it?

5:12 i dont think thats required

5:13 ddellacosta: sm0ke: hmm, I dunno, I moved the import to the top and it barfed, couldn't find it

5:13 but then moving it back to the bottom resolved it

9:07 loliveira: Any LightTable user in? I can't see log4j's console output. Any ideas?

9:44 sveri: hi, when i want to insert some data into a unique attribute datomic, what does transact return if that attribute exists already?

9:44 AeroNotix: dudes

9:45 I have a weird error. I have a file which is generating a lot of functions and such via macros, which I AOT due to wanting to run cloverage on it (which needs the class files)

9:45 I want to use clojure.tools.logging in it. But when I do, I occasionally get a ClassNotFoundException

9:46 mdrogalis: sveri: Pretty sure it throws an exception back.

9:47 sveri: mdrogalis: ok, thank you, I will try that out

10:14 AeroNotix: any ideas?

10:16 ToBeReplaced: AeroNotix: there's not enough information there -- i think you just gotta step through it

10:17 AeroNotix: ToBeReplaced: I've been at this a couple of days. It just says that core.tools.logging is a class it cannot find. Running with lein test works, running with lein run does not.

10:18 ToBeReplaced: `lein do clean run` fails too?

10:19 to me it sounds like a macro issue, like you're missing an unquote somewhere which works without the AoT but fails with it

10:20 AeroNotix: hmm

10:20 ToBeReplaced: https://gist.github.com/AeroNotix/9210902

10:21 specifically log-stack-trace uses clojure.tools.logging/warn

10:21 which fails.

10:27 ToBeReplaced: man that's brutal -- you have log-stack-trace in another gist?

10:29 ddellacosta: AeroNotix: my boss who uses Intellij/Cursive had a really similar issue today...any chance you're using it too?

10:30 he had to wipe out his config to get it working again, it had cached some stuff apparently.

10:31 noncom: hi, how do I properly access the members of the enum from this java class? http://goo.gl/io93A1 I tried like ImagePainter$BlendMode/SET and all combinations of / and $ and it did not work..

10:34 `cbp: Maybe (ImagePainter$BlendMode/valueOf "SET")

10:34 * `cbp is just guessing though

10:34 AeroNotix: ddellacosta: noppe

10:34 ToBeReplaced: it's trivial, it literally just builds the stack trace and sends it to warn

10:35 sdegutis: Does writing a CSS parser in Clojure sound fun?

10:35 AeroNotix: ToBeReplaced: https://gist.github.com/AeroNotix/f539482fa8b27db8794c5

10:35 `cbp: nothing with css is fun

10:35 AeroNotix: but I dount it'll help much

10:35 locks: sdegutis: sure.

10:36 sdegutis: I want to automatically convert our .css files to .clj files.

10:36 locks: what, why

10:36 sdegutis: https://github.com/noprompt/garden

10:36 For that.

10:37 locks: you want to convert your css files to clj to convert them to css?

10:37 CookedGr1phon: sdegutis: surely just leave the legacy css, write new stuff in garden to override it

10:37 and then when you don't need any of the legacy stuff any more, delete it

10:38 ToBeReplaced: AeroNotix: second gist not working. i don't see your issue though -- good luck.

10:38 AeroNotix: ToBeReplaced: what do you mean "not working"?

10:38 `cbp: A CSS parser should be pretty easy with instaparse. Yes?

10:38 ToBeReplaced: link is broken

10:38 AeroNotix: ToBeReplaced: https://gist.github.com/AeroNotix/f539482fa8b27db8794c5

10:38 katox: cemerick: hi, I have an austin vs. deployment q. If I do have a "dev" and "production" profiles (the second one used with "ring uberjar") - what's the recommended way of spliting the sources? I use environ for most of the stuff but it's runtime not compile time - that means the austin ns would have to be available (present in uberjar). What do you use?

10:38 AeroNotix: huh wtf

10:39 ToBeReplaced: https://gist.github.com/AeroNotix/f539482f8b27db8794c5

10:39 ToBeReplaced: i'm getting 404 on that

10:39 AeroNotix: the macro file is in the project's :aot vector

10:40 sdegutis: `cbp: oooh yes, maybe

10:41 locks: precisely!

10:41 On Instaparse's readme: "What if context-free grammars were as easy to use as regular expressions?"

10:42 Key word there being the first "as".

10:42 ToBeReplaced: AeroNotix: is it possible to have a file that's being aot'd depend on a file that isn't?

10:42 AeroNotix: Hmmm, dunno

10:44 ToBeReplaced: AeroNotix: what happens when you add tools.logging to the macro file?

10:44 AeroNotix: ToBeReplaced: same deal

10:45 noncom: `cbp: it says CompilerException java.lang.RuntimeException: No such namespace: ImagePainter$BlendMode

10:45 `cbp: noncom: well you need to import ImagePainter

10:46 noncom: i did..

10:46 ystael: sdegutis: alternatively, note the usage of 'use' as opposed to 'get right' :)

10:46 locks: "Be aware Garden makes no attempt to validate your declarations and will not raise an error if other key types are used."

10:46 Anderkent: AeroNotix: cloverage should work without having to AOT stuff; I think there was a bug related to order of ns loading that stopped that but it shold be fixed in the latest snapshot

10:46 locks: this sounds like a bug.

10:46 AeroNotix: Anderkent: lemme check on the snapshot, then

10:46 `cbp: noncom: import ImagePainter$BlendMode too

10:46 noncom: oh maybe..

10:46 AeroNotix: Anderkent: 1.0.4-SNAPSHOT?

10:47 Anderkent: yeah

10:47 AeroNotix: it's not on clojars

10:47 Anderkent: huh. lemme check

10:48 AeroNotix: works for me, do you have the clojars snapshot repo enabled?

10:48 sdegutis: I've tried writing DSLs before in Ruby and it just felt icky.

10:48 AeroNotix: Anderkent: ah, not the snapshot repo.

10:49 sdegutis: In Clojure they usually use data that you analyze, rather than redefining functions, so it feels much cleaner.

10:49 Anderkent: TBH it works for me with no lein profile / default new repo

10:49 AeroNotix: Anderkent: wut

10:49 Anderkent: :plugins [[lein-ring "0.8.5"]

10:49 [lein-localrepo "0.4.0"]

10:49 [lein-cloverage "1.0.4-SNAPSHOT"]

10:49 Anderkent: maybe just try nuking ~/.m2/repository/cloverage, it might be caching

10:49 AeroNotix: ok

10:49 Anderkent: oh nono

10:49 sdegutis: Oops wrong channel.

10:49 gtrak: cemerick: pong

10:49 Anderkent: just run CLOVERAGE-VERSION=1.0.4-SNAPSHOT lein cloverage, with the 1.0.2 plugin version

10:50 AeroNotix: Anderkent: why didn't you say :)

10:50 cemerick: gtrak: I have CLJS completions! :-)

10:50 noncom: `cbp: importing the BlendMode too worked! now my original way of ImagePainter$BlendMode/SET works)

10:50 gtrak: yay!

10:50 Anderkent: the lib and plugin arent in sync

10:50 cemerick: gtrak: couple of dumb questions

10:50 gtrak: does it work in browser repl? haven't tried it.

10:50 cemerick: gtrak: Yup; no reason why it shouldn't. I was going to say, just run austin in your demos. I wince anytime I see Rhino spinning up for 10s when someone starts a piggieback REPL. :-)

10:51 gtrak: first, I have no completions in buffers, only in the REPL. Expected?

10:51 gtrak: ah, I don't know how to actually use clojurescript, just how to hack the compiler.

10:51 :-)

10:51 I get completions in buffers, but it's C-Tab.

10:51 M-x completion-at-point is the corresponding function.

10:52 you should also be running a melpa cider to test this.

10:52 cemerick: gtrak: OK, I'll give that a try. I'm using ~cider HEAD, so should be close enough.

10:52 gtrak: yea, cider head should work.

10:52 that's what I'm using.

10:53 cemerick: I guess my other Q is related, the first tab keystroke indents the REPL prompt by ~30 chars, the second does the actual completion.

10:53 AeroNotix: Anderkent: removing :aot and running it like that works. But I'm away from the computer which is causing the weird classpath error.

10:53 cemerick: I'm trying as hard as possible to not actually learn how to use emacs. :-P

10:53 AeroNotix: Anderkent: can you do a release onto clojars of 1.0.4?

10:53 gtrak: cemerick: oh, that's weird. Mine doesn't do that.

10:53 AeroNotix: Anderkent: I would like to be able to use it on my continuous integration server / colleagues computers.

10:53 gtrak: I am also trying not to use emacs, that's why I want nrepl ops to exist.

10:53 `cbp: noncom: nice

10:54 Anderkent: AeroNotix: eventually, yes. :P Probably not any time soon (<2 weeks), busyish.

10:54 AeroNotix: Anderkent: but it takes like 5 minutes to do a clojars deploy :)

10:54 Anderkent: AeroNotix: can't you run the same command there?

10:56 CookedGr1phon: How do I make javascript objects from clojure maps in current clojurescript?

10:56 cemerick: gtrak: A minor thing. Finally, I'm seeing all sorts of spurious completions in e.g. core.async, like async/->t15711; I assume those are factory fns from macro-generated records or something, but it'd be nice if such things could be filtered out somehow...

10:56 CookedGr1phon: and is there a handy cheatsheet somewhere to avoid me having to ask really basic sounding questions?

10:57 cemerick: i.e. I get dozens of them when attempting to complete async/

10:57 gtrak: cemerick: yea, I'm not doing any filterings, lemme glance at it.

10:57 I have a placeholder to filter public vars, that might help a bit.

10:57 cemerick: gtrak: it may be that it's not something that can be reasonably controlled, given the scale of the macrology in that lib

10:57 gtrak: just glancing at the actual data

10:59 Anderkent: AeroNotix: non-snapshot versions are serious bsns :P

10:59 AeroNotix: Anderkent: wouldn't I have to build cloverage on the other machines?

10:59 Anderkent: ?

11:00 Anderkent: AeroNotix: no, it should fetch the snapshot from clojars; the building is only needed for unpublished changesets

11:00 `cbp: what's the syntax for google

11:00 ah feck it https://github.com/readevalprintlove/clojurescript-cheatsheet

11:00 gtrak: cemerick: so, for t10554 there's a ':type true' flag, and for unmix-all there's a ':fn-var true'

11:00 AeroNotix: Anderkent: huh?

11:00 Anderkent: ohhh ok

11:00 nice

11:00 lemme try this

11:01 gtrak: and a corresponding constructor function, I don't see anyway to filter that out.

11:01 any way*

11:02 I want to autocomplete types as well.

11:02 cemerick: sure

11:05 gtrak: cemerick: https://gist.github.com/gtrak/9211851

11:06 lemme fix up the formatting a bit

11:07 fixed

11:08 pbostrom: CookedGr1phon: #js {:param1 "value" :param2 "value"} is how you make a javascript literal object; I think this got documented in the release notes for a cljs release a few months ago, not sure there is a handy cheatsheet anywhere

11:12 sdegutis: Wow, ClojureScript is simple yet powerful.

11:13 gtrak: sdegutis: behold lisp

11:14 sdegutis: Yes, Lisp is simple, but powerful.

11:14 devn: unfortunate but true: I have to deal with some keywords like :r/w/f

11:15 ,(name :r/w/f)

11:15 clojurebot: "w/f"

11:15 devn: *facepalm*

11:15 perplexa: lisp = lots'a insignificant stupid parentheses

11:15 ;x

11:15 gtrak: cemerick: if there's a better way to identify those gensyms than t-number, it would be easy to run a regex, sounds like a CLJS patch.

11:17 Anderkent: ,(name ::1)

11:17 clojurebot: "1"

11:17 Anderkent: ,::1

11:17 clojurebot: :sandbox/1

11:17 Anderkent: ,:sandbox/1

11:17 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :sandbox/1>

11:17 Anderkent: cure

11:17 *cute

11:17 cemerick: gtrak: Maybe. I'd have to sink into it a bit before wanting to suggest anything.

11:18 sdegutis: ,(->> (range) (remove odd?) (take 10))

11:18 clojurebot: (0 2 4 6 8 ...)

11:18 sdegutis: Wow, so simple, yet so powerful.

11:18 I bet there's nothing like that line of code in Haskell.

11:20 CookedGr1phon: pbostrom: perfect, thanks

11:21 pbostrom: is that any different to (js-obj {...})? because js-obj would seem to play better with paredit...

11:26 sdegutis: Yeah paredit doesn't really play well with tagged literals.

11:27 When all you have is s-expressions, that's where paredit shines. It's so simple, yet so powerful.

11:29 devth: possible to set metadata on a local in a let binding?

11:31 llasram: sdegutis: ? I've found paredit to work fine w/ tagged literals. The tag is just another symbol as far as paredit is concerned

11:31 teslanick: What is js-obj? is that what the tagged literal points at?

11:31 I've been using clj->js

11:31 sdegutis: llasram: Yeah but ideally a tagged literally is really a single thing represented by two symbols. But paredit treats them separately.

11:32 CookedGr1phon: llasram: yeah, it doesn't break, but it takes away the strictness of paredit so you could end up with a floating literal tag which doesn't pertain to anything

11:32 llasram: Hmmm. Good point. And it'd be pretty Clojure-specific to handle that case

11:39 sdegutis: Right, exactly. I want a Clojure-specific paredit.

11:40 I wrote most of one in C last year. It was not pleasant.

11:40 Tried to rewrite it in Julia, not much more pleasant.

11:47 llasram: Handling tagged literals as an atomic thing seems like a pain. On every operation you'd need to read back one expression to see if the previous item is a tag

11:49 CookedGr1phon: tagged literals are a bit ugly all round imo, what would have been wrong with (#inst "....") and (#js ...)

11:49 keep it lispy

11:50 `cbp: I'm not sure that improves it at all

11:50 CookedGr1phon: #inst is a function, just one which we know we can serialise

11:51 `cbp: (map #inst strs) ; lol

11:52 technomancy: wouldn't removing the space fix the paredit issue?

12:01 sdegutis: Yes!

12:02 But you can't do that for tags where the following form is a symbol.

12:02 technomancy: yeah

12:02 sdegutis: Granted, I don't know of any such tags. It's either a string or number or list.

12:02 technomancy: it's not really a paredit issue, it's a consistency issue

12:02 where else do you have an object that reads as a single thing that has a space in it without delimiters?

12:04 sdegutis: Oh! I know, I know!! PERL6!

12:04 technomancy: I heard perl6 was going to be simple, yet powerful.

12:04 (did I do that right?)

12:04 sdegutis: Aw dang, I should have said "pick me!" instead of "PERL6" and waited until I was called on to reply with "PERL6" for optimal humor-effectiveness.

12:05 technomancy: you're already a pro at it

12:06 devn: lol, the perl6 jokes never end

12:07 "Camelia, the Perl 6 bug"

12:07 leave the door wide open

12:08 mpenet: cool anonymous fn can have multiple arities too!

12:08 ,(def a (fn ([a] a ) ([a b] [a b])))

12:08 clojurebot: #'sandbox/a

12:08 mpenet: ,(a 1)

12:08 clojurebot: 1

12:08 mpenet: ,(a 1 2)

12:08 clojurebot: [1 2]

12:08 devn: they can have names too

12:08 mpenet: a bit useless here but I never thought of this one

12:09 sdegutis: devn: beat me to it

12:09 mpenet: I knew about the name, but the arity thing escaped me

12:09 sdegutis: ,((fn foo [x] (foo x)) 3)

12:09 clojurebot: #<StackOverflowError java.lang.StackOverflowError>

12:09 devn: ,(fn hi [x] (if (= x "dude") "hi dude!" (hi "dude")))

12:09 clojurebot: #<sandbox$eval122$hi__123 sandbox$eval122$hi__123@ca5978>

12:09 gtrak: names aren't useless, means the function can pass itself around, like 'this'

12:09 devn: ,(hi "man")

12:09 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hi in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:09 devn: oh right

12:09 sdegutis: mpenet: yep, Clojure's defn etc are macros around fn as far as I know.

12:09 devn: ,((fn hi [x] (if (= x "dude") "hi dude!" (hi "dude"))))

12:09 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval171/hi--172>

12:09 devn: ,((fn hi [x] (if (= x "dude") "hi dude!" (hi "dude"))) "man")

12:09 sdegutis: mpenet: this technique is so simple, yet so powerful.

12:09 clojurebot: "hi dude!"

12:10 mpenet: indeed

12:11 mping_: hi

12:14 sdegutis: wow, clojurebot is so enthusiastic

12:16 dnolen_: seangrove: sounds like sfcljs meetup last night was a success?

12:17 seangrove: dnolen_: Yeah, attendence was twice what we expecte (> 40 people), Pete's talk was great, and I don't know if jaws dropped, but people were pretty impressed by Om

12:17 dnolen_: seangrove: haha, sweet :)

12:18 seangrove: I got to one-up Pete a few times - the modules they're thinking about releasing, we just get for free with a good design in cljs

12:18 dnolen_: seangrove: nice

12:21 upwardindex: Anyone remember the name of the library that keeps a long lived shell open to improve performance of shelling out (clojure.java.sh) ?

12:22 seangrove: dnolen_: Omchaya got quite a bit of attention as well, excited about it becoming a good (or the good) reference Om app

12:23 dnolen_: seangrove: sorry I didn't get a chance to give you much feedback but I did give a look yesterday. It's a sizeable app definitely gives a good picture what a non-trivial Om app might look like.

12:24 locks: seangrove: omchaya?

12:25 clgv: when I use a (definterface MyIfc ...) I get NoClassDefFoundError for a deftype declaration using that interface when evaluating the namespace in the repl. what is wrong here?

12:26 seangrove: dnolen_: No worries, I just don't want bad habits to start showing up in there. There are some challenges dealing with Om app, and I want people to be able to think "Oh, how did they solve that, let me go check.."

12:26 locks: https://github.com/sgrove/omchaya

12:27 locks: seangrove: cheers

12:27 dnolen_: seangrove: yep, too early to tell what best practices are precisely but omchaya is definitely a great reference point

13:09 seangrove: Put my Om presentation up http://sgrove.github.io/omchaya/docs/presentation.html

13:10 dnolen_: Would appreciate any feedback about any lies in there so I don't spread it too much :)

13:10 loliveira_: Does somebody know hew I can't see the log4j's console output in LightTable's console?

Logging service provided by n01se.net