#clojure log - Nov 26 2014

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

1:48 zRecursive: (doc ->)

1:48 clojurebot: "([x & forms]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

4:12 scizo: Is there anyone here that might have some pointers on why the readers from data_readers.clj are not being used?

4:12 They are being loaded into *data-readers*.

4:13 But I am still getting the error clojure.lang.ExceptionInfo: No reader function for tag

4:47 dan_b: sorry if this has been asked a zillion times - does anyone know what happened to the aleph wiki? apparently there used to be such a thing at https://github.com/ztellman/aleph/wiki/

4:48 or failing that, anyone point me at some code for doing http streaming with aleph?

5:53 sqd: my core.async code involving lots of subscriptions and go loops seems to continue running even if i stop the original data source channel. is there a simple pattern for looping over a channel that stops nicely when the channel is closed?

5:54 i currently have a lot of (go (while (do-something (<! ch)))) loops

5:57 i guess i could do something with the nil value returned by <! on closed channels

5:58 ordnungswidrig: sdq: yes, that's the common pattern, sth. like (go (loop (if-let [x (<! ch)] (do something) (recur)))

6:09 sqd: ordnungswidrig: thanks

6:22 justin_smith: sqd: yeah, you should be basing your recursion on what comes from the channel, because closed channels return nil and you can end up in an infinite loop if "do-something" doesn't return nil from a nil input with the while version

6:25 daniel_: can anyone explain why #'app is always used to get the server to pickup changes to the app definition?

6:26 i unserstand that #'app is the var and app is a symbol pointing to the var

6:26 justin_smith: daniel_: when a var is passed to the server process, then resolution of that var is done at each invocation of the var

6:26 daniel_: if you pass the function, that function cannot ever change

6:26 the same function is used every time

6:27 daniel_: and a symbol is a function which calls itself and looks up the var

6:27 justin_smith: daniel_: at the time that the server is invoked

6:28 not inside the functions making up the server

6:28 so it's a one time lookup

6:28 daniel_: i see, and then the result is 'cached'?

6:28 justin_smith: the args are fully resolved before the function is even called

6:28 one sec, it's a bit noisy to do with the bots, I will make a refheap

6:33 https://www.refheap.com/94025 daniel_: demonstrated here

6:34 an http server is like bar in that example, it takes a callable thing and calls it later

6:34 notice that when passed a var, what bar does changes when the var changes

6:34 but when passed a function, it does not change

6:36 mavbozo: (inc justin_smith)

6:36 lazybot: ⇒ 148

6:39 justin_smith: this is useful at dev time, but there is an overhead for the repeated var lookup. In fact there is a performance trick to bind frequently accessed functions as function args or let bindings over a loop to reduce var lookups and boost speed.

6:39 usually this won't be your bottleneck though, but it's useful to know for when it might be

6:44 daniel_: overhead was going to be my next question

6:44 * justin_smith is clearly psychic.

6:45 daniel_: ok makes sense

6:46 symbols are immutable, vars aren't

6:46 justin_smith: functions are immutable

6:47 symbols are resolved to functions before other functions see them

6:47 (or other (usually non-var) values)

6:50 daniel_: somehow i thought that a symbol pointed to a var which pointed to a function

6:50 and that if you changed the function that a var pointed to, the symbol pointed to that same var so would also change

6:50 thearthur: just to put it anohter way, when you create an instance of the server, that specific instance has a pointer to the function to call on reach request. If you make another instnce of the server it could use a different function.

6:51 daniel_: but you can't change a function, you create a new one

6:51 thearthur: if you pass it a var *as* it's function then it will still call the same "function" (the var) every time, and the var will forward this to the current function

6:52 daniel_: so the symbol has already resolved to the first function, it only resolves the var once

6:53 thearthur: yes, if you pass a symbol that resolves to a function, by way of a var, then the var is only resolved once

6:56 daniel_: maketh perfect sense

7:25 katox: oops, a deep trap to fall in http://cemerick.com/2010/08/19/case-insensitive-filesystems-vs-aot-compiled-clojure/

7:25 aka: I'm a long time vim user and am looking to use emacs as my clojure IDE... any suggested reading or links?

7:26 katox: in which one can get by using this lib https://github.com/qerub/camel-snake-kebab in lein deps

7:26 pandeiro: aka: C-h i

7:26 weavejes_: aka: Are you planning on using evil mode?

7:27 aka: I just decided to give emacs a go. Not sure if I should or not.

7:27 It would probably get me going faster but I wonder if it would be better in the long run to just go full throttle emacs

7:27 justin_smith: aka: cider is notoriously problematic to update, if you ever decide to change versions after installing, clojure-mode and all related compiled elisp (elc) files should be deleted or else things will break in really weird ways

7:27 pandeiro: justin_smith: don't scare the guy!

7:28 justin_smith: aka: I switched to evil mode, because the chord keys were killing my fingers

7:28 pandeiro: one should be afraid of cider. It's easy to break.

7:28 weavejester: justin_smith: I haven't had *that* many problems with cider. The main issue is that cider defaults to the snapshot version.

7:28 justin_smith: pandeiro: not hyperbole or dissing. I use it. It's just not easy to change versions.

7:28 weavejester: I have had all sorts of problems with cider.

7:28 aka: I do love my vim navigation

7:29 justin_smith: weavejester: and not from snapshots.

7:29 weavejester: Now that 0.8 is released, I've been considering using melpa-stable instead

7:29 aka: is there an alternative to cider that I should consider?

7:29 ahh the joys of jumping into something new

7:29 justin_smith: weavejester: I had to back off from 0.7.0 to 0.6.0 to get things working.

7:29 weavejester: aka: Not really. I think it's still the best tool for the job.

7:29 aka: okay cool

7:29 pandeiro: aka: cider's growing pains are mostly behind it i think; i'd jump in

7:29 weavejester: justin_smith: Have you tried 0.8.0?

7:30 aka: okay cool

7:30 justin_smith: not since it hit stable.

7:30 * aka looks for the absolute idiot newbs guide to emacs and cider

7:30 weavejester: aka: evil-mode is a pretty good Vi emulation layer.

7:30 pandeiro: aka: and seriously, C-h i -- the most amazing thing about emacs is the self-documenting part imo

7:30 justin_smith: weavejester: I briefly tried it in the development state, things were broken, I switched to an earlier version

7:30 aka: pandeiro: thank you :)

7:31 weavejester: does evil-mode interfere with any of emacs key bindings?

7:31 weavejester: aka: Not that I've noticed.

7:32 aka: okay cool

7:32 justin_smith: aka: only some, and you can go into emacs mode for those. (ie. Ctrl-e in insert mode)

7:32 aka: good to know

7:32 justin_smith: and of course you can hit Esc $ instead of Ctrl-e

7:33 weavejester: aka: My emacs.d directory is here if you happen to want to use it for ideas, or as a starting point: https://github.com/weavejester/dotfiles/tree/master/emacs.d

7:33 aka: If I'm not careful I will enter paralysis by analysis mode. I better just jump in.

7:33 ahh perfect thank you

7:33 weavejester: aka: Which OS are you using?

7:34 aka: for the most part Ubuntu

7:34 some OS X

7:34 but most my dev is in the terminal of an ubuntu server

7:35 weavejester: aka: I use the emacs GUI, so I haven't tried it at the terminal

7:35 aka: I might go the emacs gui route first

7:35 dev locally on my mbp

7:36 justin_smith: aka: you can edit remote files via the emacs GUI version with tramp. It works nicely.

7:36 * aka googles

7:36 justin_smith: aka: under the hood it connects via ssh, and makes the changes remotely when you save. IIRC it does this using ed.

7:36 weavejester: aka: Though having just tried it, the terminal version of my emacs setup works pretty well. The only think I'd disable is the menu-bar.

7:36 aka: weavejester: noted

7:37 weavejester: Since I use OSX, there's no reason not to have the menu bar on for the GUI mode, since it's ubiquitous anyway.

