#clojure log - Aug 29 2012

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

0:10 l1x: hey guys

0:12 i am trying to deconstruct a "matrix" (def matrix[[1 2 3][4 5 6][7 8 9]]) but not sure how could i do it i am trying to do something like (let [[[& rest][]] matrix]) an process the vector

0:14 gfredericks: what exactly do you want a binding to?

0:15 what do you want to do with the matrix?

0:15 l1x: i am trying to implement the "spiral printing" challenge

0:16 https://gist.github.com/3506753

0:17 (you have to print 1 2 3 4 5 6 7 8 9 in this case, so you need to go -> down <- up ->

0:18 gfredericks: ,(let [matrix [[1 2 3][4 5 6][7 8 9]]] (doseq [row matrix, el row] (print el)))

0:18 clojurebot: 123456789

0:19 gfredericks: if you just want to read through the elements then doseq can do that for you

0:20 n00b6502: is [ ] literal array or list

0:22 gfredericks: it's a vector, which is not quite either

0:22 but most of the time you only care that it's sequential

0:22 so it may as well be a list

0:22 n00b6502: 'dynamic array'

0:22 gfredericks: it's just easier to type as a data literal

0:22 no not a dynamic array

0:22 n00b6502: oh clojure is immutable right ?

0:22 gfredericks: yep

0:22 so not very dynamic at all

0:23 n00b6502: 'collection optimized for random acess' ?

0:23 gfredericks: yep

0:23 unlike lists with which you have to walk from the front to wherever you want to get

0:24 n00b6502: i'm just dabling with lisp at the minute; clojure looks like it could be fun

0:24 gfredericks: twenty billion people can't be wrong

0:25 n00b6502: thats the size of clojures' future userbase?

0:25 gfredericks: inevitably

0:26 n00b6502: its also got curly brace literals.. maps? or 'objects' ?

0:26 gfredericks: maps

0:26 n00b6502: heh maps in fp land. whats a map , a datastruture or a hof

0:26 l1x: gfredericks: thanks, but check the gist pls.

0:27 gfredericks: datastruture

0:27 n00b6502: what does clojure call the hof that applies a function to a sequence to produce another sequence

0:27 gfredericks: map :)

0:28 l1x: the challenge is the spiral print part

0:28 n00b6502: can you map a map

0:28 l1x: ,(let [matrix[[1 2 3] [8 9 4] [7 6 5]]] (doseq [row matrix, el row] (print el)))

0:28 clojurebot: 123894765

0:28 mk: n00b6502: yes. Do you want to map its values?

0:29 n00b6502: walking the values and getting key-value pairs i guess would be nice .. map and reduce on that

0:29 oh its not a sequence so reduce makes no sense perhaps

0:29 gfredericks: maps are seqable

0:30 ,(seq {:foo 432 :bar 23})

0:30 clojurebot: ([:foo 432] [:bar 23])

0:30 gfredericks: so when you use the map function on a map data structure it sees it as a seq of pairs

0:30 and the output is a seq as well

0:30 ,(reduce concat {:foo 384 :bar 21})

0:30 clojurebot: (:foo 384 :bar 21)

0:30 gfredericks: ^ you can reduce a map as well

0:31 n00b6502: can maps function like adhoc objects or do you still want to use classes

0:31 (i'm thinking of what goes on in python, lua etc)

0:31 gfredericks: maps are idiomatically used much more than anything OOey

0:31 they are definitely the default

0:31 mk: ,(type (first {:key "val"}))

0:31 clojurebot: clojure.lang.MapEntry

0:32 gfredericks: l1x: sorry I didn't notice the gist

0:32 l1x: np :)

0:32 n00b6502: does it have anything like tuples aswell - or would vectors do.

0:32 l1x: i have a really ugly solution

0:32 gfredericks: l1x: though it doesn't tell me much more than what you already said

0:32 mk: ,(first (first {:key "val"}))

0:32 clojurebot: :key

0:33 gfredericks: n00b6502: vectors for tuples yes

0:33 l1x: gfredericks: please note, there is a matrix and you need to print the elements following a spiral

0:33 gfredericks: oh I see

0:33 you want a general solution or specific to the 3x3?

0:34 mk: n00b6502: a MapEntry is effectively a pair, incidentally

0:34 l1x: well i have an ugly 3x3 specific one

0:35 n00b6502: perhaps the implemention can store them like structs , or maybe it needs to be able to garbage collect components

0:35 gfredericks: l1x: if I had to do it and didn't care too much about performance I'd probably print the first row, then rotate the thing and recurse

0:35 rotate the rest of the thing rather

0:35 mk: ,(conj {} [:key "val"])

0:35 clojurebot: {:key "val"}

0:36 l1x: gfredericks: what do you mean by rotating the thing?

0:37 you mean do a transform on the matrix? hmm sounds legit

0:37 gfredericks: ,(let [matrix [[1 2 3] [8 9 4] [7 6 5]]] ((fn spiral [coll] (when (seq coll) (doseq [x (first coll)] (print x)) (->> coll rest (apply map vector) (recur))))))

0:38 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval161$spiral>

0:38 gfredericks: ,(let [matrix [[1 2 3] [8 9 4] [7 6 5]]] ((fn spiral [coll] (when (seq coll) (doseq [x (first coll)] (print x)) (->> coll rest (apply map vector) (recur)))) matrix))

0:38 clojurebot: 123879465

0:38 #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$map>

0:38 gfredericks: I don't think that's what I meant to do

0:38 I'll put it in the gist when I figure it out

0:39 arohner: did I hear correctly that someone's utils library has dissoc-in?

0:40 l1x: gfredericks: brilliant idea

0:41 mk: n00b6502: not sure how you'd gc components, since they seem visible. There are a few structures that work like maps in clojure. Records, for example.

0:41 gfredericks: l1x: oh I was missing a reverse I think

0:42 now if I can just figure out why it has the map arity error...

0:43 l1x: https://gist.github.com/3506753

0:44 this is what you want to do?

0:44 gfredericks: I just commented

0:44 that one seems to work

0:45 I just tried it on an 8x7 matrix and seems to work there too

0:47 l1x: wow

0:47 really nice

0:47 what is the ->> (i havent reached that in the clojure book yet)

0:47 gfredericks: it's a macro for unnesting things

0:48 that line is equivalent to

0:48 (recur (reversee (apply map vector rows)))

0:48 Scriptor: l1x: it's the threading macro

0:48 l1x: och i see

0:48 * gfredericks avoids mentioning he could have put the ->> at the top-level

0:48 Scriptor: takes the initial value, inserts it as the last form of the 2nd argument, and so on

0:49 well, *a* threading macro to be exact, -> inserts as the 2nd form of each argument

0:50 (->> foo (a b c) (d e f)) = (d e f (a b c foo))

0:50 n00b6502: "gc components" . is the whole collection a unit of gc.. or if you have a reference to one component passed along the rest can potentially be freed

0:51 i suppose it might depend on the size

0:51 gfredericks: l1x: see next comment for an appaling use of ->>

0:52 l1x: haha evil :)

0:53 * gfredericks goes to bed

0:53 n00b6502: hey is that what i think it is... (defn lerp ( lo hi f) (->> (- hi lo)(* f)(+ lo)))

0:54 playing with lisp i just made a macro "pipe" to do tha

0:55 Scriptor: that takes the difference between hi and lo, multiplies it by f, and adds lo to it

0:55 amalloy: although you might just as well use -> there

0:55 n00b6502: lerp(lo,hi,f)=(hi-lo)*f+lo

0:57 always makes me feel just that little bit less crazy when i see another implementation of a macro i wanted

1:46 emezeske: Hey, I'm writing a blog post about my experience building a commercial website out of Clojure and ClojureScript. Is there anything in particular anyone would care to know about?

1:46 I figured I'd start with a review of the various libraries it's built on top of.

1:47 wmealing_: how you deployed it.. and upgrade it

1:48 emezeske: wmealing_: I will be sure to cover that, thanks!

1:49 wmealing_: as obvious as that sounds, people forget.. ie, intit scripts or stand alone

1:49 what toolchain was used

1:50 emezeske: Right on

1:50 LuminousMonkey: What wmealing_ said. :)

1:50 emezeske: :)

1:50 akhudek: emezeske: I'd be interested more in your experiences with the clojurescript side of things. Did you use much of google clousre? How did you deal with the lack of documentation? How did you find interop?

1:51 also, did you use advanced optimization or stick with simple?

1:51 emezeske: akhudek: Okay, thanks! It might end up as a multi-part blog entry, but that will go in there for sure.

2:02 nkkarthik: emezeske: this might be sound absurd... but will it be ok to ask for... how we can reproduce/debug a production issue... and possibly fix it on-the-fly... without restart, I mean

2:02 not that we should do it that way, of course

2:03 emezeske: nkkarthik: I'm not sure if I'll be able to fit that into this particular blog entry, but I will put that on my TO-WRITE list

2:03 nkkarthik: You are talking about things like a REPL in prod?

2:04 nkkarthik: emezeske: yeah I too felt it wouldn't fit into this... just was curious

2:06 emezeske: nkkarthik: Sure!

2:08 nkkarthik: emezeske: repl... hmm... maybe I am new and not sure... but in our case we mostly try to have proper logs... but there are issues with logs... you know the levels should be correct... but still you might not able to get the correct picture of what's happening and... locally reproducing also sometimes fails due to DB stuff

2:08 developing is surely interesting... after release, this is one pain point

2:09 emezeske: That is very true, maintaining the working app is super important

2:10 nkkarthik: we don't use clojure... I am learning in my free time...

2:10 you know these erlang guys boast about there zero downtime and continuous upgrades or fixes... I looked a little into erlang to for that :)

2:11 clojure should also be able to do that I thought

2:15 and I heard erlang can connect and debug running prod systems... will have to look into that too... maybe it's a repl

2:16 or maybe you can turn on/off *trace* for some time

2:17 l1x: ,(->> [[8 9 4] [7 6 5]] (apply map vector))

2:17 clojurebot: ([8 7] [9 6] [4 5])

2:17 * nkkarthik should stop day-dreaming and get back to work

2:17 l1x: could somebody explain this ^

2:19 nkkarthik: l1x: this is same as

2:19 ,(map vector [8 9 4] [7 6 5])

2:19 clojurebot: ([8 7] [9 6] [4 5])

2:20 nkkarthik: l1x: if you want the exact steps

2:21 l1x: nkkarthik: thanks, i forgot that map applies the function in this way to multiple parameters

2:21 but now i remember

2:21 thnka

2:21 nkkarthik: l1x: oh ok... so you got it :) cool

2:21 l1x: yeah

2:23 nkkarthik: so now i have only one question :)

2:24 if you dont mind

2:24 nkkarthik: l1x: please shoot

2:24 l1x: this is the line of code i wanted to understand (when (seq rows) (->> rows (apply map vector) reverse recur))

2:25 now why cant i just (when (blah) (map vector rows) reverse recur)?

2:27 nkkarthik: you want to expand the rows right?... apply does that

2:27 there is a difference between

2:27 ,(map vector '[[a b c] [1 2 3]])

2:27 clojurebot: ([[a b c]] [[1 2 3]])

2:27 nkkarthik: ,(map vector '[a b c] '[1 2 3])

2:27 clojurebot: ([a 1] [b 2] [c 3])

2:28 nkkarthik: just doing (map vector rows) is like the first one (map vector '[[a b c] [1 2 3]])

2:29 but (apply map vector rows) is like (map vector row1 row2 row3..) etc

2:29 did I make sense?

2:29 l1x: hmm let me re-read

2:29 och i see

2:30 sorry my question was not clear

2:30 why is it better to use the ->> macro?

2:32 nkkarthik: ah... that's just... a style thing I suppose... we could pretty well do the regular (recur (reverse (apply map vector rows)))

2:34 l1x: och man, you are awesome

2:34 now it makes sense

2:34 nkkarthik: the usual way you have to read inside-out (inner s-exp to outer)... but with -> or ->> you can read left to right

2:35 l1x: i like to inner to outer way

2:35 just like when in school i learned that parenthesis always should be read this way

2:35 kind of feels more natural to me

2:36 now i understand the entire code

2:36 <3 clojure

2:37 nkkarthik: l1x: cool... have fun :)

2:37 l1x: thanks!

2:37 this lang has the best community :)

2:38 nkkarthik: l1x: just a suggestion, don't overlook -> , it sometimes makes code more readable

2:41 like (-> camera take-shot convert-to-png save)

2:41 l1x: i see

2:41 nkkarthik: might be more readable than (save (convert-to-png (take-shot camera)))

2:41 l1x: i am fairly new to clojure so i try to understand the basics

2:42 haha after 2 weeks with clojure actually the second version makes perfect sense to me :))

2:42 nkkarthik: l1x: yeah sure... just wanned to let you know

2:43 ah nice :)

2:43 l1x: :))

2:43 i am infected with lispism for life

2:43 amalloy: nkkarthik: it's easy to go too far with ->, though. i like to use it to let me put my "verbs" in whatever order best explains what i'm doing, with the stuff i want to emphasize on the left. for example, perhaps (save (-> (take-shot camera) (convert-to-png)))

2:44 this way you don't have to go far to see that you're saving a camera shot, and convert-to-png is a detail you can ignore

2:47 magopian: always very interesting to have this kind of feedback/experience amalloy thanks

2:47 nkkarthik: amalloy: right... very true

2:48 amalloy: I was exaggerating in the process of coming up with some example quickly :)

2:50 magopian: what does "fn*" do? it seems to do the exact same as "fn", but when i print '(fn [] ()) it gives me (fn* ([] ()))

2:50 nkkarthik: convert-to-png is likely an implementation detail... but I was thinking of user actions... when they do "Take Shot" then we could have a "Save-as" window where user might select png or jpeg... and save...

2:51 magopian: *when i str

4:06 mmajchrzak: Hi. It is possible to write andoid apps in clojure ? What are the cons and pros of using clojure for that kind of jobs?

4:09 nz-: mmajchrzak: it is certainly possible to do scala apps for android, so clojure should be also possible

4:10 alcy: http://www.infoworld.com/d/application-development/clojure-inventor-hickey-now-aims-android-189105 might shed some light

4:10 mmajchrzak: I 've heard that there is problem with gc on android when app is created in clojure.

4:11 n00b6502: immutability possibly keeps more garbage around

4:11 also its possible the dalvik virtual machine is more tuned for their compilers

4:11 their java compilers

4:12 i would be interested in this sort of thinng though, i never want to touch java.

4:13 mmajchrzak: Is there any other jvm language for writing andoird apps ? I have Java on my university and i dont want to touch it anymore.

4:13 n00b6502: my guess is scala

4:13 rojepp: F# via mono?

