#clojure log - Dec 18 2012

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

0:15 amalloy: ldh: reloading a defrecord won't modify the behavior of existing instances

0:17 ldh: amalloy: i think that was indeed the issue. passing the instance into the invocation of the protocol function had me turned around a bit, but i think i get it now

1:14 TEttinger: got kinda an odd question... I'm trying to find the exact probability of certain results coming up when rolling "special" dice (a game I play on the tabletop uses specially-marked dice with no numbers, just symbols with rhyme or reason to how many symbols are on each die).

1:14 clojure is my language of choice, so I am trying to solve it in clojure...

1:15 but I am wondering if there is a way to use the for comprehension on a variable number of sequences (determined at runtime)

1:16 like for through 3 8-sided dice, each bound to something temporary in the for

1:16 then for-comprehend through 4 8 sided dice and 2 twelve-sided dice

1:17 to get a map of the symbols that came up in each pass through all dice

1:17 (each die is a vector of vectors of symbols)

1:17 someone did a finite-distributions thing for the old clojure.contrib

1:18 not sure how to get it since it doesn't seem to have source...

1:18 maybe it does

1:18 https://github.com/clojure/clojure-contrib/blob/master/modules/probabilities/src/main/clojure/clojure/contrib/probabilities/finite_distributions.clj

1:29 cark: TEttinger: maybe use the sequence monad instead ?

1:29 TEttinger: cark, never heard of it

1:31 cark: let me have a look and get back to you

1:35 enamanuel: hola

1:37 cark: TEttinger: have a look at this https://gist.github.com/4325580

1:37 is this what you're looking for at all ?

1:38 TEttinger: cark, looks like it

1:38 thanks

1:39 cark: you can find the monad library here : https://github.com/clojure/algo.monads

2:13 tomoj: ":db/cardinality :db.cardinality/ref" hmm

2:16 ":db/valueType :db.type/many"

2:23 ro_st: haha

2:23 late night, or early morning?

2:30 tomoj: likely the later, I don't remember

2:32 brainproxy: anybody using the atmosphere library (websocket, jsonp stuff) with clojure?

3:05 TEttinger: cark: I appear to have shot the garbage collector be making a monad seq with all possibilities for 4 12-sided dice and 4 8-sided dice

3:05 s/be making/by making/

3:07 I get "java.lang.OutOfMemoryError: GC overhead limit exceeded"

3:08 bbloom: TEttinger: google says that's 7.156946e+118

3:08 TEttinger: oh

3:09 well crud.

3:09 guess that's not going to stay in memory

3:09 bbloom: combinatorics: they're big.

3:10 TEttinger: so bbloom, can you figure out a better way to figure out the odds of each specific set of face combinations coming up?

3:10 let me pastebin my code

3:12 mthvedt: how about an fn that adds probability distribution + die -> probability distribution

3:12 and reduce with that

3:15 TEttinger: https://gist.github.com/4326031

3:15 I gotta say, I don't know much, if any, real probability stuff

3:15 ^ mthvedt

3:15 so I don't know how I would work with distributions

3:16 bbloom: TEttinger: boom: http://www.khanacademy.org/math/probability

3:17 mthvedt: TEttinger: convolving probability distributions in discrete domains is easy

3:17 for continuous data it's tricky

3:18 TEttinger: it isn't continuous for mine

3:18 mthvedt: but if your stuff is much smaller than memory

3:18 TEttinger: not now

3:18 i mean it isn't right now

3:18 mthvedt: like to add 2d6, take 1d6, map adding 1..6 and sum

3:19 TEttinger: take a look at the gist, I am probably doing something dumb

3:19 https://gist.github.com/4326031 the meat is in analyze-prob

3:20 mthvedt: well, i don't have time to fine tooth comb things but

3:20 there's a lot of repeated code

3:20 TEttinger: the rest is the standard rolling stuff for a few calculations of the same dice

3:20 yes.

3:20 mthvedt: a clojure programmer should never repeat code :)

3:20 TEttinger: i don't really know macros either

3:20 mthvedt: oh, you should

3:20 bbloom: mthvedt: i wouldn't take that particular statement all the way to it's logical conclusion

3:20 TEttinger: macros aren't necessary here

3:20 mthvedt: but functional programming itself can eliminate

3:21 TEttinger: and there are frequent changes, but easy enough to just rectangular insert the names

3:21 mthvedt: most code repetition

3:21 bbloom: TEttinger: it looks like you're trying to learn both clojure and statistics at the same time

3:21 TEttinger: yeah I am not trying to code-elegantly. i am trying to make it work

3:21 bbloom: TEttinger: I always find it helps to simplify and try to do fewer things at once

3:21 TEttinger: bbloom, yeah

3:22 bbloom: looks like you got the basics of clojure, but need help with the stdlib

3:22 TEttinger: the task should be fairly simple, but my math isn't great

3:22 bbloom: i recommend grabbing the cheatsheet and then doing some problems at 4clojure.com

3:22 ~cheatsheet

3:22 clojurebot: Cheatsheets with tooltips can be found at http://jafingerhut.github.com/ .

3:22 bbloom: ~4clojure.com

3:22 clojurebot: make a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive

3:22 bbloom: er thanks clojurebot, i guess i didn't really need to ~ a domain already

3:23 www.4clojure.com should be clickable :-)

3:23 then mozzy on over to kahn academy and brush up on your probability skills

3:23 TEttinger: i've been using clojuredocs a lot

3:23 bbloom: i recommend you follow some top users on 4clojure, so you can see near functions and tricks they use to solve problems more eloquently

3:23 then try to put the two things together :-)

3:24 s/near/neat

3:24 and get that monad out of there!

3:24 TEttinger: sigh...

3:25 make up your minds!

3:25 bbloom: a bunch of folks in this channel are obsessed w/ monads

3:25 TEttinger: should i use the sequence monad or not?????

3:25 bbloom: i dunno, maybe it's useful

3:25 but you've still got a lot to learn about the std lib before you start venturing out into experimental monad libraries...

3:26 TEttinger: i think i know a fair bit of the std lib, my problems are on tricky things like doseq

3:27 bbloom: you're code has a ton of opportunities to simplify, cleanup, clarify

3:27 your*

3:27 TEttinger: yeah

3:27 I know

3:27 bbloom: i'm not trying to shit on you

3:27 i'm trying to help us help you

3:27 in order to get good advice here, you need to ask for it in small pieces

3:27 TEttinger: the big thing that I am using is a rectangular insert in jEdit. it lets me edit each block as basically one line of code

3:27 got it

3:27 bbloom: this is a pretty big paste

3:28 TEttinger: the issue is almost entirely with analyze-prob

3:28 the rest is just so you can run it

3:28 since it needs multiple inputs, which I provided via a swing GUI

3:28 wei_: how do people deal with multiple build targets using lein-cljsbuild? I find myself having to add two entries (dev and prod) in my project.clj for each page that I want to have clojurescript in. it works but doesn't seem very DRY e.g. https://gist.github.com/4326069

3:34 Raynes: ggreg: What is a pretty big paste?

3:34 bbloom: wei_: I think that most people using cljs are doing singlepage apps

3:34 Raynes: Ugh

3:34 bbloom, not ggreg.

3:35 And I found it, so never mind.

3:35 Damn it, gist.

3:35 bbloom: Raynes: I never mind you

3:35 Raynes: Damn everyone who doesn't use refheap.

3:35 TEttinger: ok, using https://gist.github.com/4326117

3:35 heh just as you say refheap

3:36 wei_: alright Raynes, next time :)

3:36 and I guess I could just dry it up with "map"

3:36 Raynes: https://www.refheap.com/paste/7692 Fixed it for you, TEttinger

3:37 ;)

3:38 bbloom: Raynes: maybe you should write a bot that finds gist posts in here and copies them to refheap :-P

3:38 TEttinger: Raynes, forgot to remove seesaw :usage https://www.refheap.com/paste/7693

3:38 bbloom: we'll just stick a EULA in the channel topic: if you write in here, you assign all copyrights to Raynes, even if it's somebody else's post

3:38 Raynes: amalloy_ has suggested that a million times. I figure people would get angry pretty quickly. That might be a fun reason to do it anyways, see how fast people get annoyed.

3:38 Hahaha

3:41 TEttinger: protip: don't run that code in the latest refheap paste

3:41 just (use)'ed it in a lein repl

3:41 Raynes: You have some very weird formatting.

3:41 TEttinger: yeah, I don't have an auto-format function in jedit

3:41 Raynes: Yikes, jedit for Clojure? That can't be fun.

3:41 TEttinger: so indents are all over

3:42 bbloom: TEttinger: and some sort of weird block edit fetish

3:42 TEttinger: it starts up faster than eclipse

3:42 heh

3:42 Raynes: Also, you are like the smallest minority in the whole Clojure community.

3:42 TEttinger: yeah

3:42 Raynes: First person I've ever heard of using it. :p

3:42 TEttinger: I use eclipse too

3:42 I contributed some code to CCW a while back

3:43 bbloom: TEttinger: if i were to try to make sense of this code, i'd basically have to rewrite it

3:43 TEttinger: yeah

3:43 Raynes: Haha, I was gonna let emacs reformat the code, but realized I was in Windows when I went looking for it.

3:43 I don't have Emacs on this thing.

3:43 nbeloglazov: Hi. I have a performance issue. There is a snippet: https://www.refheap.com/paste/7694 The problem is that clojure works much slower if I use (current-surface) instead of (current-applet). It seems that clojure compiler need to use reflections because (current-surface) can return objects of 2 different types while (current-applet) return object of 1 type and compiler optimizes it.

3:43 How can I avoid this without creating 2 sets of functions - one for current-applet and another for current-graphics?

3:43 bbloom: TEttinger: see if you can get all those "reduce +" lines down to a single map transformation

3:44 nbeloglazov: Can protocol help this?

3:44 bbloom: nbeloglazov: try (set! *warn-on-reflection* true)

3:44 you probably need a type-hint

3:45 nbeloglazov: What kind of? And where? In current-surface?

3:45 bbloom: (doc *warn-on-reflection*)

3:45 clojurebot: "; When set to true, the compiler will emit warnings when reflection is needed to resolve Java method calls or field accesses. Defaults to false."

3:45 bbloom: just set! that to true and run your code

3:45 it will tell you whenever reflection occurs in clj code

3:45 nbeloglazov: Ok, I'll try