7:37 Oh, and I use cask

7:38 So you need to run "brew install cask" or whatever it is under Ubuntu, and then "cd ~/.emacs.d && cask install"

7:38 pandeiro: weavejester: aka: i use cask too but wouldnt recommend it at this point

7:38 it's just one more moving part

7:38 weavejester: pandeiro: Wouldn't it be hard to know what packages you've installed without it?

7:38 pandeiro: once you're fluent in emacs and managing your packages more carefully, there's more to gain by having something like that

7:39 weavejester: True...

7:39 pandeiro: weavejester: not when they're right there in init.el

7:39 aka: so ignore cask for now?

7:39 justin_smith: aka C-x C-f ssh://user@host:/path/to/file

7:39 weavejester: Maybe I should make a simplified version of my config.

7:39 pandeiro: weavejester: aka: for instance - https://github.com/pandeiro/dotemacs/blob/master/init.el#L6

7:39 weavejester: aka: I just mention it because I use cask in my config.

7:39 aka: any suggested way of installing emacs on OSX? just brwe install ?

7:40 pandeiro: the important part there is the package.el boilerplate for including the third-party repos and the simple way of iterating over packages and installing

7:40 weavejester: brew install emacs will work. There's also a mac-emacs version I prefer

7:40 brew tap railwaycat/emacsmacport && brew install emacs-mac

7:40 aka: k thx

7:41 pandeiro: aka: btw that emacs config is ancient and the packages are not what i use, just pointing to the boilerplate part and the iteration mechanism in elisp

7:41 mavbozo: is aquamacs good for clojure? cos i saw rich hickey use it in last clojure conj

7:41 aka: thanks for all the info and help guys

7:41 I'll soon be flaming vim users!

7:42 jk I still love me some vim

7:42 weavejester: Emacs is my OS, Vi is still my editor ;)

7:43 justin_smith: aka: after a little while using vi, followed by a long time with emacs (and a bit of the signs of rsi coming on) I like the emacs features, and the vi keybindings

7:43 so evil seems like it will be good...

7:44 weavejester: Does anyone happen to use paxedit, out of interest?

7:44 justin_smith: no, this is the first I have heard of it

7:44 weavejester: It's a more context-aware paredit

7:44 Apparently :)

7:45 aka: I love vim's text object motions... glad I will still get them in emacs

7:45 that will make the transition much faster

7:46 do you guys use paredit?

7:46 or similar?

7:46 mavbozo: smartparens

7:46 pandeiro: weavejester: i still use paredit and probably only 25% of its functions but just C-k alone is gold

7:46 justin_smith: yes, paredit and evil don't interact as nicely as I would like, but paredit does some cool stuff if you stay in regular emacs, or insert mode

7:47 weavejester: justin_smith: I've gotten quite far with evil-paredit and some of my own movement functions.

7:47 kungi: Does anyone use ediff for git merging?

7:47 justin_smith: oh, I had not heard of evil-paredit

7:47 weavejester: justin_smith: It's not as useful as it sounds :)

7:48 kungi: weavejester: evil-paredit is great :-)

7:48 weavejester: justin_smith: It just ensures that vim commands don't break paredit.

7:48 justin_smith: makes sense

7:49 weavejester: I'm still working on my evil/paredit setup, but I do have: https://github.com/weavejester/dotfiles/blob/master/emacs.d/init.el#L113

7:49 I might try out paxedit on the weekend.

7:51 * aka taps finger while he waits for emacs to compile/install

7:51 aka: you guys likely saved me a shit load of time

7:53 kungi: weavejester: Thanks for the config example