4:14 n00b6502: f# -> mono -> dalvik ?

4:14 rojepp: mono har 'mono for android' which supposedly works well.

4:14 Can't say I've tried it though.

4:14 n00b6502: oh C#/mono is a better java supposedly

4:15 'java done right'.

4:15 rojepp: F# is way better than C#

4:17 mmajchrzak: c# is for java is something like a D for c++.

4:18 n00b6502: interesting, f# is functional but still allows object.member unlike haskell?

4:19 rojepp: Yes. often called a 'functional first' language. Immutability is default, but you always have the option to go mutable where needed for speed and interop with rest of .Net

4:19 augustl: sounds a lot like Clojure :)

4:19 n00b6502: i'm enjoying getting into lisp, but its always the lack of straightforward object.member syntax that starts to grate

4:20 i can handle writing maths prefix just fine

4:20 rojepp: It differs from Clojure in that it's statically typed, and there are no macros. :)

4:20 n00b6502: ah f# has |>

4:20 rojepp: The language is baswed on ML family of languages, most directly from OCaml.

4:21 n00b6502: gui programming vs functional ...

4:22 is it easy to dable with this under linux; i'm put off anything originated by microsoft

4:23 rojepp: Well, MonoDevelop has an F# binding that runs on MacOSX. Haven't tried it on Linux

4:23 but it should run there as well

4:24 n00b6502: i think i'leave it..i have enough potential languages to juggle between already

4:24 hmm. at a glance though it does look pretty goo

4:25 rojepp: 'It is a really nice language, terse *and* readable. Too bad it is from MS. ;-)

4:26 n00b6502: does clojure actually have object.member

4:26 augustl: what's object.member?

4:26 n00b6502: or is that too infixy

4:26 just the syntax for record acess whatever you call it

4:26 augustl: you're probably asking the people that already know F# so never mind :)

4:27 n00b6502: you can call methods on java objects with (.foo my-obj)

4:27 n00b6502: . in lisp is "slot-value" i think

4:27 augustl: and you typically access maps/record/... with (:member object)

4:27 n00b6502: (slot-value myobj foo)

4:28 mmajchrzak: I've found mono for andoird but it isnt open source

4:28 n00b6502: i was going to guess mono for android sounds like a world of pain

4:29 anything built directly around jvm sounds more sane, scala / clojure..

4:29 having said that, how do they get to dalvik

4:29 kilon: very few things are originated by microsoft , C# and .NET is not one of them

4:29 Fossi: they could use the ndk as well

4:30 so via c

4:30 n00b6502: NDK doesn't expose gui frameworks does it

4:30 ndk is mostly for opengl games c/c++

4:30 Fossi: not in a nice way

4:30 afaik you can use them

4:30 clojurebot: Gabh mo leithsc?al?

4:30 nz-: mmajchrzak: there are some notes about scala&android game development: http://scalandroid.blogspot.fi/

4:30 n00b6502: hehe they didn't like my question on android-dev... can NDK compile objective-c ...

4:30 augustl: kilon: according to wikipedia, C# originated at MS, what am I missing? :)

4:31 n00b6502: yes i thought c# really was designed by a microsoft employee - not bought

4:31 kjeldahl: If you're targeting Android, Kawa might not be a bad choice, see http://kjeldahl.net/d7/node/32

4:31 kilon: augustl: C# and .NET is not created by mircrosoft, its create mostly by one man, the same man that created Delphi for Borland

4:32 Fossi: a backend for android/dalvik was planned

4:32 n00b6502: ah then they bought it ok.

4:32 augustl: kilon: he seems to be a microsoft employee though

4:32 kilon: which in turn he was largerly influenced by smalltalk

4:32 he is

4:32 rojepp: kilon: Yes, Hejlsberg was hired by Microsoft, what is your point?

4:32 nz-: mmajchrzak: my guess is that you won't make things easier if you use clojure with android

4:33 augustl: then I would say that microsoft made C#

4:33 kilon: i am not saying that microsoft does not own it as a product

4:33 rojepp: I'm pretty sure he didn't do it himself either.

4:33 n00b6502: microsoft paid him more than anyone else would

4:33 thorwil: by that logic, no product is made by a company ...

4:33 n00b6502: founder

4:34 someimtes a product really is made by a founder of a company

4:34 kilon: you said "origin"

4:34 microsoft is good at copying stuff or hiring people working at competitive products

4:35 if microsoft as a company had .NET as an idea, even as a vague concept, then yes i would agree

4:41 n00b6502: does f# have currying

4:47 kilon: anyway, i do not come across as a troll, it just pains me when i see thing not survivning by their own , see Delphi, and when embraced by a big company they become the second comming of christ, feel like humanity is zombified and completely oblivious to quality software or software of any kind

4:47 *I dont not want to come...

4:48 rojepp: n00b6502: Yes: http://hestia.typepad.com/flatlander/2011/06/partial-function-application-in-f-part-1-the-basics.html

5:02 noidi: what's wrong with my use of `await` here? https://gist.github.com/304b72eb346cdc42898f

5:03 it seems to return before all agents are finished

5:03 I'm a complete agent newb as you can probably tell :)

5:43 alcy: hello, have a Q regarding list eval - the clojure prog book gives an example like (eval '(average [1 2 3])) - is there a significance of using the quote here ?

5:43 as otherwise also, it will return the value

5:46 ejackson: alcy: yes. as given eval will be passed the list (average [1 2 3]) which it will eval. W/o the quote eval is passed the the number 2 to eval

5:46 Raynes: alcy: Yes.

5:47 borkdude: alcy yes

5:47 ,(eval 9)

5:47 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

5:47 borkdude: => 9

5:47 Raynes: alcy: If you don't use the quote, it'll try to evaluate the code normally. It'd try to call the function average on that vector and then give the result to eval. In this case, you're passing the list itself to eval because you're preventing evaluate.

5:48 evaluation*

5:49 It isn't immediately obvious because eval returns the same thing regardless. In one case, you're passing the list itself and eval is evaluating and you get the result (a number) and without the quote you're passing the result of the function average itself to eval, and eval just gives you back that same number.

5:50 alcy: Raynes: ah, right ! many thanks for the explantion

5:50 ejackson: borkdude thanks

5:51 borkdude: alcy for saying yes? anytime

6:01 kral: namaste

6:02 john2x: is this valid? (require '[(symbol (str "foo" ".bar")) :as bar])

6:05 ro_st: no, because :symbols aren't valid namespace definitions

6:06 you're looking for http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ns-resolve

6:06 noidi: ro_st, :keywords begin with a colon

6:06 ro_st: oh

6:06 hahah

6:06 why do i keep mixing those up

6:06 my apologies

6:06 you still want ns-resolve, though

6:09 noidi: I just asked this, but just in case you guys missed it, anyone know what's wrong with my `await` call? https://gist.github.com/304b72eb346cdc42898f

6:09 the agents seem to keep going after the `await`

6:10 john2x: ah. so it will be (referring to the example in clojuredocs.org): (require '[(ns-resolve *ns* (symbol (str "foo." "bar"))) :as bar])?

6:12 noidi: john2x, ns-resolve will return you the var, no need to call require

6:13 (let [dynamically-found-var (ns-resolve ...)] (do-something-with dynamically-found-var))

6:13 john2x: ahh.. got it. thanks!

6:16 ro_st: really would be cool to have such resolution in clojurescript

6:18 noidi: argh, this agent think is driving me crazy

6:19 pisketti: Can anyone tell me where have the zip-filter library moved?

6:19 from clojure.contrib I mean

6:20 noidi: pisketti, http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

6:21 pisketti: noidi: Thanks a lot!

6:22 grahamcarlyle: hi, has anyone had success with writing a library written in clojure that has its dependencies renamespaced

6:24 so using a tool like proguard to make the clojure jar and other dependencies not conflict with a client of the jar

6:25 just wondering whether its possible/wise to do

6:31 noidi: okay, I figured my `await` problem out

6:31 RTFS helped here

6:34 `await` works by adding its own action to the agent's queue. I "loop" within agents by sending new actions to *agent* from within an action, and `await` sticks its action between my loops iteration actions.

6:34 so there are still iterations to do when `await` returns

6:36 I guess I'll just add a promise as a part of each agent's state and deliver to it when done

6:36 and instead of `await` deref all the promises

6:39 * ejackson wishes he could remember how to use enlive from one usage to next.

6:55 ro_st: -grin-

7:10 Kneferilis: hello

7:10 would you say that clojure is more powerful than scala?

7:11 ro_st: yes

7:11 that was easy!

7:11 ejackson: clojure has macros, so is by definition more able. Whether that's helpful/useful/relevent is another question.

7:11 ro_st: and it has less syntax, which makes it easier

7:12 ejackson: i think 'powerful' is context dependent

7:12 ro_st: also, its creator plays a guitar and says incredibly thoughtful thought provoking things

7:13 naeg: +1 ro_st

7:13 ro_st: ultimately, though, if it solves the problem you have, it's powerful enough

7:13 Kneferilis: but scala has introduced macros (although experimental at the time)

7:13 would that make scala now, on par with clojure?

7:13 ejackson: without homoiconicity macros are a cruel joke

7:14 naeg: I guess those macros might be like the C-macros

7:14 ejackson: they're just different - scala is statically typed and it diverges from there

7:14 naeg: basically bullshit compared to lisp macros

7:15 Kneferilis: hmm, currently I am creating a rpg video game mostly written in JavaScript with some PHP code, next I will create a simulation game in play2 + scala

7:15 what kind of game could I create in clojure?

7:16 ejackson: anything

7:16 naeg: "effort towards bringing compile-time metaprogramming to Scala. Our flavor of macros is reminiscent of Lisp macros"

7:16 I probably was too hasty

7:17 ejackson: it really doesn't matter

7:17 program in what you like

7:18 ro_st: yeah. like i said: solve the problems.

7:19 Kneferilis: yes

7:19 naeg: Clojure is still an interesting "replacement" for Java or Scala for certain tasks, due to its functional style. also, as much as I can tell scala macros are not as powerful as lisp's, but still much more powerful than those in C

7:20 clgv: a java dev question: where does ${version.number} usually come from in an ant build file?

7:20 vijaykiran: depends on how it is configured - one guess might be from build.properties

7:22 clgv: vijaykiran: ah thx. that's right. it is in there

7:22 ro_st: enjoying your web-app tuts, vijaykiran :-)

7:22 vijaykiran: :) thanks - I've been meaning to update them to 1.4

7:24 ejackson: vijaykiran: link ?

7:24 vijaykiran: ejackson: http://www.vijaykiran.com/2012/02/27/web-application-development-with-clojure-part-5/

7:25 ejackson: thanks

7:25 ro_st: vijaykiran: have you seen my cljs demo app? https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/

7:26 ejackson: very nice

7:26 vijaykiran: ro_st: looks cool - starred :)

7:27 ro_st: I'm not that comfortable with cljs stuff yet - this will certainly help!

7:27 ro_st: cool. let me know what you think.

7:27 oh that's good. you'll enjoy this then

7:32 rojepp: vijaykiran: Thanks, great resource for a total newb like me.

7:34 vijaykiran: rojepp: yw :)

7:35 ro_st: vijaykiran: i'm glad you avoided noir, not because noir is bad (it isn't), but because you get to show how all those various things compose

7:35 many people coming to clj from other web techs are undoubtedly using their home lang's Monolithic Framework ™

7:36 vijaykiran: After using a lot of "Frameworks" - I'm generally less inclined to use anything that has the word in it.

7:37 ro_st: +1

7:37 my cljs demo shows just how nicely those 3 libs compose to make an app

7:37 you could use hiccup and jayq instead of enfocus and still use remotes and pubsub

7:38 or toss the remotes and use plain-jane xhr

7:49 ejackson: yup, the mantra is "small, composable abstractions" :)

7:49 ro_st: anyone using an SSD drive here?

7:49 ejackson: i'm still figuring out how to do it right

7:50 ro_st: yes

7:50 vijaykiran: ro_st: me.

7:50 ro_st: is it really worth going for one of the more expensive types?

7:50 ejackson: ro_st: dunno, I did and am blissful

7:50 ro_st: eg, the OWC Extreme over the OWC non-Extreme

7:50 ejackson: :D

7:50 vijaykiran: I have been using the OWC one

7:51 "120GB Mercury Extreme" last year model

7:51 ro_st: i'm looking at this one http://www.bhphotovideo.com/c/product/797516-REG/OWC_Other_World_Computing_OWCSSDMX6G120_Mercury_Electra_6G_Solid.html

7:51 ejackson: samsung 830 6GBs

7:52 ro_st: my OS drive is only 70gb of data. all my media is on a secondary drive (yay hackintosh)

7:52 does it speed up JVM start times ? :-)

7:53 vijaykiran: probably not :) but maven builds are faster - with disk i/o

7:53 I use XSlimmer + Clusters that compress many folders and apps

7:53 so 120GB is fairly good amount of space for me

7:54 ro_st: nice

7:54 OSX?

7:54 vijaykiran: :) yeah

7:56 ro_st: awesome. i'm going to go for the one i pasted. may it last a long time!

7:57 ejackson: you're gonna be amazed

7:57 vijaykiran: I got the combo of SSD + exernal enclosure for the current 500GB spinning drive

7:58 ro_st: my bro just did his macbookpro

7:58 he starts the entire adobe cs6 suite up in like 15 seconds

7:58 vijaykiran: http://vimeo.com/21389323 :)

7:59 after SSD upgrade

8:01 ro_st: that's just nuts

8:22 Sgeo: Hmm

8:22 I wonder if tryclj.com can be broken by exploiting the 0-day?

8:22 Or the bots in here

8:29 rojepp: Sgeo: I have java plugin disabled and tryclj.com works, so no.

8:30 Sgeo: oh, you meant break the jvm on the server?

8:30 Sgeo: rojepp, yeah

8:33 xeqi: Sgeo: if http://www.h-online.com/security/features/The-new-Java-0day-examined-1677789.html is correct in explaining it, then yes

8:34 Sgeo: The clojail would have to be broken too though, I assume?

8:39 xeqi: hmm, yeah. I've broken clojail before, so now it blocks access to the java.security package, which is needed to make the AccessControlContext

8:39 so lazybot might be safe

8:41 Sgeo: What is this Expression thing/

8:41 hyPiRion: clojurebot is probably dangerous.

8:41 ,'broken?

8:41 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to resolve symbol: pr-str in this context, compiling:(NO_SOURCE_PATH:0)>

8:41 hyPiRion: well, somewhat at least.

8:43 Sgeo: Clojure> java.security.AccessControlContext

8:43 java.lang.SecurityException: You tripped the alarm! class java.security.AccessControlContext is bad!

