#clojure log - Aug 02 2013

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

0:04 mullr: I'm having trouble with lein-cljsbuild and crossovers and would greatly appreciate another pair of eyes of somebody has a moment. I'm trying to use a clojure library in clojurescript; I'm fairly certain it's all valid clojurescript code, but I've done something wrong with the macro setup. The code and error at hand is here: https://www.refheap.com/17097

0:06 tolstoy: mullr: Does the file end in .cljs?

0:06 mullr: My own source file does, yes.

0:08 amalloy: mullr: the/parsatron isn't a valid namespace name

0:08 you mean the.parsatron

0:12 mullr: amalloy: right you are. Fixing that require gives me a whole mess of "undeclared Var" warnings. Even when using crossovers, do you need to separate the macros into another file?

0:13 amalloy: *shrug*

0:13 mullr: :) ok, thanks

1:09 clj_newb_2345: on a high level, in enlive, wahat is the relation of a snippet / a template ?

1:10 brehaut: clj_newb_2345: basically a template is a snippet that outputs a seq of strings, whereas a snippet returns a structured document fragment

2:22 futile: i half want to buy typednil.com

2:22 because computer science is kind of idiotic sometimes

4:09 which json lib is best?

4:10 supersym: i like cheshire

4:10 futile: ok

4:11 tried data.json?

4:11 supersym: barely

4:11 havent needed it much

4:12 futile: ah

4:12 thx

4:13 xsyn: I've also been using chesire

4:17 futile: this line takes a really long time: (use 'lamina.core 'aleph.tcp 'gloss.core)

4:17 i spose nothing i can do about that

4:20 just made my alert pop up from Clojure.. https://github.com/sdegutis/dotfiles/blob/master/home/zephyros/src/zephyros/core.clj

4:20 yay

4:30 laurentpetit: Hello

4:46 supersym: bonjour

4:49 endou: supersym: Salut

5:28 laurentpetit: bien le bonjour :)

5:29 clgv: hello

5:29 clgv: laurentpetit: good morning

5:29 laurentpetit: I tried the beta on wednesday evening

5:30 laurentpetit: the auto-identation when editing seemed fine in a 10min test. but the REPL behaved pretty weird

5:30 laurentpetit: clgv: it had some interesting bugs, hadn't it ? :-) I've fixed some more yesterday, as well as added support for "raise over" (alt + r)

5:30 hmm

5:31 clgv: maybe I haven't tested enough in the REPL. I've fixed issues with paredit commands interactions recently, maybe this helps

5:31 clgv: what do you mean by "behaved pretty weird" ?

5:32 clgv: laurentpetit: when defining a function in REPL, I got the feedback output that the symbol is defined more than 10 times ...

5:32 jonasen: John Carmack discussing functional programming, haskell and lisp: http://www.youtube.com/watch?v=1PhArSujR_A#t=02m05s

5:32 very interesting IMO

5:32 clgv: similarly for an exception in that case

5:32 laurentpetit: clgv: ?

5:33 clgv: laurentpetit: (defn f [x] (+ x x)) -> Output: #'user/f \n #'user/f \n #'user/f \n #'user/f \n #'user/f \n #'user/f \n #'user/f \n #'user/f \n #'user/f \n

5:33 laurentpetit: oh, real weird indeed :)

5:33 clgv: "\n" is only used to show newlines of the repl window

5:34 you updated the beta release?

5:34 I could check if it is still present

5:35 laurentpetit: yeah I updated late yesterday's evening

5:36 clgv: I fixed a fair amount of issues, refactored the code base (more in paredit.clj, less in Eclipse), added unit tests, etc.

5:37 clgv: laurentpetit: is there a link for standalone versions of the beta releases?

5:38 laurentpetit: yeah

5:38 each build creates an update site, and 5 standalone versions. You find the individual builds and update sites, per branch, per travis build, as such:

5:39 http://updatesite.ccw-ide.org/branch/&lt;branch-name>/&lt;branch-name>-travis<padded-travis-build-number>-git<git-commit-sha1>/

5:39 e.g. for the latest build, the update site is:

5:39 http://updatesite.ccw-ide.org/branch/master/master-travis000120-git7f18a374a4a23e167295614c94fba12282186f3f/

5:40 and you find the products in a subdirectory:

5:40 http://updatesite.ccw-ide.org/branch/master/master-travis000120-git7f18a374a4a23e167295614c94fba12282186f3f/products/

5:41 in the "beta" software update site, I then just use the existing "redirect" feature of eclipse software update sites which points to the several individual build-commit updatesites

5:41 I have updated the "beta" software update site, look :

5:41 clgv: oh ok. I tried to navigate beta to find the standalone

5:41 laurentpetit: http://updatesite.ccw-ide.org/beta/compositeContent.xml

5:42 "beta" update site is a "composite" update site: it references other update sites it is composed of

5:42 same for stable

5:43 clgv: ok. so always checking for newest master then^^

5:43 laurentpetit: "beta" is only updated manually. So when you use beta, you only get what I've reviewed.

5:44 If you want the bleeding edge from master, simply point to http://updatesite.ccw-ide.org/branch/master

5:44 It's also a composite repository. Each new build of the master branch updates it with the latest build

5:44 But I don't recommend following master. It may be broken. it's fully automated.

5:45 I recommend beta

6:02 hyPiRion: hum.

6:02 http://en.wikipedia.org/wiki/Marshalling_(computer_science)

6:02 [Marshalling] simplifies complex communication, using custom/complex objects to communicate instead of primitives.

6:10 ucb: allegedly, yes.

6:10 * ucb goes back under the rock he just came out of

6:38 clgv: laurentpetit: oh the ccw products have no top level folder in the archive...

6:41 laurentpetit: ok. the REPL bug does not occur on the latest master product...

6:55 gavri: given a list, how do I find the most frequent element in it?

6:56 "frequencies" gives me a map mapping each unique element to its frequency in the list

6:56 but I'm at a loss for how to pick the key from this map that has the highest value

6:56 I mean, I could do it iteratively

6:56 but I'm trying to do it the clojure way

6:59 ucb: gavri: if it's a map you can use sort-by

6:59 ,(doc sort-by)

6:59 clojurebot: "([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array."

7:00 gavri: if I call min or max after the sort, would it skip the sort?

7:00 I guess I'm asking if clojure is lazy in this case

7:00 Anderkent: no need to sort it if you only need to extract the max value. Just do reduce-kv on the frequencies

7:01 gavri: thanks, Anderkent

7:01 ucb: reduce was going to be my next suggestion :)

7:03 Anderkent: actualyl it's a little less verbose with reduce than reduce-kv

7:03 &(reduce (fn find-most-frequent [[old-k old-v :as old] [k v :as new]] (if (> v old-v) new old)) (frequencies [:a :a :b :b :b :b :c :d :e :f]))

7:03 lazybot: ⇒ [:b 4]

7:03 Anderkent: still a bit on the long side, but w/e :P

7:04 ucb: heh

7:04 Anderkent: (there's probably some composition of basic functions you could use instead of the (fn ..) but it's not coming to me right now

7:14 supersym: SLF4J: Class path contains multiple SLF4J bindings.

7:14 anyone know how I can fix that? log4j is driving me nuts

7:15 "The warning emitted by SLF4J is just that, a warning." no its not...it breaks my build :S

7:18 removal of log4j fixed it :P

7:22 gavri: thanks, Anderkent and ucb

7:22 ucb: yw

7:27 TEttinger: ,(let [freqs (frequencies [:a :a :b :b :b :b :c :d :e :f])] ((max (keys freqs)) freqs)

7:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

7:28 TEttinger: ,(let [freqs (frequencies [:a :a :b :b :b :b :c :d :e :f])] ((max (keys freqs)) freqs))

7:28 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.APersistentMap$KeySeq cannot be cast to clojure.lang.IFn>

7:28 TEttinger: hm

7:28 laurentpetit: clgv: yeah, sorry no top level, that's the way maven tycho does things. I also find it weird, and will definitely try again to fix this

7:29 clgv: re. REPL bug : (whee)

7:29 hyPiRion: TEttinger: (max (keys freqs)) ?

7:29 clgv: laurentpetit: I hope the REPL bug is not specific to my home env. otherwise I need to clean that mess up^^

7:29 TEttinger: hyPiRion, I think I had keys and vals reversed

7:30 clgv: laurentpetit: back from lunch right now? ;)

7:30 hyPiRion: TEttinger: still, ##(max [1 2]) is not what you want :)

7:30 lazybot: ⇒ [1 2]

7:31 hyPiRion: ,(let [freqs (frequencies [:a :a :b :b :b :b :c :d :e :f])] (apply max-key val freqs))

7:31 clojurebot: [:b 4]

7:31 TEttinger: right thanks

7:31 iartarisi: does anyone know if it's possible to "mock" several interactions in the same expectation using the "expectations" library?

7:31 TEttinger: gavri: take a look at hyPiRion's implementation

7:32 laurentpetit: clgv: plain right :)

7:33 clgv: laurentpetit: in our departement we got to launch early at 11:30 ;)

7:33 laurentpetit: clgv: so, how does the autoshift feature look to you? "weird" ? "interesting"? "wouldn't have noticed"?

7:33 gavri: hyPiRion and TEttinger, thanks

7:33 hyPiRion: no problem

7:34 TEttinger: np

7:34 clgv: laurentpetit: I definitely noticed it. is it intended not to work with SHIFT+TAB?

7:35 laurentpetit: try SHIFT+TAB, TAB, SHIFT+TAB, TAB, ....

7:36 laurentpetit: clgv: the way I've "plugged" autoshift "misses" some editing commands

7:36 eg it also does not notice suppr (as opposed to backspace) or Paste

7:37 I'll have to improve that

7:37 clgv: ah ok. so that's a temporary limitation

7:38 laurentpetit: clgv: yeah

7:39 clgv: laurentpetit: another thought: I'd love to have something like seesaw for eclipse' SWT

7:39 laurentpetit: what about you?

7:39 laurentpetit: clgv: are you doing a lot of SWT / Eclipse based development?

7:39 clgv: yeah, me too. I've even made some false starts in this area.

7:40 clgv: laurentpetit: no I tried a few dialogues but stayed with swing Swing+seesaw

7:41 laurentpetit: most of the time I build only small visualizations with some interaction for param selection or such...

7:42 laurentpetit: clgv: I've started an experimental swt support in the lein branch, which is used to display the "generic lein launcher" popup:

7:42 https://github.com/laurentpetit/ccw/blob/lein/ccw.core/src/clj/ccw/util/swt.clj

7:43 a thin clojure-like wrapper over FormLayout

7:43 gavri: trying to figure out how 'apply' works. it seems to work here like 'fold', but the documentation for apply makes it out to be a function that represents function application :-/

7:43 hyPiRion: gavri: (apply f x y z) is more or less like (f x y z)

7:44 clgv: laurentpetit: maybe we need a student project about extending seesaw semantics to swt - should be possible right?

7:44 laurentpetit: clgv: you create your widget tree with a mix of pure data structure representations and objects, then pass it to a function which will "reify" it into widgets

7:44 hyPiRion: gavri: wait no, I am just joking

7:44 gavri: (apply f [x y z]) is more or less like (f x y z). (I forgot the list/vector)

7:45 gavri: like apply in JS then?

7:45 hyPiRion: almost, I believe

7:45 TEttinger: ,(+ [1 2 3]) ; doesn't work

7:45 clojurebot: #<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.PersistentVector to java.lang.Number>

7:45 hyPiRion: (apply f a [x y z]) => (f a x y z), (apply f a b c [x y z]) => (f a b c x y z)

7:45 TEttinger: ,(apply + [1 2 3]) ; treats the sequence as args

7:45 clojurebot: 6

7:45 laurentpetit: clgv: maybe we could directly jump to using core.async :)

7:45 gavri: k, got it

7:46 clgv: laurentpetit: hard context switch in this discussion? ;)

7:46 gavri: so the 'reduce' part is in max-key, I guess

7:46 jtoy: i have map with 28k keys in it , I then run dissoc on it with about 200 keys, it is taking 10 of minutes to complete, i know the map is kind of large, but still, shouldnt this be near instance as these are maps and not arrays?

7:48 gavri: got it. read up on max-key

7:48 thanks, everyone

7:49 just curious about why max-key only compares numbers as mentioned here http://clojuredocs.org/clojure_core/clojure.core/max-key

7:49 why couldn't it be a generic method that uses the 'less than' function?

7:50 generic function, I mean

7:51 also, another dumb question. why doesn't max-key accept a list instead of a variable list of arguments? is that the recommended way to create functions in clojure?