8:20 clgv: (inc #clojure)

8:20 lazybot: ⇒ 8

8:41 rurumate: ,n

8:41 [2:33:12 PM] Samuel Geiger: origin:release/1.1.0

8:41 [2:33:33 PM] Samuel Geiger: bitte da nur noch sachen rein mergen wenn die Tickets dazu fix Version 1.1.0 haben

8:41 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: n in this context, compiling:(NO_SOURCE_PATH:0:0)>

8:41 rurumate: oops

8:42 clgv: rurumate: you are german as well?

8:42 rurumate: thank you gnu/linux for completely sucking at copy paste

8:42 clgv: of course not, why do you ask

8:42 clgv: :P

8:42 rurumate: so here's a question,

8:42 ,(an-jvm/analyze '(fn [n] (when (pos? n) (recur (dec n)))))

8:42 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: an-jvm, compiling:(NO_SOURCE_PATH:0:0)>

8:42 rurumate: one moment

8:44 ,(clojure.tools.analyzer.jvm/analyze '(fn [n] (when (pos? n) (recur (dec n)))))

8:44 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.tools.analyzer.jvm>

8:44 rurumate: ok so that doesn't even work

8:44 justin_smith: neither of the bots have that lib

8:44 rurumate: can we add clojore.tools.analyzer.jvm to clojurebot, please?

8:45 anyway that wasn't the question

8:45 I'll make a paste of the output

8:47 dang, how do I pprint to a file?

8:47 I know I can bind *out*, any faster way?

8:48 mavbozo: (spit f (with-out-str (pprint ))

8:50 rurumate: mavbozo: brilliant, thank

8:51 so this is the output of (clojure.tools.analyzer.jvm/analyze '(fn [n] (when (pos? n) (recur (dec n))))): https://www.refheap.com/94028

8:52 why are there more than one blocks with the same loop-id?

8:53 justin_smith: it looks like all of the blocks have the same loop id?

8:53 Bronsa: rurumate: only the method node has :loop-id, the other instances of :loop-id are in the :env of the method body nodes, to propagate it until

8:54 until it reaches a recur or another loop/fn

8:54 rurumate: oh, of course

8:54 I forgot about the env

8:54 these trees are huge, how do you navigate / search them?

8:55 for instance how do I find all :loop-id nodes, along with their paths (get-in style)

8:55 Bronsa: rurumate: I usually just use -> and explore the nodes via `keys`

8:55 rurumate: if I had that I'd quicky see that all but one have :env in their path

8:56 Bronsa: you can't really do exhaustive search that way, unless you already know where you want to look

8:56 it's just too much work

8:56 arav93: Is anyone familiar with core.typeD?

8:57 Bronsa: rurumate: well you have the AST quickref that you can use to see what info is in what nodes + what children a node has

8:57 rurumate: if you want to query the AST there's also a datomic datalog interface

8:58 rurumate: Bronsa: I was hoping for some tricks with nested maps in general

8:58 oh datalog

8:58 datomic, is that open source?

8:58 Bronsa: no

8:58 rurumate: there must be something. it's just some trees, and we have lisp

9:11 Bronsa: here it is with all the :env removed https://www.refheap.com/94029

9:12 sqd: is there a function similar to core.async/reduce that yields everytime the source channel yields? e.g. to create a counter

9:13 rurumate: Bronsa: the's a node with :loop-id loop_14182 appears only once, but nothing refers to it

9:13 shouldn't something point to that?

9:14 martinklepsch: I'm trying to get a clostache template working that contains a fair chunk of JSON that's generated via chesire. now one field in that json contains a <script> tag and I can't figure out how to properly escape double quotes - or maybe it's something completely differnt

9:15 Bronsa: rurumate: .. the env points to that ...

9:15 avrakotos: Hi all. Clojure noob here. Downloaded Counterclockwise and trying to simply create a clojure project. But I get an Exception when creating it. "unable to find valid certification path to requested target - Reason: Exception while creating new project. "

9:15 rurumate: heh

9:16 Bronsa: rurumate: were you expecting a :loop-id field on the :recur node?

9:16 clgv: avrakotos: what did you download?

9:16 rurumate: Bronsa: yes

9:16 martinklepsch: does anyone have experience with chesire/clostache and encoutered similar problems?

9:16 Bronsa: rurumate: I mean, I can add that but it's not going to add any info that's not already there

9:16 rurumate: Bronsa: so it's in the :env of the :recur node?

9:16 Bronsa: rurumate: yes

9:16 avrakotos: clgv: I first tried using the counterclockwise plugin for eclipse. Got the same error there. Then I downloaded the counterclockwise standalone exe and also got that error

9:17 rurumate: ok cool thanks Bronsa

9:17 clgv: avrakotos: which os? I tried the latest standalone on linux 64 bit last week

9:17 avrakotos: clgv: win 7 64 bit

9:18 clgv: avrakotos: can you post a complete stacktrace on refheap.com?

9:18 avrakotos: clgv: does the counterclockwise or leiningen need to connect to some online server?

9:19 ordnungswidrig: avrakotos: leiningen will self-install on the first invocation

9:19 clgv: avrakotos: oh right it might be the leiningen integration that wants to download the default clojure dependency

9:19 avrakotos: clgv: I am currently at work?

9:19 clgv: whops

9:20 clgv: i am at work, and we have a proxy, so that is probably it then

9:20 clgv: avrakotos: check the docs, I believe there are proxy settings. maybe the same you'd use for eclipse in general

9:21 avrakotos: clgv: Its probably the proxy then. Thanks for the help =)

9:23 ordnungswidrig: avrakotos: looks like an ssl issue to me.

9:30 atankanow: this may be a bigger modeling question but ... let's say i have a set of steps nicely set up with the thread last operation, e.g. (->> data (step-1 arg1) (step-2 arg1) (step-3)); now i realize steps 1 and 2 need to be run for a set of configurations, e.g. (for [k (configs)] (step-1 arg1 k)) ... ; is there an idiomatic way to handle this? I've considered (1) wrapping for loop around step-1 and step-2 and then flattening the r

9:30 (2) passing step-1 and step-2 to a reducing function

9:35 weavejester: atankanow: Are your functions side effectful?

9:36 atankanow: hmmm ....

9:37 they do rely on IO (state of the filesystem)

9:37 weavejester: You're relying on the return value, though?

9:38 If so it sounds like you want a reduce

9:39 atankanow: yes ... i want the return values, so i can use reduce to get a single list as output

9:40 so "for" is idiomatically for side-effecting fns

9:41 Frozenlock: I think it's 'doseq' if you just want the side effects.

9:45 atankanow: completely unrelated discussion, what is your IRC client of choice?

9:46 clrnd: irssi

9:46 mavbozo: emacs's erc

9:46 schmir: emacs rcirc

9:46 avrakotos: ordnungswidrig: It was indeed an SSL issue. We have a server that terminates all HTTPS traffic into the company. I had to use a proxy. Works now :) Thanks for the help

9:53 Frozenlock: atankanow: emacs's erc

9:57 weavejester: I've been trying out Textual 5

10:01 atankanow: clojure was the only thing that could make me switch from vim -> emacs, but now that i'm in this universe I'm not sure how to get out ... i'm trying emacs circe now

10:08 rurumate: Bronsa: :fn-method and :recur both have :loop-id

10:08 see https://www.refheap.com/94036

10:09 neither of these are part of an :env

10:10 Bronsa: rurumate: right so you dissoc'ed it wrongly before :P I don't recall all the node fields by heart myself

10:11 rurumate: but why you want to leave atankanow? emacs is love, emacs is life

10:12 Bronsa: I'm confuse. There are now 2 nodes with the same node id. Just how does tools.emitter figure out where the jump is supposed to go?

10:12 *with the same loop id

10:13 Bronsa: rurumate: the only loop targets are :fn-method, :method and :loop

10:13 rurumate: the loop-id in those is a label, the loop-id in :recur signals the loop target

10:14 rurumate: no loop target will have the same loop-id ever. multiple recurs inside the same loop target will have the same loop-id however

10:18 rurumate: Bronsa: thanks for these important info

10:18 is there a wiki or something about these rules?

10:21 Bronsa: rurumate: it's documented in the quickspec for t.a.jvm

10:22 rurumate: I see. Thanks for taking the time to answer Bronsa

10:23 Bronsa: so there is no need to go search for loop-id inside the :env, right?

10:24 Bronsa: right. it's just internal info that the analyzer uses for some passes

10:24 rurumate: cool. I feel I'm making some progress. This sure is fun

10:25 clgv: rurumate: what are you trying to do?

10:25 Bronsa: rurumate: sorry if I said otherwise before -- I was hacking t.a and didn't check before replying

10:25 rurumate: nothing particular, just interested in tools.analyzer

10:27 clgv: learning exercises

10:28 what is usually used to escape arbitrary text before displaying it in an html? some function from hiccup?

10:28 ah there is hiccup.util/escape

10:29 rurumate: clgv: if you're on emacs, try string-edit

10:30 not sure if that suits your use case though

10:30 clgv: rurumate: it's data loaded on runtime

10:34 mikerod: is there anything wrong with using `reduce-kv` to build data structures other than maps?

10:34 e.g. reduce-kv (fn [c k v] (conj c [k (inc v)])) [] {:a 10 :b 20}) ;= [[:b 21] [:a 11]]

10:35 I believe it is an optimized way to reduce over a map

10:35 However, does it need to *produce* a map for any particular reason?

10:35 I typically only see examples of the form: (reduce-kv (fn [m k v] (assoc m k (inc v))) {} {:a 10 :b 20})

10:36 Which ;= {:a 11, :b 21}

10:36 I'm guessing the answer to my question is "no, it doesn't matter"

10:36 clgv: mikerod: you can build anything you like with it

10:36 mikerod: you are right, it saves overhead when reducing over a map

10:37 mikerod: clgv: thanks, I was just clarifying on that due to lack of examples suggesting otherwise. It'd make sense that you may want to reduce over a map into some non-coll at all sometimes even, so that makes sense.

10:37 clgv: mikerod: building vectors or calculating aggregated values should be pretty common as well

10:39 mikerod: in the above example you can get more speed with a transient result map

10:40 mikerod: clgv: ah yes, (persistent! (reduce-kv (fn [m k v] (assoc! m k (inc v))) (transient {}) {:a 10 :b 20}))

10:41 clgv: mikerod: exactly

10:41 mikerod: btw. if you need that pattern more often, the helper function `update-vals` wants to be written ;)

10:47 Glenjamin: i tend to call it fmap, based on the function from algo generic

10:47 gfredericks: plumbing.core/map-vals

10:47 Glenjamin: https://github.com/clojure/algo.generic/blob/master/src/main/clojure/clojure/algo/generic/functor.clj#L33

10:51 mikerod: clgv: hah that is true. I guess I have often done something liek this: (zipmap (keys m) (map my-fn (vals m)))

10:52 but for some reason `zipmap` does not use transients I suppose

10:52 SparkySparkyBoom: https://www.refheap.com/0a02d2f005f8c1fce9d3fc45e

10:52 how would i make it so that i can pass a list as arguments of a function

10:54 ah i figured it out

10:54 the apply function works

10:55 Bronsa: mikerod: there's a ticket in JIRA for making zipmap use transients

10:56 http://dev.clojure.org/jira/browse/CLJ-1005

10:56 mikerod: vote if you're interested

10:57 mikerod: Bronsa: thanks, yes I'd like this

11:00 fairuz: hey guys, using liberator, how to set the Access-Control-Allow-Origin in the response header? I'm now getting the cors problem

11:00 CookedGryphon: Has anyone else come across the problem that midje's test runner is giving an exit code of 0 when errors are thrown in core.test tests?

11:00 I just deployed a buggy release thanks to this :(

11:01 clgv: mikerod: but in your case a zipmap with transients would be less efficent than the transient reduce-kv anyway

11:01 mikerod: clgv: I figured that'd be the case

11:02 clgv: woah, you cant get a java 6 jdk without an oracle account?

11:02 mikerod: due to the kv-reduce protocol impl on maps

11:02 clgv: I just wanted to check if my java 6 compatibility claim is actually true

11:03 humm for java 8 you need no account...

11:05 ghadishayban: Bronsa: zipmap with iterators & transients now... but needs 1.7

11:06 Bronsa: nice

11:07 ghadishayban: how much of a speedup do iterators have over seqs?

11:07 ghadishayban: that will depend on iterators being more pervasive, which was bumped to 1.8 i think

11:08 a few iterators right now are built upon the seqs, rather than the other way around

11:12 less alloc is good

11:12 the whole reason I made a transducible context for Iterables (while totally gross) is so that zipmap can consume it

11:13 something like (zipmap cols (iterable some-transducer values)) could realize no seqs

11:16 the whole Seq/Iterator/Reduce trinity is increasingly hard to implement

11:17 referring to the CLJ-1603 ticket for IReduceInit-able cycle & iterate. the lazy seq version is so elegant:

11:17 ,(source cycle)

11:17 clojurebot: Source not found\n

11:17 ghadishayban: (lazy-seq

11:17 (when-let [s (seq coll)]

11:17 (concat s (cycle s)))

11:18 A shorter transducer version: (sequence cat (repeat coll))

11:18 Glenjamin: watch out, cat isn't lazy - which may or may not be a problem

11:19 ghadishayban: that's probably tolerable in the cycle case, but you're right it's not 100% equiv

11:20 But a version that is IReduceInit & preserves compatibility with core/cycle is going to have to be a giant implementation

11:20 And with a giant implementation you lose the favorite property of "obviously correct"

11:21 ,(conj (supers clojure.lang.LazySeq) clojure.lang.IReduceInit)

11:21 clojurebot: #{clojure.lang.ISeq clojure.lang.IReduceInit clojure.lang.IPersistentCollection java.io.Serializable java.util.List ...}

11:29 sqd: is there a straightforward way to request all yields from a core.async channel during the last n milliseconds?

11:44 thearthur: sqd: I don't think that exists

11:46 razum2um: what is more efficient if I don't care about type https://www.refheap.com/b85d84209383136ce1506c895

11:47 stuartsierra: razum2um: probably subvec but I wouldn't expect there to be all that much difference

11:49 razum2um: stuartsierra: btw, is count on vector O(1)? (-> [1 2 3 4] (subvec 1 (dec (count [1 2 3 4])))) would be faster?

11:49 Glenjamin: ,(counted? [])

11:49 clojurebot: true

11:49 Glenjamin: i think that means yes

11:50 (doc counted?)

11:50 clojurebot: "([coll]); Returns true if coll implements count in constant time"

11:50 stuartsierra: razum2um: Yes, count on vector is constant-time.

11:50 razum2um: stuartsierra: Glenjamin: thx!

11:51 stuartsierra: As always: profile first, find the hotspots, then try to optimize.

11:55 razum2um: stuartsierra: btw, what do you think about profiling lazyseqed-code with timbre https://github.com/ptaoussanis/timbre/issues/87 ?

11:56 technomancy: ~paredit guide is making it easier to grok with purty pictures http://danmidwood.com/content/2014/11/21/animated-paredit.html

11:56 clojurebot: Ack. Ack.

12:08 mikos: hello

12:08 anyone got any recommendations on where to start learning about Clojure + sockets?

12:08 i am trying to write an rtsp client

12:12 clgv: is there a way to set a backlink to the main project (from a nested folder) in a REAME.md in agithub repository

12:12 ?

12:12 since the relative path ends up in "blob/master" and returns a 404

12:13 arrdem: clgv: I think you can say "/README.md" and github will figure it out.

12:13 andyf_: clgv: absolute path?

12:13 clgv: arrdem: I want to link to the project root, not only the readme

12:14 andyf_: that's problematic for forking right?

12:16 andyf_: clgv: perhaps. I don?t know if there is a way to do it that meets all of your desires, just ?a way"

12:16 clgv: andyf_: hm ok. guessed so

12:17 andyf_: clgv: have you read this? https://github.com/blog/1395-relative-links-in-markup-files

12:17 clgv: they seem to have forgotten that special case

12:17 yeah

12:18 hmm well I'll link to the README then

12:19 jro_: I've [incanter "1.5.5"] in ~/.lein/profiles.clj. After starting the repl and user=> (use 'incanter.core) I will get an exception: CompilerException java.lang.NoClassDefFoundError: x (wrong name: X),

12:21 any pointers where to start to resolve the problem?

12:22 arohner: mikos: clojure sockets are just java sockets

12:23 mikos: there might be sockets lib for clojure, but I haven't used any

12:24 fatwu: Hello!

12:27 aravindh: what is the defafcto webframework used in clojure that has good community support? I am looking to build an order processing system for an ecommerce client. also what is the database access library used? yesql seems simple to me. any suggestions?

12:40 dbasch: jro_: can you post your profiles.clj on refheap? How are you running the repl?

12:43 jro_: https://www.refheap.com/94042 I can run incanter by setting up a project, and running the repl from its root

12:44 I'm using lein repl and leiningen 2.4.1 on java8

12:55 technomancy: why not upgrade lein? =)

12:57 andyf_: jro_: Incanter is not a Leiningen plugin, so if you put it in your ~/.lein/profiles.clj by going to the :user key of the top level map, then the :plugins key, then adding it to that vector, that will not work.

12:58 jro_: It should work if you add it to a :dependencies vector in a profile that is active when you start 'lein repl'

13:01 jro_: andyf_: it is in the :dependencies -vector, and other deps works fine.

13:02 AlwaysBCoding: anyone know if you can have multi-arity protocol functions? i.e. SomeProtocol (someFunction [this options]) but I want to be able to call someFunction without a second arg and have the options default to {}

13:02 jro_: (use 'incarter.core) seems to launch separate JVM, maybe this causes some problems. However, I'm bit happier now, when it works in a separate project.

13:22 Raynes: Ya know

13:22 Coffeescript isn't the worst thing ever.

13:22 I tried to h8 but it reminds me enough of Python that I'm comfortable.

13:24 arrdem: Raynes: this is clojure ontopic :P

13:24 Raynes: I'm aware.

13:25 arrdem: k

13:25 Raynes: I figure we're allowed to discuss other languages.

13:25 Especially when one of them is regarding a Clojure compilation target ;)

13:26 arrdem: fair enough

13:27 justin_smith: $mail aravindh the Clojure community tends to prefer a selection of libs over frameworks. That said, friend is highly recommended for authentication if you can figure out how to use it, and you can use crossclj.info to get some sense of what libs are widely used. IMHO something as simple as yesql, while recent is likely to be less hassle than a widely used DSL like korma.

13:27 lazybot: Message saved.

13:28 dnolen_: AlwaysBCoding: such things can be done around the protocol w/ a regular function

13:29 atankanow: if you're just talking about multi-arity, you can overload protocol functions, calling a fn of greater arity with default values

13:58 edw: ping

13:59 arrdem: pong

14:00 mikos: thanks, arohner, i'll read into java sockets

14:13 gfredericks: woah

14:13 I just used ;; to comment out a line of #_#_#_

14:14 shem: you rascal!

14:18 l1x: justin_smith: thanks for the help yesterday

14:18 justin_smith: https://github.com/l1x/hasta-la-vista/blob/master/src/hasta_la_vista/core.clj#L159

14:18 if you have time and you think i could improve on the code please let me know

14:18 it runs 1000 times faster than the previous python code

14:18 so i am happy

14:18 justin_smith: wow, nice

14:20 danielcompton: l1x: idiomatic Clojure would be to import the Java classes so you don't need to reference their fully qualified name

14:20 l1x: also, java.lang is automatically imported so java.lang.Long can be shortened to Long

14:20 justin_smith: and java.lang.* are always already imported, so you can use ^Long instead of ^java.lang.Long

14:21 l1x: danielcompton: which line are you referring to with the first sentence?

14:21 thanks!

14:21 i am modifying those

14:21 danielcompton: l1x: https://github.com/l1x/hasta-la-vista/blob/master/src/hasta_la_vista/core.clj#L147-L155

14:21 justin_smith: l1x: that refers to all x.y.z class references

14:21 l1x: so i can skip java.lang

14:21 danielcompton: l1x: but theres other places there as well

14:21 l1x: from the type hints

14:22 danielcompton: l1x: yep

14:22 justin_smith: l1x: right, and you can use import to avoid x.y other places

14:22 l1x: like this? java.lang.System

14:23 justin_smith: (:import (clojure.lang PersistentHashMap PersistentArrayMap ...)) then later you only need to use PersistentHashMap etc. and you can leave out the clojure.lang

14:23 l1x: yeah, that can always just be System

14:23 since it is in java.lang

14:23 l1x: alright i am changing those

14:24 justin_smith: in general nothing in your namespace other than a require / import should have to have a . in the middle

14:25 danielcompton: l1x: https://www.refheap.com/94046

14:25 l1x: Cursive Clojure has great support for those kinds of imports

14:26 l1x: justin_smith: thanks!

14:26 danielcompton: thanks too!

14:26 thank you guys I am cleaning it up

14:29 Mendax: lol

14:29 morgan freenode

14:29 That is hilarious

14:29 justin_smith: l1x: another small thing - you may want to consider moving the definition of work-chan into the inner let block in -main, it helps readability (and often correctness as well) to put a binding into the narrowest scope in which it is used (reduces the amount of context needed as a reader, reduces the number of places something weird can happen)

14:30 l1x: yes sir!

14:31 Mendax: Is this an off topic room?

14:32 dnolen_: Mendax: no

14:33 Mendax: what do you all talk about in this channel yhen?

14:34 clrnd: Mendax, we talk about parentheses

14:34 Mendax: o I c'

14:37 l1x: Mendax: mostly about parentheses and immutability

14:37 why

14:39 justin_smith & danielcompton

14:40 https://github.com/l1x/hasta-la-vista/blob/master/src/hasta_la_vista/core.clj

14:40 thanks guys!

14:47 justin_smith: also - those "better names for the core.async functions" aren't better names for other people reading the code - we use and often see <! >! <!! >!!, and we aren't familiar with your names at all

14:48 it makes it a bit more complex to actually figure out what that code is doing

14:49 l1x: well yes, but i have non clojure co-workers

14:49 and their #1 complaint was <!

14:49 justin_smith: and the choice to use pmap inside the threads is something I don't quite get (not that I know it's wrong, just sets off my spider-sense)

