#clojure log - Jul 10 2012

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

1:18 yankov: hm, is huge functions like that https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L54 considered as a good practice in clojure?

1:21 scottj: yankov: depends on the function. rhickey writes long functions with big incremental lets.

1:22 yankov: looks crazy. is it easier to read when you know the language more?

1:24 arohner_: yankov: usually, that is not good style. However, this during the bootstrap of the core namespace, so we cut it some slack

1:24 amalloy: no. to read that, you probably need to study the language for a year, and the function for a week

1:24 arohner_: and it has to be crazy fast

1:25 yankov: ja

1:25 ha

1:25 amalloy: arohner_: that's part of the macroexpander - doesn't have to be that fast really, just acceptable

1:26 scottj: arohner_: upped your taxi comment on hn :)

1:26 arohner_: amalloy: I'm not so sure. Parts of that have to run at runtime

1:26 scottj: ha! thanks

1:26 amalloy: arohner_: the generated code does, yes

1:30 yonatane: i see rich started implementing clojure without a parser. How did he know it even works?

1:31 arohner: yonatane: lisp is designed to be easy to parse. And Rich is pretty smart

1:31 yonatane: :)

1:31 arohner: and he'd written a few other lisps before

1:31 yonatane: which lisps?

1:32 actually he also doesn't like test driven programming, according to one of the talks

1:32 arohner: I don't remember the exact names. Something like jFOIL and jFLI

1:32 yankov: got a link?

1:33 arohner: I don't know that the sites are up anymore

1:33 scottj: jfli, Foil, Lisplets, or DotLisp

1:33 google

1:33 yankov: what are some examples of well-written clojure app?

1:34 arohner: yankov: https://circleci.com/ :-)

1:34 that's my site, BTW

1:34 yankov: arohner: oh, i was singed up. awesome idea :)

1:35 scottj: yankov: open source ones?

1:35 yankov: i think I received an email that you guys started testing, but haven't tried yet

1:35 scottj: yup

1:35 arohner: but circleci is not open-sourced though? so there's no way to check out the code P)

1:36 arohner: I was being cheeky because you didn't specify

1:36 scottj: yankov: leiningen. almost all open source clojure are libraries.

1:36 arohner: there are lots of great OSS libraries

1:36 yankov: thanks, I'll check out

1:40 mcohen: looking for some help with lein

1:40 scottj: yankov: I remember enjoying reading code for https://github.com/mjg123/pacman/tree/gh-pages

1:40 mcohen: i've got the preview7 version of lein 2.0

1:40 but it can't find leiningen.core.main once it's "booted" clojure in the repl

1:41 so if i edit the lein script, to remove the "leiningen.core.main "$@"" at the end of the invocation to start the jvm, at about line 214, it works fine

1:41 clojure starts up and i get the clojure repl

1:42 but if i include that last bit - "leiningen.core.main "$@" - then I get a Exception in thread "main" java.lang.NoClassDefFoundError:

1:42 and if i look in the stnadalone jar, i don't actually see a main.class under leiningen/core

1:43 i see a bunch of main_xxxx.class files

1:43 but no plain old main.class

2:14 augustl: how can I make "lein test" keep the jvm running and only reload the files that change?

2:14 I don't want autotesting, I'd prefer to be able to manually tell it when to start running tests

2:23 ivan: do I have to bother someone to get my messages to the Clojure list to go through?

2:24 or maybe someone else could also tell "critique my code!" guy about (pst)

3:00 FND: hi - I've just started learning Clojure (I don't have much of a Java background), and can't quite make sense of some code samples I'm looking at

3:01 in particular, I don't understand leading and trailing dots: e.g. `let [dict (java.util.HashMap.)]` -- why the trailing dot?

3:02 Nican: http://clojure.org/java_interop

3:02 The dot is creating a new instance of the java object.

3:02 FND: ah, thanks!

3:13 ro_st: ibdknox: 0.0.7 looks great!

3:14 i'm just not sure how to update it. i've run both the installer command and the simple ./light table commands, but the ui i get doesn't look like the one in your announcement (no live button or bottom-right menu). and it tells me 0.0.8 is available ?

3:15 ah, just found ./light update 0.0.7. it's downloading.

3:25 FND: ah I see Light Table is a valid topic for discussion here - in that case: how can I add something to the class path (using v0.0.8, installed this morning)

3:27 ro_st: FND, looks like there is a channel #lighttable

3:28 FND: roger, thanks

4:35 michaelr525: good morning :)

4:35 late morning

4:39 ro_st: lein ring server is supposed to reload clj files, right?

4:44 michaelr525: ro_st: it works for me.. but i

4:44 i'm not sure it works all the time

4:57 ro_st: me neither. it's also not clear what will be reloaded and what won't

4:57 should probably RTFM :-)

4:58 FND: there's a revolver joke in there somewhere

5:00 ro_st: so, i have a requirement for a vector of maps to be kept in a particular order. i see we have sorted sets and sorted maps. do we have sorted vectors?

5:02 hyPiRion: ro_st: Like a red-black tree?

5:03 I don't think so.

5:03 ro_st: this is actually a question about clojurescript. i have a list of nodes (each with a viz representation). the user can add nodes to the end or anywhere in the middle. i'm trying to figure out how to model this with clojure's data structures

5:04 an additional constraint is that there is a separate list of node templates that have a proscribed order. that order needs to be kept intact when nodes are created in the active list

5:04 in good old js, this'd be an array and i'd use push or .splice as appropriate

5:07 i'm thinking i'll start with sorted-set and see where that gets me

6:05 the-kenny: sorted-set doesn't sound right

6:31 wingy: how do i check what dep versions i have installed

6:31 lein deps show nothing

6:33 michaelr525: wingy: ls lib

6:33 wingy: michaelr525: its empty

6:34 eg. in node i could just do "npm ls" and it would list all installed deps and their versions

6:34 so if i specified "2.1.x" in the package.json i could now see what version was installed

6:35 or "2.1"

6:36 ohpauleez: wingy: If lib is empty, you haven't pulled any deps at all

6:36 you can also look in ~/.m2 to see what deps you have previously pulled

6:36 (your local maven cache)

6:38 wingy: ohpauleez: how do i pull deps to the local project then?

6:38 ohpauleez: lein deps

6:39 wingy: hm .. nothing happened .. empty line returned

6:39 ohpauleez: are you using lein2?

6:39 wingy: from the help: deps Show details about dependencies.

6:39 yeah

6:40 ohpauleez: ahh yeah, it'll happen automatic when you do something like `leon repl`

6:40 lein repl

6:40 and if you look at `target` you can see a dependency file

6:41 but your deps are always listed in project.clj

6:41 so you can just view that file and find out

6:42 wingy: ohpauleez: but i need to find out exact what version was installed

6:43 ohpauleez: wingy: It's in there

6:43 you have to specify the version in there

6:43 wingy: but what if i specified a range

6:44 ohpauleez: it uses the leading the version I believe. That usage is usually not used

6:49 wingy: http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges

6:49 how do i specify a range correctly?

6:50 this didn't work: [compojure "1.0,2.0"]

6:50 or perhaps it did

6:52 no it didnt

6:53 ohpauleez: You wouldn't do that with compojure, You'd specify the exact version you'd using (because the functionality changes between the versions). The only time people typically use the range in on the version of Clojure they depend on, but that's also very very uncommon. See this: http://grokbase.com/t/gg/clojure/126k0fxk67/wildcards-in-leiningen-dependencies-versions

6:53 and the versions need to be in a seq (a list) I believe

6:56 wingy: ohpauleez: i cant keep watching for new patches all the time manually

6:56 ohpauleez: which is why the leon outdated plugin exists

6:56 and you don't want to watch for new versions

6:56 the-kenny: wingy: are you on leiningen 2?

6:56 wingy: the-kenny: yeah

6:56 ohpauleez: i c

6:56 ill check on that one

6:57 ohpauleez: you want to develop against concrete versions only, and update when you need new functionality

6:57 so that you stay stable in your project

6:57 the-kenny: wingy: lein deps :tree

6:57 wingy: ohpauleez: yeah sounds pretty logical

6:57 ohpauleez: but

6:57 ohpauleez: Sometimes I setup my own SNAPSHOT release of a project on clojars

6:57 when I want to apply new patches myself for my own projects

6:57 wingy: the last nr eg. 2.2.x tends to be for bug fixes and not change features

6:58 ohpauleez: then before deployment, I might cut my own release or switch to an official release

6:59 wingy: the-kenny: thx

7:00 ohpauleez: https://github.com/ato/lein-outdated ?

7:01 ohpauleez: that'd be the one. Also you can also use `lein help COMMAND` for more info - the-kenny's suggestion is the first piece of help information on the `deps` command docs

7:02 wingy: ok

7:02 wow lein-outdated rocks

7:03 ohpauleez: the plugin is mentioned in the previous link I gave you (with an argument against the multi versions you were asking about before)

7:03 so I think you'll find it useful for sure

7:04 wingy: yeah i already find it better than auto update

7:17 ohpauleez: something like outdated should be in the core of lein

7:18 ohpauleez: it could get merged in eventually, that's not uncommon, but Leiningen's plugin system is powerful and there are many great plugins

7:25 ro_st: what does it mean when someone does this: (def ^:dynamic var-name value)

7:25 ohpauleez: ro_st: It's a dynamic var (and the name should have earmuffs - *my-value*)

7:25 it can be rebound in a binding form

7:26 ro_st: and more importantly, can i use it to store captured config values from System/getenv?

7:26 ohpauleez: otherwise, standard (non-dynamic) defs are set for life

7:26 (like constants)

7:26 ro_st: eg so that i can override these values within midje's background

7:26 nixn: ro_st: http://clojure.org/vars

7:27 ohpauleez: ro_st: You can rebind them whenever you want

7:28 ro_st: so say i have a my.app.config ns which simply gathers values from System/getenv into a bunch of these ^:dynamic values. with midje, would i then have to put all my facts into a (binding) form?

7:29 to override those config values

7:30 don't want to store config in the code, but for tests, where i want to control the env in which testing occurs, i do want to be able to override config values. trying to determine the simplest way to do this

7:30 ohpauleez: how's shoreleave coming along? :-) i've been playing with cljsbuild today, particularly the crossover stuff. works great

7:32 ohpauleez: ro_st: re-dynamic vars - exactly, they're mostly used to store and redefine configs (or resources)