7:53 babilen: jtoy: running it on a transient might speed things up.

7:53 TEttinger: gavri: variable lists of arguments become a seq IIRC. like when you have (fn [& args] (str (first args) (second args)))

7:53 hyPiRion: gavri: well, that number may be derived from a comparator. As to why it's a variable list of arguments, I have no idea. It doesn't make much sense to me either.

7:54 babilen: jtoy: You would then, naturally, have to run dissoc!

7:55 hyPiRion: jtoy: I just checked it here, generating AND dissocing took less than 0.1 seconds.

7:55 TEttinger: gavri, the example here shows why it needs to be a number, and how you can still use max-key on things that aren't numbers. http://clojuredocs.org/clojure_core/clojure.core/max-key

7:56 it's (k x) that needs to be a number, not x, is the important thing

7:57 hyPiRion: ,(let [m [{:foo "beta"} {:foo "gamma"} {:foo "alpha"}]] (apply max-key (comp comparator :foo) m))

7:57 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.core$comparator$fn__4295 cannot be cast to java.lang.Number>

7:58 hyPiRion: oh dang. hurm.

7:58 jtoy: hyPiRion: I am narrowing down the specific piece of code , i havent done performance issues, not sure if there is a better way than hrowing in println everywhere

7:58 yeah, the dissoc seems fine

7:59 TEttinger: hyPiRion, it seems that max-key doesn't use any 2-arg function

7:59 so compare wouldn't work

8:00 I mean, it's silly but

8:00 hyPiRion: TEttinger: yeah, I realized that. Just wondered how you'd get the maximal value based upon some comparator function

8:00 (realized that in hindsight, mind you)

8:00 TEttinger: ,(let [m [{:foo "beta"} {:foo "gamma"} {:foo "alpha"}]] (apply max-key #(read-string (str "36r"(:foo %))) m))

8:00 clojurebot: {:foo "gamma"}

8:01 TEttinger: that's a fluke for now

8:02 hyPiRion: It's not always possible, nor practical, to convert "elements" to numbers.

8:08 TEttinger: ,(let [m [{:foo "beta"} {:foo "grammar"} {:foo "zalpha"}]] (apply max-key #(read-string (clojure.string/replace (format "36r%-10s" (:foo %)) " " "0")) m))

8:08 clojurebot: {:foo "zalpha"}

8:09 TEttinger: z is max, it goes first

8:09 ,(let [m [{:foo "zeta"} {:foo "grammar"} {:foo "zalpha"}]] (apply max-key #(read-string (clojure.string/replace (format "36r%-10s" (:foo %)) " " "0")) m))

8:09 clojurebot: {:foo "zeta"}

8:09 TEttinger: ze goes before za nice

8:09 err

8:09 after, since this is max

8:10 this is the most hackish code I've written in a while

8:10 jtoy: hyPiRion: It seems the apply map is really slow, are there any quick things I can do to speed this up: (apply * (map #(- 1 (/ % all_klass_docs_count) ) (vals (apply dissoc big-hash-map documents))))

8:11 hyPiRion: jtoy: aha

8:11 yeah, wrap % in a double

8:12 you're generating very large fractions

8:12 TEttinger: (double %)

8:12 hyPiRion: ,(reduce * (map / (range 1 30)))

8:12 clojurebot: 1/8841761993739701954543616000000

8:12 hyPiRion: ,(reduce * (map / (range 1 100)))

8:12 clojurebot: 1/933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000

8:12 hyPiRion: etc

8:12 TEttinger: ,(reduce * (map / (range 1.0 100.0)))

8:13 clojurebot: 1.071510288125466E-156

8:13 jtoy: ok, im testing that now

8:13 wow, that makes it nearly instantaneuos

8:13 hyPiRion: it should be blazingly fast compared to the fractions

8:13 yeah

8:13 TEttinger: hyPiRion, you're on fire today!

8:13 nice work

8:13 jtoy: hyPiRion: extremely appreciate it, had no idea how to deal with that

8:14 ro_st: gosh, what did i miss?

8:14 TEttinger: ro_st, hyPiRion solved a bunch of challenging problems people asked

8:14 ro_st: nice!

8:15 TEttinger: I wrote some code that sorts words...

8:15 ro_st: hey, so, what does everyone use in lieu of clojuredocs.org now that it's 2 versions old?

8:15 TEttinger: clojuredocs.org

8:15 hyPiRion: jtoy: no problem. I've been there myself with the fractions. They seem innocent at first, but they really turn nasty when multiplying.

8:15 TEttinger: it's still the best

8:15 ro_st: that's a pity. i wonder why it hasnt been updated?

8:15 jtoy: ro_st: tht annoys me, its because its comes on for 1st item on google

8:17 hyPiRion: The main problem is probably the fact that clojuredocs.org is... a Ruby on Rails project. Clojure developers prefer to contribute to Clojure projects, I guess.

8:17 TEttinger: https://github.com/zk/clojuredocs

8:17 hyPiRion: Also, speaking for myself, I don't know Ruby and don't currently have a need for it.

8:17 ro_st: :-o

8:18 hyPiRion: (I got Clojure!)

8:18 ro_st: didn't know that!

9:07 wink: I would suppose the amount of ruby/rails knowledge needed pales in comparison to the work/knowledge needed to get the content for 1.5 in there

9:08 that said, I'd gladly help if we could field some plan how to update :) (i.e. find out what needs to be done first)

9:09 puredanger: There was a lot of discussion about it at last years conj but there is a fair bit of work to do apparently

9:10 I cant remember the guy that was working on it but he pops up occasionally

9:11 He has all the raw data and was working on whether and how to support multi versions

9:12 tbaldridge: puredanger: yeah I talked to him at the last conj...he works for sonian, I know some people who work there. I'll see if I can dig up his name

9:15 mdrogalis: Speaking of which, is there a timeline set for when the c

9:15 Conj speakers get picked?*

9:15 puredanger: tbaldridge: Thx would like to be in touch with him

9:16 mdrogalis: It is in work, not sure when it will be done

9:16 mdrogalis: puredanger: Ok :)

9:16 puredanger: Hoping soonish but everyone is busy

9:17 mdrogalis: Same problem everywhere. Vacation season.

9:18 puredanger: Btw, jira and confluence login are working again

9:19 mdrogalis: I wonder why the DNS change made it hiccup.

9:20 stuartsierra: Changed IP addresses and firewall rules on the auth server.

9:20 mdrogalis: That'll do it.

9:32 ToBeReplaced: tbaldridge: would you be willing to elaborate on the differences between rpc and data in the google group thread?

9:33 tbaldridge: ToBeReplaced: sure, give me a sec

9:35 logicalguy: Hi, anybody running clojure on a Gentoo machine?

9:35 ToBeReplaced: tbaldrige: at your leisure, of course -- i'm not sure i'm totally with you on what the better alternatives are to RPC, so i'd find it very helpful

9:36 wink: logicalguy: is there a problem? :)

9:36 logicalguy: clojure fails to emerge on my Gentoo machine because it cannot find a file named libcups.so.2

9:36 tbaldridge: ToBeReplaced: are you familiar with Joe Armstrong's thesis? (he's one of the creators of Erlang)

9:37 mdrogalis: tbaldridge & ToBeReplaced: Gooood paper. Worth multiple reads.

9:38 wink: logicalguy: hm, got no gentoo vm flyin round, but that's a bit odd

9:38 ToBeReplaced: yes

9:39 wink: logicalguy: short of a failed packaging I suppose you'd find better help in a gentoo channel, sounds like dependency problem (java) to me

9:39 logicalguy: I did a search on my second machine, there is a libcups.so.2 in /usr/lib32 which is part of the emul-linux-x86-baselibs package, and another one in /usr/lib64 which belongs to CUPS. I'm wondering which package I need to install?

9:40 ToBeReplaced: tbaldridge: mdrogalis: i wouldn't say that I fully grokked it, need to reread when i have many hours to spare

9:40 logicalguy: yes, maybe I should ask there, wink. Thanks.

9:41 mdrogalis: ToBeReplaced: Fortunately it's not as long as it looks, since the last 100 pages are references. :)

10:08 ToBeReplaced: tbaldridge: thanks :)

10:08 chrisrossi: I'm trying to understand some behavior with clojure.test.

10:09 I have a test defined that uses with-redefs-fn to redefine a function that sleeps for timing purposes to be a noop during unit testing.

10:09 What I'm observing is my test gets executed twice, once with the redefinition, once without.

10:09 Deos this sound familiar to anyone?

10:09 s/Deos/Does/

10:12 stuartsierra: chrisrossi: Are you calling one `deftest` function inside another?

10:12 chrisrossi: no.

10:13 stuartsierra: Then I have nothing, I'm afraid.

10:13 chrisrossi: actually, i do have this macro that i cargo culted that might be the culprit. with-private-fns

10:14 i'll get rid of that and see if that fixes it.

10:16 nope same behavior.

10:16 Basic structure is:

10:17 (with-redefs-fn ...

10:17 (deftest ...

10:17 (testing ...)))

10:17 stuartsierra: You can't wrap `deftest` like that.

10:18 chrisrossi: ah, ok.

10:18 swap levels of with-redefs-fn and deftest then.

10:19 well, only runs once now, but the redef doesn't work. ;)

10:27 ok, figured that one out, too. with-redefs-fn takes a fn not a body. ;)

10:27 thanks for the help.

10:29 mdrogalis: stuartsierra: Curious: Why is it invoked twice with an outter with-defs?

10:29 stuartsierra: mdrogalis: no idea

10:30 mdrogalis: :P

10:30 chrisrossi: undefined behavior is undefined.

10:30 stuartsierra: chrisrossi: There's a macro `with-redefs` that takes a body.

10:31 chrisrossi: ah, ok.

10:31 senorflor: (inc 41)

10:31 lazybot: ⇒ 1

10:32 mdrogalis: Ahhh. I just had someone tell me that MongoDB is functional and Lispy because its represented as maps. Orthogonal is the word I'm looking to respond with, I think..

10:32 chrisrossi: hmm, with-redefs takes it back to not working again...

10:32 senorflor: foiled again.

10:43 ToBeReplaced: what is the advantage of using core.contracts' defconstrainedfn over a {:pre [] :post} map?

10:55 residentsummer1: hello

10:55 who can tell me, what does this mean?

10:55 CompilerException clojure.lang.ArityException: Wrong number of args (-1) passed to: db$eval3064$unhex, compiling:(sandbox/db.clj:65:9)

10:56 how args number can be negative?!

10:56 Yes, I'm messing with macros

10:56 Anderkent: residentsummer1: that's a bug in the compiler. I can explain how it happens, if you like, but basically you're not passing enough args to macroes

10:57 residentsummer1: I'll give you some definitions of my macros

10:57 Anderkent: I remember debugging it once before so if I can dig out my old chat logs I can find that

10:57 but basically

10:57 residentsummer1: (defmacro unhex [fs]

10:57 `(apply-sqlfn :UNHEX ~hexable ~fs))

10:57 (defmacro my-where [q spec]

10:57 (let [unhexed (unhex spec)]

10:57 (println unhexed)

10:57 `(where ~q ~unhexed)))

10:58 compiler complains about line with "let"

10:59 Anderkent: residentsummer1: http://clojure-log.n01se.net/date/2013-05-31.html , ctrl+f 'ArityException'

10:59 residentsummer1: Thanks! I'll look into it

11:00 Anderkent: basically because of double macroexpansion the compiler is 'correcting' for the count of args to a macro twice

11:00 (correcting i.e. substracting 2 from actually provided, because each macro is provided 2 default args that are hidden from the programmer)

11:00 but because it does it twice instead of just once, it gives you -1 instead of 1

11:00 residentsummer1: uh-oh

11:00 that's bad :(

11:01 Anderkent: it's just an error message bug

11:01 what's ~hexable in your code?

11:01 residentsummer1: it's vector of keys

11:02 somewhere upper there is a "let" that defines it

11:03 Anderkent: right. Nesting defs in other structures is bad practice in general, you'd be better off doing (def :^private hexable [something]) or just taking it as arg. But I suppose that's unrelated

11:03 can you post your code to refheap so that I could run it locally and try to debug it?

11:04 residentsummer1: So, is it a bug in my code, or I just triggered incorrect behaviour of compiler?

11:04 no probs

11:04 Anderkent: yeah, there *is* a bug, the bug in compiler is just in counting args for the error message

11:05 I'd expect the apply-sqlfn to be slightly wrong

11:06 residentsummer1: I guess it's totally wrong :) (that what i think, when I look at this macro)

11:10 Anderkent: here it is https://www.refheap.com/17152

11:11 Anderkent: there are some unrelated stuff, also (api- and db-keys)

11:13 futile: why does `lein run` say "No :main namespace specified in project.clj." when i have ":main foobar.core" in project.clj?

11:13 gworley3: i have a question that isn't clojure specific, but could apply to any functional programming language. as i get deeper into using clojure, i'm running into some limitation on my knowledge of functional design patterns since all the lisp programming i did was in college before i had experience as a software engineer. i have functions that all seem to receive the same several arguments to pass around "global" state. none of these values ch

11:13 during execution, though, but are set at runtime. since it's annoying to have to go through and change every one of these functions when i need to add new variable to track in the "global" state, what's the usual way you guys would handle this to avoid having to constantly modify code just to pass around another variable that only a few functions actually need?

11:14 futile: gworley3: i would just (def) them at the top level of the file

11:14 assuming all the fns are in one file

11:14 tolstoy: gworley3: Use a map instead?

11:14 futile: def'ing global state is appropriate for never-changing configs

11:14 yeah, and put it in a map

11:15 gworley3: futile: that would work, except these are set based on user set values at start time

11:16 tolstoy: so is it normal to pass around a map to all your functions for that purpose to keep track of state?

11:16 i just want to try to follow the normal design pattern here rather than reinventing the wheel

11:16 tolstoy: gworley3: I think so. I do a lot of (defn make-state [] {:conn this :blah that})

11:17 futile: gworley3: you can change the def in your entry-point (main) function

11:17 var-alter-root! or something

11:17 ,var-alter-root!

11:17 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: var-alter-root! in this context, compiling:(NO_SOURCE_PATH:0:0)>

11:17 tolstoy: Then (defn some-fn [state param1 p2] (assoc state :blah (new val))).

11:17 futile: ,(doc alter-root-var!)

11:17 clojurebot: excusez-moi

11:18 tolstoy: gworley3: I've seen that pattern in a lot of libs.

11:18 ystael: futile: it's alter-var-root! but often i use a ref or atom instead

11:18 racycle: gworley3: Check out this excellent talk by Stuart Sierra http://www.infoq.com/presentations/Clojure-Large-scale-patterns-techniques

11:18 gworley3: racycle: okay, will do

11:18 futile: ystael: that makes sense for data that will change, but for immutable data this seems better

11:18 imo

11:19 so, anyone know about this lein problem?

11:19 ystael: futile: paste your project.clj?

11:20 futile: https://www.refheap.com/17153

11:20 re ystael

11:20 gworley3: tolstoy: futile: thanks. i think i'll take a crack at passing around a map to keep track of this state

11:21 tolstoy: gworley3: I think there's some semantics to the idea.

11:21 residentsummer1: futile: according to example project.clj

11:21 tolstoy: gworley3: For instance, with a database, you pass "the database" around as a param. (The fact that it's really a connection spec, or connection object, is just impl details.)

11:21 residentsummer1: futile:;; The -main function in this namespace will be run at launch

11:21   ;; (either via `lein run` or from an uberjar). It should be variadic:

11:21   ;;

11:21   ;; (ns my.service.runner

11:21   ;; (:gen-class))

11:21   ;;

11:21   ;; (defn -main

11:21   ;; "Application entry point"

11:21   ;; [& args]

11:21   ;; (comment Do app initialization here))

11:21   :main my.service.runner

11:22 futile: WHOA

11:22 residentsummer1: futile: here is the link https://github.com/technomancy/leiningen/blob/master/sample.project.clj

11:22 futile: i have zephyros.core namespace in src/zephyros/core.clj which has a -main function

11:22 so i meet those criteria

11:22 residentsummer1: a lot of interesting stuff there

11:22 hm

11:23 IamDrowsy: futile: are you sure you running lein inside the project folder?

11:23 ystael: futile: and - super dumb question - leiningen has the right idea about what your source path is?

11:23 tbaldridge: dnolen: ping

11:23 dnolen: tbaldridge: pong

11:23 futile: IamDrowsy: yes

11:23 ystael: as long as it defaults to src/, yes

11:23 its this: https://github.com/sdegutis/dotfiles/tree/master/home/zephyros

11:23 im in that dir, and i run `lein run`

11:23 tbaldridge: dnolen: for this core.async bug with &env. Am I correct in assuming that you only test the existence of the key? Do you actually use the value?

11:24 residentsummer1: futile: and the last try, does adding :gen-class helps?

11:24 futile: oh now it works, but only if i add :main to project.clj

11:24 dnolen: well use the value in the sense of use the local in the expanded code

11:24 futile: thanks guys

11:24 sweet i just controlled my mac windows using clojure

11:25 residentsummer1: futile: wow!

11:25 tbaldridge: dnolen: right, so in CLJ the value would be a instance of LocalVariable (or whatever class the compiler uses). Do you do anything with that value, or just assert that it exists in env?

11:25 residentsummer1: futile: how did you do that?

11:25 futile: residentsummer1: are you on mac?

11:25 residentsummer1: yep

11:25 futile: here:

11:25 https://github.com/sdegutis/zephyros

11:25 the version on HEAD is controlled via a small TCP language

11:26 lang described here: https://github.com/sdegutis/zephyros/issues/14#issuecomment-21966253

11:26 example app here: https://github.com/sdegutis/dotfiles/blob/master/home/zephyros/src/zephyros/core.clj

11:26 residentsummer1: now I use slate with home-made js config

11:26 futile: residentsummer1: oh, can you help me make a node.js client for zeph?

11:27 residentsummer1: thanks for that! I'll try it out!

11:27 futile: residentsummer1: the stable version of Zeph comes with built-in JS/CoffeeScript support, if you wanna try tat out

11:27 dnolen: tbaldridge: what do you mean by "do anything" ?

11:27 futile: *that

11:27 residentsummer1: I'm afraid I'm not a js guru, used it only because it was the only option :(

11:28 futile: residentsummer1: the latest stable version also has Ruby 2.0 support

11:28 residentsummer1: and HEAD has preliminary Go (and soon Clojure) support

11:28 tbaldridge: dnolen: Well here's the deal, I can make (get &env 'x) return :a-value, but I can't really go and generate an instance of clojure.lang.Compiler.LocalBinding, is that going to be enough?

11:28 I can make your example test pass, I just can't fully duplicate the behavior of the compiler.

11:29 residentsummer1: futile: from all the languages on the gh page I now python, js (a lil bit) and learning clojure

11:30 oh, and lil lua, because of awesome-wm

11:31 futile: residentsummer1: ah then maybe you can help me port this to python :)

11:31 residentsummer1: i was struggling to make a tcp client in twisted

11:31 residentsummer1: if you're interested in helping (short or long term), feel free to come to #zephyros

11:33 residentsummer1: futile: ok, I'll can invest some spare time, cos i'm tired of cmd-tabbing :)

11:33 futile: :)

