2012-10-12
| 00:00 | JvJ | maybe I'll just compile from source |
| 00:02 | Sgeo | Uh |
| 00:02 | Sgeo | I can't seem to get documentation for .. on clojuredocs.org |
| 00:03 | AtKaaZ | Sgeo, it's 404? |
| 00:03 | JvJ | Sego, get docs from the repl. |
| 00:03 | Sgeo | Not 404, but directs to the clojuredocs.org core docs |
| 00:03 | clojurebot | reply is the new high-powered repl that powers lein2's repl task https://github.com/trptcolin/reply |
| 00:03 | AtKaaZ | Sgeo, for . works though, http://clojuredocs.org/clojure_core/clojure.core/_dot |
| 00:04 | AtKaaZ | Sgeo, it's 404 for me, if you come from cheatsheet: http://clojuredocs.org/clojure_core/clojure.core/_dot_dot |
| 00:04 | Sgeo | o.O there's a -?> |
| 00:05 | Sgeo | That's it, I'm making a m-> for use with arbitrary monads. |
| 00:05 | Sgeo | Or maybe a macro that takes macros and ... does stuff |
| 00:06 | pandeiro | ,(= (keys {:a 1 :b 1 :c 1}) (keys {:a 1 :b 1 :c 1})) ; is not converting these to (set ...) a bug? |
| 00:06 | clojurebot | true |
| 00:06 | AtKaaZ | Sgeo, where did you see the -?> I can't find it |
| 00:06 | Sgeo | http://clojuredocs.org/clojure_contrib/clojure.contrib.core/-_q%3E |
| 00:07 | AtKaaZ | in contrib? how do I access that in repl/ |
| 00:09 | JvJ | aren't the contrib libraries being refactored? |
| 00:15 | JvJ | now that contrib has been mentioned, I'm trying to access it in leiningen... I'm having some problems |
| 00:21 | JvJ | never mind, solved. clojure.contrib.core is now clojure.core.incubator |
| 00:23 | AtKaaZ | JvJ, I was able to run mandelbrot.clj example from penumbra |
| 00:23 | JvJ | AtKaaZ, was there an issue loading the PenumbraSystem class or something like that? |
| 00:24 | AtKaaZ | JvJ, it was when trying in a new project, but not when trying inside penumbra not that example at least |
| 00:26 | JvJ | AtKaaZ, what kind of problem did you get? |
| 00:26 | AtKaaZ | JvJ, I already posted it on mailing list, after your reply |
| 00:27 | JvJ | AtKaaZ...oh i misread your post. I thought you said you were NOT able. sorry |
| 00:30 | AtKaaZ | JvJ I think the error is because PenumbraSystem is java code and maybe not included in output penumbra.jar ? will check |
| 00:30 | JvJ | Thanks AtKaaZ |
| 00:43 | AtKaaZ | JvJ, I don't know why they aren't included but if you compile manually (lein uberjar) they are |
| 00:44 | AtKaaZ | I mean, I don't know what you'd have to type to lein so that you'd get the .jar without those .class files |
| 00:45 | AtKaaZ | only .clj files are in it |
| 00:45 | AtKaaZ | here: http://clojars.org/repo/penumbra/penumbra/0.6.0/ |
| 00:45 | JvJ | i have manually compiled the uberjar. do you know how to include that in my lein project? For some reason lein isn't generating or using a lib directory |
| 00:46 | AtKaaZ | I don't know, but I want to |
| 00:46 | Sgeo | Since I want to make new syntax for working with monads, I should try to make my syntax not dependent on the particular monad library used |
| 00:47 | Sgeo | Does that make sense? |
| 00:47 | Sgeo | A compatibility layer allowing my syntax to be used with either algo.monads or protocol monads |
| 00:47 | JvJ | AtKaaZ, there's some nonsense about using maven here.... but I don;t like it http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/ |
| 00:48 | antares_ | JvJ: calm down, it's not nonesense |
| 00:48 | antares_ | and it is 2 lines |
| 00:48 | AtKaaZ | lol |
| 00:48 | JvJ | Nonsense is just a word I use to mean "stuff" sometimes |
| 00:48 | AtKaaZ | seems old post, surely must be better ways file:// maybe? |
| 00:48 | antares_ | Leiningen reuses JVM infrastructure, this means that local repos are just Maven repos |
| 00:49 | antares_ | this saved Leiningen maintainers a lot of owrk |
| 00:49 | antares_ | lein also can install a jar to the local repo |
| 00:49 | antares_ | of your project, though, not an arbitrary one |
| 00:49 | JvJ | right. I want to use an arbitrary jar and access it in my project |
| 00:50 | antares_ | JvJ: I'd do mvn install:install-file -Dfile=jaad-0.8.3.jar -DartifactId=jaad -Dversion=0.8.3 -DgroupId=jaad -Dpackaging=jar (note that I do not specify a custom repo location) |
| 00:50 | antares_ | lein2 uses ~/.m2 (the standard local repo location) |
| 00:50 | AtKaaZ | JvJ, this doesn't seem too bad: https://gist.github.com/3062743 |
| 00:50 | antares_ | so you don't need to mess with :repositories |
| 00:52 | JvJ | ok, looks like I'll have to get maven |
| 00:53 | antares_ | JvJ: you can create a directory and copy the jar there but putting together a metadata file is probably harder than installing maven |
| 00:53 | antares_ | on recent Ubuntu and debians, sudo apt-get install maven |
| 00:53 | AtKaaZ | wasn't there something like lein pom ? |
| 00:53 | antares_ | on OS X, brew install maven |
| 00:53 | JvJ | i'm on windows atm |
| 00:53 | antares_ | AtKaaZ: he needs .pom for an arbitrary jar |
| 00:53 | JvJ | jarbitrary... |
| 00:54 | AtKaaZ | antares_: he has the project.clj in this case, for penumbra |
| 00:54 | AtKaaZ | antares_: would it work? |
| 00:54 | antares_ | JvJ: so you need to install the jar for a project managed by lein? |
| 00:54 | AtKaaZ | yep |
| 00:54 | antares_ | AtKaaZ: yes, in that case, just lein install in the repo |
| 00:54 | AtKaaZ | oh that simple |
| 00:55 | antares_ | assuming that project does not have unspecified dependencies, lein will do everything for you |
| 00:55 | JvJ | ok, so let me get that striahgt.... copy the jar somewhere in ~/.m2 and... use lein install? |
| 00:55 | JvJ | OH WAIT |
| 00:55 | JvJ | never mind |
| 00:55 | JvJ | i gotcha ;) |
| 00:55 | antares_ | JvJ: if you have a lein project you need to install locally, cd into that directory and lein install |
| 00:55 | antares_ | should be all you need |
| 00:55 | JvJ | I'll lein install from penumbra and then I'll have it in my directory |
| 00:55 | JvJ | OK! Let me try it |
| 00:56 | antares_ | JvJ: you will have it in the local maven repo. But that's where leiningen will look for it. |
| 00:56 | antares_ | JvJ: just for the record, do you use lein2? |
| 00:57 | antares_ | (lein install works the same way with 1 and 2 but I'd probably recommend lein2 at this point) |
| 00:57 | AtKaaZ | antares_: totally works you are a god! :) |
| 00:57 | antares_ | AtKaaZ: I am a Leiningen contributor |
| 00:57 | JvJ | is lein2 different? lein version gives me 2.0 |
| 00:58 | antares_ | JvJ: that's what I meant, you are all set |
| 00:58 | AtKaaZ | antares_: ok then demigod? :)) |
| 00:58 | antares_ | AtKaaZ: something like that :) |
| 00:58 | AtKaaZ | well this is cool |
| 00:59 | JvJ | ah, the exciting world of dependency management |
| 00:59 | AtKaaZ | I'll totally be needing this knowledge in the future |
| 01:00 | gh0stz | I've been starting to mess around with clojure now a couple weeks but really have just been reading a lot, getting a working environment and writing a few little basic things to test new things I've read about. Anyone recommend any good tutorials or whatever to kind of walk through a true functional example. just to get a good feel for it |
| 01:00 | antares_ | gh0stz: http://clojure-doc.org/articles/content.html. It is a week old but already has some decent content in one place. |
| 01:01 | gh0stz | ok great…thanks |
| 01:01 | JvJ | gh0stz: http://4clojure.org if you're looking for a challenge. there are a lot of exercises from the beginner to expert level that you can try |
| 01:02 | gh0stz | thanks…i'll definitely give both of those a look |
| 01:02 | gh0stz | this is my first experience with a functional language. also, I've been fighting with emacs after being a long time vim user |
| 01:03 | antares_ | gh0stz: why not use VimClojure? |
| 01:03 | gh0stz | I know vim has support and I also use Intelli J at work and know they have a plugin, but I just felt like I should take this opportunity to learn emacs as well |
| 01:03 | gh0stz | I am going to go back and try VimClojure, but I just thought this was a great time to do a learning exercise in both clojure and emacs |
| 01:04 | antares_ | gh0stz: in that case, check out https://leanpub.com/fp-oo |
| 01:04 | AtKaaZ | ,(declare ghost) |
| 01:04 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 01:04 | antares_ | ,(inc AtKaaZ) |
| 01:04 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: AtKaaZ in this context, compiling:(NO_SOURCE_PATH:0)> |
| 01:05 | gh0stz | I don't think emacs is bad at all, just not as quick with stuff as I'd like yet. also thought about giving evil a try in emacs |
| 01:05 | antares_ | hm, inc is a lazybot thing :) |
| 01:05 | AtKaaZ | I'm like a ghost :)) |
| 01:05 | gh0stz | :) |
| 01:05 | antares_ | &(inc AtKaaZ) |
| 01:05 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: AtKaaZ in this context |
| 01:05 | gh0stz | so what all can the bot do? |
| 01:05 | antares_ | god dammit |
| 01:05 | Sgeo | How often do people come in here to declare that identity is useless and shouldn't exist? |
| 01:06 | AtKaaZ | like doing ##(inc inexistent) |
| 01:06 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: inexistent in this context |
| 01:06 | AtKaaZ | lol |
| 01:06 | Sgeo | Because that would be amusing to see |
| 01:06 | antares_ | gh0stz: most people use bots for the REPL |
| 01:06 | antares_ | ,(+ 1 2 3) |
| 01:06 | clojurebot | 6 |
| 01:06 | antares_ | &(+ 1 2 3) |
| 01:06 | lazybot | ⇒ 6 |
| 01:06 | antares_ | but also for lulz |
| 01:06 | antares_ | ~maven |
| 01:06 | clojurebot | Help, I'm trapped in an XmlFactoryFactory! |
| 01:06 | gh0stz | nice…that's what I was wondering. I didn't know if the bot would give you a repl or not |
| 01:06 | antares_ | ,(doc iterate) |
| 01:06 | clojurebot | "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects" |
| 01:06 | Sgeo | ,(map (juxt dec identity inc) (range 5)) |
| 01:06 | clojurebot | ([-1 0 1] [0 1 2] [1 2 3] [2 3 4] [3 4 5]) |
| 01:07 | Sgeo | juxt is awesome |
| 01:07 | gh0stz | i'm not familiar with juxt |
| 01:07 | Sgeo | ,(doc juxt) |
| 01:07 | clojurebot | "([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]" |
| 01:08 | gh0stz | lol…yea I am slow tonight I had just realized that I should probably do that |
| 01:10 | gh0stz | btw, gotta give you all credit. one thing I can definitely say is since the first day I decided to play with clojure, everyone I have asked anything has been fucking super helpful. best community I've ever encountered around a language |
| 01:10 | gh0stz | so thanks to you all |
| 01:13 | AtKaaZ | antares_: ##'(inc AtKaaZ) |
| 01:13 | lazybot | ⇒ (inc AtKaaZ) |
| 01:13 | AtKaaZ | lol I failed=) |
| 01:13 | AtKaaZ | I see now that the "##" was carefully chosen |
| 01:15 | AtKaaZ | ,(println (str "##" '(inc AtKaaZ))) |
| 01:15 | clojurebot | ##(inc AtKaaZ) |
| 01:15 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: AtKaaZ in this context |
| 01:15 | AtKaaZ | ,(println (str "##" ''(inc AtKaaZ))) |
| 01:15 | clojurebot | ##(quote (inc AtKaaZ)) |
| 01:15 | lazybot | ⇒ (inc AtKaaZ) |
| 01:15 | AtKaaZ | nevermind, I fail |
| 01:16 | AtKaaZ | ,'(inc AtKaaZ) |
| 01:16 | clojurebot | (inc AtKaaZ) |
| 01:16 | lazybot | ⇒ 1 |
| 01:16 | AtKaaZ | (dec AtKaaZ) |
| 01:16 | lazybot | You can't adjust your own karma. |
| 01:17 | AtKaaZ | ,'(dec AtKaaZ) |
| 01:17 | clojurebot | (dec AtKaaZ) |
| 01:17 | lazybot | ⇒ 0 |
| 01:17 | AtKaaZ | ##'(inc AtKaaZ) |
| 01:17 | lazybot | ⇒ (inc AtKaaZ) |
| 01:19 | AtKaaZ | can't make the other bot do it |
| 01:19 | AtKaaZ | can't me one bot make the other bot do it* |
| 01:24 | gh0stz | so what's the deal with karma and the bots? |
| 01:32 | antares_ | gh0stz: that's another internal joke, kind of |
| 01:34 | antares_ | gh0stz: real karma in the Clojure community is gained by contributing real code, e.g. clojurewekz.org or flatland.org or clojuresphere.com, no need to worry :) |
| 01:35 | AtKaaZ | www.clojurewerkz.org |
| 01:36 | antares_ | yes, clojurewerkz.org |
| 01:39 | Sgeo | Hmm |
| 01:40 | Sgeo | I'm looking at the source for ->, and I don't understand the behavior of (-> 10 [1 2 3]) |
| 01:40 | Sgeo | ,(seq? [1 2 3]) |
| 01:40 | clojurebot | false |
| 01:40 | Sgeo | o.O |
| 01:41 | Sgeo | Well, that explains it, for some weird definition of "explain" where for some bizarre reason vectors aren't seqs |
| 01:41 | cemerick | vectors aren't seqs |
| 01:42 | cemerick | not bizarre, tho :-) |
| 01:47 | AtKaaZ | $findfn inc inc 1 2 3 [2 3 4] |
| 01:47 | lazybot | [] |
| 01:47 | AtKaaZ | $findfn inc inc 1 2 3 '(2 3 4) |
| 01:47 | lazybot | [] |
| 01:48 | Sgeo | You know, I think the whole vararg thing can be annoying |
| 01:49 | Sgeo | Needing to pass around (partial apply concat), instead of having concat just take a sequence like (concat [[1 2 3] [4 5 6]]) |
| 01:51 | AtKaaZ | $findfn inc 1 2 3 '(2 3 4) |
| 01:52 | lazybot | [] |
| 01:52 | Sgeo | AtKaaZ, what exactly is your example? |
| 01:52 | Sgeo | ,(map inc [1 2 3]) |
| 01:52 | clojurebot | (2 3 4) |
| 01:52 | AtKaaZ | Sgeo, it's good but I wanted to not have them in a seq |
| 01:53 | AtKaaZ | each as a param, instead |
| 01:53 | Sgeo | ,(#(map inc %&) 1 2 3) |
| 01:53 | clojurebot | (2 3 4) |
| 01:53 | AtKaaZ | lol tricky |
| 01:54 | AtKaaZ | let me remember what I wanted in the first place, since I got lost |
| 01:54 | Sgeo | ,((fn [& rest] map inc rest) 1 2 3) ; easier to read? |
| 01:54 | clojurebot | (1 2 3) |
| 01:54 | Sgeo | ...o.O |
| 01:57 | wingy | how do i set defaults to destructuing keys? |
| 01:57 | AtKaaZ | Sgeo, you're right, that is the way, I don't know why I was hoping for something else |
| 01:57 | wingy | in case it cannot find a key with that name in the vector |
| 01:58 | Sgeo | ,(let [{:keys [a b c] :or [1 2 3]} {:a 5 :b 6}] [a b c]) |
| 01:58 | clojurebot | [5 6 nil] |
| 01:58 | Sgeo | ,(let [{:keys [a b c] :or {:a 1 :b 2 :c 3}} {:a 5 :b 6}] [a b c]) |
| 01:58 | clojurebot | [5 6 nil] |
| 01:58 | Sgeo | hmm |
| 01:59 | Sgeo | ,(let [{:keys [a b c] :or {a 1 b 2 c 3}} {:a 5 :b 6}] [a b c]) |
| 01:59 | clojurebot | [5 6 3] |
| 02:00 | wingy | Sgeo: thx! |
| 02:01 | Sgeo | wingy, yw |
| 02:04 | Sgeo | ,(macroexpand '(#(map inc %&) 1 2 3)) |
| 02:04 | clojurebot | ((fn* [& rest__27#] (map inc rest__27#)) 1 2 3) |
| 02:04 | Sgeo | Hmm |
| 02:04 | Sgeo | So what did I do wrong |
| 02:05 | AtKaaZ | ,(macroexpand '(->> x class print)) |
| 02:05 | clojurebot | (print (clojure.core/->> x class)) |
| 02:05 | Sgeo | ,((fn [& restfoo] map inc restfoo) 1 2 3) ; easier to read? |
| 02:05 | clojurebot | (1 2 3) |
| 02:05 | AtKaaZ | why isn't the inner ->> expanding too? |
| 02:05 | Sgeo | Hmm |
| 02:05 | Sgeo | AtKaaZ, because macroexpand doesn't macroexpand all macros |
| 02:05 | Sgeo | ,(doc macroexpand) |
| 02:05 | clojurebot | "([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms." |
| 02:06 | AtKaaZ | ok the last line I guess |
| 02:06 | Sgeo | Just expands until the head of the form is no longer a macro. |
| 02:06 | Sgeo | Yeah |
| 02:06 | AtKaaZ | i got stuck on repeatedly calls... assuming it will all |
| 02:06 | Sgeo | ,(require clojure.walk :as w) |
| 02:06 | clojurebot | #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0)> |
| 02:07 | Sgeo | http://clojuredocs.org/clojure_core/clojure.walk/macroexpand-all |
| 02:08 | AtKaaZ | I don't see how I can use it though, no ideas |
| 02:08 | AtKaaZ | on how to import it |
| 02:09 | AtKaaZ | weird, I had it hmm |
| 02:09 | AtKaaZ | thanks:) |
| 02:09 | AtKaaZ | ,(clojure.walk/macroexpand-all '(->> x class print)) |
| 02:09 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk> |
| 02:10 | AtKaaZ | I had it from :dependencies [org.clojure/clojure-contrib "1.2.0"] |
| 02:21 | AtKaaZ | ,(#(do (map (fn [x] (->> x class println)) %&) nil) '() [] #{}) |
| 02:21 | clojurebot | nil |
| 02:22 | AtKaaZ | no idea what I'm missing, println not showing |
| 02:23 | AtKaaZ | ,(do (println 1) nil) |
| 02:23 | clojurebot | 1 |
| 02:23 | AtKaaZ | oh oops got it |
| 02:26 | AtKaaZ | ,(map println '(1 2 3)) |
| 02:26 | clojurebot | (1 |
| 02:26 | clojurebot | 2 |
| 02:26 | clojurebot | nil 3 |
| 02:26 | clojurebot | nil nil) |
| 02:27 | AtKaaZ | ragequit lol |
| 02:36 | Sgeo | (defmacro let-threaded [val varname & body] `(let [~varname ~val] ~@body)) |
| 03:08 | AtKaaZ | ok so what's the deal here |
| 03:08 | AtKaaZ | ,(map println '(1)) |
| 03:08 | clojurebot | (1 |
| 03:08 | clojurebot | nil) |
| 03:08 | AtKaaZ | ,(vec (map println '(1))) |
| 03:08 | clojurebot | 1 |
| 03:08 | clojurebot | [nil] |
| 03:08 | AtKaaZ | ,(do (map println '(1)) 2) |
| 03:08 | clojurebot | 2 |
| 03:09 | AtKaaZ | ,(do (println 2) (map println '(1)) ) |
| 03:09 | clojurebot | 2 |
| 03:09 | clojurebot | (1 |
| 03:09 | clojurebot | nil) |
| 03:09 | antares_ | aka: map is lazy |
| 03:09 | antares_ | AtKaaZ: ^^^ |
| 03:10 | antares_ | and should not generally be used for side effects |
| 03:10 | antares_ | ,(dorun (map println [1 2 3 4 5])) |
| 03:10 | clojurebot | 1 |
| 03:10 | clojurebot | 2 |
| 03:10 | clojurebot | 3 |
| 03:10 | clojurebot | 4 |
| 03:10 | clojurebot | 5 |
| 03:10 | antares_ | ,(map println [1 2 3 4 5]) |
| 03:10 | clojurebot | (1 |
| 03:10 | clojurebot | 2 |
| 03:10 | clojurebot | 3 |
| 03:10 | clojurebot | 4 |
| 03:10 | clojurebot | 5 |
| 03:10 | clojurebot | nil nil nil nil nil) |
| 03:10 | AtKaaZ | at first I was afraid that it includes the *out* in the seq but it doesn't |
| 03:11 | antares_ | dorun forces evaluation. In the REPL, printing out results also forces evaluation but it's not generally the case. |
| 03:12 | AtKaaZ | (inc antares_) |
| 03:12 | lazybot | ⇒ 1 |
| 03:13 | callen | ,(def blah 1) |
| 03:13 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 03:13 | callen | sanbox? what the hell is a sanbox? |
| 03:14 | callen | who do I complain to about the bot? |
| 03:14 | callen | ,(println "woot") |
| 03:14 | clojurebot | woot |
| 03:15 | antares_ | callen: you cannot execute arbitrary code |
| 03:15 | callen | antares_: I understand exactly how the bot works, I was bitching about the typo. |
| 03:15 | antares_ | callen: because, you know, kids will run (System/exit 0) and stuff |
| 03:16 | callen | antares_: I use clojail too. |
| 03:16 | antares_ | callen: I think it's https://github.com/hiredman/clojurebot |
| 03:16 | antares_ | callen: ok, sorry |
| 03:22 | rbxbx | Hey peeps. |
| 03:22 | rbxbx | does anyone know if there's any way in a noir pre-route to grab the handler that would have handled the request had you not intercepted it? |
| 03:22 | rbxbx | other than doing some craziness reconstructing it based off the request :uri |
| 03:23 | callen | vijaykiran: so a few pointers on your tutorial series. 1: the use of lobos is questionable. |
| 03:24 | callen | vijaykiran: 2: abstracting away from the persistence side might help with focusing on Clojure. This could potentially mean using something simpler like redis and leaving SQL for a separate tutorial. |
| 03:43 | vijaykiran | callen: Is there something comparable to lobos - the basic reason to use lobos was to show the point that if someone wants to build webapp with Rails/Playframework mindset comparable tools exist in clojure-land |
| 03:43 | wingy | so weird .. datomic seems to generate the same id all the time |
| 03:44 | wingy | if i put {:db/id #db/id[:db.part/user -1000001] in my transaction data it generates the same id |
| 03:44 | vijaykiran | callen: I agree that persistence might be delegated to a different post - but I wanted to keep things simple - the code is very primitive and not "production ready" :) |
| 04:54 | bosie | trying to get a hang of midje |
| 04:56 | bosie | https://gist.github.com/3878152 |
| 04:56 | bosie | why would this happen? |
| 05:25 | clgv | bosie: thats not midje related. you have not deleted the auto-generated test in core_test.clj |
| 05:25 | clgv | bosie: leiningen generates that one and it's a failing test |
| 05:25 | bosie | clgv: hmm, you are right. and for some reason my test file isn't being executed |
| 05:26 | clgv | bosie: do you have it in the test folder? |
| 05:26 | bosie | yes |
| 05:26 | clgv | and you run "lein test"? |
| 05:26 | bosie | clgv: yes |
| 05:28 | clgv | bosie: ah there is a separate lein-midje plugin |
| 05:29 | clgv | https://github.com/marick/lein-midje |
| 05:38 | bosie | clgv: thanks works now |
| 06:12 | goracio | hey can anyone explain how to use "on" event from jayq ? (on ($ ".element") :click [handler ])? |
| 06:19 | goracio | noone use jayq ? |
| 06:20 | aperiodic | it's a low-traffic time for the channel |
| 06:20 | aperiodic | middle of the night/early morning for the continental US |
| 06:21 | aperiodic | in a few hours the east coast will be waking up; you might have better luck then |
| 06:22 | goracio | ок |
| 06:27 | clgv | goracio: did you find no docs or tutorial on jayq? |
| 06:27 | goracio | nothing at github |
| 06:27 | goracio | will look at google ... |
| 06:40 | goracio | almost nothing - no examples |
| 06:42 | andrewmcveigh | goracio: I think it should be (on ($ :.element) :click handler-fn) - from memory |
| 06:47 | goracio | andrewmcveigh: this doesn't work |
| 06:51 | goracio | (on elem event & [selector data handler]) - selector just string i guess "document" for example |
| 06:52 | goracio | if on invokes on document then (on ($ "document") :click ["#id" handler-func]) |
| 06:53 | clgv | goracio: yoi misinterpret the argument list. remove the vector brackets |
| 06:54 | clgv | *you |
| 06:54 | goracio | ok will try |
| 06:56 | goracio | (on ($ "document") :click "#reply-but" get-replies) |
| 06:57 | goracio | also doesn't work |
| 06:57 | andrewmcveigh | goracio: this works: (on ($ :body) :click (fn [e] (.log js/console (pr-str e)))) |
| 06:58 | goracio | well i need to attach this event to an element |
| 06:58 | goracio | button click |
| 06:58 | goracio | like live() but on() is modern replacment |
| 06:59 | andrewmcveigh | goracio: well, the selector is the ($ :.element) |
| 07:00 | andrewmcveigh | goracio: so (on ($ :.class1) :click (fn [e] ...)) *should* bind to all .class1 s |
| 07:00 | goracio | ($ :.element) element not selector |
| 07:00 | goracio | ok will try |
| 07:02 | andrewmcveigh | where you would write $('.class1').on('click', handler-fn) - you should write (on ($ :.class1) :click handler-fn) |
| 07:04 | goracio | on attaches to document |
| 07:05 | goracio | so i load a document then add some code to it and there i have #reply-but |
| 07:05 | goracio | so i need something like live() |
| 07:05 | goracio | instead of bind |
| 07:06 | goracio | this is on() |
| 07:08 | andrewmcveigh | goracio: I'm just looking at the jQuery docs, I've not really used .on() before. The examples give things like: $("button").on("click", notify); |
| 07:08 | goracio | no no |
| 07:09 | andrewmcveigh | goracio: do you know how it should look in js/jQuery |
| 07:09 | goracio | there is lot more then this :) |
| 07:10 | goracio | on attached to document because document is there always and doesn't change |
| 07:10 | goracio | or to body |
| 07:10 | goracio | so propagation things work there |
| 07:10 | goracio | that's why it's almost like live() |
| 07:11 | goracio | so i need fire an event on element that doesn't exist |
| 07:11 | goracio | that will exist some time later |
| 07:12 | andrewmcveigh | goracio: so you're trying to do: $('document').on('click', '.class1', handler) ? |
| 07:13 | goracio | something like this |
| 07:14 | andrewmcveigh | goracio: that would be: (on ($ :document) :click :.class1 handler) in cljs |
| 07:17 | goracio | (on ($ :document) :click :#reply-but get-replies) |
| 07:18 | goracio | doesn't work |
| 07:24 | andrewmcveigh | (on ($ :body) :click :#step-2 (fn [e] (.log js/console e))) - is working for me |
| 07:24 | andrewmcveigh | it's not working with :document for some reason |
| 07:37 | goracio | yep on body works |
| 07:37 | goracio | ok will try this then :) |
| 07:37 | goracio | will work with body :) |
| 07:42 | holo | hi |
| 08:53 | Kototama | how can I convert a JavaScript object into a clojurescript map? |
| 09:08 | erwagasore | I would love to know how to use clojurec with lein? |
| 09:10 | Kototama | why is clojurescript complaining that I redefine get-in since i do that in a different namespace than the core? |
| 09:12 | chouser | Kototama: because a pointer to core's get-in is brought into your namespace ("referred") when you say (ns ...) at the top of your file |
| 09:13 | chouser | and then you overwrite that refer with your own var and definition, and it's just warning you about that. You can still get to clojure.core/get-in |
| 09:13 | chouser | if you want to get rid of the warning, add to your ns a clause like (ns foo (:refer-clojure :exclude [get-in])) |
| 09:14 | Kototama | ah yep, sounds logic in fact |
| 09:14 | Kototama | thank you |
| 09:15 | wingy | erwagasore: wow .. clojurec = speed |
| 09:15 | Kototama | next question: why doesn't clojurescript impleemnt ISeq for JS objects :-) ? |
| 09:17 | chouser | Kototama: I believe there's a function to return a seq for a js object. |
| 09:19 | chouser | Kototama: There is array-seq |
| 09:19 | Kototama | ah |
| 09:20 | erwagasore | wingy: Faster faster. Everyone like speed right! |
| 09:20 | Kototama | i also found js->cljs |
| 09:20 | Kototama | in the core.cljs |
| 09:20 | wingy | erwagasore: good for scripting :) |
| 09:20 | Kototama | but (seq obj) does not seem to work |
| 09:20 | chouser | ah, nice. |
| 09:21 | wingy | https://github.com/schani/clojurec/tree/master/run/android |
| 09:21 | wingy | will cljc be able to run on android? |
| 09:21 | wingy | https://github.com/schani/clojurec/tree/master/run/ios |
| 09:21 | wingy | and ios? |
| 09:22 | wingy | clojurec could surely boost up clojure's popularity even more |
| 09:30 | erwagasore | Sure. |
| 09:42 | jcromartie | what's the rationale for ClojureC |
| 09:44 | jcromartie | say, over ClojureScript running on an embedded JS VM |
| 09:45 | jcromartie | looks cool, though |
| 09:52 | jweiss | i am using a trace lib similar to clojure.contrib.trace. One thorn in my side is accidentally tracing fn's that return infinite seq's, they try to consume the whole seq and obviously blow the heap. Is there a technique I could use to avoid this (other than manually rooting out these functions from being traced)? |
| 09:54 | jweiss | maybe something like dispatching on the type of returned value, if it's a lazy seq, don't consume it? |
| 09:54 | jweiss | (in the trace lib i mean) |
| 10:04 | wingy | why aint i getting any email updated on new posts on google groups :/ |
| 10:18 | TimMc | Sgeo: Reading a ref doesn't change anything about what other transactions are allowed to do with it, since your transaction is reading from a snapshot of the ref world. |
| 10:21 | DrNautilust | ##"I worship his shadow" |
| 10:41 | chouser | jweiss: in recent versions of Clojure there is "realized?" which can be used to avoid forcing any step of a lazy seq |
| 10:42 | jweiss | hm. |
| 10:42 | jweiss | ,(realized? (iterate inc 0)) |
| 10:42 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPending> |
| 10:42 | jweiss | i'm not sure how Cons's fit in |
| 10:45 | jweiss | ,(doc iterate) |
| 10:45 | clojurebot | "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects" |
| 10:48 | zerokarmaleft | ,(let [xs (lazy-seq (iterate inc 0)) pre (realized? xs) x (first xs) post (realized? xs)] [pre post]) |
| 10:48 | clojurebot | [false true] |
| 10:51 | jweiss | zerokarmaleft: do you know how to check the lazy seq returned by iterate without wrapping it? |
| 10:54 | zerokarmaleft | jweiss: no...internally iterate conses onto a lazy-seq, so i'm a bit confused on the types returned there |
| 11:05 | duck1123 | ,(realized? (rest (iterate inc 0))) |
| 11:05 | clojurebot | false |
| 11:07 | zerokarmaleft | ,[(type (rest (iterate inc 0))) (type (seq (rest (iterate inc 0))))] |
| 11:07 | clojurebot | [clojure.lang.LazySeq clojure.lang.Cons] |
| 11:07 | zerokarmaleft | huh? clearly i need to study the source |
| 11:08 | zerokarmaleft | doesn't rest implicity call seq? |
| 11:11 | jkkramer_ | (doc next) |
| 11:11 | clojurebot | "([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil." |
| 11:12 | chouser | if its argument is already an ISeq, rest does *not* call seq, so as to preserve laziness |
| 11:12 | chouser | because calling seq on something that's already a seq forces one step so that it can return nil if the seq is empty. |
| 11:14 | zerokarmaleft | ah |
| 11:25 | pordan30 | Most installation guides for clojure assume emacs24 for package support. If I generally use emacs23 for compatibility with Coq/Agda, is but manually install clojure-mode and so forth, will there be any compatibility issues? |
| 11:28 | jsabeaudry | pordan30, I'm using emacs23 and have not had any problems |
| 11:29 | jsabeaudry | pordan30, Only a few extra steps like installing emacs package manager |
| 11:40 | pordan30 | jsabeaudry: thanks |
| 11:40 | jcromartie | what is this all about |
| 11:40 | jcromartie | Can't call public method of non-public class: public javax.sound.midi.Instrument[] com.sun.media.sound.AbstractPlayer.getAvailableInstruments() |
| 11:41 | jcromartie | is it a reflection thing? |
| 11:41 | jcromartie | hm, yeah |
| 11:41 | nDuff | jconnolly: Is this happening during a bean invocation? I have a patch for it. |
| 11:42 | jcromartie | (defn channels [^javax.sound.midi.Synthesizer synth] (.getChannels synth)) |
| 11:42 | nDuff | s/jconnolly/jcromartie/ |
| 11:42 | jcromartie | can I avoid making a fn for each method I want to call? |
| 11:42 | jcromartie | jconnolly: no, just trying to do (.getChannels synth) or whatever |
| 11:42 | jcromartie | or .getAvailableInstruments |
| 11:43 | jcromartie | yeah I can give a type hint in a def or let, I guess |
| 11:43 | nDuff | Can't hint on the call itself? |
| 11:44 | mpenet | Someone made a refheap fork using datomic, interesting |
| 11:44 | jcromartie | nDuff: yeah looks like I can |
| 11:44 | jcromartie | I can put hints all over the place :) so I'd better come up something |
| 11:44 | jcromartie | or else I will have hints everywhere |
| 12:36 | technomancy | "Notably, when you use regular expressions, you MUST ALWAYS put in a comment (usually a two-semicolon comment on the previous line) explaining, at least basically, what the regular expression does" haha geez |
| 12:37 | technomancy | (google's CL style guide) |
| 12:37 | fractaloop | That is awesome |
| 12:37 | fractaloop | We have this one regex in production that is wider than your screen. |
| 12:39 | technomancy | so many things in that guide that you just don't have to care about in clojure |
| 12:40 | technomancy | (setf vs setq, yuck) |
| 12:40 | Iceland_jack | I love CL but hate it at the same time |
| 12:40 | technomancy | also: predicates ending in -p can't help but make me think of the 80s |
| 12:41 | Iceland_jack | CL's use of "-p" was also very inconsistent |
| 12:41 | thorbjornDX | does clojure let you split regex onto multiple lines? |
| 12:42 | technomancy | why not? |
| 12:42 | technomancy | newline is just another piece of whitespace |
| 12:43 | thorbjornDX | ok :) |
| 12:43 | S11001001 | thorbjornDX: with the x option you can even have regex comments, which can lead to some interesting looking clojure (as the comments are shell-style) |
| 12:43 | antares_ | is there a common name for [java.util.concurrent TimeUnit Executors] — :import lists like this? |
| 12:44 | thorbjornDX | S11001001: interesting, I'll check it out |
| 12:44 | S11001001 | I have actually written this |
| 12:44 | S11001001 | #"(?x) someregex... # about this part |
| 12:44 | S11001001 | somemoreregex..." ;about this part |
| 12:45 | thorbjornDX | I see why you were saying it looks interesting now |
| 12:51 | jsabeaudry | technomancy, cool that google has a CL style guide, will use it to convince people of lisp's credibility |
| 12:51 | technomancy | jsabeaudry: they only have it because google bought ITA |
| 12:52 | jsabeaudry | That, I don't have to tell :} |
| 12:52 | technomancy | at one time they were using clojure for their internal code indexing |
| 12:52 | technomancy | but that was before yegge threw a fit |
| 13:01 | nDuff | Is there a built-in equivalent to -> which short-circuits on getting a nil, or a simple way to get that effect? |
| 13:01 | jkkramer_ | nDuff: -?> from https://github.com/clojure/core.incubator |
| 13:02 | nDuff | jkkramer_: graci; thanks! |
| 13:20 | Mordus | Hi, can anyone point me to a working app which uses friend? Preferably just for authentication (no special stuff, no roles, no openid) just a most basic example of how to use it for authentication? |
| 13:23 | jcromartie | technomancy: did Yegge throw a fit over Clojure? |
| 13:23 | scriptor | a while back |
| 13:23 | Hodapp | Yegge? |
| 13:23 | clojurebot | Haha! The survey mentioned in the comments to Yegge's last post has a "favorite language" question, but Clojure is not an option. |
| 13:23 | chouser | Yeah, turns out he's liberal and Clojure's conservative. Who knew. |
| 13:24 | jcromartie | I thought Yegge liked Clojure |
| 13:25 | jcromartie | oh I see |
| 13:25 | jcromartie | it's because the community has strong ideals |
| 13:26 | jcromartie | e.g. "don't use macros without a good reason" counts as "staunch conservatism" |
| 13:36 | goracio | hi clojurescript problem - i use fetch and remote for client-side communication- i need to send data to the server and get results only after that but i cann't use remote in remote what better use then ? jayq ajax ? or maybe there is some way to do this with remote ? |
| 13:41 | lynaghk | ping: dnolen |
| 13:43 | emezeske | goracio: From your description, it sounds like a single remote call would do. Maybe paste a snippet of code that demonstrates what you would like to do, but doesn't work? |
| 13:43 | goracio | ok 1 min |
| 13:48 | goracio | https://gist.github.com/3880460 |
| 13:49 | goracio | this doesn't work |
| 13:50 | emezeske | What happens? |
| 13:51 | emezeske | nDuff: I asked him to post the paste |
| 13:51 | nDuff | Ahh. :) |
| 13:52 | goracio | unreadable form |
| 13:52 | goracio | error in console log |
| 13:53 | emezeske | goracio: I don't see any immediate reason why what you're trying to do shouldn't work |
| 13:53 | emezeske | goracio: I am 99% sure I have done that exact thing before |
| 13:53 | Cheiron | Hi. I have about eight small functions used by a function. I created them as closure functions inside the function . no other function use them . should extract them to private functions? |
| 13:54 | nDuff | Cheiron: Usually, I'd say yes. |
| 13:54 | tomoj | huh, does fetch have a flat global namespace? |
| 13:54 | nDuff | Cheiron: ...extracting them will make them easier to test, and will make your larger function shorter, and thus easier to read. |
| 13:54 | emezeske | goracio: Are you certain that fetch-messages works when it's called outside of the first remote? |
| 13:54 | tomoj | that's nuts |
| 13:55 | emezeske | tomoj: Uh.. it doesn't? |
| 13:55 | Cheiron | nDuff: those eight functions are going to be created every time the parent function is called? |
| 13:55 | goracio | emezeske: will check but it should work |
| 13:55 | emezeske | goracio: It sounds to me like your server-side code for the remote is returning a Clojure object that the ClojureScript reader can't handle |
| 13:55 | tomoj | emezeske: (add-remote ~(keyword (name remote)) ~remote) |
| 13:55 | Cubic | Cheiron: If they are closures, probably yes. But I don't know very much about how the Clojure compiler works. |
| 13:55 | tomoj | (defn add-remote [remote func] (swap! remotes assoc remote func)) |
| 13:56 | tomoj | looks like it to me? |
| 13:56 | Cheiron | Cubic: assuming those are created every time the parent function is called, is it a problem? |
| 13:56 | emezeske | tomoj: The term "namespace" has a generally more commonly used meaning in Clojure |
| 13:57 | Cubic | Cheiron: Depends on what you're actually doing with that function. You probably shouldn't worry too much unless you actually run into a problem |
| 13:57 | tomoj | emezeske: yes, it would be nice if they were used here instead of a flat global namespace |
| 13:57 | emezeske | tomoj: I'm saying it's really confusing of you to call it a namespace |
| 13:58 | emezeske | tomoj: At least say "fetch-namespace" or something |
| 13:58 | Cheiron | clojurebot: I, Robot |
| 13:58 | clojurebot | historical ninja robots are so 1999... |
| 13:58 | nDuff | Cheiron: No, they aren't recreated on invocation in any event |
| 13:58 | nDuff | Cheiron: ...compilation happens once, at compilation time, unless you're using eval. |
| 13:59 | Cheiron | nDuff: Oh, amazing to know that! |
| 13:59 | Cubic | nDuff: How do closures work? Just function objects like in C++? |
| 13:59 | nDuff | Cubic: I don't know the implementation details. |
| 13:59 | goracio | emezeske: fetch-messages works fine |
| 13:59 | Cheiron | nDuff: so they will be created the very first time the father function is called? and then they live in the memory? (no re-creation is ignited if the father function is called again) |
| 14:00 | nDuff | Cheiron: No, they're called when the namespace the parent function is in is compiled, well before the invocation. |
| 14:02 | Cheiron | nDuff: still a little bit unsure. the namespace is compiled. those eight closure lives inside a function (created inside let form) . how they aren't created every time the parent function is called? |
| 14:02 | nDuff | Cheiron: Because no compilation happens except at compile time, period. |
| 14:03 | Sgeo | I think Cheiron might not be asking about implementation details? |
| 14:03 | nDuff | Cheiron: ...otherwise you couldn't use those forms in ClojureScript, which has no compiler available without a JVM. |
| 14:03 | emezeske | goracio: Hmm, and get-replies works when the (fetch-messages) call is removed from it's body? |
| 14:04 | Sgeo | ,((fn [a] (fn [b] (+ a b))) 5) |
| 14:04 | clojurebot | #<sandbox$eval27$fn__28$fn__29 sandbox$eval27$fn__28$fn__29@377cf9e5> |
| 14:04 | Sgeo | ,(((fn [a] (fn [b] (+ a b))) 5) 6) |
| 14:04 | clojurebot | 11 |
| 14:04 | gfredericks | ,(let [{:keys [foo jam]} '(:foo 12 :bar 17)] [foo jam]) |
| 14:04 | clojurebot | [12 nil] |
| 14:05 | Sgeo | Cheiron, are you thinking of closures as functions that semantically get created at runtime? |
| 14:05 | gfredericks | ,(let [{:keys [foo jam]} [:foo 12 :bar 17]] [foo jam]) |
| 14:05 | clojurebot | [nil nil] |
| 14:05 | Sgeo | Because that's how I think of them too, but implementation may be different |
| 14:05 | Cheiron | Sgeo: yes exactly |
| 14:06 | gfredericks | Sgeo: every fn form is a class, and each time "a function gets created at runtime" the class is instantiated |
| 14:06 | gfredericks | I think the object mainly holds information about the bindings |
| 14:07 | Cheiron | what I mean : a function creating eight closure functions inside it using let form. every time the parent function is called, the eight closures are going to be created? |
| 14:07 | Sgeo | That might not be what's going on in the implementation, but semantically that sounds about right |
| 14:07 | gfredericks | the 8 classes will be instantiated |
| 14:07 | goracio | emezeske: looks like get-replies doesn't work :) |
| 14:09 | Sgeo | You can simulate closures in environments without closures, with some difficulty |
| 14:09 | emezeske | goracio: Good deal. I would look at the forms that you're trying to send back from the server -- I expect that you're trying to send some Clojure object that ClojureScript can't read. |
| 14:10 | goracio | ok |
| 14:14 | Cubic | nDuff: JavaScript has closures though, so technically the functions could still be recreated all the time |
| 14:15 | nDuff | Cubic: Indeed, I assumed a fairly specific value of "created". That's a different, valid interpretation. |
| 14:18 | Cubic | Has anyone here tried using Light Table? |
| 14:20 | technomancy | ~anyone |
| 14:20 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 14:23 | Cubic | Oh sorry, I didn't know you couldn't have subjective discussions here. Guess that's to be expected to avoid clutter |
| 14:23 | lynaghk | dnolen: not sure how we could do "not-has-keyo" within the partial map's record protocol implementations. |
| 14:24 | dnolen | lynaghk: you wouldn't do it there, would just be normal goal. |
| 14:24 | dnolen | lynaghk: keys always have to be ground anyway. |
| 14:24 | lynaghk | dnolen: okay. Let me rip that stuff out and get you a new patch (assuming the rest of the current one looks okay) |
| 14:25 | dnolen | lynaghk: you can build your sugar on top of that. |
| 14:25 | nDuff | Cubic: It's not so much about subjectivity, more about respecting peoples' time. You're asking a large crowd of people to volunteer without specifying what you want to talk about in enough detail for any of them to know if they're _really_ the right person to answer. "Does anyone use foo" sounds pretty similar to "does anyone know enough about foo to volunteer to answer some arbitrary, unstated question" on IRC. |
| 14:25 | dnolen | lynaghk: I'm assuming the syntax you were showing were additions to the simple unifier correct? |
| 14:25 | lynaghk | dnolen: the !_ syntax is just a symbol in the partial map's IUNifyWithMap routine. |
| 14:26 | Cubic | That's what I meant. I didn't really intend to ask a technical question. I don't want to be a bother, so sorry about that. |
| 14:26 | dnolen | lynaghk: yeah, partial map should do anything would symbols at all. |
| 14:26 | dnolen | lynaghk: shouldn't |
| 14:26 | lynaghk | dnolen: shouldn't? |
| 14:27 | lynaghk | ah. |
| 14:27 | dnolen | lynaghk: the patch should be absolutely minimal. partial map unification, that's it |
| 14:27 | lynaghk | dnolen: okay, coming right up. |
| 14:27 | dnolen | lynaghk: but I'm all for sugar, but these enhancements should be separate discussions tickets. |
| 14:28 | @rhickey | is anyone currently using a macro/function called cond-> ? |
| 14:28 | dnolen | lynaghk: my philosophy is that you should be able to do this stuff with only the miniKanren primitives + some new fns. |
| 14:28 | lynaghk | dnolen: is the use of "load" okay with you? I wasn't sure how to put it in a separate namespace without getting into circular dependency mess, since you wanted the constructor in core.logic |
| 14:30 | Cubic | How do you `lein compile` with *warn-on-reflection*? |
| 14:31 | dnolen | lynaghk: hmm right ... yeah that's fine for now will address that later. |
| 14:31 | emezeske | Cubic: Add :warn-on-reflection true to your project.clj |
| 14:32 | lynaghk | dnolen: also, there's an issue where you can't automatically prep PMaps since walk doesn't know how to make an empty version of it. I think that's a separate ticket though |
| 14:33 | Cubic | Is that lein 1 or lein 2? I'm using lein2 and I don't get any warnings, although I know I should get some |
| 14:33 | emezeske | Cubic: Both. |
| 14:34 | dnolen | lynaghk: yeah - perhaps worth providing our own extensible version of clojure.walk |
| 14:34 | dnolen | lynaghk: btw looking forward to this patch! :) |
| 14:35 | dnolen | lynaghk: I'm really curious to see what you're going to do w/ it |
| 14:35 | lynaghk | dnolen: yeah, I'm jazzed to be finally using core.logic for something serious. =P |
| 14:38 | Cubic | emezeske: That's funny, I'm not getting anything from lein compile with or without :warn-on-reflection true, but when I call (compile my-module) from a repl with *warn-on-reflection* set I do get several |
| 14:38 | dnolen | rhickey: I saw that in codeq, looks neat |
| 14:38 | technomancy | Cubic: `lein compile` will only compile if there are changes; you can do a clean to force it to trigger. |
| 14:39 | Cubic | technomancy: Ah thanks, it works now. |
| 14:41 | @rhickey | dnolen: I'm tired of it not being in core |
| 14:41 | @rhickey | kills the repeated let pattern |
| 14:43 | goracio | emezeske: well i just converted response object to str on the server side and it works now :) |
| 14:43 | emezeske | goracio: Great! |
| 14:43 | hiredman | what is the repeated let pattern? |
| 14:44 | dnolen | lynaghk: I'm a bit confused w/ your PMap implementation, you construct it but it doesn't have any fields - it needs to take the map right? |
| 14:44 | @rhickey | hiredman: (let [x something x (if y (mod x) x) ...] ...) |
| 14:44 | hiredman | I see |
| 14:44 | lynaghk | dnolen: I'm just merging the map into it using the provided map->PMap constructor |
| 14:45 | lynaghk | dnolen: the record is for protocol dispatch only |
| 14:45 | scottj | rhickey: is there a reason deftype and defrecord use `(let [] ...) instea dof `(do ...)? |
| 14:45 | @rhickey | (cond-> x y? (conj 42) z? (conj another)) |
| 14:45 | chouser | hah! This would have been a component of my (rejected) conj talk! |
| 14:45 | dnolen | lynaghk: ah right sorry I missed that I never use the record ctor fns. |
| 14:45 | @rhickey | chouser: I was waiting for you to chime in! |
| 14:46 | hiredman | well, uh, I went to go see waht cond-> and the first use of it in codeq.core still is a repeated let, so I am not sure I follow |
| 14:46 | @rhickey | is yours called cond-> ? |
| 14:46 | @rhickey | hiredman: would have been many more repeats |
| 14:46 | dnolen | lynaghk: ok this looks good. |
| 14:47 | hiredman | rhickey: well, it's your clojure.core :) |
| 14:48 | @rhickey | hiredman: that's why I'm here seeing if it would conflict for anyone |
| 14:48 | dnolen | lynaghk: I couldn't apply the patch with git am - could you fix that? |
| 14:48 | lynaghk | dnolen: rad. I'll kick around a nice way to do the no-has-keyo thing. There are some other goals I'll want in this matching process too, so I think you're right about that being a more general approach. |
| 14:48 | chouser | rhickey: ours all start with ->, so that one is ->cond |
| 14:49 | jkkramer_ | I've been using that pattern a lot lately to build up hash maps. I tried using an assoc-if fn but cond-> looks nicer |
| 14:49 | @rhickey | chouser: do you have any you use more than that one? I guess people love the nil-safe ones |
| 14:49 | lynaghk | dnolen: I just grabbed the diff from the github url. Branch is agaist e4587 master---are you on something else? |
| 14:50 | dnolen | lynaghk: yeah can you produce a patch w/ git? |
| 14:50 | dnolen | lynaghk: a bunch of things missing from that patch - attribution, commit message etc. |
| 14:51 | lynaghk | dnolen: ohh, I think I uploaded the diff. let me grab the patch. my bad. |
| 14:51 | chouser | rhickey: none of ours are nil-safe. ->when is probably our most often used. |
| 14:51 | @rhickey | chouser: how does ->when differ? |
| 14:51 | @rhickey | just nil returning? |
| 14:52 | lynaghk | dnolen: added. |
| 14:53 | chouser | Huh, I guess I hadn't thought about it but I guess ->when is just a degenerate case of ->cond |
| 14:53 | @rhickey | if so, it doesn't seem to correspond with 'when' |
| 14:54 | chouser | sorry, I haven't looked at these in a while. let me check |
| 14:54 | hiredman | chouser: really? I am note sure you could express ->when with ->cond in a -> |
| 14:54 | @rhickey | cond-> is (cond-> something test mod test mod ...) |
| 14:55 | chouser | ah, right. vs. (->when test mod) |
| 14:55 | chouser | no |
| 14:55 | chouser | sorry |
| 14:55 | @rhickey | chouser: where does the thing go? |
| 14:56 | chouser | (->when something test mod), returning something if test fails otherwise (-> something mod) |
| 14:56 | @rhickey | (->when maybe-nil mod) ? |
| 14:56 | @rhickey | chouser: that seem a real mismatch with when |
| 14:57 | Hodapp | whoa, rhickey actually comes in this channel? |
| 14:57 | hiredman | will we get cond->>? |
| 14:58 | @rhickey | hiredman: probably, although for some reason I almost never need that |
| 14:58 | dnolen | lynaghk: applied! and merged cleanly into the branch for the next version of core.logic |
| 14:58 | chouser | so this isn't our code -- we discovered pallett already had a think like our ->when: https://github.com/pallet/thread-expr/blob/develop/src/pallet/thread_expr.clj#L40 |
| 14:58 | lynaghk | dnolen: thanks! |
| 14:59 | hyPiRion | So is putting everything into a pipeline the new thing nowadays? |
| 14:59 | hiredman | I'd hardly call it new, and it isn't everything |
| 14:59 | hiredman | ->> is just great |
| 15:00 | @rhickey | chouser: so is special case of cond-> |
| 15:00 | chouser | It's nice for like (-> q (conj :foo) (->when need-bar (conj :bar)) pop) |
| 15:01 | chouser | rhickey: yes, I think so. I hadn't noticed that before as we kept wanting ->when and then got a bit silly writing other ->* |
| 15:01 | @rhickey | yes, same use case as cond-> |
| 15:01 | hiredman | https://gist.github.com/184831 pre ->> sequence processing |
| 15:02 | @rhickey | anyone opposed-to/confused-by cond-> cond->> ? |
| 15:02 | jkkramer_ | fwiw, at first I expected cond-> to only follow one branch, like cond |
| 15:02 | chouser | when, when-not, if, cond, let, assoc, first, second, nth, last, and ->> versions of all, plus some other's we're even less sure are good ideas. |
| 15:03 | jkkramer_ | but once you know what it does, it's fine. I'd use it extensively |
| 15:03 | hiredman | jkkramer_: pretty sure it does? |
| 15:03 | @rhickey | jkkramer_: yes, that is different depending upon how you think about it |
| 15:03 | gfredericks | jkkramer_: I assumed it did until you said that |
| 15:03 | chouser | ohhh. Our cond only follows one. |
| 15:03 | @rhickey | no, keeps going, each thread is guarded |
| 15:03 | jkkramer_ | guarded-> ? |
| 15:04 | nDuff | ...okay, I'm forgetting something basic here. How do I get a var, rather than its value? |
| 15:04 | chouser | I see from the codeq impl that cond-> does not stop checking |
| 15:04 | Cubic | What does cond-> actually do? |
| 15:04 | hiredman | interesting |
| 15:04 | chouser | Cubic: https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/util.clj#L27 |
| 15:04 | ddeaguiar | ,(var) |
| 15:04 | clojurebot | #<CompilerException java.lang.NullPointerException, compiling:(NO_SOURCE_PATH:0)> |
| 15:05 | uvtc | nDuff: #'my-symbol ? |
| 15:05 | nDuff | Ahh. |
| 15:05 | @rhickey | jkkramer_: guard does mean anything in Clojure at present |
| 15:05 | nDuff | graci. |
| 15:06 | jkkramer_ | just wondering if something other than "cond" would communicate its semantics better. seems everyone expected it to follow one branch |
| 15:06 | @rhickey | I don't see much use in the branching logic |
| 15:06 | @rhickey | but yes, don't want people confused |
| 15:06 | jkkramer_ | not suggesting it should branch. right |
| 15:07 | chouser | rhickey: So now I'm uncertain about the multiple matches in a thing called cond->, compared to clojure.core/cond. But I have no complaint about the semantics. |
| 15:07 | ddeaguiar | nDuff: or (var my-symbol) |
| 15:07 | jkkramer_ | I'll be adding it to my util lib regardless |
| 15:07 | @rhickey | chouser: agreed. so we play the name game |
| 15:07 | @rhickey | test-> |
| 15:07 | hiredman | the repeated let thing makes more sense |
| 15:07 | zerokarmaleft | let-> |
| 15:07 | zerokarmaleft | ? |
| 15:08 | @rhickey | zerokarmaleft: I'd expect a binding form (let-> [x init] test mod test mod ...) |
| 15:08 | Bronsa | let->fix |
| 15:08 | @rhickey | and being able to use x in expressions |
| 15:08 | chouser | I love the name game! But I have to run. Good luck! |
| 15:08 | @rhickey | I have one of those, but it is less composable |
| 15:09 | hyPiRion | So you apply mods until one predicate fails. |
| 15:10 | @rhickey | no, you just don't do that mod if that one fails |
| 15:10 | hyPiRion | oh, okay. |
| 15:10 | @rhickey | it flows all the way through |
| 15:10 | hiredman | test-> seems to communicate what it does |
| 15:10 | @rhickey | build-. was another name |
| 15:10 | @rhickey | build-> |
| 15:11 | gfredericks | maybe-> |
| 15:11 | @rhickey | guard also works, but those are often branching too |
| 15:11 | TimMc | fix-> matches amalloy's useful/fix |
| 15:11 | hugod | pallet-thread's when-> returns it's first argument when test fails so the threaded value just falls through to the next expression - I don't see that as incongruous with when |
| 15:11 | gfredericks | or perhaps-> so as not to evoke monads :) |
| 15:11 | @rhickey | gfredericks: I like maybe for maybe someone will give me something, not maybe I will do something |
| 15:12 | hyPiRion | So you apply mod if pred is true. |
| 15:12 | hyPiRion | "apply" |
| 15:12 | @rhickey | there's no need to rename the -> notion |
| 15:12 | jkkramer_ | I kinda like build->, since that's what I'd use it for. but test-> is ok too |
| 15:12 | @rhickey | the enhancement to -> is that each step is conditional |
| 15:13 | gfredericks | I definitely already have the word 'fix' in my head for this functionality due to flatland/useful as mentioned by TimMc |
| 15:15 | zerokarmaleft | build-> seems to evoke the use case intent, test-> seems to evoke the mechanism |
| 15:15 | hyPiRion | I think of each step as optional/depending on the predicates. So my name-shot would be opt-> or optional->. |
| 15:15 | @rhickey | hugod: when examines the truthiness of its first arg, not call a test |
| 15:16 | hyPiRion | But I don't think it's evident from its name. |
| 15:16 | Hodapp | truthiness? |
| 15:16 | @rhickey | hugod: I'd expect anything named (whenblah x ...) to test the truth of x |
| 15:16 | @rhickey | gfredericks: link? |
| 15:16 | andrewmcveigh | hence-> |
| 15:16 | gfredericks | Hodapp: truthiness meaning the behavior of clojure.core/boolean |
| 15:16 | andrewmcveigh | ? |
| 15:17 | gfredericks | rhickey: https://github.com/flatland/useful/blob/develop/src/useful/fn.clj#L30 |
| 15:17 | pandeiro | for composability i'd like to be able to dynamically resolve method names on a javascript object and call those methods - can i do that in clojurescript? |
| 15:17 | TimMc | ->p |
| 15:17 | @rhickey | andrewmcveigh: not really a consequence |
| 15:17 | hugod | rhickey: when used with -> it looks like that (-> 1 (when-> true (+ 1))) => 2 |
| 15:17 | gfredericks | rhickey: I don't think any of these are exactly the same functionality, but I think they all have the conditional-modification flavor |
| 15:17 | lancepantz | fwiw, we use fix all the time in our codebase |
| 15:18 | amalloy | rhickey: i think cond-> is the same as https://github.com/flatland/useful/blob/develop/src/useful/fn.clj#L66, but i'm not 100% sure |
| 15:18 | @rhickey | hugod: but not without |
| 15:18 | amalloy | we use it the same way, for stuff like (-> foo (given even? (+ 10))) |
| 15:19 | tomoj | isn't it pretty obvious that cond-> doesn't follow only one branch, given that it's ->-shaped? |
| 15:19 | @rhickey | amalloy: no, that tests the subject, these predicates have nothing to do with it |
| 15:20 | hugod | rhickey: sure, but the only reason to use when-> is within -> |
| 15:20 | TimMc | amalloy: Is given short-circuiting? |
| 15:20 | amalloy | TimMc: just catching up now. where's the fix-> you mentioned? |
| 15:20 | pandeiro | iow, can someone show me this in cljs: function doClassOp(op, el, arg) { el.classList[op](arg); } |
| 15:20 | gfredericks | tomoj: the -> suggests that but the word 'cond' suggests the opposite; so depends which one you notice first |
| 15:20 | @rhickey | tomoj: I think so, bit I see the other side too |
| 15:20 | TimMc | amalloy: Elsewhere, and it's called cond-> so far. |
| 15:20 | amalloy | yes. matches one clause and then stops |
| 15:20 | @rhickey | hugod: I don't buy it |
| 15:20 | TimMc | https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/util.clj#L27 |
| 15:23 | wall | hello. i have questions about antlr+clojure. in blog http://briancarper.net/blog/554/ describe about it, but then i run "java -cp 'lib/*' org.antlr.Tool src/antlr_example/Expr.g" i'll get Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/Tool |
| 15:23 | wall | Caused by: java.lang.ClassNotFoundException: org.antlr.Tool |
| 15:23 | wall | at java.net.URLClassLoader$1.run(URLClassLoader.java:217) |
| 15:23 | wall | at java.security.AccessController.doPrivileged(Native Method) |
| 15:23 | wall | at java.net.URLClassLoader.findClass(URLClassLoader.java:205) |
| 15:23 | wall | at java.lang.ClassLoader.loadClass(ClassLoader.java:321) |
| 15:23 | wall | at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) |
| 15:23 | wall | at java.lang.ClassLoader.loadClass(ClassLoader.java:266) |
| 15:23 | wall | Could not find the main class: org.antlr.Tool. Program will exit. |
| 15:23 | wall | how i can solve this problem? |
| 15:23 | amalloy | rhickey: given actually works either way: if a clause is a non-ifn value, then it's tested as a value instead of used as a predicate on the subject |
| 15:24 | TimMc | wall: Please use a pastebin such as refheap.com next time. |
| 15:24 | @rhickey | amalloy: that's just too tricky |
| 15:24 | wall | <TimMc> - sorry. |
| 15:24 | amalloy | heh, i agree; that feature was added against my will. but it does make it line up with your cond-> more closely |
| 15:25 | hugod | rhickey: maybe ->when would have been a better name. pallet-thread's macros are all for use within -> expressions, whereas cond-> is something different. |
| 15:25 | @rhickey | hugod: I don't see why things need to be made for with ->, if they are good they will work there and elsewhere |
| 15:25 | gfredericks | ?-> |
| 15:25 | uvtc | possible naming consideration: I tend to think "to" when I see "->". |
| 15:26 | tomoj | gfredericks: yeah I guess I noticed the -> first.. |
| 15:26 | @rhickey | gfredericks: yes, will get perl snickers |
| 15:26 | gfredericks | perl snickers sounds like a tasty candy |
| 15:26 | scottj | pred-> |
| 15:26 | Hodapp | perl... snickers? |
| 15:26 | @rhickey | scottj: not really a pred in that not a fn called on the subject |
| 15:27 | @rhickey | just tested values |
| 15:27 | TimMc | But it's threading with a bunch of predicates... |
| 15:27 | @rhickey | a pred is a function of something |
| 15:27 | gfredericks | oh hmm |
| 15:27 | TimMc | oh wait, y? and z? aren't predicates? |
| 15:27 | @rhickey | TimMc: no |
| 15:27 | @rhickey | not in the sense of filter etc |
| 15:28 | TimMc | Suddenly I'm a lot less interested in this macro. |
| 15:28 | scottj | example usage https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/core.clj#L375 |
| 15:28 | @rhickey | scottj: thanks |
| 15:28 | gfredericks | TimMc: you really think most of the time you'd want to pass the subject in to a function |
| 15:28 | gfredericks | ? |
| 15:28 | @rhickey | the repeated let this replaces is a very common pattern |
| 15:29 | dnolen | rhickey: and annoying ;) |
| 15:29 | ninjudd | rhickey: the decision to support both subject predicates and test clauses was a compromise between amalloy and myself. if you have to choose one, it would certainly have to be the latter, but supporting predicates on the subject does make for some supremely readable code |
| 15:29 | @rhickey | one of the biggest tripups for people trying to build things non-imperatively |
| 15:29 | TimMc | I can't think of a single time I've done repeated let'ting on a binding that just checks against a value. |
| 15:29 | @rhickey | ninjudd: no need to cram into one construct |
| 15:29 | @rhickey | TimMc: not for you then |
| 15:30 | dnolen | rhickey: yep, (let [x ... x ...] ...) will burn you eventually. |
| 15:30 | TimMc | Yeah. I'd like something that does that, though. |
| 15:30 | scottj | I like that build-> doesn't autocomplete match anythign in core with bui. granted not a sufficient reason to choose it :) |
| 15:30 | @rhickey | clojure.core is full of it |
| 15:30 | gfredericks | TimMc: you can do it with (fix-> subject (funky? subject) trsform ...) |
| 15:31 | ninjudd | rhickey: i think you're right. i tend to make that mistake |
| 15:31 | @rhickey | scottj: the problem with build is that cond-> is also good inside of (-> ...) |
| 15:31 | TimMc | gfredericks: Not past the first pair. |
| 15:31 | gfredericks | TimMc: sure, but it doesn't sound very likely to me that you would have to test the most recent value of subject |
| 15:31 | hyPiRion | Question: Do you use the same function over and over with cond-> ? I see conj/assocs only. |
| 15:32 | lancepantz | i like the usefulness of cond-> but having "cond" in it when each clause is evaluated after a match is very confusing |
| 15:32 | TimMc | Oh, I see -- this is for when you have a lot of parameters that control how you munge a value. |
| 15:32 | @rhickey | TimMc: see earlier, let-> let's you test the value being built as it is named |
| 15:32 | Sgeo | Any use for a let-> (defmacro let-> [val varname & body] `(let [~varname ~val] ~@body)) |
| 15:32 | Sgeo | ? |
| 15:32 | Sgeo | Or is that different from what's being discussed? |
| 15:32 | TimMc | So you want to turn various sub-munging steps on and off. |
| 15:32 | gfredericks | Sgeo: that's just different but not really shorter syntax, so merely confusing |
| 15:33 | wall | anybody can help me with antlr? |
| 15:33 | Sgeo | What's being discussed? |
| 15:33 | @rhickey | TimMc: the linked example shows a typical use |
| 15:33 | gfredericks | Sgeo: any answer to that would probably just be repeating something from above |
| 15:33 | Sgeo | Ah, sorry |
| 15:34 | TimMc | Sgeo: Naming for https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/util.clj#L27 |
| 15:34 | zerokarmaleft | Sgeo: as used in https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/core.clj#L375 |
| 15:35 | TimMc | wall: The room's pretty busy right now on a different topic -- you probably want to wait until conversation dies down a little and pose your question again. |
| 15:36 | hiredman | wall: that error means that antlr class org.antlr.Tool is not on the classpath |
| 15:36 | @rhickey | not loving anything more than cond-> yet, reservations aside |
| 15:37 | @rhickey | read it as conditional thread |
| 15:37 | Sgeo | gfredericks, but it could be useful inside a -> ? |
| 15:37 | Sgeo | Although off-topic I gues |
| 15:37 | Sgeo | s |
| 15:37 | hiredman | wall: you might be missing the class because you don't have the jar that cintains the class, or you have a different version of the library with the class named something different |
| 15:37 | uvtc | "conditional thread-first"? |
| 15:37 | @rhickey | right |
| 15:37 | @rhickey | and cond->> |
| 15:37 | gfredericks | Sgeo: ah right; does the swiss-arrows' diamond-wand cover your use cases? |
| 15:38 | lancepantz | but it always evaluates all of the clauses? |
| 15:38 | @rhickey | yes |
| 15:38 | @rhickey | else there's not much threading going on |
| 15:38 | Sgeo | Actually, I think the diamond-wand is a bit broken. There's no way to put the diamond as part of a result of an if clause, is there? |
| 15:39 | lancepantz | i love the functionality, but it's confusing to have that in the api with cond |
| 15:39 | gfredericks | Sgeo: like (-<> (if foo <> bar))? |
| 15:39 | abrooks | Is 'chain too overloaded? |
| 15:39 | wall | <hiredman> but after lein deps in folder /home/wall/.m2/repository/org/antlr/Tool/3.2 no files. and no folder lib in my project folder. how fix it? |
| 15:39 | lancepantz | accumulate-> ? |
| 15:39 | lancepantz | acc-> ? |
| 15:39 | Sgeo | gfredericks, oh, hmm. What about if I wanted to do (-<> (if foo (inc <>) (dec <>))) |
| 15:40 | @rhickey | lancepantz: that's just redundant on the -> part of the semantics |
| 15:40 | lancepantz | i want to say apply-> but that has the same problem as cond |
| 15:40 | Iceland_jack | -<> would be fantastic to Google |
| 15:41 | hiredman | wall: if you are using lein2 it doesn't create a lib folder |
| 15:41 | hiredman | wall: it uses jars right out of the ~/.m2 cache |
| 15:41 | @rhickey | abrooks: chain also just redescribes -> |
| 15:41 | ninjudd | scottj: here is your example from above written using given https://gist.github.com/3881046 |
| 15:41 | hiredman | wall: did you specify the antlr jar as a dependency in your project.clj? |
| 15:41 | gfredericks | Iceland_jack: http://symbolhound.com/?q=-%3C%3E |
| 15:41 | @rhickey | we need to describe the conditional aspect |
| 15:42 | gfredericks | Sgeo: ah I see; so you mean it can only be used once |
| 15:42 | amalloy | Iceland_jack: symbolhound, except it apparently doesn't index github |
| 15:42 | gfredericks | Sgeo: though I don't see why it has to be that way |
| 15:42 | lancepantz | ninjudd: i like that given-> does read better |
| 15:42 | Sgeo | gfredericks, not that, but I mean that it can't be used in subforms if I understand -<> properly |
| 15:42 | hugod | the guarded-> suggestion sounds the nearest to what it does, to me |
| 15:42 | gfredericks | Sgeo: I think it can |
| 15:42 | amalloy | guarded is a neat word for it |
| 15:43 | wall | hiredman: yes. lein version return Leiningen 2.0.0-preview10 on Java 1.6.0_24 OpenJDK 64-Bit Server VM. But how correct project.clj to compile? |
| 15:43 | uvtc | ~guarded |
| 15:43 | clojurebot | Titim gan éirí ort. |
| 15:43 | Sgeo | "the <> hole form is not recursive, it only works at the top level." |
| 15:43 | hiredman | wall: project.clj is not something you compile |
| 15:44 | gfredericks | Sgeo: wat. that is lamez. |
| 15:44 | ninjudd | in the example, given is a lower-level construct that can be used with -> if you don't want short-circuiting |
| 15:44 | Sgeo | https://github.com/rplevy/swiss-arrows/blob/master/src/swiss_arrows/core.clj#L3 |
| 15:44 | hiredman | wall: have you read the lein readme? https://github.com/technomancy/leiningen |
| 15:44 | amalloy | gfredericks: not surprising, right? so is swiss-arrows |
| 15:44 | @rhickey | guards are like cond in other langs - one branch taken |
| 15:44 | wall | hiredman: yes. in project.clj exists [org.antlr/antlr "3.2"] |
| 15:44 | hyPiRion | Is there any fn which works the same way-ish? |
| 15:44 | gfredericks | amalloy: not that I knew |
| 15:44 | Sgeo | It does allow for nested -<> forms |
| 15:44 | hyPiRion | I keep on thinking about filter or keep, but I don't know if those are near enough. |
| 15:44 | hyPiRion | keep-> ? |
| 15:44 | Sgeo | amalloy, I do think <<- is nice |
| 15:45 | hiredman | wall: so that will never work, because you are using lein2, there is no lib dir full of libs |
| 15:45 | hyPiRion | it's not really describing it correctly. |
| 15:45 | zerokarmaleft | i thought guards in haskell fell through to subsequent guards? |
| 15:45 | @rhickey | zerokarmaleft: until a match |
| 15:45 | zerokarmaleft | oh right |
| 15:45 | @rhickey | one match, like cond |
| 15:45 | hiredman | wall: `lein classpath` should spit out a classpath you can use |
| 15:46 | wall | hiredman: and how correct for lein2? |
| 15:46 | ninjudd | you only need one match though. if you want multiple, use multiple gaurds and thread through them |
| 15:46 | hiredman | wall: I don't follow |
| 15:46 | antares_ | wall: have you posted your project.clj? If not, it's time to do so. |
| 15:47 | amalloy | ninjudd makes a good point: if you have something that matches a single clause and then stops (like flatland's given), it's easy to build something like cond-> by combining multiple givens; with cond->, you can't easily derive given |
| 15:48 | hiredman | antares_: his problem is he is trying to run a command line that expacts his jars to ./lib but lein2 doesn't create a ./lib |
| 15:48 | TimMc | wall: Leiningen has a classpath command. |
| 15:48 | TimMc | -cp `lein classpath` might do what you want. |
| 15:49 | antares_ | hiredman: ah, ok |
| 15:49 | wall | antares_:http://pastebin.com/F2UC9SUA |
| 15:49 | pandeiro | why does (. object (method ...)) take the first element if method is a string? |
| 15:49 | antares_ | wall: it looks OK except for the :dev-dependencies part |
| 15:50 | pandeiro | i have to do this to dynamically resolve a method name in cljs: (. object (["methodName"] ...)) |
| 15:50 | chouser | is the name game done? |
| 15:51 | hyPiRion | chouser: Nope, you're still in for the party. |
| 15:51 | @rhickey | nope |
| 15:51 | chouser | repeated uses of when-> ? |
| 15:52 | @rhickey | chouser: ? |
| 15:52 | pandeiro | wouldn't (. object ("method" ...)) make more sense if it resolved "method" to 'method, rather than to \m ? |
| 15:52 | hyPiRion | (c-> init test1 mod1 test2 mod12 == (w-> (w-> init test1 mod1) test2 mod2) |
| 15:53 | chouser | (-> foo (cond-> t1 m1 t2 m2 t3 m3)) written instead as (-> foo (when-> t1 m1) (when-> t2 m2) (when-> t3 m3)) |
| 15:54 | @rhickey | ick |
| 15:54 | @rhickey | why hve cond when you can have nested ifs? |
| 15:54 | dnolen | pandeiro: that would require changing Clojure. you can also use aget, (aget o "methodName") |
| 15:54 | chouser | these aren't nested (visually) |
| 15:54 | @rhickey | the repeated when->s take away from seeing the work |
| 15:55 | dnolen | pandeiro: I'm assuming this for interop |
| 15:55 | @rhickey | and when-> is still a bad name for that |
| 15:55 | chouser | why? |
| 15:55 | clojurebot | Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone |
| 15:55 | hyPiRion | (when-> init test mod1 mod2 mod3) sounds reasonable. |
| 15:55 | @rhickey | because when implies a truthiness test of first arg |
| 15:55 | pandeiro | dnolen: yeah but on natives it borks |
| 15:56 | @rhickey | hugod made an argument for it just being for insie -> but I don't buy it |
| 15:56 | chouser | ah, which only holds (to the extent that it does) in a -> |
| 15:56 | pandeiro | eg el.classList.[add|contains|remove] |
| 15:56 | @rhickey | chouser: exactly |
| 15:56 | dnolen | pandeiro: why do you need to a dynamic lookup on natives? |
| 15:56 | pandeiro | dnolen: wrapping a bunch of html5 apis for a chrome extension |
| 15:57 | pandeiro | dnolen: is that hack i came up with reliable moving forward, you think? |
| 15:57 | pandeiro | (. object (["methodName"] ...) |
| 15:58 | jamii | rhickey: you mentioned using QSQR to evaluate datalog - do you have a good reference for that? I found some papers explaining how to apply it to Horn knowledge bases, just wondering if there is a simpler version for datalog |
| 15:58 | @rhickey | whence-> |
| 15:58 | dnolen | pandeiro: I would not rely on it. |
| 15:58 | chouser | heh |
| 15:59 | dnolen | pandeiro: I assume you're doing this for feature detection? |
| 15:59 | @rhickey | jamii: http://www.amazon.com/Foundations-Databases-The-Logical-Level/dp/0201537710 |
| 15:59 | pandeiro | dnolen: yes and building higher order functions with partial etc |
| 15:59 | dnolen | pandeiro: if you are I don't understand why you can just use the normal property syntax. |
| 15:59 | chouser | actually, that's not bad |
| 16:00 | jamii | rhickey: awesome, thanks |
| 16:00 | pandeiro | dnolen: some APIs have 10-20 methods and it adds a lot of code to have to cond for each method rather than resolve dynamically |
| 16:00 | dnolen | pandeiro: (if (.-propertyName j/SomeNative ...) ...) |
| 16:01 | pandeiro | dnolen: yeah feature=testing is fine |
| 16:01 | chouser | resolved-> |
| 16:01 | chouser | in the debate topic sense |
| 16:01 | @rhickey | if we get that long we can use guarded-> |
| 16:01 | pandeiro | i wanted document['createElement']('div')... |
| 16:02 | pandeiro | ...in cljs |
| 16:02 | dnolen | pandeiro: ((aget js/document "createElement") "div") should work just fine. |
| 16:02 | chouser | where-> |
| 16:02 | pandeiro | dnolen: it doesn't b/c of .call |
| 16:02 | hyPiRion | chouser: That sounds pretty close to something working. |
| 16:02 | ninjudd | i like where-> |
| 16:02 | amalloy | i like where-> best so far |
| 16:03 | pandeiro | dnolen: i am testing with himera at the moment but i assume this is not different in r1450 |
| 16:03 | aperiodic | oh my god, i was just wishing that cond-> existed yesterday |
| 16:03 | dnolen | pandeiro: it is different |
| 16:03 | pandeiro | dnolen: eesh sorry |
| 16:03 | hugod | on-> |
| 16:04 | @rhickey | chouser: setting aside Clojure's use of when, when-> is better than where-> |
| 16:04 | dnolen | pandeiro: oops, actually perhaps not ... |
| 16:04 | dnolen | pandeiro: but testing against Himera is not recommended very out of date now. |
| 16:04 | ninjudd | i think i like given-> better, but where-> is a close second |
| 16:04 | wall | TimMc: Thanks. i solve all problem |
| 16:04 | @rhickey | and cond, and case |
| 16:04 | dnolen | pandeiro: in anycase that's the real problem. |
| 16:05 | ninjudd | what about -?> |
| 16:05 | pandeiro | dnolen: yeah i am with very broken code so firing up cljs.repl is a pain but... is there a fix for this or is it just outside the purview? |
| 16:05 | pandeiro | all cljs fns get called with .call, right? |
| 16:06 | dnolen | pandeiro: depends |
| 16:06 | @rhickey | then-> |
| 16:06 | dnolen | pandeiro: if the function is js/foo never, under advanced optimizations we try to eliminate call as much as possible since it's slow. |
| 16:07 | pandeiro | dnolen: yeah but the nested natives are a different beast yeah? |
| 16:07 | TimMc | ninjudd: -?> is a nil-short-circuiting version of -> |
| 16:07 | TimMc | and I wish *that* were in core |
| 16:07 | @rhickey | cond-> is the right name, how to stave off the confusion |
| 16:07 | ninjudd | TimMc: yeah. just saw https://github.com/clojure/core.incubator |
| 16:08 | TimMc | Oh, it's in incubator? Sweet. |
| 16:08 | @rhickey | cont-> (for contingent |
| 16:08 | @rhickey | ) |
| 16:08 | lancepantz | that's better |
| 16:08 | dnolen | pandeiro: they are ... is this problem everywhere or just in some browsers? |
| 16:08 | hyPiRion | Doesn't sound obvious for me. |
| 16:09 | TimMc | rhickey: Sometimes a block of clauses with (mild) repetetive structure makes code *easier* to read. |
| 16:09 | TimMc | The (when-> ...) (when-> ...) ... example someone posted earlier didn't look so bad to me. |
| 16:09 | lancepantz | to-> |
| 16:10 | @rhickey | when-> is broken IMO |
| 16:10 | @rhickey | a thing that only makes sense in a certain context |
| 16:10 | @rhickey | bleh |
| 16:10 | @rhickey | Clojure is not Ruby |
| 16:11 | TimMc | I have no opinion on when-> itself. |
| 16:12 | @rhickey | TimMc: people's confusion aside, cond-> looks great, so I;m not interested in anything other than a good name for it |
| 16:12 | abalone | hello :) paredit approximation exists now for codemirror. https://github.com/achengs/subpar |
| 16:12 | ssalc | rhickey: how about sub-> (from subordinate, def 2. here: http://www.thefreedictionary.com/subordinate) |
| 16:12 | abalone | the github repo has a demo page |
| 16:13 | lancepantz | what about then-> ? |
| 16:13 | @rhickey | gated-> |
| 16:13 | abalone | (also in the market for a job) |
| 16:14 | @rhickey | ssalc: sub is the prefix for too many things |
| 16:14 | lancepantz | then is nice because there isn't somehting to conflict with it already |
| 16:15 | chouser | cond*-> |
| 16:15 | @rhickey | chouser: yeah, but it's not let* |
| 16:16 | tomoj | abalone: sweet |
| 16:16 | chouser | no, it's not. |
| 16:16 | ninjudd | granted-> |
| 16:17 | @rhickey | we use when repeatedly in for |
| 16:17 | ninjudd | because-> |
| 16:18 | @rhickey | the loop dominating |
| 16:18 | chouser | bleh, you're right. And in 'for', :when is anded. Here it's closer to being 'ored |
| 16:18 | lancepantz | build-> ? |
| 16:18 | chouser | cont-> was a cute idea. no worse than juxt. :-) |
| 16:19 | pandeiro | dnolen: problem on [x] chrome [x] firefox [x] opera [x] android-webkit |
| 16:19 | @rhickey | chouser: bad pronunciation risks |
| 16:19 | ninjudd | i like cont-> if it isn't going to short circuit |
| 16:19 | lancepantz | rhickey: you should have heard the jokes in the office at that suggestion |
| 16:19 | @rhickey | not going to happen |
| 16:19 | chouser | oh, sigh. |
| 16:20 | Raynes | lancepantz: I heard them all the way from Alabama. |
| 16:20 | ninjudd | conds-> |
| 16:20 | lancepantz | hehe |
| 16:20 | chouser | conds-> isn't bad |
| 16:21 | lancepantz | that's a good point |
| 16:21 | hyPiRion | ifs-> may be just as good. |
| 16:21 | lancepantz | the s implies more than one |
| 16:21 | @rhickey | whens-> == whence-> |
| 16:21 | chouser | conds-> is just enough different to raise an appropriate question in the minds of the unfamiliar |
| 16:21 | TimMc | opt-> is my "vote" at this point |
| 16:21 | chouser | whence means "from where" doesn't it? |
| 16:21 | clojurebot | Excuse me? |
| 16:22 | @rhickey | chouser: here it's the 'resulting' meaning |
| 16:22 | abrooks | Yes, when I see 'whence I think locational. |
| 16:22 | TimMc | "From whence-> doth this name come?" |
| 16:23 | ninjudd | ergo-> |
| 16:23 | lancepantz | i like build-> and conds-> |
| 16:23 | technomancy | it seems like a pretty clear mash-up of cond and -> |
| 16:23 | hugod | for me, any form of cond implies the first argument is used in the predicates |
| 16:24 | @rhickey | all of those are somewhat too precious, the meaning we want is conditional-> |
| 16:24 | abrooks | I think 'conds-> or 'whens-> ake the most sense to me. |
| 16:24 | scottj | I don't like conds->, 1) for newbie, "is it plural?" 2) it might only have one clause |
| 16:24 | lancepantz | that's the point, it is a plural cond |
| 16:25 | technomancy | continuing beyond one condition is already implied by -> |
| 16:25 | lancepantz | if it has one clause there's no point in it |
| 16:25 | hyPiRion | lancepantz: That's scottj's point. It may be only one condition. |
| 16:25 | hyPiRion | oh, well, maybe. |
| 16:25 | lancepantz | umm, isn't that if? |
| 16:25 | lancepantz | *when |
| 16:25 | chouser | I disagree that when-> is incorrect. The -> overrides the usual meaning in all cases, indicating a threaded arg comes first. True in the case of cond-> as well. |
| 16:25 | amalloy | technomancy: no it isn't; you could easily write cond-> to thread into a the value of the first matching clause |
| 16:26 | technomancy | amalloy: why would you bother to write that as a macro though? it doesn't offer much value. |
| 16:26 | @rhickey | chouser: the test moves in when-> and doesn't in cond-> |
| 16:27 | chouser | the test gets shifted to the right by both |
| 16:27 | @rhickey | you expect pairs in cond |
| 16:27 | amalloy | technomancy: i disagree with that assertion, but i don't think it's relevant to the question of whether cond-> instantly implies to the reader that all clauses will be tried |
| 16:27 | ninjudd | cond-> is actually starting to grow on me, with a good docstring to make sure people understand how it is different |
| 16:28 | technomancy | "does what it says on the tin" |
| 16:28 | hyPiRion | ninjudd: I'm afraid it will be another case of "contains?". |
| 16:28 | technomancy | ->cond might express the threadiness of it better, but it reads horribly |
| 16:28 | jkkramer_ | i think it's sufficiently abstract to not be a problem for newbies |
| 16:28 | dnolen | pandeiro: hmm document.createElement.call exists in Chrome / Safari, but I guess this doesn't apply to all APIs? |
| 16:28 | @rhickey | so, not everyone presumes single branch. I agree -> implies threading |
| 16:29 | @rhickey | technomancy et al are with me |
| 16:29 | ninjudd | hyPiRion: contains? took me a while, but now i wouldn't have it any other way |
| 16:29 | lancepantz | i think slapping an s on the end solves the cond confustion |
| 16:29 | chouser | technomancy: if you didn't see it mentioned earlier, a friend and I wrote several ->foo macros, including ->cond. We actually liked the extent to which the leading -> stands out |
| 16:29 | @rhickey | conds is gross |
| 16:29 | ninjudd | confust-> |
| 16:29 | pandeiro | dnolen: interesting but i can't figure out how to invoke it |
| 16:29 | technomancy | chouser: hm; maybe it'd grow on me with time? |
| 16:30 | @rhickey | chouser: ->when works better than when-> |
| 16:30 | chouser | anyway, our ->cond expanded to actual cond, taking only one branch |
| 16:30 | technomancy | the other thing cond makes me think is "I should probably rewrite this as a pattern match" but that's a whole different can of worms. =) |
| 16:30 | dnolen | pandeiro: document.createElement.call(document, "div") |
| 16:30 | ddeaguiar | prefers cond-> over ->cond |
| 16:30 | jkkramer_ | ->cond could be confused with ->SomeRecord |
| 16:30 | Bronsa | jkkramer_: +1 |
| 16:30 | pandeiro | dnolen: cool, let me give that a spin |
| 16:31 | @rhickey | I don't like ->blah, just saying it reads thread-when |
| 16:31 | technomancy | maybe I'd be more comfortable with an arrow at the front if I actually used records |
| 16:31 | lancepantz | >>. done. |
| 16:31 | @rhickey | chouser: did you use that much: ->cond ? |
| 16:31 | jkkramer_ | I don't mind cond->, even though I presumed single branch at first |
| 16:31 | lancepantz | everyone is going to presume a single branch at first |
| 16:32 | @rhickey | lancepantz: several people have chimed in here otherwise |
| 16:32 | chouser | but I must say, I don't know that we ever used ->cond. ->when we used frequently, ->if occasionally, also the occasional ->first and ->assoc |
| 16:32 | dnolen | pandeiro: though that doesn't solve you're problem since we'd need to set the context in CLJS ... |
| 16:33 | lancepantz | i admit i have a penchant for overusing the words everyone and everywhere |
| 16:33 | @rhickey | Not thrilled with anything else, but let do a poll, one preference each |
| 16:33 | @rhickey | cond-> |
| 16:33 | lancepantz | conds-> |
| 16:33 | pandeiro | yeah it doesn't |
| 16:33 | chouser | conds-> |
| 16:33 | dnolen | cond-> |
| 16:33 | ninjudd | cond-> |
| 16:34 | hugod | guarded-> |
| 16:34 | ddeaguiar | cond-> |
| 16:34 | aperiodic | conds-> |
| 16:34 | amalloy | conds-> |
| 16:34 | technomancy | cond-> |
| 16:34 | dakrone | cond-> |
| 16:35 | andrewmcveigh | cond-> |
| 16:35 | hyPiRion | cond-> |
| 16:35 | chouser | No fair voting for cond-> just because it'll give you more karma from newbs answering simple questions! |
| 16:35 | scottj | gated-> (am I throwing my vote away?) |
| 16:35 | lancepantz | scottj: you voted for nader! |
| 16:35 | amalloy | chouser: srsly. ninjudd said he loves contains?, but he doesn't hang out in #clojure or on stackoverflow :P |
| 16:36 | @rhickey | anyone else - 2 minute warning |
| 16:36 | hyPiRion | hasn't clojurebot some timing stuff? |
| 16:36 | cemerick | lancepantz: so cynical! ;-) |
| 16:37 | amalloy | $say #clojure do bots get a vote? |
| 16:37 | lazybot | do bots get a vote? |
| 16:37 | scottj | I might have missed this, but couldn't you write a cond-> like thing that would follow only one clause? For that construct, what would be the perfect name for it? cond->? |
| 16:37 | amalloy | scottj: yeah, brought up three times or so and rejected |
| 16:37 | jkkramer_ | cond-> is good enough |
| 16:37 | zerokarmaleft | cond-> |
| 16:37 | amalloy | the version ninjudd and i have is called given; chouser likes when-> |
| 16:38 | lancepantz | looks like the the cond->'s have it |
| 16:39 | pandeiro | dnolen: just going to write everything with the dot since after advanced compilation it probably wouldn't make much difference, just more painful to type. maybe there is not a huge use case for this |
| 16:39 | @rhickey | ok everyone, thanks for your input, it was fun. coming soon, under some name, to a lang near you |
| 16:40 | lancepantz | rhickey: its a good function, i'm glad you're adding it |
| 16:40 | chouser | :-) |
| 16:40 | hyPiRion | lancepantz: macro :o |
| 16:40 | lancepantz | ofcourse i'll have to rewrite all of our givens |
| 16:40 | lancepantz | * macro :) re hyPiRion |
| 16:41 | dnolen | pandeiro: yeah I've got no answers yet for your issue - I will say I don't find this kind of approach very nice even in JS. While it's not evidence - it's also not something I've heard many people complain about. |
| 16:41 | Cheiron | Hi, i created a function with two arities. first has the signature ([& {:keys .....}]) and the second arity is [obj1 obj2] but it looks it is not allowed |
| 16:42 | Cheiron | am i missing something? |
| 16:42 | amalloy | Cheiron: (foo :a :b). what body would be invoked? |
| 16:42 | Cheiron | hmm, true |
| 16:42 | lancepantz | amalloy: with the socratic method |
| 16:43 | Cheiron | amalloy: I asked earlier. a function declaring 8 closure functions inside its body with let form. every time the parent function is called , the eight closures will be created? |
| 16:46 | amalloy | since i've been pegged as socrates: what do you think? would it make sense for them not to be created? if so, how does it work? |
| 16:47 | Cheiron | i think they will be created every time the parent function is called |
| 16:47 | lancepantz | you are correct |
| 16:48 | Cheiron | i created those 8 functions as closures because no other function is using them |
| 16:48 | lancepantz | well, they probably get jit'ed away or something |
| 16:48 | lancepantz | but i don't know |
| 16:48 | ddeaguiar | would defining them as (fn foo [..]) instead make a difference? |
| 16:49 | emezeske | Cheiron: Have you profiled your application and found the nested functions to be a performance bottleneck? |
| 16:49 | amalloy | what about in (defn foo [x] (let [f #(+ x %)] (if (even? x) (let [g #(dec %)] (g x)) (f 10))))? |
| 16:49 | Cheiron | emezeske: no not yet but planning to |
| 16:49 | amalloy | emezeske: trick question: nobody in the history of the universe has ever found that to be the bottleneck |
| 16:50 | emezeske | Cheiron: My advice, then, is to stop caring about them |
| 16:50 | emezeske | amalloy: >:) |
| 16:50 | Cheiron | amalloy: what us that code ? :D |
| 16:50 | Cheiron | *is |
| 16:51 | amalloy | i disagree with the advice, though. it's good to know what's going on under the hood; Cheiron hasn't said a word about caring about the performance |
| 16:52 | emezeske | amalloy: Oh, I didn't scroll up enough. I assumed this was an argument about performance. |
| 16:52 | Cheiron | performance issues? I'm not sure how 8 closures will differ from 8 defns in performance |
| 16:53 | emezeske | amalloy: I agree that knowing what's going on is a good thing. |
| 16:53 | amalloy | emezeske: if you scroll wayyyyyy up, there's some talk where maybe people care about performance, but that doesn't seem like the issue being discussed; at the moment he's just asking how closures work |
| 16:54 | Cheiron | but i guess calling a function that makes use of 8 internal closures will consume more memory that a function calling 8 other defns defined at the same level |
| 16:54 | emezeske | Cheiron: Keep caring about things! :) |
| 16:54 | TimMc | I missed the voting! |
| 16:54 | TimMc | Serves me right for having a job. |
| 16:54 | amalloy | TimMc: good news: no vote you could have cast would have an impact |
| 16:56 | amalloy | just like living in california |
| 16:57 | emezeske | s/california/the US |
| 16:57 | aperiodic | he might've taken us inside the recall margin, though |
| 16:57 | aperiodic | s/recall/recount |
| 16:58 | gfredericks | obligatory comment about the characteristics of the voting mechanism used contrasted with others |
| 16:59 | cemerick | apathy begets regression |
| 16:59 | cemerick | muhoo: Well done. :-D |
| 17:00 | gfredericks | (inc democracy) |
| 17:00 | lazybot | ⇒ 1 |
| 17:00 | muhoo | cemerick: thanks. i hear new hampshire might need some volunteers too. |
| 17:01 | cemerick | muhoo: Been there every four years since 2000. There's actually a close-ish race here in MA, so I actually get to work local. :-) |
| 17:06 | antares_ | cemerick, lpetit: http://clojure-doc.org/articles/tutorials/eclipse.html. Needs a lot of editing but already not bad. |
| 17:07 | hyPiRion | Oh, right. Is there anyone here who has had a "introduction to Clojure" workshop/presentation? |
| 17:09 | hyPiRion | I'm coming from Common Lisp, so I'm not 100% sure what normal Java/C++-people would have issues with when learning it. |
| 17:09 | lpetit | antares_: you wrote it? |
| 17:09 | antares_ | lpetit: no, someone contributed it, I just did some very small edits so far |
| 17:10 | antares_ | lpetit: https://github.com/clojuredocs/cds/pull/12 |
| 17:12 | cemerick | Hrm. lpetit and I both have access to the "starting with eclipse" page on dev.clojure.org. Another documentation site to maintain doesn't sound too fun. |
| 17:12 | cemerick | (Not that I've done much of any work on ccw docs. Preferred to do screencasts in that neighborhood in general.) |
| 17:13 | antares_ | cemerick: dev.clojure.org is a closed party |
| 17:13 | antares_ | cemerick: I cannot contribute to it |
| 17:13 | antares_ | and everybody can contribute to https://github.com/clojuredocs/cds/ |
| 17:14 | cemerick | antares_: Yeah, I understand the motivation, etc. It's just an odd patch — more for lpetit than me — since this now makes three distinct documentation sources. |
| 17:14 | cemerick | Ech, four if you count the in-IDE docs. :-| |
| 17:15 | lpetit | antares_: Oh, you're Michael, I hadn't understood by the nickname :) |
| 17:16 | antares_ | cemerick: we will try to unify them, maybe even move it to CCW site and link there, but there is value in having content for various levels of expertise |
| 17:16 | ystael | anyone know offhand how to troubleshoot a com.sun.tools.attach.AgentInitializationException when trying to attach a djpowell/liverepl to a running clojuer process? |
| 17:16 | lpetit | antares_: you'll just have to remember that CCW is a moving target :) |
| 17:17 | antares_ | lpetit: you can always notify us about what we need to update or update it yourself |
| 17:17 | cemerick | Maybe this will be the impetus that convinces lpetit to get ccw off of Google Code… ;-) |
| 17:17 | antares_ | it is not a problem, I merged that PR 4 minutes after it was submitted |
| 17:17 | Sgeo | hyPiRion, may I ask why you choose Clojure over CL? |
| 17:17 | antares_ | eeeek |
| 17:18 | lpetit | cemerick: you never lose your grips on a bone, do you? :-D |
| 17:18 | antares_ | lpetit: is there life on google code? :P |
| 17:18 | lpetit | antares_: do you believe in parallel worlds? Multiverses? ;) |
| 17:19 | antares_ | lpetit: no, absolutely not :) |
| 17:24 | lpetit | antares_: what is the license of the documentation for clojure-doc, again? (please) |
| 17:25 | lpetit | got it |
| 17:25 | antares_ | lpetit: Creative Commons BY 3.0 |
| 17:25 | lpetit | is there a tl;dr about this license somewhere? :) |
| 17:25 | antares_ | http://creativecommons.org/licenses/by/3.0/ |
| 17:26 | antares_ | it's BSD of content licenses, more or less |
| 17:28 | cemerick | lpetit: Come now, I haven't mentioned it in months. :-P |
| 17:28 | cemerick | But, GC is quite shite. Bitbucket, github, nearly anything is preferable. |
| 17:29 | lpetit | antares_: looks like a good start. The structure seems a little bit strange, tho. I mean, there's Installing Eclipse, and Installing Counterclockwise is not there. It does not indicate what version of Counterclockwise it covers, etc. |
| 17:29 | antares_ | lpetit: that's why I am saying that it needs a lot of editing |
| 17:30 | lpetit | antares_: being able to start discussions on a page via e.g. integration of disqus comments would be a plus? |
| 17:30 | antares_ | some day |
| 17:31 | lpetit | antares_: like right now: it's 23:25 here, I'll quit in mnutes, and while not being able to edit right now, having left notes via disqus on the page would have prevented them to get lost in #irc :) |
| 17:31 | lpetit | cemerick: I've noticed everyone moved to github :-p |
| 17:32 | antares_ | but that's what I *don't* want comments to be |
| 17:32 | antares_ | comment on the pull request or other GH issues |
| 17:32 | antares_ | comments are necessary for people to be able to point out issues |
| 17:32 | antares_ | but right now we know what sucks |
| 17:33 | antares_ | it's obvious in most places |
| 17:33 | antares_ | we are trying to add content in large chunks without much polishing right now |
| 17:33 | antares_ | err, sorry, I wanted to say "we are agile" |
| 17:34 | dignati | Hey, after reading this: https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L42 I was wondering where `fn*` is defined? |
| 17:34 | hiredman | dignati: in the compiler |
| 17:35 | dignati | hiredman: Uhm, where could I find this? |
| 17:36 | hiredman | dignati: Compiler.java |
| 17:36 | dignati | hiredman: Great, thanks! :) |
| 17:38 | dignati | Oh god, this is going to be fun |
| 17:38 | lpetit | cemerick & al: do you think it's time to switch the editing mode to strict/paredit by default? Pondering this possibility right now... |
| 17:39 | technomancy | lpetit: wow, you have some guts =) |
| 17:39 | antares_ | lpetit: that's probably too hardcore for newcomers |
| 17:39 | technomancy | nDuff: meh; I use maybe 20% of paredit on a good day |
| 17:41 | lpetit | never mind, I think I can only do that when there's a clear visual component guiding the user to escape from the strict mode. Maybe some AI understanding that when he/she hits ")" 10 times then maybe he really wants to insert that damn ")" :) |
| 17:41 | nDuff | technomancy: It's like MS Word: Nobody uses all the features, but everyone uses a different 5%. |
| 17:41 | technomancy | lpetit: yeah, the #1 usability challenge is making it clear how to step outside its boundaries when things get messed up |
| 17:42 | jkkramer_ | just use a paredit clippy |
| 17:42 | nDuff | technomancy: ...I use a very different 5% from lpetit, which drives me batty trying to use ccw (and leads to feature requests for which the answer is "why are you doing it that way? Just do it this other way...") |
| 17:42 | jkkramer_ | "so you'd like to slurp some sexps? ..." |
| 17:43 | hiredman | I see you are trying to insert a bracket, would you like your brackets balanced? |
| 17:43 | lpetit | technomancy: currently, there's no visual, but it's already there: hit alt+D to quit the mode entirely for this editor "session", hit Esc key to disable strict mode for the next key press, and/or go to the preferences to change default mode when entering a new editor. |
| 17:44 | lpetit | hiredman: he, with a cute dog face to ask the question :-D |
| 17:45 | TimMc | kibit + clippy |
| 17:45 | TimMc | And with that, I'm heading home. |
| 17:45 | hiredman | it looks like you are smasking keys randomly, would you like me ti disable paredit? |
| 17:45 | lpetit | nDuff: I see Tom Hickey has a slurpage / barrage etc. in his paredit.clj fork.Don't know whether it's finished yet, or not. |
| 17:45 | lpetit | :) |
| 17:47 | lpetit | What's the status of kibit these days? |
| 17:52 | hyPiRion | Sgeo: Sorry for late reply. I like it more, for unknown reasons. |
| 17:52 | hyPiRion | Most likely because it's more focused towards immutability. |
| 17:52 | hyPiRion | /s/towards/on/ |
| 17:55 | Sgeo | I like that, and the libraries I think. But I don't like the necessity of being oriented around projects |
| 17:55 | Sgeo | One-file things would be nice |
| 17:57 | ivan | http://www.4clojure.com/problem/49 <- the shortest solution to this makes me happy |
| 18:03 | hyPiRion | Sgeo: yeah, that's a bit impractical at times. But it keeps the simplicity down when you scale projects though. |
| 18:03 | hyPiRion | up* |
| 18:04 | hyPiRion | ivan: (juxt take drop) ? |
| 18:04 | ivan | yep |
| 18:05 | hyPiRion | it's elegant. |
| 18:08 | technomancy | it's juxt! what's not to like |
| 18:10 | Sgeo | ,(apply concat {:a 1 :b 2}) |
| 18:10 | clojurebot | (:a 1 :b 2) |
| 18:10 | Sgeo | Hrm |
| 18:10 | Sgeo | ,(apply identity {:a 1 :b 2}) |
| 18:10 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$identity> |
| 18:10 | Sgeo | ,(apply identity {:a 1}) |
| 18:10 | clojurebot | [:a 1] |
| 18:10 | Bronsa | ,(mapcat identity {:a 1 :b 2}) |
| 18:10 | clojurebot | (:a 1 :b 2) |
| 18:12 | Sgeo | ,((fn [& {:keys [a b]}] [":a" a ":b" b]) {:a 1 :b 2}) |
| 18:12 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: {:a 1, :b 2}> |
| 18:12 | Sgeo | ,((fn [& {:keys [a b]}] [":a" a ":b" b]) :a 1 :b 2) |
| 18:12 | clojurebot | [":a" 1 ":b" 2] |
| 18:12 | Sgeo | ,(apply (fn [& {:keys [a b]}] [":a" a ":b" b]) {:a 1 :b 2}) |
| 18:12 | clojurebot | [":a" nil ":b" nil] |
| 18:13 | Sgeo | ,(apply (fn [& {:keys [a b]}] [":a" a ":b" b]) (apply concat {:a 1 :b 2})) |
| 18:13 | clojurebot | [":a" 1 ":b" 2] |
| 18:14 | Sgeo | What's the proper way to do that? |
| 18:14 | gfredericks | to do what? |
| 18:14 | Sgeo | Pass a map to a function expecting keyword arguments |
| 18:14 | gfredericks | haha |
| 18:14 | gfredericks | mapply |
| 18:14 | gfredericks | which doesn't exist |
| 18:14 | gfredericks | I laugh because TimMc has been complaining about keyword arguments for that exact reason for a while |
| 18:16 | KaOSoFt | Hello there. I’m just learning about Clojure, and I’m curious. When I check `(source +)`, I see a `reduce1` function, but `(source reduce1)` throws nothing. What is this magical `reduce1` I see? |
| 18:17 | amalloy | i prefer to just not define keyword-arg functions at all. it makes everything easier |
| 18:17 | gfredericks | KaOSoFt: it's private in clojure.core |
| 18:17 | KaOSoFt | It’s different from `reduce`? |
| 18:17 | gfredericks | KaOSoFt: you can (source clojure.core/reduce1) |
| 18:17 | gfredericks | KaOSoFt: I'd never heard of it; |
| 18:17 | Sgeo | amalloy, would that be similar to accepting a single vector rather than var args? |
| 18:18 | hyPiRion | amalloy: Or explicitly sending maps. |
| 18:18 | hyPiRion | That's easier, I think. |
| 18:18 | Sgeo | If concat were used (concat [[:a :b :c] [1 2 3]]) instead of (concat [:a :b :c] [1 2 3])? |
| 18:18 | gfredericks | Sgeo: I think he's talking specifically about implicit-map varargs rather than general varargs |
| 18:18 | amalloy | reduce1 is just an artifact of the bootstrapping process; it disappears once we can do a real, performant reduce |
| 18:19 | KaOSoFt | gfredericks, indeed, there it is. Weird naming. |
| 18:19 | gfredericks | that rhickey is a real goofball |
| 18:19 | KaOSoFt | gfredericks, thanks. :) |
| 18:22 | ivan | ~mapply |
| 18:22 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 18:37 | cemerick | lpetit: That's fine by me, as long as you're going to answer all the emails ;-) |
| 18:37 | lpetit | he |
| 19:28 | dnolen | emezeske: I'm assuming a new lein-cljsbuild not too far off? |
| 19:29 | emezeske | dnolen: Yeah, I've been meaning to cut a release for a week or so now, got derailed by getting married :) |
| 19:29 | dnolen | emezeske: whoa, congrats! |
| 19:29 | emezeske | dnolen: thanks! |
| 19:30 | emezeske | dnolen: I saw a note on the ML about a new cljs release |
| 19:30 | emezeske | dnolen: I wonder if that will be soon? If so, I might wait for it |
| 19:30 | dnolen | emezeske: already out |
| 19:30 | emezeske | dnolen: oh, sweet |
| 19:31 | emezeske | dnolen: I should be able to do a release this evening then |
| 19:40 | danielglauser | Does anyone know of a detailed compojure/friend sample app that I could look at? |
| 19:41 | emezeske | danielglauser: Not a sample app, but does use friend: https://github.com/ato/clojars-web/blob/master/src/clojars/web.clj |
| 19:42 | danielglauser | emezeske: Excellent, that should do it. Thanks! |
| 19:44 | danielglauser | emezeske: can you shed some light on, "Work around friend#20 and ring-anti-forgery#10" |
| 19:44 | emezeske | danielglauser: I'm guessing those are github issues: https://github.com/cemerick/friend/issues/20 |
| 19:45 | emezeske | danielglauser: Looks like friend#20 has been fixed, maybe those workarounds are no longer needed? |
| 19:46 | danielglauser | emezeske: that makes sense |
| 19:46 | weavejester | Yeah, they were problems with setting the session. |
| 19:47 | weavejester | I'll fix the anti-forgery one tonight. I keep forgetting about it. |
| 19:47 | TimMc | /ba |
| 20:24 | AtKaaZ | am I correct in assuming a delay cannot be cancelled? or maybe interrupted? |
| 20:28 | AtKaaZ | ,(delay (throw (Exception. "a")) 100) |
| 20:28 | clojurebot | #<Delay@601ef748: :pending> |
| 20:28 | AtKaaZ | ,@(delay (throw (Exception. "a")) 100) |
| 20:28 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.Exception: a> |
| 20:30 | amalloy | &(deref (delay (Thread/sleep 10000)) 1000) |
| 20:30 | lazybot | clojure.lang.ArityException: Wrong number of args (2) passed to: core$deref |
| 20:31 | amalloy | &(deref (delay (Thread/sleep 10000)) 1000 :timed-out) |
| 20:31 | lazybot | java.lang.ClassCastException: clojure.lang.Delay cannot be cast to clojure.lang.IBlockingDeref |
| 20:31 | amalloy | oh, sure. no, you can't |
| 20:35 | AtKaaZ | ,(let [d (delay (throw (Exception. "a")) 100)] (vec (map pprint (list d (try (@d) (catch Exception ex (str "caught exception: " (.getMessage ex)))) d)))) |
| 20:35 | clojurebot | AtKaaZ: Cool story bro. |
| 20:35 | amalloy | (inc clojurebot) |
| 20:35 | lazybot | ⇒ 14 |
| 20:35 | AtKaaZ | lol what didn't he like? thanks btw for reply |
| 20:37 | AtKaaZ | some inconsistency: ##(let [d (delay (throw (Exception. "a")) 100)] (pprint a) a) |
| 20:37 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: pprint in this context |
| 20:37 | AtKaaZ | ,(let [d (delay (throw (Exception. "a")) 100)] (pprint a) a) |
| 20:37 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pprint in this context, compiling:(NO_SOURCE_PATH:0)> |
| 20:37 | AtKaaZ | ,(require 'clojure.pprint) |
| 20:37 | clojurebot | nil |
| 20:37 | AtKaaZ | ,(let [d (delay (throw (Exception. "a")) 100)] (pprint a) a) |
| 20:37 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pprint in this context, compiling:(NO_SOURCE_PATH:0)> |
| 20:38 | AtKaaZ | ,(let [d (delay (throw (Exception. "a")) 100)] (clojure.pprint/pprint a) a) |
| 20:38 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0)> |
| 20:38 | AtKaaZ | ,(let [d (delay (throw (Exception. "a")) 100)] (clojure.pprint/pprint d) d) |
| 20:38 | clojurebot | #<Delay@520ed4: :not-delivered> |
| 20:38 | clojurebot | #<Delay@520ed4: :pending> |
| 20:38 | AtKaaZ | ,(let [d (delay (throw (Exception. "a")) 100)] (print d) d) |
| 20:38 | clojurebot | #<Delay@5eff06be: :pending> |
| 20:39 | clojurebot | #<Delay@5eff06be: :pending> |
| 20:39 | AtKaaZ | this is consistent |
| 20:47 | AtKaaZ | dispatch.clj has :not-delivered and core_print.clj has that :pending the ones relevant to above |
| 20:48 | AtKaaZ | and it's the same two places where something like "#<core$future_call$reify__3499@7c9391d9: :cancelled>" can be implemented |
| 20:50 | AtKaaZ | ,(require 'clojure.pprint) (let [p (promise)] (print p) (clojure.pprint/pprint p) p) |
| 20:50 | clojurebot | nil |
| 20:50 | AtKaaZ | ,(let [p (promise)] (print p) (clojure.pprint/pprint p) p) |
| 20:50 | clojurebot | #<core$promise$reify__3678@4899aebd: :pending>#<Promise@4899aebd: :not-delivered> |
| 20:50 | clojurebot | #<core$promise$reify__3678@4899aebd: :pending> |
| 20:53 | AtKaaZ | if I wanted to use the same :key in more than 1 place within the code, would you recommend holding it in a (global?) def instead? what is the equivalent of a java static final constant in clojure? |
| 20:58 | hyPiRion | AtKaaZ: Not if you're working with keywords. There's no point in a (def foo :bar) |
| 20:59 | AtKaaZ | I guess you can always change the variable if even only temporarily, but the key itself is a static final if used like :key |
| 20:59 | AtKaaZ | hyPiRion, maybe to avoid forgetting that you have to change code in more than one place |
| 20:59 | hyPiRion | A java "static final" is the same as def. |
| 20:59 | AtKaaZ | but I can def it again later, I kinda wanted to prevent even that |
| 20:59 | hyPiRion | Hm |
| 21:00 | emezeske | AtKaaZ: For something where you just need a constant to identify something, not for a specific value (e.g. 42), just use a naked keyword |
| 21:03 | AtKaaZ | I guess that makes half sense:) I only say it because in clojure code I found the same code in two places and it shows two different keywords (I figure someone changed one of them but forgot to change the other) - it's in those tests above |
| 21:03 | AtKaaZ | (and (instance? clojure.lang.IPending o) (not (.isRealized o)) :not-delivered |
| 21:03 | AtKaaZ | (and (instance? clojure.lang.IPending o) (not (.isRealized o)) :pending |
| 22:00 | dnolen | macros are grand - http://gist.github.com/3882891 |
| 22:04 | Sgeo | Although taking the concept and implementing a Lisp based on it would likely be better than actually using Tcl |
| 22:08 | _tca | wachamacallits? |
| 22:11 | wingy | lol http://en.wikipedia.org/wiki/Brainfuck |
| 22:15 | pandeiro | i have :source-path "src/clj" in my lein project but lein cp is only showing src/ and i'm getting a ClassNotFound exception when i try to run main with lein run |
| 22:16 | emezeske | Sgeo: Have you used Tcl much? |
| 22:17 | Sgeo | emezeske, it was my preferred language for a few months |
| 22:17 | Sgeo | Wrote an IRC bot in it |
| 22:17 | emezeske | Sgeo: It is a god-awful mess to maintain code that does macro-type stuff |
| 22:17 | Sgeo | I think it was actually the ecosystem that drove me away partially |
| 22:17 | Sgeo | I needed to use tclkit, and couldn't find a good xml library that worked well on it |
| 22:18 | Sgeo | Yes, it's possible to make portable stuff with Tclkit, but don't expect to be able to port scripts that use ActiveTcl libraries :( |
| 22:18 | frozenlock | When I run a webserver from a repl, what's the typical way to send stuff to the repl, print? |
| 22:18 | emezeske | I guess I just wanted to mention that I strongly disagree with any notion that Tcl code-writing-code is remotely better than macros |
| 22:19 | Sgeo | emezeske, how much of that comes from stringiness and no quasiquoting, and how much comes from the concept of a command's call site determining what the command sees |
| 22:20 | emezeske | Sgeo: Mostly the former. |
| 22:21 | l4mb4 | Unless I'm doing it wrong, it seems as if the Lein REPL doesn't support Java escape characters in string literals; anyone know what's up with that? |
| 22:21 | emezeske | Sgeo: Okay, I won't call you completely insane, then :) |
| 22:22 | AtKaaZ | wingy: https://gist.github.com/1495970 |
| 22:22 | wingy | AtKaaZ: :) |
| 22:22 | Sgeo | wingy, check out esolangs.org |
| 22:23 | wingy | glad im doing clj |
| 22:32 | ivan | l4mbd4: what escape doesn't work? |
| 22:32 | pandeiro | is :source-path still supposed to work in lein2-preview10? |
| 22:33 | AtKaaZ | :source-paths ["src/clojure"] |
| 22:33 | Sgeo | Suppose I want to implement a lazy non-seq structure. Is it acceptable to just use some mutation, or are there higher-level libraries for defining lazy structures? |
| 22:35 | l4mbd4 | ivan: They're all fine now. Something strange was going on in my REPL, but killing it and starting a new one worked. |
| 22:35 | AtKaaZ | pandeiro, according to PLUGINS.md file: "Another key change is that `:source-path`, "..."have changed to |
| 22:35 | AtKaaZ | `:sources-paths`", so the answer is probably no |
| 22:35 | pandeiro | AtKaaZ: you da man thanks |
| 22:36 | pandeiro | swear i was looking at the sample.project.clj and seeing :source-path a second ago |
| 22:36 | AtKaaZ | I still wonder if it works as backward compatibility |
| 22:37 | pandeiro | AtKaaZ: it isn't for me |
| 22:37 | ivan | "\v" seems to mess up lein repl forever |
| 22:38 | AtKaaZ | pandeiro, searching thru code, and also in sample.project.clj it doesn't seem to be any backward compat, :source-paths only |
| 22:39 | amalloy | ivan: just type the closing " again |
| 22:39 | ivan | amalloy: man that's a weird thing to have to do. thanks. |
| 22:39 | l4mbd4 | (println "\v") just seems to throw a RuntimeException on my end |
| 22:40 | ivan | now hit enter twice |
| 22:40 | amalloy | i dunno. when a repl for any language siezes up and pretends i'm not typing anymore, "'))))]]]]}}}} is the first thing i try |
| 22:40 | l4mbd4 | Ah yeah |
| 22:41 | ivan | guess I'll be using JavaScript for my vertical tab needs |
| 22:42 | emezeske | ANN: lein-cljsbuild 0.2.8 released. |
| 22:47 | frozenlo` | \o/ |
| 22:50 | AtKaaZ | ,(symbol "\\o/") |
| 22:50 | clojurebot | \o/ |
| 22:51 | AtKaaZ | ,(symbol "\o/") |
| 22:51 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o> |
| 22:51 | jorgeu | gerard0, vos acá? jajaja |
| 22:53 | AtKaaZ | does anyone know why I am seeing the SLASH message(in my repl): http://cljbin.com/paste/5078d649e4b05027595811b8 |
| 22:53 | AtKaaZ | it's a return |
| 22:55 | AtKaaZ | ,"\o(println "test")" |
| 22:55 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o> |
| 22:55 | AtKaaZ | that shows "test" when in repl :) |
| 22:55 | jorgeu | AtKaaZ, I don't think \o is supposed to be used between " " |
| 22:56 | AtKaaZ | ,\o(println "test") |
| 22:56 | clojurebot | \o |
| 22:56 | jorgeu | ,(str "this is the o char:" \o) |
| 22:56 | clojurebot | "this is the o char:o" |
| 22:56 | jorgeu | well, and in fact it is a symbol |
| 22:56 | jorgeu | ,(symbol \o) |
| 22:56 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String> |
| 22:57 | AtKaaZ | ,\o1 |
| 22:57 | clojurebot | \ |
| 22:57 | AtKaaZ | ,(str \o1) |
| 22:57 | clojurebot | "" |
| 22:57 | AtKaaZ | my implied question was, how come the println gets executed: ##"\o(println "test")" |
| 22:58 | AtKaaZ | &"\o(println "test")" |
| 22:58 | lazybot | java.lang.RuntimeException: Unsupported escape character: \o |
| 22:58 | AtKaaZ | only in ccw repl tho |
| 22:59 | AtKaaZ | which is nrepl, works with lein repl too |
| 22:59 | AtKaaZ | ,"\o(println 'test)" |
| 22:59 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o> |
| 22:59 | AtKaaZ | i guess the bots stop automatically on first exception |
| 23:02 | AtKaaZ | it's probably a nrepl bug: http://pastebin.com/yPqPX8fK |
| 23:04 | AtKaaZ | this one is actually how that didn't throw the second time: http://pastebin.com/XhiQzHtJ |
| 23:04 | AtKaaZ | ,"\o(println "test")" |
| 23:04 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o> |
| 23:04 | AtKaaZ | ,"\o(println 'test)\" |
| 23:04 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \o> |
| 23:12 | ivan | ,(try (keys "hey") (catch Throwable e nil)) |
| 23:12 | clojurebot | ivan: I don't understand. |
| 23:12 | ivan | &(try (keys "hey") (catch Throwable e nil)) |
| 23:12 | lazybot | java.lang.SecurityException: You tripped the alarm! catch is bad! |
| 23:12 | AtKaaZ | so that's why lol |
| 23:12 | ivan | anyway, why doesn't that catch the ClassCastException? |
| 23:14 | tomoj | &(class (keys "hey")) |
| 23:14 | lazybot | ⇒ clojure.lang.APersistentMap$KeySeq |
| 23:14 | tomoj | &(try (dorun (keys "hey")) (catch Throwable e nil)) |
| 23:14 | lazybot | java.lang.SecurityException: You tripped the alarm! catch is bad! |
| 23:14 | tomoj | d'oh |
| 23:15 | tomoj | (answer: it's lazy) |
| 23:15 | ivan | tomoj: thanks |
| 23:15 | tomoj | notice that the stack trace goes back to printing |
| 23:15 | ivan | ah, yeah |
| 23:18 | nsxt | why is catch bad? |
| 23:18 | ivan | did someone claim it was bad? |
| 23:18 | ivan | oh, the bot |
| 23:18 | ivan | it's running in a paranoid sandbox |
| 23:19 | nsxt | ah |
| 23:19 | AtKaaZ | ,(dorun (keys "hey")) |
| 23:19 | clojurebot | nil |
| 23:20 | AtKaaZ | ,(dorun (take 1 (keys "hey"))) |
| 23:20 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.util.Map$Entry> |
| 23:20 | AtKaaZ | much better lol |
| 23:20 | AtKaaZ | I was wondering why the catch never triggered |
| 23:20 | AtKaaZ | ,(try (dorun (take 1 (keys "hey"))) (catch Throwable f (println f "now it triggers"))) |
| 23:20 | clojurebot | AtKaaZ: I don't understand. |
| 23:21 | AtKaaZ | how do I unlazily take 1 ? |
| 23:22 | ivan | ,(doall (take 1 '(1 2 3))) |
| 23:22 | clojurebot | (1) |
| 23:23 | AtKaaZ | thank you |
| 23:37 | ivan | user=> (try (doall (split-with "hey" "you")) (catch Throwable e)) |
| 23:37 | ivan | [(ClassCastException [trace missing] |
| 23:39 | ivan | oh, because it returns a vector with two lazies |
| 23:40 | ivan | now I need to write deep-unlazy |
| 23:40 | technomancy | there's always prn |
| 23:40 | technomancy | or rather, doto prn |
| 23:41 | tomoj | str? |
| 23:41 | clojurebot | ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25)) |
| 23:41 | ivan | I kind of wanted the value instead of some string, but I'm doing a crazy test thing anyway |
| 23:42 | technomancy | ivan: hence doto |
| 23:42 | ivan | oh, nice, thanks |
| 23:44 | aperiodic | doto: instant chaining syntax |
| 23:44 | aperiodic | except better |
| 23:44 | Sgeo | ,(-> 5 inc inc (doto println) dec) |
| 23:44 | clojurebot | 7 |
| 23:44 | clojurebot | 6 |
| 23:45 | aperiodic | i use it a lot for java interop |
| 23:45 | technomancy | (doto 'my.ns require in-ns) |
| 23:46 | aperiodic | (doto object (mutatey java crap)+) always evaluates to the object |
| 23:48 | yedi | how closely tied is functional programming to declarative programming |
| 23:48 | aperiodic | i realized recently that with clojure i think a lot more about shape of code than flow of time |
| 23:48 | aperiodic | which i think is super neat |
| 23:57 | ivan | let's train a new generation of programmers capable only of thinking functionally, leaving us with the high-paying procedural maintenance |