#clojure log - Sep 11 2012

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

0:23 zenoli: j-v-e: Query from one of the guys at PLUG West...any chance you could do an encore at West next week or next month?

0:37 mpan: is there a reason why something like (#('[1 2])) doesn't have the meaning of fn that returns constant?

0:38 tried with and without the quote and it still gave me an error that sounded like it was trying to call the vec

0:39 tmciver: mpan: as an alternative, check out the function 'constantly'

0:39 abalone: mpan: those extra parens on the outside are making the call

0:39 mpan: cool, thanks

0:39 abalone: I was expecting it to mean, call the fn which returns constant vec

0:39 rather, it seems to interpret it as, call the constant vec

0:39 wondering why

0:40 abalone: ah

0:40 mpan: as in, I would have guessed it should evaluate to '[1 2]

0:40 but it didn't

0:41 xeqi: &`#([1 2]))

0:41 lazybot: ⇒ (fn* [] ([1 2]))

0:44 Sgeo: (doc fn*)

0:44 clojurebot: excusez-moi

0:44 Sgeo: ,(doc fn*)

0:44 clojurebot: Cool story bro.

0:44 Sgeo: Right...

0:44 &(doc fn*)

0:44 lazybot: ⇒ "Special: fn*; "

0:44 * Sgeo pats clojurebot on the head

0:46 mpan: so is the shorthand not quite the same as a fn literal?

0:49 alandipert: mpan: it's so you can put an operation form inside the fn without extra parens, e.g. #(identity [1 2]) vs (fn [] (identity [1 2]))

0:50 mpan: I'm just confused why it doesn't just expand out to a regular fn form with literal args %1 %2 etc

0:50 plus handling for the % case

0:51 like, why it works to write the return-literal-vec function with fn but not the #syntax

0:53 bdesham: I'm looking for a function that takes one argument--a function of zero arguments--and executes it. is there anything in core that does that?

0:53 alandipert: bdesham: apply

0:54 bdesham: ah, of course! thanks

0:54 xeqi: &(apply #(+ 1 2))

0:54 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$apply

0:54 bdesham: never even considered that you might use apply with just one argument

0:56 alandipert: oh yeah, nor had i

0:56 &(.invoke #(+ 1 2))

0:56 lazybot: ⇒ 3

0:56 alandipert: ^ cheating

0:56 bdesham: heh

0:57 xeqi: &(#(%) #(+ 1 2))

0:57 lazybot: ⇒ 3

0:58 cark: bdesham: why do you need such function ?

1:00 bdesham: cark: I'm writing a library to work with task queues. usually you'd specify a function at the beginning, and the function gets called with each item in the queue. I figured you could also store functions in the queue, but I wasn't sure which function you would pass as the thing that gets called

1:00 xeqi: though really I'd just do something like ##(#(+ 1 2))

1:00 lazybot: ⇒ 3

1:00 xeqi: (f)

1:01 cark: #(%)

1:02 that's your function

1:02 or (fn [func-to-be-called] (func-to-be-called))

1:03 bdesham: yeah, looks like #(%) is what I need

1:03 Raynes: (fn [this-is-crazy] (call-me-maybe))

1:04 bdesham: ugh, can't get away from that song even in #Clojure...

1:08 xeqi: (fn [gangnam-style] (horse-dance))

1:15 arrdem: (inc xeqi)

1:15 lazybot: ⇒ 4

1:17 arrdem: ,(foreach [phrase ["op" "o-op" "op" "oppa gangnam style"] (println phrase))

1:17 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

1:18 arrdem: ,(foreach [phrase ["op" "o-op" "op" "oppa gangnam style"]] (println phrase))

1:18 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foreach in this context, compiling:(NO_SOURCE_PATH:0)>

1:18 xeqi: (doc doseq)

1:18 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

1:18 arrdem: ,(doseq [phrase ["op" "o-op" "op" "oppa gangnam style"]] (println phrase))

1:18 clojurebot: op

1:18 o-op

1:18 op

1:18 oppa gangnam style

1:19 arrdem: yeah I just found the docs on that as you ,(doc)'d

1:24 Sgeo: Wait, clojurebot can be induced into saying stuff across multiple lines?

1:24 Also, why not dorun a map?

1:25 erm, dorun a sequence made with map

1:25 I think I'd personally prefer that

1:25 xeqi: don't need to build up a list of nils

1:26 arrdem: clojurebot... has been caused to do many things. singing is the least of them.

1:26 Sgeo: Since it's dorun, why would a list be built up?

1:26 Shouldn't each nil be quickly garbage collected?

1:27 xeqi: ah, right, I was think doall

1:33 (doc map)

1:33 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

1:34 xeqi: (doc dorun)

1:34 clojurebot: "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."

1:38 Sgeo: ,(dorun (map println ["op" "o-op" "op" "oppa gangnam style"]))

1:38 clojurebot: op

1:38 o-op

1:38 op

1:38 oppa gangnam style

1:39 Sgeo: I feelm like my Haskell knowledge is stopping me from grasping the true meaning of that line

1:40 I keep thinking of dorun like sequence_ but it's not

1:41 ,(take 0 (map println ["op" "o-op" "op" "oppa gangnam style"]))

1:41 clojurebot: ()

1:41 Sgeo: ,(take 1 (map println ["op" "o-op" "op" "oppa gangnam style"]))

1:41 clojurebot: (op

1:41 o-op

1:41 op

1:41 oppa gangnam style

1:41 nil)

1:41 Sgeo: ...that's still a bit bizarre.

1:41 muhoo: ah, doall hangs on to the head, dorun doesn't

1:42 Sgeo: In Haskell, map putStrLn ["somestring", "anotherstring] will make a list of actions that can be performed

1:42 And sequence_ turns a list of actions into a single action

1:42 muhoo: this sounds like reducers to me, maybe

1:43 Sgeo: I'd say the connection to reducers may be tenuous, but I don't understand reducers that well

1:47 muhoo: ,(map deref (map #(delay (println %)) ["foo" "bar" "baz"]))

1:47 clojurebot: (foo

1:47 bar

1:47 baz

1:47 nil nil nil)

1:49 muhoo: ,(map #(delay (println %)) ["foo" "bar" "baz"])

1:49 clojurebot: (#<Delay@2418ec3b: :pending> #<Delay@8f8268e: :pending> #<Delay@5bab393b: :pending>)

1:50 muhoo: that's ugly, but it's a sequence of actions, kind of

1:52 metellus: map is lazy, so (map println ["foo" "bar" "baz"]) is just a sequence of actions

1:52 but if you do it in a repl or with the bot, evaluation is forced

1:54 bdesham: is there a standard for the naming of clojure libraries? should I use "com.foo.whatever" or just "whatever"?

2:01 ohpauleez: bedsham, your namespaces or the library itself?

2:02 Typically, if you're hosting it on clojars, you should use a group name: com.github.ohpauleez/mylib

2:03 bdesham: I'm talking about the library itself

2:03 ohpauleez: but if it's a major/canonical library and you expect a lot of usage, you can make the group and artifact name the same. For example: noir, shoreleave, etc

2:04 bdesham: nah, I don't think so ;-)

2:04 clojurebot: Titim gan ?ir? ort.

2:04 bdesham: thanks

2:07 ohpauleez: bdesham: Totally welcome

2:07 Glad I could help

2:15 Urthwhyte: Hey guys, simple, but odd task. I want to reduce a function across a collection and get back a hashmap of the results, where the key is the function input and the value is the function output

2:16 It can be done easily with a reduce, but it seems as though there should be a more idiomatic way

2:17 raek: Urthwhyte: something like (zipmap inputs (map f inputs))?

2:18 Urthwhyte: yup

2:19 that'll do it

2:19 thank you :)

2:56 ecraven: quick question, clj 1.4.0 on arch linux, if i enter (= '(1 2 1) (reverse '(1 2 1))), the repl hangs... why is that? shouldn't this just return true?

3:00 dhofstet: ecraven: works fine here on arch linux

3:01 ecraven: i'll update everything, then try again

3:01 dhofstet: openjdk or sun java?

3:02 dhofstet: ecraven: openjdk

3:03 ecraven: dhofstet: 7 or 6?

3:03 dhofstet: ecraven: 7

3:03 ecraven: same as me.. strange

3:37 quacKZOVV3: pepijn_away, meneer de vos, waarom gaat u weg?

3:37 Chousuke, Droids? tut tut, you bore me.

3:37 Inside of each exists the mind of a sapient being

3:38 the finest brains harvested from across the galaxy

3:38 no more droids, my deluded child, they are cyborgs


3:40 shaunxcode: exactly

4:41 clgv: is there some function or macro to avoid nesting more than 2 reduces?

4:42 in principle something with the capabilities of `for` would be awesome.

4:47 ordnungswidrig1: clgv: can't you comp the reducer functions?

4:48 clgv: ordnungswidrig1: hmm good question the reduce would have the following path [p parameter vm (value-maps p) [k v] vm] and I want to create a map then

4:49 ordnungswidrig1: solved it with merge-with with a special case in the function now

4:50 ordnungswidrig: nested reduces means you're working with nested sequences, right?

4:51 clgv: ordnungswidrig: nested maps

4:52 ordnungswidrig: which are reduces as sequences

4:52 s/redeuces/reduced/

4:52 clgv: ordnungswidrig: yep. it's not all maps but deftypes that are semantically treated like maüs

4:52 *maps

4:54 ordnungswidrig: so the inner reduce actually produces a seq. isn't it a map then?

4:56 clgv: no all three reduces should produce a final map. with `merge-with` now there is only one reduce. I think I just use this and remember that expression pattern. if it occurs again I have to do something ;)

4:57 ordnungswidrig: have a paste?

4:59 clgv: ordnungswidrig: thats the merge-with approach https://www.refheap.com/paste/5007

5:02 ordnungswidrig: result is a map of key to vector of values

5:03 ordnungswidrig: I see

6:04 Kneferilis: why clojure uses all these parenthesis?

6:08 babilen: Kneferilis: It is a Lisp and uses s-expressions -- Please read http://en.wikipedia.org/wiki/S-expression and http://en.wikipedia.org/wiki/Lisp_(programming_language)

6:13 Raynes: Also, the number of parentheses is comparable to languages like Java with the primary difference being the location of the parens.

6:13 naeg: one could even say Java has more brackets: http://www.andrewhjon.es/142343729

6:13 ("Show me the brackets")

6:16 stain: naeg: that's very tongue in cheek because the JAva example uses the secret and frawned-uppon style of {{ }}

6:19 noidi: foo(bar) -> (foo bar)

6:20 look at all those parentheses appearing when the code is rewritten in lisp! :P

6:21 hyPiRion: Or, for instance, foo.toString().length() is (.. foo toString length)

6:27 ro_st: so, how do i get an rfc 3339 compatible date string in clojurescript?

6:27 mutter datomic db.type/instant mutter

6:30 Kneferilis: babilen: thanks for the information

6:31 babilen: Kneferilis: You are welcome

6:41 I am wondering what is needed to update ClojureDocs to show documentation for Clojure 1.4 as well ... It's just that I thought that it'll happen "eventually", but it took a while already and there might be someone that can/should be poked regarding this.

6:58 antares_: babilen: please ask on the mailing list, that's a great idea

6:59 babilen: antares_: ack :)

7:00 naeg: babilen: indeed, I might even provide my time if needed

7:01 babilen: So would I (as I constantly use it), but I am just not sure what the process is. I'll write that mail and maybe we can sort it out.

7:01 naeg: I'll finally subscribe to the ML then

7:02 antares_: babilen: as far as I know there are two parts to clojuredocs, an indexer and a web app. The latter probably won't change at all, the former may need updates and reindexing to cover 1.4 + new contrib.

7:06 babilen: antares_: My secret hope is still that somebody will just answer: "Oh, right. Totally forgot to run MAGIC_UPDATER because I thought that it is handled by CRON-JOB". (I know, that is a little too optimistic, but well)

7:07 antares_: babilen: it should not be a lot of work to reindex clojure.core but getting all the new contrib libraries and removing or isolation the old stuff will probably take some effort

7:08 babilen: antares_: Getting clojure.core updated to 1.4 would be wonderful even if the rest of it is still cruft

7:10 AustinYun: anyone implement ELO or any of the glicko rating systems in clojure before? I'd be interested in seeing what it looks like

7:16 mpan: is there a built-in "function exponentiation"?

7:16 ordnungswidrig: mpan: ?

7:16 mpan: er, like, you pass f n x and it gives you (f (f (f ... [n times] x)))

7:17 llasram: &(-> (iterate (partial * 2) 1) (nth 8))

7:17 lazybot: ⇒ 256

7:18 llasram: mpan: Like that?

7:18 mpan: yea

7:18 although a bit confused by the use of -> there

7:19 how do I ask the bot to expand that?

7:19 llasram: Oh, it's just the same as:

7:19 &(nth (iterate (partial * 2) 1) 8)

7:19 lazybot: ⇒ 256

7:19 llasram: In general:

7:20 &(macroexpand '(-> (iterate (partial * 2) 1) (nth 8)))

7:20 lazybot: ⇒ (nth (iterate (partial * 2) 1) 8)

7:20 mpan: all right, thank you!

7:37 clgv: mpan: use java.util.Math

7:38 mpan: or do you really want to apply a function several times?

7:38 mpan: in that case you can write a higher-order function for that

8:16 djanatyn: hmm, time to write my first tests in clojure

8:16 I'm using lein2 and emacs, with nrepl. where do I start?

8:18 ro_st: midje!

8:18 djanatyn: what advantages does midje have over clojure.test?

8:19 ro_st: i can't really answer that because i've never used c.t

8:20 https://www.refheap.com/paste/5011

8:21 clgv: djanatyn: read midje's wiki to get an impression. it has checkers to express tests easily

8:21 ro_st: http://www.youtube.com/watch?v=HK2HG9U3anA

8:21 emacs mode for midje: with a repl up, hit C-c . to run the fact under point and see output directly above the top-level form

8:22 i use midje-mode and lazy test in combination

8:22 and our CI runs the midje tests too

8:22 not sure if nrepl and midje-mode play nice. hopefully they do

8:33 djanatyn: I don't understand why our school network blocks clojars.org ._.

8:33 clgv: djanatyn: paranoia

8:33 djanatyn: are there any mirrors? I'd like to grab midje, and I guess I could manually install it, but I don't know how

8:33 clgv: djanatyn: no mirros afaik

8:34 cemerick: djanatyn: that's bizarre!

8:34 clgv: djanatyn: I'd talk to the admin

8:34 cemerick: Indeed, that's indefensible.

8:35 clgv: djanatyn: I have been to a conference at a university where they blocked almost all ports except http/https

8:35 djanatyn: clgv: same thing on our network :P

8:35 clgv: couldnt even log onto my server via ssh there... :/

8:36 ro_st: tor -whistle-

8:36 djanatyn: the first year, the network flowed free, and I could ssh home and tunnel everything through SSH

8:36 clgv: I wonder how their CS post grads and students work there

8:36 djanatyn: then halfway through my freshman year they closed down everything

8:37 now I'm in my senior year and I've learned a few tricks, but they add new restrictions and filters every year

8:38 has anyone here used both midje and clojure.test?

8:39 clgv: I started out with clojure.test

8:39 ro_st: i believe midje's runner runs clojure.test tests as well, so you can try both out and use midje's runner

8:39 clgv: but I found it painfull to check collection contents with it. midje solved that issue

8:39 ro_st: with contains, clgv ?

8:40 clgv: for example

8:40 ro_st: i found background to be really nice too

8:40 easy to quickly establish a stable testing context without having to wrap top-level test forms in a macro call

8:41 clgv: I also like `provided` and `anything`

8:41 ro_st: i haven't used those yet

8:41 probably should :-)

8:43 clgv: you can do something like that: (fact "cdf" (build-cdf anything (sorted-map 'na 'a, 'nb 'b, 'nc 'c)) => [['a v1] ['b (+ v1 v2)] ['c (+ v1 v2 v3)]] (provided

8:43 (rating anything, 'a) => v1 :times 1) ... and so on

8:43 ups

8:44 thats almost an algebraic description ;)

9:27 bytechunky: Im dealing with a data structure that I cannot represent with nesting, because there are cyclic dependencies. As a step of indirection I want to use either integer indexes or vars. Is any one of them preferable?

9:29 identify 0!s_vk<%Kio|1M

9:29 duck1123: time to change that pw

9:29 bytechunky: lol

9:29 ro_st: haha

9:30 clgv: almost random ^^

9:31 gfredericks: bytechunky: I don't think vars are appropriate for that

9:32 duck1123: There's also namespaced keywords at your disposal. Might be a little better than using vars

9:33 clgv: bytechunky: integers would work fine. I did something like that

9:34 bytechunky: lright, i'll go with integers the

9:37 nDuff: bytechunky: ...why would you prefer vars to atoms?

9:38 Not saying that integer indexes are bad, mind you

9:43 chouser: bytechunky: why not something like a UUID or Object instead of integers?

9:43 ro_st: chouser: your in-memory pubsub looks really interesting!

9:44 i've been using shoreleave-pubsub in cljs and i'm looking for a clj pubsub to use with the clj code that i'm using in cljsbuild crossovers

9:45 ohpauleez: ro_st: At some point in the future, I plan on providing that (I'll be in need of it soon)

9:45 ro_st: can't wait :-)

9:47 bytechunky: chouser: im not following the Object part (im a bit of a software engineering newb)

9:47 clgv: bytechunky: do you want to represent a graph?

9:48 bytechunky: clgv: yes, indeed

9:49 clgv: bytechunky: well than there are two general lightweight options: adjacency matrix or adjacency list - you can also build it as objects with references to each other. depends what you do with it

9:51 chouser: bytechunky: Objects use identity for equality, so two different Objects are guaranteed to be unequal, and creating them is fast.

9:52 clgv: chouser: nice trick if you dont need names to identify them ^^

9:52 chouser: So you could say (let [a (Object.), b (Object.)] {a {:name "foo", :other b}, b {:name "bar", :other a}})

9:54 bytechunky: chouser: i need to think about this a little to grok it. Thank you for the example.

10:01 naeg: chouser: I'm "almost" finished with the checking algorithm for a connect four field in core.logic

10:01 could you take a look at this question though: http://stackoverflow.com/questions/12355352/predicate-to-declare-descending-ascending-coordinates-using-finite-domains

10:02 (checking rows and cols works already, beside a bug which I suspect being in core.logic itself: http://dev.clojure.org/jira/browse/LOGIC-52)

10:03 bytechunky: clgv: i want to be able to represent graphs with edges connecting edges ("higher order" edges), multigraphs, maybe even hypergraphs. i am really just exploring what options there are to represent things like this. So i'll contemplate it.

10:04 clgv: bytechunky: ah ok. that's far more than I did. I needed a simple graph and learned that an adjacency matrix without node and edge objects works best

10:04 Sonderblade: is there something like cpan or pypi for clojure?

10:04 lotia: clojars

10:04 clgv: Sonderblade: clojars.org

10:04 nDuff: Sonderblade: Maven is used for distributing Clojure packages

10:04 Sonderblade: thanks

10:04 nDuff: Sonderblade: ...and Clojars is the most common Maven repository for the purpose

10:05 Sonderblade: ...if you're using Leiningen, it'll automate downloading things from Maven for you.

10:06 ro_st: does anyone know if you can do the dynamic binding hijinks in clojurescript? (def ^:dynamic foo) (binding [foo (atom {})] …)

10:14 wooo it does

10:18 ohpauleez: ro_st: Just saw this now. It does but I think it has a few edge cases. Shoreleave does it configure alternate endpoints for the remotes (a little hidden gem)

10:19 ro_st: i have a whole bunch of namespaces that have top-level atoms (yeah i know)

10:19 they constitute the cljs model code

10:19 i want to be able to spin up instances of this code server side, which means not using top level atoms

10:20 trying to find a way to refactor without having to inject some state param into every fn in all these namespaces

10:21 ohpauleez: ro_st: It's typically bad design to use dynamic bindings for confs

10:21 you should pass in the state

10:21 ro_st: i figured that'd be the case

10:21 ohpauleez: the dynamic var will hurt composability and adds some piece of black magic that the programmer needs to keep in his head

10:22 ro_st: yup

10:24 anildigital: to learn clojure or to learn scala first?

10:24 ro_st: scala, definitely. it's waaaay better than clojure.

10:24 who needs simplicity anyway

10:25 anildigital: ro_st: raally?

10:25 ro_st: no. :-)

10:25 clgv: ro_st: unexpected answer for #clojure ;) :P

10:26 ohpauleez: anildigital: I'd learn Clojure first. It is a simpler language, with simpler constructs and less syntax. It'll force you to mold your brain to think functionally

10:26 once you have the functional foundation, you'll be able to swing over to scala and write idiomatic scala code without any issues

10:27 ro_st: nice, balanced answer. i'm far too biased. clojure clojure clojure.

10:27 ohpauleez: The data structure work done in scala and Clojure are pushed forward by the same group of people. Scala thinks collections themselves should be parallel (but what the hell is a parallel vector?!?!), Clojure things base operations should be parallel (map, filter, reduce ala reducers)

10:28 Scala's type system is nice (same general type system as Haskell), but it can be a pain point

10:28 Best to learn to think functionally first here in Clojure and branch out

10:29 Clojure thinks base… ***

10:30 cemerick: ut-oh, githubs are having issues again.

10:31 ohpauleez: cemerick: :( it's going to be a longer-than-necessary day

10:32 cemerick: It's subtle at the moment. Commits not showing up in the web UI, etc.

10:32 ohpauleez: ahh

10:33 abalone: ~gagnam

10:33 clojurebot: Pardon?

10:33 abalone: good. clojurebot unscathed.

10:33 ohpauleez: haha

10:37 chouser: neag: You're beyond me. I haven't done anything with the finite domain stuff yet.

10:37 I'm still struggling with my understanding of conda

10:40 naeg: chouser: I see. I'm still struggling with a lot of things too, but I only started using it yesterday

10:41 chouser: ro_st: thanks for the pubsub comments. That snippet is of course not close to a library of reusable code, but I hope the feature set provided by such a simple combination of Clojure features helps people think about what they need and some less obvious approaches to getting it.

10:41 naeg: core.logic is really fun though

10:41 chouser: naeg: yeah, I'm having fun with it too

10:41 Though less fun at the moment than previously, because I can't believe conda is supposed to act like this. :-)

10:43 babilen: What is the best/easiest way to compile clojure with Java7? (I want to play with reducers and the deployed jar has obviously been compiled with java6)

10:45 clgv: babilen: it has a build.xml for ant

10:45 naeg: chouser: haven't looked at it yet, but doesn't it do what ! does in prolog? basically a "cut" which stops backtracking

10:45 babilen: clgv: I was planning to use "mvn install" for now, but thought I ask first.

10:46 antares_: babilen: ant w/o arguments should do it but you don't need to use JDK 7 until you specifically want to

10:46 babilen: there is a fork/join framework port to JDK 6 and I believe it is bundled with Clojure

10:47 naeg: oh, well it's titled a soft-cut in the source, so maybe not quite !

10:48 TimMc: bytechunky: Here's a new password for you: ##(apply str (map char (repeatedly 14 #(+ (rand-int 94) 33))))

10:48 lazybot: ⇒ "hpV~\\93S`v!7Dd"

10:48 babilen: antares_: Well, I could specify that dependency explicitly, but I am running 7 here anyway. It does *not* work if you just declare a depdency on clojure 1.5.0-alpha4 (ClassNotFound exception for jsr166y)

10:49 antares_: babilen: I use 1.5 master and JDK 7 (not reducers, though) for something, it works great

10:49 babilen: if it does not work on JDK 7 then that's a bug you should report

10:49 babilen: jira?

10:49 clojurebot: to be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks

10:50 antares_: hahaha, I love you clojurebot

10:50 babilen: antares_: It does not -- I mean clojure works just fine, but reducers/join throws a ClassNotFound exception for jsr166y.

10:50 antares_: babilen: yeah, Clojure follows a 16th century development model

10:50 bytechunky: TimMc: Thany you XD

10:51 ivan: looks pretty 17th to me

10:51 clgv: maven?

10:51 clojurebot: Help, I'm trapped in an XmlFactoryFactory!

10:51 clgv: lol

10:51 antares_: ant?

10:51 clojurebot: ant is like a band-aid: one motion, right off! <cemerick>

10:51 cemerick: hah-hah

10:52 gko: When "lein repl", is the stuff defined in project.clj loaded?

10:52 antares_: gko: yes, to set up your classpath and so on

10:52 chouser: naeg: I expected this to return (1): (o/run 10 [q] (o/conda (o/succeed o/fail (o/== q 1)) ((o/== q 2))))

10:53 gko: antares_: sorry, I meant, is the stuff in src loaded...?

10:54 antares_: gko: only if you require it (or some other library you require does)

10:54 AOT-compiled stuff is compiled either way

10:56 clgv: gko: if you have specified a :main then namespaces your main namespace uses or requires are loaded transitively

10:56 babilen: antares_: https://www.refheap.com/paste/5016 is what I am seeing -- Unfortunately it means that deployment is pretty tricky. It is probably a better idea to just list jsr166y as a dependency for now.

10:56 gko: antares_: got it. thanks.

10:58 naeg: chouser: why do you o/succeed and o/fail in row?

10:58 antares_: babilen: still, file an issue, it should not be ignored forever. Shipping 1.5 with it would be a big issue given how long it takes for point releases to come out.

10:58 chouser: naeg: as a demonstration. reverse their order and you get the results I expected, (2)

10:59 oh, sorry, I expected (1) not ()

10:59 gah

10:59 oh, sorry, I expected (2) not () nor (1)

10:59 babilen: antares_: Where do I file that? http://dev.clojure.org/jira/browse/CLJ ?

11:01 antares_: babilen: yes, and maybe ask a thread on the mailing list about what you are seeing

11:02 naeg: chouser: I'm confused now. from the original code with o/succeed o/fail - what do you expect? and what from the second one with o/fail o/succeed?

11:02 gko: (doc require)

11:03 clojurebot: "([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of Clojure

11:04 chouser: Sorry, I messed it up. I expect the order of clauses to be unimportant within each conda clause. Therefore the existence of fail anywhere in the first clause should make it fail, and cause conda to pursue the second clause. Therefore the result should always be (2), from the second clause

11:05 But my expectations don't match reality, so either there's a bug (which I assume not to be the case) or my mental model needs some serious work. :-P

11:06 naeg: chouser: hmm...as I said, haven't really looked at conda, but from my understanding the orginal code returns () because o/succeed is the head of the clause, but o/fail "consumes" (o/== q 1) and returns nil (resulting into () for q)

11:07 and when switching o/succeed with o/fail, the second clause is chosen because the head of the first is o/fail

11:11 * naeg looks at conde again and wonders whether anything he said made sense at all

11:20 chouser: naeg: I think you're right, just not what I expected.

11:21 It looks like wrapping (fresh [] ...) around each clause produces what I expected, but surely isn't the Right Way to do anything.

11:22 naeg: chouser: the theory makes sense at least according to the behaviour (not neccessarly true therefore though...)

11:22 * chouser nods

11:23 zerokarmaleft: chouser: was (o/succeed (o/== q 1) o/fail) your other ordering for the first clause?

11:24 mpan: is there a built-in for "the elem of c with highest value of f"?

11:24 llasram: &(doc max-key)

11:24 lazybot: ⇒ "([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."

11:24 mpan: do you know if it would call k more than once on a particular x?

11:25 llasram: I don't believe it should, but if it matters then you may want to re-think what you're doing :-)