14:49 l1x: OK

14:49 l1x: hmm

14:50 how does pmap work?

14:50 justin_smith: it puts each job on a future, and gives you the results of all the futures

14:50 so it's another layer of dispatching to threads

14:50 l1x: hmmm

14:51 so i might just use map and see how it impacts the performance

14:51 justin_smith: which may not be helping perf. Compare just using a doseq instead of doall pmap, since this is already being spread across N threads.

14:51 not map, doseq

14:51 l1x: sorry i meant doseq :)

14:51 justin_smith: map is for results, and clearly that is for side effects

14:51 l1x: cool!

14:51 yes

14:52 justin_smith: definitely test the difference, but you may lose more from the pmap overhead than you gain from yet another layer of threading.

14:52 l1x: absolutely

14:52 do you know how could i bring all the imported Java code to the same log4j format?

14:53 justin_smith: you may need a properties file for that? not sure.

14:53 l1x: https://www.refheap.com/94048

14:53 this is how it behaves

14:53 it seems to be ignoring the properties file

14:55 justin_smith: l1x: where does the properties file end up relative to the classpath?

14:58 l1x: this is the 1 million dollar question

14:58 i tried everything

15:01 justin_smith: l1x: I think the secret could be that other logging.properties files are in artifacts you are using, there may be some trick to sorting that out and/or you could submit bug reports to the libs that are providing a logging.properties file that shadows yours