8:44 I think that that's Clojail and java.security.AccessControlException: access denied (java.lang.RuntimePermission setSecurityManager) is JVM sandboxing?

8:45 xeqi: the clojail portion blocked that

8:46 Sgeo: "that" being which?

8:47 I assume that things like codepad and ideone aren't vulnerable because they use something outside the language environment's security for security purposes?

8:48 xeqi: Sgeo: https://github.com/flatland/clojail/blob/master/src/clojail/core.clj#L295 -- the "java.security.AccessControlContext" string you sent was blocked by a clojail tester, so it threw an exception before trying to run it

8:49 Sgeo: Hmm, so why the different message?

8:49 Wait, no, that was the one I thought was clojail

8:50 xeqi: ah, I missread

8:50 you're right

8:52 looking further, the 0day looks to exploit the default security for jars vs local files. lazybot, clojurebot, and tryclj all have a different java.security that restricts local files further, so they are probably safe

8:53 not that there aren't other ways...

8:54 *by jars I meant applets

8:55 jsabeaudry: Slime is being abandoned in favor of nrepl?

8:56 pjstadig: jsabeaudry: it is being deprecated, yes

8:56 uvtc: jsabeaudry: http://technomancy.us/163

8:57 Does this fragment of a stack trace ring any bells for anyone? :

8:57 Exception in thread "main" java.lang.NullPointerException

8:57 at clojure.lang.Numbers.ops(Numbers.java:942)

8:57 at clojure.lang.Numbers.add(Numbers.java:126)

8:57 fro0g: you mean swank-clojure is being deprecated

8:58 uvtc: The function seems to work fine when tested by itself in isolation...

8:58 xeqi: &(+ nil nil)

8:58 lazybot: java.lang.NullPointerException

8:58 Sgeo: NIL MUST DIE


8:58 jsabeaudry: pjstadig, uvtc: thanks for the info, I'll give it a spin I guess

8:58 uvtc: Thanks xeqi . Will explore that.

8:59 pjstadig: yeah, uvtc, you're probably sending a nil to it at some point

9:01 ejackson: uvtc: all *too* damn familiar I'm afraid :)

9:01 uvtc: Glad it rang a few bells, anyway. :)

9:02 pjstadig: ejackson: are you using migratus?

9:02 ejackson: did you get a notification about this? https://github.com/pjstadig/migratus/issues/8

9:04 ejackson: pjstadig: Yeah, sorry dude its on my todo list for today !

9:04 I'm really excited for it to work :)

9:04 pjstadig: np i wasn't sure if the notification came through to you

9:05 ejackson: sorry, I didn't want to spam up the comments with a "Awesome - I'll check it out"

9:06 pjstadig: I haven't checked but is migratus lein2 capable now ?

9:06 pjstadig: hehe

9:06 uh

9:06 ejackson: :)

9:06 pjstadig: i don't know

9:06 i haven't tried, i mostly use lein1

9:07 ejackson: not a biggie, i was just curious

9:07 pjstadig: i think there's actually an issue for that though

9:14 jsabeaudry: Is there something like clojure-toolbox.com but for lein plugins? I'd like to see what plugins exist

9:21 uvtc: xeqi pjstadig ejackson : Ah, found the problem! I was doing a `cond` checking for all possible values of some result `(< x 10)` ... `(and (> x 10) (< x 20))` ... but should've had some >='s in there. :) Thanks!

9:21 pjstadig: uvtc: glad you figured it out!

9:21 ejackson: uvtc: sneaky bug

9:23 xeqi: jsabeaudry: https://github.com/technomancy/leiningen/wiki/Plugins

9:24 jsabeaudry: xeqi, great, many thanks!

9:24 wmealing_: since i'm new to this, is there some kind of generic "service/daemon" mechanism or application update mechanism used by java/clojure ?

9:25 uvtc: wmealing_: What exactly are you looking to do?

9:25 wmealing_: i have a java app, i want to deploy to mac, lin, win.. different machines

9:26 i push an update to a server repository.. and ideally id' like to write as little code as possible

9:26 and have the clients auto-update to the version that is pushed

9:26 i'd also like some kind of daemon/process manager that will restart them if updated

9:26 uvtc: Oh. "A new version of this program is available! Upgrade now?"

9:27 wmealing_: without asking.. but yes.

9:27 i maintain all the machines, so ..

9:27 i can package it in rpm, (whatever format osx uses) and some kind of .msi installer

9:27 but that seems stupidly overkill.

9:27 considering java is supposed to be cross platform

9:27 pjstadig: wmealing_: i don't know of any off hand, seems like there might be some kind of java something somewhere

9:28 wmealing_: thats what i'm thinking.. there has to be something

9:28 pjstadig: wmealing_: have you asked the googles?

9:28 wmealing_: yeah, not much luck

9:28 pjstadig: hmm

9:28 wmealing_: i might be using the wrong terms though

9:28 pjstadig: you might be able to try someplace where java devs hang out too, a forum or something

9:29 wmealing_: i came here, because the quality of answer is usually better... :)

9:29 * wmealing_ goes to haunt some forums

9:30 wmealing_: i kind of expected this to be something that people would have used.

9:33 uvtc: wmealing_: maybe ask about it on #leiningen.

9:39 naeg: does lighttable use noir?

9:45 darklajid: pjstadig: Would it be possible to bundle your app with java webstart?

9:46 pjstadig: darklajid: i suppose so

9:46 darklajid: I assume that would solve your deployment issues

9:48 rojepp: naeg: "Light Table actually uses Noir, so it's certainly still alive. I'm not the primary one driving things day to day right now, Raynes has been helping out with that."

9:49 naeg: http://yogthos.net/blog/22 in comments

9:49 naeg: thanks, just stumpled upon his tutorial

9:49 stumbled*

9:50 I'm new to Clojure and want to create a web interface for connect 4 - what would you suggest to use? Noir?

9:51 uvtc: naeg: I find plain Ring + Compojure to be straightforward.

9:51 xeqi: naeg: thats an ok place to start, and if you decide to clojurescript the frontend you can talk between server/client with fetch

9:53 uvtc: naeg: To get started with a new Compojure project using lein 2: `lein new compojure connect4`

9:53 clgv: uvtc: thats very persuasive ;)

9:54 naeg: uvtc: reading their examples right now

9:55 I'm also unsure about how to animate that connect four field then. Would that involve ClojureScript?

9:56 cshell: Has anyone heard when Oracle is going to patch the 0 day exploit in Java?

9:58 wmealing_: when they want to

9:59 cshell: yeah, hopefully soon - I think it's a little irrational for everyone to be uninstalling java from their pcs

9:59 wmealing_: cshell: watch this space http://cve.mitre.org/cgi-bin/cvename.cgi?name=2012-4681

9:59 cshell: nice, thanks

9:59 uvtc: naeg: If you want something like a single-page client-side webapp, then my understanding is that you probably want to check out ClojureScript.

10:00 naeg: cshell: do people do so? I guess it's enough to tell your browser only to run Java on-click (and then just click those you trust or none) and don't run java apps you don't trust yourself

10:00 cshell: Yeah, that's what I'd figure - but a lot of the news media posted stories that told people the only way to completely avoid it is to uninstall it

10:00 naeg: also, afaik that bug is not in Java 1.6 and most people use this.

10:01 clgv: cshell: lol yeah. you just have to disable the browser plugin ^^

10:01 wmealing_: openjdk has a patch

10:01 naeg: uvtc: thanks, noted that stuff down. I guess I'll start with the connect four AI first and create a simple CLI for now

10:01 cshell: my java plugin has never worked in chrome, so I wasn't too worried :)

10:02 Sgeo: Does Minecraft work on OpenJDK? </offtopic>

10:02 cshell: the CERT alert says 1.7, but the same news story I saw said that it affected 1.6 too but I haven't seen anything official about that