3:47 TEttinger: bbloom: you mean turn (reduce + (map #(* (count (filter (fn [c] (= :s c)) (flatten %))) (/ (get freqs %) num-rolls )) kf))

3:47 into a function call on some local function?

3:49 bbloom: TEttinger: start there

3:51 TEttinger: i think the big issue with this code is that I am storing all combinations of all dice in memory at once.

3:51 nbeloglazov: bbloom: yes it shows a lot of reflection warnings when I use (current-surface). Still I need to fix it somehow. Type hints won't help as I understand because current-surface can return values of 2 different types.

3:53 bbloom: nbeloglazov: a typehint basically compiles to a cast (afaict)

3:54 nbeloglazov: you can typehint at the call site, if you know what type you got

3:54 nbeloglazov: or, if the method you need is higher up in the type hierarchy, you can hint with a base type

3:55 debugger98: (def read-data [user-id] (let [sid (shard user-id) entity (symbol (str "shard" sid))] (select entity (where {:id user-id}))))

3:55 sorry should be

3:55 (def read-data [user-id] (let [sid (shard user-id) entity (symbol (str "shard" sid))] (select entity (where {:id user-id}))))

3:55 the entity dones't eval to its real value

3:55 select is a macro

3:56 how should I make entity eval to its value in this function definition

3:56 basically entity is a predefined val in the same file

3:57 just need to shard to the right one according to user id at run time

3:59 oops, s/def/defn/g

3:59 bbloom: debugger98: that would be your issue.

4:00 debugger98: would be very grateful if someone points out the problem, thanks

4:29 adamvh: When I try to start Leiningen, I get the error message "java.lang.NoClassDefFoundError: clojure.lang.Symbol"

4:29 Any idea why this might happen?

4:29 clgv: adamvh: sounds pretty weired. whats you environment? do you start "lein repl" outside a project?

4:30 adamvh: Yes, I get that error outside a project

4:30 I've been running a script with lein-exec

4:30 and it has ceased to work

4:30 for reasons unknown

4:30 clgv: do you have a .lein/profiles.clj?

4:31 adamvh: No, I do not

4:31 clgv: leiningen 2 preview 10 right?

4:31 adamvh: I assume it's the most recent one

4:31 clgv: you can check via "lein version"

4:32 adamvh: I get the class not found error when I run lein version

4:34 clgv: and you are sure there is no project.clj in the directory where you do that?

4:34 then just delete ".lein" and reinstall leiningen

4:36 adamvh: Happens when I try to reinstall leiningen

4:37 I get the "Downloading Leiningen now"

4:37 and the little status indicator

4:37 followed by the class not found error

4:39 clgv: huh? there is something pretty messed up. what did you do before?

4:39 adamvh: Interesting

4:39 It appears that the cluster Java was 1.4

4:40 clgv: uff

4:40 borkdude: :-0

4:40 adamvh: now that I have instructed the cluster to use 1.6

4:40 things seem to be in order again

4:40 It seems they changed the default while I wasn't looking

4:40 clgv: they have legacy software that old running on that cluster? :O

4:40 adamvh: frickin' high performance computing

4:40 what a pain

4:41 clgv: I thought I use an outdated version with java 1.6 ;)

4:41 borkdude: what programming language is 25 years old today?

4:41 clgv: well it still has support until next year...

4:41 adamvh: 1987...

4:41 C++?

4:42 llasram`: Hmm. Perl?

4:42 borkdude: It must be Perl

4:43 someone on twitter said: Happy 25th to the "duct tape that holds the Internet together"!

4:44 I actually know of only one "web shop" which is Perl based in my environment

4:44 clgv: right it is perl according to wikipedia

4:47 adamvh: Oh thank goodness I got that working. Did not want to re-write that script in something else

4:47 clgv: perl is the language where you can have source code that looks like a hash sum ^^

4:48 Iceland_jack: Oh, perl jokes :)

4:49 borkdude: I saw some generated C# code yesterday in which every name was represented by a guid…

4:49 * algernon recalls fond memories of writing code using Acme::Filter::Kenny...

4:49 clgv: borkdude: decompiled? ;)

4:50 borkdude: clgv not even, just generated from some tool

4:51 clgv: ah kk.

5:03 silasdavis: Hello, I'm trying to run a main function with lein run -m messaging.models.message

5:03 but I get: "Exception in thread "main" java.lang.Exception: lib names inside prefix lists must not contain periods"

5:03 the -main function is in a file in the project with (ns messaging.models.message) at the top

5:04 can anyone tell me how to refer to it to get it to run with lein?

5:04 rodnaph: u need to use :gen-class too i think silasdavis

5:04 (in the namespace with -main)

5:05 llasram: No, not with 'lein run'

5:05 nbeloglazov: silasdavis: are you using require,use or refer in your clojure file?

5:07 silasdavis: Same issue: http://pastebin.com/K1tBk2eE

5:07 clojurebot: I think you mean gnir.

5:08 nbeloglazov: Try (:require [monger.core :as mg] [monger.collection :as mc])

5:09 silasdavis: nbeloglazov: thanks, different error: Exception in thread "main" java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to com.mongodb.DB

5:11 nbeloglazov: silasdavis: did you try some examples of using monger? I think you use it somehow incorrectly

5:13 silasdavis: yes I had separately, I'll strip that out, I'd just like this file to run

5:14 how does lein find clojure modules? is it just everything below src?

5:19 nbeloglazov: silasdavis: try to move (mg/connect) inside main function

5:21 silasdavis: it seems to be the find call that is causing the problem

5:23 nbeloglazov: I'm not sure that mg/connect is called when you run -main function. So may be when you call mg/find you're not connected.

5:27 silasdavis: connect is fine outside of main function it seems. I wasn't selecting a database to use

5:27 do you understand why the require statement was causing the 'lib names inside prefix lists' issue?

5:39 ro_st: what's an idiomatic way to gather a flat list into a grouped-by… *checks for a group-by fn in core*

5:40 aha!

5:40 (inc read-core.clj-already)

5:40 lazybot: ⇒ 1

6:13 tomoj: anyone seen the core.logic condp/condw gisted or available elsewhere?

6:14 I found a condr that orders clauses randomly

6:14 https://gist.github.com/2876680

6:14 clgv: tomoj: for better average performance by chance?

6:15 tomoj: I'm thinking about logic programs for card games which involve shuffling

6:16 clgv: oh, wouldnt have thought of that ^^

6:16 tomoj: dunno what the motivations for condr or condp really are, I hear there's a conj talk about condp but don't know if it's available

6:17 no7hing: ,(.foo (proxy [Object][] (foo [] (println "foo!"))))

6:17 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: foo for class sandbox.proxy$java.lang.Object$0>

6:17 no7hing: shouldn't this work?

6:17 clgv: well I think, if you cannot determine the best order of clauses for a given problem or there is not a single one, than condr might improve performance on average

6:19 no7hing: no. you need an interface which contains foo

6:19 or a protocol

6:19 no7hing: this is new in 1.4?

6:19 clgv: does that work in 1.3?

6:20 no, it does not

6:20 no7hing: probably not, i just looked up an example and they all did an override on existing functions

6:20 dammit

6:20 clgv: try: (definterface IFoo (foo []))(.foo (proxy [Object IFoo][] (foo [] (println "foo!"))))

6:21 no7hing: works

6:21 clgv: ah. you definitely need to refer to an interface

6:22 even with protocol (defprotocol IBar (bar [this])) defined you need to use the interface of that protocol (.bar (proxy [Object user.IBar] [] (bar [] (println "bar!")))) assuming it was defined in namespace "user"

6:23 no7hing: silly me thought it'd would be awesome that proxy just creates an ad-hoc interface for me

6:24 clgv: no. I think there is no clojure construct that does that. proxy, reify, deftype/defrecord all need interfaces or protocols...

6:24 tomoj: how do you make a defne fail if an argument is an lvar?

6:24 I expect (l/conda [(l/nonlvaro ?arg) l/fail] ...) to work, but it doesn't

6:24 oh

6:25 I mean, I expect (l/conda [(l/lvaro ?arg) l/fail] ...) to work

6:26 no7hing: no idea what drove me there

6:32 clgv: no7hing: ah :gen-class should be able to define new methods^^

6:36 algernon: is it possible in any way to expose a PersistentArrayMap to Java, so that amap.get("foo") would look up :foo, instead of the string?

6:37 (I have a clojure lib, that ends up producing a map, with keyword keys, I'd like to expose that to Java, preferably by allowing the users to use strings instead of having to know a thing about clj keywords)

6:43 no7hing: clgv: i tried to steer clear of gen-class because of AOT ;)

6:44 clgv: algernon: you can construct clojure keywords

6:44 algernon: like that (clojure.lang.Keyword/intern ns name)

6:47 algernon: clgv: I know, that's what I do now, but that's kind of awkward in this case

6:48 clgv: algernon: well since it caches keywords it should be quite fast. you can write a wrapper aroung the map that automatically does the keyword creation

6:48 *around

6:48 algernon: I have things like for (Object o: s) { Map m = (Map) o; System.out.println(m.get(Keyword.intern("MESSAGE")); }

6:48 clgv: algernon: build the wrapper if you use it frequently in java

6:49 algernon: yeah, that's what I don't know how to.

6:49 clgv: what's the problem?

6:49 algernon: I tried extending PersistentArrayMap (which o is, under the hood), but then I get errors that say it can't be cated to my derived type

6:50 Exception in thread "main" java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to bb.XMap

6:50 stuff like that.

6:50 clgv: no dont do that. there is the golden rule: "Prefer composition over inheritance." one of the main messages of the gang of four book ;)

6:52 algernon: hrm. so, I should create a whole new class, that pretty much just wraps PersistentArrayMap, proxying everything but get?

6:53 clgv: select the interfaces you need and build a class base on them: the constructor gets a clojure map and you implement the interfaces

6:53 algernon: hmmm. that sounds reasonable.

6:53 clgv: so you should have your custom interface which gives you something like: "get-kw"

6:53 algernon: thanks, this'll get me going!

6:54 clgv: keep in mind the principle^^

7:00 bosie: i use "lein midje" to run my midje test cases. works fine except if something fails i get a rather long stacktrace

7:03 example: https://gist.github.com/4327382

7:05 ticking: how much bad style would it be to have a keyword argument that takes a numerical value or a magical keyword

7:05 say (rotate 45 :x 10 :y 5) and (rotate 45 :x :left :y :top)

7:06 algernon: clgv: thanks again, got my desired API to work fine :)

7:06 clgv: algernon: great :)

7:07 ticking: well the semantics seem unclear

7:07 ticking: I would add additional keywords for :left :top

7:08 ticking: clgv: yeah but what would you name them :D

7:09 clgv: ticking: no idea, I dont know what they do

7:09 ticking: provide an anchor around which a rotation occurs

7:10 my thought is that always providing thing like height/2 heigth and 0 is cumbersome when all you want is top bottom and center ^^

7:26 clgv: ticking: how about :vertical and :horizontal then?

7:27 ticking: what do you use for keyword args? pure clojure?

7:27 ticking: clgv: right so you mean one could in theory do (rotate img 45 :x 5 :y 10 :horizontal :center :vertical :top) but in such case x and y will simply ovverride the horizontal and vertical?

7:27 clgv: you mean the calling code?

7:27 clgv: ticking: or you throw an error

7:28 ticking: it should be pure clojure yeah

7:28 clgv: ticking: you can specify either-or in the contract and throw an exception if both are given

7:28 ticking: clgv: that sounds as if there were already code for such thing ^^

8:07 cemerick2: test, sorry

8:09 cemerick: that was bizarre

8:10 ejackson: cemerick: you forked yourself ?

8:11 cemerick: ejackson: I had said something, but it didn't show up in my log, or in the web logs

8:12 once I logged in from the freenode web client, messages from my regular client started showing up again

8:15 ejackson: that is bizarre.

8:28 bosie: how would i be able to pass an arrayseq into clojure.java.io/file ?

8:42 cemerick: bosie: you mean you have a seq containing a bunch of file path parts?

8:43 clgv: cemerick: "friend" does not offer brute-force protection, yet?

8:43 cemerick: clgv: as in, throttling authentication requests and such?

8:44 bosie: cemerick: yes, apply seems to be the thing

8:44 cemerick: bosie: yup, that's what you want

8:44 clgv: cemerick: yeah temporary bans after several attempts

8:46 cemerick: clgv: nope. Would be pretty easy to do in a naive way (which would probably work just fine in nearly all cases)

8:47 clgv: cemerick: would be a nice addition to friend ;)

8:47 cemerick: Things like lock-outs would need to be implemented on a per-workflow and per-credential-source basis though.

8:47 borkdude: (def as (clojure.lang.ArraySeq/create (to-array ["tmp" "test" "textfile.txt"])))

8:47 (apply file as)

8:47 cemerick: clgv: Be my guest. ;-) Should go into a separate library though, at least to start.

8:48 borkdude: meanwhile the question had already been answered and I have figured out how to create an ArraySeq :P

8:49 cemerick: borkdude: just (seq any-java-array) will do

8:49 clgv: cemerick: I did not investigate the internals of friend,yet. you could add it to the list of goals as hint what others may work on

8:49 borkdude: cemerick I knew there had to be an easier way ;)

8:50 I've really not worked with java arrays in clojure, never needed to

8:53 however, the arguments of a vararg function get collected in an ArraySeq

9:19 jsabeaudry: Recommendations for async http server besides aleph (too slow)?

9:26 ro_st: jsabeaudry: atmosphere was in the most recent clojure digest

9:27 no clojure abstraction yet, but it seems to be well liked

9:36 ejlo: has anyone here managed to get the clojurescript browser repl working with node-webkit?

9:40 jsabeaudry: ro_st, great, will try it out right now, I found another one named http-kit but it throws on big files

9:43 samrat: could someone take a look at my attempt to upload files using Dropbox API(its not working): https://bitbucket.org/samrat/jopbox/src/620d223b33b85dbe16b787e653c20d25864f2ca6/src/jopbox/client.clj?at=default#cl-66

9:43 jsabeaudry: ro_st, isn't that a social network api?

9:46 ro_st, oh nevermind, finally found it

9:46 Fauno1: @samrat, Access denied

9:46 Use the links at the top to get back.

9:56 jsabeaudry: Does lein uberjar AOT compile everything by default?

9:56 cark: nope

9:58 actually i think yes, but it will include the source code

9:58 there is the :omit-source true option in project.clj

9:59 jsabeaudry: cark, that will not affect start-up time however, right?

10:00 cark: i don't think so

10:00 but you know, your best bet is to check the content of an ubberjar for yourself

10:01 jar xf myjar.jar

10:01 clgv: jsabeaudry: lein uberjar compiles those files transitively which are required in the namespace with your main method.

10:01 cark: that should unpack it

10:02 samrat: Fauno1: sorry, I've made it a public repo now

10:56 moogatronic: Any emacs exp. people using SublimeText2? I'm looking for a workable setup that gives at least some of the sexp eval, Paren, and general 'integrated' feel that Emacs/nrepl gives. (Mostly to show other people who have 0 emacs experience a working clojure setup that isn't really annoying to work in)

10:59 borkdude: moogatronic no, but maybe eclipse+ccw is good for beginners/no-emacsers too

11:00 moogatronic: borkdude: yeah, though, having had to use eclipse for about 10 years, I would *really* like to avoid inflicting that thing on anyone, especially casual newb-ish programmers.

11:00 ccw itself looks pretty awesome though.

11:01 borkdude: moogatronic maybe light table, but that's not very stable and complete yet

11:01 rkz: what's wrong with the web editor bodil made? it's very noob friendly

11:01 borkdude: moogatronic I recommend ccw to my students, if they don't want to go the emacs road

11:01 rkz: https://github.com/bodil/catnip

11:03 borkdude: rkz now that you mention it, I used it when it was at version 0.1

11:03 rkz gonna try that again

11:03 moogatronic: rkz: nothings wrong, but I am wanting local 'app' editor / configurations.

11:04 rkz: moogatronic: it's local, just runs via browser :)

11:04 borkdude: moogatronic everything runs local in catnip

11:04 in fact Bodil is here, the creator of this

11:04 moogatronic: maybe i'll check it out. does it fire up nrepl from lein and all that stuff?

11:05 borkdude: yeah, I saw her preso at the conj

11:05 borkdude: moogatronic I wouldn't know about nrepl, ask Bodil

11:08 wow, catnip really improved since I saw it

11:08 moogatronic: looks like this may be what i want, based off the read me at any rate. =)

11:10 borkdude: I think I made it crash though, by evaluating (read-line) in the repl… ;)

11:22 Ferdy_: Hi, on behalf of 3 Bsc students competer science I am looking for a thesis project/internship. Is there anyone who can help me or point me in the right direction?

11:23 Fauno1: i'm starting to build my own continuous integration platform in clojure which i could open-source if you're interested

11:23 borkdude: hello Ferdy, I see you are from Delft, how nice

11:23 Ferdy_: =)

11:24 borkdude: borkdude I'm working at hogeschool utrecht and have done some clojure projects with my students

11:24 Ferdy_ I mean… (something up with my typing)

11:24 vijaykiran: Fauno1: interesting - something like Jenkins ?

11:24 borkdude: Ferdy_ would you like to work with a company or within your university?

11:25 Ferdy_: Depends on the project

11:25 borkdude: Ferdy_ doesn't the project depend on what you want in the first place?

11:27 Ferdy_: borkdude True I suppose. However we don't have too clear of an idea of what we want to do. We have to do a project for a third party such as a teacher or company. Either could be interesting

11:29 ciphergoth: Should I have stars either side of the name of my dynamic vars? Is that the convention?

11:29 borkdude: Ferdy_ should it involve clojure and is that the reason why you're asking in here?

11:29 ciphergoth it's convention, but really the metadata decides if it's dynamic from 1.3 onward

11:30 ciphergoth: borkdude: OK - yep noticed that it's now a metadata thing, but wanted to follow the conventions too!

11:30 tbaldridge: ciphergoth: but I think these conventions are "enforced" via warnings these days. So if you have a dynamic var without them it might complain

11:30 ciphergoth: no it doesn't complain

11:30 but it does complain if you put stars without a dynamic marker

11:30 that's how I know about the convention :)

11:31 Ferdy_: borkdude The 3 of us really enjoy working with clojure and think there is a lot of interesting ground not covered in our curiculum. So we would like to do it in clojure but our university doesn't seem to care for clojure.

11:31 vijaykiran: ciphergoth: yeah, it complains the otherway round

11:32 TimMc: Whenever somesome says *earmuffs*, I always think @earmuffs@ instead. :-/

11:32 borkdude: Ferdy_ let's talk private in Dutch if you don't mind, maybe we can exchange some contact details

11:37 crease: is there any way to implicitly specify project-wide namespace stuff in a leiningen profile? Like if I wanted every namespace to require pprint when developing, but didn't want that explicitly in the ns form

11:37 bosie: is there a way to overload functions based on values?

11:37 i.e. i have one parameter and if its nil, do this, if not do that

11:37 moogatronic: bosie: multi methods?

11:38 gtrak: crease: it sounds like a bad idea.. I would just make a utility function for that and put it in a shared namespace

11:38 bosie: moogatronic: lemme check

11:38 moogatronic: you can dispatch on type, value, etc.

11:39 bosie: was hoping for sth like (defn foo [nil] 0 [x] (println x))

11:39 moogatronic: google turns up some pretty good examples

11:39 borkdude: bosie multmethods yes

11:39 bosie: k

11:39 borkdude: bosie or pattern matching

11:40 bosie: borkdude: that was the word i was looking for, thx

11:40 borkdude: bosie defn doesn't support it out of the box, but there's this https://github.com/clojure/core.match

11:40 bosie: borkdude: yup

12:16 crease: gtrak: yeah, probably a bad idea

12:17 gtrak: crease: you could put some require's in a fn in a test namespace, that's probably the easiest thing

12:18 (crease.util/repl-bits) or something like that

12:18 technomancy: crease: you can do that using nstools

12:18 but it's out of scope for leiningen

12:19 I agree it's annoying to have to copy/paste things all around for simple things like pprint; nstools does a decent job of making that better

12:19 gtrak: hrm... I feel like if you're doing repetitive stuff, you'd want to group it into its own namespace... what's wrong with a little indirection?

12:20 joevandyk_: are all the lein project templates embedded in lein? or does it look them up somewhere?

12:20 crease: gtrak: it's not a very principled thing, it's just that my hands start falling off after typing (use 'clojure.pprint) (use 'clojure.repl) a billion times

12:20 technomancy: joevandyk_: it comes with a few templates (see the lein-newnew project) but can download them dynamically from clojars as well

12:21 joevandyk_: technomancy: clojars == rubygems.org?

12:21 technomancy: joevandyk_: more or less

12:21 crease: technomancy: I'll look into that, thanks.

12:21 gtrak: crease: sounds like you need a pprint foot-pedal

12:21 joevandyk_: what's with all the "Could not find artifact lein-ring:lein-ring:pom:0.7.5 in central (http://repo1.maven.org/maven2)" warnings/errors?

12:21 just me?

12:21 crease: gtrak: I'm guessing you're joking but that's actually an awesome idea

12:22 hm

12:22 gtrak: haha

12:22 technomancy: gtrak: yeah actually nrepl middleware or something to auto-pprint things might be worth experimenting with

12:23 TimMc: crease: It really is.

12:24 joevandyk_: i did 'lein new compojure hello', then 'lein run' and i get "No :main namespace specified in project.clj" Shouldn't that be put in the project.clj by the template generator?

12:24 technomancy: joevandyk_: lein looks in central (java-centric repo) as well as clojars

12:24 so it's saying it can't find it in central and is falling back to clojars

12:24 which is kind of silly; the master version is better about only telling you things that matter

12:24 weavejester: joevandyk_: Why would it? There's nothing to run...

12:24 joevandyk_: If you want to start a development server, you can do "lein ring server"

12:25 joevandyk_: weavejester: ah

12:25 weavejester: i'm confused by "there's nothing to run"

12:25 technomancy: joevandyk_: yeah it's not obvious how that template doesn't give you an embedded jetty server

12:26 weavejester: joevandyk_: Well, you're defining a web application, which in Clojure terms means a Ring handler.

12:26 joevandyk_: How a Ring handler is turned into a web server is up to you

12:26 crease: I haven't played around with nrepl middleware much, it looks like the place to go though. and pretty easy to write… I've been wanting a way to throw together queries on projects quickly

12:26 technomancy: I wonder what the numbers are on non-jetty web users

12:27 suspect they're pretty slim

12:27 joevandyk_: weavejester: ah. ok.

12:27 weavejester: The latest snapshot of lein-ring allows you to create an executable jar which uses the embedded Jetty server

12:27 I'll probably release it this weekend, since it seems to work well enough

12:27 crease: tap the foot-pedal, get a tree of all references to a function in a project…

12:27 technomancy: personally I think including a :main in the template would be a good default for beginners

12:28 antoineB: hello, how to import a protocol in clojurescript? (i get " is not a protocol" warning )

12:28 gtrak: crease: I use this in a util namespace all the time: (defn and-print [val] (pp/pprint val) val)

12:28 joevandyk_: What's the best way to learn about the infrastructure parts of clojure? testing, packaging, deploying, organizing, etc?

12:28 weavejester: The README of the template does explain how to get the server started, though maybe a (println) would be useful as well

12:28 technomancy: joevandyk_: start with `lein help tutorial`

12:29 antoineB: i used (ns some.ns (:use [some.other.ns :only [ISomeProto someProtoDef]])

12:29 joevandyk_: technomancy: perfect! thanks!

12:29 technomancy: joevandyk_: clojure-doc.org has some great content too

12:29 gtrak: during threading, it's kinda like a ruby's tap, afaict

12:29 technomancy: tap is doto, isn't it?

12:29 weavejester: technomancy: I'm a little adverse to including a main method in the template, as that combines a method of deployment with the actual code...

12:29 gtrak: yea, suppose so

12:30 weavejester: My preference is to provide different outputs: war file, executable jar, development server, etc.

12:30 technomancy: weavejester: well that's the thing about templates; it's very obvious what they're doing, and the 5% who are deploying to tomcat typically know what they're doing

12:30 so it's easy for them to just strip out the bits they don't like

12:30 in fact people deploying to tomcat are probably a lot less likely to use the template to begin with

12:30 gtrak: doto pprint is more general, you're right

12:31 TimMc: sppy

12:31 weavejester: technomancy: Yes… but templates should also guide users to the "right way" of doing things

12:31 TimMc: (defmacro sppy [form] `(doto ~form (pprint)))

12:32 weavejester: I don't think having a main method in your project is the right way to start out.

12:32 gtrak: it's weird to use doto because I learned as a java interop form

12:32 weavejester: Because you're writing a web application, not a console application

12:33 technomancy: I don't see the point of distinguishing unless you're trying to integrate into an existing legacy environment

12:33 Ember-: hmm, I see no problem in having a main function if you are doing a web application

12:34 amalloy: man, are you guys writing this macro again? you're missing the key feature: (defmacro ? [x] `(let [x# ~x] (printf "%s is %s" (pr-str x#) ~(pr-str x)) x#))

12:34 joevandyk_: technomancy: the 'lein help tutorial' stuff is *perfect*

12:34 technomancy: joevandyk_: swet

12:34 Ember-: in fact, that's the way I'd prefer to do it if app containers would allow it all the time

