#clojure log - Oct 11 2013

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

0:53 noonian: what is the difference (to the code being evaluated) between including deps in project.clj and concating them to the deps in the project map before calling leiningen's eval-in-project for a leiningen plugin?

0:56 when i inject the deps, they are on the classpath, but pallet behaves slightly differently

1:14 nvm, it was just the order they were in

2:11 muhoo: wow, pedestal;s routing seems pretty nifty

3:16 ugh tho, the interceptor stuff seems lifted from the android activity lifecycle.

3:16 H4ns: i wonder how this http://cljbin.com/paste/52579da5e4b01f853da4737b could be more idiomatic. i need to walk a tree and collect elements out of it. the remember function seems a little iffy

3:18 ordnungswidrig: H4ns: you could use (update-in results [:sets] (conj item))

3:19 e.g. (if-let [t (cond (seq? item) :seq (vector? item) :vec)] (update-in results [t] conj item) results)

3:20 H4ns: ordnungswidrig: that looks good, thanks

3:20 ordnungswidrig: i'll not use seq? and vector? in the real code, i first want to get the tree walking and collecting sorted out in a minimal fashion

3:21 ordnungswidrig: http://cljbin.com/paste/52579efae4b01f853da4737c

3:23 H4ns: ordnungswidrig: and in the real code, i don't want the original items in the results, but something that is computed from the original item :) - but thanks, update-in looks cool.

3:23 muhoo: clojure.walk/postwalk too

3:25 * H4ns tries to consume the docs for clojure.walk

3:27 H4ns: muhoo: if i understand it right, clojure.walk does not allow me to effectively flatten the structure

3:30 muhoo: what i need, though, is a concise way to walk a tree and build up a differently structured result (in my case, i process a tree and extract various objects residing on different levels into a map type->object). "extract" means that a new object will be created from what is found in the tree

3:51 wunki: I often see in .cljs files the `:require [some.Lib :as var]` while the var is never used. Why is that?

3:57 ddellacosta: wunki: are you asking why it's not used, or what the :as syntax means? As to why it's not used, maybe people thought they needed it but didn't…can't think of another reason. It doesn't do anything in and of itself.

3:58 wunki: ddellacosta: no, I know why it's used. I just thought maybe I'm missing something, that it's required in clojurescript

3:59 ddellacosta: wunki: no, definitely not--you can require stuff in CLJS without using :as, certainly. It doesn't do anything unless you refer to a var with it

3:59 wunki: again, I'm going to guess whoever loaded it up thought they needed it but didn't, in fact.

4:00 I know I've done that a few times

4:00 wunki: ddellacosta: would this work: `:require [goog.Uri :as goog-uri]` -> `(goog-uri. ...)`?

4:01 ddellacosta: wunki: you know, I've tried that before with stuff in the goog namespace but it doesn't work, consistently, in my experience. I suspect it's something to do with it not being a CLJS namespace originally, but I haven't looked under the hood yet to figure it out

4:02 wunki: but I do often do stuff like `:require [goog Uri]` and then you can do (Uri. ...)

4:02 wunki: ddellacosta: ok, clear, thanks for explaining :)

4:02 ddellacosta: wunki: or, [goog.fx.dom :refer [FadeOutAndHide FadeInAndShow]]

4:02 wunki: sure, glad I could help!

4:03 wunki: ddellacosta: no I only need to get better at debugging .cljs

4:03 ddellacosta: wunki: what are your pain points with that?

4:03 wunki: ddellacosta: I'm working with Pedestal and I don't get to see the compilation (not done with cljsbuild cmd)

4:04 ddellacosta: so I often do something wrong and the .js is just empty

4:04 ddellacosta: wunki: ah, pedestal…sorry I can't help you there, I don't have much pedestal experience. :-(

4:04 wunki: ddellacosta: would be great if I could to C-k in Emacs with .cljs as I can with .clj

4:04 ddellacosta: wunki: does pedestal not use lein cljsbuild? Does it wrap it in its own compile command?

4:05 wunki: ddellacosta: it has it's own function which watches for changes and recompiles it

4:05 ddellacosta: wunki: ah, gotcha.

4:05 hmm

4:05 wunki: it's funny you say that, I was just asking xeqi this morning about his cljs/emacs workflow

4:05 specifically in regards to testing

4:05 hold on

4:06 wunki: here, maybe this will help re: emacs + cljs

4:06 wunki: https://www.refheap.com/19658

4:08 wunki: ddellacosta: certainly, thanks!

4:10 ddellacosta: post above made me remember `(cljs-repl)` in Pedestal

4:10 ddellacosta: and with that I'm able to compile .cljs and I found my error :)

4:11 ddellacosta: wunki: oh, cool! Glad to hear it. :-)

4:11 wunki: ddellacosta: hats of to the guys from Pedestal, they have setup an awesome dev environment

4:12 ddellacosta: wunki: very cool, I really gotta dig into it again one of these days.

4:13 wunki: ddellacosta: it took me quite a while to "get" it. But I'm on my way now. Having the data flow on the whiteboard helps me :)

4:14 ddellacosta: wunki: I bet. Yah, I'm working with a codebase that came out well before Pedestal, so I can't really leverage the tech right now. But really need to look at it again one of these days and see how it works.

4:14 sounds like it's got a lot of great features.

4:17 wunki: ddellacosta: certainly has, it's complicated, but with reasons.

4:34 ddellacosta: why am I getting "Uncaught Error: No protocol method PushbackReader.read-char defined for type string:" ?

4:34 in CLJS

4:36 never mind, my mistake

4:37 pretty freaking obvious one looking at the error now…*sigh*

5:08 logic_prog: is there, anyone in this world,

5:08 an implementation of STLC (simply typed lambda calculus) in Clojure?

5:15 H4ns: i'm using tree-seq and reduce to walk a tree to extract data from it. sometimes, i need data from an outer node in an inner node (i.e. the id of a certain enclosing element when processing a deeply embedded child node). i can think of using a ref to maintain that context, but that somehow does not feel right. any suggestions?

5:27 zeroem: H4ns: pass a vector containing all nodes in the path from the root to the current child?

5:27 ,(doc tree-seq)

5:27 clojurebot: "([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree."

5:27 ljos: Is it possible to keep a reference to a part of a zip without copying the whole zip? Or rather, I have a n-ary tree and if I find an interesting node I want to store the location and go back to the node in O(1) instead of having to traverse the tree again. Right now I am using a zipper to traverse the tree and storing that zipper location, but it seems to me that when I store the location the whole zipper is copied. Because of the size of my trees t

5:28 H4ns: zeroem: you mean i can pass the context in the result and strip it later on? that could work.

5:28 zeroem: well, I was thinking about walking a tree in general

5:28 looking at the tree-seq docs, it may not be possible with it alone

5:29 H4ns: zeroem: i was thinking about reduce's result argument

5:29 zeroem: tree-seq doesn't seem like it would be your thing

5:29 generally, the "seq" functions (eg doseq) are used to force evaulation of a lazy seq

5:31 H4ns: zeroem: http://cljbin.com/paste/52579da5e4b01f853da4737b is what i basically use to traverse the tree and collect data out of it (except that i'm now using update-in in the remember fn)

5:31 zeroem: yeah, you could do a depth-first style reduce, just pass the desired context as part of the result

5:32 ljos: H4ns: if you are doing tree traversals there is both the clojure.walk and clojure.zip (clojure.data.zip).

5:32 H4ns: maybe i just need to write a plain recursive function to do it. :)

5:33 ljos: clojure.walk does not really allow me to return a differently structured result, as far as i understand. i'll look at clojure.zip, thanks.

5:35 ljos: H4ans: clojure.walk is mostly for transforming the nodes in place, that is correct. clojure.zip on the other hand can both replace, remove and insert new nodes.

5:37 H4ns: ljos: thanks, i'll have look

6:08 tangrammer: Hi folks

6:08 someone knows why is in https://github.com/swannodette/swannodette.github.com

6:09 (a repo containing a few clojurescript demos)

6:09 appear in the file blog.utils.node this line (def fs (js/require "fs"))

6:10 I'm meaning that I don't understand why in a browser-javascript we try to load a nodejs dependency 'fs'

6:21 katratxo: tangrammer: perhaps is not a "browser-javascript" example, but a node one

6:31 bordatoue: anyone got suggestions on how to implement the following, say if have an argument "= hello world" , then I need to output a function such that (fn [a b] (= a b)); simillary if the argument is "= one two three" ==> (fn [a b c] (= a b c)) ? Any suggestions on this please

6:37 TEttinger: bordatoue, so you don't want to compare one two three, you want to create a fn with the same number of args?

6:38 bordatoue: TEttinger, basically one two and three are arguments to a fn

6:39 TEttinger, so i need to creat a func that takes three arguments based on the input

6:39 TEttinger: can it be anything, or does it have to be =?

6:40 bordatoue: TEttinger, say if the string "= a b c" , the first portion of the string the operator

6:41 TEttinger and the rest is the arguments to the operator , which then output as a func

6:42 TEttinger, so for example "= a b" ==> (fn [a b] (= a b))

6:42 TEttinger: yep

6:42 trying to figure out how to solve it