15:01 l1x: hmm

15:01 justin_smith: l1x: you could try specifying -Djava.util.loggin.config.file=...

15:01 l1x: i was thinking about an override

15:01 justin_smith: as an arg to the jvm

15:01 ^^ see above for overriding the file

15:01 l1x: i see

15:02 cool!

15:02 thank you

15:02 justin_smith: you can add -D args to :jvm_opts in lein, but would need to provide them manually for an uberjar

15:03 above, it is logging.config not loggin.config, obviously

15:27 l1x: i am running the jvm with this but it ignores it, thanks anyways

15:27 justin_smith: weird - yeah, I am not sure exactly how that stuff works. You may want to check out clj-logging-config

15:28 l1x: yep

15:28 thanks anyways!

16:31 sdegutis: I'm tempted to make a cascading if-let macro.

16:32 It would allow multiple forms, and would just if-let all of them recursively.

16:32 Why doesn't if-let already do that?

16:34 crash_ep: The documentation for pipeline/pipeline-async/pipeline-blocking gives insight into how clojure.core (the team) envisions core.async being used in practice for side-effecting work. That is to say, both input and output channels should generally be parameters to the function.

16:34 (I'm still trying to build an intuition for design guidelines in core.async)

16:36 sdegutis: Oh right, everyone's taken the day off for Thanksgiving.

16:38 cfleming: sdegutis: Someone posted to the mailing list with one of those earlier today, I think.

16:39 sdegutis: I'm pretty sure one of Christophe Grand's util libs has one, too.

16:39 sdegutis: cfleming: well now I feel a little validated :)

16:39 andyf: sdegutis: cascading if-let comes up once or twice a year on Google group. People disagree on what is "natural behavior" iirc. That and straightforward to write your own

16:40 cfleming: andyf: Right, some of the semantics are a little non-obvious I think, or at least there are design choices to be made there

16:40 sdegutis: andyf: I can see the argument that it might not be intuitive to a first-time user of if-let to transform it into a recursively cascading if-let

16:41 That said, I see the use for a transformative-cascading version, and it seems like it belongs in clojure.core even if under a new name.

16:41 technomancy: there's contention whether multiple clauses should be anded or ored together

16:41 sdegutis: Maybe (if-lets ...)

16:41 technomancy: I don't see where and or or come into play here.

16:41 andyf: sdegutis: Not just that, but disagreements on and/or behavior or something like that

16:41 cfleming: sdegutis: https://github.com/cgrand/utils#if-let-and-when-let

16:41 sdegutis: (if-lets [a 1, b 2] ...) -> (if-let [a 1] (if-let [b 2] ...))

16:42 andyf: sdegutis: What belongs in core is not our call to make

16:42 sdegutis: andyf: that's preposterous, clojure is open source

16:43 andyf: if it were C# or Swift, then sure

16:43 technomancy: lol

16:43 sdegutis: if this isn't a democracy i dont know what is

16:44 cfleming: Clojure is more your benevolent dictatorship

16:45 danneu: back when i thought clojure was open source, i tried fixing a typo

16:45 sdegutis: github.com/clojure/clojure is, sure

16:45 thats 1 of 683 forks

16:46 cfleming: I'd call that more anarchy than democracy :-)

16:46 sdegutis: fair enough

16:48 technomancy: I'm pretty sure we have landed gentry

16:50 andyf: Every open source project is open to arbitrary changes via forking and every one has decision makers who decided what goes in or not

16:50 danneu: 'open source' generally refers to the interpretation that's just strict enough to disqualify the modified noun from being, indeed, 'open source'.

16:50 sdegutis: andyf: good point

16:50 danneu: wat

16:54 btw jfyi my test has been failing all mourning because it was an incorrect test

16:54 andyf: I don't know danneu's experience, but many who attempt to contribute to Clojure find the process slower than their liking

16:56 justin_smith: crash_ep: have you looked at the theory underlying core.async, CSP?

16:57 http://en.wikipedia.org/wiki/Communicating_sequential_processes

17:01 dbasch: justin_smith: better yet http://www.usingcsp.com/cspbook.pdf

17:02 justin_smith: cool - that was hidden at the bottom of the wiki page


17:02 (dec evil)

17:02 lazybot: ⇒ -1

17:04 dbasch: I had to read that in school (and pay for the book) in the 90s