7:32 shoreleave is coming along! Haven't had as much time to work on the demo apps as I've wanted, but it's getting there!

7:37 ro_st: ohpauleez: is this how i'd do it? https://www.refheap.com/paste/3536

7:38 ohpauleez: Usually binding is a top-level form, like `let`

7:38 but not sure what the midge specific stuff is

7:38 ro_st: i want to avoid sticking all my facts into a binding because it messes with midje-mode

7:38 if the facts aren't top level

7:38 ohpauleez: ahh gotcha

7:39 ro_st: anyone know what brian marick's irc handle is? does he come on here?

7:39 otherwise i'll tweetle at him

7:39 haspaker: I've sent my genetic algorithm out on a 200,000 iteration journey

7:40 We'll see if it comes up with anything useful after an hour or so

7:40 ro_st: neat! what is its output?

7:41 haspaker: I've feeded the algorithm a function - like (fn[x] (* 10 (+ x 2)))

7:41 The goal of the algorithm is to construct a function that is as close to the original function as possible

7:41 Without seeing the original function, it can only see what the original function outputs

7:42 I've basically constructed to most cumbersome and impractical way ever to do preschool math

7:42 clgv: genetic programming^^

7:43 haspaker: Yeah :P

7:43 ro_st: good luck with that

7:43 is this using logic programming?

7:43 haspaker: Depens

7:43 clgv: unlikely

7:43 ro_st: i watched the euroclojure intro to core.logic the other day, very interesting

7:43 haspaker: *depends

7:43 What is "logic programming"?

7:43 clgv: haspaker: prolog

7:44 ro_st: https://vimeo.com/45128721

7:45 haspaker: clgv: Ah. Looked it up on wikipedia

7:45 And you're right that I don't use it

7:46 Didn't even know what it was

7:46 clgv: do you use clojure symbols and constants as building blocks?

7:46 or more highlevel?

7:52 haspaker: clgv: I use symbols as building blocks

7:52 It's only simple math, so all the symbols I need are "+ - * / ) ( x"

7:52 And some numbers

7:58 wingy: haspaker: so cool

8:00 ticking: I'm wondering, when is it idiomatic to use multimethods, and when to use pattern matching in defn?

8:01 wingy: ticking: with pattern matching you mean destruction?

8:01 ticking: wingy, yeah

8:01 wingy: or destructuring

8:01 :)

8:02 ticking: the latter are used each time when you want to access some elements inside a collection (list, vector, set and map)

8:03 ticking: wingy, yeah I havent quite found a case where I'd use multimethods yet I guess, except for java interop

8:04 wingy: ,(defn greet [{:keys [name]}] (str "Hello " name)) (greet {:name "Pete" :age 20})

8:04 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

8:04 wingy: :/

8:04 ticking: hrhr^^

8:05 wingy: ticking: multimethods is something i read yesterday :) i think you will use it when you want something that resembles class system/polymorphism in oop

8:05 clgv: &(letfn [(greet [{:keys [name]}] (str "Hello " name))] (greet :name "Pete" :age 20))

8:05 lazybot: clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox4972$eval17407$greet

8:05 clgv: &(letfn [(greet [&{:keys [name]}] (str "Hello " name))] (greet :name "Pete" :age 20))

8:05 lazybot: ⇒ "Hello Pete"

8:06 wingy: cat and dog is an animal .. but when you do (speak cat) and (speak dog) the former will say "miao" and the latter "woff"

8:07 oh yeah now i know what sandbox mean, no vars :)

8:11 * ticking (defn noise ([{:dog :type}] (print "woof")) ([{:cat :type}] (print "miau")))

8:11 ticking: (defn noise ([{:dog :type}] (print "woof")) ([{:cat :type}] (print "miau")))

8:11 thought this would work, so this is where you would need multimethods

8:13 damn, I really hoped clojure would support this

8:13 wingy: yeah that one would be better refactored into multimethods i think

8:14 ticking: well it doesn't work at all

8:14 nixn: that should be a decision based on types, not on multi-methods

8:14 ticking: I had hoped it would do (noise {:type :cat}) => miao

8:15 nixn, yeah, it was only a very contrieved example, but clojure doesn't support literals in destructuring right?

8:15 clgv: ticking: no not that way. destructuring is not pattern matching

8:15 ticking: clgv, thanks, that clears up some things, damn I like patter matching ^^

8:16 nixn: s/patter/pattern/ ^^

8:16 wingy: nixn: you mean protocols?

8:16 clgv: you can do (defn noise {:keys [type]}] (case type :dog (print "woof") :cat (print "miau") nil)

8:16 wingy: http://stackoverflow.com/questions/8070368/clojure-multimethods-vs-protocols

8:17 clgv: ticking: this is not extendable. implementing it via multimethod would make your noise function extendible to new kinds of animals ;)

8:18 ticking: clgv, right thats a good point, this helps see what multimethods can be used for :) thanks

8:18 nixn: wingy: I'm not quite sure ... a beginner yet

8:19 ticking: clgv, but I think patterns wouldn't hurt either ;)

8:20 clgv: ticking: dnolen is implementing a pattern matching lib "core.match"

8:21 wingy: ticking: seems that you could/should use protocols instead for this simple case: http://clojuredocs.org/clojure_core/clojure.core/defprotocol

8:21 ticking: clgv, awesome ^^

8:22 wingy, yeah I'm currently reading about those as well

8:22 I'm wondering if I have something like a rectangle

8:22 wingy: cool im not the only beginner

8:22 ticking: btw are you using light table to test things out?

8:23 a good recommendation!

8:23 ticking: should I represent them by doing a map {:x 0 :y 0 :width 5 :height 10} or a record

8:24 clgv: ticking: start off with a map. if you need soething different you can change

8:24 ticking: wingy, currently I'm using clooj, until I get my swank running, once light table is out I'll use that but the playground is too limited for my image processing stuff ^^

8:25 clgv, thanks I'll do that ^^

8:26 wingy: didnt know about that one

8:29 ticking: wingy, what lead you to clojure^^?

8:30 wingy: ticking: light table lol

8:30 i always felt that FP was cool .. read about haskell and clojure before the switch

8:31 then i saw the light table demo and felt that clj code looked cool and gave it a real shot

8:31 also i used LiveScript on node.js which introduced many FP concepts including a std lib like the one in Haskell

8:32 so i was totally drawn to FP and wanted to use a real modern FP lang

8:32 ticking: and you?

8:32 ticking: wingy cool ^^ yeah light table seems to draw a lot og folks towards lisp ^^

8:33 wingy, I wanted to use a lisp at work and clojure seemed like the one that would most likely get permitted ^^

8:34 wingy: yeah .. watch http://blip.tv/clojure/neal-ford-neal-s-master-plan-for-clojure-enterprise-mindshare-domination-5953926 .. he talks about different strategies to draw people to clj

8:34 light table is a good step

8:34 ticking: hrhr

8:35 wingy: ticking: its modern and supported by heroku .. one of the criterias that must be fulfilled :)

8:35 ticking: hrhr

8:35 normally I'm a joxa guy lisp on erlang, feels a bit cleaner than clojure but is by no way widespread^^

8:36 wingy: is there a lisp on erlang?

8:36 ticking: yeah ^^

8:36 wingy: https://github.com/rvirding/lfe

8:36 ticking: well it's on beam (erlang vm) just like clojure is on the jvm

8:37 nope http://joxa.org/ ^^

8:37 lfe is a lisp 2

8:37 I find it annoying if vars and funs reside in different namespaces

8:37 clojure and joxa are a lisp-1 same namespace for both

8:37 which does clojure really nice ^^

8:43 wingy: what's up with all that xml :)

8:43 is it an erlang thing?

8:43 ticking: hu xml ^^?

8:43 wingy: oh

8:43 no they were just placeholders

8:44 ticking: ah those you mean, yeah thats just macro pattern annotation ^^

8:44 nothign you see besides the docs

8:44 wingy: ticking: you know erlang?

8:44 ticking: wingy, yeah but I always hated its syntax ^^

8:45 Hodapp: I've never used Erlang but it sounds like it has one of the only models of concurrency that's actually known to scale well in practice

8:45 wingy: perhaps erlang is a better fit with lisp since they are both FP?

8:45 ticking: wingy , totally

8:46 Hodapp, yeah also its system of concurrency is not only optimized on parallelism but also on robustness and fault tolerance^^

8:47 makes the whole "let if fail" thing possible

8:47 wingy: ticking: perhaps clojure could be run on erlang some day?

8:47 just like it is run in .NET, Java and JavaScript

8:48 then we don't need to switch lang

8:48 ticking: wingy, possible people are creative, but I don't think it would be worth it

8:48 the cool thing about lisp is that concepts are very uniform across dialects

8:48 wingy: since why would i make that switch to joxa if it only runs on erlang .. and erlang is not as supported as java

8:48 ticking: also clojure has its quirks because its based on jvm, joxa has its quiks from beam

8:49 wingy, it depends on what you want to do, erlang has a huge supportive user base, but with a different focus than java

8:50 wingy: yeah

8:50 ticking: wingy, erlang is an infrastructure language

8:50 wingy: no matter what i use i will be certain it will be a lisp lang

8:50 its way ahead of it's time :)

8:50 ticking: hrhr yeah ^

8:52 cshell: cemerick: Is it correct that the openid workflow in friend assumes that the user types his openid identifier in and posts it and then gets redirected to the provider's login screen, rather than allowing the user to select his provider explicitly via chooser?

9:06 bordatou`: okay, i couldn't find how to disable autoupdate in lein, every time when i copy a local jar into lib folder and do a jar then everything gets deleted

9:07 what a mess

9:08 hello

9:08 ]

9:10 ]

9:10 ]

9:11 clgv: bordatou`: https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L59

9:11 cshell: he's gone

9:12 bordatou`: why are you spamming ']'?

9:13 bordatou`: cshell: i am sorry not spamming

9:13 wingy: does anyone else agree with my comment in here that it should be (do seq) and not (do coll) http://clojuredocs.org/clojure_core/clojure.core/doall

9:13 i mean doall

9:15 cshell: bordatou`: <clgv> bordatou`: https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L59

9:15 the-kenny: wingy: doall/dorun calls `seq' on its arguments. `seq's argument is a coll, it returns a seq, so I disagree

