#clojure log - Mar 09 2014

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

0:17 sritchie: dsrx: still around?

0:17 dsrx: sritchie: yeah

0:17 sritchie: dsrx: provided is a compile time dependency. it's there for building your project etc, but it doesn't get included if someone else depends on your published har

0:17 jar*

0:17 or if you build an uberjar

0:18 dsrx: Cascalog does this with Hadoop, for example. That way when you build a Cascalog project, you can (and have to) include your own version of Hadoop without clashing with Cascalog's compile-time version

0:18 dsrx: ahh, I see

0:18 sritchie: dsrx: you see it with logging libraries too

0:18 slf4j, etc, where you want to include your own backend, but not force it on the user

0:18 dsrx: so if my project were to depend on cascalog but not on hadoop, leiningen would complain?

0:19 sritchie: dsrx: yeah, you wouldn't be able to run queries

0:19 well, locally

0:19 dsrx: well I could see there being a runtime exception about a class not being on the classpath

0:19 sritchie: dsrx: yeah, you're right, you'd see failures from the imports, I think

0:19 when you tried to run the repl and JIT compile the cascalog namespaces

0:20 logic_prog: if I'm making a product for college students, should I charge $9.99 / month or $29.99 / month?

0:20 $29.99 seems so much more expensive than $9.99 though it's only 3 times

0:20 dsrx: that depends on what the product is of course

0:21 logic_prog: it should increase their study efficiency by 25%

0:21 muhoo: have any studies showing that result? :-)

0:21 segmond: I'm looking for a pair programming partner, I'll host the session.

0:21 logic_prog: no

0:21 dsrx: sritchie: thanks for the help!

0:21 sritchie: for sure, good luck! The dependency thing is some serious JVM madness

0:21 dsrx: logic_prog: fwiw the only recurring monthly service i paid for (besides utilities) in college was netflix @ 8.99/mo or so

0:21 my budget couldn't accomodate anything else

0:21 sritchie: logic_prog: yeah, easier to pitch it lumped in w/ textbook purchase, etc

0:22 as a one time semester purchase

0:22 isaacbw: anyone have some GSoC ideas aside from what's in the ideas page?

0:22 muhoo: wth does #= do?

0:22 oh, nm, some super-secret deprecated reader macro

0:22 read-eval

0:23 dissipate: ruzu, is there one for python?

0:25 logic_prog: oh shit

0:25 I'm in #clojure, and not #startups

0:25 muhoo: context https://github.com/alandipert/enduro/blob/master/src/alandipert/enduro/pgsql.clj#28

0:26 logic_prog: haha, didn't know there was a #startups. must check it out some time

0:26 dissipate: logic_prog, i thought they were the same channel. :P

0:26 muhoo, if someone announces in there that they went public, do they get kicked out?

0:27 isaacbw, i have one. are you interested?

0:28 isaacbw: dissipate: yes!

0:28 muhoo: huh, first time i've seen a defn inside of a let

1:01 arrdem: anyone tried using org-babel to write a large(ish) clojure project?

1:02 I'm just staring at four files with > 50 line comments each and thinking that I'm using the wrong major mode :P

1:06 sritchie: arrdem: I've done it for a large scala project, when I was still at twitter

1:06 arrdem: I think in Clojure the repl / namespacing story would confuse me

1:08 arrdem: sritchie: basically what I'm thinking is that I have a src/ structure with a *.org for each *.clj, but I haven't tried this yet.

1:29 mildfate1: If I only need to test one condition, should I use "when" instead of "cond"

1:29 bob2: seems simpler

1:30 arrdem: mildfate1: if you only have one clause, yes

1:30 mildfate1: (if (condition) (case-code)) is also discuraged

1:31 mildfate1: (cond (condition) (case-const) (case-expr)) would be very frowned on

1:31 mildfate1: ok

1:32 arrdem: note that we have both (when) and (when-not) to help with exactly this.

1:32 technically they both come down to (if) but that's not the point. readability is the point.

1:32 mildfate1: arrdem: I'm using when inside of a list comprehension but it collects nils if when evaluates as false. Is there a way to stop from adding nils so I don't have to remove them later?

1:33 bob2: perhaps you wanted filter insted?

1:34 arrdem: mildfate1: bob2 hit this one in the nose. either you need to just deal with filtering later, or you should use a different comprehension structure that doesn't emit nil values. you must emit some value for ever comprehension evaluated, and nil is the default.

1:34 mildfate1: bob2: You may be right, but I get java.lang.Boolean cannot be cast to clojure.lang.IFn just from replacing "when" with "filter"

1:35 dsrx: ,(doc filter)

1:35 clojurebot: "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."

1:35 bob2: it's not a drop in replacement

1:36 mildfate1: the way I'm doing it now is (remove nil? (my-double-list-comprehension))

1:36 I guess I'll stick with the when funciton

1:37 scottj: mildfate1: maybe :when in for might help

1:37 mildfate1: scottj: what are those keywords prefixed with colons? I've seen them around.

1:37 arrdem: mildfate1: they're called keywords :P

1:37 ,(type :foo)

1:37 clojurebot: clojure.lang.Keyword

1:37 arrdem: ,(:foo {:foo 3})

1:37 clojurebot: 3

1:38 scottj: mildfate1: what does my-double-list-comprehension look like?

1:38 dsrx: might be referring to namespaced keywords

1:38 scottj: ,(for [x (range 2) :when (not= x 1)] x)

1:38 clojurebot: (0)

1:39 mildfate1: (for [el lists rank (range 1 (inc n))]

1:39 (when (test? el rank) (conj el rank)))

1:39 should I be using :when?

1:40 scottj: should? I don't know. can? I think so :)

1:40 arrdem: scottj: I think that "should" is entirely appropriate here :P

1:40 mildfate1: scottj: If I use ":when" instead of "when" I get the wrong answer

1:41 arrdem: mildfate1: you need to use it like this

1:41 scottj: mildfate1: show us the code

1:41 arrdem: mildfate1: (for [el lists rank (range 1 (inc n)) :when test? el rank)] (conj el rank))

1:42 scottj: lets see if he understood that it needs to be a keyword arguemnt to for first..

1:42 scottj: given that he didn't know keywords that may be the easy fix

1:42 ,(doc for)

1:42 clojurebot: "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], ...

1:42 arrdem: eh truncated out :c

1:43 scottj: arrdem's code above is missing a paren after :when I think

1:43 mildfate1: yea, the parens aren't matched

1:43 scottj: arrdem: yeah, my guess was he was using "] (:when ..." (i.e. replacing when with :when)

1:43 arrdem: scottj: maybe... I'm live coding in irssi, too lazy to fire up erc atm

1:44 scottj: arrdem: I'm using irssi, which is why I let you do the hard part :)

1:44 mildfate1: scottj: That's what I have

1:44 should :when be inside the sqaure brackets?

1:44 arrdem: scottj: high five sshing into a connection holding machine :P

1:44 mildfate1: yes

1:45 mildfate1: for interprets all :when arguments to be conditions on which to execute the list comprehension expression

1:45 mildfate1: so here you can promote that check into the (for) and eliminate nil values :D