11:39 How do you create a string from a sequence of Integers?

11:40 IamDrowsy: ,(apply str [1 2 3 4 5])

11:40 clojurebot: "12345"

11:40 futile: Oh, I need to convert the ints to Character first

11:40 oops :)

11:40 residentsummer: (clojure.string/join " " [1 2 3])

11:41 IamDrowsy: ,(apply str (map char [97 98 99]))

11:41 clojurebot: "abc"

11:41 IamDrowsy: like this?

11:42 futile: IamDrowsy: yep

11:42 that worked, thanks

11:42 IamDrowsy: np :)

11:42 futile: i had (apply str ...) at first, but wondering why it was just ints

11:42 heh

11:42 i think i need clojure.async now

11:42 anyone have good experience with it?

11:43 bhauman: futile: what do you need it for?

11:43 futile: sorry missed the earlier part of the convo

11:44 futile: to coordinate a background-thread listener with a foreground function call that needs to return a value fetched in the background

11:45 in Ruby i used a queue

11:45 bhauman: yeah core.async will work.

11:45 futile: in Go i used a channel and a goroutine

11:45 zerokarmaleft: futile, IamDrowsy: reduce will be faster for large seqs

11:45 futile: zerokarmaleft: i dont have seqs longer than, say, 100 chars

11:45 zerokarmaleft: ,(dotimes [i 4] (time (apply str (range 1e4))))

11:45 clojurebot: "Elapsed time: 17.552416 msecs"\n"Elapsed time: 4.039793 msecs"\n"Elapsed time: 4.487624 msecs"\n"Elapsed time: 10.171103 msecs"\n

11:45 futile: generally

11:45 mdrogalis: Aha. I understand core.async now. So cool. :D

11:45 zerokarmaleft: ,(dotimes [i 4] (time (reduce str (range 1e4))))

11:45 clojurebot: "Elapsed time: 297.796355 msecs"\n"Elapsed time: 270.507669 msecs"\n"Elapsed time: 262.986148 msecs"\n"Elapsed time: 287.415497 msecs"\n

11:46 zerokarmaleft: er, hmm

11:46 futile: zerokarmaleft: lol

11:46 chrisrossi: so, if i use a potentially infinitely long lazy sequence as the body of a ring response, can i reasonably expect the server to "do the right thing" wrt memory?

11:46 timvishe`: did clojure.contrib.seq/positions go anywhere when contrib was deprecated?

11:47 futile: is clojure.lang.PersistentQueue thread-safe?

11:47 if it blocks on reads and is thread-safe, it might be precisely what i need

11:48 tbaldridge: PersistentQueue is persistent

11:48 bhauman: futile: I think the answer to that is yes.

11:48 tbaldridge: adding to the queue creates a new queue

11:48 futile: oh right

11:48 that makes sense

11:48 working in ruby threw me off

11:49 tbaldridge: futile: take a look at Java's ConcurrentBlockingQueue. According to Rich "I didn't write my own queue, because the Java one is good enough, use it, it's good"

11:49 futile: :)

11:49 thanks!

11:49 never knew about ConcurrentBlockingQueue

11:49 (clojure is my first experience with java)

11:49 tbaldridge: or look at core.async if you want more go-like stuff :-P

11:50 futile: meh, i can make do with BlockingQueue

11:50 mdrogalis: tbaldridge: Would it be obnoxious to open a dev thread or Jira ticket about the perception problem we discussed on Google? It does seem like a legitimate short coming of Clojure's transactions.

11:50 futile: plus core.async isnt ready yet

11:50 according to readme :(

11:50 plus i want few dependencies for this

11:50 mdrogalis: futile: It's pretty much ready.

11:50 mgaare: chrisrossi: what is the right thing in that case? arbitrarily truncate the seq?

11:50 bhauman: futile: and it's just plain fun

11:50 chrisrossi: not hold the already streamed out head in memory.

11:50 tbaldridge: futile: yeah, that's more just the old docs issue. The API is so small that if we change something it won't matter much.

11:51 futile: well hmm

11:51 are there any tutorials on it?

11:51 the readme has no code in it

11:51 so im scared

11:51 nor wiki

11:51 tbaldridge: mdrogalis: yeah, open it as a future request, or better yet, join the clojure-dev mailinglist and startup a topic.

11:51 bhauman: futile: there is a walk through

11:51 mdrogalis: futile: https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj

11:51 futile: woot thanks

11:51 mdrogalis: I just did it. It's not so bad :)

11:51 futile: mdrogalis: thx

11:51 mdrogalis: tbaldridge: I'll do the former. ^^

11:52 futile: do chans have to be closed before they're garbage-collected?

11:52 or can i just throw it away?

11:52 tbaldridge: just throw away.

11:52 futile: assuming the client is done with it

11:52 mdrogalis: Nope, GC will pick it off

11:52 futile: sweet

11:52 ToBeReplaced: nothing wrong with java.util.concurrent.LinkedBlockingQueue though... just gotta type-hint sometimes

11:52 mdrogalis: ToBeReplaced: You asked about core.contracts earlier. Still interested in that kind of thing?

11:52 ToBeReplaced: yeah sorry i got dc'd

11:52 bhauman: futile: I have a bunch of links to resources at the bottom of my post http://rigsomelight.com/2013/07/18/clojurescript-core-async-todos.html

11:53 futile: ok, thanks

11:53 tbaldridge: futile: agreed, it's a question of what you want to do with threads. A ton of cheap "blocking" threads, go with core.async. Just a queue to shove stuff into, use the Java classes

11:53 mdrogalis: ToBeReplaced: My replacement for that kind of thing. https://github.com/MichaelDrogalis/dire

11:53 ToBeReplaced: just saw the library; had been using pre/post maps

11:53 mgaare: chrisrossi: could always test it and see... make a handler that does (iterate inc 1) and see what happens

11:53 chrisrossi: yeah, i'll wind up testing. just wondering if anyone already knew the answer.

11:53 ToBeReplaced: man i'm in erlang land today aren't i?

11:54 futile: tbaldridge: i want to emulate this:

11:54 https://github.com/sdegutis/zephyros/blob/master/libs/zephyros.rb#L20-L74

11:54 mdrogalis: Yeah I guess so, heh.

11:54 futile: the parts that touch @queues

11:54 mdrogalis: ToBeReplaced: It's very easy to use though.

11:55 tbaldridge: futile: yeah the JVM classes are fine for that. If you ever find yourself needing >50 threads or so, look at core.async

11:55 futile: thanks

11:57 mdrogalis: ToBeReplaced: In any case, the major shift is a complete decoupling of pre/post conditions from what they test. core.contracts & :pre/post don't do that.

11:59 mgaare: chrisrossi: I just glanced at the source, and it looks like that's something that would be determined by the underlying server. ring just passes the body as is without realizing it if it's a lazy seq

11:59 ToBeReplaced: mdrogalis: i don't understand what you mean

12:00 chrisrossi: mgaare: yeah, i figured that. there might some (unwritten) contract that server follows, though.

12:00 or differences from one to the other.

12:00 racycle: bhauman: that blog post is awesome. Thanks for that link.

12:00 mdrogalis: ToBeReplaced: https://gist.github.com/MichaelDrogalis/6140936

12:00 bhauman: racycle: your welcome :)

12:01 mdrogalis: add-one knows absolutely nothing about its preconditions

12:02 ToBeReplaced: mdrogalis: oh, i see... what are the advantages of that? I feel like I want add-one to know about its preconditions

12:02 zerokarmaleft: futile: ah, apply str uses a StringBuilder internally, that explains the difference there

12:02 futile: zerokarmaleft: is that special-cased on the apply fn?

12:02 that would seem dirty

12:03 mdrogalis: ToBeReplaced: Keep the logic away from the input validation. Additionally, you can move around those calls to with-preconditions! I regularly have dev and debug builds where I import those calls, but I leave them out in prod.

12:04 I do the same with logging. Keep it off during my automated tests, standard out for dev, and log box for prod. You can do that when they're decoupled to that extent.

12:04 zerokarmaleft: futile: special-cased on str https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L514

12:04 futile: zerokarmaleft: thats ok then :)

12:05 zerokarmaleft: indeed

12:06 dnolen: tbaldridge: yes that will be enough, we just need to know if the symbol we have is in &env, note for CLJS (:locals &env)

12:07 mdrogalis: Ok, time to attend the end of a hackathon. See you guys later.

12:08 ToBeReplaced: mdrogalis: thanks

12:09 tbaldridge: dnolen: k thanks. I have a CLJ fix done, I'm working on the CLJS version now.

12:17 egghead: lesson learned: don't put work inside a go block

12:17 Anderkent: ,(let [a (apply str (range 1e4))] (count a))

12:17 clojurebot: 38890

12:18 residentsummer: guys, can anybody tell me, what's wrong with the last macro here https://www.refheap.com/17152?

12:18 egghead: is `thread` from core.async a suitable replacement for `future` ?

12:18 residentsummer: it gaves me ArityException clojure.lang.ArityException: Wrong number of args (-1) passed to: db$eval3114$unhex

12:32 Anderkent: residentsummer: why are you doing unhex at compilation time? that definitely looks weird. don't you want (defmacro my-where [q s]ec) `(where ~q (unhex ~spec))) ?