10:02 uvtc: naeg: If you want to make your game as a regular desktop app, maybe use [Quil](https://github.com/quil/quil).

10:02 clgv: Sgeo: if it works on java , I guess so - since its the reference implementation

10:03 args *"java 7" I wanted to say

10:03 Sgeo: Hmm.

10:03 Maybe by reading about OpenJDK I will feel more comfortable learning the Java standard library and ecosystem?

10:05 naeg: uvtc: thanks, will consider that too. Actually not the guy doing interface stuff. more interested in coding the AI, but I guess it would be nicer with and some practice for me in clj

10:05 clgv: I wouldn't know why this would help you, but if it does. good ;)

10:41 dgrnbrg: I am encountering the strangest of bugs: I have a distributed application that uses leiningen to build an uberjar of its dependencies, then it ships that jar to the local disk of a bunch of remote machines, and then it starts the program on each machine. 40-70% of the time, however, the program fails to start by not finding a random class due to an "invalid LOC header (bad signature)" error caused by the inflaterinputstream used by

10:42 it fails on random classes, like "clojure.core$ffirst", "org.apache.http.HttpException", and others

10:42 and all the jars have the same (correct) md5sum...

10:42 any ideas?

10:43 llasram: Could the JAR file be not fully written at the time execution starts?

10:43 cemerick: dgrnbrg: might want to start sending a hash of the file around and checking that as part of the distribution process

10:45 jsabeaudry: How can I clear/unload a namespace (I'm working with nrepl.el)?

10:46 dgrnbrg: Let me do a hash verify on every node, and then i can see if that narrows it down at all

10:47 _zach: jsabeaudry: possible remove-ns? http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/remove-ns

10:47 jsabeaudry: I've not actually used this, but it's a place to start

10:47 clgv: dgrnbrg: do you use pallet?

10:47 dgrnbrg: clgv: nope

10:47 My flow is this:

10:48 I create the jar locally, then copy it to an NFS share in the cluster (slow link). Then, each of the processes copies from the cluster NFS share to their local disk (fast link), and sets the classpath as the local copy of the jar

10:49 if i run the exactly same process 1000x, i see around 50% of the process getting corrupted zips, i think

10:50 jsabeaudry: _zach, interesting, I'm trying to load the ns again after doing that and nrepl is stuck at "Loading /home/my/file.clj..."

10:50 dgrnbrg: also, it seems as if the time delta between copying the file to the cluster share and starting the job has an effect--immediately after the copy, it's less likely to succeed than long after

10:50 _zach: jsabeaudry: Bah, I really wish I could help you more, but I'm not really sure

10:52 jsabeaudry: How do people cleanup the :use and :require declarations? I refactored a lot of stuff and now I'm pretty sure some of my use and requires are not neeeded anymore, I was thinking of removing one and reloading the file but it seems i can remove event those that are still needed

10:53 pjstadig: jsabeaudry: manually, or you could use slamhound from technomancy

10:56 lotia: is it possible to start up noir from within an nrepl session? if so, any pointers?

10:56 jsabeaudry: pjstadig, another great plugin! thanks!

11:03 dgrnbrg: cemerick: I have checked the hashes of failing startups vs. the hash of the main application, and the jars are identical

11:04 There must be something crazy happening when I load the class to cause the bad signature error in the classloader

11:05 darklajid: dgrnbrg: And the clients that fail are random as well? Nothing locally? Or do you use one client, 1000 times?

11:05 cemerick: lotia: noir is just a library; starting it from within nREPL should be the same as starting it from any other REPL.

11:05 dgrnbrg: darklajid: the clients that fail are random

11:06 I have a cluster that I start the jobs on

11:06 The jobs copy the jar locally, print the md5sum, then start the jvm

11:06 random ones fail, even though their md5sums are fine

11:07 jsabeaudry: Can anyone else confirm this potential nrepl.el/nrepl bug? Step1: C-c C-k on a ns of your choice (It loads correctly), Step2: Go to repl and (remove-ns 'yourns), Step3: Try to load the ns again (Does not work)

11:09 wmealing_: dont you use c-c c-l ?

11:10 to reload the current namespace..

11:10 jsabeaudry: wmealing_, same thing happens

11:11 wmealing_, C-c C-k is load current buffer, C-c C-l is load file, the default being the current buffer

11:11 wmealing_: ah right

11:11 ok

11:11 Frozenlock: Any idea what is happening? Exception in thread "main" java.lang.UnsupportedOperationException: Desktop API is not supported on the current platform at org.jdesktop.swingx.hyperlink.HyperlinkAction.<init>(HyperlinkAction.java:131)

11:11 I'm not event calling the function that needs this hyperlink!

11:12 Could it be that the mere fact that it exists is throwing an error?

11:12 samflores: hey folks, is there a way I can implement existing core functions to with with other data? e.g (+ "hello" "world")

11:13 samrat: I need to be able to pass a URL as an argument to a Noir-powered API. what do I do?

11:13 pjstadig: samflores: in very few cases you can, but otherwise, no

11:13 samflores: in the case of + definitely not

11:14 wmealing_: you make baby rich cry.

11:14 samflores: :/

11:14 wmealing_: sad faces all round

11:14 pjstadig: + deals only with numbers, and in common cases actually gets inlined

11:14 clgv: samflores: hwy not be specific and use `str`?

11:14 pjstadig: so you can't even redef it for numbers

11:15 but the upside is it's fast :)

11:15 samflores: the example was only to demonstrate my intention :)

11:18 jsabeaudry: pjstadig, well, looks like slamhound does not work on lein2, what was your "manual" technique?

11:18 pjstadig: hehe

11:18 just searching through the file for uses of things in the ns form

11:18 and removing things that are not mentioned

11:19 jsabeaudry: how do you validate your changes?

11:20 clgv: jsabeaudry: you can comment all your uses and requires and see where you get erros and then include them again

11:20 jsabeaudry: or you can try to port slamhound to lein2. there is a decent chance that it might not be too much effort

11:20 pjstadig: jsabeaudry: well we have a policy never to do a bare use, so a function must specifically be mentioned in the ns form for us to use it

11:20 jsabeaudry: clgv, what is the most efficient way of recompiling the namespace

11:21 pjstadig: if it's not used in the body of the file, then it can be removed from the ns form

11:21 clgv: jsabeaudry: the key shortcut of your ide to reload the namespace

11:21 pjstadig: and using emacs it's just C-c C-k to recompile and verify

11:22 jsabeaudry: clgv, sadly, when I remove all requires (even those that are in use) the file still loads properly (as if the previous requires were "remembered" somehow

11:23 clgv: jsabeaudry: I only see that behavior if I used (use ...) on the repl manually

11:23 jsabeaudry: clgv, are you using swank, nrepl, or seomthing else?

11:23 clgv: CCW and thus nrepl

11:25 jsabeaudry: Something must be wrong on my side then, I'm using nrepl with emacs, I C-c C-k the file, everything is fine, comment out the :use directive, save the file, C-c C-k again and the ns still loads fine

11:26 john2x: I'm trying to follow the mouse.clj example in Quil (https://github.com/quil/quil/blob/master/examples/mouse.clj), but I get this error when running it: java.lang.IllegalArgumentException: No matching field found: _mouseX for class quil.applet.proxy$processing.core.PApplet$IMeta$c506c738 any Quil users here?

11:27 pjstadig: jsabeaudry: yeah you'll have to restart whatever clojure process is compilng your ns, or else it will still have the references to the things you removed

11:28 you can also use leiningen at the command line to compile a specific namespace

11:28 something like `lein compile foo.bar.baz` i think

11:28 or `lein compile :all` if you want to try everything

11:28 casion: john2x: what ver of clojure are you using?

11:28 pjstadig: not sure if the specifics changed with lein2, i'm still on lein1

11:29 casion: john2x: you need to be on 1.4, it looks like you're using 1.3

11:30 john2x: casion: how do I check the clojure version Leiningen is using?

11:31 clgv: john2x: for your project leiningen gets you the clojure version you specified in your project.clj

11:31 casion: john2x: it shoud say in your project.clj

11:32 magopian: chouser: hello ;) Did you notice that your problem http://www.4clojure.com/problem/130 uses "vector" instead of "list"? nothing bad, just fyi ;)

11:33 john2x: casion: ah yes. it was indeed 1.3.0.. thanks! how did you tell from my error message?

11:33 casion: john2x: went through back issues on github

11:34 john2x: https://github.com/quil/quil/issues?page=1&state=closed #20

11:35 john2x: casion: awesome.. thanks!

11:35 casion: np :)

11:35 abalone: i thought casion was going to say he was standing behind you

11:35 casion: lol, no I'm a hermit ;)

11:36 spend in any one of 3 large rooms with no windows, and no human contact for 14 hours a day

11:36 spend all day*

11:36 wmealing_: at least thats what you THINK

11:39 chouser: magopian: oh, yeah. I wonder how that happened...

11:39 jsabeaudry: M-4 ( in paredit will wrap the next 4 sexps, is there a fast way to wrap all sexps besides M-9 M-9 M-9 M-9 ( ?

11:41 ejackson: jsabeaudry: hold down slurpage until its done

11:41 ?

11:51 casion: M-4 ( does nothing for me :|

11:52 zerokarmaleft: is that a shortcut for C-u 4 M-(?

12:03 bruceadams: jsabeaudry: i think you can select whatever you want to wrap, then just type (

12:09 thorbjornDX: is a lazy-seq like a python generator?

12:10 nDuff: ...slightly?

12:10 thorbjornDX: okay, more different in terms of usage or implementation?

12:10 TimMc: thorbjornDX: It's like a silkworm.

12:10 antares_: Monger 1.2 is out: https://github.com/michaelklishin/monger/blob/master/ChangeLog.md, http://clojuremongodb.info

12:11 thorbjornDX: TimMc: got it, thanks :D

12:11 nDuff: ...well, there's chunking, which is something that doesn't happen in Python...

12:11 ...now, do you mean "lazy seqs" in general, or the lazy-seq function?

12:11 TimMc: You can pull a strand of silk out of it, and once it's out, it's out. You can cut off the end of the silk and throw it away if you don't want it anymore.

12:11 thorbjornDX: nDuff: the return value of the function, so the structure

12:11 casion: what a fantastic day, new contract and I finally got a pair of sandals that fit me! for the first time in my life

12:11 wooo!

12:12 nDuff: ...lazy seqs also do things generators don't, ie. caching prior values if there's a reference to the head.

12:12 thorbjornDX: TimMc: well, you can kind of do thtat with python generators, nDuff: yea, that's a pretty big difference

12:20 TimMc: casion: Are those good enough for walking around in the metal working rooms?

12:22 casion: TimMc: yep.

12:23 I ordered them specifically so I can be barefoot, but I was skeptical they'd find my size

12:24 since I have very large feet

12:24 but they fit, hurrah!

12:24 next step (pun intended) is I may as well try out a standing desk

12:24 you guys convinced me to at least give it a go

12:25 pipeline: casion: i do the sit/stand thing man

12:25 way better than standing exclusively

12:25 i pace a lot so standing helps with that

12:26 * technomancy too

12:27 zerokarmaleft: why are hammocks not part of this equation?

12:27 casion: pipeline: I walk around a lot, but I may as well try a standing workstation

12:27 technomancy: zerokarmaleft: I wasn't going to mention it because I didn't want to make you guys jealous, but I worked out of a hammock for most of yesterday afternoon.

12:28 casion: half my day is compile, go to another room to test, come back, code for an hour, repeat

12:28 with the occasional 'oh shit oh shit, cut the power' moments of running

12:28 TimMc: zerokarmaleft: My physical therapist would probably give me a very disapproving look if I tried that.

12:29 casion: and sitting/standing repeatedly is pretty difficult for me given my size and physical condition

12:29 so trying to stay standing is probably a reasonable idea

12:29 (tall + orthostatic hypotension)

12:29 zerokarmaleft: technomancy: were you typing in the hammock or just thinking?

12:30 technomancy: zerokarmaleft: I was documenting. =)

12:30 TimMc: casion: If you get a tall chair (architect's chair?) you pretty much just bring your legs up -- your torso hardly moves vertically at all.

12:30 I'd fall over if I got one of those, though -- I tend to lean backwards.

12:31 casion: TimMc: I've tried that… and I'm sitting in one now

12:31 it's a 'normal' chair for me

12:31 yet to find a taller one that'd serve me the indended purpose

12:33 zerokarmaleft: i had a college roommate that swore by his kneeling chair yet never seemed noticed that he was also constantly twisting his back to get his vertebrae aligned

12:33 casion: I have a zafu that I sit on the floor with when I know I dont have to get up for a while

12:33 that I use for morning meditation anyway

12:33 but it's rare that such a circumstance comes up

12:36 pipeline: i have an ergotron arm thing

12:36 with a keyboard tray

12:36 it goes up and down with a finger pressure

12:36 counterweighted, like window sashes

12:36 dnolen: oof, http://stackoverflow.com/questions/12176832/quicksort-in-clojure/12182450

12:37 I like Mike Anderson, but can we please upvote the fast non-macro qsort :)

12:37 casion: pipeline: that sounds interesting

12:37 dnolen: we need to stop disseminating horrible optimization advice.

12:38 casion: that is some intense code wow

12:38 I'll take the few extra ms thank you very much

12:54 naeg: How would you calculate all the possible diagonal winning combinations for a connect four board?

12:55 rows and cols are simple list comps, but seems cumbersome for diagonals

13:01 scriptor: naeg: another alternative is to keep track of the number of valid neighbors with each new piece

13:02 so, when a piece drops it adds 1 to the score of each neighbor, finds the highest value, and stores that as its score

13:02 if it's 4, there's a winner

13:03 pipeline: this is a project euler problem btw

13:04 ejackson: naeg: sounds like a good example with which to try out core.logic

13:05 naeg: scriptor: the algorithm I chose to check for a winner is to store all winning combinations in a hash (there are 69 in total), then on each turn pull out those combinations of which the new coordinate is part of

13:07 ejackson: for the whole algorithm to check for a winner or to generate the diagonal winning combinations for that hash solution?

13:07 ejackson: the whole algo

13:07 scriptor: naeg: can't you go through each combination and check if any of them have 4 of the same color?

13:07 (each relevant combination, that is)

13:08 ejackson: you have a data structure, and some rules that define what a winner looks like, should be doable in core.logic

13:08 naeg: scriptor: that's what I'm doing?

13:08 uvtc: scriptor: that's the brute-force method, I think.

13:08 (scriptor: I mean the method you just mentioned.)

13:09 naeg: scriptor: e.g. new coin at (0 0) - go through all pre-stored winning combinations which contain (0 0) and see whether there are four of that new coin in any of those combinations

13:09 S11001001: thorbjornDX: as a heavy user of clojure lazyseqs and python generators, I can attest that nDuff's difference makes the former radically more usable

13:09 naeg: the max. of possible winning combinations for a new coin is 12 - on the corners its much less

13:10 scriptor: naeg: where does the diagonal issue come in? I'm picturing each combination being just a list of positions that you can just reduce over, so maybe something like [(0 0) (1 1) (2 2) (3 3)]

13:11 uvtc: wouldn't the brute force solution be check every combination in the entire board with each new coin?

13:12 naeg: scriptor: those are the winning combinations for the rows and columns: http://bpaste.net/show/nkTgFlu8ntchnfLlRcqJ/

13:12 uvtc: scriptor: Right. Sorry, I wasn't reading closely enough. I think the brute force method is to just check the entire board after every move, and check for a winner.

13:12 naeg: 45 in total, now i need the 24 diagonal winning combinations

13:12 not as easy to express with a list comp as rows/cols

13:12 scriptor: naeg: ah, so you're asking about generating the combinations in the first place, got it

13:13 casion: naeg: are you generating combonations or winning positions?

13:13 naeg: yeah, exactly ;)

13:13 TimMc: naeg: To get all descending diagonals, take all positions but the last 3 columns and rows and make diagonals from those.

13:13 Same for ascending.

13:13 casion: if you're trying to get the winning positions, process the playing board 12 blocks of 4

13:13 TimMc: THat is, those are the starting positions for the diags.

13:14 casion: you only have 4 columns and 3 rows where a diagonal win can take place

13:14 ^ starting position for a 4x4 set

13:14 naeg: good idea TimMc - first calculate only the starting positions of the diagonals

13:14 scriptor: uvtc: yep, mine is more of a count as you go along method, you just need to go through the neighbors once for each new coin

13:16 naeg: casion: not sure, did you mean the same?

13:16 casion: naeg: I believe so

13:16 Sgeo: Can I unforce a delay somehow? As in, make it revert to being a computation to do in the future?

13:17 casion: naeg: I'm saying just start at the upper left corner and process in blocks of 4 against 2 sets of winning diagonals

13:17 naeg: I'm still curious about what I could do with core.logic as ejackson suggested. With core.logic I can do almost the same as with Prolog, right?

13:17 casion: then you only have to 'check' 12 blocks

13:18 naeg: it's worth noting that if 'you' are the second move, there's winning positions that will not occur

13:19 because the opponent will win with the prior move

13:19 naeg: casion: I guess it would not be worth fiddling them out, would it?

13:20 max. possible winning combinations are 12 and much less in most cases

13:20 casion: naeg: if you have the first move, you can force a win anyway...

13:21 so it kind of depends on your goal :)

13:21 naeg: casion: afaik not. the second player, if he's playing perfectly, can make a draw

13:21 casion: naeg: nope

13:21 first player can always force a win

13:21 naeg: are you 100% sure?

13:21 casion: if he desires

13:21 yes

13:22 naeg: I thought if both play perfect it's a draw

13:22 casion: http://homepages.cwi.nl/~tromp/c4/c4.html

13:23 writing a connect four game really only involves writing the portion that plays second player

13:23 first player is trivial

13:24 naeg: I know about victor allis thesis, but a year pasted since I looked into it the last time

13:24 I plan to implement a minimax algo

13:26 casion: minimax for a game where player one's best move is always max eval is a bit silly

13:26 and secong player's best move, is at best 0.00

13:30 naeg: casion: doesn't victor allis write about the minimax in his thesis too? (but only considering meaningful branches of the tree)

13:30 casion: I don't recall

13:30 I thought he generated a table base

13:30 naeg: I just remembered, I might confuse a few things with this one: http://www.ccs.neu.edu/home/eclip5e/classes/csu520/index.html

13:30 they use minimax with alpha beta pruning

13:31 casion: it'd be a good exercise perhaps

13:31 but not exactly 'useful'

13:32 naeg: I probably have to dig deeper again before implementing the AI, doesn't matter for now anyway. I might come back to you, if you're interested and having time

13:32 casion: sure

13:44 thorbjornDX: S11001001: that makes sense. Whenever I have wanted to use and reuse a python generator, I end up just storing it in a python list/tuple/dict, so there's another layer there

13:52 lynaghk`: ping: ohpauleez

13:53 ohpauleez: lynaghk: pong

13:54 S11001001: thorbjornDX: and that's error-prone as well

13:55 thorbjornDX: https://bazaar.launchpad.net/~scompall/+junk/autoconflate--mainline/view/head:/autoconflate/configure.py#L38 :)

13:58 naeg: is there a replacement for: (fn [loc] [(inc (loc 0)) (inc (loc 1))])

13:59 S11001001: naeg: mapv inc

13:59 naeg: didn't know about mapv, thanks

14:00 scriptor: ,(mapv inc [0 1])

14:00 amalloy: that works only if we're assuming loc is a vector of exactly two elements, right?

14:00 clojurebot: [1 2]

14:00 naeg: amalloy: yes, it is

14:00 Frozenlock: Is there way to obtain the last known focus in cljs?

14:01 abalone: ,(mapv inc [4 3 2 1)]

14:01 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

14:01 abalone: sigh

14:01 S11001001: I also learned about mapv here not too long ago; it's the circle of #clojure

14:01 abalone: you know what i mean

14:01 ,(mapv inc [4 3 2 1])

14:01 clojurebot: [5 4 3 2]

14:02 metellus: ,(map inc [4 3 2 1])

14:02 clojurebot: (5 4 3 2)

14:02 S11001001: ,(-> [1 2] reversed reversed class)

14:02 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reversed in this context, compiling:(NO_SOURCE_PATH:0)>

14:03 abalone: amalloy: may i ask, what is the concern?

14:04 S11001001: ,(-> [1 2] rseq rseq class)

14:04 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to resolve symbol: pr-str in this context, compiling:(NO_SOURCE_PATH:0)>

14:04 amalloy: huh?

14:04 abalone: "that works only if we're assuming loc is a vector of exactly two elements, right?"

14:04 metellus: the vector returned by mapv will have the same number of elements as loc

14:05 but the question only cared about the first two elements in loc

14:05 abalone: ah. right

14:05 amalloy: (mapv inc loc) is not a correct improvement of that function if: loc has five elements but it's intended to use only the first two; or loc is a map with keys 0 and 1; or loc is (fn [x] (case x 0 'foo 1 'bar))

14:05 S11001001: I guessed what naeg meant

14:09 naeg: and you were right

14:09 amalloy: yes indeed, it's a guess that's quite likely to be right. i just wanted to make sure it was clear what we were assuming

14:19 ro_st: ohpauleez: ping

14:26 ohpauleez: i'm unable to resolve shoreleave-*-0.2.2-SNAPSHOT when doing lein deps

14:36 shaungilchrist: what ever happened to incanter?

14:36 samnardoni: What's the best way to go from: [ [:a :b :c] [:d] [:e :f] ] to {:a 0 :b 0 :c 0 :d 1 :e 2 :f 2} (ie

14:37 i.e., go from vector of vectors to map of inner elements to the index of their outer element... (if that makes any sense)

14:37 `fogus: shaungilchrist: It still out there no?

14:38 shaungilchrist: yep for sure I just heard it was not being actively developed?

14:38 I wonder if thatis that just because it has reached a stable/useable state?

14:38 ro_st: netiher is 'ls' but you use that, don't you? -grin-

14:38 `fogus: If I recall a group of devs in the UK were pushing fixes and updates

14:38 shaungilchrist: ^^

14:39 samnardoni: I have: (apply hash-map (flatten (map-indexed (fn [i x] (map (fn [z] [z i]) x)) y))) gives the correct result, but doesn't seem like the best way to do it

14:39 amalloy: ~flatten

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

14:40 ro_st: *quietly refactors flatten out of his code*

14:42 naeg: How to get from [0 0] to [0 0] [1 1] [2 2] [3 3]? trying around with mapv and dotimes, but that doesn't work

14:43 chouser: ,(apply merge (map-indexed #(zipmap %2 (repeat %1)) [[:a :b :c] [:d] [:e :f]]))

14:43 clojurebot: {:e 2, :f 2, :d 1, :c 0, :b 0, ...}

14:43 shaungilchrist: samnardoni: (let [flat-keys (flatten [[:a :b] [:c :d]])] (zipmap flat-keys (repeat (count flat-keys) 0)))

14:44 amalloy: oh, i like chouser's. another approach is at https://gist.github.com/3516903

14:45 chouser: I should have used reduce

14:46 SegFaultAX|work2: I'm having trouble getting started on this in Clojure: http://www.4clojure.com/problem/84

14:46 I have a working Python version, but I can't get my head around a Clojure solution.

14:47 chouser: naeg: do you want (for [a (range 4)] [a a]) ?

14:48 amalloy: chouser: any time to look at http://dev.clojure.org/jira/browse/CLJ-865 again? trying to see if i can get this screened while relevance is still in an accepting mood

14:48 naeg: chouser: oh, nope. it's not that regular. it could be [1 0] => [1 0] [2 1] [3 2] [4 3]

14:48 ro_st: anyone using datomic in production, or working towards doing so?

14:48 amalloy: &(take 4 (iterate (partial mapv inc) [0 0]))

14:48 lazybot: ⇒ ([0 0] [1 1] [2 2] [3 3])

14:49 shaungilchrist: ro_st: working towards doing so - licensing is trickiest aspect for us

14:49 naeg: I tired with iterate too, but didn't think of partial! thanks amalloy

14:50 ro_st: shaungilchrist: for me too. i can't gauge how much scale i can actually accomplish with the free version

14:51 i very much want to use it. is everything rhickey and stu halloway talk about in their talks in Datomic as it stands now?

14:51 shaungilchrist: ro_st: for us it is determining how to include licensing cost in product cost when currently they utilize mssql which the customers usually have license for

14:52 ro_st: ah. for us it's 'merely' a matter of affording it. we plan to use heroku when we scale past our current custom-built vps. can't use datomic free on there.

14:55 seems to be little in the way of how to actually use it with clojure on the web

14:56 stuarthalloway: seancorfield: you around?

14:56 ro_st: oh, look, one of datomic's creators

14:58 stuarthalloway: is there a getting-started-with-clojure-and-datomic resource you can point me to?

14:58 stuarthalloway: ro_st: if you follow the tutorial (http://docs.datomic.com/tutorial.html), it is in Java, as you probably noticed

14:59 ro_st: yup, just been scanning through it now

14:59 stuarthalloway: but, there is a samples/seattle/getting-started.clj in the distro that covers the same stuff

15:00 and can be evaluated within a REPL launched via bin/repl in the distro

15:00 ro_st: oh, super

15:00 thanks

15:01 if i were to start with Free, is it obvious how to integrate the storage side into the rest of our stuff, i.t.o. database backup and restore? also, i'm guessing Free is not usable with Heroku, which we plan to use

15:03 stuarthalloway: ro_st: Datomic currently has command-line backup and restore: http://docs.datomic.com/backup.html

15:03 you should be able to make everything work with Heroku, so long as you can define a trusted network boundary, and have the peers and transactor inside that boundary

15:04 I think several people on the mailing list (datomic@googlegroups.com) are working with Datomic in Heroku, if you plan on going that way you may want to vet the Heroku specifics there

15:04 ro_st: where would the transactor store its data, given that H has ephemerial slug storage?

15:05 stuarthalloway: I think people have deemed that ephemeral storage, plus an hourly call to backup, as sufficient for their needs

15:05 ro_st: interesting!

15:05 hiredman: you may not be able to run the transactor in heroku, unless heroku provides it as a service or whatever

15:05 ro_st: i'll trawl the list for more. thanks

15:06 hiredman: since don't they tend to migrate processes and such?

15:06 ro_st: rich is a great salesman for datomic :-)

15:07 well, a great salesman for values.

15:08 Sgeo: Is there a convenient way to play with clojars from the REPL?

15:08 Without needing to make a project?

15:09 Something similar to quicklisp's quickload

15:09 cemerick: Sgeo: see pomegranate

15:10 Sgeo: Made by you

15:10 Is this going to happen in every language, where there are a few famous creators whose work everyone else relies on?

15:10 And they're in the IRC channel too

15:10 ro_st: 'grats on 1.0 for friend, cemerick!

15:10 Sgeo: I don't know why it makes me so uneasy

15:11 hiredman: b

15:11 clojurebot: B is C

15:11 cemerick: ro_st: no, no, no, 0.1.0 :-)

15:11 ro_st: Sgeo: on the contrary, it makes me much more at ease. i can talk to them!

15:11 aren't leading zeros silent? -grin-

15:11 casion: Sgeo: this isn't a proprietary environment

15:11 Sgeo: It makes me think Clojure's bus factor is small

15:11 casion: if someone disappears there's always someone eles

15:11 else*

15:12 `fogus: Sgeo: Not as small as 4 years ago

15:12 cemerick: what `fogus said

15:13 ro_st: for these reasons (and others), I do what I can to choose stuff built by people that are accessible; irc > ML > twitter, but random libraries thrown over the wall *does* make me uneasy.

15:14 ro_st: sure. one has to be critical of what one allows inside the walls

15:14 `fogus: (inc cemerick)

15:14 lazybot: ⇒ 9

15:14 naeg: this is how I finally managed to calculate all winning combinations of connect four: http://bpaste.net/show/91gVR4DXl2DiTs1VjmgH/

15:15 ro_st: what i like about OSS in general is that you're using code that solved somebody's problem, rather than something someone made cos they think it's pretty

15:15 naeg: would be great if someone could take a look and tell me whether that's fine (rly unsure about how i put them all together)

15:16 Sgeo: ro_st, what if my problem is that everyone else's code isn't pretty enough, so I make something because I think it's pretty?

15:17 ro_st: i'll accuse you of being a pedant -grin-

15:17 Sgeo: I should probably test my fork of the monad stuff

15:17 casion: naeg: wouldnt ([0 0] [0 1] [0 2] [0 3]) be a winning column?

15:17 ro_st: and an engineer

15:17 cemerick: "pretty" is always a big factor in any case. That's why every language has 40 different database abstractions.

15:18 Well, 4 maybe, but whatever.

15:18 naeg: casion: sure?

15:18 chouser: ro_st: not as complimentary as "a gentleman and a scholar", but "a engineer and a pedant" is probably more often accurate.

15:18 casion: naeg: that's what is generated by rows, I think it maybe mislabled?

15:18 `fogus: sounds redundant to me

15:18 casion: it confused me for a sec at least

15:18 chouser: `fogus: :-)

15:19 amalloy: naeg: (apply concat (for [x foo] (for [y bar] baz))) is (for [x foo, y bar] baz)

15:19 Sgeo: I am also annoyed that the more common monad library on Clojure does the Maybe monad wrongly

15:20 chouser: Sgeo: see also http://www.clojure.net/2012/06/03/Monad-Protocols/

15:20 samrat: how do I turn off debug mode in Noir? (to avoid the stacktraces showing up)

15:20 amalloy: casion: a common representation for coordinates in board games on a computer is [y x], where 0 0 is top-left corner. in that context what you asked about is a row

15:20 naeg: casion: nope, your coords are a winning row - it's [y x]

15:21 ro_st: chouser, `fogus :-) that's the spirit in which it was… awarded

15:21 Sgeo: chouser, I'm pretty sure that doesn't do Applicative and Functor properly either

15:21 But it does fix some of my issues with the other one

15:22 ro_st: samrat: env LEIN_NO_DEV=true or something like that

15:22 naeg: amalloy: but it's a 3-times nested for?

15:22 casion: hmm, I don't think I've ever explicitely seen [y x] for a board represetation

15:22 xeqi: samrat: change :mode you start the server with

15:22 ro_st: weavejester told me, i can't remember the right name

15:22 weavejester: ro_st: You got it right

15:23 Sgeo: But the fact that it uses protocols instead of generic methods might make it harder to _fix_ my problems with the approach

15:23 weavejester: In Lein2 profiles can be used instead of that variable

15:25 ro_st: ohpauleez: you around? shoreleave 0.2.2-SNAPSHOT has done a runner

15:25 thanks for the confirm, weavejester!

15:26 naeg: amalloy: oh, you meant that one at the diagonals - that's right, sorry

15:26 amalloy: chouser: that's pretty cool. i think his suggestion that it's easy to make hash-map a monad is a little off, though - there's no good way to implement bind; i don't think haskell has a monad instance for Data.Map

15:30 naeg: amalloy: also, the last let with a let in the bindings itself does only look weird to me as a newbie?

15:33 jsabeaudry: Why is clojuredocs.org trolling me? (Trying searching for "str" "def" "ns"...)

15:34 dakrone: jsabeaudry: type it into the search box but don't press enter and select it from the suggestions

15:34 the search is a little wonky

15:34 scriptor: jsabeaudry: it's better to use the js drop-down that clojuredocs gives you in the search box

15:34 yea, I don't understand why it doesn't sort the main results in the same way the autocomplete is sorted

15:35 jsabeaudry: ah that is how that tool works, thanks for the info

15:36 Sgeo: amalloy, the reason Haskell doesn't have a Monad instance for Data.Map is because the type of bind would need to indicate that the keys are orderable

15:38 goodieboy: is there a way to make "take", return values but using the same collection type that was passed in? For example, (take 3 [1 2 3 4 5]) returns a list. I have a function that uses take, and sometimes lists are passed in, sometimes vectors are passed in. I want the same type returned.

15:39 ro_st: interesting question

15:39 nz-: ,(into [] (take 3 [1 2 3 4 5]))

15:39 clojurebot: [1 2 3]

15:39 ro_st: nz, i think he's saying that his fn doesn't necessarily know which type it'll be

15:39 dnolen: goodieboy: no, sequence fns always return sequences.

15:40 goodieboy: exactly, i don't know what type

15:40 llasram: &((fn my-take [n coll] (into (empty coll) (take n coll))) [1 2 3 4 5])

15:40 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox65663$eval77151$my-take

15:40 goodieboy: dnolen: ok thanks

15:40 llasram: &((fn my-take [n coll] (into (empty coll) (take n coll))) 3 [1 2 3 4 5])

15:40 lazybot: ⇒ [1 2 3]

15:40 goodieboy: ahh

15:40 llasram: But, why?

15:40 ro_st: dnolen: your tweets are very diverting. my reading list grows every day!

15:40 nz-: ro_st: you could build that functionality if know how to get empty version of paramereter vector/list

15:41 ,(doc empty)

15:41 clojurebot: "([coll]); Returns an empty collection of the same category as coll, or nil"

15:41 Sgeo: ,(doc into)

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

15:41 jkkramer: except… ##((fn my-take [n coll] (into (empty coll) (take n coll))) 3 '(1 2 3 4))

15:41 lazybot: ⇒ (3 2 1)

15:41 nz-: ,(into (empty [1 2 3 4 5]) (take 3 [1 2 3 4 5]))

15:41 clojurebot: [1 2 3]

15:41 Sgeo: &(into '() [1 2 3])

15:41 lazybot: ⇒ (3 2 1)

15:41 ro_st: neeeaaat!

15:41 dnolen: ro_st: haha, I'm way behind too, I fear I will never actually catch up.

15:42 Raynes: did you ever try that Node.js CLJS fix?

15:43 ro_st: nz, sgeo: very cool

15:43 simple, but very cool!

15:43 Sgeo: amalloy, hmm, didn't think that through, I should have said set... I think?

15:43 * Sgeo is unsure if Data.Map could be monadized if not for an Ord issue, and whether or not that was even the question

15:44 amalloy: Sgeo: haskell can't have a monad instance for Map k v, because the type constructor takes two types

15:45 but i think it *also* can't have a monad instance, even for Map Int v, because there's no good way to implement: Map Int v `bind` (v -> Map Int v) :: Map Int v

15:45 Sgeo: I should think about how to implement the reverse state monad

15:46 It might be easier to ask whether join can be implemented, since that's the same question but may be easier to understand.

15:47 Joining a Map Int (Map Int v) into a Map Int v

15:48 amalloy: right, that's the same problem as bind

15:48 ordnungswidrig: dnolen: i skimmed over oz on fd today. this is great stuff. Can you elaborate how kanren is related to oz? Or is it an independent implementation of logic programming?

15:49 jsabeaudry: Ah, too bad CLJ-107 never made it

15:49 seems like most reasonable to me

15:50 Sgeo: amalloy, there's definitely a function of that type. But I have a feeling that it wouldn't obey the monadic laws with a join defined like that

15:52 dnolen_: ordnungswidrig: Mozart/OZ was initiated by Peter Van Roy and other folks - Van Roy worked on Aquarius Prolog, an experiment to see if Prolog could possibly compete w/ lower level languages like C.

15:52 kind like the Orbit Scheme of the Prolog world

15:53 Mozart/OZ tries to implement enough functionality to simulate all the paradigms - including logic programming.

15:53 ordnungswidrig: so the algorithms of how to solve the logic problem is implementet as a mozart/oz program?

15:53 dnolen_: logic programming of course presents many performance issues - one of those being search. So constraints have long been a research topic in the LP community.

15:54 abalone: is this a good way to end up with a flattened collection of results? (reduce concat (map some-fn some-list))

15:54 ordnungswidrig: that means that one you use this to optimize how core.logic searches for solutions?

15:54 dnolen_: ordnungswidrig: well Mozart/OZ has a design which makes it easy to express logic programming and a bunch of other things.

15:54 ordnungswidrig: no, Moart/OZ itself is written in C.

15:55 ordnungswidrig: but the series of events occurred w/ miniKanren.

15:55 llasram: abalone: (apply concat ...) is probably better

15:55 ivaraasen: dnolen_: one of my courses next semester is all Mozart/OZ. seems like a pretty cool language, albeit slow

15:55 dnolen_: ordnungswidrig: Oleg & Dan Friedman wanted to see if they could get something as fast as SWI in Scheme (and note that SWI is not the fastest Prolog)

15:55 Sgeo: ,(doc mapcat)

15:55 clojurebot: "([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection."

15:56 dnolen_: ordnungswidrig: they succeeded, but of course they discovered Prolog is not that great for many kinds of problems, so they started exploring CLP.

15:56 ordnungswidrig: dnolen_: ok, you got me wrong. I thought of the algorithms how fd constraint programming is _implemented_ in oz. and if this can be "mixed into" core.logic

15:56 dnolen_: ordnungswidrig: the real difference here is that miniKanren is a purely functional implementation of LP, which eliminates many difficulties of lower level implementation.

15:56 llasram: Sgeo, abalone: Oops, I only read so far as (reduce concat ...) didn't even see the rest. Agree for the specific case of (apply concat (map ...)), def just -> (mapcat ..)

15:57 Sgeo: ,(mapcat (fn [x] (vector x (+ 1 x)) [1 2 3 4 5])

15:57 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

15:57 Sgeo: ,(mapcat (fn [x] (vector x (+ 1 x)) [1 2 3 4 5]))

15:57 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$map>

15:57 Sgeo: ,(mapcat (fn [x] (vector x (+ 1 x))) [1 2 3 4 5])

15:57 clojurebot: (1 2 2 3 3 ...)

15:57 abalone: Sgeo, llasram: thanks! mapcat does seem to be exactly what i want... but why was apply concat better than reduce concat?

15:57 ordnungswidrig: dnolen_: so assuming there was an implementation like FD/CLP for OZ in clojure, this could substitute core.logic?

15:58 dnolen_: ordnungswidrig: there's no need really. Mozart/OZ implementation does a lot of work (i imagine in C). We have CLP in cKanren, but the approach is different since we're working in a functional context.

15:58 ordnungswidrig: I think you're missing what I'm saying :) we have CLP(FD) in core.logic *today*

15:58 Sgeo: Am I allowed to find it amusing that there's a core.logic discussion occurring concurrently and separately with/from a mapcat discussion?

15:58 ordnungswidrig: dnolen_: I know, but the "solver" works differently that CLP(FD) in OZ, right?

15:58 Sgeo: Because they're secretly related.

15:59 emezeske: abalone: (apply concat ...) will call concat once, wheras (reduce concat ...) will call concat a bunch of times

15:59 abalone: no secrets please. i want to know everything

15:59 dnolen_: ordnungswidrig: yes, but I'm not sure how that's relevant.

15:59 llasram: abalone: (reduce concat ...) will call 'concat' once for each item in the input sequence, vs (apply concat ...) just calling concat once with the sequence of all the arguments

15:59 dnolen_: ordnungswidrig: beyond comparing the approaches of course.

15:59 emezeske: llasram: jinx

15:59 ordnungswidrig: Sgeo: shh, you're disrupting the entanglement!

15:59 llasram: man, I type too slow emezeske :-p

15:59 emezeske: llasram: ^_^

16:00 ordnungswidrig: dnolen_: I got the impression that the concept of distributors is what make oz more powerful than core.logic (for now)

16:00 * Sgeo goes to look at the reverse state monad stuff

16:00 S11001001: abalone: moreover it will call concat a bunch of times in the wrong direction

16:00 abalone: emezeske Sgeo llasram: ah thanks! man, so much help around here, i'm afraid i'm going to forget to thank someone

16:01 S11001001: (using concat iteratively is unsafe in general)

16:01 abalone: S11001001: thanks :-P hm. ah.

16:01 dnolen_: ordnungswidrig: right. You can't customize the strategy.

16:02 Sgeo: I should totally make a newtype library

16:02 ordnungswidrig: dnolen_: I remember from like 15 years ago, that you need to manually cut in prolog. so I suppose beyond being declarative there is the need to tune the "how-to-solve" as well.

16:03 Sgeo: ...or not, that is a bit silly

16:04 WHY are things like deref working on IDeref not documented outside of the source?

16:04 dnolen_: ordnungswidrig: being able to define the strategy seems powerful but I don't yet understand all the performance implications nor the complexity for consumers of such an interface.

16:04 jimduey: Sgeo: Konrad talks about the probability monad dist-m here

16:04 http://onclojure.com/2009/04/24/a-monad-tutorial-for-clojure-programmers-part-4/

16:05 Sgeo: Oh hey jimduey

16:05 jimduey: It uses a hash-map as its container value.

16:05 dnolen_: ordnungswidrig: so it's not on the table in the near term for core.logic. unless of course someone else wants to take that on.

16:05 jimduey: hey.

16:05 ordnungswidrig: dnolen_: I have next to no knowledge of kanren, so I trust you regarding this.

16:05 Sgeo: Did you see my fork of ... I guess Konrad's monad stuff?

16:05 jimduey: nope. been buried

16:05 Sgeo: (It's just m-lift as a function that doesn't need to know how many arguments)

16:06 ordnungswidrig: there will the day that I'll read the little schemer

16:06 Sgeo: Although I haven't tested it

16:06 jimduey: ordnungswidrig: you definitely should. great read, deep code. and all the authors are going to be at Strangeloop next month. :)

16:07 Sgeo: https://github.com/Sgeo/algo.monads/blob/master/src/main/clojure/clojure/algo/monads.clj#L270

16:07 ordnungswidrig: jimduey: between strangeloop and me is a whole ocean

16:07 dnolen_: ordnungswidrig: it may in fact be simple to do, cKanren has a critical step called force-ans. distributors are all about controlling which possibilities are considered first.

16:07 Sgeo: Please tell me m-seq returns a monadic value representing a sequence, because that's what I assumed

16:07 dnolen_: force-ans does this work, but it's naive.

16:08 ivaraasen: I wish I had the money to go to CUFP this year

16:08 ordnungswidrig: dnolen_: I supposed that there must be some kind of "branch-logic" at some point. bread vs. deep, picking an element etc.

16:09 Sgeo: jimduey, anyway, it should be possible to define Functors and Applicatives separately from Monads, and I'm disappointed that the libraries I've seen don't allow for that

16:09 ordnungswidrig: . o O ( when will github fix syntax highlighting for @ in clojure code ? )

16:13 Frozenlock: I've make dynamic shortcut handling for cljs (kinda like emacs) heavily inspired by https://github.com/AndreasKostler/dyscord. However I'm able to differentiate between local and global shortcut. I would like to offer to possibility to show the key-sequences on screen in a friendly manner (not the log). Any suggestion on how I could do this?

16:15 jimduey: Sgeo: I

16:15 shaungilchrist: Frozenlock - you mean like a growl-like approach perhaps?

16:15 Frozenlock: What's growl-like?

16:15 RaaaaAAAAr? :P

16:15 shaungilchrist: where the notifications "stack" in what ever corner (usually top right)

16:16 and slowly fade out or close on click

16:16 jimduey: Sgeo: I'm not sure the answer to your question above. Will have to go check.

16:16 dnolen_: ordnungswidrig: actually I think it will be easy. Will probably try to look into after a 0.8.0 release

16:17 Frozenlock: Hmm I'm sure... I would like to show the entire keysequences (which I have stored in an atom).

16:18 shaungilchrist: http://boedesign.com/demos/gritter/ is sort of what I meant

16:18 Frozenlock: shaungilchrist: Looks great!

16:19 shaungilchrist: yeah I'd set the timeout a lot quicker than what they have on the demo so they sort of bubble up and fade quickly to not be too distracting

16:20 Frozenlock: Indeed. Or I would just discard them once the key sequence is completed.

16:21 Oh it's jquery :(

16:21 amalloy: jimduey: did you notice the remark about Map not having a good monad instance? seems like a bad idea to mention it in the blog post

16:21 shaungilchrist: it would be sort of cool to have a key sequence auto complete where it shows the other "branches" you can go from your current key combo

16:21 Frozenlock: shaungilchrist: Woah, wait I need to complete the basics before :p

16:21 shaungilchrist: frozenlock: it would not be difficult to implement from scratch using enfocus or what not

16:22 * Frozenlock google enfocus

16:23 Frozenlock: Well at this point I could just build it on top of Domina; that's what I'm already using. I'll just make a quick check for "growl" now that I know it's what I'm lookign for.

16:23 shaungilchrist: Thanks :)

16:23 jml: is there a way to see the source code for a class that gen-class makes?

16:23 shaungilchrist: *google domina*

16:23 I have not seen that

16:23 Frozenlock: https://github.com/levand/domina

16:24 jml: I'd like to understand what's going on better

16:24 amalloy: jml: it doesn't generate (java) source code at all. jvm bytecodes

16:24 you can disassemble the .class file

16:25 abalone: "no disassemble!"

16:25 Raynes: need inpuuuuuut

16:25 abalone: haha

16:25 Raynes: abalone: <3

16:26 Short Circuit fans, unite!

16:26 Form of, cute robot!

16:26 Sgeo: ...I heard "no disassemble" in a Lemon Demon song

16:27 gtrak: huh, 'not' is a function, how about that

16:27 ohpauleez: If you pinged me in the last hour or so, I missed it

16:27 Raynes: http://en.wikipedia.org/wiki/Short_Circuit for reference

16:27 abalone: is it surprising that not is a fn?

16:27 Raynes: ohpauleez: Oh thank God, we all though you had died.

16:28 ohpauleez: Raynes: haha

16:28 gtrak: a little, though not when I think about it

16:28 Raynes: $clojuredocs not

16:28 lazybot: clojure.core/if-not: http://clojuredocs.org/v/1537; clojure.core/not=: http://clojuredocs.org/v/1530; clojure.contrib.monads/m-when-not: http://clojuredocs.org/v/771; clojure.contrib.except/throw-if-not: http://clojuredocs.org/v/296; clojure.contrib.error-kit/do-not-handle: http://clojuredocs.org/v/289

16:28 Sgeo: Ah, so the Lemon Demon song makes a Short Circuit reference

16:28 Raynes: Good work finding every function except the one I asked for, lazybot

16:28 gtrak: heh, see?

16:28 even lazybot is surprised

16:28 Sgeo: I mean, it said "Have they forgotten Johnny 5", but didn't know that Johnny 5 was from a film called Short Circuit

16:29 It's Clojuredocs. Don't expect sane sorting.

16:29 jimduey: amalloy: I saw that. I think you can have a monad that uses a hash-map as its container. The bind would determine what kind of monad it would be.

16:29 jml: "Since the implementations of the methods of the generated class occur in Clojure functions, they have no access to the inherited protected fields of the superclass." ah, that's the badger.

16:29 jimduey: For instance, a probability monad could be built that way.

16:30 amalloy: jimduey: yes, but nobody should do it that way because you can only have *one* monad using a hashmap as its container

16:30 plus it wouldn't work on an array-map

16:30 Sgeo: ..Oh, "container" as in...

16:31 I think I see

16:31 What you'd do instead of using a data declaration in Haskell

16:31 jimduey: amalloy: Precisely the reason I didn't include one in.

16:32 Sgeo: I'm not familiar with the data declaration.

16:32 naeg: How can I iterate over only those items of coll which pass a certain test?

16:32 thought some would do it, but not really

16:32 Sgeo: jimduey, it's how you make a type in Haskell.

16:33 data MyType = ConOne String Int | ConTwo [String]

16:33 jkkramer: naeg: filter

16:33 Sgeo: Examples of MyTypes: ConOne "Hello" 5

16:34 ConTwo ["Hello", "Goodbye"]

16:34 naeg: jkkramer: *facepalm* oh yeah

16:34 thanks

16:34 jimduey: Sgeo: I don't think you need that in clojure

16:34 Sgeo: Yeah, you could use a map, with maybe a :con key

16:35 I think you did Maybe correctly, so for reference, here is Maybe in Haskell:

16:35 data Maybe a = Nothing | Just a

16:35 (modulo some deriving clauses)

16:45 jimduey, you know what I should do? Write a macro that takes a join function and expands into code to implement a monad

16:46 (Or maybe just takes a join function and a return function and gives a bind function.)

16:46 For some monads, it's probably easier to write join than bind

16:46 jimduey: Sgeo: possibly. that could be pretty easy with protocol monads.

16:47 amalloy: Sgeo: why would it be a macro? make it a function, right?

16:48 Sgeo: amalloy, yeah, that makes more sense

16:56 Frozenlock: Is there something in leiningen to rename a project?

16:56 bonega: Hi, could someone explain why I would do a var quote in this situation?

16:57 (defn animation [x]

16:57 (when running

16:57 (send-off *agent* #'animation))

16:57 (Thread/sleep animation-sleep-ms)

16:57 (.repaint @panel)

16:57 nil)

16:57 jeremyheiler: Frozenlock: What would you expect it to do? Change the namespaces in the clj files?

16:58 casion: bonega: https://www.refheap.com/paste is your friend

16:58 Frozenlock: jeremyheiler: Well yeah, I'm sure I would mess up something doing it by hand. :P

16:58 ChongLi: is there a clojure equivalent to haskell's zipWith

16:58 ?

16:58 amalloy: ~zip

16:58 clojurebot: zip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))

16:58 ChongLi: oh, cool

16:59 wait, that's not the same as zipWith

16:59 amalloy: yes it is

16:59 dnolen_: ,(map +[1 2 3] [3 2 1])

16:59 clojurebot: (4 4 4)

16:59 bonega: casion: thanks. Here it is https://www.refheap.com/paste/6359d295337d9ef7da4682e67

16:59 ChongLi: oh, okay

16:59 duh :)

16:59 thanks

16:59 Sgeo: Prelude zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]

17:00 amalloy: (map list a b) ~= zipWith (,) a b

17:00 Sgeo: I want to :/ at the confluencing of list with (,) but meh

17:03 casion: bonega: http://stackoverflow.com/questions/5964997/clojure-agent-question-using-send-off

17:03 jeremyheiler: Frozenlock: So really you want a "change all namespaces" tool? lol

17:06 Sgeo: :/ at that

17:06 So it's not so easy to change code at the REPL unless you're careful?

17:08 S11001001: Sgeo: s,you're careful,you write idiomatic clojure and occasionally toss in #' at your shims,

17:08 Sgeo: shims?

17:08 S11001001: the borders between whatever execution framework you're using and your actually-doing-stuff code

17:09 likewise, there are for most simple macros two macro implementing strategies

17:09 one that just pours everything into the expansion, and the other which factors as much as reasonable out to a function

17:10 the latter is easier to debug and means you have cascading reloads less often (as you're more likely to have to change just a function instead of a macro, triggering recompile of all its users)

17:11 Sgeo: Wait, "triggering recompile".... if I redefine a macro at a REPL, will its users be ... modified, or would I manually have to recompile them?

17:11 S11001001: latter

17:12 Sgeo: Ah, ok

17:12 Former would be kind of cool

17:12 S11001001: sure, but it would complicate the compiler, and serves as a good canary right now

17:12 if you are changing macros too often, time to factor parts of them into functions you can manipulate without a reload cascade

17:13 bonega: Casion: thanks, but I still don't understand

17:13 if I change the definition of animation and evaluate it I still see the changes regardless of var quote

17:16 S11001001: bonega: ah, that might be a clj1.2 vs 1.3 thing

17:16 bonega: for that particular example #' would have been needed pre-1.3

17:17 bonega: I see, how confusing :D

17:17 Sgeo: Why is so much Clojure stuff undocumented?

17:17 As in, deref doesn't explicitely mention IDeref except in the source

17:17 shaungilchrist: keeps the magic alive

17:17 technomancy: IDeref is an implementation detail

17:18 Sgeo: :/ so I shouldn't make my own IDerefs then?

17:18 dnolen_: Sgeo: because it's only ~5 years old?

17:18 Sgeo: I disagree w/ technomancy - the lack of documentation around protocols is unfortunate.

17:18 technomancy: well, I'm not saying it *should* be an implementation detail

17:19 dnolen_: Sgeo: well, on the JVM they are interfaces - elsewhere the story is a bit better.

17:19 bonega: So, var quote should mostly be used for some weird meta-data or something? Not for code-reloading in >= 1.3?

17:20 dnolen_: Sgeo: but perhaps in some sense they are subject to change on the JVM and somewhat more considered in CLJS because hindsight is 20/20

17:21 Sgeo: dnolen_, hmm, what's the situation in CLJS?

17:21 dnolen_: Sgeo: everything is built ontop of protocols.

17:21 * Sgeo still prefers multimethods

17:22 pjstadig: Sgeo: multimethods are nice, but usually overkill, and slow compared to protocols

17:22 S11001001: I agree with shaungilchrist; it's more fun the way it is

17:23 hiredman: multimethods can be much slower due to lock overhead

17:24 amalloy: hiredman: that patch got accepted for 1.5, i think, right?

17:24 technomancy: I sure hope so

17:25 hiredman: amalloy: I just glanced over the commits and didn't see it in

17:26 amalloy: yeah, i'm wrong. it's screened now, but not yet accepted or applied

17:35 djanatyn: are there any good clojure libraries for generating graphs and charts?

17:35 technomancy: djanatyn: I used incanter for http://lein-survey.herokuapp.com

17:35 but it was kind of a pain

17:36 brehaut: technomancy: time to make a quil-charts lib

17:37 lynaghk: djanatyn: depends how custom you want stuff. I wrote C2 as a set of tools for building custom statistical graphics in Clojure/ClojureScript. It's not exactly a charting library though, since there's no "make me a bar chart" function or anything like that

17:37 djanatyn: I was thinking about using quil

17:37 lynaghk: djanatyn: http://keminglabs.com/c2/

17:38 djanatyn: lynaghk: that's exactly what I wanted! thank you.

17:38 lynaghk: djanatyn: C2 is only really useful for HTML/SVG output, though, so you'll need to turn to something like phantomjs if you want to rasterize on the serverside.

17:38 thorbjornDX: djanatyn: c2 is based on d3.js if you didn't know

17:38 Sgeo: " 1.1 Earmuffed Vars are No Longer Automatically Considered Dynamic

17:38 "

17:38 thorbjornDX: djanatyn: inspired by

17:39 Sgeo: Hmm, that could break code that was written for 1.2, right?

17:39 lynaghk: djanatyn: sure thing. Drop me a line if you have any questions about it. We use it on almost all of our projects, but I have no idea what other people are doing with it (if anything).

17:39 djanatyn: hmm. I'll try both Incanter and C2

17:40 technomancy: here's what I ended up doing with incanter: https://github.com/technomancy/lein-survey/blob/master/src/lein_survey/results.clj#L51

17:40 Sgeo: Oh, it gives warnings

17:45 nDuff: Is there a way to be within a dosync's scope during the assignment portion of a let, but not in the body (where those values are being used)?

17:45 technomancy: nDuff: you could destructure a dosync

17:45 nDuff: Ahh, that works.

17:46 (not very pretty, but works)

17:47 amalloy: eh? what does destructure have to do with it? (let [x (dosync ...)] (...use x...))

17:47 technomancy: amalloy: if you need multiple values calculated in the same transaction

17:47 amalloy: sure

17:47 technomancy: I'm assuming if he didn't then he wouldn't be asking =)

17:48 amalloy: oh, i see. you're thinking he wants multiple things bound in the let, all in the same dosync

17:48 which is probably correct; i didn't get it

17:48 Sgeo: Why is every-pred called every-pred and some-fn is some-fn?

17:48 Why not every-pred and some-pred or every-fn and some-fn?

17:49 naeg: checking connect four field: http://bpaste.net/show/7xHePXFnDd1sRTqH8uQX/

17:49 what do you think? it's quite fast imo

17:50 check-board works, but the return value is strange. () when a player won and all the possible winning combinations for given coordinates if no one won

17:50 (saying that it works is quite brave from my side, didn't test it really)

17:58 Sgeo: How do I sort the problems on 4clojure by number?

18:03 hyPiRion: ,(map #(str "http://www.4clojure.com/problem/&quot; %) (range 153))

18:03 clojurebot: ("http://www.4clojure.com/problem/0" "http://www.4clojure.com/problem/1" "http://www.4clojure.com/problem/2" "http://www.4clojure.com/problem/3" "http://www.4clojure.com/problem/4" ...)

18:06 Frozenlo`: To package a cljs library, do I just need to lein uberjar as usual and send it to clojars?

18:06 amalloy: (inc hyPiRion)

18:06 lazybot: ⇒ 2

18:06 amalloy: doesn't actually work though, because not every problem id is used. some problems got submitted, had ids assigned, and were declined

18:08 hiredman: seancorfield: ping

18:10 emezeske: Frozenlock: I don't think you should be putting uberjars on clojars

18:10 Frozenlock: I don't... that's just how I always compile :)

18:10 emezeske: Frozenlock: Shouldn't a regular jar be enough?

18:11 Frozenlock: Yes, uberjar gives you both. I'm just used to always getting a uberjar for my own needs.

18:11 But other then that, that's the way to go?

18:11 emezeske: Frozenlock: But anyway to respond to your original question:

18:12 Yeah, that's the way to go. In some cases, you might want lein-cljsbuild's :jar option to help with that, but I don't know if it's always necessary

18:12 (You can always like "jar tf ..." to see if the cljs files were included as you expected)

18:13 Frozenlock: Isn't it what " :cljsbuild {:builds [{:jar true..." is for? (Really, I'm clueless here)