11:25 mpan: for correctness it's the same regardless

11:25 for performance I might be a bit worried

11:26 llasram: Ah, I see. Well, the implementation is at your fingerprints!

11:26 mpan: reading that at the moment

11:26 unfortunately it appears to use k kind of like a comparator

11:26 chouser: zerokarmaleft: I meant (o/succeed o/fail (o/== q 1)), but yours behaves the same.

11:27 babilen: antares_away: I've reported it and it was aptly named CLJ-1066. I just got the priority wrong, which I apparently can't change anymore.

11:27 antares_: babilen: thank you!

11:28 babilen: np, thank you!

11:30 mpan: I guess if I want decorate-sort-undecorate I should do it directly

11:30 thanks!

11:30 zerokarmaleft: chouser: (o/run 10 [q] (o/conda ((o/== q 2)) (o/succeed o/fail (o/== q 1)))) <= conda commits to the first clause with this ordering

11:32 because it succeeds, and in conda only one clause can succeed

11:32 chouser: zerokarmaleft: yes, I understood that. What was confusing me was that in my original example, I assumed the o/fail would cause conda to move on to the second clause, but it did not. It had already committed to the first clause, so the o/fail caused it to find no solutioons at all.

11:33 zerokarmaleft: chouser: ah...no, the first succeed prunes the rest of the tree at the level of conda