12:42 konr: Is there an 'undef' functions that frees a symbol from its definition?

12:43 residentsummer: Anderkent: Seems that I've overcomplicated this

12:44 My initial thought was "if it's known what to transform at compile time, why not to do so?"

12:45 justin_smith: residentsummer: with what you were doing, it was being transformed at the moment the macro was defined

12:45 the input does not exist yet

12:45 residentsummer: ah...

12:45 Anderkent: konr: ns-unmap or something like that

12:46 justin_smith: inside `() it is defined at the time of macro invocation - which is likely compile time

12:46 konr: Anderkent: thanks!

12:46 residentsummer: am I right, thinking that outer macros are processed first?

12:47 so I wanted to get output of #'unhex before supplying it to where (because it's a macro, too)

12:50 justin_smith: residentsummer: https://www.refheap.com/17158

12:50 that demonstrates the order

12:51 residentsummer: justin_smith: So, I was right on that

12:52 justin_smith: yeah

12:52 Anderkent: residentsummer: then you need to do something like `(let [unhexed# (unhex stuff)] (where ...))

12:52 but the unhexing should still happen within the 1

12:52 *`

12:53 justin_smith: unless unhex generates the code to be executed (which of course it doesn't)

12:57 residentsummer: Anderkent: i'll try your suggestion

13:08 seangrove: Is there a way to nrepl-jack-in using the lein production profile?

13:09 technomancy: seangrove: no, but there's an open ticket discussing it

13:10 seangrove: Thanks technomancy

13:10 technomancy: np. you can always start a repl session and M-x nrepl into it

13:12 poppingtonic: .join #eff

13:12 sorry

13:16 residentsummer: Anderkent: it's not quite what I'm trying to get… But enough of that for today

13:16 Thanks everyone

13:21 cemerick: seangrove: at that point, it's probably simpler to just have your app start an nREPL endpoint itself, and connect to it

13:36 gtrak: anyone know of any pre-existing ring/compojure 'forward' middleware?

13:36 mgaare: gtrak: forward as in redirect?

13:37 gtrak: redirect, without the redirect, change the request, run it back through the handler

13:37 justin_smith: gtrak: just have a branch in the request handler that recurs?

13:38 gtrak: yes.. just wondering if there's a pre-built solution, aware of compojure contexts and such :-)

13:38 mgaare: I'm not aware of an extant middleware to do that

13:39 justin_smith: or put the forwarding request rewriter at the top of the handler, and that's done (unless a forward should in turn be able to forward)

13:39 mgaare: actually it'd be a little tricky to write this as a middleware

13:40 justin_smith: mgaare: if it took the handler itself as an arg I don't think it would be tricky at all

13:40 gtrak: hopefully one forward is enough :-)

13:40 mgaare: or rather the usage would be tricky, because you'd need to have it pretty much at the top of the stack.

13:41 justin_smith: the tricky part of it is that it could have unfortunate interactions with other middlwares. wrap-params reads the request body, which is mutable and can only be read once

13:41 futile: is there such a thing as a queue where push/pop work per key (like a Map)?

13:41 and where q.pop(1) wont block q.pop(2)?

13:42 justin_smith: futile: a map where every val is a queue?

13:42 futile: thats what i have right now

13:42 but it means i have to remove the queue from the map when im done with it

13:46 dnolen: tbaldridge: did you see this? http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/

13:50 futile: wat!?

13:50 clojurebot: For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

13:51 futile: its august already?

13:51 i thought it was may or june

13:51 * futile blinks

13:58 tbaldridge: dnolen: just read it, spot on!

14:00 soulman: anyone familiar with xml zipping?

14:02 I want to process an eclipse .classpath file but (zx/xml-> zipper :classpath) just returns an empty list

14:03 classpath is the root element in the .classpath file

14:04 (zx/xml-> zipper) returns the content BTW

14:06 squidz: i have a mysqlservice which returns json from a database query with php. What would be the easiest way to get my service to return EDN instead of json

14:07 justin_smith: squidz: if you want the php layer to remain, cheshire, if you want to replace it, clojure.java.jdbc

14:08 if you want to replace the mysql - datomic :)

14:08 scape: hah

14:09 rainerschuster: :D

14:09 squidz: I can't replace the mysql unfortunately. So you are suggesting converting the json to edn? Isn\t there a way with php to send edn instead of json?

14:10 wei: how would you write this function, update-vec? https://gist.github.com/yayitswei/6141890

14:10 justin_smith: squidz: a quick google finds this https://github.com/igorw/edn/blob/master/src/encoder.php

14:10 scape: why not use json?

14:11 hiredman: wei: gross, use a map

14:12 justin_smith: wei: I would use (group-by :id args)

14:14 wei: for various reasons i need it in vector format. so convert to map using group-by, then convert back?

14:14 justin_smith: that would be the easy way I think

14:14 wei: cool, thanks

14:14 hiredman: wei: you almost certainly don't need it in a vector format

14:14 don't convert that is just gross

14:15 when you have associative data, and do associative operations, why would you structure the data to fight against that?

14:15 wei: i'm displaying it as a list

14:15 jcrossley3: soulman: try xml1->

14:16 hiredman: wei: so?

14:16 kmicu: so?

14:17 wei: good point, i'll consider it

14:17 squidz: justin_smith: I am using clojurescript. I don't believe I can use chesire with it right?

14:18 justin_smith: squidz: hmm - not sure

14:19 if you are in clojurescript using json via interop should be very easy, no?

14:20 clj_newb_2345: anyone know of a good set of minimalist css style foiels for showing source code? (I'm outputing stuff with enlive, but want a good css style sheet for the source code)

14:23 juhu_chapa: Hi guys!

14:25 chronno: juhu_chapa: Hi!

14:27 juhu_chapa: How would be a macro that returns: (. Integer valueOf "42") when called with: (int-macro Integer valueOf "42")

14:27 ?

14:29 justin_smith: (defmacro int-macro [& args] `(. ~@args)) would trivially match your case

14:30 juhu_chapa: justin_smith: really nice, i am just learning macros. thank you!

14:30 chronno: Hi!

14:31 seangrove: squidz: Just use goog.json/parse and friends

14:32 justin_smith: juhu_chapa: I don't know if that is really what you want, it just happens to expand to what you want for the example input

14:34 seangrove: justin_smith is a constraint-based reverse-lookup table for function/macros definitions

14:34 justin_smith: I would see (defmacro int-macro [& args] `(. Integer ~@args)) being slightly more useful, then the call would look like (int-macro valueOf "42")

14:34 seangrove: lol

14:35 juhu_chapa: justin_smith: how now would be the macro when: (int-macro Integer (valueOf "0") (valueOf "1")) -> (. Integer valueOf "0") (. Integer valueOf "1")?

14:36 seangrove: juhu_chapa: What are you trying to do?

14:38 justin_smith: juhu_chapa: echoing seangrove's question, and that has a completely different structure from the other input, so it needs a different macro (or function) to process it

14:40 kohyama: wei: I commented your gist.

14:44 juhu_chapa: seangrove: I am trying to write apache camel java dsl in clojure. for example: (from "uri") (to "uri) written in clojure would be (. this (from "uri)) (. this (to "uri"))

14:44 I think the task would be easier with macros

14:45 hiredman: juhu_chapa: I think you would be better descibing the pipeline as a datastructure, and have a function that takes the datastructure and does all the method calling

14:46 justin_smith: (inc hiredman)

14:46 lazybot: ⇒ 22

14:47 dnolen: jonasen: ping

14:47 wei: (inc hiredman)

14:47 lazybot: ⇒ 23

14:47 wei: (inc justin_smith)

14:47 lazybot: ⇒ 5

14:48 juhu_chapa: hiredman: (inc :all)

14:48 konr: is EDN pronounced 'Eden' or 'Ee Dee Ann'?

14:49 matthavener: konr: eden

14:49 technomancy: I pronounce it like "edna" but withaut the A

14:50 stuartsierra: I pronounce it "Gladys."

14:54 gdev: I need some examples of edn in action

14:54 For some reason that isn't part of the documentation

14:55 Raynes: I pronounce it Jennifer.

14:55 hiredman: it is a serialized data format, there is no action

14:55 like, all you can do is read it or write it

14:56 gdev: hiredman, gotcha thanks

15:00 gfredericks: hiredman just wrote a very short "EDN In Action"

15:01 hiredman: EDN Inaction

15:02 gdev: snark as a service

15:04 pjstadig: snarka sas er vice

15:05 rasmusto: pjstadig: sounds like my job description

15:10 DomKM: In ClojureScript, is it possible to define a protocol in terms of another protocol? For example, I'd like to create a protocol that can be satisfied by implementing function-foo AND satisfying the IFn protocol.

15:13 dnolen: DomKM: it's not possible in ClojureScript or Clojure

15:16 DomKM: dnolen: Oh well, thanks for answering. Is there a standard way of dealing with something like that? Or, is there a way to create an object that implements a protocol and delegates all methods not belonging to that protocol to another object?

15:17 MacCoaster: hi guys, I'm trying to parse some xml that was input from a POST using Noir, but i keep getting MalformedURLException

15:17 i've even tried to do url-decode

15:17 but doesnt seem to work

15:18 am i doing it wrong by simply doing (xml/parse xmlstring)

15:18 dnolen: DomKM: you can do delegation easily with protocols, just compose

15:18 bhauman: DomKM: I normally just forward the calls

15:19 dnolen: DomKM: instance A can't handle protocol P0, but protocol P0 has a default case asking if A has something which can handle protocol P0, and it calls that instead.

15:19 MacCoaster: oh the string argument is an URI

15:19 i can't read, nevermind

15:19 dnolen: DomKM: so this means that A must at least implement the ability to provide something that can handle P0

15:20 DomKM: dnolen: Even if you don't know the specific methods in advance? The use case is creating a function that takes an object and a function and returns an object that implements IFn and invokes the supplied function but delegates all other calls to the object.

15:26 troydl: Howdy. Is there a way to break elements out of a list to use each element as a separate argument to another function? In order to do something like this (average (range 5))

15:26 ystael: troydl: you mean 'apply' ?

15:26 futile: troydl: like this?

15:26 ,(reduce + (range 5))

15:26 clojurebot: 10

15:27 futile: no hold on thats not it.

15:27 troydl: what are you trying to do?

15:28 troydl: Well I was just messing around in a clojure book playing with the & extra argument for functions and I was wondering if I could pass in a list of args somehow

15:29 futile: troydl: yes, apply.

15:29 troydl: Essentially, break the elements out of a list all at once

15:29 futile: ,(apply max [1 2 3])

15:29 clojurebot: 3

15:29 dnolen: DomKM: ok, yeah you can't do that elegantly yet - we need a proposal called specify to be implemented first. no need for protocol on protocols to do that.

15:29 futile: ,(max 1 2 3)

15:29 clojurebot: 3

15:29 futile: troydl: see those two examples.

15:29 troydl: Oh, nice

15:29 mgaare: apply is a massively useful function ;)

15:29 futile: yes

15:29 troydl: Perfect, thank you

15:30 DomKM: dnolen: Ah, okay. Yeah I saw the specify discussion ClojureScript confluence site but didn't entirely understand it.

15:30 dnolen: Thanks for your help.

15:31 dnolen: DomKM: IFn is more or less an illusion, if you want instances to work as fns in that way set! call and apply properties on the thing you have.

15:31 DomKM: this is in fact how specify! will probably work, specify would require that the object be cloneable

15:37 jonasen: dnolen: pong

15:37 dnolen: jonasen: re inst ticket, so I'm not totally following your comments on the ticket. did you or did you not fix the tests?

15:39 jonasen: dnolen: for CLJS-454? No I did not. but I think they're buggy

15:39 upwardindex: I've seen people exclude the clojure of their dependencies in their leon file, why do people do that?

15:40 dnolen: jonasen: so I don't understand how they are buggy because I didn't find your comments particularly clear

15:40 jonasen: they don't follow the #inst spec

15:40 dnolen: jonasen: so are the core_test.cljs tests good and the reader ones buggy?

15:40 or the other way around?

15:41 jonasen: the reader_tests are bad. Because they don't follow the spec

15:41 dnolen: jonasen: and they don't follow the spec ... because of how they handle padding?

15:41 jonasen: At least the clojure reader can't read the generated data

15:41 DomKM: dnolen: Oh, interesting. I'll look into that. Thanks.

15:41 jonasen: ,#inst "2007-1-1"

15:41 clojurebot: #<RuntimeException java.lang.RuntimeException: Unrecognized date/time syntax: 2007-1-1>

15:42 dnolen: jonasen: but what is buggy about the tests? how it generates the strings?

15:42 jonasen: the clojure reader requires #inst "2007-01-01"

15:42 dnolen: jonasen: does the reader need to be fixed? do the tests need to be fixed?

15:43 jonasen: dnolen: yes, and If you fix that then they are exactly the same as in core_tests. All 7000 of them

15:43 the tests needs fixing. (But that's not really what the original issue is about)

15:44 dnolen: jonasen: I don't see how those tests are the same ... one tests the client side reader, the other date printing

15:44 core_tests.cljs = date printing test, core_reader.cljs = date reading test

15:45 jonasen: dnolen: ah, sorry. You're correct

15:45 dnolen: jonasen: ok, this why I didn't understand anything you were saying on the ticket :)

15:45 jonasen: but the reader_tests still need fixing

15:45 dnolen: heh

15:45 dnolen: jonasen: sure, if those get fixed I'll review the patch more closely and apply.

15:46 jonasen: I'll fix the tests then.

15:46 dnolen: jonasen: thx

15:46 upwardindex: What happens if I have more than one version of clojure in my dependencies tree?

15:46 jonasen: dnolen: sorry for the confusion

15:48 xeqi: upwardindex: it chooses the version with the least depth in the tree, provided none of the dependencies use a version range

15:48 do you have a link to a project.clj that excludes clojure?

15:54 jonasen: dnolen: It's pretty easy to speed up the reader with ~30% by optimizing the StringPushbackReader. Would you accept such a patch?

15:54 https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/reader.cljs#L18

15:55 dnolen: jonasen: that would be awesome, though separate enhancement ticket + patch please

15:55 jonasen: dnolen: ok

15:56 dnolen: jonasen: are you thinking about just switching to ^:mutable fields?

15:56 jonasen: dnolen: and js array for the buffer

15:56 dnolen: jonasen: excellent

15:57 jonasen: dnolen: https://www.refheap.com/17161

15:58 upwardindex: xeqi: ok so nothing bad happens, yes i've seen many projects excluding the clojure of their dependencies but can't figure out why

15:58 rebcabin: '(take 3 (range 3 9 0))

15:59 dnolen: jonasen: nice, though, small nit, just use alength

15:59 rebcabin: funny that unit tests in clojure source show this as returning '(3 3 3)

15:59 jonasen: dnolen: ok

16:00 rebcabin: line 951 of https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/sequences.clj

16:00 LauJensen: Good evening. I've used Tomcat for a while to host a few servlet apps and Im looking for an alternative which easily lets me host several webapps on the same java instance. Any suggestions?

16:00 rebcabin: but my implementation definitely returns ()

16:00 as does try-clojure

16:03 gfredericks: ,(take 3 (range 3 9 0))

16:03 clojurebot: ()

16:04 gfredericks: rebcabin: what unit tests have (3 3 3)?

16:06 modern_major_gen: I have a Hiccup question in clojure... I'm trying to embed an image in an e-mail, I was generating the html like this

16:06 (hiccup/html [:html

16:06 [:body

16:06 [:h2 "Title"]

16:06 [:img {:src (str "data:image/jpg;base64," chartstr)}]

16:06 ]])

16:06 rebcabin: I wonder how builds pass when unit tests require (take 3 (range 3 9 0)) to produce '(3 3 3) but the implementation produces ()?

16:06 modern_major_gen: this seems to work great except I get <html><body><h2>Aggregate Ratings</h2><img src=\"..

16:06 rebcabin: ,(take 3 (range 9 3 0))

16:06 clojurebot: (9 9 9)

16:06 modern_major_gen: i.e. the img tag has the " escaped out

16:06 rebcabin: works in the other direction :)

16:07 I guess the co-range operator works :-P

16:07 SegFaultAX: modern_major_gen: Y u post in channel?

16:07 modern_major_gen: I'm sorry I thought this was a channel for clojure help, my aplogies SegFaultAX

16:08 SegFaultAX: modern_major_gen: It is, but gist multiline paste.

16:08 hiredman: rebcabin: the head of master can have different behavior from clojure releases that tend to be months older than the head of master

16:08 SegFaultAX: Oh, post. I meant paste

16:08 :)

16:08 rebcabin: hiredman: I see!

16:09 hiredman: good show then

16:09 hiredman: rebcabin: check the source for your specific version, and check out and build master and check the behavior there

16:09 rebcabin: yes, will do .. all is clear now

16:10 tsantos: Anyone have a clue why goog.ui evaluates as nil in the ClojureScript REPL? goog.dom evaluates to an object but not goog.ui.

16:10 hiredman: https://github.com/clojure/clojure/commit/950487fa67243271d522b389d6ea1aad70429474

16:12 modern_major_gen: hiccup/clojure problem I'm stuck on https://gist.github.com/philipsdoctor/6142922 any input greatly appreciated

16:13 dnolen: tsantos: goog.ui isn't really a namespace with anything (functions) in it

16:14 tsantos: you have to require a specific class

16:14 tsantos: dnolen: anything in goog.ui fails, like goog.ui.Select

16:14 dnolen: tsantos: what does you require look like?

16:16 tsantos: dnolen: [goog.ui :as gui]

16:16 dnolen: tsantos: yes that won't work

16:17 tsantos: goog.ui only provides classes not real namespaces and you can't alias

16:17 tsantos: we do have :import, sadly it doesn't quite follow the Clojure import syntax, would like a patch for that if possible.

16:18 tsantos: dnolen: so what's the prescribed way to reference classes in goog.ui?

16:18 noncom: i know that the question may be strange, but i find myself repeatedly coming back to it: why is it when I create a new Leiningen project, the default ns is called "core"? Usually I feel that it is one of the fartherst nss which I may call "core" in my app?

16:18 dnolen: tsantos: (:require [goog.ui.Foo]), or (:import goog.ui.Foo)

16:19 tsantos: dnolen: ah! thanks.

16:19 noncom: i mean, it could be "main" or something, but rarely it is a core for the app

16:20 arohner: didn't the compiler used to check for invalid arity on function calls? why did that go away?

16:21 ,(fn [] (map))

16:21 clojurebot: #<sandbox$eval29$fn__30 sandbox$eval29$fn__30@d29790>

16:21 tbaldridge: ,(map)

16:21 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$map>

16:21 arohner: &(fn [] (map))

16:21 lazybot: ⇒ #<sandbox11278$eval63597$fn__63598 sandbox11278$eval63597$fn__63598@e785d7>

16:25 arohner: , (fn [] (map))

16:25 clojurebot: #<sandbox$eval173$fn__174 sandbox$eval173$fn__174@147e8ed>

16:25 arohner: didn't the compiler used to throw on invalid arity for that? Why did that change?

16:26 tbaldridge: no, it's always been throw on dispatch

16:26 ,(fn [] (:foo))

16:26 clojurebot: #<sandbox$eval203$fn__204 sandbox$eval203$fn__204@11f8255>

16:27 bbloom: cljs does have some arity warnings

16:28 arohner: I've shipped a few bugs to production because of that recently. What are my options for improving that?

16:29 tbaldridge: better tests?

16:29 noncom: arohner: (map) in (fn [] (map)) is not evaluated until runtime. for options i would take tests.

16:29 or automated code analysis (if you want an additional game)

16:29 maharj: why does the compilation of clojure code end with Caused by: java.lang.NoSuchMethodError: clojure.lang.RT.mapUniqueKeys([Ljava/lang/Object;)Lclojure/lang/IPersistentMap;

16:29 It does not tell you anything :)

16:30 noncom: maharj: what is you IDE?

16:30 arohner: tbaldridge: I run circleci.com :-). I have tests, but not everything is easy to test, and this is something that could be automated

16:30 maharj: If I do lein compile it's fine

16:30 noncom: I'm using vimclojure

16:31 arohner: I use typed clojure for some parts of our codebase, but it's somewhat heavyweight for existing code

16:31 noncom: maharj: well, never used vim.. but in counterclockwise there is a button which can show more details on an exception if they are available (the stack trace i mean)

16:31 maharj: yeah, I'm getting the stack trace

16:31 technomancy: maharj: usually that comes from AOT'd class files that were compiled using an old clojure version

16:31 maharj: but it does not tell me anything that's reasonable

16:32 technomancy: okay.. do I need to specify the clojure version "1.5.1" in somewhere else than project.clj?

16:33 technomancy: maharj: you should, but whether that will fix the problem depends on where the bad .class files are coming from

16:33 noncom: arohner: funny with tests, yeah :D i think that you could write a library which would check for such errors on startup (or when run on a file-structure of a project)

16:33 maharj: technomancy: is there a way to tell?

16:33 this occurs just one in a while

16:34 arohner: noncom: k. I'm going to play with tools.analyzer, see what I can do

16:34 maharj: normally when I screw things up somehow (parens, invalid macrodefs etc..)

16:34 jonasen: dnolen: added CLJS-454-patch2.diff which fixes the tests. I'll create the reader perf ticket+patch tomorrow.

16:34 dnolen: jonasen: thx!

16:34 technomancy: maharj: you can check all the clojure jar files on `lein classpath` for .class files; if there are some then it might not be your fault but a problem with dependencies

16:34 maharj: if it's correlated with compiler exceptions it's probably a vimclojure bug

16:35 noncom: arohner: maybe you will even become a hero who introduced a code-editing-time checks for clojure code correctness :)

16:36 maharj: technomancy: Okay. Sounds fair. So basically I'd need to switch to Fireplace or something that is actively developed?

16:37 technomancy: maharj: you'd have to ask someone more familiar with vim; sorry

16:37 maharj: I just got back to Clojure so I've not yet up to speed with the current development tools...

16:37 technomancy: but fireplace is probably a good idea anyway

16:38 maharj: yeah, I know vim isn't exactly the tool of the trade in lisp circles, but I gave up emacs 10 years ago for vim and I'm not in the mood to switch back again :)

16:38 technomancy: nothing[1] wrong with vim

16:38 [1] - except vimscript

16:38 maharj: yeah, you can say that again...

16:38 technomancy: I probably will

16:38 =)

16:38 maharj: :)

16:39 But thanks, So I'll be shaving the Yak once again for a couple of days :D

16:39 It was just like Haskell.. I wanted to do something with it and wound up doing updates for a whole evening... and then never got back to it :D

16:40 That's why I think it would be a good idea to decide already what I want to do... but there are so many problems in the world and so many suitable tools.

16:45 lenovo`: hello

16:53 stuartsierra1: Is Tim McCormack here?

16:54 How about Andy Fingerhut or John Stoneham?

16:55 I just pushed fixes for DJSON-9 and DJSON-11, wanted to know if they fix the reported problems.

16:56 wei: is there a clojure/clojurescript version of @the_string.html_safe? basically changing newlines to <br> but escaping out html entities

16:59 gfredericks: TimMc: ping ^

17:00 noncom: wei: idk but why not use the native one?

17:02 wei: what's the native one? the example I gave was from Rails

17:15 clj_newb_2345: is there a way to put a span element into a :content field in css? (context: I'm trying to figure out how numbered lines of code works; I have a clss which I'm using ":before" on to insert the line number. However, I want to insert more than just plain text. I would like to insert an actual span element.

17:15 thus, I want a :content field to conttain a span element. Unfortunately, it's displaying the HTML code rather than interpreting it and generaring a span element

17:16 TimMc: stuartsierra1: Surprisingly, yes.

17:17 My shell server is down, but you caught me online.

17:17 stuartsierra1: :)

17:17 clj_newb_2345: hmm

17:17 wrong channel

17:17 this is not #css

17:17 stuartsierra1: TimMc: Does this solve your reported problem in DJSON-9: https://github.com/clojure/data.json/commit/64f7d311bb5e8a5a6032ad071c675b4c257dc3fc

17:18 * technomancy read that as deep space 9

17:18 technomancy: TooManyFerengiException

17:18 stuartsierra1: technomancy: That would be vastly more interesting.

17:18 pjstadig: technomancy: i would patch that issue

17:22 TimMc: stuartsierra1: I think that fixes it, yes. Can't check right now, but the included test looks good. Why "separator", though?

17:22 stuartsierra1: TimMc: Didn't know what else to call it.

17:22 "special-separators" seemed too long.

17:23 And the characters in question are "\u2028 - Line separator" and "\u2029 - Paragraph separator."

17:25 TimMc: :tricky-little-bastards

17:25 stuartsierra1: heh

17:25 ztellman: core.async question: put! throws on a closed channel, but >! doesn't appear to; is this intentional?

17:25 stuartsierra1: :those-things

17:27 TimMc: Huh, my description on DJSON-9 looks like it is missing a couple characters near "viz".

17:27 I wonder if that's a typo or a markup problem.

17:28 stuartsierra1: JIRAAAAA!

17:30 ztellman: dnolen bbloom, if you're around, can I pick your brains re: core.async?

17:30 TimMc: Something like :js-eval-compat for the option and :js-compat-escape for the character "class". But it's not really important, since it's a default no one needs to worry about.

17:31 ..and it's documented. ♥

17:31 stuartsierra1: I'll think about alternate names, maybe something with "js" in it would be good.

17:32 TimMc: By the way, did you actually encounter this bug or is the patch meant to be preventative?

17:34 TimMc: stuartsierra1: Actually encountered it.

17:34 stuartsierra1: ok

17:35 wow

17:35 Who's evil enough to insert U+2028 into a string?

17:35 TimMc: It's not really a bug in DJSON, of course.

17:36 Someone who wants to force an NLP tool to declare a sentence boundary, if I recall correctly.

17:36 stuartsierra1: Ha!

17:36 TimMc: And then various JSON parsers *cough* ExtJS *cough* freak out when they see it, even though it's valid.

17:37 poppingtonic: what's the (currently) best clojure http client?

17:37 wei: poppingtonic: http-kit

17:37 poppingtonic: checking it out. ty

17:37 wei: or you could try clj-http

17:39 clj_newb_2345: are there any video tutorials of pedestal

17:39 seangrove: Yeah, both have been pretty pleasant to use

17:39 rkneufeld: clj_newb_2345: not yet, but we're hoping to do one some time.

17:39 clj_newb_2345: I feel like this is one of the few pieces of software where I need a bit more hand holding to understand.

17:39 rkneufeld: you should put up a kickstarter. I'd donate a few packets of ramen noodles

17:40 rkneufeld: clj_newb_2345: That'd be a ton of fun–we just need the bandwidth to actually be able to deliver. Clojure Cookbook is taking up most of my time right now.

17:41 clj_newb_2345: rkneufeld: hmm, is the book open sourced https://github.com/clojure-cookbook/clojure-cookbook ?

17:41 rkneufeld: Yep

17:42 clj_newb_2345: rkneufeld: dumb question, how can I read the book without reading the raw asiidoc?

17:42 is there a way to generate an html or pdf from that github?

17:42 dnolen: ztellman: what's up?

17:43 rkneufeld: You can with the asciidoc program, but it looks like ass. We need to rig up the output from the O'Reilly process to be displayed somewhere (Not even Luke or I can build locally, we have to do it in the Atlas system they have.)

17:44 ztellman: dnolen: let's say I have a function that returns a periodic stream of messages, by looping inside a go block, reading from a timeout channel, and then writing to the output channel

17:44 then someone closes the output channel, because they don't need it anymore

17:44 how will I ever know?

17:44 I'll just keep on looping and no-oping forever

17:45 clj_newb_2345: rkneufeld: noted, thanks!

17:45 ztellman: there doesn't seem to be a closed? predicate, or any way of knowing that my enqueue fizzled

17:45 am I missing something?

17:46 amalloy: ztellman: don't channels send a nil when they're closed? you could read something like (alts! timeout-channel output-channel), and if it's nil the output was closed

17:46 clj_newb_2345: What are people using for generating css from clojure? cssgen, clj-style, gaka, or something else? Note, I want to generate CSS, not do css-style selectors, thus not enlive

17:46 ztellman: amalloy: right, but this is from the producer's side

17:46 amalloy: i know

17:46 ztellman: I'd need to send a message from the consumer to the producer to stop

17:46 right?

17:46 clojurebot: Equal Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://www.pipeline.com/~hbaker1/ObjectIdentity.html

17:46 technomancy: clojurebot: botsnack

17:46 clojurebot: Thanks! Can I have chocolate next time

17:47 ztellman: I can't consume my own messages, that's for someone else

17:47 amalloy: ztellman: i don't have a lot of experience with core.async, but my understanding from podcasts/etc was that when the consumer closes a channel, the producer would (if it reads the channel) see a nil

17:48 ztellman: I feel like there's something fundamental I'm not getting here, but why would the producer ever read the channel?

17:48 seangrove: ztellman: I'm with you so far, curious about this as well

17:48 But why are consumers closing the channel?

17:49 amalloy: so that it can see that the channel has closed. it wouldn't ever see any other messages aside from the channel-closed message, right?

17:49 dnolen: ztellman: it seems weird to me that you would close the output channel yourself

17:49 amalloy: since put is "blocking", you would never be able to enqueue a message until the real consumer is there to read it, and so the only message that's ever in the channel for you to read will be a channel-closed message

17:49 ztellman: dnolen: if the stream from the producer is unbounded, then I might want it to stop sometime

17:49 hiredman: ztellman: there has been some discussion of a closed? predicate on the ml if you haven't seen it

17:50 ztellman: hiredman: I haven't, that would address this, I think

17:50 dnolen: ztellman: but if no one has a ref to it it will get collected anyway - if you need to clean up resources you need to consider that the channel in question may need to do a lot of cleaning up anyway

17:50 hiredman: amalloy: it sounds like you are assuming a "producer" and a "consumer" are passing messages back and forth to each other over a single channel, which seems very odd

17:51 dnolen: ztellman: so the producer should provide two things - the channel to consume, and channel to communicate a kill signal

17:51 amalloy: hiredman: i guess i'm out of my core.async depth

17:51 hiredman: amalloy: well just replace "channel" with "queue"

17:51 ztellman: dnolen: really? that seems wasteful, since all I need to know is if the channel's been closed

17:52 to be fair, that's more or less what I did (in this case just created an atom that the consumer can mark when it's done)

17:52 but it seems weird and indirect to me

17:52 zerokarmaleft: ztellman: talks.golang.org/2012/concurrency.slide#37

17:53 rob pike's example pretty much mirrors what dnolen suggests

17:53 dnolen: ztellman: yeah I think what you're suggesting sounds like an anti-pattern, my understanding is that closed? will introduce race conditions, the pattern I've described seems to avoid that.

17:54 ztellman: dnolen: why would there be race conditions?

17:54 in either case I may be enqueueing into a closed channel

17:54 bbloom: ztellman: im here too now

17:54 ztellman: bbloom: if you scroll back far enough, you can see my original question

17:55 but it's basically about how to signal a producer to stop

17:55 since they can't tell if they're enqueueing into a closed channel

17:55 bbloom: ztellman: the lack of predicates & other channel-state-inspection functions is intentional to avoid race conditions

17:56 ztellman: bbloom: I get that if you check closed? and then enqueue that it may have been closed after you check

17:56 technomancy: clojurebot: chocolate is <reply>actually I decided I prefer botsnacks after all.

17:56 clojurebot: Ack. Ack.

17:56 ztellman: but I don't see how creating a "stop" channel gets around that

17:57 bbloom: "someone" closing a channel doesn't make sense

17:57 Raynes: ztellman: http://i.imgur.com/1N74Drm.jpg Have a transparent butterfly with which to lighten your day.

17:57 bbloom: close is a control signal from a producer

17:57 it's not a resource management operation, you don't need to call it. and nobody should call it but the "owner" of the writing port

17:57 ztellman: what if downstream there's nowhere for the messages to go?

17:58 bbloom: ztellman: in go, if you have a receive-only channel, you CAN'T close it. it's a type error

17:58 you need to have an extra channel for communication & use multiplexing

17:58 ztellman: ok, fair enough

17:59 my intuition for CSP is horribly underdeveloped, thanks for the help, dnolen zerokarmaleft bbloom

17:59 and thank you for the butterfly, Raynes

18:00 bbloom: ztellman: in general, the broken intuition is to use channels in more places in your app and to use fewer channels per place

18:00 ztellman: instead, use channels less frequently, but don't be afraid to create a handful of them for various needs

18:00 it's totally ok to have TWO parties communicating with 2,3, or 4 or so channels. or even to have them send channels back and forth to each other wrapped up in containers

18:02 it's rare that you put a channel on a channel directly, but it's very common to put a channel in a "connection" or "request" object, then put that object on the channel

18:04 stuartsierra1: bbloom: Are you getting those intuitions from Go language docs?

18:04 zerokarmaleft: seems weird in that pattern that you can send a completely arbitrary message on the "stop/quit" channel b/c the producer discards it

18:05 bbloom: stuartsierra1: i've done a non-trivial amount of socket programming

18:05 stuartsierra1: plus golang videos/docs/tinkering

18:05 stuartsierra1: ah

18:05 bbloom: zerokarmaleft: *shrug* lots of the go examples just sick a 1 on the channel

18:05 stick*

18:06 zerokarmaleft: though I suppose finer-grained control could be had with explicit control messages if needed

18:06 bbloom: send :quit and then (assert (= msg :quit)) if you want to feel better :-)