12:34 technomancy: sweet

12:35 amalloy: er, except i got the two args to printf backwards. you get the idea, i think: print the form as well as its value

12:35 gtrak: amalloy: nice

12:36 weavejester: technomancy: It's not necessarily just legacy environments like servlet containers

12:36 joevandyk_: best way to get autotest-like functionality?

12:36 hyPiRion: joevandyk_: lazytest I think

12:36 technomancy: joevandyk_: keep it in the repl

12:36 ejackson: which profile does leiningen use to find repositories for lein jar ?

12:36 technomancy: for emacs, clojure-test-mode

12:36 joevandyk_: vim?

12:36 clojurebot: Gesundheit!

12:37 weavejester: And the idea is to separate the definition of a web app from the implementation

12:37 ejackson: lein repl finds my nexus repo, lein jar gets upset. I have the repo described in ~/.lein/profiles.clj under {:user ....}

12:37 amalloy: wait, servlet containers are legacy environments now?

12:37 TimMc: amalloy: No, I was just writing the basic version, knowing you'd fill it in. :-D

12:38 weavejester: amalloy: In my view ;)

12:38 technomancy: ejackson: the user repo is the wrong place for repos that you can't build the jar without

12:38 * amalloy makes a note to be less predictable

12:38 technomancy: ejackson: that's what you call a recipe for Works on My Machine =)

12:38 TimMc: amalloy: The background there was wanting to have a pprint version.

12:38 ejackson: hehehe, yeah, rather what I'm discovering :)

12:39 amalloy: yeah. but i never use pprint so i couldn't remember how to get it to write to *out* without just lamely (binding ...)

12:40 TimMc: amalloy: The key is to have that foot-pedal change an atom (I think) so that a (printer) fn returns the right print fn.

12:40 gtrak: I want a write-my-program button on my foot pedal

12:40 amalloy: speaking of which: foot pedal, really? i mean, i'm all in favor of foot pedals, but this sounds more like a job for a keyboard shortcut

12:40 or a keybinding, if you're in emacs

12:41 TimMc: FOOT PEDAL

12:41 It's a mode, not a command.

12:41 Or maybe it should be a set of stops, like on an organ.

12:41 gtrak: I've been thinking of using this for a generic controller: https://github.com/overtone/grid

12:41 now that we're talking about organs

12:42 it even lights up and stuff

12:42 ejackson: technomancy: the problem is that I don't control the source, and the dep in question is not on a public repo. No problem, just host locally in nexus, but now I figure out how to resolve the repo without changing the project.clj.

12:42 technomancy: ejackson: so the source is broken =(

12:43 ejackson: technomancy: alright, I'll go upstream then :)

12:45 crease: foot pedal, definitely. with stops

12:46 I was thinking pressure plates on desk chairs, so you can instruct the repl exactly how pretty to print by shifting your weight

12:47 gtrak: you shouldn' t put buttons on your pedal. finger-pinch

12:47 gtrak: hook up an extra monitor to your tongue: http://www.dailymail.co.uk/sciencetech/article-1210425/Blind-people-able-using-amazing-tongue-tingling-device-bypasses-eyes.html

12:50 TimMc: Ugh, the Daily Mail.

13:12 bosie: is there a way to make midje use nailgun ? the startup times of midje are too slow

13:14 mabes: bosie: you're best bet is to try to use drip since it has lein integration (https://github.com/flatland/drip)

13:14 s/you're/your/

13:14 drip will only save on the JVM start up time though

13:14 joevandyk_: i'm using vimclojure, but i'd love for the output of the repl to go to a different terminal window (or maybe the terminal that's running nailgun. is that possible?

13:15 bosie: mabes: as opposed to?

13:16 technomancy: bosie: you should just start a repl and do all your work in it

13:16 starting a new process just to run your tests is not the way to go

13:17 bosie: technomancy: and then execute midje through the repl?

13:17 joevandyk: technomancy: is there a screencast or something about how to edit code and work with files inside a repl? i'm so used to editing files and running them

13:18 technomancy: bosie: yeah

13:18 joevandyk: hmm... not sure what would be helpful there

13:18 joevandyk: technomancy: you edit functions and save them to files inside the repo?

13:19 technomancy: right

13:20 mabes: bosie: as opposed to JVM start up time + load time of midje and your app. technomancy is right about using the repl.. the newest version of midje has nice repl support

13:21 bosie: mabes: looking at it now

13:23 * technomancy really does not understand why ruby-land is so bad at interactive development =(

13:26 bosie: mabes: can't seem to figure out how to do it in the repl

13:27 antoineB: is there someone here, involved in clojurescript analyzer dev?

13:27 dnolen: antoineB: yep

13:28 antoineB: i get "is not a protocol" error, when i use a protocol imported from another file

13:28 mabes: bosie: this may help https://groups.google.com/forum/?fromgroups=#!topic/midje/XH5WOZFMrAA ... So, in 1.5-alpha3 you can say (load-facts :all)

13:28 antoineB: i suspect the "resolve-var" in cljs.analyzer remove the meta-data

13:31 bosie: mabes: i use alpha3. i load a repl with "lein repl" and do "> (use 'midje.sweet)"

13:31 (load-facts :all) results in "unable to resolve symbol"

13:31 dnolen: antoineB: do you have a minimal reproducible case? Can you make a gist of what you're trying to do?

13:32 antoineB: dnolen: i will test in a repl

13:32 bosie: mabes: clearly i am doing it wrong ;)

13:33 pandeiro: is declare supposed to work in cljs?

13:33 dnolen: antoineB: a little more info would be helpful. Are you running into this problem when using lein-cljsbuild? the clojurescript compiler directly?

13:33 pandeiro: yes

13:36 pandeiro: dnolen: definitely doesn't work in the Rhino REPL on the latest release, cleaning my cljsbuild cache and testing in browser...

13:36 antoineB: dnolen: lein-cljsbuild, i haven't the problem before, but a update to lein-cljsbuild form 0.2.9 to 0.2.10

13:37 *i update form 0.2.9 to 0.2.10 and the problem appear

13:38 dnolen: pandeiro: declare still works - but it seems like it may have issues in the Rhino REPL.

13:39 pandeiro: dnolen: w/ lein-cljsbuild 0.2.10 + :whitespace i get nothing in the output js from declare

13:39 dnolen: antoineB: please create a minimal case and open a ticket.

13:40 pandeiro: declare shouldn't generate any code, it doesn't do anything.

13:40 pandeiro: dnolen: shouldn't it just create the key in the namespace?

13:41 dnolen: pandeiro: I don't see why it should, it's likely to get removed anyway.

13:42 TimMc: dnolen: Because of var hoisting in JS?

13:42 pandeiro: dnolen: i thought of declare as a way of "re-enabling" the JS hoisting behavior we're used to?

13:42 dnolen: TimMc: no because of optimizations.

13:42 pandeiro: declare is meant to be used precisely as it's meant to be used in Clojure, hoisting has nothing to do w/ it.

13:43 it's for forward declarations of top levels

13:44 pandeiro: dnolen: not sure what that accomplishes if the JS interpreter will still trip up on any var that hasn't been actually defined when it is used in code

13:44 dnolen: http://dev.clojure.org/jira/browse/CLJS-444

13:44 pandeiro: k

13:44 dnolen: pandeiro: will look into it, this probably an unfortunate side effect of some dead code elimination improvements.

13:45 pandeiro: dnolen: i had been using declare in the manner TimMc and I alluded to in previous versions of CLJS and i remember it working... so i think you might be right

13:46 dnolen: pandeiro: it's error to use it that way.

13:46 no promises were ever made about unintended uses of declare

13:46 pandeiro: dnolen: hmm, then i don't understand the use case, honestly

13:46 dnolen: pandeiro: forward declaration, that's it

13:46 pandeiro: i mean cljs doesn't really exist apart from the JS runtime

13:47 dnolen: pandeiro: however if you're running into something where the semantics don't line up w/ Clojure then by all means, that's a bug too.

13:47 antoineB: dnolen: https://gist.github.com/4330709

13:47 dnolen: pandeiro: but I can't think of case that doesn't involve ns manipulation where it wouldn't blow up in Clojure JVM

13:47 antoineB: dnolen: i tested it in a fresh project

13:47 pandeiro: dnolen: hard to assess, because in my mind 'forward declaration' and function housing in JS are practically synonymous, albeit achieved by different means

13:48 dnolen: pandeiro: that's not what it means

13:48 pandeiro: there are no hoisting semantics to `declare` in clojure at all

13:48 antoineB: just also notice that the command "lein cljsbuild once" don't end (don't give me back the bash)

13:48 dnolen: pandeiro: using any top level name before def or declare is an error. it's that simple.

13:49 pandeiro: dnolen: ah no, you're misunderstanding me: i am doing (declare foo) and then (defn foo ...) later in the namespace file

13:49 dnolen: antoineB: that's a lein-cljsbuild bug.

13:49 pandeiro: and JS trips up regardless with an undefined error

13:49 antoineB: dnolen: you mean the "once" command or the warning?

13:50 for the "once" it's a cljsbuild bug

13:50 pandeiro: dnolen: i understand the semantics are different, but functionally, the two mechanisms allow for the same common coding technique: defining things later in the file than they are used, ie code organization

13:50 dnolen: pandeiro: heh, ok, I thought we were talking past each other.

13:51 pandeiro: attach a minimal case not at the REPL that demonstrates what you're talking about. Though that seems weird since we're using declare in core.cljs and not seeing any undefined issues.

13:51 pandeiro: to the ticket

13:51 pandeiro: dnolen: k, will do

13:51 dnolen: commen to the same ticket as yours, or new ticket?

13:52 dnolen: pandeiro: i'll change the ticket title.

13:52 pandeiro: done

13:53 antoineB: can you include the error you are seeing in your paste?

13:53 antoineB: i made a comment

13:55 cljsbuild 0.2.10 use ClojureScript version 0.0-1552.

13:57 dnolen: if you look like at the error message, you go into "extend-type" macro

14:01 dnolen: antoineB: are you sure there is not a type involved here, I just tried it and it works for me no error

14:01 type -> typo

14:02 antoineB: dnolen: do you use cljsbuild?

14:03 dnolen: antoineB: yep 0.2.10

14:03 pandeiro: feel free to comment on this ticket, http://dev.clojure.org/jira/browse/CLJS-444

14:04 pandeiro: dnolen: i'm afraid it was user error on my part, expecting "hoisting" behavior, as you pointed out

14:04 sorry

14:04 it's because in JS, I can call a function before it's defined

14:04 and in Clojure, declare really doesn't allow that

14:04 sorry to waste your time with that

14:04 dnolen: antoineB: if you're certain you can reproduce - it's easiest if you can make a project that illustrates the issue, then I can clone that and try it out using your exact setup modulo OS & JVM environment

14:04 pandeiro: but the Rhino REPL really does barf on (declare ...) in any case

14:04 not sure that's a major bug

14:05 dnolen: pandeiro: ok, updating the title.

14:05 antoineB: dnolen: ok

14:05 dnolen: pandeiro: it's a bit annoying for interactive dev

14:05 harob: Hi all, I wanted to get your thoughts on a recurring problem in my code: I often want to have alternating computations and side-effecting statements (e.g. logging of the intermediate computed results). The way I do that now is with "fake" let variables, but it seems really hackish:

14:05 let [a (compute-a)

14:05 _ (log-a a)

14:05 b (compute-b a)

14:05 _ (log-b b)

14:05 ...]

14:05 The other way I can think of would be to have many nested let statements, and do the logging in the implicit do's, but that makes the code even less readable. Is there a better solution for this?

14:05 technomancy: harob: 0) please use a paste site like gist or refheap; 1) try (doto (compute-a) log-a)

14:06 pandeiro: dnolen: i really wanted to be able to define an "on-ready" fn for initiating my app, but throw that definition at the bottom of the file, after the more 'important' code, which is something i could do in JS of course

14:08 dnolen: pandeiro: I don't see how that problem isn't solved w/ declare.

14:08 harob: technomancy: got it for gist! doto sounds good, although I would have as many doto statements as intermediate variables. I think ideally there would be a higher-level construct similar to let but that supports skipped

14:08 joevandyk: what is "trampoline", as in "lein trampoline"?

14:08 harob: expressions

14:08 borkdude: you could also let the logging function just return its argument… let [a (log (compute a))] …, don't know.. is that evil?

14:09 technomancy: joevandyk: it's a way to avoid having both Leiningen's JVM and the project's running at the same time

14:09 hyPiRion: borkdude: it's okay for debugging at least

14:09 technomancy: joevandyk: Leiningen enforces a separation between your code and its code, which is pretty different from ruby. it tries to be as transparent as possible, though there are a few necessary exceptions.

14:09 hyPiRion: But purists/functional extremists may want to hunt you down

14:10 borkdude: hyPiRion we can wrap it inside an IO monad anytime, to hide the evil

14:10 pandeiro: dnolen: (declare on-ready) (defn do-stuff []) (on-ready do-stuff) (defn on-ready [f] (set! (.-onload js/window) f)) <-- this won't work b/c the call to on-ready comes before the definition

14:10 squidz: can anybody point me to some code using enlive for html templating?

14:11 pandeiro: dnolen: which is expected, right? same would happen at the clj repl

14:11 antoineB: dnolen: for my test project, i find the typo, i used a .clj instead of a .cljs

14:12 dnolen: pandeiro: yeah that won't work.

14:12 squidz: so far Ive mostly found tutorials on how to use enlive for scraping, but I would really like to see real examples of it being used for templating

14:12 TimMc: squidz: Here's some I wrote recently: https://github.com/timmc/pellucida/blob/master/src/org/timmc/pellucida/listing.clj

14:12 squidz: TimMc: thanks

14:12 dnolen: antoineB: good to hear it's not a bug in CLJS that would have been a bad bug :)

14:13 pandeiro: dnolen: so basically i was asking for JS weirdness to be brought into CLJS and was appropriately scolded by you ;)

14:13 TimMc: squidz: I found Enlive to have a long learning curve.

14:13 joevandyk: technomancy: hm, if I use lein 2 with heroku, 'lein deps' doesn't seem to be ran automatically?

14:13 harob: By the way, is the let-with-fake-undercore pattern acceptable in the clojure community? I saw it in the Emerick-Carper-Grand book.

14:13 squidz: is it worth it in the end? Normally Ive only really used java's wicket, i'm guessing it's much different

14:14 technomancy: joevandyk: correct; running deps hasn't been necessary for a long time

14:14 borkdude: squidz here is something from a project of mine https://www.refheap.com/paste/7701

14:14 dnolen: pandeiro: heh hopefully not scolded. I was confused by you asking for something clearly not allowed in Clojure.

14:14 TimMc: squidz: I'm not familiar with Wicket. I like Enlive's separation of HTML and transformation.

14:14 squidz: borkdude: thanks

14:14 harob: squidz: The Programming Clojure book has an excellent tutorial on Enlive, much better than I found online. And yes, it is worth it?

14:14 joevandyk: technomancy: ah. on the first request to heroku, it starts downloading all the dependences, which takes a minute or two

14:14 pandeiro: dnolen: i was totally trying to get hoisting into cljs :)

14:14 joevandyk: (while the request hangs)

14:14 technomancy: yeah

14:14 joevandyk: which doesn't happen with lein1

14:15 technomancy: hm; should be the same

14:15 squidz: harob: thanks for the tip, ill take a look at it

14:15 TimMc: borkdude: Combining Hiccup and Enlive, there?

14:16 borkdude: TimMc yes, is that evil also?

14:16 TimMc: Well, it certainly startled me.

14:17 borkdude: TimMc it's called pragmatic instead of pure ;)

14:18 TimMc or a lack of enlive knowledge, probably that

14:18 technomancy: enlive is hard =\

14:18 squidz: why is it so hard?

14:19 technomancy: it's not documented and the conceptual model behind it is difficult to grasp

14:19 squidz: ah, okay, so the documentation is really a problem i guess

14:20 I thought my google-fu just wasn't sufficient

14:20 technomancy: all the docs for it I could find were like "here, do it like this" rather than explaining what was really going, which leads to copy/paste coding rather than real understanding

14:20 *going on

14:20 borkdude: yes, I agree. there is documentation, but it lacks examples

14:20 squidz: technomancy: you used to program ruby if I remember corrrectly, how long did you do ruby?

14:20 technomancy: squidz: around 2005-08, and I've picked it up a bit again for work

14:21 squidz: okay, are you happy with almost completely moving over to clojure?

14:21 technomancy: I'm much happier working in Clojure, but there are still some things the JVM is rubbish at

14:21 callen: technomancy: other than scripts, what?

14:22 squidz: interesting

14:22 technomancy: callen: subprocess management and unixy things primarily

14:22 disposable processes

14:22 callen: technomancy: oh yes.

14:22 borkdude: compared to most template libraries, Enlive is black magic in a bad way.

14:22 squidz: has learning clojure changed the way you program ruby now

14:22 callen: borkdude: I'd rather use Fleet or Stencil.

14:22 technomancy: the codebase I manage at work is practically all messing with subprocesses and SSH

14:23 Ember-: well, it did get better though, process management with java at least

14:23 callen: I'd *really* rather have something like Play or Django/Jinja templates though.

14:23 squidz: callen: what templating engine do you recommend?

14:23 technomancy: squidz: well I never wrote "proper" OOP ruby to begin with

14:23 borkdude: callen I like css selectors and total separation of html and templating

14:23 callen: squidz: Fleet or Stencil, to taste.

14:23 Ember-: not saying it couldn't be better though

14:23 technomancy: just a bunch of methods on modules

14:23 callen: borkdude: yeah uh, what you just said doesn't mean what you think it means.

14:23 borkdude: think carefully to yourself about the implications of writing backend code that complects CSS classes with passing data to the frontend.

14:23 borkdude: how much does that make really?

14:24 further it makes the ludicrous assumption that templating is only needed where HTML or XML are involved.