1:45 s/eliminate/escape/g

1:46 mildfate1: for requires an even number of forms in binding vector

1:46 scottj: mildfate1: :when test = 2

1:46 * arrdem grumbles darkly and copies code into emacs for real editing

1:47 mildfate1: what's a binding vector?

1:47 scottj: mildfate1: maybe share your code if it's still not working

1:47 (for [I am a binding vector] ...)

1:47 (let [same here] ...)

1:47 mildfate1: (for [el lists rank (range 1 (inc n)) (:when test? el rank)] (conj el rank))

1:48 arrdem: https://www.refheap.com/54942

1:48 scottj: replace (:when...) with :when (test...)

1:48 mildfate1: ah!

1:48 works

1:48 thanks a lot!!

1:49 scottj: mildfate1: are you/have you read a book on clojure?

1:49 mildfate1: scottj: No, I just started coding. the docs are pretty nice though, sometimes I (obviously) get confused

1:50 arrdem: :c docs

1:50 +1 Joy Of Clojure

1:50 bob2: it's "clojure tutorial" is one chapter, though

1:50 "programming clojure" is very good and thorough also

1:52 mildfate1: while I'm here, is there a more concise way of putting this function? I feel like it might be a little ugly http://pastebin.com/JqEmTYvn

1:54 or is it way too hard to read?

1:54 bob2: what's it do, in english

1:55 mildfate1: It returns true if rank is allowed to be added to the list

1:56 depending on the test? function which takes 4 arguments

3:00 arrdem: sorry, can't comment without more context. refheap please.

3:03 I can say that this is very awkward code, but how exactly to make it better is hard to say.

3:03 scottj: mildfate1: not sure, but I think you should get rid of both the partials and use one fn, and get rid of the inner map-indexed and make the outside map a map-indexed.

3:04 mildfate1: arrdem: https://www.refheap.com/1a9f9e3af66f19e9ddfedf68f

3:05 scottj: Yea, I was unsure about the partials. I looked for function currying in clojure and that's what turned up. Cause I need to apply eq-point? with the same first point to every point in the list

3:06 but in order to get the actual values of the points, I need map-indexed

3:06 (since without it, I only have y-values)

3:11 ddellacosta: mildfate1: what does query-y look like? I'm having trouble de-constructing it from the code.

3:11 mildfate1: er, both args I should say

3:12 mildfate1: ys is a list of numbers (y-coordinates) and query-y is a number (a possible y-coordinate to add to the list)

3:13 ddellacosta: mildfate1: what is the criteria for query-y being added to the list?

3:13 arrdem: mildfate1: lookig at this I think you have your point addition criterion wrong...

3:13 scottj: mildfate1: maybe this for your first version https://www.refheap.com/54945

3:14 mildfate1: This criteria is more complicated than in the code I pasted— but in the code I pasted it's that as long as two points are different, the new y-coord is added

3:14 arrdem: mildfate1: is sharing the same X as the _last_ element really the goal

3:14 mildfate1: (so addable? will always be true)

3:15 ddellacosta: mildfate1: so, based on your English description, you need to figure out if the passed in value matches any of the values in a list?

3:16 arrdem: https://www.refheap.com/54946

3:17 (range) isn't inclusive so this can _never_ return true... (inc (max (range N))) << (inc N)

3:22 ddellacosta: arrdem: aren't the two :when clauses going to match on one or the other, rather than both (or vs. and)?

3:23 arrdem: ddellacosta: it is my understanding that the two whens will function as an and. no testing was done. an (and) could be used :P

3:24 ddellacosta: ,(for [i (range 0 10) j (range 0 10) :when (= i 2) :when (or (= j 1) (= j 2))] "foo")

3:24 clojurebot: ("foo" "foo")

3:24 ddellacosta: hmm, maybe that's not a good test

3:25 arrdem: ,(for [i (range 0 10) j (range 0 10) :when (= i 2) :when (or (= j 1) (= j 2))] [i j "foo"])

3:25 clojurebot: ([2 1 "foo"] [2 2 "foo"])

3:25 arrdem: ddellacosta: seeks good to me...

3:26 mildfate1: arrdem: here's how I've modified it with your helpful code https://www.refheap.com/e7acd5f5273d1671def253409

3:26 ddellacosta: arrdem: yeah, I think I misunderstood the semantics of for, nevermind...

3:27 * arrdem looks at his own paste....

3:29 arrdem: mildfate1: okay. so I'm gonna be harsh here. your "point equality" function isn't needed to implement this according to your specification.

3:29 ,(bool [])

3:29 mildfate1: arrdem: You're right, from what you've seen, it's not necessary

3:29 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: bool in this context, compiling:(NO_SOURCE_PATH:0:0)>

3:29 * arrdem facepalms

3:29 mildfate1: arrdem: But the eq-point? method has other checks that I didn't include

3:29 arrdem: I don't even care.

3:30 your code is messy. you don't show me enough to give comment. I'm done.

3:30 mildfate1: It's still messy? I thought it was looking better :(

3:32 arrdem: I wouldn't say that second paste is at all materially better than the first one tbh.

3:33 mildfate1: is it the apply and partial functions?

3:33 arrdem: https://www.refheap.com/54951

3:33 the partial is OK... you can get away without it tho.

3:33 amalloy: i wouldn't say yours is any better than his, arrdem :P

3:34 mildfate1: never seen that guy before (->>)

3:34 arrdem: this does exactly that... https://www.refheap.com/54952

3:34 amalloy: really? I'll stfu then.

3:36 amalloy: i think https://www.refheap.com/9b689c91cf82cb3451fe3fb0b should be equivalent, right?

3:36 or at least close, up to my eta-reducing incorrectly