17:05 justin_smith: I've been looking at Kahn Process Networks lately (which are an incompatible async formalism)

17:05 s/are/is

17:07 dbasch: interesting, apparently amazon is looking for clojure people http://lispjobs.wordpress.com/2014/11/25/clojure-software-development-engineers-amazon-com/

17:07 crash_ep: justin_smith: I'm starting to learn more about it (CSP)

17:08 Clojure's implementation of the ideas seems more flexible/powerful than some of its predecessors, so I'm not sure how much of my time I should dedicate to looking at the more historical coverage of CSP vs reading modern actual core.async-using source code/examples.

17:09 justin_smith: I find that looking at the initial assumed constraints is useful, it lets me look out for "oh, that's why that isn't possible" or "oh, it's a big deal that this is possible, let's look at why it was done that way"

17:10 also, core.async was made by people who think it is a good idea to read the old papers before implementing things :)

17:12 so, whether they are right or wrong on that account, things they make likely reflect that opinion

17:17 crash_ep: dbasch: justin_smith: I'll take a look at Hoare's book, thanks for the link

17:21 kenrestivo: dbasch: i have to wonder how many of these corporations are actually looking for engineers to write clojure, versus looking for engineers who know and like clojure, to be deployed writing/maintaining java or ruby or python?

17:23 justin_smith: kenrestivo: I would hope that would be too dysfunctional even for the tech world

17:23 dbasch: in the case of Amazon I would assume there’s a particular project championed by someone who likes Clojure

17:23 Amazon doesn’t have trouble attracting good people in general

17:24 wink: I love how the ad doesn't even say that the position is in the us. which it probably is

17:25 technomancy: justin_smith: I've definitely heard of it happening

17:25 someone putting "smalltalk" on the list of requirements for a job completely unrelated to smalltalk just to filter out the noise

17:25 teslanick: There's a fifth column where I work who want to get Clojure as an accepted tech. I'm the lone frontend guy in the back like, "and clojurescript!"

17:26 justin_smith: technomancy: I hope they got a guy who knows like - smalltalk, fortran, cobol and nothing else and had to pay him to learn javascript

17:27 technomancy: I hope it didn't take too long for whomever they found to realize they'd been hoodwinked =\

17:27 cfleming: kenrestivo: From that ad: "Our stateless event-driven compute engine for dynamic data transforms is built entirely in Clojure"

17:27 justin_smith: that actually sounds fun to work on!

17:28 technomancy: "dynamic data transforms" could describe nearly anything

17:28 * justin_smith switches back to the buffer where he is editing his resume

17:28 technomancy: "we have a dynamic data transform that turns HTTP requests into HTTP responses, wooo"

17:28 cfleming: That said, pretty much everything I hear about Amazon makes it sound like a pretty awful place to work.

17:28 technomancy: I've heard it varies wildly by team

17:29 hfaafb: i hear the same as technomancy

17:29 mavbozo: dynamic-data transforms or dynamic data-transforms ?

17:29 cfleming: That makes sense - Google is similar. That's probably true of most large companies, although the Amazon horror stories at the bottom end are pretty bad.

17:30 technomancy: mavbozo: I just assume it means "throws type exceptions at runtime" =)

17:30 sdegutis: Is it possible to load a given (io/resource clojure-file) and get back all the top-level forms within it without evaluating them?

17:30 dbasch: any sufficiently large company will have asshole managers who will make some people’s lives miserable

17:30 justin_smith: sdegutis: that is what read / read-string are for

17:31 sdegutis: For example, if clojure-file contains "[:foo bar] (baz quux)" -- I'd like to get [[:foo 'bar] '(baz quux)] or something equivalent.

17:31 hyPiRion: sdegutis: (read-string (str "[" (slurp (io/resource clojure-file)) "]")) is the hacky way I do it