6:43 bordatoue: TEttinger, do we need to use macros to solve this

6:49 tangrammer: katratxo: sorry for the delay (i went out for a coffee) , the same thing (node example) I was thinking too, but the problem is when you try to use the code in your browser..... anyway thanks a lot for your comments

6:55 TEttinger: bordatoue:

6:55 (let [tst "< one two three" sp (clojure.string/split tst #"\s+")] ((fn [& args] (when (= (count args) (dec (count sp))) (eval (read-string (str "(" (first sp) " " (clojure.string/join " " args) ")"))))) 1 2 3))

6:55 it won't run here, eval is forbidden here

6:55 so in final form,

6:58 (defn fn-from-code [code] (let [sp (clojure.string/split code #"\s+")] (fn [& args] (when (= (count args) (dec (count sp))) (eval (read-string (str "(" (first sp) " " (clojure.string/join " " args) ")")))))))

6:58 it's a cheap hack, eval is frowned upon, but it avoids macros

7:01 bordatoue, you there?

7:08 chillitom: anyone here familiar with how to connect LightTable's REPL to a remote service?

7:08 clojurebot: Gabh mo leithscéal?

7:16 dublindan: Hey, does anyone know how I can connect to an nREPL running on amazon ec2? I'm using vim-fireplace and I tried to port forward to ec2 using ssh but vim-fireplace seems to crash when I try to evaluate any code

7:18 bordatoue: TEttinger, thanks , Sorry for the delay; I'm looking at it

7:18 llasram: dublindan: Try using the `lein repl` nREPL client

7:18 (just for testing, at least)

7:24 dublindan: llasram: good idea, I'll give it a try

7:26 sm0ke: why vectors are not seq, but still have rest/first defined? ##(if (not (seq? [1 2 3])) (rest [1 2 3]))

7:27 ,(print :all-ok?)

7:27 clojurebot: :all-ok?

7:27 bordatoue: TEttinger, wow, great. I need to study it. It works with numbers,

7:27 sm0ke: ,(if (not (seq? [1 2 3])) (rest [1 2 3]))

7:27 clojurebot: (2 3)

7:28 sm0ke: hmm i guesshmm i guess first/rest works on everything

7:29 weird typo

7:30 llasram: sm0ke: Because those functions work on things which are `Seqable`, not just directly `ISeq`s

7:31 Well, really anything on which `seq` can be called, which is broader than just things implementing `Seqable`

7:31 * llasram hopes the core library abstractions all become protocols some day...

7:32 sm0ke: whats protocol?

7:33 llasram: The things defined by `defprotocol`?

7:33 sm0ke: it looks to me a bunch of declarations

7:34 whats that used for

7:34 aha interfaces of clojure world

7:35 odd though..considering that clojure isnt oo

7:35 llasram: Kind of. The ability to extend them to existing types makes them rather more powerful, while the ability to `reify` anonymous implementations gives them some different use cases from multimethods

7:55 sm0ke: why is cons on vector linear time?

7:55 llasram: sm0ke: What do you mean? `cons` is constant time

7:55 sm0ke: llasram: for lists not vectors

7:56 llasram: No -- period

7:56 Bronsa: cons is the same for lists and vectors and every other data structure

7:56 TEttinger: bordatoue, it will fail on strings due to how it constructs the code for eval -- ((fn-from-code "clojure.string/join a b") " " ["whee" "hooray"]) fails

7:56 sm0ke: wow really

7:57 so clojure vector is a finger tree internally?

7:57 TEttinger: you might be thinking of conj

7:57 sm0ke: conj is constant time operation of vectors also right then?

7:58 i can both append and prepend in constant time to a vector?

7:58 llasram: conj for vectors is O(log32(n))

7:58 sm0ke: llasram: OK i know little that clojure data structures are internally tree.so for some time assume logs are near constant

7:59 Bronsa: sm0ke: cons returns a Cons, not the original data-structure

7:59 llasram: sm0ke: But `cons` on a vector doesn't return a vector -- it returns a Cons.

7:59 Bronsa: jinx!

7:59 Bronsa: hah

7:59 sm0ke: so is doing a (vector) on Cons constly?

8:00 costly*

8:00 lol i coined a new term *constly*

8:00 llasram: That actually is linear time

8:01 sm0ke: why is that?

8:02 i mean which tree operation take linear time?

8:02 given its balanced

8:02 most probly clojure must be using rb trees

8:02 llasram: None. Turning a Cons or general seq into a vector is linear time because Conses and general seqs are essentially singly-linked listeds

8:03 So you need to traverse the entire list in linear time to turn it into a vector

8:04 sm0ke: aha ok cons..a head and a tail..essentially a linked list

8:04 llasram: Exactly

8:05 sm0ke: thanks

8:11 nickZury: How does Shen Compare to Clojure?

8:12 Anybody used shen?

8:13 ?

8:13 llasram: nickZury: I glanced at it, but the licensing seemed so crazy that I didn't get far

8:14 nickZury: hmmm..

8:14 sm0ke: i knew it..i was not the only one..look at Java dislikes https://news.ycombinator.com/item?id=6527104

8:15 nickZury: And one more question - How about R7RS-large?

8:18 ?

8:20 TEttinger: nickZury, clojure is a lot more mature than Shen. it also has an actual development community to answer questions...

8:20 I don't know about scheme versions

8:21 clojure can leverage the JVM and all the libs on it, which is a huge benefit

8:26 nickZury: TEttinger: It is said that R7RS-large is larger than Common Lisp, targetted for practical programming...

8:27 TEttinger: clojure's large enough that I haven't explored all the core features in about a year of usage. I wouldn't worry about that.

8:28 I still can definitely get by without macros...

8:28 clojure's pretty much become my go-to scripting language when I need to manipulate data

8:28 or all sorts of things

8:29 I have a bitmap font maker (takes a TTF, produces a PNG) in clojure, using java's font API

8:30 AimHere: I was going to say that clojure is annoying to make standalone scripts with, but it'd be less annoying than Java

8:30 TEttinger: I sometimes use the REPL and just paste in the script

8:31 AimHere: Yeah. Just stay in the repl. Sod the rest of the world.

8:38 `cbp: never turn off omacs never have to restart repl :-)

8:57 hungryblank: hi, I took a tar.gz of /var/lib one of my production nodes and try to restore on my local machine

8:57 llasram: Cool story, bro

8:57 hungryblank: feels liek i'm close to done but getting a bunch of not allocating, number_of_allocated_shards_found [1], required_number [2]

8:58 llasram: hungryblank: You may not be in the channel you think

8:58 clojurebot: Huh?

8:58 hungryblank: oh

8:58 sorry.

8:58 llasram: np :-)

8:58 Happens to us all

9:07 sm0ke: ,(conjuring)

9:07 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: conjuring in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:07 sm0ke: haha now thats some horror

10:04 john2x: how would I design an API wrapper function, which takes a session object (in addition to whatever params the API takes). But the session expires after some time, so I made the wrapper function automatically retry the call with a new session. What's an idiomatic way to return the new session? [session response]? {:session session :rest :of :the :response}?

10:05 but then every time the function is used, I'll have to deal with the returned session. Which sounds like a mess. Would a dynamic var for session be ok?

10:06 weavejester_: Does anyone happen to know of any talks or quotes on reliability in programming?

10:07 I'm looking for something that relates constraints, like types, immutability, etc, with reliability/correctness.

10:11 jcromartie_: Is it good practice to name Clojure namespaces after Java package conventions? But it seems kind of unclojurely to have namespaces like org.whatever.division.subproject.api.core

10:11 also, "unclojurely" needs to become a thing

10:12 * AimHere denounces jcromartie for Anticlojurian activities

10:13 jcromartie_: drat, it's already been coined http://www.coderanch.com/t/546519/clojure/Exceptions-Clojure

10:14 AimHere: Unidiomatic tends to be the word that's used anyways

10:14 gfredericks: So leiningen merges data_readers.clj now? does that mean it's okay for libs to have them?

10:15 llasram: I'm never sure why people would have said it wasn't okay for libs to have them, since Clojure will find and merge all instances of it on the classpath

10:16 pjstadig: llasram: true, but i think the problem is uberjars

10:16 llasram: Well, in 1.5+ at least -- 1.4 had that bug where duplicates would "conflict" even if they had the same value

10:16 pjstadig: Yeah, but you would need to provide you own in that case prior to lein 2.3.3 anyway, which would completely override any libarry-provided ones

10:17 echo-area: Adding a directory into class path results in this error: http://pastebin.com/AYqzXy6Q

10:17 What could be the reason?

10:18 (The error is "java.lang.IllegalArgumentException: No matching method: meta")

10:18 Removing that directory then java could start run

10:18 That directory contains only a single .class file

10:21 gfredericks: okay I am now pro libs-with-data-readers-file

10:21 * gfredericks flips his sign around

10:22 gfredericks: llasram: what is reproducibility wrt user.clj?

10:23 stuartsierra: Latest commits on nrepl.el (after 0.2.0) break nrepl-jack-in for me.

10:23 llasram: gfredericks: You might end up with code which only works with particular things in your personal `user.clj`?

10:24 gfredericks: llasram: I'm not talking about a personal user.clj; in this case it'd be lib-specific

10:24 llasram: Ah

10:24 Hmm.

10:24 gfredericks: my assumption was that pjstadig was using data_readers.clj _just_ for the evaluation, not for an actual data reader

10:24 llasram: Right.

10:24 Can you have multiple user.clj's though?

10:24 pjstadig: no

10:24 gfredericks: well you could merge with file concatenation :P

10:25 I guess that breaks when _not_ uberjaring

10:25 llasram: Yeah

10:25 pjstadig: clojure only finds one user.clj on the classpath and evaluates it, so it doesn't compose

10:25 data_readers for my purposes at least composes (except for uber jars or lein trying to merge them)

10:25 gfredericks: so if that were "fixed", would we all switch our signs to be pro libs-with-user-files?

10:26 llasram: My personal curmudgeon looks with suspicion upon automatic code-loading

10:26 gfredericks: (i.e., if clojure eval'd all of them; or alternately evaled all #"user-\d+.clj" in alphabetical order)

10:26 llasram: I'd need to contemplate the state my own sign :-)

10:27 pjstadig: i don't think i'd be in favor of such a thing

10:27 stuartsierra: No one should ever put user.clj in a library release.

10:27 gfredericks: stuartsierra: the reasoning behind that statement is what I'm trying to uncover

10:27 stuartsierra: It's called "user.clj" for a reason. :P

10:28 If I'm using your library, I do not want you to mess with my development environment.

10:28 Ever.

10:29 gfredericks: stuartsierra: well in this case we're talking about a library whose sole purpose is to do that

10:29 so there shouldn't be any surprises

10:29 stuartsierra: gfredericks: Oh, I missed that bit of the discussion. But why would you ever want to do that?

10:29 gfredericks: pjstadig: I'm now confused about what this is accomplishing exactly -- you're deffing some vars in what namespace?

10:30 pjstadig: gfredericks: it drops vars into the clojure.core namespace during the data_reader initialization phase, by the time you come out of that, the vars from the pjstadig.scope namespace are magically available everywhere by virtue of the fact that they have been inserted into clojure.core

10:31 it's basically a monkey patch of clojure.core

10:31 stuartsierra: Ack!

10:31 pjstadig: hehe

10:31 gfredericks: ah right; not sure how I doubted that.

10:32 pjstadig: it's optional, you have to depend on the scopes-magic artifact

10:32 bordatoue: is there a way to use doseq and maintain state , for example i want to iterate over a seq and store it in a vector , then when the iteration is completed return the vector

10:32 gfredericks: pjstadig: is there some reason I'm missing why people would get tired of requiring the scopes functions/macros but not other libs?

10:32 pjstadig: otherwise you just require and use pjstadig.scopes like you would anything else

10:32 gfredericks: i.e., is scopes special in some way?

10:32 stuartsierra: bordatoue: Use `reduce`

10:33 pjstadig: gfredericks: erm, not particularly, it's a generalization of with-open which is in clojure.core

10:34 the point is it does scopes

10:34 gfredericks: pjstadig: okay; I think I will erect my sign to be "against" this. The only use I can imagine is an alternative to the ns macro

10:34 pjstadig: scope-magic is just a distraction

10:35 gfredericks: that's why its a separate and optional dependency :) don't use it if you're against it

10:37 bordatoue: stuartsierra: thanks, but when using reduce and map is there a way I can be the variables within the fn visible. basically if I have a fn (fn [a] (do something a) (get my-map a)) ; here how can i make my-map visible within the fn, without making it global

10:37 gfredericks: pjstadig: indeed; I'm curious about scopes proper. I've scanned the readme a couple times and haven't yet wrapped my head around what problem it's solving

10:37 pjstadig: gfredericks: does this help at all? https://groups.google.com/d/msg/clojure/qPUd3AEVxT8/W2_FaCyjj_wJ

10:38 gfredericks: bordatoue: the function takes two args

10:39 pjstadig: these concepts take concentration

10:39 mdrogalis: tbaldridge: I read the Eff paper. Pretty neat stuff.

10:39 Really similar to where I landed.

10:41 tbaldridge: mdrogalis: yeah, it's cool stuff, I'm interested in seeing where it can be taken in more mainstream languages.

10:42 bordatoue: gfredericks: says its a map, with a fn (map (fn[x] (get my-map x)) [1 2 3]) I want to make my-map visible in the annonymous fn with argument x, is it possible ?

10:42 mdrogalis: I got lost in the second half, but the first half about effects made a lot of sense.

10:43 tbaldridge: mdrogalis: yeah, it takes awhile to digest. :-)

10:44 mdrogalis: tbaldridge: Still digesting deep walking macros. :P

10:51 gfredericks: bordatoue: ##(reduce (fn [my-map x] (print x) (assoc my-map x x)) {} [1 2 3])

10:51 ,(reduce (fn [my-map x] (print x) (assoc my-map x x)) {} [1 2 3])

10:51 clojurebot: 123{3 3, 2 2, 1 1}

10:51 gfredericks: bordatoue: your code examples aren't making much sense to me compared to your original question, but ^ that's an example use of reduce

10:51 with side effects

10:52 ,(reduce (fn [v x] (print x) (conj v x)) ["things i printed:"] [4 5 6])

10:52 clojurebot: 456["things i printed:" 4 5 6]

10:55 bordatoue: gfredericks: I wanted to know if I could increase the scope of a variable definied in fn within map or reduce ; (map (fn [x] (get my-map x)) [1 2 3]) ; in this example I want to make the scope of my-map visible in the annonymous function, without passing it as an agrument

10:57 pjstadig: bordatoue: the function passed to map is a closure so you can do something like (let [my-map {}] (map (fn [x] (get my-map x)) [1 2 3]))

10:58 bordatoue: pjstadig: Thanks very much

11:10 gfredericks: pjstadig: will this make dealing with streaming database results less callbacky?

11:11 pjstadig: gfredericks: not sure what you mean by callbacky

11:12 gfredericks: e.g., with latest java.jdbc I must pass in a :result-set-fn to query

11:12 all javascripty asyncy style

11:12 so that it knows when it can close the result set

11:12 same as old API (with-query-results) except that was macro-based

11:14 CapnLexii: I have a question about interop best practices. It's technically a cljs project, but the question is fundamentally the same for clj or guile or what have you

11:14 mdrogalis: Fire away, CapnLexii

11:15 CapnLexii: The question is: for working with various libraries/APIs that require side-effectful function calls (in this case, WebGL), the way one handles such a situation in the native language (in this case JS) is to create a set of "init" functions that perform these stateful API calls

11:15 it feels very icky to define analogous functions in clj

11:15 But at the same time, you don't want to have all those api calls sitting around at the top level when they could be hidden away

11:15 llasram: pjstadig: Would you be open to a PR which made `scopes` work in terms of a protocol which is by default implemented for `Closeable` and `AutoCloseable`-when-available?

11:16 mdrogalis: CapnLexii: It depends on how you handle this, but you're not going to escape side-effects.

11:16 pjstadig: llasram: sure

11:16 mdrogalis: It's just a reality, regardless of language.

11:16 CapnLexii: mdrogalis: Certainly not

11:17 pjstadig: gfredericks: i guess i don't know enough about the latest changes in java.jdbc to comment

11:17 mdrogalis: CapnLexii: That being said, I try to handle it on a case-by-case basis.

11:17 gfredericks: pjstadig: same question for the classic version

11:17 mdrogalis: For example, I have a Cljs project where I need to open a websocket. I just do it in an init function. *Shrug*

11:18 CapnLexii: mdrogalis: Aha, I see. I'm trying to make a cljs WebGL library a la Three.js, so I also have to worry about what the user experience is like

11:19 llasram: pjstadig: Oh, hmm, uses other Java 7 features

11:19 mdrogalis: CapnLexii: Understandable. What concerns you?

11:19 CapnLexii: It doesn't seem to write to give other clojurians functions to call that don't return anything; but, I wouldn't know where else to put the init code

11:19 mdrogalis: CapnLexii: println? :)

11:19 Always returns nil.

11:20 Make it obvious with an exclamation point. init!

11:20 CapnLexii: mdrogalis: Haha fair enough. I like the bang idea.

11:20 coventry2: mdrogalis, tbaldridge: What is the eff paper?

11:21 mdrogalis: coventry2: http://math.andrej.com/wp-content/uploads/2012/03/eff.pdf

11:22 Language around algebraic side effects. It

11:22 's interesting*

11:22 tbaldridge: coventry2: it's a way of getting all the good parts of monads, without all the bad parts :-)

11:22 pjstadig: gfredericks: in the case of with-query-results it does three things: create a resource, bind a name in a lexical scope, and manage a resource (i.e. close it when you're "done" where "done" means you exit the dynamic scope of the with-query-results).

11:23 coventry2: Thanks, guys.

11:23 mdrogalis: If a monad had a physical representation, tbaldridge would have a picture of it on a dart board.

11:23 pjstadig: gfredericks: with scopes you would manage a resource using with-resource-scope and you would register a resource for management using scoped! (within the dynamic extent of a with-resource-scope) and those can be in separate places (lexically speaking)

11:24 tbaldridge: mdrogalis: I'm not that anti-monad. They're actually pretty cool in languages like haskell.

11:25 mdrogalis: Heh, alright. I recall some 'rid the world of monads' talk a few weeks ago. :)

11:30 pjstadig: there's (i think) an analagous concept in memory management called region based memory management

12:13 gfredericks: pjstadig: I believe this would help; at least if we patch java.jdbc to allow returning a lazy seq and a close function

12:13 pjstadig: so if I'm running a ring server, I'd stick with-resource-scope in my middleware and then just register resources willy-nilly?

12:15 dnolen: eric_normand: btw, your patch, did you actually change the api at all?

12:15 jcromartie_: defmutli ...

12:15 http://upload.wikimedia.org/wikipedia/en/2/21/Muttley-picture.gif

12:15 muhoo: has anyone gotten pedestal and friend to play togethr nicely?

12:16 pjstadig: gfredericks: you'd want to create scopes with reasonable extent; one way to do that might be to create a scope for each request if you're building a server type application

12:16 gfredericks: you could also use scopes (in addition to closing files) to delete temporary files that are created as a part of processing a request

12:16 eric_normand: dnolen: hmm, I don't think so

12:17 dnolen: what do you mean by "the api"?

12:17 gfredericks: pjstadig: "create a scope for each request" is what I was suggesting by middleware I think

12:17 pjstadig: yeah

12:17 dnolen: eric_normand: like did you actually change what a function takes and returns?

12:17 eric_normand: dnolen: yes

12:17 gfredericks: pjstadig: oh there's still the problem of inputstreams and ring

12:17 stuartsierra: muhoo: Chas Emerick and Gabriel Horner recently did some work on Friend & Pedestal.

12:17 I don't know the details.

12:18 dnolen: eric_normand: is it possible to get the desired behavior w/o doing that?

12:18 mdrogalis: stuartsierra: Did you end up hurdling over your Lamina problem?

12:18 eric_normand: dnolen: yes

12:18 muhoo: stuartsierra: thanks

12:18 dnolen: eric_normand: lets do that instead and I'll apply it

12:18 eric_normand: dnolen: give me a few minutes

12:18 stuartsierra: mdrogalis: Yes, by updating to latest version.

12:18 dnolen: eric_normand: thanks

12:19 mdrogalis: stuartsierra: Good to know.

12:19 gfredericks: pjstadig: with some sort of request-closed callback wrt ring this could be super slick

12:29 muhoo: update: it looks like friend as of about 4 months ago 0.2.0 supports pedestal

12:36 dnolen: jonasen: could we add tools.macro to list of cljsfiddle libs?

12:36 jonasen: dnolen: does it support clojurescript? I didn't know that

12:36 dnolen: jonasen: it's just a macro lib, works great

12:38 jonasen: dnolen: I'll add it then :) I'll test the new cljs release when it reaches maven central and then I'll push a new version

12:38 dnolen: jonasen: 1934 already landed in maven central

12:38 muhoo: am i the only one who finds the convention of side-effecting function naming so! freakin! alarming! ?

12:38 jonasen: great

12:40 technomancy: side effects are srsbsns

12:44 muhoo: hmm,, i guess making the names annoying to read is one way to discourage their use

12:44 Foxboron: side effects can burn down your house.

12:44 or does it? You will never know.

12:46 * muhoo grumbles and renames! a! bunch! of! functions!

12:47 rasmusto: programming with side effects is fn!

12:51 eric_normand: dnolen: a little update: I am having trouble compiling source maps using a clean master!

12:51 dnolen: eric_normand: what's the problem?

12:52 eric_normand: dnolen: null pointer exception

12:52 dnolen: eric_normand: file and line number?

12:52 eric_normand: closure.clj:729 cljs.closure/optimize[fn]

12:53 dnolen: eric_normand: I think you have the wrong version of ClojureScript, if you look at closure.clj on master, not possible

12:54 eric_normand: dnolen: I am starting over from a fresh master again. one sec

12:55 dnolen: eric_normand: I just tried core.async with 1934, works for me.

12:55 eric_normand: dnolen: is there a particular level of optimization I have to use?

12:56 dnolen: eric_normand: whitespace, simple, advanced

12:56 eric_normand: we don't support source maps for any other level yet

12:56 heh, which is just :none

12:56 eric_normand: dnolen: trying with advanced now

12:56 dnolen: ok, worked with advanced

12:56 dnolen: now I will try my patch

12:56 dnolen: eric_normand: what did you try :simple?

12:57 eric_normand: dnolen: before I had nothing set for :optimizations

12:57 dnolen: eric_normand: oh yeah ok, that won't work

13:00 eric_normand: dnolen: cool, it works!

13:00 dnolen: shows up in chrome

13:01 dnolen: I have attached another patch to the issue

13:02 dnolen: http://dev.clojure.org/jira/browse/CLJS-591

13:03 dnolen: thanks for the help; let me know if you need anything

13:06 dnolen: eric_normand: could not apply that patch with git am

13:07 eric_normand: better for the patch to have attribution, and commit message w/ ticket number etc.

13:07 eric_normand: I refer to this http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/

13:11 eric_normand: dnolen: I attached another patch

13:11 dnolen: using the guidelines from the post you linked to

13:12 dnolen: source-map2.patch

13:25 dnolen: eric_normand: applied to master thanks

13:26 eric_normand: dnolen: you're welcome

13:32 bitemyapp: rkneufeld: haha, CA strikes back!

13:39 justin_smith: muhoo: if it has side effects that are more serious, any number of ! tokens should be added to the name, for the super serious, throw in some 1 too: (format-hard-drive!!!11!!11!)

13:39 mtp: how about some leading underscores while we're at it

13:40 justin_smith: hmm, _ indicates "this has to be there for implementation reasons" right? so the number of _ before the symbol should indicate how low it is on the implementation stack

13:40 mtp: _____format-hard-drive!!!!one!

13:42 justin_smith: (.var ____RT "clojure.core" "___*allow-unresovled-vars*")

13:43 or maybe that should have been ____RT/var

13:44 jonasen: dnolen: http://cljsfiddle.net/fiddle/jonase.tools-macro-test

14:05 rkneufeld: bitemyapp: Yeah I was none too pleased about that. The upside is everyone gets a hard-copy of the book

14:08 bitemyapp: rkneufeld: also was filename ".license_assignments/.md" a typo? is my name supposed to come before the .md?

14:08 rkneufeld: bitemyapp: probably was supposed to be <your-github-handle>.md or the like.

14:09 bitemyapp: gotcha. Thanks.

14:34 muhoo: justin_smith: what is this, the linux kernel?

14:43 gfredericks: so if you have a pretty vanilla clojure lib that is not really sensitive to clojure versioning, is it important what's listed in the project.clj? e.g., if it currently says 1.3, is there much accomplished by switching it to 1.5?

14:44 technomancy: gfredericks: I'm tempted to suggest leaving it out entirely

14:44 but I haven't really thought through the implications

14:47 gfredericks: technomancy: that approach would make it a lot easier to use a forked clojure?

14:47 technomancy: if everyone did it, sure

14:48 gfredericks: so currently if I want to use [com.gfredericks/clojure "1.5.1-NIFTY"], I can suppress org.clojure/clojure in my project.clj and that's the way to do it?

14:48 bitemyapp: "1.5.1-GENETICALLY-SUPERIOR-BRO"

14:49 technomancy: practically speaking you need a top-level exclusion currently

14:49 bitemyapp: gfredericks: ^^ spooky

14:49 gfredericks: [com.gfredericks/lava "1.5.1"]

14:49 technomancy: but if only a few libs depend on clojure then you could use scattered targeted exclusions

14:49 heh

14:49 "1.5.1-COLLECTORS-EDITION"

14:50 bitemyapp: I kinda hate that the only message he saw was me being stupid -_-'

14:50 hiredman: cut a limited edition, delete it from clojars tomorrow

14:50 bitemyapp: if he saw anything

14:52 gfredericks: hiredman: we all get to run our apps on it for a day just for the thrill of it, then backgrade

14:52 mdrogalis: bitemyapp: Ahahahah.

14:52 bitemyapp: seangrov1: I'm cutting a Korma release soon, any requests before I do so?

14:52 seangrov1: the release will include your PR that I merged.

14:52 mdrogalis: Ah, that was a good laugh.

14:52 hiredman: gfredericks: have it popup a dialog asking for an activation key

14:52 bitemyapp: mdrogalis: I'm glad you enjoy my shame.

14:53 mdrogalis: bitemyapp: Someone has to. Can't let it go to waste.

14:53 bitemyapp: The Ecology of Embarrassment

14:55 mdrogalis: Man, its been raining all week. x.x

14:58 bitemyapp: mdrogalis: 60F and slightly overcast here.

14:58 It doesn't really rain much in this area.

14:58 mdrogalis: SF, IIRC?

14:58 bitemyapp: mdrogalis: yeah

14:58 mdrogalis: Fun place.

14:59 bitemyapp: I don't really experience that side of it. I'd like to some day.

14:59 I actually really don't like living here and am waiting for my first opportunity to leave.

14:59 Which seems a waste, but I don't really know what I'm supposed to enjoy about SF.

15:00 Other than the career opportunities.

15:00 And cool programmers/startup people.

15:00 mdrogalis: bitemyapp: Definitely not for everyone, nothing wrong with that.

15:00 Where do you want to be?

15:00 coventry: _A Dirty Job_ made it *sound* nice.

15:01 bitemyapp: mdrogalis: I miss the nice people back home in Ohio, but I'd rather not live in Ohio. I've heard good things about Austin. I'm going to stay in SF for quite awhile though. Possibly the next decade.

15:01 mdrogalis: bitemyapp: That's a long time to spend in a city you don't like.

15:02 bitemyapp: mdrogalis: I don't make my decisions in a way that is heavily weighted by comfort or contentment.

15:02 mdrogalis: To each his own.

15:02 technomancy: bitemyapp: I thought you were coming up north

15:03 bitemyapp: technomancy: I'm considering Portland and Seattle alongside Austin.

15:03 technomancy: nice

15:03 bitemyapp: If for no other reason than that I don't like heat.

15:03 and I really like forests.

15:04 mdrogalis: part of the reason I'm staying in SF for now is that I work at a rather exceptional company and they're bay area only at the moment.

15:05 technomancy: yeah, I felt like a broken record saying "wow, it's so green" every half hour or so when I first moved up here

15:05 mdrogalis: bitemyapp: Ping pong table on the roof?

15:05 xeqi: heat vs rain

15:07 bitemyapp: xeqi: I'm okay with rain.

15:07 mdrogalis: very self-directed environment. I have no boss.

15:08 mercwithamouth: ,(def foo[22 [747, 1]) (nth (last foo) 1)

15:08 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

15:08 mercwithamouth: ,(def foo[22 [747, 1]) (nth (last foo) 1))

15:08 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

15:08 mercwithamouth: ,(def foo[22 [747, 1]]) (nth (last foo) 1))

15:08 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

15:08 mdrogalis: bitemyapp: Very easy to stick it to the man then.

15:09 mercwithamouth: hrmm how do you handle multiple lines/levels with the bot?

15:09 yeoj___: I have a sequence of dictionaries with one entry.... what's an efficient way to make a sequence with just that one dictionary value? I was looking at seq to make a vector, then taking only even elements... but has to be a better way?

15:10 cmajor7: need to test several http endpoinds. I'd like to do it with clj-http and clojure.test. the question is about a fixture that needs to start/stop "ring server" around these tests. what is a recommended way of doing that? (in a fixture). everything is read only, so I only need this :once for all the tests.

15:12 coventry: yeoj___: ,(map #(get % :t) [{:t 1} {:t 2}])

15:12 xeqi: cmajor71: https://github.com/ato/clojars-web/blob/master/test/clojars/test/integration/uploads.clj#L17 or https://github.com/cemerick/friend/blob/master/test/test_friend/functional.clj#L11

15:12 clojurebot: Excuse me?

15:12 coventry: ,(map #(get % :t) [{:t 1} {:t 2}])

15:12 clojurebot: (1 2)

15:13 yeoj___: coventry: thank you

15:13 clojurebot: thanks little buddy.

15:13 clojurebot: Cool story bro.

15:13 xeqi: mercwithamouth: can you make it a let?

15:13 coventry: yeoj___: Or ##(map :t [{:t 1} {:t 2}]) if it's a kw.

15:13 devth: amalloy: i thought flatland/useful had a fn that throttled calls, queuing them and calling at a specified frequency (e.g. to prevent excess floods when sending messages to irc). was i mistaken? i realize rate-limited is not it.

15:13 cmajor71: xeqi: hit the spot :) thx. looks like it can be a gist/clojure.test macro, since I can't think it is so rare.. ?

15:14 dnolen: jonasen: awesome thanks

15:14 dobry-den: cmajor71: testing is common? ;)

15:15 cmajor71: dobry-den: I'd like to believe it is.. and if this macro is in, it'll enforce faith

15:15 amalloy: are you thinking of flatland.useful.state/periodic-recompute, devth?

15:16 jonasen: dnolen: I've never used tools.macro so I don't know if the example even makes sense..

15:16 amalloy: we definitely don't have one that queues up calls

15:17 but i think https://github.com/jkk/rate-gate is that

15:17 devth: amalloy: ah ok. i haven't used periodic-recompute but looks interesting

15:17 oh sweet. i'll check that out.

15:17 amalloy: thanks

15:18 my irc bot keeps getting excess flood kicked

15:20 dnolen: jonasen: heh yeah, I used symbol-macrolet so I can use _ for (var)

15:20 in core.logic

15:21 bitemyapp: devth: devn?

15:21 but with a weird lisp?

15:22 devth: bitemyapp: nope :)

15:22 bitemyapp: so many dev* *_*

15:32 dobry-den: No matter what I do, nrepl-load-current-buffer (C-c C-k) always displays the Exception in the minibuffer: https://dl.dropboxusercontent.com/spa/quq37nq1583x0lf/-4cqzq0i.png

15:32 Isn't (setq nrepl-popup-stacktraces t) supposed to change that behavior?

15:33 The minibuffer is the ideal place to show an exception, but it's not very useful since it doesn't show the linenumber in your source

15:50 mlb-: Is there a Haskell-like "swap" method in clojure?

15:51 Raynes: mlb-: What does swap do? Are you talking about Data.Tuple.swap?

15:51 mlb-: yes

15:51 Raynes: Well, we don't really have tuples.

15:52 So unless you've somehow got actual tuples, you can just call reverse on a two element sequential data structure.

15:52 mlb-: hmm, maybe I'm thinking of the wrong method then,

15:53 Raynes: http://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Tuple.html

15:53 mlb-: Swap just swaps the elements of a pair.

15:53 mlb-: What I want is a function that takes a function(a, b, ...) and returns a function(b, a, ...)

15:54 amalloy: you mean "flip", i think

15:54 justin_smith: flip?

15:54 amalloy: which is a haskell function that does that, but has no equivalent built into clojure

15:54 Raynes: Indeed.

15:55 mlb-: Ah, yes. Exactly. I'm sorry, it's been a while since I've used Haskell

15:55 AimHere: You could roll your own oneliner that did the job though

15:55 amalloy: i wrote a library called hot-potato many years ago which was basically generalized flip. i don't really recommend using it, partly because i was so new when i wrote it, but it might be fun to study

15:55 mlb-: that's fine. I was just hoping for a way to compose functions to reduce the amount of anonymous functions =]

16:02 seangrove: I keep asking this, but can never quite seem to get it right - my compojure app is giving 500 errors, but I don't see any stack traces in the output, or in the *nrepl-server* buffer

16:04 Whenever running a compojure app via nrepl.el, how can I get a stacktrace output in the *nrepl-server* buffer on a 500 error?

16:05 bitemyapp: seangrove: hey sorry to bug you, did you see what I said about Korma?

16:06 seangrove: bitemyapp: I don't think so no, what was it?

16:06 bitemyapp: seangrove: I'm cutting a release that includes your PR soon, any requests before I do so?

16:06 seangrove: Nothing that comes to mind

16:06 justin_smith: seangrove: I have wondered about maybe using somthing like timbre to make sure output goes to a reliable place when combining nrepl and threads

16:06 seangrove: What's the state of/plan for korma.incubator?

16:07 bitemyapp: I use timbre and am mostly happy with it but the exception logging breaks with an NPE sometimes.

16:07 seangrove: I don't have any specific plans for it myself, I'm open to stealing things from incubator into Korma main if somebody's willing to speak up and say they want something and that it works for them.

16:08 componentization is another thing on my mind.

16:08 justin_smith: bitemyapp: ugh, good to know before I go too far with that route, thanks

16:08 bitemyapp: justin_smith: you just want to be careful when you use the (t/error ex "blah") thingy

16:09 I also find timbre's code a bit...disconcerting.

16:09 the indirection is not very contribution friendly.

16:09 I need to submit a PR for that NPE

16:10 they're doing something that really upsets clj-stacktrace (I guess clj-stacktrace should technically be considered to be at fault?)

16:11 I ended up writing my own exception logging middleware that uses clojure.stacktrace instead of clj-stacktrace and it hasn't broken yet.

16:11 justin_smith: ^^ if that helps.

16:11 justin_smith: bitemyapp: interesting, thanks

16:12 bitemyapp: technomancy: are you maintaining clj-stacktrace?

16:12 justin_smith: I think the real fix may just be a more thread-safe output redirection fornrepl, instead of having to use a full fledged logger just to get printouts

16:12 technomancy: bitemyapp: no =(

16:12 bitemyapp: justin_smith: no doubt. All this stuff is just from my Clojure/Datomic/Ring/Compojure stuff.

16:13 technomancy: what's going on with clj-stacktrace? last commit was you.

16:13 I need to know if this is damage to route around or if it should be fixed and maintained.

16:13 technomancy: bitemyapp: Chouser gave a talk about a new better stacktrace lib he was going to release, so I quit hacking on it and waited for the release

16:14 this was like 18 months ago?

16:14 bitemyapp: :|

16:14 I take it I'm the only one that was fine with clojure.stacktrace? :P

16:15 technomancy: clj-stacktrace works fine for me; I was just going to add filtering out of compiler gunk and other fine-tuning

16:15 but I started using clj-stacktrace backw when clojure.stacktrace was much worse

16:16 bitemyapp: technomancy: I bugged chouser on the twatters.

16:16 technomancy: I don't remember what it's like now, but having color and justification is really great

16:16 bitemyapp: technomancy: well like I said above, with t/error logging in Timbre some Exception instances will make clj-stacktrace throw an NPE and barf.

16:17 technomancy: huh.

16:17 bitemyapp: This is, as you might imagine, unacceptable for something that's supposed to managing my logging.

16:17 technomancy: oh crap; there's an open PR I missed

16:17 bitemyapp: can you see if this fixes your issue? https://github.com/mmcgrana/clj-stacktrace/pull/27

16:17 I can cut a release if so

16:18 bitemyapp: I'll see if I can put a project repro together on the weekend. Have to finish this migration stuff.

16:19 coventry: That's a coincidence, I was just watching chouser's longbottom talk today, and wondering where it is.

16:21 Why doesn't clojure.lang.PersistentVector$ChunkedSeq implement IPersistentList (so that (list?) would return true?)

16:23 dnolen: fun, fun http://cljsfiddle.net/fiddle/swannodette.zebra

16:23 technomancy: coventry: don't use c.c/list?

16:23 it's Not What You Want

16:23 probably coll?

16:23 seangrove: Tiny

16:24 technomancy: list? returns false on many things that are lists

16:24 coventry: technomancy: clojure.test-clojure.compilation uses it, and my walked/transformed clojure.core breaks that test.

16:24 bitemyapp: technomancy: what's the URL to that diagram of which collections return what against different types?

16:25 coventry: technomancy: But thanks for the advice, didn't know that.

16:25 technomancy: bitemyapp: the one about defrecords and stuff?

16:25 bitemyapp: urrrrghhh it was some crazy-old looking page but it had examples of what each type would return for sequence?, list? etc.

16:25 llasram: bitemyapp: It was one of cemerick's

16:25 technomancy: list? should never have been added =\

16:25 bitemyapp: llasram: link?

16:25 llasram: bitemyapp: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/

16:25 That guy?

16:26 Oh, no

16:26 bitemyapp: no, not that.

16:26 llasram: Sorry, not paying enough attention

16:26 bitemyapp: sequence?, list? truth tables for different Clojure coll types.

16:26 t'was a table, was a crazy old looking page

16:26 * bitemyapp grumbles about needing a wiki

16:27 llasram: Remember when people used to "bookmark" things?

16:27 bitemyapp: http://www.brainonfire.net/files/seqs-and-colls/main.html

16:27 ^^ that!

16:27 coventry: ^^

16:27 seangrove: technomancy: I agree

16:28 technomancy: bitemyapp: quick teach it to clojurebot so we'll be able to find it again

16:28 seangrove: technomancy?

16:28 clojurebot: technomancy is always one step ahead of me

16:28 coventry: bitemyapp: Thanks.

16:28 seangrove: Heh, prescience

16:28 bitemyapp: technomancy: I always forget the syntax.

16:29 clojurebot: colls is http://www.brainonfire.net/files/seqs-and-colls/main.html

16:29 clojurebot: In Ordnung

16:29 bitemyapp: ~colls

16:29 clojurebot: colls is http://www.brainonfire.net/files/seqs-and-colls/main.html

16:29 jonasen: dnolen: Cool, the only thing's missing is the cljs port of bblooms fipp so the output would line up nicely :)

16:29 bbloom: ^

16:29 dnolen: jonasen: heh yes

16:31 bbloom: jonasen: for what exactly?

16:32 jonasen: bbloom: http://cljsfiddle.net/fiddle/swannodette.zebra

16:32 bbloom: ah cool

16:32 any idea what the state of the rrb stuff is?

16:34 jonasen: bbloom: I don't think there has been any changes to the library

16:34 lately

16:34 bitemyapp: ,(type (list* 1 2 3 4 '()))

16:34 clojurebot: clojure.lang.Cons

16:34 bbloom: bitemyapp: lol yeah, that made me face palm too

16:34 bitemyapp: coventry: ^^ I take it this is what's draining your sanity lately?

16:35 coventry: bitemyapp: See the issues lists for riddley and sleight. :-)

16:35 dnolen: bbloom: last I heard it basically works

16:36 bitemyapp: coventry: you're contributing to ztellman libraries? You're braver than I thought.

16:36 bbloom: I don't have a strong opinion about the cons cell / PersistentList dichotomy.

16:36 bbloom: bitemyapp: i didn't for a while. now i have a lot to say about data encapsulation: a topic clojure doesn't tackle too much. but that rant is still brewing

16:36 bitemyapp: there was no difference in CL unless somebody was doing something strange, but the difference hasn't truly bitten me.

16:36 Yet

16:37 bbloom: it's a rant I'd like to hear, I'd like to learn more about this and why it was done that way.

16:37 I wonder how hard it would be to convince rhickey to explain the Cons thing.

16:37 bbloom: i don't think there is much explaination

16:37 bitemyapp: maybe he wanted to bootstrap them independently of the persistent data structures?

16:37 bbloom: it's just legacy, afaict

16:38 coventry: bitemyapp: I now have code which can evaluate all of clojure.core and test-clojure into distinct namespaces and run the tests. I am trying to decide how hard to look at the test failures at the moment, as opposed to just getting on with using this wrapping code to write the debugger I started out intending to write.

16:38 The failures probably do hide other errors in the wrapping code.

16:38 s/hide/expose/

16:39 bbloom: if i were to have a vote, all the "abstract" types would have a wrapper object that delegates to the underlying concrete type. so a List could contain an ArrayList (PersistentList) or a LinkedList (Cons)

16:39 a LinkedList and a PersistentList wouldn't be equal to each other, unless they were wrapped in a Lisp

16:39 List* rather

16:39 similarly for maps, vectors, etc

16:39 bitemyapp: technomancy: chrishouser: @bitemyapp I'm afraid attempts to reduce clutter in stack traces are doomed to remove critical detail. What should we do instead?

16:39 technomancy: he's punting. We have work to do.

16:39 clj-stacktrace has to be maintained or replaced.

16:40 technomancy: yeah, obviously you can't hard-code the stack trace cleanup stuff

16:40 bitemyapp: if it isn't, I have to convince pt-toomanyfuckingvowels-nis to replace clj-stacktrace with clojure.stacktrace in Timbre.

16:41 technomancy: I don't even really care about the clean-up, I just want my logger to not crash my application.

16:43 technomancy: bitemyapp: I bet that pull will fix it tho

16:43 will cut a release once you can confirm

16:44 bitemyapp: technomancy: much appreciated. I'll try to get you an answer ASAP.

16:54 technomancy: bitemyapp: the other problem is that "longbottom" (chouser's name) is a lot better than clj-stacktrace

16:57 bitemyapp: technomancy: I agree. Uno momento.

17:08 yeoj___: if i have a function that is the value of a dictionary, how do i call it after i look it up? is that with apply?

17:08 coventry: bitemyapp, technomancy: Based on what he said in http://downloads.mostlylazy.com/episodes/mostly-lazy-006.mp3 (around minute 39) it sounds like he might be OK with someone taking it over.

17:08 yeoj___: ##(({:t inc} :t) 1)

17:09 lazybot: ⇒ 2

17:09 technomancy: coventry: huh; I got the impression it was in legal limbo

17:09 yeoj___: ohh, that must be that ## thing i don't know about yet

17:09 coventry: technomancy: Maybe, but it sounds there very much like he just lost interest. I could be wrong.

17:09 bitemyapp: coventry: I asked him for the name directly.

17:10 technomancy: it sounded on Twitter like he lost interest to me too.

17:10 technomancy: probably both

17:10 bitemyapp: technomancy: What legal limbo?

17:10 coventry: yeoj___: No, the ## is syntax to tell lazybot to evaluate it and report the result here. (({:t inc} :t) 1) should work in the relp.

17:10 technomancy: bitemyapp: needing to get approval for the OSSing process =\

17:11 coventry: ,(({:t inc} :t) 1)

17:11 clojurebot: 2

17:11 yeoj___: coventry: ok, thank you. i'll keep studying that then.

17:11 bitemyapp: technomancy: from whom?

17:12 technomancy: bitemyapp: originally lonocloud, now viasat I guess?

17:12 acquisition complications

17:12 bitemyapp: Hum. Ick.

17:19 sveri: hi, how can i check if something is a sequence?

17:19 rasmusto: ,(some #{1 2 3} [4 5 6 7 1])

17:19 clojurebot: 1

17:20 llasram: sveri: In what sense of "sequence"?

17:20 coventry: sveri: ##(sequential? '(1 2 3))

17:20 lazybot: ⇒ true

17:20 rasmusto: oops, I read an "in" that wasn't there, my mistake

17:20 sveri: coventry: llasram what coventry wrote is what i am looking for

17:20 thank you

17:24 rasmusto: ##(sequential {:a 1 :b 2})

17:24 lazybot: java.lang.RuntimeException: Unable to resolve symbol: sequential in this context

17:24 rasmusto: ##(sequential? {:a 1 :b 2})

17:24 lazybot: ⇒ false

17:24 rasmusto: ##(sequential? (seq {:a 1 :b 2}))

17:24 lazybot: ⇒ true

17:24 rasmusto: ##(sequential? #{:a 1 :b 2})

17:24 lazybot: ⇒ false

17:25 rasmusto: ##(sequential? (sorted-set [:a 1 :b 2]))

17:25 lazybot: ⇒ false

17:25 rasmusto: sveri: I'm curious what you're using "sequential?" for, can you paste the code by chance?

17:26 bitemyapp: ~colls

17:26 clojurebot: colls is http://www.brainonfire.net/files/seqs-and-colls/main.html

17:26 bitemyapp: sveri: ^^

17:26 sveri: rasmusto: i am doing the 4clojure task: http://www.4clojure.com/problem/28

17:26 llasram: I am eagerly awaiting Clojure 1.6 if for no other reason than the end of "reference to field <x> can't be resolved" for `-`-prefixed single-argument protocol functions

17:27 sveri: rasmusto: and i guess i have to check if there is a sequence inside a sequence

17:27 rasmusto: ,(sequential? "123")

17:27 clojurebot: false

17:27 rasmusto: ah, that might be a good use case

17:27 sveri: I haven't solved that one yet, it's one of the few easy ones that is stumping me

17:28 sveri: rasmusto: hehe, i am not sure how to do that, i just started it

17:28 rasmusto: bitemyapp: thanks for the link :)

17:29 scriptor: spoilerish hint for 4clojure 28: try coll?

17:30 coventry: sequential? vs coll? should make no difference for that exercise, but people are right that I was wrong to recommend sequential? so quickly.

17:31 rasmusto: ,(counted? (lazy-seq (range))

17:31 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

17:31 rasmusto: ,(counted? (lazy-seq (range)))

17:31 clojurebot: false

17:31 sveri: well, for me the problem is not to check what i have, but how to concatenate the inside seq

17:31 rasmusto: ,(counted? (lazy-seq (range 32)))

17:31 clojurebot: false

17:32 rasmusto: sveri: how about cons?

17:32 bitemyapp: rasmusto: np

17:32 ,(type (list* 1 2 3 4 '()))

17:32 clojurebot: clojure.lang.Cons

17:32 bitemyapp: ,(list? (list* 1 2 3 4 '()))

17:32 clojurebot: false

17:34 scriptor: sveri: what do you mean by inside seq?

17:34 sveri: i guess cons will do :D

17:34 scriptor: i mean the seqs that are inside the seq

17:35 scriptor: there's also concat

17:35 sveri: thank you all very much, for now i got to go, my kid will be up in 7 hours :D

17:36 cu some time

17:36 rasmusto: sveri: night ;>

17:37 cellist: try checking out the function tree-seq

17:37 rasmusto: yay, seq is flattened, glad I finally figured that out

17:38 cellist: rasmusto: how did you end up doing it?

17:38 rasmusto: cellist: https://www.refheap.com/19680

17:39 probably inefficient

17:39 cellist: This is probably cheating, but i looked at the source of flatten

17:39 ,(source flatten)

17:39 clojurebot: Source not found\n

17:40 rasmusto: ~source flatten

17:40 cellist: oops. Anyway, it's pretty compact. Still trying to understand it, but I'm guessing that's the best way

17:41 llasram: ~flatten

17:41 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

17:41 rasmusto: cellist: hmm, looks cool. I'll have to see what tree-seq does

17:41 llasram: point noted, we're talking about a 4clojure problem though :D

17:41 coventry: flatten is great when you want to yank something out of a tree at the repl, though.

17:41 llasram: Golfing?

17:42 rasmusto: llasram: trying for my first impl, now golfing/optimizing

17:42 (and drinking afternoon tea)

17:43 llasram: Cool beans

17:43 * llasram sips his evening whiskey :-)

17:43 bitemyapp: don't use (apply hash-map (mapcat concat ...)) - just use (into {} ...)

17:44 rasmusto: bitemyapp: into and seq are inverses in some sense, yeah?

17:44 well, except for the key/set-elem duplication stuff

17:45 bitemyapp: ,(doc into)

17:45 clojurebot: "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."

17:45 rasmusto: ah, conj is the culprit

18:23 logic_prog: (require 'eopl.chap01) from user=> in lein works. However, (require 'main) fails when src/main.clj contains (:require eopl.chap01)

18:23 so somehow, I can require eopl.chap01 from lein, but not from src/main.clj

18:23 what am I likely to have done wrong?

18:24 hyPiRion: try (:require [eopl.chap01]) instead

18:26 logic_prog: hyPiRion: same error. However, "user> (ns tstblah (:require eopl.chap01))" works

18:27 seems like I can type anything into the lein repl, and it works, but from src/main.clj, nothing works

18:37 yeoj___: when destructuring using ":keys" is there anyway to retain the : on the front of the name, so it's symbol once i'm in the function body?

18:41 rasmusto: yeoj___: you want the ':' on your symbol name? I'm confused

18:43 yeoj___: rasmusto: yeah thats it

18:43 rasmusto: yeoj___: symbol names can't have a ':' in front, they would be keywords

18:43 yeoj___: rasmusto: ah, ok.

18:44 rasmusto: thanks

18:46 i'm trying to get my head around unquote

18:46 i have a dictionary with instructures (not a function) in the value of a key

18:46 and i want that to be passed to the repl, when i copy and paste a prn it works, but putting a ~ on the front doesn't.

18:47 SegFaultAX: yeoj___: Not clear on what you're trying to do. Paste code. refheap.com

18:47 yeoj___: SegFaultAX: http://pastebin.com/krQBnnD1

18:47 oh, sorry

18:47 i'll put it on refheap.com

18:48 https://www.refheap.com/19681

18:49 SegFaultAX: i'm new to clojure... i have a lot to learn about the correct ways to do things i'm sure.

18:51 sorry i got disconnected

18:53 justin_smith: yeoj___: in '(str type_name ...) in the mssql-to-netezza-dictionary, why do you quote it, and where would type_name be coming from?

18:53 yeoj___: justin_smith: well, i'm sure thats an icky bit..... type_name comes from the destructing in the function call on line 50 i think

18:54 justin_smith: then that should be an fn

18:54 not a quoted form

18:54 so that it can be called with an arg

18:54 yeoj___: I was trying to get a sort of.... put "business rules" in a dictionary thing going

18:54 ok

18:54 so your saing the mssql-to-netezza-dictionary should have keys like "varchar" and values like (fn [] ...)

18:55 rasmusto: yeoj___: it looks like the destructuring should be happening in the mssql-to...dict function instead

18:55 or it should just be a function that takes one argument

18:55 instead of a quoted form as justin_smith said

18:56 yeoj___: ok

18:56 i'll give it a shot and see what happens. i think i had it as a function but i still couldn't execute the function once it was returned.

18:56 let me check.

19:02 hmm... i wanted it to be a lookup... like lookup the logic for this data_type. It's starting to have (cond x ) in there now... i'll get it written then maybe someone can show me the clojure way

19:04 rasmusto: yeoj___: you can have a (fn [something] (lalalala something)) as a map entry

19:04 yeoj___: ;w

19:04 ok

19:14 justin_smith: ,((:a {:a (fn [x] (* x x)) :b (fn [x] (* x x x))}) 2)

19:15 clojurebot: 4

19:16 justin_smith: yeoj___: ^ that demonstrates putting a value retrieved from a map in the calling position to apply it

19:36 lodin: What's the rationale for records not supporting (r :x), only (:x r)?

19:50 logic_prog: is there a good way to do clojure/C interop? I want to have a clojure DSl that can output high performance C code

19:50 and somehow send the datastructures back & forth

19:50 that would make me happy

19:51 r0bgleeson: doesnt sound easy

19:54 gws: logic_prog: https://github.com/bagucode/clj-native did you see that? might be a start

19:57 biggbear: hello everybody

19:59 lodin: logic_prog: Not that I have anything that can help you, but I'm curious: how do you plan to handle the data when crossing language boundaries? Convert (and copy) between representations for each argument/return value for every call?

19:59 biggbear: does anyone is using counterclockwise to create a leiningen template and having issues?

20:01 logic_prog: lodin: yes, probably json

20:07 biggbear: one question folks please: do you know how to import by hand a leiningen project to eclipse?. Please

20:07 lodin: logic_prog: I haven't used JNA, but it seems to me that it shouldn't be necessary to serialize to json.

20:07 coventry: logic_prog: It's not clojure/C interop exactly, but tbaldridge has a talk about a clojure LLVM DSL which does the "output C code" part. Mjolnir is the project name.

20:10 Well, the "output machine code" part, I guess...

20:15 justin_smith: does anyone else thing that clojure.test/are is awful? why not just let an fn and test the results of applying it

20:16 *invoking it even

20:17 coventry: It would really be a lot of extra boilerplate for something like clojure.test-clojure.numbers

20:17 logic_prog: coventry: yeah, saw the talk

20:18 found it a bit "heavy" (requires modifyhing LLVM, I believe)

20:18 coventry: btw, how is your side project going? do you intend to open source it?

20:19 coventry: logic_prog: Once it's reliable enough. Wrapping every form in debugging instrumentation is pretty invasive.

20:20 justin_smith: coventry: my complaint is it parses with a completely different set of rules than I see in any other standard clojure function - the way it breaks up the args into groups of n for example

20:20 well, this is a macro, not function of course

20:21 point being I need to add a bunch of extra special cases to how I read code just for test/are that don't get applied anywhere else

20:22 technomancy: yeah, not a fan of c.t/are

20:51 bitemyapp: technomancy: my coworker looked at me weird when I explained the point of c.t/are to him. I think it shamed me out of using it.

20:51 technomancy: fun fact: it is also the reason clojure.walk is part of clojure

20:52 =\

20:52 justin_smith: wow

20:52 double whammy

20:54 bitemyapp: technomancy: hey, I like clojure.walk.

20:54 I needed it in my project like 2 or 3x :P

20:54 technomancy: it's been publicly disavowed

20:55 bitemyapp: technomancy: where? I can't google it up.

20:55 technomancy: bitemyapp: probably just in this channel

20:56 bitemyapp: technomancy: well I'm not giving up my tree-walkin'.

20:56 technomancy: stuartsierra has his regrets

20:57 justin_smith: is the problem a problem with walking, or with that particular implementation of walking?

20:57 technomancy: I think it's the implementation

21:06 coventry: technomancy: Really? His clojure.walk2 only came up in July, and AFAIK it behaves the same way, just faster.

21:06 *came out

21:07 technomancy: coventry: just speculating

21:07 maybe he has recanted his recantment

21:08 coventry: Actually, there is a bug referenced in the clojure.walk2 README which says "The conditional dispatch in clojure.walk is slow and not open to extension. It also doesn't support records", which counts as a regret.

21:10 justin_smith: (walk/postwalk recant (read-string (with-out-str (source walk/postwalk))))

21:21 akhudek: an alternative to walking might be https://github.com/akhudek/zip-visit

21:22 bitemyapp: I don't have zipped data structures in my case. I needed walk.

21:22 akhudek: ah, right, sorry

21:25 bitemyapp: akhudek: no problem. More libraries is always good :)

21:25 akhudek: bitemyapp: it's pretty easy to create zippers for arbitrary data structures too

21:29 bitemyapp: akhudek: not worth it in my case.

21:29 I did consider it.

21:46 cgag: Anyone have experience with http-basic auth and friend? I'm getting sent straight to my unauthorized handler without ever seeing the basic auth prompt. https://gist.github.com/cgag/6944435

21:46 nmq: Could someone tell my why (mod (math-function/pow 11 23) 187) returns 1.34217728E8 and not 88?

21:47 math-function being in clojure-contrib

21:48 llasram: nmq: Using clojure-contrib implies Clojure 1.2, which is several years old

21:49 nmq: Which unfortunately means few people will probably be able to help you with that specific question

21:49 nmq: But there is the broader issue -- why such an old Clojure?

21:49 nmq: I can use a new version

21:50 Has contrib been rolled into Clojure core?

21:50 newer version*

21:51 akhudek: nmq it was broken into many small libraries

21:51 http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go

21:52 coventry: https://github.com/clojure/math.numeric-tower has expt

21:54 gfredericks: ,(rem (Math/pow 11.0 23.0) 187)

21:54 clojurebot: 1.34217728E8

21:55 gfredericks: ,(reduce #(rem (* %1 %2) 187) (repeat 23 11))

21:55 clojurebot: 88

21:57 gfredericks: ,(let [x (Math/pow 11.0 23.0)] (= x (inc x)))

21:57 clojurebot: true

21:57 gfredericks: nmq: I think we can safely just blame floating point math

21:57 nmq: gfredericks: I agree, lol

21:57 I appreciate the example

21:58 gfredericks: also:

21:58 ,(mod (apply * (repeat 23 11N)) 187)

21:58 clojurebot: 88N

22:10 nmq: Thanks again for this, it helped out a lot, especially to you gfredericks

22:57 ddellacosta: so, this is more of an emacs question, but I figure someone here may know--I'm trying to override the key for nrepl's C-c C-c by using add-hook with nrepl-mode-hook, but no luck: https://www.refheap.com/19684

23:05 amalloy: ddellacosta: is there some reason M-; is a problem for you?

23:05 (also, C-c <any letter>) is reserved for the user, so you could use C-c c and C-c u without fear of conflicting with any (well-behaved) mode

23:06 ddellacosta: amalloy: yes, I suppose I can use M-;, that works just fine, thanks--I'd just gotten used to C-c c

23:06 coventry: ddellacosta: I don't think you want the <> characters in there.

23:06 Esp. for nrepl-mode-hook

23:07 amalloy: M-; is even nicer, because it serves both purposes on a single key

23:07 ddellacosta: coventry: ah, my confusion over what was probably parameters, whoops

23:07 amalloy: yeah, I'll start using that. Not the solution I thought I was looking for, but a better one in any case. Thanks!

23:07 amalloy: heh

23:09 ddellacosta: amalloy: although, nrepl most definitely maps C-c c, I should add. Not sure if that means it is poorly behaved or what.

23:10 amalloy: ddellacosta: no, it maps C-c C-c

23:10 coventry: No it doesn't. You're getting that from somewhere else.

23:10 ddellacosta: amalloy: sorry, excuse me, C-c C-c

23:10 …is what I meant to say.

23:10 amalloy: right. that's not poorly behaved at all

23:10 only C-c c is reserved for you

23:11 ddellacosta: amalloy: ah, I see, thanks. Didn't know about these emacs conventions.

23:12 sorry for the emacs discussion in #clojure, but thank you folks!

23:16 uvtc: Emacs-related question: The readme for nREPL says that it provides both a server *and* a client. In typical usage with Emacs, are we using "the nREPL client", or does nrepl.el play that role?

23:18 ddellacosta: uvtc: if you mean you log into a nrepl session started somewhere else, you are the client in emacs. But you can also start a nrepl server in emacs (nrepl.el). So it can do both, depending.

23:18 depends on typical usage I suppose--I usually connect to an nrepl session started in another repl, in a project dir

23:19 uvtc: ddellacosta, thanks. I'd like to understand the overall architecture here, and I'm not yet currently an nREPL/nrepl.el user.

23:20 saosebastiao: any core.logic users in here?

23:20 I'm trying to understand how to solve a problem

23:21 \list

23:21 ddellacosta: uvtc: this section and the one immediately below it describe the two methods I've used to connect--one is for starting up your own server (nrepl-jack-in) and the other connecting to a running server (nrepl): https://github.com/clojure-emacs/nrepl.el#launch-a-nrepl-server-and-client-from-emacs

23:23 uvtc: ddellacosta, Thanks. Reading that now.

23:27 amalloy: ~anyone

23:27 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

23:27 technomancy: nrepl.el is not a server; it contains a command to launch a server though

23:28 uvtc: technomancy, Right. It is a client that can talk to the server provided by nREPL, correct?

23:28 technomancy: right

23:28 there's only one nrepl server but many clients

23:29 uvtc: What is REPL-y ? When I start `lein repl`, it tells me that it's connected to an nREPL server, but then below that says "REPL-y 0.2.1".

23:30 technomancy: repl-y is a client implemented in clojure that ships with lein

23:30 uvtc: Oh, I see. I can talk to nREPL either using REPL-y (from `lein repl`), or using Emacs (nrepl.el). :)

23:30 technomancy++

23:31 Oh, wait. I forget the syntax here for karma infusion.

23:31 ,(inc technomancy)

23:31 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: technomancy in this context, compiling:(NO_SOURCE_PATH:0:0)>

23:31 uvtc: $(inc technomancy)

23:31 Gah.

23:32 technomancy: or using grench

23:32 uvtc: technomancy, I'm getting there, I'm getting there! Need to understand the basics before facing the Grench! :)

23:36 seangrov`: (inc technomancy)

23:36 lazybot: ⇒ 84

23:38 uvtc: Ah. Thanks, seangrov`.

23:38 ruzu: ,(+ 1 2)

23:38 clojurebot: 3

23:38 uvtc: &(+ 1 2)

23:38 lazybot: ⇒ 3

23:47 SegFaultAX: uvtc: I read that in Tim Curry's voice. Was that intentional?

23:49 uvtc: SegFaultAX, Heh, the Grench was just a red herring.

23:50 SegFaultAX: uvtc: Flames... on the side of my face...

23:50 ruzu: ,(.. System out (println "Cake!"))

23:50 clojurebot: nil

23:51 ruzu: The cake... is a...

23:51 * ruzu cries

23:52 SegFaultAX: ruzu: println has no [meaingful] return value

23:52 Meaningful, even.

23:59 uvtc: Ok. I see. When I just open a file in a regular lein-based Clojure project, and there's no `lein repl` running, if I then do `M-x nrepl-jack-in`, nrepl.el is smart enough to recognize we're in a lein-based project and can have lein start up the nREPL for us?

23:59 Is that correct?

Logging service provided by n01se.net