3:36 arrdem: mildfate1: so ->> is thread-last. writing (->> e (f a) (g b (h c)) is (h c (g b (f a e)))

3:36 amalloy: oh, and i forgot the second arg to keep-indexed

3:37 * arrdem dropped a paren there

3:38 arrdem: ,(doc keep-indexed)

3:38 clojurebot: "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects."

3:39 arrdem: totally didn't know that was a thing..

3:39 amalloy: oh yeah, it's non-nil. so i guess you need to have eq-point? return nil instead of false

3:39 or do some other thing, whatever

3:40 really not-any? false? and map-indexed is probably better

3:40 arrdem: yeah I'll go with amalloy's solution over mine due to the way you're chaining the x coordinate to the index..

3:40 mildfate1: amalloy: You're saying my solution?

3:41 amalloy: well, without that partial

3:41 mildfate1: How did you get around the partial?

3:41 amalloy: well, (apply (partial f x y) z) => (apply f x y z)

3:41 but also i'd do the computation inside map-indexed, so that there's no vector to apply to anyway

3:41 mildfate1: riiiight

3:42 I see it, it's in the actual function passed to map

3:42 amalloy: amusingly, (every? false? xs) is the same as (apply = false xs)

3:42 i'd prefer the version with every?, but it's a cute trick

3:44 arrdem: (inc amalloy) ;; karma too low

3:44 lazybot: ⇒ 88

3:55 mildfate1: If I wanted to do something like: (f n (f n (f n [base-case]))) would I use comp?

4:05 scottj: (nth (iterate (partial f n) base-case) 2), maybe

4:05 amalloy: probably 3, not 2, but yeah

4:06 noonian: ,(doc iterate)

4:06 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

4:25 sveri: hi, I have a list of keys and a map, now I want a map that contains only the (key -> value) set of the list of keys I have, is there a function for that in clojure?

4:27 bob2: sveri, select-keys

4:27 amalloy: $findfn {;a 1 :b 2} [:a] {:a 1}

4:27 lazybot: [clojure.core/cond clojure.core/dosync clojure.core/import clojure.core/prn clojure.core/refer-clojure clojure.core/print clojure.core/newline clojure.core/comment clojure.core/or clojure.core/load clojure.core/await clojure.core/declare clojure.core/println clojure.... https://www.refheap.com/54960

4:27 amalloy: oh haha, i commented it. silly lazybot

4:27 $findfn {:a 1 :b 2} [:a] {:a 1}

4:28 lazybot: [clojure.core/select-keys]

4:28 bob2: woah

4:29 sveri: bob2: thanks, thats what i was looking for

4:29 amalloy: that clojure bot is awesome

8:58 Pupeno: Anybody using quil?

11:06 igorw: is there a way to do a negative membero in core.logic? to ensure that an item is *not* a member of a list

11:24 hyPiRion: igorw: define it as you would implement membero, but use != instead of == to match?

11:53 romain_p__: Hi everyone, is there a lib like Gambit (cljs CES) but available on clojars and maintained?

12:00 igorw: hyPiRion: figured it out, thanks!

12:18 benmoss: hm, does anyone have a keybinding for vim-fireplace that copies an eval onto the copy buffer?

12:29 ambrosebs: benmoss: are you aware of :Last

12:29 benmoss: no, or if i was i forgot about it

12:29 thanks, thats close enough

12:29 though becoming more handy with "c!!" is also pretty close

12:46 pepijndevos: Is there any good reason for using symbols instead of keyword in core.logic, or is it simply a leftover from scheme?

12:52 ambrosebs: pepijndevos: I can't think of any.

12:52 pepijndevos: ok

12:53 Then I'll use kewords, it feels less abusive.

12:55 seangrove: bbloom: Still primitive, something special about composable components https://www.dropbox.com/s/hhyr2qp6p7c5ubp/zenrise_prev_1.mov

12:55 pepijndevos: hmm, i keep forgetting using conde contributes additional, but sometimes identical results.

12:55 But forgot what to do about it :D

12:55 bbloom: seangrove: awesome. making good progress

12:56 seangrove: bbloom: Some interesting problems around mapping the tree of components to the app state. Think I'm almost there

12:56 bbloom: seangrove: mmmmm real layout

12:57 seangrove: bbloom: Yeah, a crazy world we live in, huh?

12:57 "We can do layout in the browser now!"

12:58 pepijndevos: seangrove, wait, what have I missed? Layout in the browser?

12:58 seangrove: pepijndevos: Flexbox + proper components, that's all

12:58 pepijndevos: I did find this gcss thing the other day, basically porting iOS autolayout to JS.

13:00 seangrove: pepijndevos: Where is it?

13:01 pepijndevos: seangrove, googling grid css doesn;t work, right? uuuhm, searching...

13:02 seangrove, ah! http://gridstylesheets.org/

13:04 seangrove: pepijndevos: Pretty cool, thanks. Wonder how it interacts with React

13:04 pepijndevos: only one way to find out...

13:04 Would react/om questions be on-topic here? I havn't figured that thing out yet.

13:05 seangrove: pepijndevos: probably

13:06 pepijndevos: I'll give it a go then :) I did some things with Angular in the past, which is MVC, while React/Om are just V, right?

13:07 So in Angular you could say {{ name }} <input ng-model="name"> and that would just work. How can you do this kind of bidirectional binding in Om?

13:07 This seems to be a model related thing.

13:08 seangrove: pepijndevos: There's only one-way binding in React/Om

13:09 pepijndevos: In other word, forms are still a pain?

13:10 Frozenlock: Wait, who's making the template thingy?

13:10 seangrove: pepijndevos: But if you wanted to do it quick-n-easy: (dom/div nil (om/get-state owner :name) (dom/input #js{:onChange #(om/set-state! owner :name (.. % target value))}))

13:10 Frozenlock: (my irc bugged out)

13:10 rebcabin: ,(+ 42 0)

13:10 clojurebot: 42

13:11 seangrove: pepijndevos: Forms havn't been a pain at all, actually

13:12 pepijndevos: Is it comon to combine Om with a model library?

13:13 I was making an editable tree in angular the other day. First I posted stuff to the server, then I tried jQuery, then Angular, which was the only non-painful solution up to that point. Just curious how om would handle that.

13:13 What is owner in that snippet?

13:15 seangrove: pepijndevos: Are you developing in cljs or js?

13:15 pepijndevos: js+angular at the moment. mainly asking for future projects.

13:16 seangrove: pepijndevos: If cljs, just go through the tutorial, it's worth it. It's pretty quick to grok https://github.com/swannodette/om/wiki/Basic-Tutorial

13:16 pepijndevos: Will do.

13:17 Frozenlock: I still find this much easier http://holmsand.github.io/reagent/

13:17 Tho I'm sure this is going to bite me in the ass in the future...

13:17 seangrove: Frozenlock: Yeah, different approaches

13:19 Frozenlock: seangrove: Do you know what's mainly different under the hood?

13:21 seangrove: Frozenlock: There's some chatter about it on the ML that's worth reading. Under the hood it's similar, but the design decisions mean the apps that are built out of them are probably going to be pretty different

13:21 Frozenlock: the cljs mailing list?

13:22 seangrove: Frozenlock: Yeah, I'll grab the thread in a second

13:22 * seangrove is figuring out how to install grunt

13:24 * seangrove shakes his head at npm

13:28 seangrove: Frozenlock: https://groups.google.com/forum/#!topic/clojurescript/o9CqGss_HC4

13:29 Frozenlock: seangrove: thanks!

13:31 isaacbw: anyone know how to get in contact with Mike Anderson? (about GSoC)

13:33 seangrove: isaacbw: He's on the ML, you can get his email from there

13:34 isaacbw: awesome, thanks

13:37 Frozenlock: Btw, with this https://github.com/alandipert/storage-atom (and the pending pull request), making multi windows applications with react/om/reagent is a cakewalk.

13:38 seangrove: Frozenlock: Oh, pretty nice

13:38 isaacbw: seangrove: mikera?

13:39 seangrove: isaacbw: Yeah

13:39 isaacbw: huh... his email is hidden. I guess I can reply directly to him from one of his posts

13:41 anyone else here thinking about doing the GPU core.matrix for GSoC?

13:43 seangrove: isaacbw: Or just send an email to the group asking for instructions

14:17 isaacbw: oh man, excited about this GPU idea

14:17 I hope no one has talked to Mike about it yet :P

14:18 ambrosebs: isaacbw: fwiw multiple students can work on the same project

14:19 isaacbw: independently

14:19 isaacbw: ah, okay!

14:19 in that case, it might be fun to have someone else to work with

14:20 ambrosebs: it's possible, but maybe not for Clojure since we might not get so many slots play with

14:20 just make an enthusiastic impression and I'm sure you'll be fine :)

14:21 last year Python got around 30 projects, some duplicates. We got 7

14:21 isaacbw: heh

14:22 I really don't enjoy python. I use it occasionally for its scientific ecosystem

14:22 but the language itself leaves me wanting

14:23 hmm, is there anything like matplotlib for clojure?

14:24 rebcabin: incanter may have some R-like plotting, dunno

14:26 isaacbw: I'm working on a research project with networks atm, and I think I've convinced my advisor to let me use clojure to interface with the neo4j api

14:26 (I picked neo4j so I would have leverage to convince him to let me use clojure)

14:26 rebcabin: @isaacbw incanter does have some plotting http://data-sorcery.org/2010/04/04/new-chart-theme

14:26 isaacbw: it would be awesome if I could do more with clojure, rather than having to write some things (like plots) with python

14:26 ah, cool, I'll take a look

14:29 benmoss: i have an ugly data structure for representing a chess board, wondering if anyone has any bright ideas how to do it differently? https://gist.github.com/benmoss/9452134

14:29 the redundancy part is what bothers me, but i don't know what a good alternative would be

14:31 being able to look up based on position is obviously important, but then the value still needs to know its position as well

14:31 Frozenlock: benmoss: I had a similar problem recently. I just ended up sending the key as an argument along with the value. I'd be interested to know with what solution you'll come up. :-)

14:32 benmoss: right now its just deal with the redundancy

14:32 gfredericks: the value needs to know its position?

14:33 why?

14:33 clojurebot: why not?

14:33 benmoss: exactly clojurebot

14:33 i pass the value around as a "square", and want to be able to calculate the moves for the piece on that square

14:34 * gfredericks rummages through his chess code

14:35 benmoss: yeah i worried when asking that this might be one of those "no simple answer" kinda questions, but thought someone might have a clue what i was talking about

14:35 gfredericks: I think it's easier to just pass around the pieces of data that are needed

14:35 so if you want to compute the moves for a piece

14:35 benmoss: i guess this would just be a vector if i didn't need efficient access

14:36 gfredericks: you have a function that needs to know A) what does the board look like, and B) what piece are we talking about