9:15 bordatou`: cshell: I know clgv did pointed me to that link, I tried most of the options and still couldn't prevent lein from deleting local jar in lib folder

9:16 cshell: i tried update online?

9:16 wingy: the-kenny: but that detail shouldn't be told to the users .. its implementation detail .. eg. you should pass a sequence to it .. but it is nice to you and would auto convert if you passed a coll

9:17 coll is not a seq .. so looking at the signature you can't pass a seq

9:17 but a seq would work

9:17 (its the only one that works but its auto converting for you in the background)

9:18 another question: collections cant be lazy? they are concrete data structures right?

9:18 the-kenny: The docstring could be clearer

9:18 cshell: bordatou`: line 59

9:19 wingy: the signature as well .. where can i post change requests like this?

9:19 for clojuredocs and the original one

9:20 cshell: pull requests on github?

9:20 wingy: for clojure or clojuredocs?

9:20 bordatou`: cshell: all this time i have been looking at https://github.com/technomancy/leiningen/blob/preview/sample.project.clj

9:21 the-kenny: wingy: Clojure. You should open a ticket in JIRA for this

9:21 clgv: &(doseq [x [[] '() {} #{}] (println (doall x)))

9:21 lazybot: java.lang.RuntimeException: Unmatched delimiter: )

9:21 clgv: &(doseq [x [[] '() {} #{}] (println (doall x))

9:21 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

9:22 clgv: &(doseq [x [[] '() {} #{}]] (println (doall x)))

9:22 lazybot: ⇒ [] () {} #{} nil

9:22 cshell: bordatou`: yeah, that's for 2+

9:22 clgv: wingy: so "coll" is right

9:22 bordatou`: damm, thanks cshell.

9:22 wingy: clgv: ok since i can pass a coll then it should be like that i guess

9:23 cshell: np

9:23 wingy: but since i can pass a seq as well shouldn't it at least be in the signature as well?

9:23 (doall coll|seq)

9:23 clgv: wingy: you stick too much to unimportant details...

9:24 wingy: details are not unimportant :)

9:24 seq is not coll

9:24 ,(seq? [1 2 3])

9:24 clojurebot: false

9:24 ohpauleez: ,(sequential? [1 2 3])

9:24 clojurebot: true

9:24 ohpauleez: wingy ^

9:25 octagon: is there a rich hickey chia pet available for purchase?

9:25 if not, can someone please get that going?

9:25 ohpauleez: ,(seqable? [1 2 3])

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

9:26 ohpauleez: wait, that's in contrib, use sequential

9:26 michaelr`: ,(seq [1 2 3])

9:26 clojurebot: (1 2 3)

9:27 wingy: ohpauleez: that means the correct thing is to have (doall sequential)

9:27 ohpauleez: no it does not

9:27 ,(sequential? (seq [1 2 3]))

9:27 clojurebot: true

9:27 ohpauleez: ,(sequential [1 2 3])

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

9:28 ohpauleez: ,(sequential? [1 2 3])

9:28 clojurebot: true

9:28 wingy: (doall coll) .. thats what i am saying

9:28 oh wrong

9:29 ohpauleez: you can pass in anything that is sequential, seq, collection, etc -for the reason suggested above. But fundamentally, anywhere you see "coll" this is usually true

9:29 wingy: i mean (doall sequential) seems right since you can pass whatever that is sequential? .. a coll or a seq

9:29 ohpauleez: but seq? and sequential? are not the same

9:29 wingy: (doall coll) means (doall (seq [1 2])) wouldn't work

9:30 the-kenny: ,(coll? (seq [1 2 3]))

9:30 clojurebot: true

9:30 the-kenny: ,(coll? [1 2 3])

9:30 clojurebot: true

9:30 wingy: ok that was something new :)

9:30 ohpauleez: because collections implement sequential

9:30 clgv: (inc the-kenny)

9:30 the-kenny: \o/

9:31 ohpauleez: they're all tries underneath, afaik

9:44 wingy: ok made this i think would help me get it more: https://www.refheap.com/paste/3538

9:51 clgv: &(seq? (cons 1 nil))

9:51 lazybot: ⇒ true

9:52 wingy: clgv: yeah

9:54 according to this one https://www.refheap.com/paste/3538 when it says coll in the doc it means all colls and seqs since seqs are colls .. i thought it wasnt

9:57 its updated if you (all beginners here) want the latest one :)

9:59 michaelr`: cool.. i replaced jetty with aleph and the percieved page loading speed seemed to improved noticeably

10:00 wingy: michaelr`: did you need to change your source code to fit aleph async style?

10:00 michaelr`: wingy: nope

10:00 wingy: cool

10:00 michaelr`: wingy: it has ring-compatible sync mode

10:00 wingy: nice

10:01 michaelr`: check here if you are interested: https://github.com/ztellman/aleph/wiki/HTTP

10:01 wingy: thx

10:09 minikomi: hi there

10:09 cmiles74: Good morning :)

10:09 minikomi: good evening (from tokyo!)

10:10 cmiles74: :P That's far from Western Massachusetts.

10:10 minikomi: haha

10:10 I just tried to run this on 4clojure but keep getting a time out.. https://www.refheap.com/paste/3539

10:11 is there something silly I missed?

10:11 (problem 115..)

10:11 cmiles74: I pasted it in and it ran in 0.045 secs... I'm using Clojure 1.3

10:11 locojay1: hi i would like to apply multiple functions to a sequence using map. i could do (comp f1 f2 ...) but this would require that each function has same return value (elem of sequence). my function only do some monger update's. thanks

10:12 minikomi: bummer

10:12 seems the site is a bit wonky at the moment haha

10:12 cmiles74: Ah.

10:12 minikomi: local repl is also 30~50 ms for me

10:13 cmiles74: minikomi: Here's a gist of the same code, https://gist.github.com/3083515

10:13 minikomi: all but the last one pass for http://www.4clojure.com/problem/115 haha.. it times out..

10:15 tmciver: locojay1: how about using juxt?

10:15 locojay1: tmciver: thanks this is it.

10:15 gfredericks: locojay1: can you give an example input and output?

10:19 minikomi: bummer

10:19 well, guess I'll go to bed & try again tomorrow haha

10:21 locojay1: gfrederikcks : input is a sequence of integers, and i would like to apply multiple functions which update some stuff in mongodb given a integer . so there's no reall output.

10:22 gfredericks: locojay1: ah ha, so it is side effects; I would use doseq; (doseq [n my-ints] (f1 n) (f2 n) (f3 n))

10:23 I think that's what you're asking for

10:23 also (doseq [n my-ints] (doto n (f1) (f2) (f3))) would work too I think

10:25 locojay1: thanks

10:29 that's what i was looking let each number supplied to multiple function instead of using comp and have each function return the same input

10:31 gfredericks: juxt does something similar, but is more pure-function-style rather than side-effect-style

10:36 locojay1: since i m doing db plumming i guess doto is better as docs this.

10:36 gfredericks: ,(doc doto)

10:36 clojurebot: "([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"

10:36 duck1123: (doall (for [n my-ints f ['f1 'f2 'f3]] (f n)))

10:37 gfredericks: duck1123: doseq could do that too couldn't it?

10:37 duck1123: well, doseq won't save the result. Can doseq take multiple pairs?

10:37 I guess I don't do that enough

10:38 gfredericks: &(doseq [a [1 2], b [:hey :ho]] (println a b))

10:38 lazybot: ⇒ 1 :hey 1 :ho 2 :hey 2 :ho nil

10:38 gfredericks: duck1123: he said no output so I assume saving the result would be unnecessary and wasteful

10:38 duck1123: true

10:55 edge86: what's the term for extra keywords in arguments such as this here?

10:55 (for [x (range 100000000) y (range 1000000) :while (< y x)] [x y])

10:55 I want to learn about them but they're tricky to google. for clairity, I'm looking at the :while in the above line

10:57 ohpauleez: edge86: Optional keyword arguments

10:57 edge86: thanks!

10:57 ohpauleez: you get them doing something like: (defn my-func [arg & opts] (let [optional-args (apply hash-map opts)] ..))

10:58 edge86: np

11:03 augustl: how do I "map" a map? Need to run all values through a function.

11:03 nDuff: augustl: zipmap?

11:03 augustl: nDuff: looking it up, tnx

11:05 nDuff: augustl: ie. (let new-map (zipmap (keys old-map) (map some-fn (values old-map)))

11:08 michaelr`: also:

11:08 ,(into {} (map (fn [p] p) {:a 1 :b 2}))

11:08 clojurebot: {:a 1, :b 2}

11:14 gfredericks: ,(into {} (map identity {:a 1 :b 2}))

11:14 clojurebot: {:a 1, :b 2}

11:14 gfredericks: ,(into {} {:a 1 :b 2})

11:14 clojurebot: {:a 1, :b 2}

11:22 ttimvisher: what's the easiest way to get a reference to a private field on an object?

11:24 gfredericks: if there's nothing in the clojure Reflector class then probably just through the standard java reflection api

11:24 the clojure Reflector might not be public-intended in any case

11:30 david: Hello.

11:31 I have a map that I'd like to traverse and for each item I'd like to do a test and if that test is true I'd do some side-effect such as println. What would be the best construct to use for this?

11:32 I meant *tree not map

11:33 ttimvisher: gfredericks: thanks for the pointer

11:34 locojay1: what is the correct syntax for something link (defn play [elem & args] (doto elem args)) (play 3 println println) should output 33. but i get ArraySeq cannot be cast to Fn. thanks

11:35 ttimvisher: actually, my problem may be even more complicated. I'm getting a reference to an implementation of a service from a spring classpath context and the instance variable is obviously only in the implementation class

11:35 :)

11:35 gfredericks: locojay1: try (doseq [f args] (f elem)), or ((apply juxt args) elem)

11:39 locojay1: same issue its more why can i wrap inside a function ((juxt print print) 3) works and output is 33 but (defn play [elem & forms] ((juxt forms) elem)) will output error

11:42 nDuff: locojay: I'm wondering if perhaps you want (apply juxt forms) there.