11:33 * zerokarmaleft checks scrollback

11:35 Frozenlock: Awww git is down... anyone has a copy of the domina readme?

11:36 gfredericks: I oughta

11:36 wait no

11:36 wait maybe

11:36 Frozenlock: :P

11:36 I would really appreciate if you could pastebin it.

11:37 gfredericks: Frozenlock: http://upload.gfredericks.com/domina-1.0.0.jar

11:37 I went half-way for you :)

11:37 if it's not in the jar then I don't think I have it

11:37 Frozenlock: Thank you very much

11:37 gfredericks: let me know if that 404's I didn't check it

11:38 Frozenlock: No it's good, checking now if the readme is in there

11:38 gfredericks: cool

11:38 come to think of it it probably isn't :/

11:38 I can't imagine a build process that puts it in

11:38 naeg: Frozenlock: what about google cache?

11:38 (if you can't find the readme there)

11:38 Frozenlock: No it's not, however I have the source, I can use that :p

11:39 zerokarmaleft: chouser: since the first clause succeeds, you're getting the disjunction of o/fail and (o/== q 1), which is ()

11:39 gfredericks: Frozenlock: glad I could be mildly helpful

11:40 Frozenlock: naeg: Indeed...

11:40 Yay first occasion of the day to do the smart thing and I missed it!

11:40 naeg: it's available in google cache, just google "cache:https://github.com/levand/domina"

11:40 Frozenlock: \o/

11:40 Thanks :)

11:41 naeg: you're welcome

11:42 zerokarmaleft: which i guess naeg already said, in so many words...time for a second cup of coffee

11:42 Frozenlock: I'm still on my first... but I'm getting there!

11:44 naeg: zerokarmaleft: I guess it results in a better understanding for all of us ;)

11:44 is there a naming convention for passing HOF's as arguments? like "step-f" or do I simply use "step"?

11:44 jocke12: a couple of guys in my office are planning to learn some new languages. i've decided to learn clojure (they've chosen haskell and erlang respectively). we want to make it more interesting by having some sort of competition. do you guys have any idea on what would be a good "first project" type of system, that we then could, in some way, compete with? :)

11:44 chouser: zerokarmaleft: yes thanks, I just didn't understand that the first expression in each conda clause was "special".

11:45 scriptor: jocke12: well, there's the canonical convert-something-you-already-use project

11:47 jocke12: scriptor: thanks for the tip. we were thinking something more ... fun. :) less useful but equally instructive

11:48 scriptor: hmm, is there something all three of you are good at?

11:48 jocke12: within programming you mean?

11:49 scriptor: yep

11:49 as in, some specific, field, data analysis, web dev, etc.

11:49 jocke12: a definite now on that one. only two of us are even programmers to begin with. thinking something like calculus would be a good starting point, though

11:50 definite no*

11:50 TimMc: Write a Haskell interpreter in Clojure, a Clojure interpreter in Erlang, and an Erlang interpreter in Haskell. :-P

11:50 naeg: jocke12: sudoku solver, conways game of life, tic tac toe AI, ...

11:50 jocke12: ;)

11:50 nsxt: jocke12: totally absurd suggestion, but how about each person writes an interpreter for the other two languages?

11:50 TimMc: beat me to it :)

11:50 naeg: lol

11:50 jocke12: haha

11:50 TimMc: heh

11:51 Clojure has the most complex runtime, though.

11:51 gfredericks: write an interpreter for (intersection clj cljs)

11:51 scriptor: game of life actually sounds pretty fun

11:52 rbxbx: Actually, writing a simple lisp interpreter wouldn't be bad, though I feel like Erlang might be slighted in that domain.

11:52 gfredericks: erlang. what a guy.

11:52 pepijndevos: $['a 'b #_foo 42]

11:53 &['a 'b #_foo 42]

11:53 lazybot: ⇒ [a b 42]

11:53 abalone: gfredericks: haha. a corporation is not a person :-P

11:53 scriptor: isn't erlang's string processing a little handicapped or is that just a myth?

11:53 abalone: gfredericks: (political joke)

11:53 TimMc: abalone: Erlang was a guy.

11:53 gfredericks: abalone: programming languages are people my friend

11:53 TimMc: https://en.wikipedia.org/wiki/Agner_Krarup_Erlang

11:54 rbxbx: scriptor I know sadly little of Erlang, tbh :(

11:54 gfredericks: you can't spell people without PL

11:54 TimMc: >_<

11:54 pjstadig: or EO

11:54 TimMc: abalone: https://en.wikipedia.org/wiki/Ericsson is the place erlang was developed.

11:54 abalone: TimMc: there are four lights!

11:54 TimMc: What does that even mean?

11:55 rbxbx: TimMc the internet tells me it's a Star Trek TNG reference.

11:56 zerokarmaleft: abalone: ah! you called me Picard!

11:56 abalone: ok i didn't know erlang was also a guy. seemed like such a convenient abbreviation

11:56 TimMc: Ah, found it.

11:56 jocke12: did not know that erlang was a person connected to ericsson. just thought it was ERicsson LANGuage

11:56 scriptor: huh, it sounds a lot like the scene from 1984

11:56 qubit[01]: github down :(

11:56 jocke12: thanks for that, gfredericks

11:57 rbxbx: scriptor: the internet also tells me it's that the episode of TNG was a reference to 1984 ;)

11:57 * rbxbx googles things

11:57 scriptor: rbxbx: that's what I get for commenting before finishing the wiki article

11:57 jocke12: naeg: think we're going with sudoku solver. thanks

11:57 TimMc: jocke12: I don't know that Mr. Erlang had anything to do with Ericsson.

11:58 gfredericks: jocke12: ironically I wasn't even referring to that; but I did know it I think

11:58 jocke12: TimMc: well, not directly maybe, but it says on wikipedia that he was important to telecommunications, so i guess in some way he was

11:59 gfredericks: :D

11:59 scriptor: apparently it was both a reference to the danish mathematician and the company

11:59 two birds

11:59 rbxbx: jocke12 "A unit of measurement, statistical distribution and programming language listed below have been named in his honour."

11:59 jocke12: indeed

11:59 rbxbx: Yeah. Fancy, that.

12:00 Everyone gets to learn something today :)

12:00 jocke12: :)

12:00 scriptor: I'm surprised nobody has name a language after euler

12:00 oh, never mind

12:00 jocke12: http://en.wikipedia.org/wiki/Euler_(programming_language)

12:01 zerokarmaleft: damn you, Wirth, you claim everything that is cool

12:01 abalone: clearly i need my own language. but with the existence of clojure i cannot be motivated enough

12:01 basicsensei: is there a ccw channel?

12:02 is it possible to specify in :dependencies a project that's in (eclipse) workspace ?

12:02 or I'm stuck having to upload any updates to clojars?

12:02 unlink: How do I insert or update a row with clojure.java.jdbc if one of the columns is a PostgreSQL enum type?

12:04 basicsensei: since github's dead, I'm stuck waiting for the clojars tutorial to show: https://github.com/ato/clojars-web/wiki/tutorial

12:04 TimMc: basicsensei: https://encrypted.google.com/search?q=cache%3Ahttps%3A%2F%2Fgithub.com%2Fato%2Fclojars-web%2Fwiki%2Ftutorial

12:05 basicsensei: timmc thanks, wise one;)

12:05 TimMc: basicsensei: ...but you may want to look at firing up a local maven repo.

12:05 ~repeatability

12:05 clojurebot: repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability

12:05 TimMc: ^ there are some options here

12:06 basicsensei: sounds good

12:06 naeg: jocke12: believe me, that will be fun. you might want to think about writing a functional solution (like the others) and then write a logic one using clojure.core.logic

12:06 basicsensei: timmc, I'll take that as: https://webcache.googleusercontent.com/search?q=cache:KxQdDLSiirIJ:https://github.com/technomancy/leiningen/wiki/Repeatability+&cd=1&hl=en&ct=clnk

12:07 rbxbx: naeg is there a CGOL implementation on top of core.logic?

12:08 naeg: rbxbx: I don't know what exactly CGOL is nor whether core.logic has it :3

12:09 rbxbx: not sure whether this answers your question, but core.logic has the same syntax as clojure itself (s-expressions)

12:09 rbxbx: naeg: sorry. conways game of life. I thought that's what you were referring to before.

12:09 scriptor: http://en.wikipedia.org/wiki/CGOL

12:09 I thought it was that for a bit

12:10 rbxbx: CGOL is an unfortunate acronym apparently. I shan't use it again.

12:10 naeg: rbxbx: I'm not aware of one, but haven't searched. there is a sudoku solver in core.logic though (about 30 lines iirc)

12:12 rbxbx: I'm not sure whether a core.logic implementation of conways would be a good idea...

12:12 rbxbx: naeg: looking into it it doesn't seem like a problem often approached with logic programming

12:13 naeg so perhaps you're correct

12:13 naeg: I've only just started reading "The Art of Prolog" last night, so I can't say I have a good grasp on the sort of problems Logic Porgramming is suited for yet.

12:13 naeg: rbxbx: but it sounds interesting though, I'll put it on my ToDo and might come back to you with one

12:14 rbxbx: naeg: that would certainly be appreciated if you did :)

12:15 naeg: a paper to get you started, if you fancy (and can read their notation) http://citeseerx.ist.psu.edu/viewdoc/summary?doi=

12:15 naeg: rbxbx: it can't be that hard on first thought though, because you're actually just applying rules on some data

12:15 augustl: is there a mirror for leiningen out there, or is it only available on github.com?

12:16 technomancy: augustl: I had it on gitorious for a while but I don't know if the mirroring scripts have kept up

12:16 lemme take a look

12:16 naeg: rbxbx: but the pure clokure solution of conways will be hard or impossible to beat...

12:16 clojure*

12:16 technomancy: nope =(

12:17 I'll push

12:17 augustl: aww, let's hope github.com goes back up soon then :)

12:17 Hodapp: I eagerly await whatever paradigm replaces OOP as "that paradigm that must be good because everyone uses it and claims to support it and is therefore responsible for all things that are good because all modern things support it"

12:17 augustl: it's down again?

12:17 augustl: it's down for me at least

12:18 jkkramer: it's been down for a while

12:18 technomancy: augustl: https://gitorious.org/leiningen/leiningen

12:18 gfredericks: Hodapp: that will happen when somebody figures out some turing-complete thing based on REST

12:18 augustl: technomancy: nice!

12:18 gfredericks: Hodapp: or maybe it will just be the javascript paradigm

12:18 rbxbx: naeg: would be an interesting intellectual exercise, regardless. Plus wouldn't a hybrid solution be possible using 'core.logic ?

12:18 augustl: OS X seems pretty github centric :) Can't even get git (homebrew, that is)

12:18 jkkramer: nice, github's status page is down too

12:19 technomancy: if anyone has suggestions for how to automate mirroring from github to gitorious I'm all ears

12:19 Hodapp: gfredericks: It's not that OOP is bad, it's that it is certainly not everything it's so often claimed to be...

12:19 augustl: odd, it went down for 5-10 minutes yesterday too

12:19 gfredericks: Hodapp: I haven't been convinced it isn't bad

12:19 technomancy: getting an OS X dev environment seems a lot like terraforming; you need a friendly civilization on a nearby planet from which to shuttle supplies.

12:20 Hodapp: gfredericks: I see how it can map well to GUI development. My issue is with the common view that this must mean it also is optimal for every other problem, ever.

12:21 augustl: technomancy: you can set multiple URLs on a remote

12:21 so that when you push you push to both

12:21 technomancy: augustl: aha; clever

12:21 gfredericks: Hodapp: oh yeah guis are a good example maybe; I've been puzzling over organizing GUIs in clojurescript just recently

12:21 naeg: rbxbx: yes, for board representation, etc. I'd just use this: only (neighbours) and (stepper) will be replaced with logic predicates

12:21 rbxbx: and again, this: http://bpaste.net/show/S5OpM7BHWMQGfnzYO6ho/

12:21 technomancy: that's probably good enough. won't help for other committers, but it'll be eventually consistent

12:21 augustl: technomancy: hehe indeed :)

12:22 Hodapp: gfredericks: and the "object-oriented is the best paradigm for all other problems, because the world is made of objects!" is, er, hand-waving bullshit

12:22 duck1123: at least it'll only be out of date till you next push

12:22 or you could set up a cron to pull and then push

12:23 gfredericks: Hodapp: Erik Meijer and rhickey recently talked back to back here; Meijer ended with a demonstration of tearing a stuffed bear in half and claimed that therefore mutability is great because the real world is mutable

12:23 Hodapp: rhickey did not let that slide

12:23 technomancy: duck1123: yeah, I'd like to keep the cron somewhere it'd stick around. I could probably do it in a heroku app

12:23 Hodapp: o_O

12:23 zerokarmaleft: gfredericks: heh, i didn't watch that far into it

12:23 Hodapp: gfredericks: I would think tearing a stuffed bear in half is a demonstration that mutability is NOT always great

12:24 duck1123: The real wold is mutable, but you don't want to give a bear to a small child that someone else ripped up in another thread

12:24 gfredericks: rhickey's main rhetorical point, as I remember it, was that despite the bear no longer having a head, you don't have to forget that it had one

12:24 there is value to remembering :)

12:25 rbxbx: naeg: that is a pretty elegant solution, though I'm not super big on the heavy use of list comprehensions, but that's probably just a personal style matter :)

12:25 gfredericks: "don't be the bear" I think he said a few times

12:25 technomancy: just because we can't hop between parallel universes in real life doesn't mean it's not a totally awesome thing to be able to do

12:26 and I mean awesome there literally

12:26 Hodapp: Paul Graham has a few interesting essays on why he doesn't like OO much

12:27 justicefries: mutability also resulted in a bear without its head. ;)

12:28 gfredericks: eh that happens in either case

12:28 casion: Hodapp: PaulGraham has essays on why he doesn't like … anything that's not lisp ;)

12:28 gfredericks: zerokarmaleft: is the talk on the interwebs somewhere? or were you there?

12:28 justicefries: rhetorically wouldn't it be a new head being made and given to you, and you still have the original bear?

12:28 head twisting.

12:28 zerokarmaleft: gfredericks: http://channel9.msdn.com/posts/Expert-to-Expert-Erik-Meijer-and-Rich-Hickey-Clojure-and-Datomic

12:29 gfredericks: zerokarmaleft: oh that was just their conversation afterwards, right?