14:36 https://github.com/fredericksgary/chess-clj/blob/master/src/com/gfredericks/chess/rules.clj#L111

14:36 when I did this I passed in the board, the piece, the color, and the square

14:36 clojurebot: Gabh mo leithscéal?

14:36 gfredericks: even though some of that was redundant

14:36 mskoud: hi

14:37 gfredericks: benmoss: but my point is that I don't think it helps to think of a piece as something that knows where its square is

14:37 that's contextual; the piece just knows what kind of piece it is

14:37 benmoss: the piece is embedded in the square

14:38 but maybe same difference

14:38 gfredericks: from the board's perspective

14:38 the board is a data structure that knows where the pieces are

14:38 benmoss: yeah

14:38 mskoud: having something like (def x (atom {:name "A" :id 1 :children [{:name "B" :id 2 :children []} {:name "C" :id 3 :children [{:name "D" :id 4 :children []}]}]} )) how do i update fx name to "Z" if i only got the id?

14:38 gfredericks: mskoud: fx?

14:39 benmoss: let the board be responsible for matching pieces to squares; the pieces themselves don't need to

14:39 broquaint: mskoud: update-in?

14:39 mskoud: i need x changed so fx :name is "Z" in the map with id: 2...

14:39 benmoss: yeah, i gotcha gfredericks

14:39 thankas

14:39 thanks*

14:39 gfredericks: np

14:40 mskoud: update-in... will try

14:40 broquaint: Are chess rules describable with the likes of core.logic?

14:40 benmoss: can't use update-in because you've got vectors

14:40 or rather

14:41 you'd have to resupply the whole vector if you wanted to use update-in

14:41 mskoud: ok...

14:41 gfredericks: broquaint: I tried that once; the sticky part was expressing negatives, specifically wrt check

14:42 broquaint: gfredericks: Aha, interesting.

14:42 benmoss: gfredericks: does your chess game not take into account history for things like en passant and castling?

14:43 gfredericks: benmoss: that's part of the position

14:43 the position data structure contains the board, whose turn it is, castling+en-passant

14:43 I even rigged it up to print with FEN notation

14:43 #chess/fen "..."

14:44 benmoss: i've found that to be one of the more annoying features of chess

14:44 when implementing it anyway

14:44 gfredericks: I started playing Go instead because it isn't such a pile of arbitrary rules

14:45 benmoss: yeah, i was saying to someone recently Go is definitely the lisp of board games

14:45 gfredericks: I think I have a tweet to that effect

14:46 but it cannot be foudn

14:46 speaking of go, go.davepeck.org is the shit

14:46 benmoss: luckily they had not read that tweet

14:50 gfredericks: broquaint: I ended up trying to express it positively in terms of "safety"; the whole thing was sooper slow, but it was kind of fun

14:50 I think I had everything but castling+en-passant described accurately

14:50 I wanted to be able to run an arbitrary position backwards to the initial setup, but it was not nearly fast enough to support that

14:53 broquaint: That's a shame, but interesting to hear it was possible, bring on the optimizations necessary for this sort of thing :)

14:54 gfredericks: yeah I kept wondering if the core.logic extension points would allow for some much more optimal data structures or something

14:54 I don't think I was clever enough to determine one way or another

14:54 but using nested lists to represent the board seemed terrible

15:13 Joe_________: hey, im just starting clojure in school and I was wondering if anyone could guide me in reading through some code

15:15 bbloom: ~anyone

15:15 clojurebot: anyone is anybody

15:15 bbloom: ~anybody

15:15 clojurebot: anybody is anyone

15:15 bbloom: *sigh*

15:15 gfredericks: (inc clojurebot)

15:15 lazybot: ⇒ 33

15:16 bbloom: ~anybody

15:16 clojurebot: anybody is anyone

15:16 gfredericks: ~anyone

15:16 bbloom: ~anybody

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

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

15:16 bbloom: there we go dammit lol

15:16 Joe_________: ^^

15:16 gfredericks: 3rd & 4th times are the charm

15:17 amalloy: clojurebot: forget anyone |is| anybody

15:17 clojurebot: I forgot that anyone is anybody

15:18 amalloy: clojurebot: forget anybody |is| anyone

15:18 clojurebot: I forgot that anybody is anyone

15:18 bbloom: amalloy: thanks

15:18 amalloy: poor guy sounds like he doesn't remember anything anymore

15:18 bbloom: ha

15:18 jebberjeb: Joe_________: where are you learning Clojure in school?

15:19 Joe_________: i'm learning it on the east cost

15:19 amalloy: bbloom: sadly my ~forget seems to have no impact

15:19 bbloom: amalloy: nothing is ever forgotten.

15:19 jebberjeb: where on the east coast

15:20 amalloy: hiredman: any idea why clojurebot is still conflating "anyone" and "anybody", even after i told him to forget their relation? i don't see any transitive factoids