18:06 stuartsierra1: Stick that in your channel and queue on it.

18:07 bbloom: reading the go std libs is a great way to see some common patterns

18:07 check out their http or rpc libs

18:07 stuartsierra1: cool

18:07 zerokarmaleft: hmm, good idea

18:10 bbloom: this is a cool read too: http://doc.cat-v.org/bell_labs/concurrent_window_system/

18:12 zerokarmaleft: I've read that, I've started on Hoare's CSP book in my free time

18:12 akurilin: I put together a simple standard deviation function as an example of a variadic fn (which I haven't written many of before). Could tell me if I could be doing this fairly idiomatically, or if I could do something better? http://pastebin.com/dK3fUCXq

18:14 *I'm doing this, not "could" be

18:24 amalloy: akurilin: why is this variadic at all? it makes way more sense to have it accept a list

18:26 sorenmacbeth: anybody good with calling clojure from java land? I'm getting "call to unfound fn" errors calling into a reified instance which I've instantiated from a java class. shouldn't a reified object capture the fns called from inside it?

18:29 TimMc: A reasonable expectation, but you may need to require the namespace first using RT.

18:31 ztellman: bbloom: if you're still around, I'd be interested to hear your thoughts on https://github.com/ztellman/narrator/blob/master/src/narrator/query.clj#L136

18:31 egghead: are there any examples of exposing a clojure namespace through a java class? I know datomic does this but it's not too easy to see their source

18:31 bbloom: ztellman: 1 sec

18:31 ztellman: bbloom: not entirely self-explanatory, but I think you can ignore all the bits that aren't prefixed with a/

18:32 amalloy: akurilin: that's also not a very good algorithm for std dev of a large list, since it has to hold the whole thing in memory at once

18:34 bbloom: ztellman: ok rewind, what are you trying to do?

18:34 that's a lot of code for me to fail at reviewing :-)

18:34 ztellman: bbloom: haha, yeah, sorry

18:35 basically, this takes something that describes a descriptor of a streaming analysis you'd like to do, plus a stream

18:35 and returns a a stream representing the output of the analysis

18:36 so in this case, it takes a channel, feeds the messages into the "operator", and periodically receives a "flush" signal that means it should emit a value into the output stream

18:36 TimMc: How do I tell lein-deploy to not try to sign a release?

18:37 bbloom: ztellman: why bother with this flush loop? why not just multiplex on a timeout & flush when it gets a message, then create a new timeout and loop?

18:37 akurilin: amalloy, true, I wasn't expecting large numbers, you're right.

18:37 amalloy, aren't a lot of math operations in clj variadic by default for convenience? I was trying to model after +

18:38 or the advice in this post: http://stackoverflow.com/questions/7823516/why-are-many-clojure-functions-variadic

18:38 amalloy: akurilin: nobody's ever going to type (std-dev a b c d e f g), they're going to have a list of things like (std-dev xs)

18:38 ztellman: bbloom: hmm, I seem to recall rejecting that, but now I can't remember why

18:38 so I'm going to assume it was for no good reason

18:38 amalloy: whereas (+ x 5) is much more common

18:39 akurilin: amalloy, so would you say that being variadic here buys you no extra flexibility?

18:40 ztellman: akurilin: not that you necessarily need it, but here's an implementation of streaming variance: https://github.com/ztellman/lamina/blob/perf/src/lamina/stats/variance.clj

18:40 amalloy: akurilin: variadic never impact flexibility, it's just a tradeoff of which calling scenario will be more convenient

18:40 akurilin: amalloy, got it.

18:40 ztellman, thanks, will check it out!

18:41 amalloy: if your function is variadic, then calling it on a list of things will be annoying, (apply f some-list) instead of just (f some-list); if it's not variadic, then calling it on a couple of fixed args is annoying: (f [a b c]) instead of (f a b c)

18:41 akurilin: btw, I might have asked that before, but is it poor tone to cram a bunch of steps into the let form?

18:41 and then just return the last binding inside of the let

18:41 amalloy: for +, (+ a b) is pretty common, so it's made convenient; for std-dev, nobody will ever do that, so make the thing they actually will do convenient

18:41 akurilin: amalloy, gotcha, makes total sense.

18:54 sorenmacbeth: TimMc: I'm doing this to load the namespace which contains the reify: https://gist.github.com/sorenmacbeth/72499f3b2a5f13012576

18:55 TimMc: The problem occurs when I have functions from other namespaces which I've (:required) inside of the namespace that I've loaded

18:55 inside the reify that is

18:56 (reify Whatever ([this stuff things] (other-namespace/function-which-throws-unbound-fn stuff)))

18:56 LauJensen: Im seeing an issue where lein2.0 is not picking up the ~/.lein/profiles.clj user profile, has anyone come across that before, specifically on windows 8 ?

19:04 sorenmacbeth: the other thing I guess is important to mention is that it works fine locally (in a single thread), but breaking in a distributed environment

19:28 hiredman: sorenmacbeth: I recommend not eating exceptions like that

19:43 andrewshawcare: Hi, I had a question about lisp syntax...

19:44 Is there any reason why whitespace cannot define prefix notation? So instead of this:

19:44 (foo

19:44 1

19:44 2

19:44 3

19:44 )

19:44 we could write this:

19:44 foo

19:44 1

19:44 2

19:44 3

19:45 danlarkin: first of all, quit spamming the channel

19:45 andrewshawcare: That's how my client handles multiple lines, sorry.

19:45 danlarkin: second, congrats on being the 5 billionth person to come up with that idea

19:45 andrewshawcare: I don't user IRC often.

19:45 *use

19:45 danlarkin: it isn't very good if you really think about it

19:45 andrewshawcare: Why?

19:45 clojurebot: why not?

19:46 danlarkin: because why would you want it?

19:46 what possible advantage does it offer

19:46 andrewshawcare: To eliminate unnecessary syntax, possibly.

19:46 dnolen: andrewshawcare: people ask this all the time - usually if they haven't used Lisp for very long - spend some time w/ macros and you'll see why.

19:48 andrewshawcare: Which allows for greater readability.

19:48 danlarkin: except it doesn't

19:49 andrewshawcare: Care to offer a reason why?

19:50 danlarkin: you offering an opinion on clojure's readability is like me offering an opinion on fine wine

19:50 doc_brown: personally, i cant tell the difference between good wine and bad wine

19:50 dnolen: andrewshawcare: you could ask us or read up on it look at Dylan. if you aren't the first person to have the idea there's probably challenges involved in making it work in an acceptable fashion.

19:51 andrewshawcare: No, I don't think I'm making a subjective argument. Less to understand is less to understand. If we inherently use whitespace to organize our code already, it would seem that the braces would be redundant.

19:52 dnolen: andrewshawcare: look you have some opinions, come back when you've read about why it hasn't worked. It's also worth looking at Julia, which seems to have advanced the state of the art a bit (could be wrong about that).

19:52 danlarkin: they aren't redundant though, and for you to say they are suggests you don't really know clojure well enough to speak on the matter

19:53 which isn't to say you should abandon critical thinking, that's very valuable

19:53 andrewshawcare: I know they define a special type of list, one with the function to be invoked as the first item in the list.

19:53 danlarkin: it just so happens that you're mistaken here

19:53 * dnolen moves on

19:53 andrewshawcare: And list literals are defined with '(), is that correct?

19:55 Did I make a mistake with my last two statements?

19:56 danlarkin: no, but it's not like you're going to convince anyone here

19:56 dnolen suggested some reading you could do

19:57 there's really nothing left to talk about

19:57 noto2: andrewshawcare, clojure has () for list, calling first arg if not 'quoted, [] for vectors, {} for maps... the braces help with legibility in most cases. having to indent every function call would fit like 10 columns of code on the screen

19:59 TEttinger: as an example, clojure could have (fn [coll] (map inc coll))

19:59 inc is a function, and if this proposed syntax treats functions specially, then that code breaks

20:00 or at least become much harder to read, because it makes indented coll fail and non-indented coll (which looks weird) work

20:00 andrewshawcare: Okay, so then you could write that as:

20:00 fn

20:00 [coll]

20:00 map

20:00 TEttinger: no

20:00 andrewshawcare: inc

20:00 coll

20:00 Or extend coll out further if inc is a function, sorry.

20:00 But actually, no.

20:00 Since it's not being invoked.

20:01 TEttinger: ok, you definitely haven't programmed in clojure.

20:01 andrewshawcare: It's an argument to map

20:01 TEttinger: you should try it first

20:01 dnolen: andrewshawcare: if you're going to show code please use a pasting service, don't paste in channel

20:01 TEttinger: alsom that's 5 lines for a one-liner, total waste of space

20:02 SegFaultAX: TEttinger: It's lisp. Everything is a one-liner. :)

20:02 andrewshawcare: You could also write your groceries on one line...

20:02 SegFaultAX: (Without doing syntax gymnastics)

20:02 andrewshawcare: Humans read in an F pattern

20:02 Top down, left to right (or possibly, right to left)

20:03 SegFaultAX: I like to write my programs as simple universal transformations.

20:03 TEttinger: well ##(count "(fn [coll] (map inc coll))") characters vs. 5 lines, and barring a truly massive screen you can't fit a large function on one screen, prohibiting readability

20:03 lazybot: ⇒ 26

20:03 SegFaultAX: In other words, my program is a single function that takes the current state of the universe and produces the next state.

20:03 TEttinger: SegFaultAX, continuation passing style?

20:04 soulman_: SegFaultAX, with map it works on multiverses too

20:04 ;-)