11:42 duck1123: because forms is a sequence where juxt takes just functions. (you'll need to use apply)

11:43 locojay1: thanks

11:43 nDuff: locojay: I suspect that you want (play 3 print print) to become ((juxt print print) 3) rather than ((juxt (print print)) 3)

11:44 sayyestolife: Ok. My previous IRC-client bugged out so I'll try again.

11:44 I have a tree that I'd like to traverse and for each item I'd like to do a test and if that test is true I'd do some side-effect such as println. What would be the best construct to use for this?

11:45 foxdonut: any thoughts on having 'map' only once in (->> coll (map f1) (map f2) (map f3)) ?

11:47 nickmbailey: do cljs projects handle javascript dependency management with lein somehow?

11:48 foxdonut: score another one for the rubber duck. (map (comp f3 f2 f1) coll)

11:55 _wingy: what would one use xml for in clojure land?

11:56 duck1123: producing or reading?

11:56 RickInGA: _wingy: probably interfacing with other systems

11:56 duck1123: namespace aware?

11:56 _wingy: or is the mentality to move away from it as far as possible

11:56 foxdonut: web services perhaps

11:57 _wingy: RickInGA: yeah thats what i thought about. Do you think its ok to only provide JSON http api?

11:58 duck1123: both i guess

11:58 foxdonut: _wingy: who is consuming your api?

11:58 duck1123: for producing, just hiccup works well enough for me

11:59 _wingy: no one atm. i need to know if xml is someone we should provide or is it ok to ditch it eniterely

11:59 duck1123: for reading, it depends on if you need ns-support

11:59 nDuff: Hmm.

11:59 _wingy: some web services only have xml support others have only json

12:00 they dont care about their users need they choose what feels right for them

12:00 * nDuff has an atom with a queue of errors to be presented to the user by his UI layer, and is trying to figure out the safest way for the UI layer to manage same.

12:01 _wingy: is that stupied since youl could have both the xml and json customers if you provide both

12:01 duck1123: I like xml-picker-seq if you need ns-support

12:04 of course, now that I look over the relevant code. I'm wondering if I'm actually using that lib anymore or am completely using XOM

12:06 kaoD: hi

12:08 uvtc: hi, kaoD

12:16 dnolen: nDuff: I looked at the patch, looks OK, if you add some tests I'll apply.

12:23 nDuff: dnolen: *nod*. Will repost w/ a test case added shortly.

12:29 * nDuff waits for v8 to build (running the tests with node appeared to fail in a place unrelated to his code)

12:33 dnolen_: nDuff: yeah testing CLJS via Node not recommended.

12:33 nDuff: ...hrm; we have some other tests that assume a default namespace of user.

12:33 * nDuff makes it so.

12:37 nDuff: dnolen_: Updated patch attached.

12:44 dnolen_: nDuff: one thing I'm confused by is why we need the reader-ns dynamic var ... why can't we just create-ns w/ the *cljs-ns*

12:48 droidboi: i am looking for work in london

12:49 UK

12:50 what are the type of jobs there

12:50 nDuff: dnolen_: ...oooh. Actually, in trying to fix things up, I broke some of the original intent.

12:51 droidboi: banking?

12:51 nDuff: dnolen_: ...if I'm following correctly, reader-ns was intended to be a gensym to distinguish it from any namespace the user might _intentionally_ be trying to refer to.

12:52 droidboi: or more broadly, 'finance'.

12:52 what is the typical job

12:53 nDuff: dnolen_: ...that said -- I don't know the code in question well enough to really be comfortable with the solution in question; this really was just a direct port of DSkarda's patch.

12:53 dnolen_: nDuff: I don't follow. this is about handling ::foo. not :alias/foo or :fill-ins/foo

12:53 nDuff: er :full-ns/foo

12:54 nDuff: so I don't see why we need any of those dynamic vars, could be missing something tho ...

12:56 nDuff: Oooh.

12:57 Investigating that, found a bigger bug (places where the test suite was explicitly testing for wrong behavior)

12:59 dnolen_: nDuff: in the reader tests?

13:00 nDuff: in core.test, ie. (assert (= #{:user/shape} (parents ::rect)))

13:00 ...but that's within (ns cljs.core-test)

13:00 dnolen_: nDuff: ah right, yeah, probably copy and pasted old tests.

13:02 nDuff: dnolen_: ...so, reverting the non-test code and making the line "(if-let [form (binding [*ns* (create-ns ana/*cljs-ns*)] (read rdr nil nil))]" results in some of those being expanded to :cljs.user/* rather than :cljs.core-test/*, which isn't right...

13:03 dnolen_: nDuff: "some" ?

13:04 nDuff: Presumably all, but haven't explicitly validated contrary.

13:04 (some (constantly true)) => true, after all.

13:05 dnolen_: nDuff: so worth investigating why *cljs-ns* doesn't handle this. seems to unexpected to me.

13:10 nDuff: ok I understand what's going.

13:10 nDuff: dnolen_: ...well, I don't really understand the logic here. We're setting up the *ns* for the reader just once, at the beginning of form-seq, right? So even if *cljs-ns* gets rebound partway through, it seems fully expected to me that the *ns* wouldn't change. If there's something in the code that's expected to handle that case correctly by intent, well I don't know it well enough to follow.

13:10 dnolen_: nDuff: read time vs. analyze time problem, still think the intention of the old patch could be clearer.

13:11 ::foo -> :cljs-unknown-ns/foo, which we can fix when we encounter keywords via analysis.

13:12 nDuff: ^ this was the intention of the original patch.

13:12 nDuff: *nodnod*.

13:12 that's what I was intending (and failing) to describe earlier when I was talking about why there was a gensym in the first version.

13:13 dnolen_: nDuff: the original patch is good, it should be left alone, just updated for master. Would be nice to add a comment on what *reader-ns* is, a namespace that most be resolved at analysis time.

13:14 nDuff: ...well, it's not quite good -- I was getting a test failure off it.

13:14 * nDuff reruns the suite

13:14 dnolen_: nDuff: I mean skarda's patch - what was failing?

13:15 nDuff: Hmm -- runs fine now. *scratches head*

13:15 * nDuff was seeing a gensym'd namespace leaking out.

13:16 dnolen_: nDuff: skarda's patch updated for master + tests welcome and will be applied.

13:16 nDuff: *nod*. Generated, will be posted shortly.

13:16 dnolen_: nDuff: a comment around the role of reader-ns please if you don't mind.

13:17 nDuff: thx much.

13:18 nDuff: dnolen_: attached as CLJS-266-r3.patch

13:26 dnolen_: nDuff: applied to master

13:26 wingy: is there a reason for "get" to be a function when you can just use the collection as the function?

13:27 and they work exactly the same

13:28 nDuff: (oops -- missed the request for a comment 'til looking back at the channel just now)

13:28 dnolen_: nDuff: I added it, no problem.

13:32 nDuff: thx for the bump on that ticket.

13:49 nDuff: dnolen_: np; very much a scratching-my-own-itch thing. (Using a lot of watchers crossing namespaces, so wanted to have namespaced keys on them)

13:54 kaoD: how can I put a lazy sequence inside another lazy sequence without the inner one being evaluated in the outer cons?

14:05 wingy: working in FP style is like working with cards .. you shuffle them .. you sort them .. you mix them etc

14:06 each collection is like a deck of cards

14:06 poker time!

14:09 scriptor: how would you reduce a deck?

14:10 wingy: summing all values?

14:10 TimMc: scriptor: Fire.

14:13 (reduce burn flame deck)

14:13 ohpauleez: Interview with Alan Kay by Binstock: http://www.drdobbs.com/architecture-and-design/interview-with-alan-kay/240003442

14:13 "the web was done by amateurs"

14:13 SO good

14:15 ttimvisher: what's the proper `class` test in a multi-method for `{}`?

14:18 anyone have a preferred way to load up their entire source into swank so that something like `C-c <` works properly?

14:21 bobo_: when i have a running swank with emacs (jack-in). Kan i get it to fetch new dependencies without havint to restart?

14:22 technomancy: bobo_: not really

14:23 bobo_: ok thanks =)

14:23 technomancy: you can manually fetch new versions if you declare a runtime dependency on pomegranate, but there's no good way to apply updates to project.clj

14:24 bobo_: its not that much work to restart it. Just wanted to be sure im not missing something

14:24 madsy: Ahh.. demoscene party coming up, and I'm all out of ideas for demo effects

14:24 Stupid brain.. work!

14:29 joegallo: ttimvisher: IPersistentSet, probably.

14:30 foxdonut: madsy: pound your head like an old TV

14:30 joegallo: that is, clojure.lang.IPersistentSet.

14:30 ttimvisher: joegallo: referring to the class question? ended up using java.util.Map

14:31 isa? and implements? continue to confuse me :(

14:31 joegallo: derp, i'm so dumb.

14:31 i read that as #{}...

14:31 wingy: ohpauleez: yeha nice article

14:31 joegallo: anyway, yeah, java.util.Map is probably just fine.

14:31 ttimvisher: i'm the dumb one, of course, because i forgot that i was wrapping it in a ref anyway

14:32 so now i'm trying clojure.lang.Ref

14:32 joegallo: ttimvisher: and it seems that that's good enough for rhickey: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L77

14:32 wingy: ohpauleez: reminds me about Bruce Lee who didn't believe in style as well .. he wanted you to forget style .. there is no style in fighting .. there is the shortest distance between you and the opponent

14:33 clojure seems pretty good in this aspect .. keep it simple

14:33 ttimvisher: any day Brue Lee comes up in #clojure is a good day

14:34 :)

14:34 foxdonut: lol

14:35 wingy: principles are universal no matter what field you are in

14:36 ttimvisher: so i've got a multimethod defined with class as the dispatcher

14:36 i have method defined with clojure.lang.Ref as the dispatch value

14:36 and when i try to call it with a defined using (ref ...)

14:36 i get no method found

14:37 but

14:37 wingy: but his advice on being formless would not be great in this channel :)

14:37 ttimvisher: ,(isa? (class (ref {})) clojure.lang.Ref)

14:37 clojurebot: true

14:37 ttimvisher: so what am i missing?

14:37 ,(class (ref {}))

14:37 clojurebot: clojure.lang.Ref

14:38 ttimvisher: interestingly, the stacktrace i get references: clojure.lang.Ref@18ab088

14:38 and the @ bit changes everytime

14:38 zakwilson: Pastebin a minimal version of your code.

14:39 hiredman: ttimvisher: @18ab088 is part of the hashcode, it is part of the .toString on refs I believe

14:40 ttimvisher: are you trying to call a ref as a function?

14:40 oh

14:40 ttimvisher: zakwilson, hiredman: https://gist.github.com/3085419

14:41 hiredman: what is class*?

14:41 zakwilson: beat me to it

14:41 hiredman: it doesn't seem to be returning the class, it is returning the instance

14:42 ttimvisher: whoops, not enough clipboard: https://gist.github.com/3085419

14:42 i'm using that to ignore the other arguments to the function

14:42 hiredman: ttimvisher: run (def write-hotfix nil) then reload your code

14:43 most likely you definied the multimethod with a different dispatch function, then changed it

14:43 but defmulti behaves like defonce

14:43 ttimvisher: ah that's right!

14:43 i'm ashamed to admit that bites me more often than not

14:43 but you're exactly correct

14:43 thanks!

14:44 i keep trying to avoid compulsively `clojure-jack-in`ing but it seems like the right thing to do sometimes

14:49 augustl: "Could not locate leinmidje/midje_color__init.class or leinmidje/midje_color.clj on classpath" hmm

14:51 anyone seen that one before? Got `[lein-midje "1.0.10"]` in plugins and `[midje "1.4.0"]` in dev-dependencies

14:51 mcohen: wondering if anyone can help me figure out why lein repl works fine in an empty dir, but if i lein new app <name> then cd <name> and then lein repl again, i get a NoClassDefFoundError

14:52 i've tried lein 1.7.1 and lein 2 preview7

14:53 ToxicFrog: 'lein repl' tries to build and load your project so you can interact with it, I think

14:53 But I also thought that the default 'app' configuration built out of the box, so that shouldn't be the problem

14:53 What's the actual error?

14:54 augustl: hmm lein-midje needs to be both a plugin and a dev-dependency

14:54 mcohen: Exception in thread "main" java.lang.NoClassDefFoundError:

14:54 Caused by: java.lang.ClassNotFoundException:

14:54 technomancy: mcohen: can you put the stack trace on gist or refheap or some such?

14:54 mcohen: sure thing. thanks! one sec

14:55 https://gist.github.com/3085504

14:57 it takes a few seconds, maybe 10 or so, before you get the "Couldn't Connect" errors being printed

14:57 technomancy: mcohen: what about in lein2?

14:57 mcohen: same thing, but one sec and i'll run it

14:58 augustl: does lein-midje and/or midje have hooks so I can start a server before the tests start running?

14:58 mcohen: https://gist.github.com/3085516

14:58 not exactly the same thing actually

14:58 ohpauleez: mcohen: OS, JVM version, and any sort of weird /etc/hosts or firewall/iptables setup?

14:59 technomancy: mcohen: this is a brand new "app" project?

14:59 mcohen: OS X

14:59 mcohen$ lein2 -v

14:59 Leiningen 2.0.0-preview7 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM

14:59 technomancy: mcohen: try removing the :main line from project.clj

14:59 mcohen: yep, just ran lein new app and didn't touch anything

14:59 technomancy: crazytown

15:00 it's possible lein1 populated ~/.m2 with some jars that were corrupted in download

15:00 lein2 will refuse to download them if the checksums don't match, but it will use them if lein1 already downloaded them

15:00 if removing :main doesn't work try `mv ~/.m2 ~/.m2-bak`

15:01 mcohen: ok, i'll try that. i removed the :main in project.clj but now the trace changed to https://gist.github.com/3085516

15:02 technomancy: ok, it looks like probably the clojure jar wasn't downloaded correctly

15:02 shouldn't happen with lein2 going forward with any luck

15:04 uvtc: One great thing about lein is that you can so easily start over again from scratch. Just delete/rename your ~/.m2, ~/.lein, and your ~/bin/lein script, and just start fresh.

15:04 foxdonut: LFS=Lein From Scratch

15:04 dyba: Can anyone tell me why (= 'clojure.lang.PersistentArrayMap (class (hash-map))) is not true?

15:05 mcohen: wow, looks like it fetched everything, but still no joy

15:05 https://gist.github.com/3085516

15:05 hiredman: ,(type 'clojure.lang.PersistentArrayMap)

15:05 clojurebot: clojure.lang.Symbol

15:05 hiredman: ,(type clojure.lang.PersistentArrayMap)

15:05 clojurebot: java.lang.Class

15:05 hiredman: ,(type (class (hash-map)))

15:05 clojurebot: java.lang.Class

15:05 dyba: ah, ok

15:05 technomancy: mcohen: does it happen with projects using the default template?

15:06 dyba: hiredman: I was working under a wrong assumption when I wrote the test

15:06 technomancy: it's somewhat unfortunate that they are visually indistinguishable

15:06 foxdonut: ,(= clojure.lang.PersistentArrayMap (class (hash-map)))

15:06 clojurebot: true

15:06 dyba: see i wanted to get the string of the class name and compare it to the result i get w/ (class (hash-map))

15:07 mcohen: technomancy: yeah i think so. basically, lein repl runs fine in an empty dir, but if i type lein new app <name> and then cd into and run the repl i get the error

15:07 augustl: is there a way to get a hold of the "project" that you pass to a leiningen plugin? Want to write a script for initiating the test run myself, but to reuse existing code I need that "project" :)

15:07 dyba: oh, i see, I just got to get rid of the quote. :)

15:07 technomancy: mcohen: what about in `lein new myapp`?

15:07 augustl: try the lein-pprint plugin

15:07 dyba: thanks <hiredman>!

15:08 foxdonut: anyone else picture hiredman as an assassin?

15:08 mcohen: yeah, just tried. same thing

15:08 augustl: technomancy: cool, thanks

15:08 mcohen: download clojure-1.4.0.jar though that time

15:09 augustl: technomancy: how do I invoke "lein pprint" without shelling out?

15:10 technomancy: augustl: I don't know what that means

15:10 augustl: technomancy: I want to write a .clj file to use as a script to start my test run. In it I want to invoke the lein-midje to initiate the test run. To do that I need the "project".

15:11 hiredman: http://www.mylibrarybook.com/books/702/William-Gibson/Count-Zero-40.html

15:11 augustl: so I need to invoke "lein pprint" from that script, and I'm wondering if shelling out to call that command is the only way

15:11 technomancy: what does "use as a script" mean?

15:12 augustl: technomancy: invoke it via the command line

15:12 technomancy: you mean like `java -cp [...]`?

15:12 augustl: java -jar path/to/clojure.jar run-tests.clj

15:12 or something like that

15:12 technomancy: why do you want to do that?

15:13 augustl: so I can control the lifecycle of the test run, none of the testing tools I've found has the hooks I want

15:13 namely, doing something before the entire suite starts running

15:13 Cheiron: Hi. I want to send a POST request to Ring app. a basic idea how to do it?

15:13 technomancy: ok, you can do it by hand, but you'll have a lot less wheel-reinventing if you write it as a leiningen plugin

15:13 mcohen: can't imagine what it could be, but i'm guessing something on my machine must be borked somewhere. thank you for the help technomancy

15:13 technomancy: mcohen: sorry, I have no idea what's going on there. never seen anything like it =\

15:13 augustl: technomancy: great, I'll investigate that

15:14 Cheiron: a real one, or a mocked one?

15:14 mcohen: i'll report back what it was when i figure it out

15:14 foxdonut: hiredman: awesome

15:14 technomancy: mcohen: feel free to open an issue on the leinigen github tracker

15:14 Cheiron: augustl: ?

15:14 mcohen: ok, thanks

15:14 augustl: technomancy: that means having the script in a separate project as far as I can tell (since the plugin needs to be a dependency), but it's better than nothing :)

15:15 Cheiron: do you want to mount your ring app to a http server and do requests on it, or is in-process mocks OK?

15:15 technomancy: augustl: you can put it in the tasks/ dir and then have a .lein-classpath file containing just "tasks"

15:15 hm; I need to make that better-documented

15:15 augustl: technomancy: oh, great

15:15 Cheiron: augustl: i will deploy it under immutant

15:15 it will be mounted

15:15 technomancy: it would probably be better to fix the existing plugin to do what you want, but that's a good way to start out and experiment

15:16 augustl: Cheiron: use any old http client then :) There are a few, I use clj-http.

15:16 technomancy: got an example of such a task anywhere?

15:17 technomancy: augustl: read PLUGINS.md in the doc/ dir of leiningen

15:17 Cheiron: augustl: I mean how to define a function in Ring that will accept POST requests (kind of REST API). forgive my ignorance but never did ring dev before

15:17 augustl: Cheiron: oh, I misunderstood your question. Just check the method of the request?

15:17 Cheiron: I've never used Ring directly for any "real" applications though, I tend to use compojure which is a routing DSL on top of Ring

15:18 Cheiron: augustl: will check that

15:18 any tool to generate documentations such as the official Clojure libs docs?

15:19 tcrawley: Cheiron: those are generated by autodoc

15:19 technomancy: Cheiron: yes, but please don't use them unless you have already written prose documentation

15:20 http://jacobian.org/writing/great-documentation/what-to-write/

15:20 augustl: technomancy: made tasks/run-tests.clj, put http://pastie.org/4233299 in it, added "tasks" to .lein-classpath, how do I invoke it?

15:20 technomancy: augustl: should be tasks/leiningen/run_tests.clj

15:20 then just `lein run-tests` should work

15:21 Cheiron: may I ask where is the "autodoc" ?

15:21 augustl: then it shows up in "lein help" as leiningen.run-tests Problem loading: Could not locate leiningen/run_tests__init.class or leiningen/run_tests.clj on classpath:

15:21 Cheiron: technomancy: that is a great reference!

15:21 tcrawley: Cheiron: http://tomfaulhaber.github.com/autodoc/

15:22 augustl: nvm, hyphens vs underscores in clojure file names ftw :)

15:22 Cheiron: tcrawley: thanks!

15:22 uvtc: Cheiron: there's also https://github.com/weavejester/codox , http://fogus.me/fun/marginalia/ , and https://github.com/dakrone/lein-clojuredocs .

15:22 amalloy: technomancy: does my documentation have to be prose? verse sounds so much more interesting

15:23 technomancy: amalloy: I guess free verse could probably work.

15:23 if you can fit it into a sonnet, I salute you

15:23 scriptor: no documentation epics?

15:24 amalloy: jiraph: a database in which to store your stuff ;; shakespeare-style

15:24 technomancy: amalloy: you're already in iambic pentameter; good start

15:24 amalloy: that was the idea, yes

15:24 aperiodic: dactyllic hexameter > iambic pentameter

15:24 sduckett: mmm...sea shanties...

15:24 amalloy: i forget what a dactyl is

15:25 uvtc: Cheiron: for prose/verse/sonnet/novella documentation, I suggest just making a directory containing of .md files. Displays nicely on github and simple.

15:25 aperiodic: menin paidea thea, peliadiao achileus

15:25 uvtc: s/of//

15:25 technomancy: terza rima for lyfe

15:25 amalloy: well, that would be useful if i knew how to pronounce latin

15:25 uvtc: Latin is all greek to me.

15:26 technomancy: sing, muse, the rage of achileus, peleus' son

15:26 scriptor: from what I've heard, roman latin sounded a lot like italian

15:26 aperiodic: (inc technomancy)

15:26 nDuff: Heh.

15:26 Cheiron: uvtc: what is prose/verse/sonnet/novella?

15:26 technomancy: that's about the limit of my greek =)

15:26 aperiodic: mine too! :)

15:26 * nDuff 's significant other was just in a production of Medea; King Peleus, then, was something of a player.

15:28 aperiodic: still doesn't have anything on Zeus

15:28 dude just could not keep it in his pants

15:28 uvtc: Cheiron: just extending technomancy's joke there. I mean standalone docs, as opposed to API docs (in your docstrings).

15:28 ToxicFrog: aperiodic: let's face it, there are very few classical gods, demigods, rulers, or heroes who could~

15:28 aperiodic: s/pants/toga/

15:28 ToxicFrog: Odysseus

15:29 but yeah, he is the exception

15:29 scriptor: nah, Odysseus failed to temptation too

15:29 it's in the first few pages he's in

15:31 aperiodic: clearly it's been a while since I read the epics

15:32 rainerschuster: hi all. I'd like to port some contrib libs over to .NET. I've read the articles from David porting the libs. Is there a central repo or list, or some kind of coordination?

15:34 ah ok, i've found a hint: http://www.myclojureadventure.com/p/clojureclr-ports-page-purpose-of-this.html

15:59 augustl: technomancy: I'm getting "Could not locate leiningen/core/eval__init.class or leiningen/core/eval.clj on classpath:" when attempting to require leiningen.core.eval from my custom "task" thing, any ideas?

16:00 antares_: rainerschuster: http://dev.clojure.org/display/doc/Clojure+Contrib

16:00 rainerschuster: take a look and then ask on the mailing list

16:01 rainerschuster: antares_: thanks

16:17 kenneth: hey all

16:17 so i've been struggling with using a native dependency but i finally figured my problem out

16:18 the jar installed by lein is broken, but when installing it manually i can get it to work

16:18 is there a way to specify an external jar to include in lein?

16:31 technomancy: kenneth: you can do `lein install` to get it in your local repo, but of course you should push your fixes upstream

16:31 augustl: not sure; it works for me

16:32 kenneth: i didn't do any fixes—i just compiled from github source, as opposed to using the clojar which is broken

16:32 how does lein install work?

16:32 technomancy: oh, well you should let the maintainer know their deployed version is broken

16:32 kenneth: it creates a jar and puts it in the local repository (~/.m2)

16:33 kenneth: ah! so you do `lein install /path/to/jar`?

16:33 technomancy: no, just `lein install` from the project directory

16:33 kenneth: how does it know how to get the jar?

16:34 technomancy: it just makes a jar out of the current project

16:48 wingy: "God created this world with Lisp" :)

16:48 Raynes: He actually hacked it together with Perl.

16:51 duck1123: Which explains all the oddities in the universe

16:54 TimMc: With a 6-day deadline, I wouldn't be surprised if it were mostly shell scripts.

17:04 AWizzArd: hiredman: ping (please look into your prv chat)

17:04 wingy: is core.logic used in Datomic?

17:04 AWizzArd: wingy: no

17:05 wingy: oh .. looked like it

17:09 AWizzArd: wingy: it is based on Datalog: http://en.wikipedia.org/wiki/Datalog

17:10 drocamor: Hi

17:10 wingy: AWizzArd: what i meant is Datomic using core.logic under the hood?

17:11 https://github.com/clojure/core.logic/wiki they mention Datomic

17:12 drocamor: I have a lazy seq (an AWS SQS queue provided by cheshire) and I'm trying to process it 100 items at a time so I can bundle them together and put them some place.

17:12 amalloy: wingy: dnolen's talking about teaching core.logic to read facts from datomic

17:12 drocamor: And this IRC client is garbage

17:12 brb

17:12 dnolen_: wingy: rhickey just asked that I create an example of wiring up Datomic indexes to core.logic.

17:12 wingy: you can provide any data source really tho.

17:18 drocamor: I'm having some trouble processing an SQS queue using bandalore. I need to group together 100 messages at a time to do something with them, but when i use partition on the lazy-seq it ends up not deleting the messages. Can anyone provide some insight?

17:19 kenneth: how would i convert a byte[] into a string?

17:19 (utf8)

17:20 pjstadig: new String(bytes, "UTF-8")

17:20 Raynes: &(String. (.getBytes "foo") "UTF-8")

17:20 lazybot: ⇒ "foo"

17:20 Raynes: Round tripping!

17:20 pjstadig: trippy!

17:37 wingy: core.logic is very awesome

17:38 core.match as well .. clojure is too great compared to other langs ... learned like never before in just 2 weeks

17:47 dikidoom: > 1

17:47 -> 1

17:48 => 1

17:49 a quick question: (range 1 2.6 (/ 1.6 3)) returns a list of 4 elements, (range 0.1 1.7 (/ 1.6 3)) returns 3. is that to blame on floating point foo or on range? :)

17:50 ah, i meant (range 0 1.6 (/ 1.6 3)) that second time.

17:51 &(range 0 1.6 (/ 1.6 3))

17:51 lazybot: ⇒ (0 0.5333333333333333 1.0666666666666667)

17:52 dikidoom: &(range 1 2.6 (/ 1.6 3))

17:52 lazybot: ⇒ (1 1.5333333333333332 2.0666666666666664 2.5999999999999996)

18:02 gtrak``: &[(eval ''1) (eval '''1)]

18:02 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

18:03 scriptor: This incident will be reported

18:18 aaelony: What's the best clojars lib for sending emails? (I don't need anything especially heavy, just something that can send out alert emails from time to time.) Simple-email? Funnel-mailer? mailfinger? I see many choices....

18:21 jeremyheiler: aaelony: postal looks pretty good, https://github.com/drewr/postal

18:21 andres-v: aaelony: I don't if it's the best, but here is another one, https://github.com/drewr/postal

18:21 aaelony: jeremyheiler and andres-v: cool, thanks

18:21 jeremyheiler: (at least until i get my act together with Lime lol)

18:23 aaelony: wish there were ratings/rankings for clojars libs to help discern

18:24 amalloy: google helpfully sorts results for "clojure mail library" by popularity :P

18:25 aaelony: never heard of google

18:25 amalloy: it's like a www directory listing but with more features

18:25 aaelony: :)

18:25 jeremyheiler: I am glad my completely unfinished and unused library gets good google ranks then lol

18:26 amalloy: jeremyheiler: second place out of two, right? sounds about right if you're not done with it

18:27 scriptor: well, it has an actual website

18:28 maybe the algorithms like that

18:28 jeremyheiler: lol

18:28 there are a few more, they jsut get lost after all the clojure.org pages that are in the results

18:29 scriptor: let's see if adding -clojure.org helps any

18:38 haspaker: God, LISP syntax actually starts to make sense to me now

18:38 Never thought it would happen

18:41 wingy: haspaker: since when?

18:41 OlegYch|h: eh

18:41 never thoought lisp had syntax

18:41 scriptor: just wait, it'll all seem so simple that you'll want to make your own interpreter next

18:42 lisp has syntax, just not much

18:42 Chousuke: I don't understand it when people say lisp has no syntax :/

18:42 amalloy: Chousuke: it's an exciting tag-line; even if it's verifiably nonsense it almost does a good job of getting the point across

18:42 Chousuke: it actually has extensible syntax

18:43 it's just that there are very few syntactic elements so it mostly looks uniform

18:44 haspaker: wingy: Just sat down and realized I can actually _see past_ all the the god damn parantheses. I couldn't do that two days ago

18:44 OlegYch|h: it's just that lisp syntax is so minimal that it's negligible

18:44 Chousuke: OlegYch|h: the thing is, every macro has its own syntax

18:45 OlegYch|h: true, but it's more of a form than syntax

18:45 Chousuke: they all make use of the same basic elements (in clojure, mostly lists, vectors and symbols) but the interpretation of those elements is left to the macro

18:45 scriptor: now we're just entering a debate on semantics :)

18:45 amalloy: OlegYch|h: no, that's nonsense. (let (asdff) (blah) (lol)) is illegal specifically because it violates the syntax (synonym: grammar) defined by the let macro

18:47 Chousuke: one thing I like about clojure is that it actually has more idiomatic and useful syntactic building blocks compared to CL and Scheme

18:47 amalloy: scriptor: i suspect you are trying to start a debate about the difference between semantics and syntax

18:47 Chousuke: so you can design more expressive and readable syntax for macros.

18:47 nDuff: Hmm.

18:48 scriptor: amalloy: not quite, more on the difference between form and syntax

18:48 so linguistic semantics

18:48 * nDuff just tweaked his codebase a bit... and eliminated the false-positive warnings he's been getting from cljs. Phooey -- this means I probably need to figure out the root cause and report them upstream now, or it presumably won't happen.

18:48 Chousuke: of course in CL or scheme you can always extend the reader but that has other problems

18:54 dnolen: Chousuke: extend the reader in Scheme?

18:56 Chousuke: I suppose you mean that some popular implementations allow it

18:56 nDuff: another CLJS bug? or bug in another lib?

18:57 nDuff: dnolen: I reported this one earlier, you asked me to file a ticket, and I put it off.

18:57 dnolen: nDuff: ah

19:00 * nDuff grumbles about clojure-mode forcing his inferior-lisp to lein, overriding the cljs-repl script he's trying to point it at.

19:00 SegFaultAX|work2: It absolutely floors me how expressive clojure is. I was just looking at clout... an entire route matching library in less than 150 LOC.

19:06 mebaran151: Hey #clojure, what's the best way to create an object to pass as options in Clojurescript?

19:07 I have a jquery library I need to interop with

19:08 emezeske: mebaran151: ibdknox/jayq has a clj->js function that does that

19:08 yonatane: is there any point in interoping with clojure's source?

19:08 mebaran151: thanks emezeske

19:09 emezeske: mebaran151: I think if you google "clj->js" there are a few different implementations floating around

19:09 mebaran151: I wish Clojurescript exported a native constructor (something like (js-map "a" 1 "b" 2) )

19:18 btw, emezeske, I'm working on a fileupload widget for this site (partially in bootstrap); any suggestions?

19:19 emezeske: mebaran151: None come to mind

19:26 nDuff: Blerg.

19:28 * nDuff just hit an actual bug related to CLJS-266 (two watches added from different namespaces stomping on each other).

19:28 * nDuff ponders looking into using lein-cljsbuild with a cljs rev other than its built-in preferred one

19:32 SegFaultAX|work2: Does anyone use Jetty + Nginx to serve their Clojure web applications?

19:33 technomancy: SegFaultAX|work2: sure

19:34 SegFaultAX|work2: technomancy: Would you be willing to share your nginx configuration?

19:34 technomancy: SegFaultAX|work2: oh, I don't set the nginx part up myself

19:35 SegFaultAX|work2: technomancy: I mostly just want to see how the proxy pass is setup.

19:35 technomancy: Do you have access to it?

19:35 technomancy: no, it's just used in the heroku routing layer

19:35 I mean I probably could but it wouldn't be anything like what you would want =)

19:36 SegFaultAX|work2: technomancy: Do you work at Heroku?

19:36 amalloy: yonatane: i don't think you'll get an answer to that question because it doesn't make sense. what does it mean to interop with clojure's source?

19:36 technomancy: SegFaultAX|work2: yeah

19:36 SegFaultAX|work2: technomancy: Would it be in the build pack?

19:37 amalloy: SegFaultAX|work2: i'll find 4clojure's nginx setup

19:37 SegFaultAX|work2: Probably not...

19:37 technomancy: SegFaultAX|work2: that's the main thing, yeah

19:37 SegFaultAX|work2: amalloy: Thanks!

19:38 technomancy: SegFaultAX|work2: oh, I mean that's the main thing I do at heroku. the build pack doesn't contain any nginx config.

19:38 SegFaultAX|work2: technomancy: What's the main thing you do? Manage the build pack?

19:39 technomancy: yeah, the Clojure buildpack plus some other general build infrastructure; also the heroku client installers

19:39 amalloy: SegFaultAX|work2: https://gist.github.com/5e766a7ab6f1976eeeb0

19:39 SegFaultAX|work2: technomancy: That's pretty cool. I did see the talk from the guy who manages the Erlang buildpack at SF Erlang conf.

19:40 technomancy: Kind of a neat way to handle deploying lots and lots of websites.

19:40 emezeske: nDuff: https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler

19:40 SegFaultAX|work2: amalloy: That's it? Awesome! So all the other routing configuration is handled by Ring?

19:41 amalloy: (Or whatever you happen to be using)

19:41 amalloy: yes

19:41 for higher performance, you could set up nginx to handle some static files for you

19:41 SegFaultAX|work2: amalloy: That's easy enough.

19:42 amalloy: I really just wanted to see how the proxy pass was handled.

19:42 amalloy: but ring is fast, and 4clojure feels very snappy in every browser, from what i hear

19:42 SegFaultAX|work2: amalloy: For serving other types of Java web applications, the configuration is a bit more involved, eg http://wiki.nginx.org/JavaServers

19:42 amalloy: Do you have to configure a context for your domain? Can I see that, too if you do?

19:43 amalloy: only if you want to serve multiple applications out of the same jetty container

19:43 we just run embedded jetty in the 4clojure process

19:43 SegFaultAX|work2: amalloy: Ah, so you use uberjar (or equiv) and bundle the application server in your war file?

19:44 amalloy: lein run in production, baby

19:45 SegFaultAX|work2: amalloy: I don't see jetty in the deps for 4clojure, how do you bundle it with the application?

19:46 ibdknox: lein run is for winners.

19:47 amalloy: i dunno, actually. we must get it transitively from something like ring

19:47 ibdknox: ring brings it in with the ring-jetty-adapter

19:47 amalloy: yeah

19:47 SegFaultAX|work2: amalloy: Oh, I see.

19:48 amalloy: Sorry to keep bothering you, but how do you deploy the application? I imagine you git-push and have some post-receive-hooks do the rest?

19:48 ibdknox: SegFaultAX|work2: http://toroid.org/ams/git-website-howto

19:48 that's a nice simple way of setting it up ^

19:49 SegFaultAX|work2: ibdknox: Isn't that what I just said? :D

19:49 amalloy: no, i just ssh in and deploy manually. none of us are terribly good at server admin

19:49 ibdknox: SegFaultAX|work2: clearly it was for amalloy's benefit ;)

19:49 SegFaultAX|work2: amalloy: So is there downtime on every code upgrade, then?

19:49 amalloy: yeah, somewhere in the neighborhood of ten seconds i think

19:50 ssutch: say i want to wrap forms in noir to add a csrf token validation, what would be the most sane way to approach that?

19:50 SegFaultAX|work2: amalloy: Is there a god/monit/other process that makes sure jetty doesn't die?

19:51 ibdknox: ssutch: write a new form function that takes the same stuff as hiccup's and just adds your csrf in there

19:51 amalloy: there's a cron job restarting it if it stops responding

19:51 ssutch: ibdknox what about validation?

19:52 amalloy: if you figure out a better way to do all of this i'm sure we'd welcome the help. currently it sorta chugs along and works most of the time, and eventually repairs itself when it stops working

19:52 ibdknox: ssutch: do it as middleware

19:54 ssutch: ibdknox i'll try it out, thanks!

19:54 ibdknox: ssutch: np, good luck :)

19:55 ssutch: oh, I forgot about this

19:55 ssutch: https://github.com/weavejester/ring-anti-forgery

19:55 use that

19:55 even better :D

19:55 Raynes: ibdknox: Have you seen validateur

19:55 https://github.com/michaelklishin/validateur

19:56 ssutch: hey that looks exactly like what i wanted to do

19:56 Raynes: Noir also has validation middleware. Not sure how these compare.

19:56 SegFaultAX|work2: Is there anything that weavejester hasn't already implemented?

19:58 amalloy: i hear he's still struggling on getting his traveling-salesman solution down from O(n^2)

19:59 SegFaultAX|work2: :D

20:00 Raynes: amalloy: Careful, that joke's an antique.

20:02 ibdknox: Raynes: yeah, when I looked at it, it didn't really seem to serve the same purpose

20:04 Raynes: ibdknox: It doesn't?

20:05 ibdknox: Raynes: maybe it does now? I dunno. It is certainly order of magnitude more complicated

20:05 SegFaultAX|work2: How is that joke an antique?

20:05 ibdknox: orders*

20:06 Raynes: SegFaultAX|work2: Implies it is an old joke that people have said before.

20:06 SegFaultAX|work2: Raynes: Oh, yea.

20:07 Raynes: But so is "emacs is a great operating system... now all it needs is a decent text editor" but I still chuckle every time :)

20:08 Raynes: Also, for your reading pleasure: http://www.gnu.org/fun/jokes/ed-msg.html

20:11 carlo_au: Is Light Table trying to do what Emacs + SLIME do?

20:11 SegFaultAX|work2: carlo_au: Not really.

20:13 ibdknox: only in so far as both let you write software :)

20:13 insofar*

20:14 carlo_au: SegFaultAX|work2: what'sthe main point of difference?

20:15 ibdknox: carlo_au: have you seen any of my videos?

20:15 carlo_au: ibdknox: maybe, url?

20:15 ibdknox: carlo_au: http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept/

20:16 dnolen: carlo_au: I don't see Emacs switching to WebKit for starters.

20:16 SegFaultAX|work2: carlo_au: It's just different.

20:16 ibdknox: carlo_au: http://www.chris-granger.com/2012/05/21/the-future-is-specific/

20:16 SegFaultAX|work2: carlo_au: Emacs is a text editor, slime is a lisp client.

20:16 carlo_au: ibdknox: oh, you're Chris?

20:16 ibdknox: I am indeed

20:16 carlo_au: ah :)

20:19 SegFaultAX|work2: carlo_au: In my opinion the main "point of difference" is the change in perspective of what a code unit is. Traditionally IDE's force you to think of a file as an increment. Light table challenges this idea.

20:19 carlo_au: There are some other novel (and not so novel) ideas at play, but for me the change in the way code is manipulated is a big factor.

20:20 ibdknox: SegFaultAX|work2: before it's all said and done I hope to change the notion of what editing means

20:20 SegFaultAX|work2: ibdknox: That's the impression I've got from your talks etc.

20:20 ibdknox: speaking of talks

20:20 SegFaultAX|work2: ibdknox: And in general I like the idea.

20:20 ibdknox: You guys should come to my OSCON talk :)

20:20 It should be really neat

20:20 lynaghk: ibdknox: when are you getting in to PDX?

20:20 ibdknox: dnolen: everything was working for you again right?

20:21 SegFaultAX|work2: ibdknox: Most of the other functionality (quick access to docs, running code in real-time, etc.) are well covered by other power editors (vim, etc.)

20:21 ibdknox: lynaghk: weds afternoon

20:21 lynaghk: ibdknox: we should make some time to parrrty.

20:21 ibdknox: oh, this Wednesday?

20:21 ibdknox: next

20:21 I'm only coming to give my talk unfortunately :(

20:21 lynaghk: you flying out Thursday?

20:21 ibdknox: friday

20:21 so I have a little buffer

20:22 lynaghk: party buffer, dude.

20:22 though I bet a lot of people are going to be looking for you.

20:22 ibdknox: lol

20:22 * ibdknox hides

20:23 ibdknox: lynaghk: we should definitely catch up while I'm there, you giving a talk?

20:23 lynaghk: ibdknox: yeah, I have a talk on Friday at 10 a.m.

20:24 ibdknox: C2 stuff?

20:24 lynaghk: ibdknox: I'll probably be bumming around OSCON a fair bit though, since it's something like ten minutes from where I live

20:24 dnolen: ibdknox: yes!

20:24 lynaghk: ibdknox: yeah, though more of a higher level overview than what I gave at Clojure/West---in particular talking about some of the advantages and tradeoffs of using Clojure vs. JavaScript.

20:25 SegFaultAX|work2: lynaghk: What about ClojureScript vs CoffeeScript?

20:25 ibdknox: dnolen: I wrote a launcher in java that should make all of this much more painless. Just need to test it out. The install/use will then just be download this jar, double click it

20:25 lynaghk: cool

20:26 lynaghk: well, as time draws near, I'll let you know my plans

20:26 lynaghk: In particular I'm getting really excited about Clojure's soon-to-be-cross-platform domination---I looked into writing C2 for CoreGraphics (iOS rendering tech) via Lua ClojureScript this past weekend. And this morning I find out there's a solid looking Clojure -> project. So now I have options!

20:26 carlo_au: ibdknox: that sql example is really nice (watching the video)

20:26 lynaghk: ibdknox: sounds good, you've got my cell in your email somewhere I believe.

20:27 SegFaultAX|work2: CoffeeScript is JavaScript, so I don't think there's much of a distinction worth talking about. It's a bit better, but not wildly different (which is its big advantage/disadvantage)

20:27 ibdknox: are you familiar with R at all?

20:27 ibdknox: lynaghk: only at a very high level

20:28 I've seen it used, never used it myself

20:28 SegFaultAX|work2: lynaghk: Is that different from using ClojureScript's JS backend?

20:28 technomancy: eliminating the statement/expression distinction places it at least above python

20:28 SegFaultAX|work2: lynaghk: The result is the same.

20:28 lynaghk: ibdknox: ah. The "ggplot2" library for R is a really great exploratory data visualization library.

20:28 ibdknox: SegFaultAX|work2: not really, CLJS has new semantics, coffeescript does not

20:29 lynaghk: It's at a much higher level than C2. I'm toying with the idea of porting it to Clojure/C2 and maybe mashing it up with some of this Session stuff kovas has been working on.

20:29 ibdknox: lynaghk: I might have to check that out. I was messing around with Incanter the other night making histograms of usage patterns :)

20:29 SegFaultAX|work2: ibdknox: Hmm, really? Can you cite some specific examples? I'd like to read up on this.

20:30 lynaghk: ibdknox: R is a quirky language, but yeah. I only use it these days to play with ggplot2, which is great for doing initial visual analyses of datasets.

20:30 ibdknox: SegFaultAX|work2: just think about truthiness

20:30 * hiredman is getting really antsy waiting for kovas to push new session stuff

20:30 technomancy: does session use nrepl?

20:30 lynaghk: hiredman: anything in particular? There's a lot of pieces he's working on as part of that project

20:30 ibdknox: hiredman: what has you excited?

20:30 hiredman: technomancy: I have a pull request that switches it to nrepl

20:31 technomancy: hiredman: cool

20:31 hiredman: ibdknox: I like the idea of a computational document, sort of relaxed/more flexible spreadsheet

20:31 SegFaultAX|work2: ibdknox: Go on? Once the CLJS is compiled to javascript the broken truthiness is still there. How is CLJS making it less ugly different from, say, CoffeeScript making it less ugly?

20:32 lynaghk: SegFaultAX|work2: because you the programmer get to work with non-broken truthiness.

20:32 SegFaultAX|work2: Does CoffeeScript not provide that? TIL.

20:32 ibdknox: It didn't

20:32 I dunno if it does now

20:32 technomancy: coffeescript does provide new semantics

20:32 SegFaultAX|work2: Any other particular examples?

20:32 ibdknox: hiredman: yeah, absolutely. There's goodness to that idea

20:32 technomancy: everything is an expression

20:32 lynaghk: SegFaultAX|work2: it has some nice things like the existential operator, but you can still find plenty of ways to shoot yourself in the foot

20:33 hiredman: lynaghk: just progress really, I want to see what I think of his new stuff, there are some issues I have with the existing implementation, I don't think I completely understand why he thinks reader tags are super, so I am interested to see

20:33 lynaghk: SegFaultAX|work2: clj has immutable semantics, much richer data structures (e.g., sets), lazy sequences (so you can mess with infinite lists easily, &c. &c.

20:33 ibdknox: hiredman: I think those concepts will fit really well into LightTable when it's ready for it

20:33 SegFaultAX|work2: lynaghk: I'm not yet familiar with the existential operator. Is it a similar concept to existentials in Haskell?

20:34 hiredman: it seems to me the existing loop idea needs to be split, so you have a loop as a thing running in the clojure server, which is has a proxy loop in cljs in the browser

20:34 lynaghk: SegFaultAX|work2: it just lets you see if something is undefined vs. falsey, which is tricky to do right is JS because it's so flexible

20:34 SegFaultAX|work2: lynaghk: Ah, those are some good examples.

20:34 lynaghk: Yea, that's a good point.

20:35 hiredman: either that, or the protocol between the server and the browser needs to be a little more complex than prn/read-string because somethings (like vars) prn in clojure but cannot be read in clojurescript

20:35 and somethings like #<Object> can be prn'ed but not read

20:35 lynaghk: hiredman: yeah. I think tagged literals are nice to read but I'm not sure how fundamentally there is any difference between them and, say, XML tags.

20:37 ibdknox: I don't want them to start appearing in code :(

20:38 lynaghk: ibdknox: tagged literals? Why not? I would have expected you to be all over that, so that Light Table could, e.g., read #color[:rgb, 1, 223, 39] in someone's codebase and render it as a colorpicker.

20:38 hiredman: but you can already embed incanter charts in session (chart -> image -> data uri) which is always the first thing I try to do with a gui repl

20:39 lynaghk: hiredman: are they dynamic?

20:39 hiredman: nope

20:39 lynaghk: hiredman: if you're into that kind of thing, after I watched his talk I spent a few hours putting together a "manipulate" demo that uses Himera to dynamically compile mathematical fns, extracts the free vars from them, and gives you sliders: https://github.com/lynaghk/c2-demos/tree/manipulate/manipulate

20:40 hiredman: neat

20:40 lynaghk: it's super rough, and nothing really too exciting. What I'm interested in is how you generalize that in Clojure to cover the same kinds of things that Mathematica's manipulate covers---anything renderable, basically. Plots render as plots, text as text, shapes as shapes...

20:43 hiredman: yeah, it is interesting, you need a set of rules for turning things in to "renderable datastructures" (tagged literals?) and then manipulate has to know how to manipulate those

20:43 lynaghk: hiredman: I think the open "IRenderable" protocol is something that Kovas is thinking about as part of Session.

20:45 hiredman: yeah, but you don't want to have things taht know how to render themselves, you want things than can be translated in to a manipulatable/renderable data representation

20:45 lynaghk: hiredman: Since we're using Clojure I just assume that everything we get is an easily-manipulable data structure = )

20:47 hiredman: lynaghk: that does help

20:49 lynaghk: hiredman: primarily I'm interested in seeing what a family of protocols will look like for different kinds of UI widgets, especially with some reactive stuff e.g. https://github.com/halgari/reactive

20:53 ssutch: anyone else tried the lein-light plugin? i am getting FileNotFoundException - could not locate leiningen/core/eval...

21:26 beffbernard: how do you create an list initialized to 0 of size n?

21:27 I did it this way and I feel bad: (map (fn [a] 0) (take 24 (range)))

21:27 gfredericks: ,(repeat 5 0)

21:27 clojurebot: (0 0 0 0 0)

21:28 gfredericks: beffbernard: though if you're planning on making random updates to it you probably want a vector

21:28 beffbernard: thank you sir.. I feel dumb now

21:28 gfredericks: sure

21:33 brehaut: why is clojure.core/repeat implemented with (take n (range)) rather than just (range n)? is it something to do with chunked seqs?

21:34 wait, ignore me

21:35 * brehaut is a big idiot

21:38 gfredericks: man #clojure needs some self esteem

21:40 wkelly: lol

21:47 gtuckerkellogg: heh

21:56 unnali: brehaut: you're the best!

21:57 * unnali is "helping".

21:57 brehaut: lol

21:59 madsy: I see that atoms in ClojureScript call a function whenever it's referenced. Is it potensially faster to copy the dereferenced atom into a let if I need to read it multiple times?

22:10 gfredericks: madsy: that sounds like a reasonable thing to say; and for clojure-proper probably safer

22:20 locojay1: hi how can i destruct in argument a nested map

22:22 gfredericks: ,(let [nested-map {:foo {:bar 12}}, func (fn [{{bar :bar} :foo}] bar)] (func nested-map))

22:22 clojurebot: 12

22:22 locojay1: cool thanks

22:23 gfredericks: locojay1: if it were me I'd use get-in or -> instead of destructuring

22:25 locojay1: yeah just learned about get-in but just wanted to know how it would work.

22:26 amalloy: &(macroexpand-1 '(let [nested-map {:foo {:bar 12}}, func (fn [{{bar :bar} :foo}] bar)] (func nested-map))) ;; if you're curious

22:26 lazybot: ⇒ (let* [nested-map {:foo {:bar 12}} func (fn [{{bar :bar} :foo}] bar)] (func nested-map))

22:26 amalloy: oh

22:27 &(macroexpand-1 '(fn [{{bar :bar} :foo}] bar)

22:27 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

22:27 amalloy: &(macroexpand-1 '(fn [{{bar :bar} :foo}] bar))

22:27 lazybot: ⇒ (fn* ([p__21478] (clojure.core/let [{{bar :bar} :foo} p__21478] bar)))

22:27 * amalloy hates this game

22:27 amalloy: &(macroexpand-1 '(let [{{bar :bar} :foo} x] bar))

22:28 lazybot: ⇒ (let* [map__21486 x map__21486 (if (clojure.core/seq? map__21486) (clojure.core/apply clojure.core/hash-map map__21486) map__21486) map__21487 (clojure.core/get map__21486 :foo) map__21487 (if (clojure.core/seq? map__21487) (clojure.core/apply clojure.core/hash-... https://www.refheap.com/paste/3546

23:01 madsy: lein-cljsbuild have ways to launch repls connected to the browser. Like lein cljsbuild repl-launch. Is it possible to make those work with slime/swank, instead of using them as lisp-inferior in emacs?

23:02 I mean, it is possible with clojurescript the manual way, but that requires me to launch swank first, and then initiate the cljs repl afterwards inside slime.

23:03 Not exactly a nice workflow

23:37 ssutch: is there a way to optionally-require

23:57 ivan: ssutch: require inside a function and use (resolve '...) to reference the required thing

Logging service provided by n01se.net