15:21 firefaux: is it to be expected that trying to compile a custom data structure written in java would make the compiler tell me I'm using unchecked/unsafe operations?

15:21 Joe_________: my main question is given this code snippet (for [i range( k) :let [vi (v i)]] where v is a vector of length k, what is the data type of vi

15:22 firefaux: I pretty much followed suit from what clojure's PersistentTreeMap did

15:22 amalloy: Joe_________: (range k), not range(k)

15:22 Joe_________: oh whoops, that was a mistype

15:22 firefaux: writing too much python? :P

15:22 gfredericks: Joe_________: vi would be an element of v

15:23 amalloy: firefaux: that's a pretty normal warning message. you can write the data structure in a way java would prefer, using generics, but if you'll only be consuming it from clojure there's not much point

15:23 firefaux: amalloy: that's what I figured. Would there be any purpose to using <Object> for generics?

15:23 would that even make it stop complaining?

15:23 amalloy: no, that would be silly

15:23 Joe_________: ohh, that makes sense. I'm kind of confused as to how that works though.

15:24 amalloy: you can put @SuppressWarnings("unchcked") before the class definition, too

15:24 gfredericks: Joe_________: ##([:a :b :c] 1)

15:24 lazybot: ⇒ :b

15:24 firefaux: yeah, I know it's pointless

15:24 gfredericks: Joe_________: what part in particular is confusing?

15:24 firefaux: maybe I'll do that

15:24 amalloy: er, "unchecked"

15:24 firefaux: right

15:25 Joe_________: In general, if I have a vector v, and a index i do I access its elements with (v i)

15:25 I thought that parentheses denoted a list?

15:25 gfredericks: the parentheses are a function call

15:25 syntactically they are a list, but that's kind of a different level

15:25 firefaux: they only denote a list if they're quoted

15:26 I still don't understand when that's acceptable in clojure, though

15:26 in my experience basically never

15:26 common lisp is a different story...

15:26 does anyone here ever use quoted lists?

15:26 and not just vectors?

15:27 Joe_________: Hmm, I don't understand how that is a function call. And thank you for the explanation on parenthesis fire and frederick.

15:28 firefaux: in lisp, lists *are* indeed denoted by parenthesis. but when a list is encountered by the lisp reader, it treats the first element as the function, and the rest as its arguments

15:29 or at least that's my basic understanding of how it works

15:29 amalloy: firefaux: yes, although s/reader/compiler

15:29 firefaux: if you "quote" the list (e.g. '(1 2 3)), then it takes the list as-is, without evaluating

15:30 Joe_________: So, in my code snippet (for [i (range k) :let [vi (v i)]] the vector v is a function and is taking i as an arguement?

15:30 amalloy: Joe_________: yes

15:30 vectors, when called as functions, look up in themselves

15:30 firefaux: yes, all of clojure's data structures are also functions

15:30 Joe_________: Oh, I that makes so much more sense now.

15:30 firefaux: and their arguments are either the keys, indices, or whatever else the data structure uses to look up a value

15:30 amalloy: firefaux: that's quite a reach. most sequences aren't functions; it's just vectors, maps, and sets that are

15:31 firefaux: hmm, I guess you're right

15:31 forgot about sequences in general

15:31 do literal lists work as functions? lets find out

15:31 ,('(1 2 3) 0)

15:31 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>

15:31 firefaux: nope

15:32 ,([1 2 3] 0)

15:32 clojurebot: 1

15:33 Joe_________: Thanks for all the help guys. I get the code now.

15:33 amalloy: Joe_________: fwiw, that could be better written as (for [vi (take k v)] ...)

15:34 i guess the `i` might be needed in the body of the `for`, but in that case you probably want map-indexed

15:35 Joe_________: Does map-indexed act like zip in python?

15:35 amalloy: (->> (take k v) (map-indexed (fn [i vi] ...)))

15:35 ~zip

15:35 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))

15:36 Joe_________: Ah, I'm learning all over the place today. What does ->> denote?

15:36 bbloom: Joe_________: for that sort of question, try the following in your repl:

15:36 (doc ->>)

15:36 clojurebot: "([x & forms]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."

15:37 Joe_________: Ah okay. Thanks

15:37 firefaux: wait, clojure bot doesn't need you to put anything in front of your S-exps?

15:38 bbloom: firefaux: doc is a special case

15:38 firefaux: ah

15:38 thought that might be it

15:52 igorw: hey folks, I made a relational turing machine with core.logic - probably there's a lot of room for improvement

15:52 https://gist.github.com/igorw/9449950

15:54 would love to get any feedback at all, I hope this is the right place for such things

15:55 TravisD: What's a relational turing machine, out of curiosity

15:56 igorw: oh, the 'relational' was just referring to it being implemented on top of core.logic/miniKanren

15:57 TravisD: Ah, cool. I don't know anything about core.logic

15:58 Does it provide resolution (I think that's what it's called) from prolog?

15:58 hiredman: unification

15:58 TravisD: ah

15:59 mathiasx: I feel like I'm misisng something basic.. I need a timestamp (instant) and found clojure.instant for parsing one.. but what about creating one for "now"?

15:59 hiredman: ,(System/currentTimeMillis)

15:59 clojurebot: 1394395127405

16:00 chouser: ,(java.util.Date.)

16:00 clojurebot: #inst "2014-03-09T19:59:32.582-00:00"

16:02 mathiasx: thank you

16:05 chouser: mathiasx: hiredman's example will run much faster

16:07 mathiasx: Is there a reason why something like that isn't in core? Assumption that people will know the Java way of asking for it?

16:07 bja: mathiasx, that's a common assumption

16:08 clojure is expected to be extremely symbiotic with the host platform

16:08 kinda bites you if you're a non-java guy looking to get into clojure, from say, python or rub

16:08 *ruby

16:09 mathiasx: makes sense

16:09 thanks for clarifying

16:12 bbloom: amalloy: you're surely the man who'd know this... function for filtering and removing at the same time in to two collection in parallel?

16:12 with a single predicate

16:12 amalloy: well, group-by

16:12 bbloom: amalloy: ah, duh. thanks

16:13 amalloy: (juxt filter remove) if you want

16:13 bbloom: group-by is perfect. just didn't occur to me b/c my key is a boolean

16:25 gfredericks: ,((juxt filter remove) #(< (rand) 0.5) (range 10))

16:25 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval25/fn--26>

16:25 trap_exit: how do I generate "out/goog/base.js" ?

16:25 :optimizations :advanced doesn't seem to generate it

16:25 gfredericks: ,((juxt filter remove) (fn [_] (< (rand) 0.5)) (range 10))

16:25 clojurebot: [(5 8) (0 2 3 4 5 ...)]

16:32 hyPiRion: gfredericks: woah, that probability seems unlikely to happen

16:32 ,((juxt filter remove) (fn [_] (< (rand) 0.5)) (range 10))

16:32 clojurebot: [(0 4 6 8) (3 6 7 8)]

16:32 TravisD: It's really cool that you get duplicates in that code

16:33 Dangerous side effects!

16:35 gfredericks: ,(->> (repeatedly 10 #(rand-int 10)) (sort))

16:35 clojurebot: (0 1 1 2 2 ...)

16:36 gfredericks: so weird that rand-int is based on floats

16:37 TravisD: gfredericks: why not write that as (sort (repeatedly 10 #(rand-int 10)))?

16:39 gfredericks: habit

16:39 TravisD: I like how in your version it's clear that you're generating a random sequence, then sorting it

16:39 that's less clear in the other version

16:44 During a section on purity, a good question to ask students would be: Find a predicate p and a collection coll such that f1 and f2 behave differently, where (def f1 (juxt filter remove)) and (defn f2 [p coll] (map (comp seq second) (group-by p coll)))

16:44 RuralClojurer: is there a way to salvage an emacs nrepl that's been mistakenly blocked by core.async?

16:44 chouser: RuralClojurer: Have you tried nrepl-interrupt?

16:45 RuralClojurer: thanks, worked!

16:48 amalloy: TravisD: too broad: f1 produces partial results from infinite sequences, where f2 doesn't

16:48 TravisD: ah

16:48 amalloy: is the thing that occurs to me first as an answer to that question

16:48 TravisD: yeah, that's right

16:48 could fix the collection, I guess

16:48 and then you should also force f1 to evaluate the lazy seqs

16:56 amalloy: oh, and also the ordering of f2 isn't guaranteed. it might act like (juxt filter remove) or (just remove filter)

16:57 TravisD: ah, yeah, I guess if the predicate is pure then the result would be the same (aside from the swapping)

17:18 seangrove: dnolen_: The react team would like the closure advanced compiler to be part of their build process, but some of the stuff they do is likely to be difficult to get working in advanced mode (use of `this` in mixin methods, etc.). I'm doing the work for it right now so we can get some externs for ReactAddons, then they'll take it over if it's part of their test suite. Wondering about the scale of this project though.

17:58 bbloom: https://github.com/brandonbloom/eclj <- latest little thing i'm hacking on :-)

17:59 seangrove: bbloom: Sounds pretty interesting. Meant to be used for production-level stuff at some point, or just experimentation?

18:00 bbloom: seangrove: i guess you'd be able to use it for jail-ing purposes, but it would be pretty slow

18:01 seangrove: otherwise, it's experimenting for a super evil master secret plan i've got in the works

18:01 steckerhalter: is there `map` that also acts as `filter`?

18:02 amalloy: &(doc keep)

18:02 lazybot: ⇒ "([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects."

18:02 steckerhalter: amalloy: thanks

18:04 Bronsa: bbloom: https://github.com/brandonbloom/eclj/blob/master/src/eclj/core.clj#L264-L265 actually records don't implement IFn

18:04 bbloom: Bronsa: heh, well perfect then :-)

18:05 Bronsa: https://github.com/brandonbloom/eclj/commit/e6f93ad4de4d5d10c2ab869c70afcbaf25c2bf3c

18:06 Bronsa: hah

18:07 bbloom: seangrove: I wanna try to implement a symbolic predicate dispatch system

18:08 if the eval function was an open predicate dispatch system, abstract interpretation based analysis would be a trivial extension

18:09 Bronsa: how many people do you think have suffered through parsing fn-tails ? :-/

18:09 amalloy: bbloom: re https://github.com/brandonbloom/eclj/blob/master/src/eclj/core.clj#L262 , defrecord doesn't have an IFn instance (and if it did i don't think you could override it)

18:09 oh, Bronsa already said that. i'm behind

18:09 bbloom: haha

18:15 gfredericks: KEYNOTE TBD

18:19 Bronsa: bbloom: you mean parsing (fn* STUFF)? yeah, that's not fun

18:50 alew: is there a way to declare records like you can declare functions using (declare a b)?

19:05 TravisD: alew: I don't know the answer, but I'm curious about why you want to do that. The reason for declaring functions before defining them is to allow for mutual recursion. But I don't see how two records could depend on one another (unless, maybe, there are type hints somewhere or something)

19:09 bufferloss: is incanter on topic in here?

19:09 TravisD: bufferloss: I believe so

19:10 bufferloss: aight cool thx

19:15 what should I know about starting a new clojure project?

19:15 should I use leinengen or something else?

19:15 isaacbw: use lein

19:16 bufferloss: do I need a JDK or just Java?

19:17 do I need to have clojure on my PATH to run leinengen?

19:17 TravisD: I believe that you need a java compiler for various things, so it's probably a good idea to install the JDK

19:17 leiningen will install clojure for you

19:18 bufferloss: ah ok cool

19:18 TravisD: bufferloss: As far as incanter goes, lein will also download and manage your dependencies. It's all very nice

19:19 alew: TravisD: the record types have functions that do some verification and that requires type checking

19:19 TravisD: the type checks are using other record types

19:21 TravisD: alew: Ah. I guess you could use extendtype to provide implementations of those type checking methods after the records have been defined

19:21 extend-type

19:21 bufferloss: yikes, lein help tutorial just spits out a ton of markdown, is it supposed to open something for that?

19:22 TravisD: bufferloss: I followed the tutorial online, available here: https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md

19:22 alew: TravisD: yeah, that works, but I thought having a forward decleration would make it cleaner

19:22 bufferloss: ah great, thanks

19:23 TravisD: alew: Yeah, I see. Sorry, I don't know the answer :(

19:24 bufferloss: I also notice that the lein github page indicates that you must have a java JDK version 6 or later

19:24 bufferloss: k

19:25 thx, I'll make sure I do, I probably do

19:30 benmoss: if you install the markdown binary and http://rtomayko.github.io/bcat/, `lein help tutorial | markdown | bcat` works

19:30 :)

19:31 executable i mean

19:35 damn bcat is pretty awesome in general

19:38 bufferloss: how do I set my namespace in project.clj

19:39 I just used :main test-project.core and that finally stopped complaining but now it says wrong number of arguments when i use lein run, and my function is just the example function from the lein new project, and the same one from the TUTORIAL.md

19:43 rebcabin: @bufferloss I think "lein run" looks for a function named "-main" in the namespace that you specify in the ":main" key in your defproject

19:45 try "lein help run"

19:45 bufferloss: k

19:46 gfredericks: let's say I wanted, in hiccup, to create a link that POSTs to some url, presumably backed by a <form> or something

19:46 what library would I want to be using to help me assemble this?

19:47 this hypothetical is actually based on a true story, because in fact that's exactly what I want to do right this minute

19:48 rebcabin: @bufferloss if you write (defn -main [& args] (dorun println args)) and then do lein run "a" "b" "c" you should see a b c printed out in the console

19:49 but you will have a LOT more fun in lein repl :)

19:49 also consider LightTable for building up your code

19:49 then transfer to project once solid

19:50 sort of like prebugging your code or doing ephemeral TDD

19:54 danielszmulewicz: I get the impression that pre- and post-conditions are not often used. Am I wrong?

19:55 rebcabin: @danielszmulewicz take a look at https://github.com/clojure/core.contracts

19:55 danielszmulewicz: What's the current practice to do sanity checking on input parameters without resorting to core.typed?

19:55 rebcabin: thanks

19:55 rebcabin: I've used in production code

19:56 danielszmulewicz: rebcabin: I'm looking for something built-in for the moment...

19:57 gfredericks: clojurebot: core.typed is something you resort to

19:57 clojurebot: In Ordnung

19:57 danielszmulewicz: rebcabin: No dependencies. Just some idiomatic Clojure checks.

19:57 gfredericks: danielszmulewicz: I think pre/post is fine for checking for programmer errors

19:57 not fine for validating external stuff

19:57 danielszmulewicz: gfredericks: I see. Thanks.

19:58 gfredericks: for libraries it'd be nicer if there were customizable error messages

19:58 rebcabin: @danielszmulewicz only think I know of is manually testing your inputs and throwing or bubbling up error codes (or using maybe-like monads, but they're not built-in)

19:58 gfredericks: but other than that I don't know of any downsides

19:58 danielszmulewicz: I don't see much pre/post in the wild, I was wondering whY.

19:59 gfredericks: it might not occur to people

19:59 danielszmulewicz: Current use case is to make sure that fns are called with correct params.

20:00 seangrove: ,(let [ds {:coms [{:zr-com-data {:sub-coms []}}]}] (assoc-in ds [:coms 0 :zr-com-data :sub-coms 0 :a 0 0 :p] "hi"))

20:00 clojurebot: {:coms [{:zr-com-data {:sub-coms [{:a {0 {0 {:p "hi"}}}}]}}]}

20:00 seangrove: Is there a way to get that to be {:coms [{:zr-com-data {:sub-coms [{:a [[{:p "hi"}]]}]}}]} instead?

20:00 gfredericks: seangrove: wooah

20:00 ,(assoc [] 0 :foo)

20:00 clojurebot: [:foo]

20:00 gfredericks: ,(assoc-in {:foo []} [:foo 0] 12)

20:01 clojurebot: {:foo [12]}

20:01 gfredericks: ,(assoc-in {:foo []} [:foo 0 :hooha] 12)

20:01 clojurebot: {:foo [{:hooha 12}]}

20:01 seangrove: Heh, but...

20:01 gfredericks: what's the minimal case here?

20:01 seangrove: ,(assoc-in {:foo []} [:foo 0 :hooha 0] 12)

20:01 clojurebot: {:foo [{:hooha {0 12}}]}

20:02 gfredericks: oooooh

20:02 seangrove: The terminal 0 there is added as a hashmap, rather that a vector offset

20:02 gfredericks: righto

20:02 we're talking about new data structures

20:02 interesting

20:02 I know you could rewrite assoc-in to use vectors when creating a new thing with integer keys

20:03 heck you'd have to special case on 0 in particular probably

20:03 I think that's your only option...

20:03 seangrove: (doc assoc-in)

20:03 clojurebot: "([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created."

20:03 seangrove: Yeah, "hash-maps will be created". Bummer

20:03 gfredericks: it'd be weird if it did anything different

20:03 seangrove: gfredericks: Oh, I agree, and I'm not sure how I'd specify that level of detail, but it's causing a problem for me right now

20:04 I'll take a nap and revisit it

20:04 gfredericks: ,(source assoc-in)

20:04 clojurebot: Source not found\n

20:05 gfredericks: ,(clojure.repl/source assoc-in)

20:05 clojurebot: Source not found\n

20:05 gfredericks: it's super-short you could patch it in 20 seconds

20:05 bufferloss: ok so I added the postgres jar to my dependencies in project.clj, I ran lein deps, that seems to have "worked" so how would I go about accessing or using this jar from my clojure script now?

20:06 gfredericks: bufferloss: are you trying to use clojure.java.jdbc?

20:06 bufferloss: gfredericks, uh, not sure, I don't think so, I've always just used the actual postgres .jar file that is downloadable from the postgres JDBC site

20:07 seangrove: gfredericks: Yeah, there's assoc-in-idx on clojuredocs, might work

20:07 gfredericks: bufferloss: "I've always" -- does that mean from java?

20:07 bufferloss: yeah from java

20:08 gfredericks: so you're planning on using java interop to do JDBC things?

20:08 bufferloss: sorry, I'm pretty much 100% new to clojure, but I've worked with JDBC in Java before, rather extensively

20:08 I've also done ruby/python/PHP/C++/JavaScript/you-name-it-almost

20:08 gfredericks: are you familiar with how java interop works yet?

20:08 bufferloss: gfredericks, nope, I'm not familiar with Java interop

20:09 I just want to access postgres from clojure, whatever is the best way to do that, I'll use

20:09 gfredericks: okay; so I'd recommend using clojure.java.jdbc eventually, but if you want to stick with familiar things and/or learn about java interop...

20:09 bufferloss: it doesn't need to be JDBC if there's something else available

20:09 gfredericks: clojure.java.jdbc is a library that provides a clojure-oriented interface to JDBC

20:09 bufferloss: gfredericks, do you mean "java interoperability" in the general sense?

20:09 gfredericks: bufferloss: no "java interop" is a specific set of clojure features

20:09 bufferloss: aight what would a dep line for that look like in project.clj

20:09 ok

20:10 nevermind I see on the github

20:10 `cbp: bufferloss: you can find some examples in clojure wikibooks that you can find by googling clojure

20:10 googling clojure + jdbc + examples*

20:12 gfredericks: bufferloss: "java interop" refers to clojure code that explicitly calls instance methods or class methods on jvm objects/classes

20:12 bufferloss: so I see that the github for clojure.java.jdbc uses a dep line similar to [postgresql/postgresql "8.4-702.jdbc4"], wheras the line I saw in a different post (from googling) only uses [postgresql "8.4-702.jdbc4"] (no leading slash and repeated name)

20:12 gfredericks: leiningen expands the shorter one to the longer one

20:12 bufferloss: is it better ore more appropriate to use the former? is there something wrong with the latter?

20:12 ah ok

20:13 gfredericks: short is fine

20:18 I'm going to propose an unsession at ClojureWest called "bbloom states a strong opinion about something you've never heard of and then you get to ask him questions until you know what he's talking about".

20:19 bufferloss: ok sweet, I can connect and run queries with clojure.java.jdbc :)

20:19 gfredericks: bufferloss: excellent

20:21 tolstoy: Hm. in Om (0.5.2) attempting to (om/get-props owner) inside a click handler gives me the "cannot manipulate cursor". Weird.

20:26 gfredericks: guys ClojureWest is brought to you by Staples and WalMart

20:27 I'm not quite sure what to conclude from that

20:27 did this ever happen to a haskell conference?

20:28 akhudek: gfredericks: clojure actually gaining in enterprise?

20:29 aka: gfredericks: lol

20:32 pcn: I conclude there is a module out there with an easy button in swing, and that pushing it will drive my wages down

21:09 bufferloss: ok so now that I've gotten setup with a basic project that will query a postgres database and return results...

21:09 what might be a good tutorial to use to start learning about e.g. how to structure my code into modules/packages etc

21:10 best practices for app structure and whatnot

21:11 now that I can get data from the DB, the next goal is to process it with statistical analysis stuff like incanter

21:15 also, lein repl takes quite a while to boot up

21:15 which is not the biggest deal, but on a long term basis, invoking lein run and or lein repl regularly, which I'm sure I'm apt to do, that overhead grows

21:16 is there anything that I can do to have the repl or something running in the background so I don't have to wait for the startup (I presume it's just the jvm loading, can I just keep a jvm preloaded in the background somehow?)

21:16 arubin: Yes.

21:16 Let me see if I can remember the name of the project.

21:17 Starts with a g I believe...

21:18 `cbp: hmm

21:18 whatever happpened to grench

21:18 oh yeah

21:18 bufferloss: maybe you can try this https://github.com/technomancy/grenchman

21:18 arubin: http://leiningen.org/grench.html

21:19 Yeah.

21:19 That is it.

21:22 muhoo: gfredericks: well staples bought runa IIRC, which is how they ended up with clojure

21:22 dunno wat's up with walmart, but i'd bet on an acquisition

21:23 seangrove: muhoo: Yeah, bit weird. I thought Walmart was mostly a node shop for new projects

21:23 muhoo: but in general, i believe that enterprise adoption was the specific reason why rich designed clojure to be a hosted language (jvm, c#, js etc) in the first place

21:27 bbloom: gfredericks: that sounds fun :-P

21:30 bufferloss: why do the decimal() fields from my db say e.g. 18.5M (why the M?)

21:30 gfredericks: ,(type 4M)

21:30 clojurebot: java.math.BigDecimal

21:30 bufferloss: ah, ok cool thanks

21:31 gfredericks: bbloom: I'd come prepared by grepping through my IRC logs

21:31 seangrove: gfredericks: I always worry I'll be walking down the street and a homeless man yelling at everyone will actually turn out to be bbloom speaking wisdom ahead of his time.

21:32 gfredericks: B. B. Loom

21:33 indure: Hi - qq - from book JoC

21:33 . (assoc {1 :int} 1.0 :float)

21:33 seangrove: .(assoc {1 :int} 1.0 :float)

21:33 ,(assoc {1 :int} 1.0 :float)

21:33 clojurebot: {1.0 :float, 1 :int}

21:34 indure: . (assoc (sorted-map 1 :int) 1.0 :float)

21:35 why the difference ?

21:35 I couldn't understand the explanation in the book

21:36 This is because the comparison function used by the sorted map not only determines order by equality, and if two keys compare as equal, only one will be kept. This applies to comparison functions provided to sorted-map-by as well as the default comparator shown previously.

21:36 ??

21:36 lazybot: indure: What are you, crazy? Of course not!

21:36 clojurebot: ? is !

21:36 gfredericks: ,(assoc (sorted-map 1 :int) 1.0 :float)

21:37 clojurebot: {1 :float}

21:37 seangrove: The bots are getting uppity

21:37 gfredericks: ,(< 1 1.0)

21:37 clojurebot: false

21:37 gfredericks: ,(<= 1 1.0)

21:37 clojurebot: true

21:37 verma: if a package in clojars is outdated, what is the recommended way to get the latest jar of it?

21:38 gfredericks: indure: that sentence is difficult to figure out; I actually didn't realize sorted-maps did this

21:38 but I can see why

21:38 sorted maps are based on a comparison function, and apparently clojure's built-in comparison function will say that 1.0 and 1 are equal

21:38 but for hash-map equality and general equality, they are not equal

21:38 ,(= 1 1.0)

21:38 clojurebot: false

21:39 gfredericks: this is pretty edge-casey I think

21:39 verma: hmmm, may be I am fetching an incorrect version

21:39 seangrove: I think sorted-maps aren't exercised much in general

21:39 gfredericks: sometimes I suspect a programming language's utility is directly proportional to how terrible it is

21:40 indure: if (= 1 1.0) is false, map is being as expected, sorted-map is a surprise

21:40 '/being/behaving/

21:40 gfredericks: indure: sorted map is behaving according to <=

21:40 which says that they are equal

21:40 ,(let [=== #(and (<= %1 %2) (<= %2 %1))] (=== 1 1.0))

21:40 clojurebot: true

21:41 verma: ah nice, had an older library version specified in project.clj :)

21:42 indure: gfredericks: could lead to some strange bugs - coverting map to sorted map I mean

21:43 gfredericks: if you have a map with integers and floats as keys you already have some strange code

21:44 indure: agreed

21:45 gfredericks: thanks!

21:45 hyPiRion: It is way better than the opposite problem

21:46 I remember in 1.2, when (assoc {2 1} (denominator 1/2) :foo) returned {2 1, 2 :foo}.

21:46 gfredericks: cuzof BigInt?

21:46 hyPiRion: gfredericks: yessir

21:47 gfredericks: those were the good ole days

21:47 hyPiRion: when you could do (+ a b) without being afraid of overflow

21:49 indure: hyPiRion: it still returns that in 1.5 - has that changed?

21:49 1.5.1 I mean

21:50 hyPiRion: indure: it returns {2 :foo} for me

21:50 seangrove: ,(assoc {2 1} (denominator 1/2) :foo)

21:50 clojurebot: {2 :foo}

21:50 indure: Ah oh - typo - my mistake

21:51 So what happens here ? Type coercing?

21:51 If so, why not for sorted-maps

21:54 hyPiRion: that's not type coercing, it's just that (= 2 2N) was false in 1.2 I think

21:58 bbloom: seangrove: gfredericks: i'll do my best to not become homeless while pursuing computational nirvana

22:06 bufferloss: what is the purpose of the caret in this (def ^:dynamic v 1) ; v is a global binding (from http://java.ociweb.com/mark/clojure/article.html)

22:10 `cbp: bufferloss: the caret is reader syntax to add metadata

22:10 bufferloss: in that case it makes that var have dynamic binding

22:11 bufferloss: which can be exploited with the special form

22:11 "binding"

22:56 dissipate: what the heck. this timed out 'try clojure': (repeat (seq "abcdefghijklmnopqrstuvwxyz"))

22:57 bja: realized that I'm slowly accruing clojure.core but for python

22:57 dissipate: bja, accuring?

22:58 bja: gaining

22:58 dissipate: bja, what does this have to do with python?

22:59 bja: I was saying that I've been adding a bunch of python versions for various clojure.core functions

22:59 dissipate: bja, that sounds nasty

23:00 bja: get-in, assoc-in, dissoc-in, update-in are really addictive

23:00 particularly when dealing with a bunch of json

23:00 merge_with was also necessary

23:03 dissipate: bja do you know why (repeat (seq "abcdefghijklmnopqrstuvwxyz")) times out the repl?

23:07 gfredericks: it's infinite

23:08 takes a while to print

23:08 dsrx: ,(doc repeat)

23:08 clojurebot: "([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."

23:08 dissipate: gfredericks, but it's lazy, right?

23:08 gfredericks: yeah but the repl is trying to print it

23:08 dissipate: gfredericks, the repl is trying to take infinity from it? that's crazy

23:09 gfredericks: no, it's printing the elements one at a time

23:09 bja: dissipate, compare (range)

23:10 (which will also try to print the natural numbers and is unlikely to return)

23:12 dissipate: gfredericks, i see. i just did 'take 5' on it, and it returned.

23:13 gfredericks: yep

Logging service provided by n01se.net