20:04 SegFaultAX: soulman_: That's the spirit!

20:04 TEttinger: here, let me find a real-world example, andrewshawcare

20:05 andrewshawcare: And PS, sorry in advance for my IRC etiquette, I'm brand new to this and I'm sure I'm not doing some things correctly.

20:05 TimMc: andrewshawcare: Regardless of whether this is a good or bad idea, you owe it to yourself and others to at least research the history of this topic, as suggested.

20:05 SegFaultAX: "If you want to make an apple pie from scratch, you must first invent the universe" - Abraham Lincoln

20:06 andrewshawcare: How do I directly reference someone? Is there a prefix character?

20:06 SegFaultAX: andrewshawcare: Just type the first few letters of their nick and press the tab key.

20:06 andrewshawcare: SegFaultAX: Ah, thanks.

20:06 TimMc: ~paste

20:06 clojurebot: paste is https://refheap.com/

20:07 TimMc: ^ there's a pastebin you can use, too

20:07 andrewshawcare: TimMc: Awesome, thanks.

20:07 SegFaultAX: TimMc: You're a pastebin.

20:08 TimMc: Your *face* is a pastebin.

20:08 andrewshawcare: https://www.refheap.com/17172

20:08 Where inc might be a function, but like any variable, is just a variable in this context (since it isn't being invoked).

20:08 SegFaultAX: TimMc: Nuh uhh!!

20:09 malyn: andrewshawcare: I don't use it, but clarity has already worked this out: https://github.com/one-more-minute/clarity/

20:10 andrewshawcare: malyn: Ah, beautiful! Thanks.

20:10 malyn: andrewshawcare: Let's be careful with the "beautiful" word there... ;)

20:10 andrewshawcare: malyn: Fine, gorgeous.

20:12 TimMc: andrewshawcare: You're going to find a lot of pushback from the community. There are very good reasons for people preferring the s-expression syntax, which you will come to understand as you learn more about code-is-data.

20:13 I guess what I'm saying is, you're not going to convince anyone with arguments that a beginner is capable of making.

20:13 soulman_: TimMc, yeah, that's it

20:13 andrewshawcare: Logical fallacies.

20:13 soulman_: TimMc, macros forever ;-)