12:29 naeg: rbxbx: what else would you use there for e.g. create-world or neighbours? i'm rather new to clojure

12:29 gfredericks: they each gave actual hour-long talks

12:29 Frozenlock: Nooooo, no more interesting videos, stop it!

12:30 zerokarmaleft: gfredericks: no idea, i hope their GOTO talks get posted to infoq

12:30 rbxbx: naeg: as am I, but I'd probably be inclined to use HOFs. Not to say they would reach as elegant a solution though.. just work better to my mind :)

12:30 Hodapp: casion: well, I do agree with a lot of his essays, fiery as they sometimes are.

12:31 naeg: rbxbx: that code is actually based on that one: http://clj-me.cgrand.net/2011/08/19/conways-game-of-life/

12:31 (used in the book I'm reading)

12:31 casion: Hodapp: I do too, but citing graham has never worked for me ("Oh.. that guy, of course…")

12:32 * casion shrugs

12:34 mpan: is there a particular reason the language allows both calling a map with a keyword and calling a keyword with a map?

12:34 rbxbx: naeg: yup, I'm reading that as well. Cheers for the link though :)

12:35 dnolen: mpan: it's useful to have the collections be functions of their keys. have keywords implement IFn is also useful in other ways.

12:35 abalone: mpan: if you're using a threading macro, being able to choose where each goes is convenient

12:35 dnolen: ,(map {:foo 1 :bar 2 :baz} [:foo :baz])

12:35 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>

12:35 dnolen: ,(map {:foo 1 :bar 2 :baz 3} [:foo :baz])

12:35 clojurebot: (1 3)

12:36 dnolen: ,(map :foo [{:foo 1} {:foo 2}])

12:36 clojurebot: (1 2)

12:36 mpan: so like, it helps in the places where you would want something fn-like?

12:36 thanks!

12:36 nsxt: lispnyc meeting later: http://www.meetup.com/LispNYC/events/67027682/

12:39 naeg: dnolen: hey, have you seen my bug report for core.logic's +fd and infd? I'm still a bit unsure whether I misunderstood something

12:40 dnolen: naeg: I did, I'm happy that people are filing tickets on the FD stuff, but they probably aren't going to get addressed until I do a pretty serious refactor of how that's stuff works.

12:41 naeg: which probably won't happen until after StrangeLoop

12:41 naeg: dnolen: oh, so I should switch away from using FD stuff for my fun project since it's not going to be fixed in the near future?

12:42 dnolen: naeg: it's alpha stuff :) it will probably get addressed w/in 3-4 weeks.

12:42 naeg: I took a look at the code base, but that's too much for me as a clojure newbie

12:42 dnolen: naeg: heh, I don't really expect patches for the FD stuff. The refactor is pretty significant and addresses some serious flaws in the original Scheme design

12:45 naeg: dnolen: ok, great. can't wait to hear about it. btw, how can I get informed about such news? (github down atm, can't look myself)

12:45 dnolen: naeg: I will definitely announce a 0.8.0 beta on the Clojure mailing list.

12:45 gfredericks: dnolen: I've been fantasizing about doing OSS work during free time at strange loop; if that doesn't turn out to be over-ambitious maybe I'll be able to get my head around the FD code

12:47 dnolen: gfredericks: the Scheme cKanren code is definitely approachable - that + the paper is all you need. hopefully my unsession talk can clear up the basic internals for core.logic users.

12:47 gfredericks: dnolen: I will nearly almost probably be there then!

12:48 dnolen: gfredericks: the refactor from a high level is simple - the constraint fixpoint calculation in cKanren Scheme is not very good. so my refactor is mostly around improving that.

12:48 gfredericks: cool!

12:49 naeg: dnolen: one more question - is domain meant to be used on vectors? like this: (domain [[0 0] [1 1] ...])?

12:49 better say, can it be used on vectors

12:49 dnolen: naeg: no, meant to be used like: (domain 1 2 4 5)

12:51 naeg: dnolen: it is possible to create a domain of vectors then (not e.g. of LCons, since they are not comparable). is the workaround of using membero instead of domain correct then?

12:51 see here for more information on my issue: http://stackoverflow.com/questions/12355352/predicate-to-declare-descending-ascending-coordinates-using-finite-domains

12:56 dnolen: naeg: can't really go into a full explanation right now - will try to find some time to answer that question soon tho. but yes that last solution look OK at first glance. I'll try to make the domain doc string for domain more clear about valid inputs.

12:56 djanatyn: cool! I never knew assoc could work with vectors

12:56 assoc is my favorite function so far

12:56 technomancy: meh; it's OK. it's no juxt though.

12:57 djanatyn: I've never seen juxt :O

12:57 chouser: fnil -- a white knight on a charging steed

12:57 naeg: dnolen: thanks, you helped me a lot and saved me quite some time today :) will just replace conso with ==

12:57 djanatyn: I'm excited; I'm going to a local clojure meetup in pittsburgh today

12:57 technomancy: clojurebot: juxt?

12:57 clojurebot: juxt is usually the right answer

12:57 technomancy: clojurebot: have a scooby snack

12:57 clojurebot: forget botsnack is Thanks. Can I have chocolate next time

12:57 chouser: ha! lie!

12:57 technomancy: oh dear

12:58 djanatyn: O_O

12:58 juxt is awesome

12:58 cemerick: dnolen: is the restriction that e.g. :refer in ClojureScript's :require must be a vector something that could be relaxed? Seems like a silly clj/cljs incompatibility.

12:58 scriptor: it's like how "hashmaps" is the answer to 90% of software interview questions

12:58 djanatyn: it's like...backwards map

12:59 that takes functions instead of things to feed to functions

12:59 Hodapp: scriptor: I prefer "interfaces". Or just pick a random design pattern.

13:00 TimMc: singleton factories

13:00 dnolen: cemerick: I personally have no strong opinions about that. It's not clear to me whether the restriction was intended.

13:00 * Hodapp stabs design patterns in the face.