14:24 how much sense*

14:24 borkdude: callen what do I think it means?

14:24 TimMc: squidz: Enlive requires you to be *really* comfortable with higher order functions if you want to do anything non-trivial.

14:24 callen: borkdude: backend code should not care about CSS classes on the frontend.

14:24 I have great news though, you see, the world found a better way.

14:24 squidz: TimMc: so it enforces good practice?

14:24 borkdude: I feel a religious debate is coming up

14:24 TimMc: No, it' just requires a certain way of thinking.

14:24 callen: It's called passing a map or dictionary of data to the template-side. works great.

14:25 hyPiRion: Oh, it's almost time for the quine to reappear.

14:25 borkdude: callen that is basically how you use a deftemplate I guess?

14:25 squidz: callen: what do you use for making sites instead of enlive?

14:25 callen: technomancy: that doesn't surprise me that work there involves that amount of mucking about.

14:26 squidz: usually Stencil, mostly because of refheap (raynes), but I've tinkered with fleet and been fairly impressed.

14:26 technomancy: callen: our platform is all based around HTTP applications, and I'm stuck maintaining an SSH-based app =(

14:26 callen: Fleet is analogous to JSP for Clojure.

14:26 amalloy: hyPiRion: Raynes removed the timer because he is a spoilsport who thinks that a message every 16 hours is spammy

14:26 hyPiRion: Unless Raynes killed it.

14:26 oh

14:26 TimMc: squidz: http://clojure-log.n01se.net/date/2012-11-29.html#00:38

14:26 squidz: t

14:26 TimMc: thanks

14:27 hyPiRion: Well, I don't mind. Did he remove timers altogether?

14:27 TimMc: That was my insight.

14:27 technomancy: I'm working on a replacement with HTTPS-based git, but HTTP really sucks for this kind of thing in a number of ways

14:27 hyPiRion: $timer 0:0:1 foo

14:27 lazybot: Timer added.

14:27 foo

14:27 TimMc: muahaha

14:27 callen: "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan <--- this applies to Enlive.

14:27 technomancy: not the least of which being lack of support for client-side SSL certs

14:27 * dnolen doesn't find Enlive confusing, but does wish it had a CSS parser to support standard selector syntax.

14:28 callen: dnolen: you are the guy behind core.logic/match, nobody expects you to find things like that difficult.

14:28 TimMc: amalloy: If he had removed timers altogher, I'd stage a civil disobedience action by tossing clojurebot a lazybot-flooding command.

14:28 hyPiRion: echo Gotta love echo

14:28 borkdude: I like enlive, only more examples would be welcome.

14:28 callen: dnolen: nevertheless, I have things I want to make. I'd like to make them in Clojure rather than Python. Sadly the state of templating on Clojure makes a compelling argument for not using Clojure. I'm not the only one who feels this way.

14:28 hyPiRion: Oh, he removed that one. Smart guy.

14:28 dnolen: callen: a lot of people seemed to enjoy my old tutorial - http://github.com/swannodette/enlive-tutorial

14:29 callen: I think the primary issue is the lack of more good documentation and example usages

14:29 callen: dnolen: I am of course familiar with it, as I followed along with it when I originally tried to learn Enlive.

14:29 dnolen: no, I'm sorry but it's really not. It's a fundamental property of the design.

14:29 TimMc: dnolen: It didn't help me, but I haven't gotten my own understanding tight enough to write my own tutorial. :-P

14:29 Ember-: I know this isn't exactly about templating in clojure, but we are currently super happy in using clojure+noir+angular.js combo

14:29 lazybot: Gotta love echo

14:29 callen: dnolen: performing whole comprehensions/transformations of the HTML is unnecessary and complecting HTML markup with data injection is insane.

14:29 TimMc: (inc lazybot)

14:29 lazybot: ⇒ 11

14:29 TimMc: Ember-: Shouldn't you be using ember.js? ;-)

14:30 dnolen: TimMc: callen: heh fair enough, I tried my best to explain.

14:30 Ember-: development is super speedy, it's ridiculous how much you can achieve with so few lines of code and it's SPA all the way

14:30 callen: Ember-: I'm considering side-stepping the insanity of templating by making it a 100% single-page-app

14:30 technomancy: hiccup forces you to be disciplined about not mixing logic and presentation, but is that really too much to ask?

14:30 hyPiRion: Wow, was lazybot in the kitchen when I echoed or something?

14:30 Ember-: TimMc: hehe, true that. But it's inferior imho :)

14:30 callen: go for it

14:30 I've done 100% SPA stuff for 2-3 years now

14:30 technomancy: all that practice clojure devs have separating side-effects from functional values helps

14:30 Ember-: ain't going back without a good reason

14:30 TimMc: I hate single-page apps.

14:30 callen: Ember-: I just resent being forced to do so. I don't believe in 100% SPA or 100% server-side.

14:31 Ember-: I also don't like that in 100% SPAs how much work I have to do to make it behave like a normal webapp

14:31 TimMc: Maybe with a proper history mechanism...

14:31 callen: so that it doesn't break user expectations

14:31 joevandyk: has anyone done any work with postgresql returning json to clojure? seems like it might be a natural fit.

14:31 callen: TimMc: that exists bro

14:31 dnolen: callen: perhaps, but different projects have different needs. Enlive does make getting pure CSS and HTML from designers feasible. You have Hiccup at the other end of the spectrum of designs.

14:31 Ember-: callen: like a "normal" webapp?

14:31 huh?

14:31 TimMc: Ember-: <a href...>

14:31 history

14:31 technomancy: joevandyk: I think that would depend on the underlying jdbc driver

14:31 tbaldridge: (inc dnolen) I don't linke enlive much but that feature is hard to beat

14:31 Ember-: TimMc: those are done by the spa libraries

14:31 for you

14:32 technomancy: joevandyk: when I looked into hstore (a similar feature to json) the JDBC support was really half-baked

14:32 haven't tried json yet because IIRC heroku postgres doesn't have it yet

14:32 callen: dnolen: I understand fully why people like Enlive, but it's not appropriate for working on webapps where you have a frontend guy.

14:32 borkdude: what the heck is a SPA webapp? a single page application web application?

14:32 Ember-: I built one myself actually, unfortunately proprietary

14:32 borkdude: hehe, nitpicker

14:32 callen: borkdude: JS-driven navigation, history, templating, state transition web app.

14:32 TimMc: SWPA

14:33 single world wide web user-agent page view application

14:33 Ember-: borkdude: but if you did not actually know SPA then think it as fat client on browser

14:33 dnolen: callen: sure, I agree it's not applicable in many cases.

14:33 borkdude: Ember- I have tried GWT for a while, so I think I know what it means … (yikes)

14:34 Ember-: no, GWT is not SPA

14:34 callen: dnolen: for someone who's mostly trying to build web apps, that's most cases.

14:34 squidz: and some of you have made SPAs in clojure?

14:34 callen: borkdude: ...no.

14:34 Ember-: and it's bad. Cool hack, but bad

14:34 squidz: \o

14:34 but using plain javascript, not clojurescript

14:34 borkdude: well GWT generates a single page application

14:34 callen: squidz: SPAs aren't all that special when it comes to backend. You're mostly kicking around JSON.

14:34 squidz: Ember-: why not clojurescript?

14:34 callen: squidz: the frontend is usually the more interesting part.

14:34 joevandyk: technomancy: that's too bad :(

14:34 Ember-: squidz: learning clojure still, babysteps :)

14:34 callen: squidz: because you lose convenient access to a lot of really nice libraries.

14:34 Ember-: and that

14:34 callen: squidz: using JS libraries from CLJS can be really irritating.

14:35 that's why JayQ exists.

14:35 technomancy: joevandyk: that was over 6 months ago though; maybe it's gotten better

14:35 dnolen: callen: I've worked on projects where there is no front end person, just designs in HTML/CSS. So it doesn't work in your experience. But perhaps it works in other people's experience. In anycase, not worthy of extended discussion.

14:35 callen: dnolen: I'm just so tired and frustrated with the state of templating being so utterly broken that it shifts the pragmatic decision back over to using Python for my projects.

14:36 TimMc: callen: I still want a pony that can generate markup either on the client or server, depending on whether JS is enabled on the client.

14:36 callen: I hate that I can't reasonably choose to use a great language because batteries aren't included for a critical component of making a web app.

14:36 Ember-: use angular? :) Not that I weren't a fan of separation of concerns in layout and templating logic

14:36 callen: TimMc: I could think of a few ways to go about that. The JS enabled thing is rough though. noscript on the client means you'd be doing an image load callback or something which is effin' weird.

14:37 Ember-: wicket has a great idea, not a fan of wicket and it's hugely verbose way of doing things (plus it's trying to do too much, contain state in backend)

14:37 but the component mapping to html is great in it

14:37 callen: I don't want anything that involved, complicated, or holistic.

14:37 Ember-: similar and elegant solution to clojure would be awesomesauce

14:37 squidz: wicket is all ive use so far but i actually like it

14:37 technomancy: Raynes: how's that enlive-like lib coming anyway?

14:37 callen: I want a template library made by somebody who seems to have experience with writing web apps for a living.

14:37 technomancy: callen: ^

14:38 squidz: just seems very Object-Oriented

14:38 solussd: enlive works wonderfully for me working with our front end guy. I "fill in the blanks" with enlive.

14:38 i cant imagine anything better than "pure html" templates… I hate most templating languages

14:38 Ember-: callen: I hear your pain and suffering. Unfortunately I don't see the need anymore with advanced client side templating libraries

14:38 or well, if you need to support browsers without javascript

14:38 TimMc: callen: image load callback? I just mean render the whole page on the server side on first load, then incrementally update the page via either client or server rendering when I capture clicks.

14:39 borkdude: Ember- what does this component do?

14:39 craigbro: switches from enlive to jsoup

14:39 Ember-: borkdude: could you elaborate?

14:39 craigbro: enlive is sloooooooow for large tempaltes

14:39 callen: TimMc: you'd want this to be holistic I take it?

14:39 Ember-: what component

14:39 callen: http://jinja.pocoo.org/ <--- first example. That's how template inheritance, overrides, loops, and map/dictionary data access work in Jinja. Enlive and Hiccup do not compare favourably.

14:39 borkdude: Ember- from wicket

14:39 ivan: is there a better way to define step functions than condp <=?

14:39 Ember-: borkdude: ah

14:39 craigbro: Jsoup can do many of the same things, and I can avoid the cost of converting eveything from java objects to vectors

14:40 Ember-: component is a core concept in wicket, it can do pretty much anything

14:40 it can populate text for example into <p> or any html tag

14:40 dnolen: callen: to be honest, it's a known issue. I had a chat w/ Jen Myers (who works at Relevance) at the Clojure Conj. Clojure's web story as far as gracefully integrating w/ modern front end dev practice is still evolving.

14:40 callen: It's all simple, it works how you expect it to, no crazy CSS-reach-in, no need to touch backend.

14:40 Ember-: or it can contain it's own html snippets

14:40 squidz: for me wicket is kind of like developing a swing/swt app

14:40 Ember-: and stuff like that

14:40 squidz: it is, but it has a huge problem

14:40 1) java and it's verbosity with anonymous classes

14:40 ibdknox: callen: https://github.com/weavejester/comb

14:40 dnolen: callen: fingers crossed she gives a talk about this at Clojure/West, it's an important topic

14:41 callen: dnolen: I've talked to the author of another template library about it, he's thinking about a potential equivalent to something like Jinja.

14:41 Ember-: 2) it's trying to do too much: it contains the UI state at server side in HTTP session

14:41 callen: ibdknox: looks a lot like Fleet. Thanks for sharing this!

14:41 Ember-: and due to this it has a LOT of magic under the hood which will bite you in the leg sooner or later

14:41 ibdknox: callen: it is *much* better than fleet

14:41 Ember-: pretty much the same as Hibernate

14:41 squidz: Ember-: Ember- yes I dont like #2

14:41 borkdude: Ember- is that like webforms in ASP.NET?

14:41 callen: ibdknox: oh, just wondering, what does it do better?

14:41 ibdknox: callen: the impl is like 60 lines

14:42 callen: it's very fast

14:42 Ember-: borkdude: not familiar with webforms

14:42 borkdude: http://wicket.apache.org/learn/examples/

14:42 you can view the source code from those

14:42 callen: ibdknox: the real question is, what would it take to build this up to something appropriate for writing templates for a web app.

14:42 ibdknox: looks really promising.

14:42 Ember-: it's overly verbose and I don't like it

14:42 callen: seems like you'd still need to build up the machinery for things like template inheritance, injection, overrides, etc.

14:42 Ember-: I mean, we have this search functionality in our app with clojure+angular

14:43 squidz: Ember-: wicket makes doing ajax pretty simple though. Ive never done ajaxy stuff outside of wicket, but I needed zero experience to get ajax enabled components up and running

14:43 ibdknox: callen: you have the full power of clojure, you'd just need a couple convenience functions for those things :)

14:43 Ember-: we have a fully functional search from 3rd party API to browser with less than 20 lines of clojure, 15 lines of javascript and 15 lines of HTML

14:43 TimMc: ivan: "We're sorry, #clojure is currently closed for our monthly templating argument. Please leave a message and we'll get back to you when we return. *beep*"

14:43 craigbro: oi

14:43 ivan: TimMc: no problem ;)

14:44 callen: ibdknox: yeah I think I might give this a whirl. Thank you very much.

14:44 Ember-: 3rd party server takes in a HTTP request, returns XML

14:44 technomancy: (inc TimMc)

14:44 lazybot: ⇒ 23

14:44 technomancy:

14:44 callen: (inc TimMc)

14:44 lazybot: ⇒ 24

14:44 ibdknox: (dec

14:44 (dec TimMc) ; #Clojure is not a place for humor :p

14:44 lazybot: ⇒ 23

14:44 TimMc: haha

14:45 I mean

14:45 ibdknox: also your karma is getting too high. Gotta take you down a peg ;)

14:45 TimMc: "Yes sir."

14:45 I would never laugh in #clojure.

14:45 craigbro: guffaw?

14:45 mdeboard: This is very serious business.

14:45 amalloy: we need a movie-preview announcer's voice to narrate the upcoming KARMA WARS

14:46 pjstadig: "In a world were karam is the most valuable commodity..."

14:46 ibdknox: haha

14:46 squidz: Ember-: so you said you were using fleet mostly right?

14:46 hyPiRion: Say I have the following form: (let [a (foo ?a?)] a). What is the idiomatic way of getting ?a? to point to a here?

14:46 TimMc: ivan: Is your step function returning existing values, or is this more of a control flow thing?

14:47 Ember-: squidz: fleet? not familiar

14:47 * Ember- is still a Clojure noob, learning though

14:47 squidz: Ember-: sorry, what do you normally use instead of enlive?

14:47 Ember-: ah right, you come from javaland?

14:47 Ember-: we use enlive for XML parsing

14:47 yes, been working in a real project with clojure a bit over two weeks now

14:47 ivan: TimMc: existing values

14:47 Ember-: before that, just random hacking

14:48 nothing even remotely serious

14:48 amalloy: hyPiRion: wat?

14:48 ivan: TimMc: it just seemed like a common thing that should exist in some library rather than as code generated by condp

14:48 borkdude: just println to the HTTPServletResponse's outstream guy's, who needs static html files anyway.

14:49 Ember-: squidz: ok, fleet looks like a templating library. No, we use angular.js

14:49 and it's templating

14:49 simple, efficient. But does not separate layout from templating

14:49 TimMc: ibdknox, callen: comb doesn't have any facility for output escaping. o\__/o

14:49 Ember-: but it does it's templating with style (although I'm not very happy with all the curly braces)

14:50 ibdknox: TimMc: I'm pretty sure with a 60 line codebase it could be added trivially :p

14:50 bbloom: ivan: how about (some pred vector) where vector is a vector of [threshold value] pair or something like that, and pred checks the threshold

14:50 ivan: some returns the first item to match the predicate

14:50 TimMc: I can't believe people are still writing templating libs that are not XSS-safe by default.

14:50 Ember-: I really should try LightTable in our project

14:50 bbloom: or you can do (first (filter ...)) to be clearer

14:50 Ember-: have been mostly using the instarepl in it

14:50 ibdknox: which is awesome :P

14:50 ivan: bbloom: thanks. I'll give that a try.

14:50 callen: TimMc: fuck it, XSS doesn't even real.

14:51 TimMc: ...

14:51 egghead: xss safe ? like what -- xss is a lot more than just escaping <>

14:51 callen: TimMc: well gee willikers we wouldn't be considering using such evil stygian tools like eval'ing unescaped strings all over the place if we had decent template libraries...

14:52 TimMc: Oh... kay...

14:53 hyPiRion: amalloy: nevermind, I think I'll have to work with Y-combinators to make this work

14:53 llasram: callen: OOC, since you have strong opinions about how templating libraries should work, are you developing one?

14:53 TimMc: egghead: I don't mean such as stopping people from doing eval(location.hash.substring(1)) -- just basic context-aware escaping.

14:53 Or even just plain ol' escaping by default.

14:53 callen: llasram: I'm awful at parsers. I actually said this to the author of Stencil, who's already planning to make the sort of template library I have in mind.

14:53 Ember-: callen: write your templating with clojure :)

14:53 lisp is trivial to parse

14:53 callen: llasram: but until he does, I'd like to convey my suffering to the rest of you.

14:54 Ember-: that's called Hiccup.

14:54 hyPiRion: amalloy: I realised that I was asking how I could pass the result of a value as a parameter to the function call which realized the value

14:54 Ember-: callen: yup

14:54 but do it the way you like it :)

14:54 callen: That...is not what I have in mind.

14:54 hyPiRion: Since Clojure can't send unbound variables, that's rather hard.

14:54 callen: Ember-: http://jinja.pocoo.org/ I want this.

14:54 jkkramer: callahad: https://github.com/sjl/dram - release date TBD