20:13 TEttinger: http://pastebin.com/W3L6Le5N vs. http://pastebin.com/UVjFaDGN

20:14 TimMc: This is not an appeal to tradition, it's an appeal to learning about something before you try to change it.

20:14 technomancy: TimMc: http://epicureandealmaker.blogspot.com/2012/03/chesterton-fence.html

20:14 andrewshawcare: https://yourlogicalfallacyis.com/the-fallacy-fallacy

20:15 justin_smith: TimMc: no, clearly nobody who uses clojure has tried a non-homoiconic language, and if we actually tried it we would be converted

20:16 technomancy: «It is extremely probable that we have overlooked some whole aspect of the question, if something set up by human beings like ourselves seems to be entirely meaningless and mysterious. There are reformers who get over this difficulty by assuming that all their fathers were fools; but if that be so, we can only say that folly appears to be a hereditary disease.»

20:16 TimMc: andrewshawcare: Linking to fallacy descriptions is not a conversation.

20:17 hiredman: who wants to have this conversation?

20:17 TimMc: technomancy: That's some pretty good writing there.

20:17 technomancy: hiredman: I've already linked to Chesterton; it can only go downhill from here

20:18 andrewshawcare: I did stop and think, and deferred to the community. I was met with ridicule.

20:18 hiredman: I've had the poor guy on ignore for half an hour already and from here you look like a bunch of people yelling at an empty chair