18:14 emezeske: Yeah, you're on the right track!

18:14 Frozenlock: Yay!

18:14 Thanks!

18:14 emezeske: I'd definitely do a "jar tf" just to make sure that the cljs files were included.

18:14 Of course there are other ways to test that...

18:15 hiredman: anyone using java.jdbc having issues with the new (post 1.3) numerics stuff?

18:17 naeg: why does this return true instead of a value for that range?

18:17 ,(some #(= (get-in [[" "], [" "], [" "]] [% 0]) " ") (range 2 -1 -1))

18:17 clojurebot: true

18:18 hiredman: I think our issues are mostly around clojure.lang.BigInt vs. java.lang.BigDecimal, with java.lang.BigDecimal (as comes out of jdbc) not being = to any bigints from clojure

18:18 naeg: read the docs on some?

18:18 ,(doc some)

18:18 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

18:19 Frozenlock: emezeske: It doesn't do the uber-cool-google-compile-thingy when wrapping in a jar?

18:19 naeg: hiredman: I thought it should return a x? like in:

18:19 ,(some #{1} [0 1 2 3])

18:19 clojurebot: 1

18:19 naeg: but that's because it's a set, right? hm...

18:19 emezeske: Frozenlock: So :jar true is for releasing, say, a clojurescript library that other clojurescript code will use (e.g. through requiring it)

18:20 Frozenlock: To do :advanced compilation, all of the clojurescript source code has to be available at compile-time

18:21 naeg: correct like that?

18:21 ,(some #(if (= (get-in [[" "], [" "], [" "]] [% 0]) " ") % nil) (range 2 -1 -1))

18:21 clojurebot: 2

18:21 Frozenlock: Ok, so it is up to those who uses the library to compile it, correct?

18:21 *use

18:21 emezeske: Yep!

18:22 Frozenlock: Excellent, thank you very much!

18:22 hiredman: naeg: you may what to consider just taking the first of a filter

18:22 emezeske: The 3rd party doesn't have to do anything special, though; if they depend on your jar, and (require ...) something from it, compilation will automatically include it

18:22 No prob

18:23 naeg: hiredman: seems better

18:24 hyPiRion: naeg:

18:24 er

18:24 nvm

18:37 Frozenlock: There: https://github.com/Frozenlock/zizanie, my first clojurescript library. I intend to add more, but at least it works :-)

18:39 I must say, I'm quite surprised by how well the `global-set-key' VS `local-set-key' works.

18:39 * Frozenlock is proud.

18:40 * emezeske high-fives Frozenlock.

18:40 jeremyheiler: (inc Frozenlock)

18:40 lazybot: ⇒ 1

18:44 Frozenlock: Now, for the notifications part, I will probably use the closure popup api. Any suggestions?

18:44 (it's for showing the pending key sequences)

18:50 nz-: Frozenlock: nice

18:51 Frozenlock: Thanks. Now I just need a working in-browser repl :)

18:51 For some reason I can't get Himera started.

18:59 naeg: is there a way to check whether take-while consumed the whole seq?

19:06 emezeske: naeg: I don't think so (at least not without like counting the seq or something)

19:06 Sgeo: "If you want to see every step of execution you can pass an optional third

19:06 argument of true to run-push."

19:06 emezeske: naeg: The implementation of take-while is super simple, though; it would be easy to make your own that told you whether it hit the end

19:06 Sgeo: Ugh, non-keyword boolean arguments are ugly

19:09 amalloy: wat. (= coll (take-while f coll))?

19:13 emezeske: amalloy: Doesn't that realize the whole seq?

19:13 goodieboy: anyone here use cheshire, the json library?

19:13 amalloy: &(= (range) (take 1 (range)))

19:13 lazybot: ⇒ false

19:13 dakrone: goodieboy: yes

19:13 technomancy: pretty much everyone

19:14 emezeske: amalloy: That makes sense.

19:14 goodieboy: good! we use it in production, but discovered today that it does not escape unicode characters, which blew up our front-end. Swapping it out with clojure.data.json fixed the problem, but I'm thinking there has to be a way to do this with cheshire?

19:14 emezeske: amalloy: I guess I was picturing a huge seq where you might not want to compare the whole thing, but that isn't actually indicated in the question

19:15 naeg: See amalloys comments above, and don't listen to me.

19:15 technomancy: goodieboy: why would you want unicode characters escaped?

19:15 UTF-8 is part of the JSON standard

19:16 ivan: not all Unicode codepoints can be sent through all transports

19:16 hiredman: technomancy: maybe he means unicode characters encoded as something other than utf8?

19:16 technomancy: hiredman: then it's no longer json

19:17 ivan: "JSON text SHALL be encoded in Unicode. The default encoding is UTF-8."

19:17 hiredman: goodieboy: you might want to check your default file encoding

19:17 webben: Indeed. http://tools.ietf.org/html/rfc4627#section-3

19:18 hiredman: goodieboy: although whatever method you are using to write data, clojure.data.json and cheshire should end up writing out to the same encoding

19:19 goodieboy: anyway, I think if you find any differences, I am inclined to call whatever cheshire does as correct

19:20 clojure.data.json has some provisions for reading hex literals, but I am pretty sure those are not part of json

19:21 Frozenlock: My google skills are proving ineffective. Is there really no notifications library for closure? :(

19:21 ivan: goodieboy wants \uxxxx

19:21 goodieboy: oops sorry, had to step away for a minute

19:22 Sgeo: What happens if I want to use a library that specifies Clojure 1.3.0 in Clojure 1.4.0?

19:23 goodieboy: ivan: yes, like this: \u2028

19:23 ivan: heh, cheshire fails to do that?

19:23 (for that codepoint)

19:23 emezeske: Sgeo: There's a good chance it will just work -- if your project specifies an explicit clojure version, that's what will be used

19:23 Sgeo: But if the library is broken by some 1.4 change, you're in trouble

19:23 goodieboy: well, it does handle that, but the unicode (real line separator) breaks our javascript, where as the \u2028 does not

19:23 Sgeo: emezeske, but if the library's project.clj specifies a different Clojure version...

19:24 nDuff: Sgeo: Yours overrides.

19:24 Sgeo: (in general; if version ranges are in use, things get more complicated)

19:25 ivan: goodieboy: I would file a bug for that

19:25 and maybe a bug for \uxxxx'ing all non-ascii

19:25 lotia: greetings all. Using lein2 and woking on a noir project in emacs. When I do a "lein repl" in a termainal within the noir project directory, it automatically loads in the correct namespaces.

19:25 how do i get that to work when I call nrepl-jack=in within emacs?

19:26 s/nrepl-jack=in/nreplc-jack-in/

19:26 goodieboy: ivan: ok thanks!

19:27 ivan: simplejson does ASCII output by default, and it does \u2028 right in either case

19:31 goodieboy: ivan: is \u2028 hex literal?

19:32 ivan: it's a six-character sequence with a hexadecimal unicode codepoint

19:34 dakrone: goodieboy: I can add that feature pretty easily if desired, please put a ticket in so I can do that

19:34 (just to remind me)

19:34 ivan: man this RFC sucks

19:34 it keeps saying "character" but people transfer non-character codepoints

19:35 goodieboy: dakrone: cool thanks! i'll see if i can get that done tonight

19:35 dakrone: goodieboy: I'll try to get it done tomorrow, if not it may have to wait a couple of weeks while I'm out of the country

19:36 goodieboy: dakrone: awesome thanks! :)

20:00 dakrone: goodieboy: added in https://github.com/dakrone/cheshire/commit/bacb3acb1dd0489cbf46f5a0596732383e3b4c66 , I will cut a release later tonight

20:08 jeremyheiler: Can someone help me understand why I am getting this stackplosion? https://www.refheap.com/paste/4723

20:10 hiredman: jeremyheiler: double check your mail.clj file to see it really matches what is in the paste

20:10 main.clj

20:10 Raynes: You don't need that vector around foo.core unless you're actually going to use :refer or :as.

20:10 I don't think that causes this particular error though.

20:11 Sgeo: Lamina pipelines remind me of monads

20:11 technomancy: it's there for loosk

20:11 looks

20:11 Raynes: For uglies.

20:11 jeremyheiler: Yeah, I had ":as core" in there, but took it out to simplify it.

20:11 technomancy: not as much as your face

20:12 jeremyheiler: hiredman, the only thing different is that all the functions I have in those files are commented with ; at the beginning of each line.

20:12 goodieboy: dakrone: THANKS, very much appreciated

20:12 Sgeo: *sigh*

20:12 I hate map.

20:12 If map were sufficiently general, Lamina shouldn't need to provide a map*

20:12 Just define map on its channels

20:12 But instead, it's defined for sequences only.

20:12 ChongLi: you should try Haskell's map

20:13 it's defined for lists

20:13 and only one list at that

20:13 hiredman: jeremyheiler: are you sure you want foo.core under :main there instead of foo.main?

20:13 Sgeo: At least there's fmap

20:13 ahkurtz: fmap however is defined on almost everything

20:13 emezeske: Sgeo: Isn't there some interface that can be implemented to make something seqable?

20:13 ChongLi: yeah, it's just silly that fmap has to exist

20:13 because map was written so long ago

20:14 jeremyheiler: hiredman, that was a typo i made in the original paste. it really is ":main foo.main"

20:14 Sgeo: emezeske, yeah, but it's not applicable to everything that it makes sense to map over

20:14 hiredman: :(

20:14 amalloy: Sgeo: the only way to get a language where everything is exactly as you want it, is to write one yourself

20:14 ChongLi: this is one of the things that drew me to clojure: the core standard library actually makes use of all the cool stuff

20:14 jeremyheiler: yeah, im going nuts over this lol

20:15 emezeske: Sgeo: What would it not be applicable to, for example?

20:15 hiredman: jeremyheiler: the :( was for asking for help then giving a mistranscribed paste

20:16 jeremyheiler: I edited it immediately after I pasted it, sorry. didn't think anybody was that quick.

20:16 Sgeo: emezeske, a continuation monadic value.

20:16 hiredman: jeremyheiler: what are you doing that results in that exception? running lein? what command?

20:17 Sgeo: At least, I don't _think_ it's applicable there

20:17 jeremyheiler: as the paste says, "lein run" (and i "lein clean" just before)

20:17 emezeske: Sgeo: Well I'm not a monad expert, but I was under the impression that was exactly what fmap was for

20:18 Sgeo: Are you really writing functions that don't know whether they'll be passed a monad or a seq?

20:18 Sgeo: emezeske, fmap is only called fmap because Haskell's map was not sufficiently general. If there was a do-over, fmap would be called map.

20:20 jkkramer: 4

20:21 hiredman: jeremyheiler: my guess is while pasting(and editing) your example you made other changes, most likely turning something like (ns foo.main require [foo.core]) in to what you have in the paste, or you left out some stuff from the paste

20:22 as the paste is right now there is nothing in foo.core so it does nothing, but maybe in the realy code you have foo.main loading foo.core or something

20:23 mayber there is (ns foo.main (:use [whatever.bleh :only x])) somewhere

20:25 (and your gist doesn't mention lein run anywhere)

20:25 jeremyheiler: hiredman: I really have commented out everything except for what is in the paste, and those are the only two files (namespaces) I have. The only thing that seems to change the outcome is removing (:require [foo.core]) from foo.main

20:25 (line 11)

20:26 hiredman: is that the complete namespace for foo.core?

20:26 complete ns form

20:26 jeremyheiler: yes

20:26 hiredman: I don't believe you

20:28 all evidence points to bad ns form

20:29 erider: which one is better to use hash-map or {}

20:29 hiredman: {}

20:30 erider: ok thanks

20:31 Frozenlock: Trying to use this in cljs: http://closure-library.googlecode.com/svn/trunk/closure/goog/demos/timers.html

20:32 (def asdf (create-delayed-function #(js/alert "ho!") 1000)) => #<[object Object]>

20:32 Nice, but then when I want to start the timer: (.start asdf) => #<TypeError: Object [object Object] has no method 'start'>

20:33 Am I not using the method like I should?

20:35 jeremyheiler: hiredman: Maybe my computer is just messed up. I kept running "clear; lein clean; lein run" over and over again, and started noticing that I would not constantly get the error (but I would get it most of the time) with out editing any files.

20:36 zaargy: hi all. i was just trying out something i found on stack overflow and i can't work out why the (.getName d) after the Files in this paste doesn't print out anything for me? http://pastebin.com/FAWSEvf9

20:37 also wouldn't it be better to have a function that constructs the list and then print it out nicely in another function?

20:38 amalloy: ,(.getName (java.io.File. "/"))

20:38 clojurebot: ""

20:39 zaargy: sure

20:39 but in the above it doesn't print out antyhing

20:39 it works elsewhere

20:39 elsewhere in the function that so was a bit confused about what the different was

20:40 amalloy: / is a directory whose name is the empty string

20:40 it successfully prints zero characters

20:41 zaargy: a ha

20:41 sorry i see your thing now

20:48 Frozenlock: Eh... I don't know why, but it works when I call the entire name: goog.async.Delay.

20:50 emezeske: Frozenlock: Are you aware of the (:require ...) restrictions in cljs?

20:50 Frozenlock: Maybe... :) I know I need to require the constructor too. --> [goog.async :as async] [goog.async.Delay :as Delay]

20:51 tomoj: I still am confused about that

20:51 emezeske: Frozenlock: Requiring the constructor like that looks very wrong to me (but I don't know what would be right)

20:52 tomoj: https://groups.google.com/d/topic/clojure/etFN-sdBS6c/discussion http://dev.clojure.org/jira/browse/CLJS-312

20:52 Frozenlock: Is there another way to make it work? iirc, if I don't require it, I can't call it even when I write goog.async.Delay.

20:52 emezeske: Frozenlock: I think for the constructor you should :import instead of :require, maybe?

20:53 tomoj: :import is not supported yet

20:53 Frozenlock: Oh. I've never used :import o_O

20:53 tomoj: [goog.async :as async :refer [Delay]] maybe?

20:54 emezeske: Frozenlock: I think you need to (:import goog.async.Delay) in your (ns ...)

20:54 tomoj: :import is not supported yet (or did they sneak it in in another patch or something?)

20:54 CLJS-312 "Support :import" is unresolved

20:54 emezeske: Oh, nevermind me then

20:54 Damn

20:54 I have no ide athen

20:54 Frozenlock: tomoj: bullseye

20:55 Now I'm wondering wall requiring the directly the constructor worked :s

20:55 Anyway, thanks!

20:56 tomoj: [goog.async :as async :refer [Delay]] doesn't work?

20:56 oh

20:56 Frozenlock: Yes it works.

20:56 tomoj: I read "bullseye" as "bullshit"

20:56 Frozenlock: lol!

20:58 jeremyheiler: Are there any known issues with clojure on java 7?

20:59 Frozenlock: jeremyheiler: Not that I can tell.

21:00 uvtc: jeremyheiler: I'm using OpenJDK 7 on GNU/Linux and it seems fine.

21:03 jeremyheiler: I've been using it for a while, too. I'm just getting a lot of weird errors in a project that worked fine on a different machine with jdk6 earlier. Now I am wondering if I've copied in some odd whitespace issues.

21:06 casion: anyone using nrepl-ritz, and if so how's it working out for you?

21:08 dnolen: emezeske: ping

21:09 emezeske: dnolen: pong

21:10 dnolen: emezeske: I thinking about moving forward with the printing patch ...

21:10 emezeske: warning can be separate ticket.

21:11 emezeske: dnolen: Arg, sorry that I haven't gotten around to that yet X_X

21:11 dnolen: emezeske: no worries, I don't feel like letting that ticket languish since what's there is good.

21:12 emezeske: dnolen: I think that's reasonable -- as long as the warning gets added before the old ways is removed, that should be fine

21:13 dnolen: emezeske: one question about the implementation ... it seems a bit strange that the printer is a function?

21:13 emezeske: hmm actually I guess not since you leverage it taking multiple args

21:14 emezeske: dnolen: A function as opposed to what?

21:14 dnolen: (I'm not at my workstation atm)

21:15 dnolen: emezeske: it's just that in Clojure it's all done via the JVM Writer inerface - but it's probably not a big deal ...

21:15 emezeske: I was hoping folks w/ review the ticket but no such luck :)

21:16 review the patch I mean.

21:16 emezeske: dnolen: Ooh, I hadn't thought of that

21:17 dnolen: Is there an equivalent interface in cljs?

21:17 Frozenlock: Ok I have this function: (create-delayed-function fn delay). `fn' need to apply the method .dispose on the result of create-delayed-function. I would like to do this without any atoms, so purely functional. Is there a way?

21:18 amalloy: a function seems most natural to me: it's a Writer because java doesn't have functions and Writer is the basic output mechanism; in js the basic output mechanism is a function (console.log)

21:18 dnolen: emezeske: writer / printer does seem more appropriate given some folks might want to redirect when working with node.js ...

21:19 emezeske: dnolen: Without the source in front of me it's hard to comment

21:20 S11001001: Frozenlock: I think you've mixed up some of your metasyntactic vars; do you mean by the latter `create-delayed-function' `delay', and by the latter `fn', `create-delayed-function's result'?

21:20 ChongLi: how would I go about mapping a Java method over a sequence?

21:20 emezeske: dnolen: I could take a look a little later tonight

21:21 dnolen: amalloy: yes, but given various other places where you might run JS I'm just wondering if there are benefits to a writer protocol?

21:21 S11001001: ChongLi: #(.getBlah x y z) is a clojure function that calls the java getBlah method on x with args y and z

21:21 jeremyheiler: ChongLi: You can use an anonymous function like &(map #(Math/pow % 2) (range 0 5))

21:21 Ah, too slow...

21:22 ChongLi: I want to map Math/log over a sequence of numbers

21:22 Frozenlock: (def abc (create-delayed-function fn delay)). The delayed function fn-> (defn fn [] (.dispose abc))

21:23 http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/trampoline?

21:23 clojurebot: http://clojure.org is timeless.

21:23 ChongLi: (map Math/log (seq 1 2 3 4))

21:23 unable to find static field: log

21:23 sorry, I'm not a Java programmer

21:23 S11001001: ChongLi: see lines from jeremyheiler and myself

21:24 tmciver: ,(map #(Math/log %) (seq 1 2 3 4))

21:24 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core$seq>

21:24 jeremyheiler: ,(map #(Math/log %) [1 2 3 4])

21:24 clojurebot: (0.0 0.6931471805599453 1.0986122886681098 1.3862943611198906)

21:24 S11001001: aww tmciver

21:24 ChongLi: ahhh thanks

21:24 tmciver: :(

21:25 S11001001: jeremyheiler: well if you're just going to give away the answer :)

21:25 jeremyheiler: I basically did earlier, just with Math/pow lol

21:33 dnolen: emezeske: added some comments to the ticket, worth pondering a little bit more I think. That said I think we're close.

21:37 emezeske: dnolen: Cool, I'll try to take a look later tonight.

21:38 pandeiro: emezeske: any horizon for your fetch-esque code to go public?

21:38 emezeske: pandeiro: Hooo... No, I don't know when I'll have a chance to work on that.

21:38 pandeiro: i am still trying to figure out the sanest skeleton for writing async-heavy, clojure/cljs apps

21:39 emezeske: pandeiro: Maybe I can find some way to work that into the blog series I'm doing about my experiences developing my seating charts app

21:39 pandeiro: emezeske: that would be really cool

21:40 * emezeske ducks out for dinner.

21:43 Frozenlock: Scew that, I'll use an atom.

22:05 xeqi: $findfn [1 2] [1 2 3] true

22:05 lazybot: [clojure.set/subset? clojure.core/not= clojure.core/distinct?]

22:06 amalloy: xeqi: are you looking for https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L242 ?

22:07 xeqi: yep

22:07 thanks amalloy

22:11 amalloy: that impl probably isn't as lazy as it should be, though. i really need to break the (if-let [[x & xs] (seq coll)]) habit

22:11 xeqi: that one might be more memory efficent then (fn [l1 l2] (= (take (count l1) l2) l1)) ?

22:11 ah, its lazier

22:12 amalloy: xeqi: the simplest impl is (every? true? (map = xs ys))

22:12 xeqi: haha

22:12 amalloy: but then you get back true if either one is shorter, which might be what you want, or not

22:13 ChongLi: https://www.refheap.com/paste/4726

22:13 anyone have some advice on making this more idiomatic?

22:14 besides the indentation, which I can't get right on this site

22:15 amalloy: that looks fine to me. you could use iterate to generate an infinite seq of guesses, and drop-while it's not good-enough? but i doubt that comes out looking better

22:17 ChongLi: hmmm

22:18 I guess I just need to get better at reading S expressions

22:18 so my eyes don't get crossed from the parens :)

22:19 amalloy: ChongLi: if the guess function is bothering you, you can use -> to nest the math less

22:20 ChongLi: not sure how to do that

22:21 amalloy: (->> (inc (* k 2)) (/ (Math/pow -1 k)) (* 4) (+ o)) would be one way

22:22 or perhaps (-> (Math/pow -1 k) (/ (inc (* k 2))) (* 4) (+ o))

22:25 ChongLi: yeah that looks nicer

22:27 it looks really nice when you put each function on its own line

23:30 axle_512: sorry in advance for the newb question… what is the relationship between clojure.core and other "core" libraries? (e.g. core.match, core.logic, core.cache)

23:30 ChongLi: I'd like to know this one as well, I'm a newb too :)

23:31 jeremyheiler: The other libraries are just not included in the clojure.jar

23:31 cshell: They're just additional libraries of clojure functions

23:31 so you use only what you need

23:32 axle_512: any reason why they are labelled as "core"? Does anyone create a library with core.x or are these libraries affiliated with the clojure.core team?

23:32 arohner_: is there any circumstance where count will return nil?

23:32 ChongLi: alright so who's ready for some more category theory?

23:32 hahaha

23:32 I love Rich

23:33 amalloy: arohner: no, it's not possible

23:33 arohner: axle_512: many of the contrib libraries labeled 'core' are looking to become part of the official release

23:34 axle_512: arohner: thanks!

23:34 cshell, jeremyheiler: thanks!

23:34 amalloy: really? i don't think that's true except in the quite long term

23:53 XPherior: Does does calling has-a-different result in Clojure complaining that java.lang.Class doesn't implement Differentiate? (type (attribute description)) can resolve to Integer or Long or String and it still dispatches to Class.

23:53 Meant there to be a "Why" at the beginning of that. Sorry.

Logging service provided by n01se.net