14:54 Ember-: callen: no offense, but that looks horrible to me :)

14:55 just what I *don't* want to use

14:55 jkkramer: oops, callen ^^

14:55 ro_st: what's wrong with Hiccup?!

14:55 callen: Ember-: well, Jinja and Django templates have suited many projects for me for the last 4+ years.

14:55 TimMc: hyPiRion: Go on...

14:55 callen: jkkramer: I know about Dram. I'm just kinda hoping Losh picks it back up.

14:55 Ember-: callen: I understand and not saying that it wouldn't work

14:55 callen: jkkramer: if he doesn't, I'll have to wait on Santiago.

14:55 hyPiRion: I don't know if there's more to discuss, heh

14:55 TimMc: hyPiRion: I smell a code horror, and I want to know more!

14:55 bbloom: the reason there are 39385935 templating languages is because there are lots of different use cases and many people haven't explicitly stated their use cases and design goals

14:56 Ember-: but you previously said you'd like a templating library for clojure which has been developed by a guy doing web apps for living

14:56 well, I do web apps for living and I wouldn't desing a templating system like that

14:56 it's a matter of taste which is good

14:56 callen: jkkramer: the last commit was, "Basic template file loading!"

14:56 bbloom: if you want a template language for designers, than maybe django/jinja is a reasonable choice

14:56 callen: jkkramer: very encouraging.

14:56 bbloom: i've never worked with a designer smart enough to figure out django templates, but dumb enough not to be able to learn HAML

14:56 i figure they could learn hiccup to

14:56 o

14:57 hyPiRion: TimMc: Okay, it's basically like this: Create a recursive merge function by calling e.g. merge-with

14:57 callen: bbloom: there's a *lot* to Jinja that makes it my template lang of choice.

14:57 bbloom: not just that a designer can use it.

14:57 bbloom: callen: like what?

14:58 hyPiRion: TimMc: So (fn [& r] (apply merge-with merge r)) would merge two levels only.

14:59 callen: bbloom: registering template filters and custom tags for extending the functionality to match your use-case without repetitiously processing the data on the backend logic, template extension, overrides, and injection that actually work really well to eliminate duplicate logic/markup, syntax that is both simple and easy and doesn't break down once you hit a moderately complicated use-case, good separation of frontend/backend in terms of markup/layout an

14:59 borkdude: "Clojure html templating libraries: the grand tour", free blog post idea =)

14:59 hyPiRion: TimMc: That's solved through (fn rec [& r] (apply merge-with rec r)) usually, but I can't do that since I'm calling a function which expands that fn

14:59 callen: borkdude: it'd just be me walking around with a baton, pointing at things and going, "so this sucks...this sucks too. Oh yeah, that definitely sucks."

14:59 hyPiRion: /s/fn/fn-form/

15:00 ro_st: borkdude, callen: it'd be interesting if you included _why_ it sucks

15:00 borkdude: ro_st probably because it's not ninja, like clojure is not common lisp

15:00 callen: ro_st: I could talk for weeks about why 99% of templating libraries are awful.

15:01 ro_st: i don't doubt it.

15:01 callen: for the record, I hate CL-WHO too.

15:01 bbloom: callen: every single one of those use cases can be more directly accomplished via functions. jinja reifies particular signatures of functions into particular convinenent syntaxes. but if you're a programmer, you should be just fine writing normal functions....

15:01 callen: bbloom: you're missing...the damn point.

15:01 bbloom: I'm not always writing the templates

15:01 bbloom: most projects are not one dude.

15:01 bbloom: I need to make the template filters and tags *ahead of time*, in the backend code, register them with the template handler, THEN let the designer use what I created

15:01 bbloom: callen: which is exactly what i'm saying: if you have non programmers on your teamwriting templates, then you've got a justification for using jinja

15:02 and you told me that wasn't the reason :-P

15:02 callen: because if I don't do that, it'll end up in JS somewhere.

15:02 bbloom: I said that wasn't the only reason.

15:02 bbloom: there's a lot about Jinja that makes my life simpler as a lone programmer, but it's positively critical when I have a frontend guy.

15:02 TimMc: hyPiRion: So how does this end up with you trying to pass around unbound vars?

15:03 callen: replicating even the simple example here: http://jinja.pocoo.org/ would take way too much work in Hiccup and Enlive.

15:03 you could get sorta close in Stencil, but it'd be laborious and involve {{{ }}}

15:03 clojurebot: Cool story bro.

15:03 hyPiRion: TimMc: I have a function foo which takes a function and returns a function, I want to pass the returned function as the argument function.

15:04 Hence the fun.

15:04 ro_st: callen: why do you want a mix of html and something else?

15:05 callen: ro_st: https://github.com/sjl/dram#why

15:05 ro_st: just read the "why".

15:05 ro_st: that, imho, is why 99% of TLs suck. they get soupy even with trivial examples

15:06 Ember-: callen: I know it is client side, but with angular.js those examples are less verbose, more like normal HTML and very designer friendly

15:06 devinus: will 1.5 have a PersistentQueue literal?

15:06 Ember-: if you really need server side templating then it's of course off limits

15:06 hyPiRion: I mean, (fn bounce [args] (apply (foo bounce) args)) works, but it's hairy and computationally heavy.

15:06 Or not hairy, but I don't know if it's idiomatic.

15:06 dnolen: hmm what's the dynamic var in Clojure that you can check for AOT compiles?

15:07 callen: hyPiRion: apply is pretty bad in Clojure.

15:07 tomoj: *compile-files*

15:07 callen: Ember-: I'd like to avoid resorting to an SPA if possible.

15:07 tomoj: I think you mean?

15:07 hyPiRion: callen: Slow you mean?

15:07 dnolen: tomoj: yes, that's it thanks.

15:07 Ember-: callen: I can appreciate that if you have a good reason for that

15:07 callen: hyPiRion: why not.

15:07 Ember-: but in my experience SPA is way better than traditional

15:08 callen: Ember-: because I've done 100% SPAs before and it turned into a mess for usability and accessibility.

15:08 Ember-: even if you have to tolerate javascript and it's quirks

15:08 callen: standard web apps are better unless you have something very specific going on.

15:08 I don't mind JS.

15:08 egghead: can anyone who is familiar with carmine (the redis client) explain this to me? https://www.refheap.com/paste/7703 is it just that with-redis (wcar) only makes one trip to redis?

15:08 Ember-: callen: ok, well. No offense but someone in your team did not know how to build SPA then :)

15:08 hyPiRion: callen: I think I lost you there

15:08 callen: Ember-: maybe so.

15:08 Ember-: the largest SPA project I've done had over 40kloc of javascript in it

15:08 callen: hyPiRion: just benchmark it, you'll see what I mean very quickly.

15:09 Ember-: and hundreds of thousands of lines of java code in the backend

15:09 TimMc: callen: How about you *explain* what you mean.

15:09 hyPiRion: callen: Oh, I know it's slow. That's not the issue here though

15:09 Ember-: it was quite manageable, had great performance and usability

15:09 hyPiRion: I just wonder what's idiomatic to do.

15:09 callen: TimMc: as soon as somebody makes a template library that doesn't make me want to take the protesting buddhist monk way out of life with a bucket of gasoline.

15:09 crease: I'm having trouble with cl-format… shouldn't (cl-format nil "~2@* ~D" 1 2 3) give you " 3"? I'm getting " 1"

15:10 hyPiRion: ,(require '[clojure.pprint :refer [cl-format])

15:10 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

15:10 TimMc: callen: Yeah, I'm not in that discussion anymore, sorry.

15:10 hyPiRion: ,(require '[clojure.pprint :refer [cl-format]])

15:10 clojurebot: nil

15:10 hyPiRion: ,(cl-format nil "~2* ~D" 1 2 3)

15:10 clojurebot: " 3"

15:11 Ember-: callen: well, fortunately for you someone is making that Jinja version for clojure

15:11 callen: I didn't know people actually wanted to use cl-format.

15:11 Ember-: if you mean dram, he hasn't worked on it in awhile.

15:11 Ember-: fork and pick up it and finish the work?

15:11 callen: Ember-: Clango is in a similar state.

15:11 Ember-: I'd end up replicating the work Santiago wants to do. I'd rather not trip over him, he has more experience writing template libraries.

15:12 Ember-: lure the original Jinja developers to the Clojure side? :)

15:12 callen: actually, Mitsuhiko is a good target for that

15:12 he's been pissed about Python 3 for awhile.

15:12 Ember-: go for it

15:13 I really mean it

15:13 hyPiRion: crease: huh, I think I need to read the docs

15:13 callen: Ember-: I already asked him in #flask.

15:13 hyPiRion: ,(cl-format nil "~D ~0@* ~D" 1 2 3)

15:13 clojurebot: "1 1"

15:13 hyPiRion: ,(cl-format nil "~D ~1@* ~D" 1 2 3)

15:13 clojurebot: "1 2"

15:13 hyPiRion: ,(cl-format nil "~D ~2@* ~D" 1 2 3)

15:13 clojurebot: "1 1"

15:13 hyPiRion: Either that, or this is not working properly.

15:15 hiredman: win 15

15:15 crease: hyPiRion: yeah, maybe it's a bug… the doc says ~2@* is an absolute goto to the third argument. Maybe I'm missing something tho. It's a kind of scary doc.

15:16 devinus: technomancy: do you use elein at all?

15:17 hyPiRion: crease: yup, it's a bug. SBCL, clisp and clozure gives "1 3" for the last one there

15:17 I'll check JIRA for bugs

15:18 callen: devinus: pretty sure he lives inside a perma-running lein terminal for that.

15:18 devinus: so, "no"

15:18 devinus: callen: that's what i figured

15:18 callen: does explain why the lein command mode thingy exists though. He made it for himself, haha.

15:19 devinus: i'm trying to figure out the latest emacs/clojure stuff, trying to figure out the difference between clojure-mode and clojure-test-mode

15:19 then there's clojure-project-mode

15:20 crease: hyPiRion: thanks! and appreciative clicking noises for firing up those languages. I don't see it in JIRA...

15:21 zerokarmaleft: what does clojure-project-mode have that clojure-mode doesn't cover?

15:22 cark: hum this FXML thing in javafx feels a bit half-assed

15:23 devinus: zerokarmaleft: no idea, trying to figure that out

15:24 then there's cljdoc

15:25 i need technomancy's technomastery me thinks

15:25 hyPiRion: crease: I tested it with 1.5.0-beta2, and it's still there. Want me to add a ticket for it?

15:26 It's either me or you.

15:26 callen: devinus: it's 12:18 pm in the bay area, he's probably at lunch.

15:27 devinus: callen: good call

15:28 callen: devinus: not really. I noticed I was hungry. I'm in south bay.

15:29 hyPiRion: crease: I'll add a ticket if you don't mind.

15:29 devinus: callen: i'm guessing the bay area is the only place to get jobs that let you work with Clojure these days? :P

15:30 craigbro: devinus: we're hiring, remote workers too

15:30 oh, sorry, didn't detect your sarcasm

15:30 clj_newb_2345: what is the most robust (i.e. not adhoc) way of getting the maybe monad inside of clojure?

15:30 (I'd like to use it together with map)

15:31 Ember-: devinus: I live in Finland and I am working on a Clojure project

15:31 pretty far away from the bay area :)

15:31 devinus: craigbro: half-sarcasm. i've looked around the austin area for people doing Clojure stuff

15:31 haven't seen much

15:31 matthavener: devinus: i think mass relevance does some clojure

15:31 or scala

15:32 callen: devinus: basically, yes, but I don't get to work in Clojure. I can't convince my boss the community has good templating libraries.

15:32 Ember-: and push your own organization to clojure?

15:32 that's the way we started to use it

15:32 internal evaluation after developers brought it up

15:33 still baby steps, only 2 projects using clojure currently out of maybe 70 but the way we are progressing and just Getting Things Done(tm) I have a good feeling that more clojure projects will be coming...

15:33 callen: I'm considering evaluating Scala/Play for a project since the template story there is pretty good.

15:33 ivan: https://github.com/clojure/algo.monads/blob/master/src/main/clojure/clojure/algo/monads.clj#L354 <- would an explicit Just/Nothing make little sense in Clojure?

15:34 devinus: callen: wait, is it really templating holding you back? i thought you were being sarcastic

15:34 clj_newb_2345: ivan: defmonad looks like a macor worth undersstanding

15:35 callen: devinus: it'd sap too much productivity to justify using Clojure. It tips the scales in favor of using Python or Scala.

15:35 devinus: it's that bad.

15:35 craigbro: callen: really? Mazel Tov

15:35 Raynes: callen: I think that if it is really that if you need django, chances are django is your best option.

15:35 craigbro: as if templating was a ahrd problem worthy of more than, oh, i don't know, 50 lines of code

15:36 callen: Raynes: I have a forthcoming project that will require a more...industrial language than python.

15:36 Raynes: I'd like to have a few projects down before that happens.

15:36 craigbro: Raynes: agreed actually.

15:36 Raynes: I haven't had your problems with templating.

15:36 callen: Raynes: you use Stencil.

15:36 Raynes: We obviously have different needs.

15:36 callen: Raynes: it's your git repo that I use to guide working with Stencil when I *do* make things in Clojure

15:36 Raynes: But the constant shitting on of all the templating libs is getting a bit old, no offense.

15:37 callen: Raynes: but just because I was able to get it done, does it mean that it's a sensible choice wrt productivity.

15:37 Raynes: The biggest problem I see is that nobody has finished that one you linked too a few days ago.

15:37 devinus: callen: what are you looking for exactly? DTL in Clojure?

15:37 callen: Raynes: Santiago (Stencil author) sees the same problem I do.

15:38 Raynes: he's just less vocal about it.

15:38 don't act as if I'm some crazy man from the mountains who alone sees this problem.

15:38 Ember-: callen: I hear you!

15:39 throw clojure at HTML/CSS guy's face and he'll punch you

15:39 Raynes: I'm not disagreeing with your desire for such a thing, just that we don't need to be so angry at the existing templating libs. Lots of people like them and use them, and lots of people put lots of work into them. They work really well for most people. I wrote one myself. You just want something different which is totally understandable.

15:39 Ember-: Hiccup isn't the only templating lib he is talking about.

15:39 Ember-: yeah I know

15:40 callen: Raynes: if you know a better way to spur the development of something legitimately appropriate for building a web app with other people, I'd love to hear it.

15:40 Raynes: I think you're missing my point completely.

15:40 callen: I didn't know you had one, save to complain about my complaining.

15:40 Raynes: Okay.

15:40 I should have known better.

15:41 callen: I asked for an actionable improvement to my approach, you demurred. That leaves me with no way to understand what you want to achieve.

15:41 brehaut: callen: shitting on developer set A does not cause people in developer set B to think 'oh! i'd like develop an alternative' it causes them to think 'glad im not getting shat on right now'

15:41 ivan: I'm looking at enlive for the first time and completely befuddled by why I would load some existing HTML and manipulate it in another file with some Clojure

15:41 callen: LOL ^^ you know what? I don't even need to say anything. I'll just let the truth speak for itself.

15:41 ivan: I guess I'll have to play with hiccup and see where the brick wall is

15:42 HolyJak: Raynes: Your point seemed to by quite clear to me, though :-) Don't fall into dispair.

15:42 Raynes: brehaut: Your IRC client has an ignore feature designed specifically for trolls.

15:42 Exercise it.

15:42 brehaut: Raynes: it does, but it comes unstuck

15:42 devinus: i think there's plenty of room for a logic-ful (as opposed to a logic-less like Stencil) templating lib for Clojure

15:42 is there not?

15:42 Raynes: Sure.

15:42 callen: devinus: there's a great one called http://jinja.pocoo.org/

15:42 devinus: just need a Clojure version.

15:43 Raynes: devinus: Something like jinja would be great for Clojure.

15:43 brehaut: devinus: why not just use a java library in that case? there are heaps of options

15:43 devinus: callen: right

15:43 yeah, or not even like jinga

15:43 hyPiRion: woa, you guys are still going on with the template discussion? It's been 90 minutes.

15:43 dnolen: haha

15:43 devinus: the language it uses could be clojure-inspired

15:43 dnolen: hyPiRion: my thoughts exactly

15:43 Raynes: devinus: But that doesn't mean we should shit all over the existing libraries that other people have made. But that appears to be callen's motive.

15:43 devinus: instead of jinjaish

15:43 callen: I don't *really* want to talk about Enlive

15:43 devinus: Raynes: i must have missed a lot of previous context :P

15:43 callen: I want something better to crop up.

15:44 Ember-: callen: please use term "different" instead of "better" to keep this civil

15:44 callen: they ignored me anyway, but noted.

15:44 Ember-: you're stabbing someone's baby the way you are going with your argument

15:45 Raynes: ivan: I wrote a lib similar to Enlive that does that too (laser). It's simply a way of transforming HTML using selectors instead of markers in code such as you would do with mustache. Also, if you use hiccup your HTML is written in a Clojure DSL that a designer probably can't read or want to mess with.

15:45 Ember-: the father of that baby won't be happy

15:45 devinus: this honestly shouldn't be too hard. i've worked on erlydtl for erlang and written my own mustache libs before. a clojinja would be relatively easy i think

15:46 m0smith: I chose stencil for just that reason: a designer needs to be able to work with it as well

15:46 callen: the revolution begins! /me cackles

15:46 brehaut: m0smith: my expiernece is designers are entirely capable of working with plain HTML too :P

15:47 hyPiRion: devinus: Well, it's great news that it shouldn't be too hard - an even better reason for you to create your own solution :)

15:47 Raynes: ivan: The point is to keep your code separate from your logic. Does that make sense?

15:47 devinus: hyPiRion: yes :P the only problem is i'm on page like 160 of JoC

15:47 m0smith: brehaut: They ceratinly are but clojure data structures are a bit of a stretch