20:18 andrewshawcare: "You're a beginner" "You clearly haven't programmed in clojure"

20:18 technomancy: clojurebot: Chesterton's fence is http://epicureandealmaker.blogspot.com/2012/03/chesterton-fence.html

20:18 clojurebot: Ik begrijp

20:18 technomancy: ^ surely will come in handy in the future

20:18 TimMc: hiredman: Use the -replies feature if your client has it. (irssi does)

20:20 hiredman: *shrug*

20:20 TimMc: Something I've wanted for a bit is a plugin that just greys out ignored lines instead of hiding them.

20:21 It would be useful for temporarily shutting out conversations.

20:21 clojurebot: excusez-moi

20:21 TimMc: or clojurebot

20:21 justin_smith: I wonder if people show up on #c and argue for garbage collection and tagged types as language level features?

20:21 andrewshawcare: I appreciate the help, I had one person provide me with a library that seemed to implement exactly what I asked, and some who would rather cast dispersion on someone 's character rather than help them.

20:22 I'm new to clojure, I'm going to say things that aren't correct.

20:23 technomancy: justin_smith: dare you to join #scala and ask "type systems... hm. seems like a lot of work, doesn't it? is it really worth it?"

20:24 justin_smith: andrewshawcare: speaking for myself it is less about the strict correctness and more about my own preferences in language design - if clojure was what you described (using indentation to carry structural information) I would be on some other channel talking about a language that wasn't like that

20:27 TimMc: ...and gone.

20:31 seangrove: Scala is one-indexed?

20:31 Interesting, always thought that was a bad idea

20:32 I guess just for tuples though

20:36 soulman__: Haskell has whitespace conveying semantics

20:36 I hate that since I woked with make.

20:41 TEttinger: I feel kinda bad that he thought I was mocking him, but his idea was definitely, almost verifiably bad for clojure. Getting macros to insert at the right indentation levels would be a hassle, for one, the lack of putting any meaning in horizontal space is another

20:42 ah, and clarity doesn't remove all brackets either

20:51 joe`: exit

21:46 dnolen: more fun w/ core.async, 100000 DOM updates http://swannodette.github.io/2013/08/02/100000-dom-updates/

21:46 neat that core.async trivially allows you to express batched rendering

21:58 gfredericks: it does?

21:58 * gfredericks is not a UI guy

22:03 aidalgol: What did I do wrong here? http://paste.debian.net/22307/ It seems to be saying that an integer is not an integer.

22:05 dnolen: gfredericks: yes you send render updates to a channel which is looping on timeout

22:08 gfredericks: dnolen: I just don't see how that batches anything; something to do with buffered channels?

22:08 dnolen: gfredericks: the queue is batching updates

22:09 gfredericks: aidalgol: ##(even? nil)

22:09 lazybot: java.lang.IllegalArgumentException: Argument must be an integer:

22:09 gfredericks: oh I missed the phrase "which is looping on timeout" somehow

22:10 aidalgol: gfredericks: Oh, right. At the end of the list. :P

22:10 gfredericks: yep

22:17 TimMc: TEttinger3: I think he was already feeling mocked by the time you joined the conversation, and in any case he did not seem to be up for a productive conversation.

22:23 isaacbw: clojure doesn't have any sugar for argument type overloading, right?

22:26 soulman__: multimethods

22:27 defmulti and defmethod

22:27 that's more sugar than most other languages. ;-)

22:30 ThatOneGuy: can I define a macro that uses ->?

22:30 gfredericks: ThatOneGuy: yes

22:30 ThatOneGuy: so (defmacro awesome [lawl] (-> lawl something something))

22:30 gfredericks: -> itself is a macro that uses ->

22:30 isaacbw: soulman__: oh man, awesome

22:31 gfredericks: ThatOneGuy: that code is technically allowable yes

22:31 john2x: wat

22:31 ThatOneGuy: well I'm trying to compact some zipper traversal code

22:32 in my zipper, z/down, z/down z/right, z/down z/right z/right, all stand for something so I would like to make macros that expand to them so I can just (-> zip short-macro-1 shorter-macro-2) and it will expand out correctly

22:32 * TimMc throws a ` at ThatOneGuy

22:32 dnolen: 100,000 go blocks in ClojureScript (edge of what's possible :) http://swannodette.github.io/2013/08/02/100000-processes/

22:34 jtoy: are there any libraries for if i want to operate on clojure objects but all form disk so i dont have to store them in memory?

22:34 and do calculations on the collections

22:45 ThatOneGuy: sorry I closed my laptop. why do I need a backtick for (defmacro shorter-macro1 [forms] (-> forms z/down z/right)) ?

22:47 mattmoss: ,(+ 1 2)

22:47 clojurebot: 3

22:47 mattmoss: ,`(+ 1 2)

22:47 clojurebot: (clojure.core/+ 1 2)

22:48 ThatOneGuy: but if im using -> wouldn't it just expand anyways?

22:48 ,'(-> forms z/down z/right)

22:48 clojurebot: (-> forms z/down z/right)

22:49 mattmoss: ,(-> forms z/down z/right)

22:49 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: z, compiling:(NO_SOURCE_PATH:0:0)>

22:49 mattmoss: Or were you asking tick vs. backtick rather than nothing vs. backtick?

22:49 ThatOneGuy: ,(require 'clojure.zip :as z)

22:49 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: z in this context, compiling:(NO_SOURCE_PATH:0:0)>

22:49 ThatOneGuy: ,(require '[clojure.zip :as z])

22:49 clojurebot: nil

22:50 ThatOneGuy: ,(defmacro shorter-macro1 [forms] (-> forms z/down z/right))

22:50 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

22:50 mattmoss: Can't do that w/clojurebot.

22:51 amalloy: ThatOneGuy: without the `, the -> gets expanded at compile-time, leading to the macroexpander attempting to do down+right while expanding the macro, rather than working on the zipper in your expanded code

22:53 mattmoss: ThatOneGuy: you also don't need macros here.

22:53 (def short-op (comp z/down z/right z/right))

22:54 ThatOneGuy: ok, so when: (-> zip z/down z/right shorter-macro1) =expands to=> (-> (z/right (z/down zip)) z/down z/right)

22:55 but comp is a function, and really all I'm doing is renaming a series of functions, so I think a macro would be better, no?

22:55 mattmoss: Generally, no.

22:55 amalloy: ThatOneGuy: there's really no excuse for that function to be a macro

22:56 ThatOneGuy: aren't macros expanded at compile/read time?

22:57 mgaare: yes

22:58 ThatOneGuy: and this is a simple rename of z/down (comp) z/right -> better-name; I'd rather not have the overhead of a function just for this. I am going to be traversing this zipper'd datastructure a lot in the following code so I'd like to reduce any overhead

22:58 mattmoss: ThatOneGuy: Ask yourself.... why is that important? why do you need it expanded?

22:58 Overhead of a comp isn't an issue when most everything you're doing isn't macros.

22:59 mgaare: ThatOneGuy: speaking of overhead, if it's a function the jvm will be able to more easily jit

22:59 ThatOneGuy: and it can't jit a ->?

23:00 mgaare: it'll have to do that in every place you use the macro, rather than just the one function

23:00 amalloy: ThatOneGuy: you are lightyears away from the conclusion that you need to inline this function for performance

23:01 ThatOneGuy: Ok, I'll go with the prettier version :P But just out of curiousity, (-> zip z/down z/right (-> z/down z/right z/right)) expands to a single set of nested forms?

23:01 amalloy: try it and see

23:02 ThatOneGuy: :) have to get used to the repl again. its been a while since I've written clojure. I write C# at my day job

23:02 mattmoss: ,macroexpand

23:02 clojurebot: #<core$macroexpand clojure.core$macroexpand@159715d>

23:03 mattmoss: ,(macroexpand '(-> zip z/down z/right (-> z/down z/right z/right)))

23:03 clojurebot: (z/right (clojure.core/-> (clojure.core/-> (clojure.core/-> (clojure.core/-> zip z/down) z/right) z/down) z/right))

23:03 ThatOneGuy: user> (macroexpand (-> [] z/down z/right (-> z/down z/right)))

23:03 IndexOutOfBoundsException clojure.lang.PersistentVector.arrayFor (PersistentVector.java:107)

23:04 mattmoss: ,(macroexpand '(-> [] z/down z/right (-> z/down z/right)))

23:04 clojurebot: (z/right (clojure.core/-> (clojure.core/-> (clojure.core/-> [] z/down) z/right) z/down))

23:04 mattmoss: I think there's a macroexpand-all, but I forgot which namespace it's in.

23:05 ,(clojure.walk/macroexpand '(-> [] z/down z/right (-> z/down z/right)))

23:05 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>

23:05 mattmoss: ,(clojure.walk/macroexpand-all '(-> [] z/down z/right (-> z/down z/right)))

23:05 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>

23:05 ThatOneGuy: ,(doc macroexpand)

23: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."

23:06 amalloy: &(do (require 'clojure.walk) (clojure.walk/macroexpand-all '(-> [] z/down z/right (-> z/down z/right))))

23:06 lazybot: ⇒ (z/right (z/down (z/right (z/down []))))

23:06 mattmoss: thanks, amalloy

23:07 ThatOneGuy: thanks.

23:07 so final version: (defn DSL-name [loc] (-> loc z/down z/right))

23:08 mattmoss: Another way: (def DSL-name (comp z/down z/right))

23:09 oops, ... (comp z/right z/down)

23:09 Bad brain. Bad!

23:10 ThatOneGuy: might as well restrict the args so it fits with the zipper DSL

23:11 mattmoss: The (comp ...) version will be the same, since z/down (first part of comp) only takes the one arg.

23:11 jimrthy: I want to busy-loop poll a socket until it closes (state reset...so I have to be single-threaded by now); is there anything more idiomatic than loop/recur?

23:11 mattmoss: It'll work out the same, but your final version does name it explicitly, which is comforting for some.

23:13 Also: "when to use macros": http://clojurefun.wordpress.com/2013/01/09/when-do-you-need-macros-in-clojure/

23:13 ThatOneGuy: ,(doc comp)

23:13 clojurebot: "([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."

23:14 ThatOneGuy: yeah var-args

23:17 mattmoss: Sure, the comp is, but z/down is not, so (DSL-name arg1 arg2) will fail whether you are explicit or point-free.

23:17 aidalgol: Why does (cons 'foo 'bar) throw a hissy fit?

23:18 In elisp and scheme, I get (foo . bar)

23:18 mattmoss: ,(cons 'foo 'bar)

23:18 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>

23:18 mattmoss: Because the 2nd arg is not a sequence as cons expects.

23:18 ,(doc cons)

23:18 clojurebot: "([x seq]); Returns a new seq where x is the first element and seq is the rest."

23:18 aidalgol: Right, so to be more direct, why is cons different in clojure?

23:20 mattmoss: Sorry, can't help you there. Someone more versed in the design will have to attend.

23:21 amalloy: aidalgol: clojure doesn't have cons cells, it has sequences. so consing onto something that is not sequential is an error

23:21 jimrthy: I'm not an expert, but I think the goal was to distance themselves from the ancient lisp roots.

23:21 aidalgol: ah

23:21 mattmoss: ,(conj nil 'foo 'bar)

23:21 clojurebot: (bar foo)

23:21 mattmoss: hmm

23:21 aidalgol: ,doc conj

23:21 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0:0)>

23:21 mattmoss: ,(doc conj)

23:21 clojurebot: "([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."

23:22 aidalgol: oops...

23:22 mgaare: ,(cons 'foo '(bar))

23:22 clojurebot: (foo bar)

23:37 futile: i notice my clojure code is much closer to actual intent than my code in any other language

23:38 i.. i cant explain it

23:41 mischov: don't try. it's... futile

23:42 futile: :)

23:42 btw it occurred to me recently that #clojure is an awesome channel full of very smart, mature, helpful people

23:42 thank you all.

23:43 its a pleasant community to be in

23:44 mischov: And there I had to go and make a joke right before you said it. There goes the maturity! I second the full of very smart, helpful people, though.

23:44 People have been great about fielding my sometimes really dumb questions.

23:44 jimrthy: It's an unpleasant statement about my character that my first inclination was to /fart in futile's general direction

23:45 futile: even so, very mature channel

23:45 jimrthy: (not that I'm much more than a lurker, at best)

23:45 futile: its easier to see when you step outside the community for a moment.

23:49 im also way excited to be able to control my OS X windows via clojure

23:50 jimrthy: @futile: You're absolutely correct. The people on here are generally quite amazing.

23:50 And, yeah. That's *way* cool!

23:50 futile: :)

Logging service provided by n01se.net