17:31 technomancy: (take-while (partial not= ::eof) (repeatedly #(read rdr false ::eof))) or something like that

17:31 sdegutis: hyPiRion: ahhh

17:31 justin_smith: or you can make a buffered-reader and collect the results of read until it is empty

17:31 sdegutis: technomancy: that's terrifying

17:31 danneu: sdegutis: i found a lazy edn-seq reader on stackoverflow once that i used for that purpose

17:32 sdegutis: technomancy: somehow less terrifying than hyPiRion's

17:32 *more

17:32 technomancy: sdegutis: reciting from my memory of a certain section of leiningen code that has been replaced

17:33 danneu: http://stackoverflow.com/questions/15234880/how-to-use-clojure-edn-read-to-get-a-sequence-of-objects-in-a-file

17:33 sdegutis: Terrifying. Okay I'll use it.

17:33 technomancy: live on the edge

17:33 extreme programming

17:34 kenrestivo: i once wrote something similar to hyPiRion's hack above, for datomic schema updates

17:34 mavbozo: reactive programming

17:34 andyf: A loop of reads is terrifying?

17:34 kenrestivo: in fact, i vaguely remember seeing something like that in the day-of-datomic example code, but my memory is fuzzy

17:34 hyPiRion: I'm pretty sure I've used that piece of code more than once.

17:35 sdegutis: Reactive programming is for those who live in a reactor.

17:35 kenrestivo: radioactive programming is for people who are fans of imagine dragons

17:35 sdegutis: Anyway, now I'm in Java land -- lots of "bla cannot be cast to java.io.some.obnoxious.class.hierarchy.hey.i.wonder.whats.on.reddit"

17:36 technomancy: CatGifException

17:38 hyPiRion: We were afraid of a NotEnoughPoniesException at the end of the conj

17:39 sdegutis: sounds like you all had fun at your social gathering

17:39 teslanick: public static void someNonsenseOnReddit() throws ExceptionalCatGifException ?

17:40 justin_smith: UnrecoverableClickedOnSpaceDicksKillItWithFierError

17:40 teslanick: [sic]

17:41 sdegutis: I am DETERMINED to probably figure this out maybe!

17:41 Or at least to try to not give up right away.

18:12 Is (load) just (read) + (eval) ?

18:15 Bronsa: sdegutis: conceptually, yes, the clojure impl of load is a bit more than that though

18:15 andyf: It tries to avoid reloading a namespace that is already loaded, but essentially yes

18:16 gfredericks: does it?

18:16 I thought that was the difference between load and require

18:16 andyf: Bronsa's answers here take precedence over mine :-)

18:16 Bronsa: gfredericks: yeah you're right

18:16 gfredericks: $karma andyf

18:16 lazybot: andyf has karma 9.

18:16 gfredericks: $karma Bronsa

18:16 lazybot: Bronsa has karma 73.

18:17 gfredericks: huh yep, Bronsa takes precedence.

18:17 andyf: Karma shmarma :-). He knows more of this than I do

18:19 I was reading RT.load source and got confused by meaning of local ' loaded'

18:19 gfredericks: (inc shmarma)

18:19 lazybot: ⇒ 1

18:19 gfredericks: $karma schmarma

18:19 lazybot: schmarma has karma 0.

18:19 gfredericks: $karma shmarma

18:19 lazybot: shmarma has karma 1.

18:20 andyf: Not to be confused with shawarma

18:21 Now someone is writing a bot ' karma cage match' to arbitrate disputes, I bet

18:22 gfredericks: it's no coincidence that amalloy has the most karma and is also right all the time

18:25 andyf: Wow. Cage match on Wikipedia leads to "professional wrestling match types", of which there are more than I would have imagined. Don't go there

18:25 justin_smith: we could totally make a $cagematch command for lazybot (fn cagematch [a b] (if (> (rand-int (karma a) (karma b))) "a wins" "b wins"))

18:26 err, wait, I messed that up

18:26 (if (> (rand-int (karma a)) (rand-int (karma b))) ...)

18:26 andyf: Too late. It has already been shipped

18:26 justin_smith: haha

18:36 mgaare: if I have a set of records, any way to get this to work: (record-set "somestring") => record where (.toString record) = "somestring"?

18:38 justin_smith: mgaare: so you want to redefine that record type to have a new to-string method?

18:39 mgaare: justin_smith: I want to override the lookup mechanism used in sets to use toString for that record type, rather than hashing and whatever else it does now

18:41 justin_smith: mgaare: to change how sets use it, you have to change .equals and .hashCode

18:41 this may be easier with a deftype than a defrecord? may not be

18:41 mgaare: right on. thanks!

18:43 I think you can do (defrecord Thingy Object (equals [this that] ...) (hashCode [this] ...))

18:43 justin_smith: yeah, that will likely work

18:46 andyf: gfredericks: Thx for comments on Eastwood issue. I should have some time this long weekend to try out some things

18:47 hyPiRion: Oh, it's Thanksgiving for you Americans tomorrow

18:48 andyf: Tis the season to eat well and start Christmas shopping

18:51 gfredericks: overeating & shopping: it's what George Washington commanded us to do

19:02 ffwacom: '(+ 1 1)

19:02 ,(+ 1 1)

19:02 clojurebot: 2

19:02 ffwacom: ,((partial - 1) 0)

19:02 clojurebot: 1

19:02 ffwacom: wait

19:02 nevermind

19:04 andyf: Anyone have favorite sorted collection variants besides github.com/amalloy/ordered data.priority-map and flatland.useful.map/ordering-map ?

19:04 I'm looking for most useful variants to link from cheatsheet

19:28 subtone100: clojure jobs dealio front paging on hacker news… http://lispjobs.wordpress.com/2014/11/25/clojure-software-development-engineers-amazon-com/

19:50 {blake}: Idiomatic way of converting string to Boolean, Number or Date (or leaving as string)? Should I just do a defmulti or does something already exist.

19:51 andyf: If only arg is string, defmulti will not help, will it?

19:51 gfredericks: well the dispatch can be anything

19:51 but sounds clunky regardless

19:52 andyf: Date formats are legion. Which do you want to support?

19:52 Which kind of numbers: ints only? Negative allowed? Ratios? Floating point?

19:53 gfredericks: (inc andyf) ;; closing in on Bronsa

19:53 lazybot: ⇒ 10

19:53 {blake}: andyf: Well, maybe that's the answer. I'm getting this stuff from a web form, and it's all being formatted so maybe I put it in the right format at that end.

19:53 dbasch: andyf: I haven’t dated in a long time, but I heard friends talk about speed dating

19:53 gfredericks: (dec dbasch)

19:53 lazybot: ⇒ 20

19:54 dbasch: gfredericks: oh, date formats as in YYMMDD. Never mind.

19:54 andyf: I get inc for badgering someone with questions? Hmmm

19:55 {blake}: Do you? Do you? Do you? Do you? (This isn't working...)

19:55 dbasch: {blake}: hold it, or you’ll get a dec for bad jokes :P

19:55 gfredericks: andyf: I was considering saying something about the requirements being ambiguous but you dove right in

19:55 {blake}: dbasch: That's the price we pay for comedy.

19:55 dbasch: {blake}: freedom costs a dec o five

19:56 gfredericks: all the incs are like saving up for making puns

19:56 {blake}: dbasch: lol... (there are three types of people...)

19:57 zRecursive: (doc inc)

19:57 andyf: I heard a fun variant on the Cognicast podcast recently: there are only 2 hard problems in computer science: cache invalidation, naming, and off-by-one bugs

19:57 clojurebot: "([x]); Returns a number one greater than num. Does not auto-promote longs, will throw on overflow. See also: inc'"

19:57 {blake}: Well, I was thinking the REPL...it does something like what I'm talking about. The R&P parts.

19:58 gfredericks: "there's two hard problems in computer science: we only have one joke and it's not funny."

19:59 dbasch: andyf: that joke is at least a decade old, probably older

20:00 {blake}: Wait..it's a joke?

20:00 andyf: {blake}: You could use clojure.edn/read-string and check class of return value, but it may not work for dates, and may allow many more number formats than you wish

20:00 technomancy: oh dear https://www.atlassian.com/jirajr

20:00 andyf: dbasch: Even the last phrase?

20:01 dbasch: andyf: https://www.google.com/search?q=naming+things+and+off+by+one+errors&safe=off&espv=2&biw=1536&bih=1235&source=lnt&tbs=cdr%3A1%2Ccd_min%3A%2Ccd_max%3A12%2F31%2F2002&tbm=#safe=off&tbs=cdr:1%2Ccd_max:12%2F31%2F2002&q=%22naming+things+and+off+by+one+errors%22

20:02 gfredericks: technomancy: Pivotal Tracker Tikes

20:02 andyf: I'm glad I don't know all of the jokes yet

20:03 dbasch: technomancy: we need clojunior

20:03 gfredericks: don't like that it's called "contains?" -- then just call it "stuff".

20:03 {blake}: andyf: Date-wise...this is coming in off a web-page which I control. Seems like that should help somehow.

20:04 dbasch: (poop Exception. “I want a pony!”)

20:05 I can’t even get jokes to be syntactically correct

20:06 andyf: Looks like the merch is really for sale, but I assume jirajr is an atlassian-approved bit of humor?

20:06 dbasch: andyf: look at the date of the youtube video

20:22 kenrestivo: i'm partial to "there are only 10 kinds of people: those who understand binary and those who do not"

20:23 andyf: There is a clojure.core/partial joke in there somewhere

20:23 dbasch: kenrestivo: don’t forget the ones who understand ternary, or any other bases

20:24 andyf: Wait, date formats as in YYMMDD. Are you from 1990?

20:25 dbasch: andyf: I wish, that would make me 24 years old

20:25 but yes, I grew up in the days of YY

20:26 kenrestivo: i've seen a y2k bug in the wild only once. it was on a kid's computer math game, made in 1994. when used in 2007 it showed dates as 1907

20:26 andyf: I was actually semi-worried around New Year's Eve 2000. Not for planes falling out of the sky, but for the economy going wonky

20:26 kenrestivo: that happened in 2001 :-/

20:26 which was actually the millenium :-P

20:26 * kenrestivo mutters about off-by-one bugs in the media

20:27 justin_smith: kenrestivo: my tandy 102 works great, modern batteries can make it last over a week on a set of aa cells, it's indestructable, but it thinks this is 1914

20:28 also, it has the last significant piece of software written by bill gates on it (a text editor)

20:30 {blake}: Nothing wrong with YY. We're well into the 2000s now. And nothing of import happened in the 19xxes.

20:31 andyf: Dude, do you even history?

20:31 {blake}: Stop living in the past.

20:31 dbasch: the past is for log files. in #clojure we live in the present

20:31 kenrestivo: no dude

20:31 we live IN THE FUTURE

20:32 hfaafb: logs are stateful

20:32 dbasch: (dec logs)

20:32 lazybot: ⇒ -1

20:32 andyf: Shudders to think what would happen if nothing older than 10 years ago was known

20:33 hfaafb: NodeJS is what happened

20:33 #rekt

20:33 dbasch: we wouldn’t know that the Concorde existed, and flew for the last time 11 years ago today

20:33 we didn’t have Clojure but we had commercial supersonic flights

20:33 hfaafb: God bless America

20:35 {blake}: Er, Concorde was British.

20:35 dbasch: it was Anglo-French

20:40 verma: does clojuredocs have an API?

20:40 stuff to query examples etc?

20:40 justin_smith: grimoire has that

20:40 andyf: Yes, but I think it accesses data from about SEp 2014

20:40 justin_smith: $grim clojure.core/+

20:40 lazybot: http://grimoire.arrdem.com/1.6.0/clojure.core/+

20:41 andyf: Search github for cd-client lib

20:41 verma: nice

20:41 thanks guys

20:41 andyf: There is an issue for ClojureDocs to update it, but not done yet

20:42 verma: so when you say data from sep 2014, what does that mean? like a snapshot was taken?

20:42 the docs and examples are continously growing aren't they?

20:42 andyf: ^

20:43 andyf: It appears to me that a snapshot was taken and that is what API accesses. Updates are occurring to HTML version

20:44 verma: oh

20:44 andyf: Probably snapshot is from when they updated HTML version to clojure 1. 6.0 around sep 2014

20:44 verma: nice, I can always iframe stuff

20:45 just trying to make a nodewebkit app for quick documentation and samples, kind of like dash but very clojure specific and sources data live from the interwebs.

20:45 andyf: I pull my own snapshot via their API every month or so, and it has stopped updating for a while , even though HTML keeps updating since then

20:45 verma: and playing with freactive along the way

20:46 andyf: what do you do with the snapshot?

20:46 andyf: Generate stats for clojure cheatsheet tooltips

20:47 verma: which clojure cheatsheet?

20:47 andyf: Also put up a text file of snap on github in case someone wants offline accessible version for cd-client

20:47 verma: nice

20:48 andyf: The ones here: jafingerhut.github.io

20:48 justin_smith: ~cheatsheet

20:48 clojurebot: Cheatsheets with tooltips can be found at http://jafingerhut.github.com/ .

20:48 enn: Given a java.lang.class like clojure.core$map, is there a straightforward way to get the clojure.lang.Var clojure.core/map?

20:48 gfredericks: just heuristics I Think

20:48 so...no.

20:49 enn: ok

20:50 justin_smith: gfredericks: well, you could filter all-ns / ns-publics

20:50 but that's way ugly

20:50 verma: andyf: nice!

20:50 gfredericks: justin_smith: clever though

20:52 ,(for [ns (all-ns) [_ v] (ns-publics ns) :when (= clojure.core$map @v)] v)

20:52 clojurebot: ()

20:52 gfredericks: ,(for [ns (all-ns) [_ v] (ns-publics ns) :when (= clojure.core$map (class @v))] v)

20:52 clojurebot: (#'clojure.core/map)

20:53 gfredericks: enn: ^ marginally better than string wrangling

20:53 (inc justin_smith)

20:53 lazybot: ⇒ 149

20:53 enn: oh, nice. That might not be too ugly for this application. Thank you!

20:54 justin_smith: the problem is you are walking every var in every namespace

20:54 terrible algorithm

20:54 andyf: Caching!

20:55 justin_smith: haha

20:55 andyf: (No invalidation required, thus avoiding hard problem)

20:55 justin_smith: andyf: if you never redefine vars, sure

20:55 andyf: Hard problem avoided by putting fingers in ears and singing

20:56 gfredericks: redefining is a problem even if you don't cache

20:56 depending on your requirements at least

20:56 justin_smith: gfredericks: it's no longer the value of any var, so isn't found - what's the problem?

20:56 yeah, depending on requirements that could still be an issue

20:56 gfredericks: maybe you wanted to find it anyways

20:57 justin_smith: then you want a reverse registry for all namespaces

20:57 gfredericks: I have clojure.core$map and I want #'clojure.core/map whether or not anybody's redefined it

20:57 I was about to claim I couldn't think of a use case for this but maybe handling stack traces?

20:59 enn: Yes, exactly

21:00 andyf: I recall reading something recently about project that modifies stack traces but forgetting its name

21:00 justin_smith: yeah, for something like stacktraces you don't need a super efficient algorithm anyway - something broke, do a linear seach and grab pieces of what happened, that's reasonable

21:06 andyf: AvisoNovate /pretty lib on github is not what I am remembering, but has code relevant to enn's question

21:08 enn: oh, that looks really nice

21:09 verma: emacs users: what's your general flow for adding a new dep to your project?

21:10 andyf: Edit project.clj in emacs. Save. :-)

21:10 kenrestivo: um, add it to project.clj and rstart the vm?

21:10 justin_smith: verma: I have pallet/alembic in my profiles.clj user deps, so I add it to the running repl at the same time I add it to project.clj

21:10 pallet can add a dep based on a changed project.clj at runtime

21:10 verma: oh what!

21:10 nice

21:10 kenrestivo: what is this sorcery?

21:10 justin_smith: pallet/alembic. It is awesome.

21:11 alembic/load-project

21:11 verma: also the part of actually looking up the exact package you need, like I need core.async, but there's this whole lein string that you need, do you just copy paste it after googling it?

21:11 justin_smith: it doesn't drop deps, only adds them though

21:11 andyf: It is sorcery, kenrestivo! Save yourself while there is still time!

21:11 justin_smith: verma: clojars / crossclj.info

21:11 andyf: Seriously, some sorcery is good

21:12 justin_smith: also lein search

21:12 kenrestivo: i'm already locked in a battle to the death with clojure.tools.namespace/refresh, not sure i want ot add another magickal thing

21:12 justin_smith: haha

21:12 kenrestivo: that does Things to my classpath and jvm

21:12 but it sounds very cool

21:13 justin_smith: compared to the state-wrangling that refresh does, downloading a jar and adding to classpath is pretty trivial

21:13 unlike refresh it can't drop things, only add to what you have

21:14 verma: lein search excepted :(

21:14 crossclj.info is pretty nice!

21:14 justin_smith: yeah, it is pretty amazing, I wish it would get a UX overhaul though

21:15 kenrestivo: i wish crossclj was integrated into emacs and/or lein

21:15 verma: hehe agree, I still cannot find that lein package string

21:15 kenrestivo: actually, something like alembic + crossclj + emacs.... mmmm

21:15 verma: I mean click this button to copy it

21:15 or something, like lein plz is trying to do this

21:24 kenrestivo: starting to get to the bottom of this. it seems that if the component dependency order is not exactly the same as the namespace dependency order, Trouble can arise

21:33 huh, well that fixed it. super scary that i have no idea *why*, but it did :-/

21:34 i removed one dependency in one of the ns's. wasn't even a circular dependency or anything, just a slightly different order than i really needed.

21:36 * kenrestivo rewrites the whole app to use a core.async message bus instead of having ns's require each other

22:28 cfleming: I hate the ns form in all its, er, forms.

22:28 Especially use. I have a special hatred in my heart for use.

22:30 gfredericks: ~ns

22:30 clojurebot: ns is unfortunately more complicated than it needs to be, but http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns may be helpful.

22:31 gfredericks: ~ns

22:31 clojurebot: ns is unfortunately more complicated than it needs to be, but http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns may be helpful.

22:31 gfredericks: hmm

22:33 cfleming: Unfortunately that blog post is silent on such matters as what (:use [my.ns :refer [a b c] :only [d e f] :exclude [a d] :as blarg]) actually means.

22:34 Or actually does, rather.

22:34 And such matters as whether (:use (clojure.java io javadoc)) is valid or if I have to split the prefix.

22:34 gfredericks: well clearly it

22:37 thearthur: cfleming: It would be nice if use was more clearly discouraged in the official documentations for ns

22:38 cfleming: thearthur: No doubt. I'm an unusual case, admittedly, since I have to write code that parses ns and rewrites it, so I have to care about the edge cases that most people don't.

22:38 Turns out there's a lot of them.

22:39 gfredericks: "arble-garble is a clojure library for parsing and rewriting ns forms."

22:40 cfleming: That would be an excellent name for such a library.

22:40 Or gobbledygook, perhaps. Or gibberish.

22:40 I like gibberish, actually.

22:41 Anyway, rant over. Thank you all for listening.

22:45 gfredericks: name it gobble-gobble in honor of tomorrow

22:50 justin_smith: gfredericks: global-gobble?

22:52 * llasram <3 docker

22:56 thearthur: global-globble

22:57 kenrestivo: i despise :use, and i don't much care for :refer :all either. i like it when people call out specifically what functions come from where

22:58 llasram: explicit > implicit

22:58 Python got a few things right, at least philosophically

22:58 kenrestivo: yeah. java's "import foo.bar.*;" makes me see red too. especially in readmes and sample code.

23:02 cfleming: My main beef are things like the prefixed use/require form, which make it massively more complex to avoid typing a few chars. The CLJS ns form is much more sane.

Logging service provided by n01se.net