13:00 technomancy: lists in :require make me =(

13:00 * djanatyn tries to write juxt in haskell

13:01 TimMc: Design Patterns was intended as a set of observations, not recommendations. :-/

13:02 cemerick: technomancy: I like them as values of :refer, :only, etc. Some visual distinction helps with readability IMO. But, that's besides the point…

13:02 technomancy: cemerick: it's all about the indentation

13:02 cemerick: technomancy: fix your editor :-P

13:02 hiredman: cemerick: I tried to tell him

13:02 * chouser is suspicious of any literal list that isn't invokation

13:03 chouser: [:require ...] ftw!

13:03 * chouser ducks

13:03 * technomancy backs away slowly

13:04 xeqi: djanatyn: &&& from http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Arrow.html

13:04 hiredman: you've certainly won something there

13:04 cemerick: dnolen: It seems to be intentional (it's enforced with an assertion with firm error message), but goes against the docs for require, refer, and canonical examples like @ http://clojure.org/libs

13:04 technomancy: cemerick: every other place you use parens, the head is indented separately from the tail

13:04 and things in vectors are indented as peers

13:04 why complicate things with new rules that only apply inside ns?

13:05 cemerick: I can't say I've ever had more than 3-4 things in a :refer or :only list *shrug*

13:05 djanatyn: looks like sequence does what juxt does

13:05 cemerick: If you're bringing in more than that, an ns alias is probably a better route?

13:05 djanatyn: too much clojure, I forgot to add commas in my lists in haskell :)

13:06 technomancy: cemerick: yeah actually I strongly prefer :require/:as now, but I used to work on a codebase with ginormous :only vectors

13:06 djanatyn: funny how you start to realize that commas are really only there to pacify the parser

13:07 dnolen: cemerick: then I would bring it up on the ML ... the restriction dates back to the original release - so perhaps it was a explicit effort to limit variations.

13:07 technomancy: and once you realize that it starts to get more and more annoying because it's obvious the designer of the parser didn't realize it =(

13:07 cemerick: dnolen: will do

13:07 thorbjornDX: technomancy: python

13:08 djanatyn: technomancy: I'm pretty sure the commas are important in haskell, because of how haskell does functions

13:09 my example was:

13:09 technomancy: oh yeah, the whitespace sensitivity probably complicates things too

13:11 thorbjornDX: technomancy: ggVG= shouldn't break code functionality IMO

13:19 naeg: If I want to wrap certain funccalls into always the same sourrouding funccallls - is this where I use macros of HOF?

13:19 djanatyn: > let juxt fs x = map (\f -> f x) fs in juxt [(+1), (+2), (+3)] 5

13:20 gfredericks: naeg: I have no idea what that means

13:21 naeg: gfredericks: I'm having severals checks which always have the same core.logic run, fresh, and (== q) around them. only the goals in between differ on each call

13:22 gfredericks: naeg: if you're just doing (== q [x y z]) for some fresh x y z, you can actually use x y z as the query variables

13:22 i.e., (run [x y z] ...)

13:22 naeg: gfredericks: ok, so the fresh is not needed - but the other stuff around is

13:23 gfredericks: you don't need the fresh or the ==; what else is there?

13:23 naeg: gfredericks: concrete code: http://bpaste.net/show/44967/

13:24 gfredericks: but the first and second goal (infd and everyg with +fd) are the variables and the stuff around is always the same

13:24 tried to just give check* functions through parameters, but that didn't work

13:26 gfredericks: you could make a function (relation) that takes the a b c d as args, couldn't you?

13:26 then does the variable stuff

13:26 I guess I'm suggesting exactly what you claimed doesn't work

13:26 so I'm curious what didn't work for you

13:27 naeg: gfredericks: just a sec, have to rewrite what didn't work for me

13:30 gfredericks: trying something new now, just giving check* & rules parameter and trying to extract that inside l/run then - takes some time, clojure newbie

13:32 gfredericks: so you have a list of relations and you want to assert each of them

13:32 I think you'd want a helper function for that

13:36 everyg would be a good name for it but that is apparently taken

13:36 maybe all-fn

13:37 (defn all-fn [funcs & args] (if (empty? funcs) succeed (all (apply (first funcs) args) (apply all-fn (rest funcs) args))))

13:37 * gfredericks thinks maybe that might work

13:38 naeg: gfredericks: I just realized it's always just two functions - one which is a constraint (either infd or membero) and one rule which describes the winner

13:38 oich: When I attempt to run line-ritz it trys and fails to fetch leiningen:leiningen:jar:2.0.0-SNAPSHOT. I have the most recent leiningen. Do you know where I can change this, or find the jar? I don't see a reference in any pom in my maven pile 'o jars or the ritz source tree.

13:38 gfredericks: yeah it'd be simpler for sure to avoid the dynamic-length part

13:39 naeg: gfredericks: yeah, and it seems not to be needed at all

13:39 oich: lein-ritz... I mean

13:40 hugod: oich: I realised I messed up with that dependency yesterday - you will either need to build lein master and install it, or build lein-ritz from source and install it. I should have a new ritz release shortly to fix this properly.

13:44 naeg: gfredericks: I'm still fiddling around, but this is about what I'm trying to do:

13:44 http://bpaste.net/show/jl6FZMfZrqmTBCACzNL6/

13:44 the -old versions work, the two new ones don't

13:44 Frozenlock: Is the 'indices' function in clojure now, or do I need to add it in my programs? http://stackoverflow.com/questions/8641305/how-do-i-find-the-index-of-an-element-that-matches-a-predicate-in-clojure

13:47 sayyestolife: I'm having some trouble with encodings, more precisly the swedish characters å, ä and ö. I can read a file with slurp from the REPL or clj myfile.clj and it does print correct characters. However when using noir, all I get is those famous unicode-boxes

13:48 S110010011: sayyestolife: content-type header in http responses?

13:52 the-kenny: Is there a browser-connected nrepl that works nicely with nrepl.el?

13:54 cemerick: the-kenny: see piggieback

13:55 https://github.com/cemerick/piggieback

13:56 amalloy: S11001001, sayyestolife: content-encoding, not content-type

13:57 abalone: working on my subset of paredit for codemirror (which i shall call 'subpar') .... does light-table use ctrl- up/down/left/right for anything?

14:04 pepijndevos: dnolen: I modified Clojure so it does not use ArrayNode, and it's somewhat slower.

14:04 With ArrayNode: "Elapsed time: 37540.096 msecs"

14:04 without: "Elapsed time: 48837.642 msecs"

14:05 dnolen: pepijndevos: did you figure out why?

14:07 pepijndevos: dnolen: still thinking about that. The only thing I figured out so far is that it switches on the degree of the node, and that ArrayNode contains only other INodes

14:07 xeqi: the-kenny: piggieback works as a repl, though nrepl.el needs some changes to load files; kingtim/nrepl.el#95

14:07 lazybot: Use :op load-file to load a file -- https://github.com/kingtim/nrepl.el/issues/95 is open

14:08 the-kenny: xeqi, cemerick: Thanks, that looks nice. I can't wait for full support in nrepl.el. Finally a nice dev-environment for hybrid projects

14:09 pepijndevos: dnolen: So far it does not seem a matter of time complexity, but rather regular time :) Still about 8 reads of the code to go.

14:12 nsxt: ring-anti-forgery's docs/code give me the impression that, after adding it as middleware, *anti-forgery-token* should be available. unfortunately, i keep getting Unbound: #'ring.middleware.anti-forgery/*anti-forgery-token*

14:13 weavejester: nsxt: It's likely you're not accessing the var within the middleware.

14:13 nsxt: weavejester: haha, so i'm operating under a gross misunderstanding - the var isn't available throughout the application, but only within the middleware?

14:13 weavejester: nsxt: The middleware adds a binding around your handler, so you can only access that var's value within the handler that has been wrapped.

14:14 nsxt: weavejester: thanks

14:14 weavejester: nsxt: It's available in the handler the middleware wraps

14:14 nsxt: And any functions called by that handler within the same thread, of course.

14:17 sayyestolife: S11001001: none is visible from firebug, only content-type which is utf-8

14:18 naeg: llasram: hey, I tried to apply your solution for checking rows/cols on a connect four field onto diagonals - but it's messy

14:18 ofc, instead of looking whether they are in sequence, I have to check whether they are ascending/descending (which means, y and x coordinates matter)

14:18 S11001001: amalloy: charset is in content-type

14:18 amalloy: content-encoding is like gzip or what have you

14:19 amalloy: dang. too long since i fiddled with that stuff, i guess. objection withdrawn

14:19 oich: hugod thanks about the leiningen dependency. I mistyped though, I meant lein ritz-nrepl. Now, I get an exception in thread "main " of com.sun.jdi.connect.VMStartException: VM initialization failed for: /opt/jdk1.7.0_04/jre/bin/java. Do I need a different jdk version?

14:19 S11001001: sayyestolife: does the writer on java side know you're in utf8 land?

14:19 llasram: naeg: Yeah. I'm not sure what the best representation to make the expression most straightforward

14:20 sayyestolife: I'm using slurp straight out

14:20 naeg: llasram: did you try around with diagonals too?

14:20 llasram: I'm thinking about converting diagonals to rows/cols, so I only have to care about one coordinate again

14:20 hugod: oich: looks like you are running a jre rather than the jdk. Could that be?

14:22 naeg: llasram: well, I could create "matches" based on [y x] like [2 2] would be 22 and the difference between each has to be 11

14:23 damn, that seems neat on first thought...

14:24 mpenet: sayyestolife : you could also try adding :jvm-opts ["-Dfile.encoding=UTF-8"] in your project.clj just in case

14:24 Frozenlock: In the DOM, if I ask for td[1], I will get the FIRST cell from a row in a HTML table. However, nth 0 will give me the first element in a coll. If I want to make some cljs function to manipulate the html table, how should I implement it? 0--> first, or 1--> first?

14:25 Idiomatic clojure would be 0---> first, right?

14:26 Bronsa: è

14:26 i think so*

14:26 nsxt: weavejester: not sure if you're intimate with noir, but would this entail using a custom-handler, rather than add-middleware?

14:27 sayyestolife: S11001001:, mpenet the difference is that it works when running it in a REPL or in a "clj myfile.clj"-script, but not when I do lein run?

14:27 nsxt: (i'll admit to being completely lost as to how to access values within the handler)

14:28 dnolen: pepijndevos: w/ ArrayNode that's 30% faster tho right? Not quite a "slight" difference.

14:29 thorbjornDX: is it best to use (int (/ 1 2)) if I want floor division? or should I use with-precision?

14:29 pepijndevos: dnolen: yea… funny.

14:30 aperiodic: thorbjornDX: quot

14:30 nsxt: weavejester: never mind, i got it. sorry for the pestering.

14:30 naeg: how can I put two numbers together, like (f 1 2) => 12

14:31 thorbjornDX: aperiodic: thanks

14:31 Bronsa: ,(str 1 2)

14:31 clojurebot: "12"

14:31 keugaerg: (#(+ (* 10 % ) %2 )

14:31 ((#(+ (* 10 % ) %2 ) 1 2)

14:31 llasram: naeg: I don't think you want to do that... I think it'd be more straightforward to just express the logical conjunction of the two conditions

14:31 keugaerg: (#(+ (* 10 % ) %2 ) 1 2)

14:31 naeg: oh, yeah, meant "12" - so str

14:32 keugaerg: ,(#(+ (* 10 % ) %2 ) 1 2)

14:32 clojurebot: 12

14:32 zenoli: (Integer/parseInt (str 1 2)) to round trip it back to a number.

14:32 naeg: llasram: "two conditions"?

14:32 keugaerg: ^^

14:32 llasram: naeg: incrementing in both the x and y directions

14:33 naeg: llasram: that's what I was trying to do, but it got really ugly, let me paste some code

14:35 llasram: naeg: Actually... You know what, I retract what I was saying. I think the basic approach is right. If you collapse the board positions into a single index, then you can express all winning states as patterns of those indices

14:35 so (let [i (+ x (* 5 y))])

14:36 naeg: llasram: (* 5 y)?

14:36 llasram: Then rows are just incrementing values by one, columns by 5, and diagonals by 6

14:36 With some extra rules to prevent wrapping around edges :-)

14:37 naeg: llasram: I was actually planning to leave the check for rows and cols the same. also, the ugly code I promised: http://bpaste.net/show/Pc0jRiSXy0LBOySfeAT7/

14:37 (it doesn't even work yet actually)

14:37 llasram: naeg: Oh, right 6x6 grid, so *6

14:38 naeg: llasram: 6x7 grid

14:38 llasram: Oh, same principle :-)

14:38 Yeah... that code seems a bit much for what should be a simple problem

14:39 naeg: llasram: I learnt a lot of things though, so not completly wasted time :P

14:39 llasram: Of course! Plan to throw one away and all

14:39 naeg: (and it could be made improved and reduced to less code a lot, like ascendo/descendo, etc.)

14:40 llasram: but generating values for actual coordinates is only needed for diagonals - would you apply that pattern on the checks for rows and cols anyway?

14:41 llasram: naeg: I think so. Because then you could collapse to a single representation

14:42 I think you could do this version in ~6 lines of code

14:42 djanatyn: woah woah woah woah woah

14:42 does clojure have built in pattern matching? :O

14:42 naeg: llasram: yeah, I guess I'll use a vector of strings then, instead of a vector of vectors of strings

14:42 then the index is all i have to care about

14:43 djanatyn: ,((fn [[x y]] (+ x y)) [1 2])

14:43 clojurebot: 3

14:43 naeg: I just love throwing all the code and concepts away for something new

14:43 djanatyn: whaaaaaat

14:43 I can now remove apply in like...500% of my code

14:44 llasram: naeg: I hope not sarcasm?

14:44 dnolen: djanatyn: not pattern matching, destructuring. tho proper pattern matching is possible via macros.

14:45 naeg: llasram: biased - put quite some time in the old stuff, but I'm somewhat excited about the new solution

14:48 cemerick: djanatyn: see http://clojure.org/special_forms#let for more about destructuring

14:49 Or a good book ;-) …there's a lot of nifty tricks one can do with destructuring.

14:53 unlink: I can't be the first person to want to insert an enum value into PostgreSQL with Clojure, am I?

14:56 Or am I supposed to use sql/do-prepared "INSERT ... VALUES (?::my_enum_type, ?, ? ...)" directly?

14:56 hoover_damm: unlink, you could

14:59 hiredman: unlink: what type of column are you trying to insert it in to?

14:59 (java enums are ints at the bottom, I believe)

15:00 pepijndevos: Where is this box class defined? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java

15:00 hiredman: unlink: http://stackoverflow.com/questions/3155967/are-enums-supported-by-jdbc

15:00 dnolen: pepijndevos: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Box.java

15:00 pepijndevos: hur dur

15:00 S11001001: pepijndevos: grep is your friend

15:01 oich: hugod about lein ritz-nrepl I see it is using the jre. which java returns the JDK java and JAVA_HOME is set to the JDK directory. Do you have any guess about where the jre path is coming from?

15:01 unlink: hiredman: It's an enum type I've created with CREATE TYPE. No, JDBC does not in fact support transparent mapping between Java enums and database enums. That isn't what I'm asking for, though.

15:01 pepijndevos: S11001001: can't grep on github. Oh wait, I do have a copy now, Yea, should try that.

15:02 S11001001: also probably can't log -f or chase blames on github

15:02 unlink: hiredman: I have a value like 'USD' and I'm trying to insert it into a column of type currency, such as one created by CREATE TYPE currency AS ENUM('USD', 'EUR', 'JPY', 'CHF');

15:02 hiredman: unlink: oh, I thought you meant java enums

15:03 unlink: I would like to do (sql/update-values :products ["id=?" product-id] {:currency "USD"}) but this doesn't work.

15:03 hugod: oich: which os? do you have a leinrc file?

15:03 hiredman: unlink: what db?

15:04 naeg: llasram: although, I'm wondering - what exatly should be done in ~6LOC?

15:04 unlink: hiredman: PostgreSQL

15:04 hiredman: unlink: does the sql work from pgsql?

15:05 oich: hugod linux (fedora). .lein/profiles.clj contains only: {:user {:plugins [[lein-ritz "0.4.1"]]}}

15:05 hiredman: or whatever the postgress command line client is called

15:05 unlink: hiredman: if I do echo "UPDATE products SET currency = 'USD' WHERE id = 123" | psql db?

15:05 jsabeaudry: (if-let [x (foo)] x :other-value) is there a more idiomatic way of writing this ?

15:05 hiredman: unlink: yeah

15:06 unlink: hiredman: yes, works fine.

15:06 hiredman: unlink: did you pastebin the error you get somewhere?

15:07 llasram: naeg: Well, maybe closer to a dozen. But take a board, a piece-symbol, and return all winning index-sets

15:07 raek: jsabeaudry: (or (foo) :other-value)

15:07 llasram: naeg: That's just the scope I was considering

15:08 hiredman: at work in mysql what we have in schemas is something like ..., state SET ('new', 'scheduled', 'complete'), …

15:08 jsabeaudry: raek, ah yes, thanks!

15:08 hiredman: which works fine with jdbc and mysql

15:08 unlink: hiredman: Yeah, MySQL casts text to enums without complaining. PostgreSQL does not.

15:08 naeg: llasram: I'm currently writing (get-matches) which gets index for the relevant rows, cols and diags - then i'm trying to find those patterns in all those index

15:09 hiredman: unlink: you may have to dig in to how jdbc does type mapping

15:09 naeg: llasram: i'm only considering those which are relevant to the newest turn - shall I just go with all?

15:15 pepijndevos: hehe, I had this thought too. If you remove everything from the bitmap, do you remove the bitmap. NO: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L653

15:15 djanatyn: destructuring using maps is *very* cool

15:18 I feel like I find out a new *very* cool thing about clojure every day, but it's not nearly as confusing as it was when I was learning haskell

15:19 also, I'm solving a lot of problems I never had the patience to solve in other languages

15:20 llasram: naeg: Relevant to the newest turn? Not quite following

15:23 naeg: llasram: if the player's coin landed at [0 2], I only have to check row 0, because there sure won't be a row-based winning combination in row 1-5

15:24 llasram: naeg: Oh. Yeah, seems way easier to just re-evaluate the whole board

15:24 pepijndevos: dnolen: any idea what this box is used for? I'm on my third read through BitmapIndexedNode

15:25 llasram: naeg: If this were a harder problem, might help to include forcing the solution to include the new piece, but probably not worth it here

15:25 naeg: llasram: well, not exactly. I'm struggling with determining where diagonals start/end based on a given index

15:25 dnolen: pepijndevos: a mutable container to know whether a leaf has been added.

15:26 naeg: llasram: it's probably easier to just filter out all index where the given piece-symbol is present and search for the patterns in there - also more "logial" in general

15:26 casion: naeg: are you using an array for your board representation?

15:26 llasram: naeg: Oh, for "harder" I meant for the computer to solve, like pruning solutions

15:26 casion: or a vector

15:26 pepijndevos: dnolen: ah, I think it's only used to ceep track of the number of elements in the map: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L146

15:26 naeg: casion: actually a vector of vectors of strings, but the solving part works on a vector of strings

15:27 casion: naeg: in chess engines that use 2d arrays, they have bounds padding around the the board (2 levels due to knight movement)

15:27 surround your board with invalid values so you can easily check for exceeding boundaries

15:29 naeg: casion: sounds like a great idea, will consider it if I can't attempt to do what is in my mind now

15:30 casion: if your board is [[x x] [y y]], it becomes something like [[-1 -1 -1 -1] [-1 x x -1] [-1 y y -1] [-1 -1 -1 -1]]

15:34 TimMc: In clojure that would be (get-in board [x y] :out-of-bounds)

15:37 amalloy: surrounding the board with invalid values sounds awful. make use of TimMc's suggestion

15:42 naeg: llasram: it might be a better idea to use (+ (* y 10) x) for the index, because then the diagonals can't go over boundaries?

15:44 llasram: with current representation, [30 22 14 6] could be a diagonal, but it obviously isn't

15:45 llasram: naeg: Maybe. That actually seems like casion's suggestion, applied to this representation. Honestly, my focus is elsewhere ATM :-)

15:45 naeg: that's fine, thanks though :)

15:45 clojurebot: thanks for your suggestion, but as usual it is irrelevant

15:46 naeg: ?

15:46 technomancy: clojurebot: be nice

15:46 clojurebot: It's greek to me.

15:46 casion: if you don't have bounds, or pre-calc deltas (inefficient), you end up wrapping around when calculating diagonoals

15:46 ro_st: technomancy: how do i tell clojure-mode to use a different font-lock for strings?

15:47 casion: you can't just arbitrarily check for out of bounds without explicit boundaries because a basic diagonal calculation won't generate invalid indices till it reaches the top or bottom of the game board

15:47 naeg: casion: what I first thought of was just (apply concat vec-of-vecs-of-strings-board) and then have index from 0 to 42 - but there are problems with diags

15:47 ro_st: keywords and strings are all mashed together, colour wise. i'd like to distinguish strings to improve readability

15:47 technomancy: ro_st: not sure if you can do it just for clojure-mode. M-x customize-face can do it globally

15:47 ro_st: didn't you write clojure-mode?

15:47 technomancy: no, I just maintain it

15:48 naeg: casion: but when I use (+ (* y 10) x) for the index, then I don't seem to have problems with diags/boundaries

15:48 ro_st: the thing is, i'm using solarized which specifies a colour for strings, but cl-mode ignores it and uses the one for keywords

15:48 ah

15:49 naeg: casion: don't know whether you read that before, but when I filtered all the relevant index for a piece-symbol, I would search for patterns in it: either a +1 sequence (row), +10 sequence (col), +11 sequence (\) or +9 sequence (/)

15:49 ro_st: nah, customize-face alteration is ignoring me

15:49 oh well

15:49 back to solving real problems :-)

15:50 abalone: ro_st: try deep-blue theme

15:50 naeg: casion: boundaries are still a problem though -.-

15:50 abalone: ro_st: strings and keywords are different colors for me

15:51 ro_st: hmm. i'll try that, thanks

15:51 abalone: ro_st: i used to use solarized dark

15:52 ro_st: that's what i'm on now

15:52 abalone: ro_st: i know. but i'm not standing behind you.

15:52 ro_st: haha :-)

15:52 casion: naeg: if you're always generating diagonals in the same direction, you can check if you've exceeded wrapped by comparing current and previous values

15:53 pepijndevos: dnolen: fisnished third read. Other than that BitmapIndexedNode is just a lot more complex, they basically do the same thing, afaict. Now, sleep.

15:53 ro_st: how many fingers am i holding up

15:53 casion: but that's far less efficient than just having an explicit boundary

15:53 abalone: ro_st: your thumb counts as a finger.

15:53 dnolen: pepijndevos: did you read Karl Krukow's posts about PHM?

15:53 casion: you could also switch to using bitboards, then diagonals are easy ;)

15:54 pepijndevos: dnolen: … maybe… link?

15:54 dnolen: pepijndevos: http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/, that and the follow up post might shed some light.

15:54 pepijndevos: dnolen: yea, read that one, but it doesn't go into much detail about the actual implementaion

15:55 dnolen: he uses ingle nodes and empty nodes, while the clojure impl uses just bitmap nodes that are wildly more complex

15:55 naeg: casion: I'm getting insane - now i'm thinking again that with this representation boundaries are no problems...enough for today

15:55 pepijndevos: *single

15:56 casion: naeg: it's not a problem… it's just not as efficient

15:56 pepijndevos: oh, he calls them leaf nodes. Anyway, no such thing exists. The edge case is handled in the mitmap node itself.

15:57 lnostdal: hi guys, anyone else constantly getting the *nrepl error* buffer popping up even though there are no errors? (nrepl.el + nrepl instead of slime and swank this)

15:59 pepijndevos: dnolen: his bitmapindexed node is actually more like arraynode

16:00 dnolen: pepijndevos: he's actually referring to the old PHM implementation, before rhickey refactored faster version.

16:00 pepijndevos: follow up post covers that.

16:00 pepijndevos: oh! I never read part 2

16:01 nsxt: is there a way to get the name of the referring namespace? e.g. within namespace a, there's a call to foo within namespace b - can b return 'a' as its referrer?

16:01 err... can foo* return

16:01 pepijndevos: sweet!

16:02 dnolen: pepijndevos: one thought perhaps the win is because BIN (bitmap indexed nodes) is not really 32 way - it's 16 way since it holds leaves. ArrayNode support the full 32 way branching?

16:03 pepijndevos: BINs become ANs when there are more than 16 KV pairs I think.

16:03 pepijndevos: dnolen: but it's arraynode that's the optimization. And… why would leaves be 16-way?

16:03 oh yea

16:04 djanatyn: hmm :\

16:05 chouser: nsxt: if foo is a macro, you might be able to swing it.

16:05 or I suppose you could capture a call stack and troll through it. ew.

16:08 pepijndevos: dnolen: not necessarily leaves though, any "sparse" node. Maybe that is the secret. But I doubt bitcounting makes for 30% time diff

16:12 dnolen: pepijndevos: yep looking at CLJS implement, ArrayNodes always hold arrays of 32 elements - nodes. BINs are 32 arrays of alternating KV pairs.

16:12 pepijndevos: so you really want BINs to be at the bottom - ArrayNodes are just going to be faster - you want to hop through those.

16:13 pepijndevos: dnolen: right, so maybe the time difference comes from copying 32 elements, instead of 64? and not using a bitmap, and… lots of small things.

16:20 svedubois: How I can change the default font of seesaw?

16:20 (default-font "Label.font")

16:21 #<FontUIResource javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]>

16:24 rattboi: hi, I'm working on doing the 4clojure problems, and I think I'm stuck on syntax for one problem. Is it ok to ask about it here? I know what I'm attempting to do, but it's not working as I expected.

16:24 Hodapp: I don't expect anyone will bitch at you.

16:25 rattboi: the problem is to reimplement count

16:25 lemme just paste what I have somewhere

16:26 http://pastebin.com/TfbGZXan

16:27 I thought when it recurred to the point where the list is empty, ind would have been incremented the # of drops, and so it would return ind = # of elements.

16:28 hyPiRion: ,(rest [])

16:28 clojurebot: ()

16:28 hyPiRion: ,(nil? (rest []))

16:28 clojurebot: false

16:28 hyPiRion: ^

16:28 rattboi: ah, that's a problem

16:29 hyPiRion: Hint: There's a function called empty? - check it out :)

16:31 rattboi: could I be using a local let instead of the multi-arrity call thing?

16:33 hyPiRion: You could use loop instead.

16:35 naeg: casion: after a short break, I managed to implement it: http://bpaste.net/show/zNBy4VYkoQexPga2BkVQ/

16:35 hyPiRion: ,(loop [a () b [1 2 3]] (if (empty? b) a (recur (conj a (peek b)) (pop b))))

16:35 clojurebot: (1 2 3)

16:35 casion: naeg: l is core-logic?

16:36 naeg: casion: yeah

16:36 casion: bah, I don't know anything about core-logic :(

16:37 naeg: casion: well, it's basically trying to find pattern of either +1, +10, +11 or +9 inside the given dataset

16:37 if it can find such a pattern with in sequence of 4 numbers, we have a winner

16:37 casion: oh… so you're not generating diagonals, you're searching them?

16:38 rattboi: http://pastebin.com/eti22j8V <-- 2nd attempt

16:38 hyPiRion: rattboi: That looks good, sir!

16:38 rattboi: (counter [1])

16:39 IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:487)

16:39 ^^ I'm not sure what that's about...

16:39 naeg: casion: I wanted to make heavy use of core.logic - all i did outside of it is generating the indices of (+ (* y 10) x) for each piece of a player

16:39 hyPiRion: rattboi: in the recur, you've mixed the first and second argument

16:40 naeg: is there something like map in core.logic which can be used inside a conda?

16:40 hyPiRion: c is the first argument, lst is the second.

16:40 rattboi: awesome. I need to read more on recur. I think there's something fundamental I'm not understanding with it

16:40 thanks for the help though :)

16:41 naeg: casion: i'm not sure what you were talking about though. anyway, i'm having three algorithms for checking a connect four field now (generating all possible winning combinations and pulling out those, a bitboard solution and this core.logic)

16:41 hyPiRion: rattboi: Play around with it a bit more

16:42 casion: naeg: I did not realize you were searching the diagonals, I though you were just generating long diagonals from a position

16:42 naeg: casion: I guess that's what I'm doing here: https://gist.github.com/3520562

16:44 samuelj: Hey guys, I'm trying to build something simple on top of compojure, but I'm getting a PersistentList cannot be cast to Ifn exception. I've included a pastebin here, can anyone point me in the right direction? http://pastebin.com/fEUEVuCQ

16:44 hyPiRion: ,(let [foo (fn [a] (if (= 0 (get a 0)) a (recur (update-in a [0] dec))))] (foo [10 9 8 7 6 5 4 3 2 1 0]))

16:44 clojurebot: [0 9 8 7 6 ...]

16:44 samuelj: Any help is greatly appreciated :)

16:44 naeg: chouser: good thing we talked about conda before, just made use of it now :)

16:45 chouser: naeg: :-)

16:45 weavejester: samuelj: routes doesn't take a list. It's signature is (routes & handlers) rather than (routes handler). So you need an "apply" in there

16:46 samuelj: (def app (apply routes @my-routes))

16:46 naeg: chouser: anyway, an idea what I could do about all those redundant calls to find-pattern? http://bpaste.net/show/zNBy4VYkoQexPga2BkVQ/

16:46 samuelj: weavejester: ah thanks! i'm getting there!

16:46 Cheiron: Hi, I need to build a REST API. I checked a couple of projects modeled after WebMachine but I'm not satisfied. Do you recommend a project to build REST APIs?

16:46 weavejester: samuelj: But if you're going to be dereferencing the atom immediately, there's no point in having it, really.

16:46 samuelj: oh, is there a better way?

16:47 hyPiRion: Just defroutes immediately: Put all the routes within the defroutes.

16:48 weavejester: samuelj: I'm not entirely sure what you want to do, but atoms are used for modifying state atomically

16:48 samuelj: If you're going to be creating it and dereferencing at compile time, there's not a lot of point to it.

16:49 franks: anyone seen this error, which seems to come and go (?): Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'hiccup.core/render-html

16:50 weavejester: franks: That's familair, but I can't remember what caused it...

16:51 samuelj: weavejester - so I could actually just add to a list right?

16:51 weavejester: samuelj: If you want to split up the routes you could just define them in parts and then combine them later.

16:51 franks: weavejester: i upgraded from hiccup 0.3.8 to 1.0.1 ...

16:52 piranha: hm, what's the best way to follow releases of leiningen, lein-cljsbuild, and so on? I just discovered that my lein is hundred years old already...

16:52 hugod: oich: do you have LEIN_JAVA_CMD or JAVA_CMD set? or are you using drip?

16:53 technomancy: piranha: `lein upgrade` will mostly do the right thing. there's a lein-outdated plugin for dependencies

16:53 piranha: technomancy: thanks!

16:54 technomancy: piranha: `lein upgrade` won't get you from 1.x to 2.x though since it's still a preview

16:54 hugod: oich: ritz 0.4.2 is out now, which fixes the dependency in lein ritz-nrepl on leiningen-SNAPSHOT

16:54 piranha: technomancy: sure, I had preview4 :)

16:56 interesting, why 'lein repl' now writes 'Compiling ClojureScript'... it didn't do that before upgrade

16:57 technomancy: piranha: hooks can be auto-detected from plugins now

16:57 piranha: I see :)

16:58 ehm, is there anybody who got piggieback working with browser repl?

16:59 technomancy: piranha: there's a thread about that on the mailing list

16:59 piranha: cemerick: its readme says I can ping you, so here we go, I can't really understand where do I execute (cemerick.piggieback/cljs.repl ...), because cljs.repl isn't on my path...

17:00 technomancy: yeah, I've read it, I probably lack experience a bit, still newbie to clojure :\

17:00 technomancy: piranha: it's not just you; the whole setup is really convoluted

17:00 cemerick: piranha: what's the actual error you get?

17:01 piranha: cemerick: well, I thought I should paste those 3 lines of code in a running repl

17:01 and it says CompilerException java.lang.ClassNotFoundException: cljs.repl.browser, compiling:(NO_SOURCE_PATH:2)

17:01 maybe I'm wrong? should I create some script?

17:01 cemerick: piranha: how are you starting this REPL?

17:01 piranha: cemerick: 'lein repl'

17:02 in a directory of cljs project

17:02 cemerick: and you've added piggieback as a dependency?

17:02 piranha: yes

17:02 cemerick: bizarre

17:02 piranha: what version of lein?

17:02 piranha: I can show my project.clj if that will help :)

17:02 preview10 :-)

17:02 cemerick: piranha: please

17:03 piranha: cemerick: http://paste.in.ua/4708/

17:03 franks: weavejester: when i go back to 0.3.8 everything works... and 1.0.1 doesn't give me any useful line number of the offending line (?)

17:03 weavejester: franks: Which Lein are you using?

17:04 franks: i.e. Lein 1 or 2?

17:04 cemerick: piranha: meh, looks sane. It's bizarre that you don't have cljs.repl on your classpath though, it's part of ClojureScript :-/

17:04 piranha: :\

17:04 franks: weavejester: tried both lein 1 and 2 - same error

17:04 piranha: cemerick: maybe that's because of :extra-classpath-dirs somehow?

17:04 franks: weavejester: blew away ~/.m2 but that didn't help

17:04 cemerick: oh.

17:05 piranha: I'll try commenting them out :)

17:05 cemerick: piranha: Hell, maybe. Take those out of the project.clj and give it a whirl.

17:05 piranha: sure

17:05 cemerick: so I guess you have a cljs checkout in /deps?

17:05 weavejester: franks: Hm, I thought I recalled this being a problem with deps… Are you doing anything unusual with Hiccup? Can you reproduce the problem in a repo I can look at?

17:05 piranha: cemerick: yes, current release has a small bug

17:06 technomancy: can I somehow remove a hook which compiles clojurescript from a repl command? It doesn't make a lot of sense to me...

17:06 cemerick: same error, without extra classpath

17:07 cemerick: piranha: you can move cljsbuild to its own profile to keep it out of repl invocations

17:08 piranha: cemerick: is it described in lein docs? I'll read then :)

17:08 technomancy: piranha: ugh; I thought you could but looking over the implementation I don't see a clear way to =(

17:08 cemerick: piranha: yeah, look in leiningen/doc

17:08 piranha: cemerick: if you have time/will have time/desire, I can push changes with piggieback to my project on github so you can see if it's a bug in piggieback...

17:08 technomancy: will definitely need to fix that

17:08 franks: weavejester: just changed it back to 1.0.1 to push it on github for you, but now it compiles without the error... scary stuff

17:09 weavejester: franks: Which version of Clojure?

17:10 cemerick: piranha: your project.clj works here. Sorry :-|

17:10 franks: weavejester: clojure 1.4

17:10 weavejester: franks: Hm. Curious.

17:10 piranha: cemerick: eh, what can it be... I'll remove ~/.m2/ to try again %)

17:11 technomancy: piranha: oh wait I see now it might be possible

17:11 try :plugins [[lein-cljsbuild "x.x.x" :hooks false]]

17:11 weavejester: franks: I've only heard of this problem once before, and I seem to remember it vanished as well after some random fiddling around.

17:11 piranha: technomancy: ok :)

17:11 technomancy: oh, it's even documented in sample.project.clj; I'm dumb

17:12 cemerick: technomancy: that probably won't work because of the profile double-application that's going on

17:12 franks: weavejester: sorry, i screwed up editting the wrong project.clj - error is still there... which is "good" - let me push it out on github

17:12 cemerick: (or, I seem to remember trying that at some point, and it not working)

17:13 technomancy: hm... if it's not possible we should have a bug open about it

17:14 piranha: eh, still ClassNotFound :((

17:14 cemerick: any ideas where should I poke to make it work? :)

17:15 weavejester: franks: I'll look at it tomorrow or Thursday night. Now I need sleep :)

17:15 russfrank: why was lein plugin removed again?

17:15 why not have lein-plugin just add a plugin to the ~/.lain/profiles.clj

17:16 franks: weavejester: https://github.com/franks42/clj-info - just "lein jar" will give you the error

17:16 russfrank: s/lein-plugin/lein plugin/

17:16 franks: weavejester: have a good night - thanks for the help

17:17 weavejester: franks: Hm, it works fine for me on lein2 preview10

17:18 franks: Also in Lein 1.7.1

17:18 * russfrank pokes technomancy

17:19 russfrank: hi!

17:19 franks: weavejester: ough...

17:19 weavejester: franks: I'll take a closer look tomorrow - see if I can't see anything

17:20 franks: weavejester: ok - I will see if I can reboot my environment in the mean time

17:20 technomancy: russfrank: I think the declarative approach has a lot of advantages over the imperative approach. a task that rewrites ~/.lein/profiles.clj would obliterate formatting and comments, which are valuable.

17:20 well, comments are valuable anyway

17:21 russfrank: technomancy: yeah, but a really awesomely easy plugin system is probably better

17:22 why not have the plugin def stored elsewhere so it can be rewritten, if comments are desirable in the user profile (which sounds like it may include more than plugins)

17:22 technomancy: that's a lot more complicated than a single map

17:22 russfrank: its just an include or whatever

17:23 load-file?

17:23 technomancy: conceptual simplicity is more valuable than supporting the old interface

17:24 as soon as you start inserting things behind the scenes, debugging gets a lot more complicated

17:26 russfrank: technomancy: the old interface was just so much easier, though

17:26 there's a huge difference between "paste this thing" and "find this file and edit it inthis particular way"

17:26 cemerick: I run far, far away from system I see that has a usage pattern like `x install foo`.

17:26 russfrank: cemerick: that's very weird of you

17:27 piranha: cemerick: ok, doing (require '[cljs.repl]) and (require '[cljs.repl.browser]) made it work. I feel dumb. :(

17:27 technomancy: you can't check `lein install swank-clojure` into your dotfiles repo

17:27 russfrank: technomancy: you can have it pop a thing into a dotfile though, which is how a lot of things work

17:27 cemerick: piranha: cemerick.piggieback requires cljs.repl itself; wasn't that the ns it was complaining about?

17:28 franks: weavejester: well... blowing away ~/.lein/ and letting leiningen rebuild itself seems to do the trick - no more hiccup error - not sure how to find out what went wrong...

17:28 technomancy: russfrank: sure, and that would be viable if we had a lossless reader, but we don't.

17:28 russfrank: technomancy: but really, that's not a configuration - its a program thats installed or not installed, which isn't really a function of dotfiles imo

17:28 piranha: cemerick: well, having requires before code made it work

17:28 technomancy: russfrank: that's an arbitrary distinction

17:28 russfrank: thats like saying "I can't put zsh in my dotfiles repo so I can have zsh everywhere"

17:28 technomancy: that's only true because the unix model isn't as good as the lisp model =)

17:28 russfrank: you configure things in your dotfiles -- you don't manage installed programs

17:29 weavejester: franks: It might be an error to do with some subtle ordering that works 99.9% of the time but somehow fails under rare and specific circumstances

17:29 cemerick: piranha: dammit, I misread your earlier msg; it was cljs.repl.browser that it wasn't finding, not cljs.repl. Sorry!

17:29 You can definitely stop requiring cljs.repl explicitly though.

17:29 weavejester: franks: I'm planning out Hiccup 2.0, and hope to get that out sometime this year, so perhaps a new compiling engine will fix things.

17:29 piranha: cemerick: well, cljs.repl had the same problem, but I'll check

17:29 technomancy: anyway, you can and I do, it's just a crappier experience because apt-get isn't declarative.

17:29 ordnungswidrig: naeg: could you solve the fd +1 mistery?

17:30 technomancy: https://github.com/technomancy/dotfiles/blob/master/bin/init/debs.yml

17:30 russfrank: technomancy: is it possible I could convince you to take a PR that adds this functionality but warns the user that their profiles file will be overwritten

17:31 piranha: cemerick: if I understand correctly, I can connect my browser to emacs using nrepl and piggieback and then evaluate code in the browser as I write it?

17:31 technomancy: russfrank: I'd consider an implementation based on a lossless reader. I think cgrand is working on one, but it's not quite ready yet.

17:31 russfrank: ok

17:31 technomancy: best to implement it in a plugin first though

17:32 russfrank: I feel like this is a really important issue.. I think people will very quickly be turned off of an environment/language because the tooling isn't easy enough to use

17:32 technomancy: if you do it in a plugin you can use the existing reader now and swap it out for cgrand's once it's stabilized.

17:32 franks: weavejester: may not be hiccup... may be leiningen - going back and forth between lein 1&2 and following all the beta releases sometimes makes the environment a little unpredictable - plus the fact that there seems to be some voodoo associated with a build-system - thanks and good night!

17:32 oich: hugod thanks. about ritz-nrepl: after updating and installing ritz source from git and exporting LEIN_JAVA_CMD set to java in the JDK, ritz-repl still uses java from the jre.

17:32 cemerick: russfrank: weird or not, experience with things like easy_install, pip, and so on (and then nightmares I've heard re: gems) have forever made me want to have control over the environment I'm using, with a minimum of magic.

17:33 technomancy: I haven't heard any complaints about editing profiles.clj yet, but noted.

17:33 russfrank: cemerick: I've used all of these things, and npm.. npm generally does much, much better than anything else of course, but that's mostly because of its unique dep model

17:33 naeg: ordnungswidrig: how do you mean "solve"? I reported it and dnolen said he would address this in about 3-4 weeks

17:33 hugod: oich: could you gist the full stacktrace?

17:33 russfrank: technomancy: that's because those people probably have moved on before they get a chance to complain

17:33 technomancy: heh; well that's one theory

17:34 russfrank: :]

17:34 cemerick: Everyone is fleeing Leiningen!

17:34 russfrank: you wouldn't know, would you :]

17:34 cemerick: ~survey

17:34 clojurebot: survey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/

17:34 cemerick: russfrank: ^^

17:34 ordnungswidrig: naeg: so it's a bug. I did not wait for the end of the story, yesterday.

17:34 cemerick: ~suddenly

17:34 clojurebot: CLABANGO!

17:34 cemerick: data!

17:35 russfrank: ;-) :-D

17:35 naeg: ordnungswidrig: I asked him today. yes it is a bug, but as far as i understood it, it would not make sense to hunt it down and solve it. all the FD will be re-designed

17:35 technomancy: with nrepl.el now you don't even need a third-party plugin for proper emacs integration

17:35 russfrank: reading ;P

17:35 technomancy: which is what I felt like most of my old `lein plugin install` invocations were doing in 1.x

17:36 cemerick: piranha: Yup, that's about right.

17:36 Although you're not connecting your browser to emacs, it's connecting to your Clojure/ClojureScript process.

17:36 Er, to the webapp that process is serving.

17:36 piranha: right

17:37 well, I don't have a webapp

17:37 I only have clojurescript part

17:37 cemerick: Yup. Hack away. :-)

17:37 well, you need one to use browser-repl

17:37 even if it's just a shell to set up the browser-repl channel

17:37 russfrank: cemerick: yknow, I find it interesting that clojure hasnt' seen more adoption in academia, though I suppose that requires inordinate amounts of time

17:38 ordnungswidrig: russfrank: maybe because it was not build by academia?

17:39 russfrank: was java?

17:39 ordnungswidrig: is java adopted?

17:39 scriptor: what do you consider academia here?

17:39 cemerick: I'm not sure why it would be used in an academic setting. Most schools are either actually vocational in nature (so they'll use java and maybe python), or heavily research oriented (and would probably tend towards fortran and C and scheme).

17:40 naeg: ordnungswidrig: but it seems to be OK to use +fd and just membero instead of infd

17:40 russfrank: used in classes

17:40 at my university we use mostly java in the lower courses, C in some of the higher ones, and in the few that want to touch on a variety of languages they use scheme

17:40 scriptor: even python is only seeing more recent acceptance in classes

17:41 ordnungswidrig: we have been introduces to programmung with haskell. "To give everbody equal chance". epic fail, IMHO.

17:42 aperiodic: my college did that, and i thought it worked pretty well

17:42 thorbjornDX: aperiodic: I hated swing programming in my freshman courses

17:43 oich: hugod here is a ritz-nrepl stack trace: https://gist.github.com/3702261

17:43 ordnungswidrig: aperiodic: the effect was that who did not know about programming would not get it at all. those who knew some programming managed it somehow.

17:43 next language was delphi with gui and "database" programming. (paradox file based db).

17:44 russfrank: is noir actually active at all? is there a more active web dev framework

17:47 hugod: oich: the exception message doesn't show any quoting for the -cp or -e arguments, which is strange

17:47 cemerick: russfrank: you mean the one that had a commit 5 days ago?

17:48 hugod: oich: is this oracle jdk?

17:48 cemerick: I guess that's more active than compojure, the most popular "framework", only committed to 8 days ago. ;-)

17:48 russfrank: cemerick: that was a commit noting that the repo has moved

17:48 aperiodic: ordnungswidrig: very few people in the class had programming experience, and it wasn't a barrier to learning the material

17:48 russfrank: to github/noir-clojure/noir

17:48 last updated 3 months ago

17:49 cemerick: heh, fair point

17:49 russfrank: also their main site says to use the lein 1.x plugin system

17:49 ordnungswidrig: aperiodic: nice to see that i can work, too. :)

17:49 russfrank: and we're now full circle :]

17:49 cemerick: Compojure is certainly the best default IMO.

17:51 oich: hugod yes it's the jdk from oracle from within the last few months

17:52 * ordnungswidrig thinks about what to commit _right now_ to win the recency competition

17:53 technomancy: russfrank: IIRC the plugin noir recommends is just a template, so it's not even needed to use noir in the first place

17:53 anyway, I highly recommend compojure

17:55 Frozenlock: Is there some documentation for Domina's xpath? I've checked the readme, but there's some other options used in the tests, which leaves me wondering if there's more to this xpath thingy.

17:55 gfredericks: every other day I see somebody saying "Don't use noir; use compojure."

17:55 technomancy: huh, github is case-sensitive on git clone but not in the browser.

17:57 cemerick: gfredericks: there's a bunch of magic in noir that I think people either love or hate

17:57 djanatyn: I'm having a blast trying to write minesweeper in clojure :)

17:57 I'm getting weird erros that are hard to debug, though :O

18:07 aha! fixed everything. :)

18:16 gfredericks: cemerick: I'm not usually attracted to magic; I've never tried noir

18:16 I haven't built any large web apps in clojure though

18:17 djanatyn: is there any way to make clojure errors more...informative?

18:19 S11001001: djanatyn: most people come here asking them to be less informative

18:32 cemerick: djanatyn: clj-stacktrace is the best there is

18:33 unlink: hiredman: Things work well from a JDBC perspective if you do (.setObject stmt ix value java.sql.Types/OTHER)

18:33 cemerick: gfredericks: noir builds on compojure, and makes things a lot easier insofar as you don't need to make quite so many of your own choices. Both are used widely and successfully; I think it boils down to taste.

18:34 unlink: hiredman: clojure.java.jdbc/set-parameters calls setObject() without the last parameter.

18:36 cemerick: I also have a vague impression that those that use ClojureScript significantly/successfully are more likely to use noir. I think that comes from ibdknox being a cljs early adopter.

18:37 thorbjornDX: cemerick: what's the status on lighttable btw?

18:37 the last I heard about it was at oscon

18:37 and I think project/files were added, but I never managed to get them working

18:38 cemerick: thorbjornDX: you're asking the wrong guy :-)

18:39 thorbjornDX: heh, just figured I'd throw the question out there

18:48 rattboi: is there an easy method to add to the end of a sequence?

18:48 it seems like cons and conj add to the front

18:49 cemerick: conj is polymorphic over the type of collection being operated upon

18:49 ,(conj [1 2 3] 4)

18:49 clojurebot: [1 2 3 4]

18:49 cemerick: ,(conj '(1 2 3) 4)

18:49 clojurebot: (4 1 2 3)

18:50 rattboi: right, I understand that. So you're not supposed to add to the end of a sequence?

18:50 Bronsa: you can do that

18:50 cemerick: You cannot *efficiently* append to a list or sequence.

18:50 Bronsa: but it's an expensive computation

18:50 thorbjornDX: seqs have to be traversed

18:50 cemerick: (concat '(1 2 3) [4])

18:51 &(concat '(1 2 3) [4])

18:51 lazybot: ⇒ (1 2 3 4)

18:51 rattboi: if I can do it with cons, is it cheaper to get it backwards, then (reverse s) ?

18:52 cemerick: goodness no

18:53 rattboi: If you absolutely must append cheaply, then you must use vectors.

18:53 But, it's generally a good thing to not care about the concrete type of sequential collection you're using.

18:53 rattboi: I didn't think so. I would use a vector, if that's what the problem requested. I'm doing 4clojure problems, and it wants fibonacci #s in a '() sequence.

18:54 llasram: You can also just create a lazy sequence

18:54 rattboi: I'm sure there's a clever way to do it, but I'm doing a loop/recur method that recurs passing (conj s newfib)

18:55 here, I have a solution, that isn't clever. I'll do that for now, and see what clever solutions looked like.

19:22 shinobi_one: clojure noobie here. can anyone help me with a function that reads a specific line from a file? where the lines are new line separated?

19:22 i want to use java.io BufferedReader FileReader due to being on 1.1.0

19:22 ordnungswidrig: shinobi_one: what is the problem?

19:23 shinobi_one: i'm not really sure where to start ha

19:23 ordnungswidrig: shinobi_one: what do you want to achieve?

19:24 shinobi_one: i want to be able to call this function i've named get-line that reads a file and outputs that specific line from the file

19:24 ordnungswidrig: shinobi_one: what do you mean by "specific"?

19:25 shinobi_one: for instance get-line "file.txt" 5

19:25 outputs the 5th line of text in the file

19:27 ordnungswidrig: you're on clojure 1.1.0?

19:27 shinobi_one: ha yeah

19:30 ordnungswidrig: (let [r (BufferedReader. (FileReader. "file.txt")) eof (Object.)] (nth (take-while #(not= eof %) (repreatedly #(read r false eof)))) 5))

19:30 like that.

19:39 technomancy: shinobi_one: that's a pretty old version; any reason you can't upgrade?

19:39 shinobi_one: well.. it depends on how much breaks and how time consuming it is lol

19:39 technomancy: virtually nothing will break if you upgrade to 1.2.1

19:39 shinobi_one: and 1.4?

19:40 technomancy: depends on how much you have that uses the yucky old contrib library

19:40 but there is virtually no reason to stay on 1.1.0

19:40 shinobi_one: ^ except the time consumption part

19:41 S11001001: shinobi_one: #1 problem jumping to 1.3 is contrib, #2 is dynamics, #3 is looking at your math to make sure you didn't assume bigint promotion too hard. But 1.1.0->1.2.1 is trivial

19:41 shinobi_one: i will keep that in mind thanks :)

19:44 technomancy: I'm actually kinda surprised there are still any codebases left on pre-1.2

19:44 shinobi_one: yeah it's unfortunate

19:49 ordnungswidrig: in your example how can i get it to output the text?

19:50 ordnungswidrig: it evalutes to the string read as line 5

19:51 shinobi_one: yeah i changed it to take a line number as an argument instead, but it outputs nothing when i run the script with the args

19:53 errr wait

19:53 i'm being stupid hang on

19:54 paxan: Dynamic access to static class fields question. Say I want a function that given a string like "YEAR" or "DAY_OF_MONTH", would return the value of the static field in java.util.Calendar class (e.g. (foo "YEAR") => Calendar/YEAR… I tried something like this (defn foo [field] (eval (read-string (format "Calendar/%s" field)))), but it fails with No such namespace: Calendar, even though the .clj file that defines foo also imports Calendar class. I am lacking somet

19:55 S11001001: paxan: use reflection; you'll live longer

19:56 paxan: also please note that your pidgin/adium doesn't correctly wrap IRC messages, so your messages are cut off after ≈500 chars

19:57 paxan: S11001001: thanks

19:58 S11001001: paxan: since you know the class in advance, I would suggest building a map of strings to static fields at load time (i.e. in a top-level def) so any failures happen during loading instead of ordinary execution

20:11 paxan: s11001001: Yay!(.getInt (.getField Calendar "DAY_OF_MONTH") nil)

20:14 mpan: any recommendations for ways/libraries to generate images? I'm looking to plot some points and a path between them

20:17 TimMc: I've certainly used straight-up Swing graphics before.

20:17 You might look to see if there's a good way of using Processing from Clojure.

20:18 thorbjornDX: mpan: I've seen a bit of this (and I like d3): http://keminglabs.com/c2/

20:18 mpan: the thing I'm trying to visualize is a bit arbitrary

20:18 thorbjornDX: mpan: it's cljs though

20:19 mpan: uh, like, I'm trying to show a path through a graph

20:20 so I was thinking just drawing it directly using hue to indicate path progression

20:20 would look silly, but all I need is informative

20:20 technomancy: yeah, I'd try quil

20:22 mpan: thanks guys!

20:26 with quil, how would I get everything in an output file rather than screen output? can't seem to find that in the docs even though the cheatsheet briefly mentions files

20:26 technomancy: you might need to check the processing docs for that

20:33 https://blogs.oracle.com/henrik/entry/java_6_eol_h_h

20:33 EOL on Java 6 extended to February

20:58 erider: hi all

21:05 cjfrisz: I'm not sure if I write goofy commit messages hoping that somebody or that nobody reads them

21:08 aperiodic: $mail mpan in case you haven't found it yet: https://github.com/quil/quil/wiki/save~frame

21:08 lazybot: Message saved.

21:08 clj_newb_2345: is there an tutorial on writing a forht interpreter in clojure?

21:08 it doesnt' need to be efficeint

21:08 it just needs to model the core of forth

21:09 I suspect it can be done in < 1000 LOC

21:09 technomancy: I would totally read such a tutorial

21:09 casion: http://nakkaya.com/2010/12/02/a-simple-forth-interpreter-in-clojure/

21:10 clj_newb_2345: wtf

21:10 it looks like less than 100 LOC

21:10 casion: what?

21:10 clojurebot: what is 2d6

21:11 clj_newb_2345: clojurebot: 2d6 is sampling a random integers betwen 2, 12 s..t. P(X = i) = (7-|i-7|)/36

21:11 clojurebot: In Ordnung

21:11 hiredman: I have an interpreter for a concatenative language written in shell, it's only 337 lines

21:12 2d6

21:12 clojurebot: 5

21:12 hiredman: 2d6

21:12 clojurebot: 7

21:12 casion: you can roll with clojurebot?!

21:13 this thing is infinitely useful

21:13 TimMc: (def infinitely 5)

21:14 hiredman: https://github.com/hiredman/stack/blob/master/foo.stack

21:14 llasram: clj_newb_2345: To be fair, that is only a "forth" interpreter in the sense that it's a stack-based language with superficially similar syntax. It doesn't have control structures or any of the supporting abstraction you need to implement them

21:15 OOC, who here has implemented a reasonably complete Forth/-like stack-based language?

21:15 * llasram raises his hand

21:15 llasram: I imagine it's a pretty common exercise, given how easy it is

21:16 casion: I use amforth relatively often for 'actual' work

21:16 never implemented a forth

21:17 llasram: casion: Really! Neat. I know it's still used in the embedded space, but I've never met anyone who's actually used it for real work. What do you think of it in practice?

21:18 casion: llasram: it's better than writing avr firmware in assembly

21:18 llasram: hahaha

21:18 casion: that's all I have positive to say :)

21:18 llasram: That's fair :-)

21:19 casion: I"m still waiting for the day where one can do avr development in something other than C, asm or in some circumstances forth

21:19 hiredman: http://home.pipeline.com/~hbaker1/LinearLisp.html might be easily dropped on top of forth, I think

21:19 casion: I'd even be excited to use scheme

21:20 I've messed with some scheme on arm, but I don't even remember what it was…

21:21 armpit. that's it

21:21 llasram: What a charming name

21:22 clj_newb_2345: hmm

21:22 does clojure promise that argumengs to functions are evaluated in order?

21:22 casion: clojure is really my first serious attempt at doing something in a relatively high level language

21:23 _tca: whatever you are doing it sounds evil clj_newb_2345

21:23 aperiodic: casion: alan dipert & friends were working on a lisp for arduino-compatible AVR chips, but i don't know how usable it is (https://github.com/splatspace/wombat)

21:23 clj_newb_2345: _tca : http://nakkaya.com/2010/12/02/a-simple-forth-interpreter-in-clojure/ <-- I think this assumes the args are evaluted in order

21:24 llasram: clj_newb_2345: left to right http://clojure.org/evaluation

21:24 clj_newb_2345: the way how it pops arguents off the stack

21:24 casion: aperiodic: ohhhhhh, thanks

21:24 clj_newb_2345: llarsam: thanks

21:25 aperiodic: casion: when i talked to him about it at clojure/west, he said 'garbage collection in 4k of RAM is hard'

21:25 casion: I was about to say

21:25 every lisp-ish thing I've seen for embedded requires just using boehm

21:25 which isn't exactly reasonably

21:29 clj_newb_2345: is there a way to turn a clojure string into a stream?

21:30 (I want to be able to test the interpreterwith wrings, rather than send inputs over stdin)

21:30 aperiodic: casion: i've been wondering if i can't hack together something based around either static analysis or promises from the programmer that certain parts of the program won't allocate memory (for the sorts of things i like to do, i don't think making memory usage steady-state would be too onerous), but i haven't had the bandwidth to tackle that

21:31 llasram: clj_newb_2345: java.io.StringReader

21:31 clj_newb_2345: casion: one of the things I like forth is that I think the core of it requires not gc

21:31 casion: aperiodic: well, avr-gcc already has some limitations on alloctions

21:31 even at the very base of it, you can't use new/delete or templates with c++ code

21:32 llasram: aperiodic: I've wondered similar things, although somewhat less grand. Constrain the language to make memory management somewhat manual, so the runtime can stay out of that business all together

21:32 casion: and m/c/re/alloc all are a bit 'stupid' in that sometimes they don't always return null pointers on failure

21:33 I've had a few times where I spent days debugging that nonsense :|

21:33 llasram: casion: .... wha? I don't think that's spec-compliant

21:33 casion: llasram: avr-gcc is not spec compliant.

21:33 no advertisement of such either

21:33 llasram: Well, that's okay then

21:34 aperiodic: llasram: yeah, or maybe have some way of coming up with an allocation plan ahead of time using static analysis (many of my programs don't take any inputs, and so their runtime behavior is entirely pure)

21:58 * gfredericks overflows the cljs compiler's stack

22:00 mk: what's the best way to get swt set up? (1.4, lein)

22:02 clj_newb_2345: swt as in eclipse?

22:02 mk: yes, it was made by/for the eclipse project

22:03 (I don't need to get eclipse set up, though)

22:04 many of the tutorials seem dated

22:20 Sgeo: Is the code that Noir's defpage emits side-effecting?

22:20 How does Noir know which routes to use if it isn't, since all defpages aren't under some larger macro?

22:22 gfredericks: Sgeo: it must be

22:23 as is anything called def-something, idiomatically

22:23 usually at the very least they end up deffing something :)

22:25 probably also registers it somewhere globally while it's at it

22:31 Sgeo: http://yogthos.net/blog/23-Noir+tutorial+-+part+2

22:32 The defn init-db's code is indented in a way that doesn't suggest that sql/with-connection and catch are part of the try form

22:32 Isn't that bad style?

22:47 Raynes: Sgeo: Noir's defpage mutates an atom.

22:47 Not really a good thing.

22:49 Sgeo: :(

22:50 cemerick: That's one thing I need to get out of my shoreleave-remote server-side impl (i.e. eliminate the statefulness of defremote).

22:51 Sgeo: Would it make sense to force things such as defpage and defremote to be in one macro, and the macro sees all the defpages or defremotes and makes one data structure that ... etc?

22:52 cemerick: Sgeo: I think you just described a set of compojure routes? :-)

22:52 xeqi: thats what I heard too

22:52 gfredericks: +1

22:54 Sgeo: It would be nice if there was .... hmm, a sort of .... way to have the defpage convenience of not needing one mega macro while still being stateless

22:55 cemerick: mega macro?

22:55 Sgeo: Perhaps each file can be run through one macro that processes everything in the file?

22:55 In the Noir example, it could hunt down all defpages in the file and make a structure out of them without side effecting, and leave all other code as-is

22:55 cemerick: There's no reason to define Ring handlers all in one place.

22:56 xeqi: (defroutes app group/routes todo/routes user/routes ...)

22:57 cemerick: OK, cljs time: is there anything out there that's (a) gclosure-ready and (b) even close to jquery in terms of support for transitions, animation, css, etc?

22:57 gfredericks: cemerick: I've been using straight jquery for a lot (via jayq)

22:57 xeqi: no

22:58 zakwilson: What's the state of the art for making GUIs in Clojure?

22:59 xeqi: zakwilson: seesaw or quil

22:59 cemerick: gfredericks: same here, although I know jquery well enough that I just use the interop for most of it.

22:59 Raynes: Or embed webkit like lighttable.

22:59 Hodapp: I haven't tried Lighttable yet...

22:59 xeqi: isn't that cljs?

22:59 cemerick: The protocol extensions are key, of course.

23:00 Raynes: xeqi: Yes, but how else would he render it except with webkit?

23:00 zakwilson: I have. It's promising, and the version I tried launched Chrome rather than embedding webkit.

23:00 Raynes: zakwilson: It embeds webkit on OS X. From what I've been told, it'll do the same in Windows and Linux eventually.

23:01 dnolen: cemerick: relying jQuery for animations at this point is a waste of time.

23:02 cemerick: dnolen: oh?

23:02 dnolen: cemerick: just to graceful fallbacks for crap browsers, CSS3 transitions all the way.

23:02 just do

23:02 zakwilson: I think that approach is a bit Rube Goldberg for what I have in mind, but seesaw seems appropriate.

23:02 cemerick: dnolen: noted. I've not investigated those at all.

23:03 dnolen: cemerick: jQuery animations are horrible once you have a couple of things going, CSS transitions are optimized, CSS transforms even more so.

23:03 zakwilson: Quil looks to be more for drawing and animation than general-purpose UI.

23:04 Raynes: Yeah, but it is so trendy at the moment that everyone is recommending it for everything.

23:04 aperiodic: it is not suited for making GUIs

23:04 unless you hate yourself and your users

23:04 Raynes: I'm surprised it hasn't been recommended for JSON parsing and XML emitting.

23:04 cemerick: dnolen: Yea or nay on inline svg? I loved raphael when I last used it a year ago or so.

23:05 dnolen: cemerick: just depends on the complexity of the graphics.

23:05 cemerick: SVG is crazy slow on mobile devices.

23:05 zakwilson: I have no users... maybe because I have no UI. I should probably make a UI.

23:06 ohpauleez: I'm with dnolen, favor CSS3. It's hardware optimized on mobiles

23:06 mk: what does quil use to draw? java's graphics2d?

23:07 ohpauleez: I think jQuery uses CSS3 and falls back to js, but it ends up being a mess if you're going a whole bunch of things. For simple stuff, just grab all the less files from bootstrap and hack something together

23:07 aperiodic: mk: it can use a few things, including that

23:07 ohpauleez: cemerick: What's missing from your shoreleave-remote experience?

23:07 cemerick: ohpauleez: Nothing so far. :-)

23:07 ohpauleez: ohh the statefulness

23:07 yeah, I agree. It's carry-over from the fetch

23:07 cemerick: oh, that. Yeah, going to eliminate defremote.

23:08 The middleware should take a map of name -> fn, done.

23:08 or, name -> var so as to be REPL-friendly.

23:08 ohpauleez: (shoreleave started has just adding CSRF protection on fetch, and exploded into: "Here's everything I wish I hard to make my life easier")

23:08 aperiodic: mk: also an alternative 2D drawing backend written by the processing.org team, a 3D drawing backend also from processing, or OpenGL (via JOGL)

23:08 ohpauleez: I favor name- > var personally

23:09 cemerick: yup

23:09 mk: aperiodic: oh neat. I've found that java has pretty bad buildin drawing. Slow, and the fonts aren't native.

23:09 cemerick: There'll probably be a macro version so there won't be #' littered everywhere.

23:09 mk: builtin*

23:09 ohpauleez: cemerick: Definitely dive into the pubsub stuff too. It's helped me out a lot in my apps

23:09 cemerick: ohpauleez: it's on the list

23:10 ohpauleez: FWIW, I'd be happy to put remote-ring under the shoreleave org if you want it.

23:10 aperiodic: mk: yeah, java2D is optimized for accuracy, not speed. fonts are pretty wonky no matter the backend, though, in my experience

23:10 ohpauleez: cemerick: Agreed. I plan on rolling your remote backend, refactoring things a bit and hopefully coming up with something better for everyone

23:10 cemerick: I'd love it :)

23:11 I want to adjust a few things (bring ns stuff back in somehow), but other than that, I thought it was solid. Exactly what I was gunning for

23:12 cemerick: sure, the ns stuff can sit on top of the middleware; should be cake

23:12 ohpauleez: I think if you add me to the org, I can move the repo over as-is, and twiddle away there.

23:14 ohpauleez: cemerick: Sounds awesome!

23:14 cemerick: \m/

23:36 mk: can I make an element in a list not exist using a conditional, at that position?

23:37 jkkramer: mk: example?

23:37 mk: for example, (new Foo (if ... optional-param))

23:37 amalloy: no

23:38 mk: in this case, it would either invoke the Foo() or the Foo(Param p) method

23:38 amalloy: that's not even a list; you want to modify the contents of a special form

23:39 mk: well suppose that I wanted either the list (1 2 3 4) or (1 2 4)

23:40 amalloy: why is that a special form?

23:40 it's a list at one stage, it seems

Logging service provided by n01se.net