15:47 ivan: Raynes: yeah, but I have the need to see some rendering logic with the HTML structure

15:47 joevandyk: anyone find rendering html templates to be a bottleneck ever? i found that happened a lot with rails

15:47 hyPiRion: devinus: don't stop ;)

15:47 brehaut: m0smith: enlive does not use clojure data structures for templates. it uses plain HTML.

15:48 joevandyk: (possibly it was related to slow view helpers and route generation)

15:48 Raynes: ivan: I'll be rewriting refheap's views with laser soon. Keep an eye out.

15:48 brehaut: m0smith: that goes for a number of other libs too (tinsel, laser)

15:49 ivan: Raynes: cool, I'll check it out

15:49 callen: ivan: it's like Enlive

15:49 brehaut: "i dont understand how to use X" is not the same as "X is bad". Nor is it a condemnation of anyone not understanding X.

15:50 callen: there is such a thing as understanding just fine, but being horrified nevertheless. Of course it's a lot easier to think your position is tenable if you assume all who don't share it are ignoramuses.

15:51 m0smith: brehaut: Yes I see what you mean. I prefer the mustache metaphor as it gives the designer a wider range of options without breaking the clojure coe

15:51 code

15:52 for example [:p#message] can be frgaile if the designer decides to not use the <p>

15:52 brehaut: m0smith: do take the time to look at a transformational templating system though. its a different formulation of that idea where the designer _only_ worries about html and css etc, and doesnt concern themselves with population at all

15:53 m0smith: brehaut: do you have a link? The stuff I am seeing is just some tutorials

15:53 brehaut: m0smith: no more fragile than passing a map of keys through to the designer. you need to have some sort of interface/schema between the two sections of code nomatter what the soliution you use is

15:53 Raynes: m0smith: I had someone give me that exact same argument a few days ago, and it seems valid enough.

15:54 brehaut: I think the point is that with tags you can change what they are without breaking anything in a lot of cases, whereas laser and friends all require an exact DOM structure in order for them to work reliably.

15:54 Well, not exact.

15:54 m0smith: brehaut: True. It just seems easier for our designers to leave the key names in tact

15:54 Raynes: But still.

15:55 brehaut: m0smith: theres two tutorials. both are somewhat hard slog, but give them a crack. the actual documenation for enlive is somewaht mind boggling when you dont know enlive already.

15:56 Raynes: i understand that.

15:56 gtrak: meh... there are java template libs, too... clojure ones implement java.util.Map

15:56 clojure maps*

15:56 brehaut: gtrak: exactly.

15:57 m0smith: brehaut: It feels a bit like JQuery for clojure

15:57 I like JQuery so that is not a slam (BTW)

15:58 brehaut: m0smith: there are parallels

16:00 gtrak: callen: does something like this float your boat?

16:00 https://developers.google.com/closure/templates/docs/helloworld_java

16:03 brehaut: gtrak: i've also heard that StringTemplate can be pretty good. (and stupidly fast)

16:03 gtrak: I even found the map line for you: http://code.google.com/p/closure-templates/source/browse/trunk/java/src/com/google/template/soy/tofu/SoyTofu.java?r=21#131

16:03 brehaut: I hated it when I tried to use it for even a toy program

16:03 brehaut: gtrak: hah ok

16:03 gtrak: I can show you an integration though

16:04 brehaut: sure

16:04 gtrak: https://github.com/gtrak/garytrakhman.com/blob/91813c7d0b6206e2821aadbf2b47c18135d5a6e1/src/garytrakhman/stview.clj

16:05 there's some extra bits like associating a JS file per view... I couldn't make myself happy with it though

16:05 the variable scoping's a huge pain

16:06 devinus: i know there's a condition-restart lib for clojure

16:06 can anybody remember what it is?

16:07 technomancy: devinus: error-kit, but I don't think it's recommended

16:08 devinus: technomancy: there was nother one too

16:08 another*

16:08 crease: hyPiRion: ticket's a good idea, thanks

16:09 devinus: technomancy: also you're back!

16:10 gtrak: here's the bit in closure-templates that takes a map, anyway: http://code.google.com/p/closure-templates/source/browse/trunk/java/src/com/google/template/soy/tofu/SoyTofu.java?r=21#131

16:10 devinus: technomancy: i have some clojure/emacs questions for you. your talk on leiningen inspired me

16:10 technomancy: can you tell me what the clojure-project-mode does that clojure-mode doesn't?

16:13 zerokarmaleft: devinus: https://github.com/psyllo/emacsenations, i don't think technomancy authored clojure-project-mode

16:13 technomancy: devinus: never heard of clojure-project-mode

16:13 devinus: ah, it seems it extends project-mode

16:14 there's also cljdoc

16:14 technomancy: I use ,,find-file-in-project for larger codebases

16:14 oh wait, this isn't #emacs; no fsbot

16:14 devinus: technomancy: i have find-file-in-project installed after your endorsement

16:14 technomancy: anyway, I think most of the project stuff around emacs is kind of silly; the only thing I need is scoped file opening

16:14 zerokarmaleft: from a glance, it looks like it does some project-wide string searching and source-file/matching-test-file navigation

16:15 technomancy: I highly recommend using M-x rgrep (or rgrep from eshell) for searches

16:15 when you can't use M-.

16:15 clojure-mode has some functionality for jumping between implementation and test, but it's not great

16:15 I wish he would have fixed the existing implementation instead of creating a new one =\

16:17 callen: gtrak: not at all. My boat sinks.

16:18 gtrak: ha, it seems to me similar to django's

16:19 callen: gtrak: you don't appear to have used Django much.

16:19 gtrak: nope... http://www.jangod.org/

16:19 'inspired by django'

16:20 can you tell I don't work with designers? :-)

16:20 callen: gtrak: that's not what you linked me

16:20 gtrak: you linked me a different library.

16:20 gtrak: ah, yea, that's what I found just now

16:20 callen: ...

16:21 that's for java and java classes

16:21 I need something that works with maps.

16:21 gtrak: I'm not sure why closure-templates doesn't match your requirements... but perhaps that does the trick

16:21 callen: No.

16:34 tpope: (v/length-of :password :within (drop 5 (range)))

16:34 is there a less obtuse way to write this?

16:35 gtrak: (->> (range) (drop 5) (v/length-of :password :within)) ?

16:35 TimMc: What does length-of do?

16:35 haha

16:36 amalloy: (nthnext password 4)? like, i don't know about this crazy validation library, but checking that a seq is at least 5 elements long is not hard in normal life

16:36 tpope: it's from validateur to check if a password is at least x chars

16:37 gtrak: err... I want my validations as data!?

16:37 tpope: the existing implementation has (range 5 20) and I was like "why enforce a maximum length"

16:37 xeqi: (numericality-of (comp length :password) :gte 5) ?

16:38 technomancy: partial <= 5

16:39 gtrak: (= 5 (count (take 5 my-seq))

16:39 xeqi: wonder if you could just pass (comp (partial <= 5) length :password) to the validation-set

16:39 tpope: xeqi that's what we're trying

16:40 rbxbx: xeqi: that would work except it doesn't adhere toe the contract of a validator fn

16:40 xeqi: ah, not quite, needs to return a [boolean #{errors}] pair

16:40 rbxbx: needs to do something like... yes

16:40 technomancy: wait what

16:40 why not just check for an empty set?

16:41 xeqi: technomancy: how would you fail without providing any useful info?

16:41 technomancy: can't tell if serious =)

16:42 rbxbx: technomancy could if not using a library, but in order to adhere to what validateur expects from validator fns...

16:42 technomancy: rbxbx: yeah, arguing against the larger design, not the suggestions here

16:43 rbxbx: technomancy gotcha.

16:43 gfredericks: why did lein/maven just say something about looking for a snapshot of thneed?

16:43 gtrak: gosh.. validation as a Domain seems ill-suited to a DSL

16:44 gfredericks: I don't see thneed anywhere in my deps tree

16:44 technomancy: gfredericks: I thought I added an exclusion for that or something

16:44 not sure

16:45 rbxbx: technomancy gfredericks that has happened to me many times.

16:46 technomancy: rbxbx, gfredericks: running lein from source?

16:46 rbxbx: yes.

16:46 gfredericks: no, just a regular installation

16:46 rbxbx: er

16:46 2.0.0-preview10

16:47 hyPiRion: I've seen it pop up from time to time, not sure whether it has been on the preview or master though

16:48 gfredericks: arrays in postgres: korma doesn't seem to handle them correctly on insert. Should I expect clojure.java.jdbc to be any better?

16:48 (specifically korma generates "(?,?,?)" when it ought to "{?,?,?}")

16:48 technomancy: ok, so I think master has the exclusions in place for thneed though I don't recall the details

16:50 xeqi: gfredericks: thneed snapshot was used in the latest trammel, which is used by some versions of lein-jacker, which is used be some plugins

16:50 I'd guess it came from there

16:50 gfredericks: xeqi: okay, thanks

16:50 hyPiRion: Travis doesn't pick up thneed though, so I assume it's not from lein itself

16:51 xeqi: for example, lein-ring pulls it in sometimes

16:51 tomoj: clojure.java.jdbc would generate neither "(?,?,?)" nor "{?,?,?}", would it?

16:51 gfredericks: tomoj: I don't know. What happens if you give it a vector as a value?

16:52 xeqi: rbxbx: ^

16:52 gfredericks: I was about to try it out myself.

16:52 rbxbx: xeqi okay. Thanks.

16:52 frozenlock: Going through the slime->nrepl transition... I used to be able to send some interesting info to my REPL using a simple `print' function while running an application. (For example, I could see any webhooks received). However `print' doesn't seem to be sending the output to the REPL. Am I mistaken?

16:52 (print in nrepl that is)

16:53 moogatronic: frozenlock: you mean like (print "some string") ?

16:53 technomancy: frozenlock: possibly different flushing behaviour? see if println is different

16:53 moogatronic: should be appearing. Also there's a *nrepl-server* buffer that nicely captures log4j output

16:54 cark: frozenlock: your print is hapenning in some other thread, where *out* is not bound

16:54 llasram: frozenlock: When I print form other than the main REPL thread, I see messages go to the JVM process's stdout instead of *out*

16:55 msamiry: hello all

16:55 frozenlock: Oh I see o_O

16:55 cark: frozenlock: i usually define a function debug like so (let [o *out*] (defn debug [s] (println o s)))

16:55 tho i'm not sure about order of parameters on println

16:55 msamiry: please I'd like to ask a question

16:55 technomancy: ~anyone

16:55 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 ..."

16:56 hyPiRion: msamiry: fire away!

16:56 msamiry: is there something in clojure like numpy.linspace

16:57 TimMc: What does it do?

16:57 msamiry: Return evenly spaced numbers over a specified interval

16:58 numpy.linspace(start, stop, num=50, endpoint=True, retstep=False)

16:58 amalloy: &(doc range)

16:58 lazybot: ⇒ "([] [end] [start end] [start end step]); Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0, step to 1, and end to infinity."

16:58 TimMc: msamiry: So, if asked for 3 numbers in 0..20, what would it give back?

16:58 cark: frozenlock: look at this : https://gist.github.com/4332383

16:58 TimMc: amalloy: Not absolutely trivially.

16:59 msamiry: numpy.linspace(0,2,1000) will give a list of 1000 item between 0 and 2 evenly devided

16:59 TimMc: Oh, not just integers?

17:00 Then range could work after all -- although you'd want to watch for error propagation.

17:00 gtrak: cark, if it's in a different thread, send the message to an agent or something

17:00 TimMc: *accumulation

17:00 cark: gtrak: this is quick and dirty debugging

17:00 msamiry: no not just integers

17:00 hyPiRion: ,(range 0 2 (/ (- 2 0) 4)) ; not correct, but going there.

17:00 clojurebot: (0 1/2 1N 3/2)

17:00 cark: gtrak: if you want something serious, use a logging tool

17:00 gtrak: cark: future's quicker

17:01 and it uses the same threadpool

17:01 TimMc: msamiry: The incanter library might have something ready-made, if you don't mind pulling that in.

17:01 cark: gtrak: can't be quicker than my quick and dirty thing =P

17:02 gtrak: surely could be more correct tho

17:02 amalloy: &((fn linspace [start stop num] (take num (range start Double/POSITIVE_INFINITY (/ (- stop start) (dec num))))) 0 20 3)

17:02 lazybot: ⇒ (0 10 20)

17:02 Fauno1: &(+ 5 3)

17:02 lazybot: ⇒ 8

17:02 Fauno1: o_O

17:02 gtrak: cark: yours will break if *out* is rebound, since it captures the value at initialization

17:02 TimMc: Fauno1: Not the answer you expected?

17:03 cark: gtrak: i observed some mixing of log output with this, the agent way is indeed better, but best as i said is a logging framework

17:03 gtrak: works for me !

17:03 * technomancy feels a chill down his spine at the words "logging framework"

17:03 cark: technomancy: haha yes

17:03 technomancy: (actually just "framework" would be enough)

17:04 brehaut: dont anyone else say it, or something unknowable will show up and destroy our sanity

17:04 TimMc: technomancy: Just wait until you see my JPEG rendering framework.

17:04 hyPiRion: ,((fn linspace [min max n] (let [step (/ (- max min) (dec n))] (range min (+ max step) step))) 0 20 3)

17:04 clojurebot: (0 10 20)

17:04 frozenlock: cark: thanks!

17:05 gert: Hi all, we're working on a cljs mocking tool and we would like to use something like with-redefs in clojurescript -- we're using binding to temporarily bind defined functions to their mocked versions, but that generates a lot of "... not declared dynamic" warnings. What's the best way to go about this?

17:06 amalloy: brehaut: i imagine the next mention of "logging framework" would gradually turn into http://stackoverflow.com/a/1732454/625403

17:06 brehaut: haha

17:07 cark: woah was digging my biggest project for the logging thing i have in it, and it still uses c.c.def and c.c.duck-streams

17:07 brehaut: amalloy: i found an accurate diagram on wikipedia http://upload.wikimedia.org/wikipedia/commons/2/28/Azathoth.jpg

17:08 dnolen: gert: probably need an official `with-redefs` that works like `bindings` minus the warnings, open a ticket in JIRA

17:08 msamiry: @TimMc @hyPiRion @amalloy thanks, I appreciate ur help

17:08 gfredericks: so if I want to use arrays in postgres am I best off patching clojure.java.jdbc to handle them?

17:09 there's no existing clojure lib that does this well?

17:09 technomancy: amalloy: ... wow.

17:09 crease: man, backbutton.el's great

17:09 cark: it indeed uses an agent, a ref and does daily log file rotation, the whole of which is about 30 lines of code...

17:09 gert: dnolen: cheers. as a temporary workaround, we're trying to figure out how to set *cljs-warn-on-dynamic* to false from leiningen when we're running our tests, but not sure how to do that

17:10 technomancy: gfredericks: I think it would go deeper than c.j.jdbc to the actual underlying jdbc drivers?

17:10 gfredericks: technomancy: I'm not sure what that statement implies

17:10 certainly the details involve the driver...

17:10 technomancy: gfredericks: oh never mind I'm thinking of the json datatype

17:11 carry on

17:11 dnolen: gert: are you using lein-cljsbuild?

17:11 gert: yes we are

17:11 brehaut: postgres's json datatype intrigues me. Im thinking of porting my site from couchdb to postgres and using it as a datamullet

17:12 dnolen: gert: k not sure how that's done but you just need to bind that to false when calling lein-cljsbuild to compile the files. I don't think we provide a fine grained way to tweak warnings yet via build options.

17:12 no sure how things are handled in lein-cljsbuild I mean as far as where you need to set up the binding

17:12 I mean

17:12 technomancy: brehaut: I don't think the underlying jdbc driver supports it yet

17:13 brehaut: technomancy: ah :/

17:13 technomancy: but yeah, it looks like it could replace document DBs nicely once it does

17:13 someone told me that postgres is the emacs of DBs

17:13 gert: thanks dnolen, we'll do some more digging

17:13 brehaut: nightmare to set up but does everything once you succeed?

17:13 sounds apt

17:15 ynniv: I'm having issues with AOT compilation, but I'm not compiling on purpose

17:15 TimMc: "datamullet"...

17:15 ynniv: I think this is due to import / use?

17:15 technomancy: ynniv: do you have :main in project.clj?

17:15 TimMc: Do you have any protocols or defrecords?

17:15 brehaut: TimMc: business (relational) in the front, party (adhoc blobs) in the back

17:16 TimMc: originally meant for a system that uses an SQLDB with a NoSQL db

17:16 ynniv: i have no protocols or defrecords, but I do have a :main

17:16 technomancy: ynniv: try :main ^:skip-aot my.ns

17:16 TimMc: brehaut: Hmm, in that case I misunderstand the pg/json usage.

17:16 technomancy: ynniv: the next version of lein won't require that, FWIW

17:17 ynniv: that sounds good, because ^:skip-aot is pretty magical

17:17 brehaut: TimMc: Im not sure i can explain it sorry :/

17:17 TimMc: technomancy: lein 2 defaults to non-AOT?

17:17 technomancy: ynniv: it used to be that :main was only used for uberjars, but these days it's usually used for lein run instead

17:18 TimMc: brehaut: Ah, relational calls producing JSON blobs?

17:18 ynniv: yes, I'm using it for lein(2) run.

17:18 technomancy: TimMc: better to be explicit about AOT instead of magically flipping it on and having a hidden switch to turn off the magic

17:18 TimMc: technomancy: Man, who wants it for uberjars anyhow? ;-P

17:19 s/;/:/

17:19 technomancy: TimMc: I tell ya, back in the day it was all uberjars all the time

17:19 TimMc: all AOT'd uberjars, too

17:19 Let me tell you about this one plugin...

17:19 ynniv: uberWar is still very useful

17:19 technomancy: lein 1.0.0 actually compiled everything by default

17:20 that didn't last long

17:20 crease: Anyone know if it's possible to extend protocols over primitive types?

17:20 not having much luck :(

17:21 ynniv: (inc technomancy)

17:21 lazybot: ⇒ 42

17:21 ynniv: wow! congrats!

17:21 TimMc: brehaut: I somehow thought it was a JSON-ish interface backed by relational stuff. :-)

17:21 ibdknox! We need a downvote in here!

17:21 AimHere: (dec TimMc)

17:21 lazybot: ⇒ 22

17:22 TimMc: oh no!

17:22 AimHere: I think we got one

17:22 technomancy: (dec inc)

17:22 lazybot: ⇒ 1

17:22 TimMc: (inc dec)

17:22 lazybot: ⇒ 1

17:22 dnolen: crease: you can extend the object versions of the primitives

17:23 ppppaul: would someone be able to help me with a datomic issue

17:23 i'm in the datomic channel

17:23 crease: dnolen: it is so! thanks!

17:24 hyPiRion: (inc TimMc)

17:24 lazybot: ⇒ 23

17:24 TimMc: a good number

17:25 hyPiRion: $karma TimMc

17:25 lazybot: TimMc has karma 23.

17:25 AimHere: And only yesterday I made an illuminatus reference.

17:26 craigbro: (inc foo)

17:26 gman_: Hi all can someone tell me what an expression like header->body means?

17:26 lazybot: ⇒ 2

17:26 craigbro: (inc craibro)

17:26 lazybot: ⇒ 1

17:26 craigbro: (inc craigbro)

17:26 lazybot: You can't adjust your own karma.

17:26 craigbro: good

17:27 AimHere: (dec ChanServ)

17:27 lazybot: ⇒ -1

17:27 gtrak: that guy's a jerk

17:27 hyPiRion: You can adjust your own karma.

17:27 ,(println "(inc hypiRion)")

17:27 clojurebot: (inc hypiRion)

17:27 lazybot: ⇒ 4

17:28 gtrak: gman_: when I write names like that, that usually signifies a map

17:28 from key->value

17:29 amalloy: gman_: it's just the name of something. probably a function

17:29 gman_: ok so you can dereference a map with that syntax?

17:29 crease: ,(type crease)

17:29 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: crease in this context, compiling:(NO_SOURCE_PATH:0)>

17:29 crease: ho hum

17:29 gtrak: gman_: it's not a syntax

17:29 technomancy: it means it's converting between "types" loosely

17:29 but header->body makes no sense

17:29 because you can't convert between them

17:29 amalloy: technomancy: just confusing the issue. the point is it's a name, with no special signifigance in the language

17:29 technomancy: oh, sure

17:30 gtrak: data row header to human body conversion function

17:30 amalloy: header->body exists in gloss and makes sense in context

17:30 crease: (type craigbro)

17:30 craigbro: (inc (var-get (resolve 'craigbro)))

17:30 lazybot: ⇒ 1

17:30 craigbro: (inc (var-get (resolve 'craigbro)))

17:30 lazybot: ⇒ 2

17:30 craigbro: well well well

17:30 crease: uh oh

17:30 TimMc: what

17:30 amalloy: dunno if that's the one he's run into, but saying it makes no sense seems silly

17:31 technomancy: craigbro: you're way over-thinking it =)

17:31 gman_: yes it is from gloss, I just can't glean what it expresses

17:31 amalloy: TimMc: that's just the karma plugin

17:31 technomancy: craigbro: it only looks like lisp; it's really not.

17:31 crease: (type (var-get (resolve 'craigbro)))

17:31 TimMc: oh, ha

17:31 I get it.

17:31 craigbro: $karma craigbro

17:31 lazybot: craigbro has karma 0.

17:31 craigbro: ah

17:31 Bronsa: lol

17:31 TimMc: $karma (var-get (resolve 'craigbro))

17:31 lazybot: (var-get has karma 0.

17:31 Bronsa: $karma (var-get (resolve 'craigbro))

17:31 lazybot: (var-get has karma 0.

17:31 Bronsa: what.

17:31 hyPiRion: it's escaping incorrectly

17:32 ibdknox: 2pro4u

17:32 hyPiRion: We've been through this before

17:32 ibdknox: lol

17:32 craigbro: i imagine so

17:32 gman_: i mean the -> operator when between two symbols

17:32 TimMc: Oh, (inc and $karma have differnet parsing.

17:32 hyPiRion: (inc ~@:*)

17:32 lazybot: ⇒ 1

17:32 TimMc: gman_: It's not between them -- it's part of the name.

17:32 ibdknox: ppppaul: is that cljs pprint stuff somewhere? :)

17:32 hyPiRion: karma ~@:*

17:32 amalloy: gman_: -> isn't an operator anyway, and in header->body it's just the name of a thing, named "header->body"

17:32 hyPiRion: $karma ~@:*

17:32 lazybot: ~@:* has karma 1.

17:32 clojurebot: @ has nothing to do with whether sth is evaluated or not

17:32 gtrak: gman_: ##[(class 'a->b) 'a->b]

17:32 lazybot: ⇒ [clojure.lang.Symbol a->b]

17:33 TimMc: ,'foo->>>>-->->>bar ;; gman_

17:33 clojurebot: foo->>>>-->->>bar

17:33 gman_: ahh.. ok thanks TimMc

17:33 TimMc: gtrak: Don't you mean... ##((juxt class identity) 'a->b) :-P

17:33 lazybot: ⇒ [clojure.lang.Symbol a->b]

17:33 gtrak: of course

17:34 TimMc: Always use juxt, even if it will confuse people.

17:34 amalloy: TimMc: well done preempting me there; i was going to scold you for confusing people

17:34 TimMc: s/even if/especially when/

17:34 ibdknox: especially when it'll confuse people.

17:34 TimMc: BAM

17:34 amalloy: ibdknox: TimMc is on fire

17:34 ibdknox: oh no's

17:34 lol

17:37 gtrak: ,(map #(%) (map #(partial % 'a->b) [class identity]))

17:37 clojurebot: (clojure.lang.Symbol a->b)

17:38 crease: hrm, is there a good way to traverse maps in core.logic?

17:38 dnolen: crease: nothing beyond seq'ing them

17:39 amalloy: maps are almost as hard as numbers

17:40 crease: dnolen, amalloy: oh. So what do people use to run queries on map literals in source?

17:40 solussd: what do people use for custom decoders when using cheshire?

17:40 dnolen: crease: or you could do some custom unification

17:41 gtrak: last one: ##(drop 1 (reductions (fn [_ a] (a)) nil (map #(partial % 'a->b) [class identity])))

17:41 lazybot: ⇒ (clojure.lang.Symbol a->b)

17:41 dnolen: crease: people haven't tried it much so it's still a developing topic. lynaghk implemented partial maps which is useful - but I need to tweak it a bit to make it sound.

17:42 frozenlock: cark: I must be missing something... I still don't see anything appearing in my *nrepl* or *nrepl-server*. :(

17:43 mindbender1: what the best way of adding new library dependency to a running nrepl session

17:44 moogatronic: frozenlock: what version of nrepl.el are you running?

17:44 brehaut: pomegranate ?

17:44 frozenlock: eh... the one from lein 2.0.0-preview10

17:45 crease: dnolen: yah, I was just looking at that branch… I'm trying to write a source navigator for projects using zippers and logic queries

17:45 moogatronic: frozenlock: well, nrepl.el is separate from nrepl that lein uses. oh wait, are you using emacs even?

17:45 crease: I suppose I could represent the source as a tree of records and do queries on that

17:45 frozenlock: Oh sorry, I didn't see .el

17:46 * frozenlock checks his .el files

17:46 moogatronic: 0.1.6-preview fixed some stuff that was broken for me in the prev ver, but that's not likely related to your issues..

17:46 hyPiRion: ,(mapv #(% 'a->b) [#(`%%%) class])

17:46 clojurebot: [a->b clojure.lang.Symbol]

17:46 frozenlock: 0.1.3

17:46 dnolen: crease: partial maps are actually in master now. that sounds interesting.

17:46 frozenlock: Oh! I'll try that then, thanks for the tip!

17:46 mindbender1: brehaut: ok thanks just making sure

17:47 brehaut: mindbender1: i dont know for certain, but thats the only thing that springs to mind

17:47 crease: dnolen: oh, awesome!

17:47 moogatronic: frozenlock: yeah, maybe update to at least 0.1.5, but the preview fixed restarting the repl for me.

17:47 (0.1.6-preview i mean)

17:48 gtrak: there must be a market for manual clojure obfuscation

17:49 aperiodic: sounds like a good kibbit plugin

17:49 crease: dnolen: the idea is something a bit like the call-hierarchy stuff in Eclipse, where you can display and navigate through potentially cyclic or otherwise infinite trees

17:49 dnolen: crease: again I don't recommend using them heavily in their current form. At some point in the future I hope to see how well having a constraint version of some of Clojure's core APIs plays out. for traversal I need some hammock time

17:51 gfredericks: seancorfield: ping

17:51 dnolen: crease: rhickey at ClojureX had a good idea - relations should really be polymorphic - Clojure already has a rich notion of sequences, core.logic should perhaps have something that mirrors that but allowing moving back to the original data that generated the sequence.

17:51 crease: have you seen this - http://github.com/cderoove/damp.ekeko ?

17:52 crease: queries of the Java AST in Eclipse, it uses core.logic

17:58 hyPiRion: gtrak: manual clojure obfuscation? Sure thing!

17:58 gtrak: let's start a company

17:58 hyPiRion: We need to find a market first

17:58 gtrak: the users don't know what they want... it's our job to tell them

17:59 crease: dnolen: no, I hadn't seen that! It looks really cool

17:59 hyPiRion: Maybe we can sell our services to rhickey, explaining that he can focus on working with the language instead of reviewing bugfixes and whatnot

17:59 Bronsa: lol

18:00 gtrak: I meant obfuscating the code, not the language itself.. ;-)

18:00 hyPiRion: I meant the code for the language :)

18:00 technomancy: was going to say; that explains contains?

18:01 hyPiRion: And (Boolean. false) and friends?

18:01 gtrak: technomancy: just use java interop in order to doTheRightThingTM

18:02 what's the big deal? #(.contains [:a :b :c :d] :d)

18:02 ##(.contains [:a :b :c :d] :d)

18:02 lazybot: ⇒ true

18:02 hyPiRion: Or some

18:02 ,(some :d [:a :b :c :d])

18:02 clojurebot: nil

18:03 hyPiRion: See, that works nice.

18:03 ,(some #(= :d %) [:a :b :c :d])

18:03 clojurebot: true

18:03 hyPiRion: gah.

18:04 dnolen: ,(some #{:d} [:a :b :c :d])

18:04 clojurebot: :d

18:04 hyPiRion: ,(some #{false} [false :a :b :c :d])

18:04 clojurebot: nil

18:04 hyPiRion: But yeah, if you know they are truthy, #{} is sweet.

18:05 gtrak: contains? makes more sense as clojure.set function, but it's used all over core.clj

18:06 AimHere: ,(contains? [:a :b :c] :c)

18:06 clojurebot: false

18:06 AimHere: ,(contains? [:a :b :c] 1)

18:06 clojurebot: true

18:06 rbxbx: weavejester: am I incorrect in thinking that https://github.com/weavejester/ring-json-response/blob/master/src/ring/middleware/json_response.clj#L11 should work for things other than maps which are representable as JSON? (ie: a vector)

18:06 amalloy: rbxbx: the docstring is pretty clear that it's not intended to work that way

18:07 weavejester: rbxbx: That library is deprecated. Try: https://github.com/ring-clojure/ring-json

18:07 rbxbx: aha

18:07 weavejester: I need to update the README to mention that. I thought I did, but maybe I didn't push it.

18:08 rbxbx: weavejester: awesome. That's how I expected the impl to work :D

18:08 amalloy I get that, just figured https://github.com/ring-clojure/ring-json/blob/master/src/ring/middleware/json.clj#L41 was the apropos behavior ;)

18:08 Thanks weavejester!

18:08 weavejester: rbxbx: Note it only works with vectors, not seqs, because seqs are used for streaming Ring responses.

18:11 rbxbx: weavejester: noted.

18:19 hyPiRion: ..well, that was easier than I though it would be.

18:20 Anyone here who has submitted patches to bugs in core?

18:20 yedi: is it called boolean pattern, or boolean equation, or?

18:28 TimMc: &(-> class class class)

18:28 lazybot: ⇒ java.lang.Class

18:28 technomancy: hyPiRion: I have, but the process has changed so as to be unrecognizable since Jira was introduced

18:28 s/unrecognizable/incomprehensible/

18:28 hyPiRion: technomancy: okay, that's exactly why I asked.

18:30 Oh well, I'll just hop down the rabbit hole and hope for the best.

18:30 TimMc: hyPiRion: #(`%%%) is still my favorite.

18:31 hyPiRion: TimMc: it's shorter than identity!

18:32 There's some gensym leakage within #() though

18:33 ,(#(do `%) :foo)

18:33 clojurebot: p1__87__88__auto__

18:34 bbloom: dnolen: could you elaborate on the polymorphic relationship and bi-directional navigation?

18:36 mmitchell: is there a core fn that takes a map and a set of functions, and then applies the functions to the *values* of the map, and then returns the map with the new values?

18:36 technomancy: mmitchell: no, but it'd sure be nice

18:36 Raynes: There is one in useful.

18:36 technomancy: (zipmap (keys m) (map f (vals m))) is the closest

18:36 Raynes: I hate that version

18:36 mmitchell: haha

18:37 technomancy: s/closest/shortest/

18:38 hyPiRion: No love for reduce-kv?

18:38 &(reduce-kv (fn [m k v] (assoc m k (+ 1 v))) {} {:a 1, :b 2, :c 3})

18:38 lazybot: ⇒ {:b 3, :c 4, :a 2}

18:39 mattmoss: (into {} (map (juxt key (comp f val)) coll)

18:39 dnolen: bbloom: just that if you want to do anything w/ the various Clojure data structures in core.logic you end up doing a lot of explicit seq'ing. Would be nice if this could be pushed under the covers somehow. seems like you might need a slightly smarter notion of seq to do this.

18:39 hyPiRion: (reduce-kv #(assoc % %1 (f %2)) {} ...)

18:39 amalloy: TimMc: that's a neat identity function

18:40 bbloom: dnolen: smarter in what sense?

18:40 dnolen: bbloom: in general miniKanren abounds with cases where there are missed opportunities for polymorphism - constraints for example. !=fd vs !=. Of course it make it's more challenging to implement, and it's not clear how constraints might / should interact.

18:40 bbloom: dnolen: one thing i've considered is "the seq" or "a seq". unsorted collections are seq-able, but really there are N! arbitrary sequences you can pick

18:41 dnolen: bbloom: you put a map in your want to get a map out. that won't happen if you seq a map.

18:41 mattmoss: ,(let [m {:a 1 :b 2 :c 3}] (into (empty m) (map (juxt key (comp inc val)) m)))

18:41 clojurebot: {:a 2, :c 4, :b 3}

18:41 bbloom: dnolen: ah, i see, some kinda seq that carries with it the notion of conj! and empty

18:42 dnolen: bbloom: something, to be honest I have the haziest of notions at the moment.

18:43 TimMc: amalloy: Praise/blame goes to hyPiRion for #(`%%%)

18:43 bbloom: dnolen: clearly your AbstractRehydratableCollectionSequence needs to have an AbstractLinearizableCollectionFactory

18:43 er i mean, yes more hammock time.

18:44 dnolen: bbloom: :)

18:45 bbloom: dnolen: but yeah: makes sense to me. definitely worth exploring

18:45 hyPiRion: TimMc: http://i.imgur.com/cvEFp.png

19:03 bosie: is midje supposed to reload the code in the repl?

19:03 i am using (load-facts) and it doesn't seem to see the changes i make outside of the test files

19:05 S11001001: bosie: I don't think it will globally load; if you're using nrepl press C-c C-l when in a buffer to reload it

19:05 bosie: global reload is more trouble than it's worth

19:06 bosie: S11001001: lein repl

19:06 S11001001: bosie: well, you can use require :reload then, but I'd suggest getting going with nrepl instead

19:06 bosie: S11001001: i am just trying technomancy's suggestion of executing midje test cases through the repl and not with "lein repl"

19:09 technomancy: bosie: I recommend handling reloading through your editor

19:09 bosie: S11001001: will look into nrepl

19:10 ticking: what if file implemented count to get the number of files in a directoy?

19:10 technomancy: ticking: you can count file-seq

19:11 ticking: technomancy: yeah but that is recursive

19:11 technomancy: oh right

19:11 ticking: technomancy: tbh a non recursive file-seq would probably better ^^

19:11 technomancy: like .listFiles

19:11 ?

19:12 S11001001: but there's the burning question of whether you must count "." and "..", therefore all file list counters must be custom

19:12 ticking: yes, but without the java interop

19:12 technomancy: why without java interop?

19:12 ticking: because its nasty

19:12 technomancy: it is not nasty

19:12 ticking: just think of the higher order functions^^

19:12 amalloy: use another language, then

19:13 clojure can't get anything done without *someone* talking to java

19:13 hyPiRion: "eww, java. Let's build a language on top of it"

19:13 "with good interop"

19:13 ticking: hyPiRion: you know what they say "The jvm is a nice runtime, but its reference language sucks."

19:14 amalloy: ticking: not relevant? nobody is telling you to write java

19:14 only suggesting you use the jvm runtime's method-invocation feature

19:14 ticking: amalloy: there is a reason why you don't write java.io.File. everytime you now use clojure.java.io/file

19:14 Raynes: Uh

19:14 No, I don't.

19:14 S11001001: One time I needed to use httpcomponents-client.

19:15 clj-http-client didn't have the features I needed.

19:15 Raynes: If you hate Java so much that you aren't willing to use perfectly acceptable code already written in it, you're probably using the wrong language.

19:15 S11001001: So I...used interop to work with hc-client directly, it worked out

19:15 dakrone: S11001001: out of curiosity, which feature?

19:16 ticking: Raynes, I'm not saying that this shouldn't be used but that it should be wrapped by the core already

19:16 Raynes: That's insane.

19:16 You want to wrap every single bit of Java code in clojure.core?

19:16 For the sole purpose of not having to write a dot before the name?

19:16 ticking: Raynes, no, I just want to wrap the usefull file io bits in clojure.java.io

19:17 Raynes: I agree that the old testament "The only good about java are 1 billio lines of java." is true

19:17 Raynes: https://github.com/Raynes/fs <-- some file system stuff

19:17 S11001001: dakrone: it was 2 years ago, but probably something to do with headers or persistent connection handling

19:17 ticking: Raynes: thus we should use what is there

19:17 S11001001: ticking: define useful

19:17 ticking: Raynes but that still doesn't mean that I want to use interop in non libary coe

19:18 Raynes: yeah I know, I actually use your lib in a lot of projects, could use jome javadoc btw ;D

19:19 Raynes: If I could get weavejester to reply to my codox issue. ;)

19:19 weavejester: Hm?

19:19 Raynes: weavejester: https://github.com/weavejester/codox/issues/16

19:19 y u no work

19:19 ticking: S11001001: everyday stuff, not esoteric things like getters and setters for sticky bits or ZFS hash information

19:20 S11001001: ticking: it's not a dichotomy

19:20 for example, suppose you're walking a tree.

19:20 weavejester: Oh yep, I've been meaning to look into that, but I've been sick lately, so I haven't worked up the courage to go through the code in Lein master and work out why the dependencies have changed.

19:20 S11001001: Do you need file types beyond isdir?

19:20 Raynes: Awww.

19:20 * Raynes makes weavejester some chicken noodle soup

19:21 S11001001: Well, maybe.

19:21 brehaut: Raynes: weavejester is in england, they drink tea

19:21 S11001001: Depends on how good you want it to be.

19:21 ticking: S11001001: you need isDir? isFile? isSpecial?

19:21 weavejester: We have chicken soup too

19:21 Raynes: brehaut: I'm in Alabama. We drink whiskey and cough syrup.

19:21 weavejester: I had some earlier :)

19:21 brehaut: weavejester: what‽ my entire understanding of england is coming unraveled!

19:21 Raynes: I'll be in LA soon though. And they drink protein shakes.

19:22 bosie: Raynes: many clj programmers in alabama? ;)

19:22 Raynes: bosie: I know of just one.

19:22 His name is Raynes.

19:22 S11001001: So the definition of "everyday stuff" isn't clear-cut.

19:22 bosie: hah

19:22 crease: lovin protocols

19:23 Raynes: weavejester: Where is that assert at? I can probably fix whatever the problem is for you.

19:23 Oh, dur

19:23 Never mind.

19:23 Dear Anthony, you has stacktrace.

19:23 ticking: S11001001: then you grow and shrink the library based on user input

19:23 brehaut: S11001001, ticking: I think java.util.concurrent Queues are a great example of everyday stuff that nobody wraps because they are so useful already

19:24 S11001001: ticking: that sounds like "grow and ...grow" to me. We can't even kick if-not out of clojure.core.

19:25 ticking: S11001001: then there are 1 or 2 functions in there that are already use or you aply this conservatively and try to keep it at a minimum

19:25 S11001001: I think the main area where you might want a library, and you can't do something nice with clojure like write a dsl, is "stuff you might want to do in cross-clojure code"

19:25 ticking: S11001001: still no reason to keep it nonexistent

19:26 Raynes: weavejester: How would you feel about inlining source code instead of linking to Github, sort of like rubydoc does?

19:26 S11001001: ticking: anyway, since it's just a few functions, why not introduce a new library with impls for jvm,clr?,js? The bar isn't that high for new libs in clojure-land

19:26 ticking: S11001001: the same goes for the queues, just because they are usefull doesn't mean they are idiomatic

19:26 weavejester: Raynes: Not sure. Too tired right now to have an opinion.

19:26 Raynes: weavejester: I'm interested in adding it with pygments highlighting. It would basically just change the source link to expand to the code. Could also still do the linking to github thing with an option.

19:26 Haha

19:26 weavejester: Raynes: Codox does support custom outputs, though

19:27 Raynes: Alright, no prob.

19:27 ticking: S11001001: the bettern thign to do would probably write a pull request for fs to Raynes

19:27 S11001001: hmm

19:27 @mail rplevy you'll be happy to know I'm getting RHCA'd

19:28 Raynes: I don't accept pull requests. You have to send me a CA, a blood sample, make a jira issue, wait 6 months, attach a patch, and then wait for me to vet it and send it to amalloy for code review and then brehaut will merge it if all goes as planned.

19:29 ticking: Raynes: sounds simpler than contributing to clojure ;)

19:29 brehaut: ticking: you havent seen me try to merge a patch

19:29 Raynes: Haha, that's exactly the process for contributing to Clojure, except the blood sample.

19:31 ticking: yeah thats the only thing from submitting a 400% faster version of partition-by which is implemented in the even faster partition-between which can split at arbitrary places instead of just borders between values

19:31 hyPiRion: wait 6 months for what?

19:31 the CA to be accepted?

19:32 ticking: hyPiRion: it takes rick that long to channel the dark spirit of clojus the deamon of programming from the 11th dymention to give is dark blessing to the patch ^^

19:33 hyPiRion: Well yeah, obviously.

19:33 * brehaut imagine a partition function that turns [1 2 3] into [[1 1.5] [0.5 3]]

19:33 ticking: lol

19:33 hyPiRion: brehaut: how the.. what? wouldn't it be [1 1] [1 3] ?

19:34 brehaut: hyPiRion: not if you are partitioning in arbitrary places instead of just the borders between values

19:34 hyPiRion: oh right

19:34 brehaut: i never said it was rational :P

19:34 ticking: hrhr

19:34 amalloy: brehaut: you made it produce rational numbers

19:34 ticking: I wonder how the params for the partition funciton would look like

19:35 brehaut: amalloy: someone always has to be pedantic

19:36 amalloy: no, the pedants would have pointed out your lame implementation produces real numbers

19:36 Raynes: sattvik: leinjacker's dep stuff is broken against recent leiningen 2 previews.

19:36 ticking: I would already be happy about something like (partition-between (fn [x y] …) …)

19:37 Raynes: amalloy: Didn't leiningen start using ordered maps as an internal representation of dependencies instead of vectors?

19:37 ticking: in the core

19:37 amalloy: started, then stopped, i think

19:44 dhm: anyone know if it's possible to make ring watch and reload namespaces defined in a project's dependencies and imported at startup time via a symlink in directory 'checkouts'?

19:45 sattvik: Raynes: Hmm… I'll have to take a look at that. Could you open a bug, please?

19:45 Raynes: sattvik: I found out why

19:46 sattvik: Dependencies isn't a vector of vectors anymore, it's a seq of vectors. Just need to change the assertion to look for a seq instead.

19:46 sattvik: https://github.com/Raynes/leinjacker/blob/master/src/leinjacker/deps.clj#L47 these assertions

19:46 sattvik: Raynes: Ah, OK.

19:47 Raynes: sattvik: Want me to throw a pull request at you?

19:47 Well...

19:47 sattvik: Raynes: That'd be great.

19:47 Raynes: I guess asserting a seq would break lein 1 compatibility.

19:47 Are you going for compatibility with lein 1 here?

19:47 I could assert (sequential? ..)

19:48 sattvik: Yes, both Lein 1 and Lein 2.

19:48 That could work.

19:48 Raynes: I'll give that a shot.

19:52 egghead: hey all, I am trying to use a function which slurps up keys/vals via [& {:keys [..]}] -- I have a object containing those keys but I need to pass them individually (somefn :a 1 :b 2) rather than (somefn {:a 1 :b 2}) -- if it wasn't a hashmap I'd use apply, is there anything I could do?

19:53 bbloom: ,(apply concat {:a 1 :b 2})

19:53 clojurebot: (:a 1 :b 2)

19:54 egghead: ah, that works... thanks bbloom

19:54 I was thinking 'I could mapcar list over the keys and vals....' but concat works much better

19:55 Raynes: sattvik: I'm having a bit of trouble running the tests.

19:55 Actual: java.lang.IllegalStateException: Unable to find Leiningen 2 in the path as lein or lein2. Please make sure it is installed and in your path under one of those names.

19:55 I have lein on my path (leiningen 2) as well as lein1 for lein 1.

19:55 Is something wrong with that setup?

19:56 egghead: mapcat*

19:57 amalloy: egghead: you could mapcat identity over the map-entries. concat is better, but mapcat solutions also exist

19:58 Raynes: sattvik: Never mind, drip was breaking it.

19:58 amalloy: Damn your drip.

19:58 bbloom: I found a solution to the slow JVM startup time! i got a faster machine :-P

19:59 egghead: amalloy: ah, mapcat identity is even simpler than what I was thinking, still apply concat seems to make sense since I just want to concatenate all the key/value pairs

19:59 Raynes: amalloy: Remember how we always had that issue where we'd want to kill cake's persistent jvm just to be sure it wasn't causing problem? I do that now with LEIN_JAVA_CMD= lein test

19:59 egghead: you guys are so smart :3

20:03 mpan: what's the most convenient way to run a standalone clojure file?

20:03 osbert: hi, is there somebody here that is an admin on clojars that can delete the jars osbert/hiccup-bootstrap and org.clojars.osbert.osbert/hiccup-bootstrap for me? i just had two huge brain farts. sorry and thanks in advance.

20:03 technomancy: osbert: sure; I can get that

20:04 amalloy: the jvm really doesn't start up slowly enough for developers to notice, bbloom. it's the time spent compiling clojure.core, lein, and your app that you notice

20:05 akhudek: amalloy: can you aot clojure core? I've found even if you aot your entire app the startup time is still ~2 sec

20:05 bbloom: amalloy: i'm just enjoying my new mbp being much faster than my prior machine. `lein repl` now only takes 1ish second to get to a useful prompt, which is a huge improvement for me

20:05 amalloy: probably that's your ssd rather than a faster cpu

20:05 bbloom: amalloy: my prior machine was an older air which had an ssd too

20:06 technomancy: osbert: *voip*

20:06 gone

20:06 osbert: technomancy: thanks, sorry about that.

20:06 technomancy: np

20:06 amalloy: akhudek: even if you AOT namespaces, i believe the compiler checks to see if a source file is available and recompiles it if so; AOT is more for exposing a java-friendly interface. not sure about that, though

20:06 technomancy: AOT does allow for faster loading

20:07 but the bytecode still needs to pass through the verifier

20:07 Raynes: sattvik: Just sent you a pull request. When do you think we can get a release? Codox is broken until we do.

20:07 akhudek: yep, we have a command line app and AOT is pretty crucial to have it start up quickly

20:07 technomancy: FSVO "quickly"

20:07 akhudek: well, people still complain about the 2s :-/

20:08 which is funny because it's a compiler that is not fast

20:08 Raynes: akhudek: I would have written it in Haskell! :D

20:08 akhudek: Raynes: hah, not a bad choice :-)

20:11 amalloy: technomancy: so if your code is AOTed, the compiler doesn't attempt to recompile it? i have a heck of a time figuring out what code is run when you (require 'some.ns) so i can't really track it down myself

20:12 technomancy: amalloy: it still checks the timestamps; if the source is newer it will recompile.

20:12 amalloy: it looks to me like (require 'foo.core) unconditionally involves a call to (load "foo/core.clj") eventually; where's that timestamp check?

20:15 technomancy: wouldn't surprise me to find it in load

20:15 require is all about translating symbols to paths and preventing unnecessary reloads

20:16 amalloy: ah, it's in c.l.RT/load. i was looking in c.l.RT/loadResourceScript, since that's what people are usually encouraged to use; it doesn't do that check

20:22 dhm: regarding my previous question about auto reloading a ring app's dependencies, turns out ring-reload-modified is a great solution for that

20:32 Raynes: Houston, we have documentation http://raynes.github.com/laser/

20:33 technomancy: Raynes: you had documentation before too

20:33 Raynes: technomancy: I don't think I did.

20:33 technomancy: Not pretty html documentation

20:33 technomancy: I mean before you generated and published the HTML

20:33 Raynes: technomancy: You're talking about the code, right?

20:34 technomancy: Raynes: right; just a pet peeve

20:34 amalloy: i think your big rambling README is more interesting/useful documentation than some html that's autogenerated from the sources

20:34 technomancy: IMO repl-accessible docstrings and long-form prose are way more important as documentation

20:34 Raynes: technomancy: So now I can't use when without side efforts or generate documentation? Jesus, I give up.

20:34 technomancy: Raynes: I'm objecting to your treatment of in-repl docstrings =)

20:34 don't discriminate!

20:35 Raynes: technomancy: Well, the docstrings are still there.

20:35 Nothing has changed.

20:35 amalloy: I need to make it even bigger with more rambling.

20:35 technomancy: right; that's what I was getting at; "you had documentation before too"

20:35 Raynes: I'm going to cause you physical harm.

20:36 technomancy: sorry I am getting a bunch of snark tossed my way in #git for expressing my wish that the gc operation was documented and am deflecting it over here

20:36 were documented

20:36 Raynes: wuz

20:36 amalloy: Raynes: you already have caused him physical harm by claiming docstrings aren't documentation

20:37 Raynes: I did not claim that.

20:37 I hate you all.

20:37 technomancy: "Performs a bunch of housekeeping stuff. Don't sweat the details."

20:37 brehaut: technomancy: pity that goes against git's general philosophy of sweating the details

20:38 technomancy: (inc brehaut)

20:38 lazybot: ⇒ 10

20:39 amalloy: technomancy: isn't the behavior of gc explained in the --auto option and CONFIGURATION section of that help page?

20:39 technomancy: amalloy: not really

20:40 amalloy: it says it does two things: repack and prune, but I have a repo with 5MB of loose objects and no unreferenced objects, and a gc brings the size from 1.5GB to 35MB

20:40 so either something else is happening, or the loose objects count is completely bollocks

20:41 ivan: what size were you expecting?

20:42 hyPiRion: well, 5 MB less I suppose.

20:42 amalloy: really, no unreachable objects? how did you get to that state?

20:42 technomancy: amalloy: well, ~0

20:43 amalloy: small enough that pruning had no effect on du -hs

20:43 ivan: I'd expect count-objects to show ~1.5 GB of loose objects

20:43 amalloy: how did you determine 5MB of loose objects?

20:43 sattvik: Raynes: I'm not sure I'll be able to get to it in the next day or two since I am travelling. tcrawley should also be able to make a new release.

20:43 technomancy: amalloy: git count-objects

20:44 ivan: technomancy: but repack compresses tons of nearly-identical text files into one pack

20:44 see .git/objects before and after

20:44 technomancy: ah, because repack is overloaded; it's actually two operations?

20:45 I guess by now I should expect that of git

20:45 amalloy: technomancy: i think that's the last paragraph of the --auto docs

20:45 ie, it can operate on more than just loose objects

20:46 Raynes: tcrawley: Make a new release or I hurt you

20:46 I cut you

20:46 technomancy: yeah, true

20:47 they did tell me in #git that gc.auto is not actually used exactly; it uses an estimate to determine whether it's over the limit, but it's frequently wrong =\

20:48 * dhm remembers not to turn his back on Raynes

20:48 * Raynes twitches

20:49 technomancy: hm; I don't think that's it; `git repack -A` actually increases the repo size

20:49 hyPiRion: I'm not saying I find Raynes threatening at times, but if someone would setup a donation for an anger management therapist to him, I would donate a significant amount of money to it.

20:49 Clojure need healthy developers.

20:49 Raynes: I could probably use some anger management

20:50 dhm: I mean some people make the anger work for them. Like Rambo.

20:50 neilmock: damnit, I came to clojure to avoid the anger of ruby

20:51 technomancy: yeah, gc must be doing some other undocumented operation

20:51 hyPiRion: neilmock: It's only Raynes, everyone else are nice

20:51 technomancy: awesome

20:51 and the only person who knows how it works in #git has me on ignore

20:51 neilmock: higher order functions be damned

20:51 technomancy: because I told him the man page was wrong

20:52 bbloom: technomancy: that'll teach you to correct people

20:52 hyPiRion: technomancy: You never tell people that they are wrong. You ask "hey, I see the documentation states X, but I see Y. Is there something I don't understand here?"

20:53 bbloom: Raynes: I get annoyed when i see API docs with no obvious link back to the README

20:53 mainly b/c i hate API docs....

20:53 technomancy: bbloom: I was actually just repeating what someone told me earlier; there was one nice guy in #git, but he went to bed

20:53 hyPiRion: People hate people correcting them, so better let them "figure" out errors themselves.

20:53 * bbloom joined git to spectate

20:53 technomancy: hyPiRion: well this was just after he kept pointing me to the man page

20:54 brehaut: if someone doesnt like being corrected, they probably shouldnt use IRC

20:54 hyPiRion: technomancy: Oh, then it's rather fruitless, yeah.

20:54 bbloom: it's always entertaining how much the attitude of the BDFL for any community influences the tone of that community

20:54 technomancy: bbloom: sorry, it's done; I'm about to head to dinner =)

20:59 It_the_zfealian: Raynes,

20:59 I Worship His Shadow.

23:20 crease: dnolen: can core.match take arbitrary predicates in the guards?

23:25 dnolen: crease: yes, :when is restricted, :guard is not

23:25 crease: dnolen: cool, thanks.

23:50 dnolen: gfredericks: hey the core.logic version of 4clojure is cool! :D

23:50 tcrawley: Raynes: sattvik: sure thing! I'll do a release tomorrow morning. FIRST THING

23:51 * Raynes puts his knife away.

23:51 Raynes: Excellent, sir.

23:51 tcrawley: *phew*

Logging service provided by n01se.net