#clojure logs

2014-03-09

00:17sritchiedsrx: still around?
00:17dsrxsritchie: yeah
00:17sritchiedsrx: 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
00:17sritchiejar*
00:17sritchieor if you build an uberjar
00:18sritchiedsrx: 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
00:18dsrxahh, I see
00:18sritchiedsrx: you see it with logging libraries too
00:18sritchieslf4j, etc, where you want to include your own backend, but not force it on the user
00:18dsrxso if my project were to depend on cascalog but not on hadoop, leiningen would complain?
00:19sritchiedsrx: yeah, you wouldn't be able to run queries
00:19sritchiewell, locally
00:19dsrxwell I could see there being a runtime exception about a class not being on the classpath
00:19sritchiedsrx: yeah, you're right, you'd see failures from the imports, I think
00:19sritchiewhen you tried to run the repl and JIT compile the cascalog namespaces
00:20logic_progif I'm making a product for college students, should I charge $9.99 / month or $29.99 / month?
00:20logic_prog$29.99 seems so much more expensive than $9.99 though it's only 3 times
00:20dsrxthat depends on what the product is of course
00:21logic_progit should increase their study efficiency by 25%
00:21muhoohave any studies showing that result? :-)
00:21segmondI'm looking for a pair programming partner, I'll host the session.
00:21logic_progno
00:21dsrxsritchie: thanks for the help!
00:21sritchiefor sure, good luck! The dependency thing is some serious JVM madness
00:21dsrxlogic_prog: fwiw the only recurring monthly service i paid for (besides utilities) in college was netflix @ 8.99/mo or so
00:21dsrxmy budget couldn't accomodate anything else
00:21sritchielogic_prog: yeah, easier to pitch it lumped in w/ textbook purchase, etc
00:22sritchieas a one time semester purchase
00:22isaacbwanyone have some GSoC ideas aside from what's in the ideas page?
00:22muhoowth does #= do?
00:22muhoooh, nm, some super-secret deprecated reader macro
00:22muhooread-eval
00:23dissipateruzu, is there one for python?
00:25logic_progoh shit
00:25logic_progI'm in #clojure, and not #startups
00:25muhoocontext https://github.com/alandipert/enduro/blob/master/src/alandipert/enduro/pgsql.clj#28
00:26muhoologic_prog: haha, didn't know there was a #startups. must check it out some time
00:26dissipatelogic_prog, i thought they were the same channel. :P
00:26dissipatemuhoo, if someone announces in there that they went public, do they get kicked out?
00:27dissipateisaacbw, i have one. are you interested?
00:28isaacbwdissipate: yes!
00:28muhoohuh, first time i've seen a defn inside of a let
01:01arrdemanyone tried using org-babel to write a large(ish) clojure project?
01:02arrdemI'm just staring at four files with > 50 line comments each and thinking that I'm using the wrong major mode :P
01:06sritchiearrdem: I've done it for a large scala project, when I was still at twitter
01:06sritchiearrdem: I think in Clojure the repl / namespacing story would confuse me
01:08arrdemsritchie: 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.
01:29mildfate1If I only need to test one condition, should I use "when" instead of "cond"
01:29bob2seems simpler
01:30arrdemmildfate1: if you only have one clause, yes
01:30arrdemmildfate1: (if (condition) (case-code)) is also discuraged
01:31arrdemmildfate1: (cond (condition) (case-const) (case-expr)) would be very frowned on
01:31mildfate1ok
01:32arrdemnote that we have both (when) and (when-not) to help with exactly this.
01:32arrdemtechnically they both come down to (if) but that's not the point. readability is the point.
01:32mildfate1arrdem: 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?
01:33bob2perhaps you wanted filter insted?
01:34arrdemmildfate1: 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.
01:34mildfate1bob2: You may be right, but I get java.lang.Boolean cannot be cast to clojure.lang.IFn just from replacing "when" with "filter"
01:35dsrx,(doc filter)
01:35clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
01:35bob2it's not a drop in replacement
01:36mildfate1the way I'm doing it now is (remove nil? (my-double-list-comprehension))
01:36mildfate1I guess I'll stick with the when funciton
01:37scottjmildfate1: maybe :when in for might help
01:37mildfate1scottj: what are those keywords prefixed with colons? I've seen them around.
01:37arrdemmildfate1: they're called keywords :P
01:37arrdem,(type :foo)
01:37clojurebotclojure.lang.Keyword
01:37arrdem,(:foo {:foo 3})
01:37clojurebot3
01:38scottjmildfate1: what does my-double-list-comprehension look like?
01:38dsrxmight be referring to namespaced keywords
01:38scottj,(for [x (range 2) :when (not= x 1)] x)
01:38clojurebot(0)
01:39mildfate1(for [el lists rank (range 1 (inc n))]
01:39mildfate1 (when (test? el rank) (conj el rank)))
01:39mildfate1should I be using :when?
01:40scottjshould? I don't know. can? I think so :)
01:40arrdemscottj: I think that "should" is entirely appropriate here :P
01:40mildfate1scottj: If I use ":when" instead of "when" I get the wrong answer
01:41arrdemmildfate1: you need to use it like this
01:41scottjmildfate1: show us the code
01:41arrdemmildfate1: (for [el lists rank (range 1 (inc n)) :when test? el rank)] (conj el rank))
01:42arrdemscottj: lets see if he understood that it needs to be a keyword arguemnt to for first..
01:42arrdemscottj: given that he didn't know keywords that may be the easy fix
01:42arrdem,(doc for)
01:42clojurebot"([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 ...], ...
01:42arrdemeh truncated out :c
01:43scottjarrdem's code above is missing a paren after :when I think
01:43mildfate1yea, the parens aren't matched
01:43scottjarrdem: yeah, my guess was he was using "] (:when ..." (i.e. replacing when with :when)
01:43arrdemscottj: maybe... I'm live coding in irssi, too lazy to fire up erc atm
01:44scottjarrdem: I'm using irssi, which is why I let you do the hard part :)
01:44mildfate1scottj: That's what I have
01:44mildfate1should :when be inside the sqaure brackets?
01:44arrdemscottj: high five sshing into a connection holding machine :P
01:44arrdemmildfate1: yes
01:45arrdemmildfate1: for interprets all :when arguments to be conditions on which to execute the list comprehension expression
01:45arrdemmildfate1: so here you can promote that check into the (for) and eliminate nil values :D
01:45arrdems/eliminate/escape/g
01:46mildfate1for requires an even number of forms in binding vector
01:46scottjmildfate1: :when test = 2
01:47mildfate1what's a binding vector?
01:47scottjmildfate1: maybe share your code if it's still not working
01:47scottj(for [I am a binding vector] ...)
01:47scottj(let [same here] ...)
01:47mildfate1(for [el lists rank (range 1 (inc n)) (:when test? el rank)] (conj el rank))
01:48arrdemhttps://www.refheap.com/54942
01:48scottjreplace (:when...) with :when (test...)
01:48mildfate1ah!
01:48mildfate1works
01:48mildfate1thanks a lot!!
01:49scottjmildfate1: are you/have you read a book on clojure?
01:49mildfate1scottj: No, I just started coding. the docs are pretty nice though, sometimes I (obviously) get confused
01:50arrdem:c docs
01:50arrdem+1 Joy Of Clojure
01:50bob2it's "clojure tutorial" is one chapter, though
01:50bob2"programming clojure" is very good and thorough also
01:52mildfate1while 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
01:54mildfate1or is it way too hard to read?
01:54bob2what's it do, in english
01:55mildfate1It returns true if rank is allowed to be added to the list
01:56mildfate1depending on the test? function which takes 4 arguments
03:00arrdemsorry, can't comment without more context. refheap please.
03:03arrdemI can say that this is very awkward code, but how exactly to make it better is hard to say.
03:03scottjmildfate1: 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.
03:04mildfate1arrdem: https://www.refheap.com/1a9f9e3af66f19e9ddfedf68f
03:05mildfate1scottj: 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
03:06mildfate1but in order to get the actual values of the points, I need map-indexed
03:06mildfate1(since without it, I only have y-values)
03:11ddellacostamildfate1: what does query-y look like? I'm having trouble de-constructing it from the code.
03:11ddellacostamildfate1: er, both args I should say
03:12mildfate1ys is a list of numbers (y-coordinates) and query-y is a number (a possible y-coordinate to add to the list)
03:13ddellacostamildfate1: what is the criteria for query-y being added to the list?
03:13arrdemmildfate1: lookig at this I think you have your point addition criterion wrong...
03:13scottjmildfate1: maybe this for your first version https://www.refheap.com/54945
03:14mildfate1This 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
03:14arrdemmildfate1: is sharing the same X as the _last_ element really the goal
03:14mildfate1(so addable? will always be true)
03:15ddellacostamildfate1: so, based on your English description, you need to figure out if the passed in value matches any of the values in a list?
03:16arrdemhttps://www.refheap.com/54946
03:17arrdem(range) isn't inclusive so this can _never_ return true... (inc (max (range N))) << (inc N)
03:22ddellacostaarrdem: aren't the two :when clauses going to match on one or the other, rather than both (or vs. and)?
03:23arrdemddellacosta: it is my understanding that the two whens will function as an and. no testing was done. an (and) could be used :P
03:24ddellacosta,(for [i (range 0 10) j (range 0 10) :when (= i 2) :when (or (= j 1) (= j 2))] "foo")
03:24clojurebot("foo" "foo")
03:24ddellacostahmm, maybe that's not a good test
03:25arrdem,(for [i (range 0 10) j (range 0 10) :when (= i 2) :when (or (= j 1) (= j 2))] [i j "foo"])
03:25clojurebot([2 1 "foo"] [2 2 "foo"])
03:25arrdemddellacosta: seeks good to me...
03:26mildfate1arrdem: here's how I've modified it with your helpful code https://www.refheap.com/e7acd5f5273d1671def253409
03:26ddellacostaarrdem: yeah, I think I misunderstood the semantics of for, nevermind...
03:29arrdemmildfate1: okay. so I'm gonna be harsh here. your "point equality" function isn't needed to implement this according to your specification.
03:29arrdem,(bool [])
03:29mildfate1arrdem: You're right, from what you've seen, it's not necessary
03:29clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: bool in this context, compiling:(NO_SOURCE_PATH:0:0)>
03:29mildfate1arrdem: But the eq-point? method has other checks that I didn't include
03:29arrdemI don't even care.
03:30arrdemyour code is messy. you don't show me enough to give comment. I'm done.
03:30mildfate1It's still messy? I thought it was looking better :(
03:32arrdemI wouldn't say that second paste is at all materially better than the first one tbh.
03:33mildfate1is it the apply and partial functions?
03:33arrdemhttps://www.refheap.com/54951
03:33arrdemthe partial is OK... you can get away without it tho.
03:33amalloyi wouldn't say yours is any better than his, arrdem :P
03:34mildfate1never seen that guy before (->>)
03:34arrdemthis does exactly that... https://www.refheap.com/54952
03:34arrdemamalloy: really? I'll stfu then.
03:36amalloyi think https://www.refheap.com/9b689c91cf82cb3451fe3fb0b should be equivalent, right?
03:36amalloyor at least close, up to my eta-reducing incorrectly
03:36arrdemmildfate1: so ->> is thread-last. writing (->> e (f a) (g b (h c)) is (h c (g b (f a e)))
03:36amalloyoh, and i forgot the second arg to keep-indexed
03:38arrdem,(doc keep-indexed)
03:38clojurebot"([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."
03:39arrdemtotally didn't know that was a thing..
03:39amalloyoh yeah, it's non-nil. so i guess you need to have eq-point? return nil instead of false
03:39amalloyor do some other thing, whatever
03:40amalloyreally not-any? false? and map-indexed is probably better
03:40arrdemyeah I'll go with amalloy's solution over mine due to the way you're chaining the x coordinate to the index..
03:40mildfate1amalloy: You're saying my solution?
03:41amalloywell, without that partial
03:41mildfate1How did you get around the partial?
03:41amalloywell, (apply (partial f x y) z) => (apply f x y z)
03:41amalloybut also i'd do the computation inside map-indexed, so that there's no vector to apply to anyway
03:41mildfate1riiiight
03:42mildfate1I see it, it's in the actual function passed to map
03:42amalloyamusingly, (every? false? xs) is the same as (apply = false xs)
03:42amalloyi'd prefer the version with every?, but it's a cute trick
03:44arrdem(inc amalloy) ;; karma too low
03:44lazybot⇒ 88
03:55mildfate1If I wanted to do something like: (f n (f n (f n [base-case]))) would I use comp?
04:05scottj(nth (iterate (partial f n) base-case) 2), maybe
04:05amalloyprobably 3, not 2, but yeah
04:06noonian,(doc iterate)
04:06clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
04:25sverihi, 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?
04:27bob2sveri, select-keys
04:27amalloy$findfn {;a 1 :b 2} [:a] {:a 1}
04:27lazybot[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
04:27amalloyoh haha, i commented it. silly lazybot
04:27amalloy$findfn {:a 1 :b 2} [:a] {:a 1}
04:28lazybot[clojure.core/select-keys]
04:28bob2woah
04:29sveribob2: thanks, thats what i was looking for
04:29sveriamalloy: that clojure bot is awesome
08:58PupenoAnybody using quil?
11:06igorwis there a way to do a negative membero in core.logic? to ensure that an item is *not* a member of a list
11:24hyPiRionigorw: define it as you would implement membero, but use != instead of == to match?
11:53romain_p__Hi everyone, is there a lib like Gambit (cljs CES) but available on clojars and maintained?
12:00igorwhyPiRion: figured it out, thanks!
12:18benmosshm, does anyone have a keybinding for vim-fireplace that copies an eval onto the copy buffer?
12:29ambrosebsbenmoss: are you aware of :Last
12:29benmossno, or if i was i forgot about it
12:29benmossthanks, thats close enough
12:29benmossthough becoming more handy with "c!!" is also pretty close
12:46pepijndevosIs there any good reason for using symbols instead of keyword in core.logic, or is it simply a leftover from scheme?
12:52ambrosebspepijndevos: I can't think of any.
12:52pepijndevosok
12:53pepijndevosThen I'll use kewords, it feels less abusive.
12:55seangrovebbloom: Still primitive, something special about composable components https://www.dropbox.com/s/hhyr2qp6p7c5ubp/zenrise_prev_1.mov
12:55pepijndevoshmm, i keep forgetting using conde contributes additional, but sometimes identical results.
12:55pepijndevosBut forgot what to do about it :D
12:55bbloomseangrove: awesome. making good progress
12:56seangrovebbloom: Some interesting problems around mapping the tree of components to the app state. Think I'm almost there
12:56bbloomseangrove: mmmmm real layout
12:57seangrovebbloom: Yeah, a crazy world we live in, huh?
12:57seangrove"We can do layout in the browser now!"
12:58pepijndevosseangrove, wait, what have I missed? Layout in the browser?
12:58seangrovepepijndevos: Flexbox + proper components, that's all
12:58pepijndevosI did find this gcss thing the other day, basically porting iOS autolayout to JS.
13:00seangrovepepijndevos: Where is it?
13:01pepijndevosseangrove, googling grid css doesn;t work, right? uuuhm, searching...
13:02pepijndevosseangrove, ah! http://gridstylesheets.org/
13:04seangrovepepijndevos: Pretty cool, thanks. Wonder how it interacts with React
13:04pepijndevosonly one way to find out...
13:04pepijndevosWould react/om questions be on-topic here? I havn't figured that thing out yet.
13:05seangrovepepijndevos: probably
13:06pepijndevosI'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:07pepijndevosSo 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:07pepijndevosThis seems to be a model related thing.
13:08seangrovepepijndevos: There's only one-way binding in React/Om
13:09pepijndevosIn other word, forms are still a pain?
13:10FrozenlockWait, who's making the template thingy?
13:10seangrovepepijndevos: 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:10Frozenlock(my irc bugged out)
13:10rebcabin,(+ 42 0)
13:10clojurebot42
13:11seangrovepepijndevos: Forms havn't been a pain at all, actually
13:12pepijndevosIs it comon to combine Om with a model library?
13:13pepijndevosI 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:13pepijndevosWhat is owner in that snippet?
13:15seangrovepepijndevos: Are you developing in cljs or js?
13:15pepijndevosjs+angular at the moment. mainly asking for future projects.
13:16seangrovepepijndevos: 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:16pepijndevosWill do.
13:17FrozenlockI still find this much easier http://holmsand.github.io/reagent/
13:17FrozenlockTho I'm sure this is going to bite me in the ass in the future...
13:17seangroveFrozenlock: Yeah, different approaches
13:19Frozenlockseangrove: Do you know what's mainly different under the hood?
13:21seangroveFrozenlock: 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:21Frozenlockthe cljs mailing list?
13:22seangroveFrozenlock: Yeah, I'll grab the thread in a second
13:28seangroveFrozenlock: https://groups.google.com/forum/#!topic/clojurescript/o9CqGss_HC4
13:29Frozenlockseangrove: thanks!
13:31isaacbwanyone know how to get in contact with Mike Anderson? (about GSoC)
13:33seangroveisaacbw: He's on the ML, you can get his email from there
13:34isaacbwawesome, thanks
13:37FrozenlockBtw, 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:38seangroveFrozenlock: Oh, pretty nice
13:38isaacbwseangrove: mikera?
13:39seangroveisaacbw: Yeah
13:39isaacbwhuh... his email is hidden. I guess I can reply directly to him from one of his posts
13:41isaacbwanyone else here thinking about doing the GPU core.matrix for GSoC?
13:43seangroveisaacbw: Or just send an email to the group asking for instructions
14:17isaacbwoh man, excited about this GPU idea
14:17isaacbwI hope no one has talked to Mike about it yet :P
14:18ambrosebsisaacbw: fwiw multiple students can work on the same project
14:19ambrosebsisaacbw: independently
14:19isaacbwah, okay!
14:19isaacbwin that case, it might be fun to have someone else to work with
14:20ambrosebsit's possible, but maybe not for Clojure since we might not get so many slots play with
14:20ambrosebsjust make an enthusiastic impression and I'm sure you'll be fine :)
14:21ambrosebslast year Python got around 30 projects, some duplicates. We got 7
14:21isaacbwheh
14:22isaacbwI really don't enjoy python. I use it occasionally for its scientific ecosystem
14:22isaacbwbut the language itself leaves me wanting
14:23isaacbwhmm, is there anything like matplotlib for clojure?
14:24rebcabinincanter may have some R-like plotting, dunno
14:26isaacbwI'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:26isaacbw(I picked neo4j so I would have leverage to convince him to let me use clojure)
14:26rebcabin@isaacbw incanter does have some plotting http://data-sorcery.org/2010/04/04/new-chart-theme
14:26isaacbwit would be awesome if I could do more with clojure, rather than having to write some things (like plots) with python
14:26isaacbwah, cool, I'll take a look
14:29benmossi 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:29benmossthe redundancy part is what bothers me, but i don't know what a good alternative would be
14:31benmossbeing able to look up based on position is obviously important, but then the value still needs to know its position as well
14:31Frozenlockbenmoss: 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:32benmossright now its just deal with the redundancy
14:32gfredericksthe value needs to know its position?
14:33gfrederickswhy?
14:33clojurebotwhy not?
14:33benmossexactly clojurebot
14:33benmossi pass the value around as a "square", and want to be able to calculate the moves for the piece on that square
14:35benmossyeah 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:35gfredericksI think it's easier to just pass around the pieces of data that are needed
14:35gfredericksso if you want to compute the moves for a piece
14:35benmossi guess this would just be a vector if i didn't need efficient access
14:36gfredericksyou have a function that needs to know A) what does the board look like, and B) what piece are we talking about
14:36gfrederickshttps://github.com/fredericksgary/chess-clj/blob/master/src/com/gfredericks/chess/rules.clj#L111
14:36gfrederickswhen I did this I passed in the board, the piece, the color, and the square
14:36clojurebotGabh mo leithscéal?
14:36gfrederickseven though some of that was redundant
14:36mskoudhi
14:37gfredericksbenmoss: 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:37gfredericksthat's contextual; the piece just knows what kind of piece it is
14:37benmossthe piece is embedded in the square
14:38benmossbut maybe same difference
14:38gfredericksfrom the board's perspective
14:38gfredericksthe board is a data structure that knows where the pieces are
14:38benmossyeah
14:38mskoudhaving 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:38gfredericksmskoud: fx?
14:39gfredericksbenmoss: let the board be responsible for matching pieces to squares; the pieces themselves don't need to
14:39broquaintmskoud: update-in?
14:39mskoudi need x changed so fx :name is "Z" in the map with id: 2...
14:39benmossyeah, i gotcha gfredericks
14:39benmossthankas
14:39benmossthanks*
14:39gfredericksnp
14:40mskoudupdate-in... will try
14:40broquaintAre chess rules describable with the likes of core.logic?
14:40benmosscan't use update-in because you've got vectors
14:40benmossor rather
14:41benmossyou'd have to resupply the whole vector if you wanted to use update-in
14:41mskoudok...
14:41gfredericksbroquaint: I tried that once; the sticky part was expressing negatives, specifically wrt check
14:42broquaintgfredericks: Aha, interesting.
14:42benmossgfredericks: does your chess game not take into account history for things like en passant and castling?
14:43gfredericksbenmoss: that's part of the position
14:43gfredericksthe position data structure contains the board, whose turn it is, castling+en-passant
14:43gfredericksI even rigged it up to print with FEN notation
14:43gfredericks#chess/fen "..."
14:44benmossi've found that to be one of the more annoying features of chess
14:44benmosswhen implementing it anyway
14:44gfredericksI started playing Go instead because it isn't such a pile of arbitrary rules
14:45benmossyeah, i was saying to someone recently Go is definitely the lisp of board games
14:45gfredericksI think I have a tweet to that effect
14:46gfredericksbut it cannot be foudn
14:46gfredericksspeaking of go, go.davepeck.org is the shit
14:46benmossluckily they had not read that tweet
14:50gfredericksbroquaint: 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:50gfredericksI think I had everything but castling+en-passant described accurately
14:50gfredericksI 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:53broquaintThat's a shame, but interesting to hear it was possible, bring on the optimizations necessary for this sort of thing :)
14:54gfredericksyeah I kept wondering if the core.logic extension points would allow for some much more optimal data structures or something
14:54gfredericksI don't think I was clever enough to determine one way or another
14:54gfredericksbut using nested lists to represent the board seemed terrible
15:13Joe_________hey, im just starting clojure in school and I was wondering if anyone could guide me in reading through some code
15:15bbloom~anyone
15:15clojurebotanyone is anybody
15:15bbloom~anybody
15:15clojurebotanybody is anyone
15:15bbloom*sigh*
15:15gfredericks(inc clojurebot)
15:15lazybot⇒ 33
15:16bbloom~anybody
15:16clojurebotanybody is anyone
15:16gfredericks~anyone
15:16bbloom~anybody
15:16clojurebotJust 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:16clojurebotJust 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:16bbloomthere we go dammit lol
15:16bbloomJoe_________: ^^
15:16gfredericks3rd & 4th times are the charm
15:17amalloyclojurebot: forget anyone |is| anybody
15:17clojurebotI forgot that anyone is anybody
15:18amalloyclojurebot: forget anybody |is| anyone
15:18clojurebotI forgot that anybody is anyone
15:18bbloomamalloy: thanks
15:18amalloypoor guy sounds like he doesn't remember anything anymore
15:18bbloomha
15:18jebberjebJoe_________: where are you learning Clojure in school?
15:19Joe_________i'm learning it on the east cost
15:19amalloybbloom: sadly my ~forget seems to have no impact
15:19bbloomamalloy: nothing is ever forgotten.
15:19jebberjebwhere on the east coast
15:20amalloyhiredman: 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:21firefauxis 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:21Joe_________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:22firefauxI pretty much followed suit from what clojure's PersistentTreeMap did
15:22amalloyJoe_________: (range k), not range(k)
15:22Joe_________oh whoops, that was a mistype
15:22firefauxwriting too much python? :P
15:22gfredericksJoe_________: vi would be an element of v
15:23amalloyfirefaux: 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:23firefauxamalloy: that's what I figured. Would there be any purpose to using <Object> for generics?
15:23firefauxwould that even make it stop complaining?
15:23amalloyno, that would be silly
15:23Joe_________ohh, that makes sense. I'm kind of confused as to how that works though.
15:24amalloyyou can put @SuppressWarnings("unchcked") before the class definition, too
15:24gfredericksJoe_________: ##([:a :b :c] 1)
15:24lazybot⇒ :b
15:24firefauxyeah, I know it's pointless
15:24gfredericksJoe_________: what part in particular is confusing?
15:24firefauxmaybe I'll do that
15:24amalloyer, "unchecked"
15:24firefauxright
15:25Joe_________In general, if I have a vector v, and a index i do I access its elements with (v i)
15:25Joe_________I thought that parentheses denoted a list?
15:25gfredericksthe parentheses are a function call
15:25gfrederickssyntactically they are a list, but that's kind of a different level
15:25firefauxthey only denote a list if they're quoted
15:26firefauxI still don't understand when that's acceptable in clojure, though
15:26firefauxin my experience basically never
15:26firefauxcommon lisp is a different story...
15:26firefauxdoes anyone here ever use quoted lists?
15:26firefauxand not just vectors?
15:27Joe_________Hmm, I don't understand how that is a function call. And thank you for the explanation on parenthesis fire and frederick.
15:28firefauxin 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:29firefauxor at least that's my basic understanding of how it works
15:29amalloyfirefaux: yes, although s/reader/compiler
15:29firefauxif you "quote" the list (e.g. '(1 2 3)), then it takes the list as-is, without evaluating
15:30Joe_________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:30amalloyJoe_________: yes
15:30amalloyvectors, when called as functions, look up in themselves
15:30firefauxyes, all of clojure's data structures are also functions
15:30Joe_________Oh, I that makes so much more sense now.
15:30firefauxand their arguments are either the keys, indices, or whatever else the data structure uses to look up a value
15:30amalloyfirefaux: that's quite a reach. most sequences aren't functions; it's just vectors, maps, and sets that are
15:31firefauxhmm, I guess you're right
15:31firefauxforgot about sequences in general
15:31firefauxdo literal lists work as functions? lets find out
15:31firefaux,('(1 2 3) 0)
15:31clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>
15:31firefauxnope
15:32firefaux,([1 2 3] 0)
15:32clojurebot1
15:33Joe_________Thanks for all the help guys. I get the code now.
15:33amalloyJoe_________: fwiw, that could be better written as (for [vi (take k v)] ...)
15:34amalloyi guess the `i` might be needed in the body of the `for`, but in that case you probably want map-indexed
15:35Joe_________Does map-indexed act like zip in python?
15:35amalloy(->> (take k v) (map-indexed (fn [i vi] ...)))
15:35amalloy~zip
15:35clojurebotzip 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:36Joe_________Ah, I'm learning all over the place today. What does ->> denote?
15:36bbloomJoe_________: for that sort of question, try the following in your repl:
15:36bbloom(doc ->>)
15:36clojurebot"([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:37Joe_________Ah okay. Thanks
15:37firefauxwait, clojure bot doesn't need you to put anything in front of your S-exps?
15:38bbloomfirefaux: doc is a special case
15:38firefauxah
15:38firefauxthought that might be it
15:52igorwhey folks, I made a relational turing machine with core.logic - probably there's a lot of room for improvement
15:52igorwhttps://gist.github.com/igorw/9449950
15:54igorwwould love to get any feedback at all, I hope this is the right place for such things
15:55TravisDWhat's a relational turing machine, out of curiosity
15:56igorwoh, the 'relational' was just referring to it being implemented on top of core.logic/miniKanren
15:57TravisDAh, cool. I don't know anything about core.logic
15:58TravisDDoes it provide resolution (I think that's what it's called) from prolog?
15:58hiredmanunification
15:58TravisDah
15:59mathiasxI 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:59hiredman,(System/currentTimeMillis)
15:59clojurebot1394395127405
16:00chouser,(java.util.Date.)
16:00clojurebot#inst "2014-03-09T19:59:32.582-00:00"
16:02mathiasxthank you
16:05chousermathiasx: hiredman's example will run much faster
16:07mathiasxIs there a reason why something like that isn't in core? Assumption that people will know the Java way of asking for it?
16:07bjamathiasx, that's a common assumption
16:08bjaclojure is expected to be extremely symbiotic with the host platform
16:08bjakinda bites you if you're a non-java guy looking to get into clojure, from say, python or rub
16:08bja*ruby
16:09mathiasxmakes sense
16:09mathiasxthanks for clarifying
16:12bbloomamalloy: 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:12bbloomwith a single predicate
16:12amalloywell, group-by
16:12bbloomamalloy: ah, duh. thanks
16:13amalloy(juxt filter remove) if you want
16:13bbloomgroup-by is perfect. just didn't occur to me b/c my key is a boolean
16:25gfredericks,((juxt filter remove) #(< (rand) 0.5) (range 10))
16:25clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval25/fn--26>
16:25trap_exithow do I generate "out/goog/base.js" ?
16:25trap_exit:optimizations :advanced doesn't seem to generate it
16:25gfredericks,((juxt filter remove) (fn [_] (< (rand) 0.5)) (range 10))
16:25clojurebot[(5 8) (0 2 3 4 5 ...)]
16:32hyPiRiongfredericks: woah, that probability seems unlikely to happen
16:32hyPiRion,((juxt filter remove) (fn [_] (< (rand) 0.5)) (range 10))
16:32clojurebot[(0 4 6 8) (3 6 7 8)]
16:32TravisDIt's really cool that you get duplicates in that code
16:33TravisDDangerous side effects!
16:35gfredericks,(->> (repeatedly 10 #(rand-int 10)) (sort))
16:35clojurebot(0 1 1 2 2 ...)
16:36gfredericksso weird that rand-int is based on floats
16:37TravisDgfredericks: why not write that as (sort (repeatedly 10 #(rand-int 10)))?
16:39gfrederickshabit
16:39TravisDI like how in your version it's clear that you're generating a random sequence, then sorting it
16:39TravisDthat's less clear in the other version
16:44TravisDDuring 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:44RuralClojureris there a way to salvage an emacs nrepl that's been mistakenly blocked by core.async?
16:44chouserRuralClojurer: Have you tried nrepl-interrupt?
16:45RuralClojurerthanks, worked!
16:48amalloyTravisD: too broad: f1 produces partial results from infinite sequences, where f2 doesn't
16:48TravisDah
16:48amalloyis the thing that occurs to me first as an answer to that question
16:48TravisDyeah, that's right
16:48TravisDcould fix the collection, I guess
16:48TravisDand then you should also force f1 to evaluate the lazy seqs
16:56amalloyoh, and also the ordering of f2 isn't guaranteed. it might act like (juxt filter remove) or (just remove filter)
16:57TravisDah, yeah, I guess if the predicate is pure then the result would be the same (aside from the swapping)
17:18seangrovednolen_: 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:58bbloomhttps://github.com/brandonbloom/eclj <- latest little thing i'm hacking on :-)
17:59seangrovebbloom: Sounds pretty interesting. Meant to be used for production-level stuff at some point, or just experimentation?
18:00bbloomseangrove: i guess you'd be able to use it for jail-ing purposes, but it would be pretty slow
18:01bbloomseangrove: otherwise, it's experimenting for a super evil master secret plan i've got in the works
18:01steckerhalteris there `map` that also acts as `filter`?
18:02amalloy&(doc keep)
18:02lazybot⇒ "([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:02steckerhalteramalloy: thanks
18:04Bronsabbloom: https://github.com/brandonbloom/eclj/blob/master/src/eclj/core.clj#L264-L265 actually records don't implement IFn
18:04bbloomBronsa: heh, well perfect then :-)
18:05bbloomBronsa: https://github.com/brandonbloom/eclj/commit/e6f93ad4de4d5d10c2ab869c70afcbaf25c2bf3c
18:06Bronsahah
18:07bbloomseangrove: I wanna try to implement a symbolic predicate dispatch system
18:08bbloomif the eval function was an open predicate dispatch system, abstract interpretation based analysis would be a trivial extension
18:09bbloomBronsa: how many people do you think have suffered through parsing fn-tails ? :-/
18:09amalloybbloom: 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:09amalloyoh, Bronsa already said that. i'm behind
18:09bbloomhaha
18:15gfredericksKEYNOTE TBD
18:19Bronsabbloom: you mean parsing (fn* STUFF)? yeah, that's not fun
18:50alewis there a way to declare records like you can declare functions using (declare a b)?
19:05TravisDalew: 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:09bufferlossis incanter on topic in here?
19:09TravisDbufferloss: I believe so
19:10bufferlossaight cool thx
19:15bufferlosswhat should I know about starting a new clojure project?
19:15bufferlossshould I use leinengen or something else?
19:15isaacbwuse lein
19:16bufferlossdo I need a JDK or just Java?
19:17bufferlossdo I need to have clojure on my PATH to run leinengen?
19:17TravisDI believe that you need a java compiler for various things, so it's probably a good idea to install the JDK
19:17TravisDleiningen will install clojure for you
19:18bufferlossah ok cool
19:18TravisDbufferloss: As far as incanter goes, lein will also download and manage your dependencies. It's all very nice
19:19alewTravisD: the record types have functions that do some verification and that requires type checking
19:19alewTravisD: the type checks are using other record types
19:21TravisDalew: Ah. I guess you could use extendtype to provide implementations of those type checking methods after the records have been defined
19:21TravisDextend-type
19:21bufferlossyikes, lein help tutorial just spits out a ton of markdown, is it supposed to open something for that?
19:22TravisDbufferloss: I followed the tutorial online, available here: https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md
19:22alewTravisD: yeah, that works, but I thought having a forward decleration would make it cleaner
19:22bufferlossah great, thanks
19:23TravisDalew: Yeah, I see. Sorry, I don't know the answer :(
19:24TravisDbufferloss: I also notice that the lein github page indicates that you must have a java JDK version 6 or later
19:24bufferlossk
19:25bufferlossthx, I'll make sure I do, I probably do
19:30benmossif you install the markdown binary and http://rtomayko.github.io/bcat/, `lein help tutorial | markdown | bcat` works
19:30benmoss:)
19:31benmossexecutable i mean
19:35benmossdamn bcat is pretty awesome in general
19:38bufferlosshow do I set my namespace in project.clj
19:39bufferlossI 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:43rebcabin@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:45rebcabintry "lein help run"
19:45bufferlossk
19:46gfrederickslet's say I wanted, in hiccup, to create a link that POSTs to some url, presumably backed by a <form> or something
19:46gfrederickswhat library would I want to be using to help me assemble this?
19:47gfredericksthis hypothetical is actually based on a true story, because in fact that's exactly what I want to do right this minute
19:48rebcabin@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:49rebcabinbut you will have a LOT more fun in lein repl :)
19:49rebcabinalso consider LightTable for building up your code
19:49rebcabinthen transfer to project once solid
19:50rebcabinsort of like prebugging your code or doing ephemeral TDD
19:54danielszmulewiczI get the impression that pre- and post-conditions are not often used. Am I wrong?
19:55rebcabin@danielszmulewicz take a look at https://github.com/clojure/core.contracts
19:55danielszmulewiczWhat's the current practice to do sanity checking on input parameters without resorting to core.typed?
19:55danielszmulewiczrebcabin: thanks
19:55rebcabinI've used in production code
19:56danielszmulewiczrebcabin: I'm looking for something built-in for the moment...
19:57gfredericksclojurebot: core.typed is something you resort to
19:57clojurebotIn Ordnung
19:57danielszmulewiczrebcabin: No dependencies. Just some idiomatic Clojure checks.
19:57gfredericksdanielszmulewicz: I think pre/post is fine for checking for programmer errors
19:57gfredericksnot fine for validating external stuff
19:57danielszmulewiczgfredericks: I see. Thanks.
19:58gfredericksfor libraries it'd be nicer if there were customizable error messages
19:58rebcabin@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:58gfredericksbut other than that I don't know of any downsides
19:58danielszmulewiczI don't see much pre/post in the wild, I was wondering whY.
19:59gfredericksit might not occur to people
19:59danielszmulewiczCurrent use case is to make sure that fns are called with correct params.
20:00seangrove,(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:00clojurebot{:coms [{:zr-com-data {:sub-coms [{:a {0 {0 {:p "hi"}}}}]}}]}
20:00seangroveIs there a way to get that to be {:coms [{:zr-com-data {:sub-coms [{:a [[{:p "hi"}]]}]}}]} instead?
20:00gfredericksseangrove: wooah
20:00gfredericks,(assoc [] 0 :foo)
20:00clojurebot[:foo]
20:00gfredericks,(assoc-in {:foo []} [:foo 0] 12)
20:01clojurebot{:foo [12]}
20:01gfredericks,(assoc-in {:foo []} [:foo 0 :hooha] 12)
20:01clojurebot{:foo [{:hooha 12}]}
20:01seangroveHeh, but...
20:01gfrederickswhat's the minimal case here?
20:01seangrove,(assoc-in {:foo []} [:foo 0 :hooha 0] 12)
20:01clojurebot{:foo [{:hooha {0 12}}]}
20:02gfredericksoooooh
20:02seangroveThe terminal 0 there is added as a hashmap, rather that a vector offset
20:02gfredericksrighto
20:02gfrederickswe're talking about new data structures
20:02gfredericksinteresting
20:02gfredericksI know you could rewrite assoc-in to use vectors when creating a new thing with integer keys
20:03gfredericksheck you'd have to special case on 0 in particular probably
20:03gfredericksI think that's your only option...
20:03seangrove(doc assoc-in)
20:03clojurebot"([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:03seangroveYeah, "hash-maps will be created". Bummer
20:03gfredericksit'd be weird if it did anything different
20:03seangrovegfredericks: 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:04seangroveI'll take a nap and revisit it
20:04gfredericks,(source assoc-in)
20:04clojurebotSource not found\n
20:05gfredericks,(clojure.repl/source assoc-in)
20:05clojurebotSource not found\n
20:05gfredericksit's super-short you could patch it in 20 seconds
20:05bufferlossok 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:06gfredericksbufferloss: are you trying to use clojure.java.jdbc?
20:06bufferlossgfredericks, 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:07seangrovegfredericks: Yeah, there's assoc-in-idx on clojuredocs, might work
20:07gfredericksbufferloss: "I've always" -- does that mean from java?
20:07bufferlossyeah from java
20:08gfredericksso you're planning on using java interop to do JDBC things?
20:08bufferlosssorry, I'm pretty much 100% new to clojure, but I've worked with JDBC in Java before, rather extensively
20:08bufferlossI've also done ruby/python/PHP/C++/JavaScript/you-name-it-almost
20:08gfredericksare you familiar with how java interop works yet?
20:08bufferlossgfredericks, nope, I'm not familiar with Java interop
20:09bufferlossI just want to access postgres from clojure, whatever is the best way to do that, I'll use
20:09gfredericksokay; 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:09bufferlossit doesn't need to be JDBC if there's something else available
20:09gfredericksclojure.java.jdbc is a library that provides a clojure-oriented interface to JDBC
20:09bufferlossgfredericks, do you mean "java interoperability" in the general sense?
20:09gfredericksbufferloss: no "java interop" is a specific set of clojure features
20:09bufferlossaight what would a dep line for that look like in project.clj
20:09bufferlossok
20:10bufferlossnevermind I see on the github
20:10`cbpbufferloss: you can find some examples in clojure wikibooks that you can find by googling clojure
20:10`cbpgoogling clojure + jdbc + examples*
20:12gfredericksbufferloss: "java interop" refers to clojure code that explicitly calls instance methods or class methods on jvm objects/classes
20:12bufferlossso 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:12gfredericksleiningen expands the shorter one to the longer one
20:12bufferlossis it better ore more appropriate to use the former? is there something wrong with the latter?
20:12bufferlossah ok
20:13gfredericksshort is fine
20:18gfredericksI'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:19bufferlossok sweet, I can connect and run queries with clojure.java.jdbc :)
20:19gfredericksbufferloss: excellent
20:21tolstoyHm. in Om (0.5.2) attempting to (om/get-props owner) inside a click handler gives me the "cannot manipulate cursor". Weird.
20:26gfredericksguys ClojureWest is brought to you by Staples and WalMart
20:27gfredericksI'm not quite sure what to conclude from that
20:27gfredericksdid this ever happen to a haskell conference?
20:28akhudekgfredericks: clojure actually gaining in enterprise?
20:29akagfredericks: lol
20:32pcnI conclude there is a module out there with an easy button in swing, and that pushing it will drive my wages down
21:09bufferlossok so now that I've gotten setup with a basic project that will query a postgres database and return results...
21:09bufferlosswhat might be a good tutorial to use to start learning about e.g. how to structure my code into modules/packages etc
21:10bufferlossbest practices for app structure and whatnot
21:11bufferlossnow that I can get data from the DB, the next goal is to process it with statistical analysis stuff like incanter
21:15bufferlossalso, lein repl takes quite a while to boot up
21:15bufferlosswhich 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:16bufferlossis 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:16arubinYes.
21:16arubinLet me see if I can remember the name of the project.
21:17arubinStarts with a g I believe...
21:18`cbphmm
21:18`cbpwhatever happpened to grench
21:18`cbpoh yeah
21:18`cbpbufferloss: maybe you can try this https://github.com/technomancy/grenchman
21:18arubinhttp://leiningen.org/grench.html
21:19arubinYeah.
21:19arubinThat is it.
21:22muhoogfredericks: well staples bought runa IIRC, which is how they ended up with clojure
21:22muhoodunno wat's up with walmart, but i'd bet on an acquisition
21:23seangrovemuhoo: Yeah, bit weird. I thought Walmart was mostly a node shop for new projects
21:23muhoobut 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:27bbloomgfredericks: that sounds fun :-P
21:30bufferlosswhy do the decimal() fields from my db say e.g. 18.5M (why the M?)
21:30gfredericks,(type 4M)
21:30clojurebotjava.math.BigDecimal
21:30bufferlossah, ok cool thanks
21:31gfredericksbbloom: I'd come prepared by grepping through my IRC logs
21:31seangrovegfredericks: 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:32gfredericksB. B. Loom
21:33indureHi - qq - from book JoC
21:33indure. (assoc {1 :int} 1.0 :float)
21:33seangrove.(assoc {1 :int} 1.0 :float)
21:33seangrove,(assoc {1 :int} 1.0 :float)
21:33clojurebot{1.0 :float, 1 :int}
21:34indure. (assoc (sorted-map 1 :int) 1.0 :float)
21:35indurewhy the difference ?
21:35indureI couldn't understand the explanation in the book
21:36indureThis 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:36indure??
21:36lazybotindure: What are you, crazy? Of course not!
21:36clojurebot? is !
21:36gfredericks,(assoc (sorted-map 1 :int) 1.0 :float)
21:37clojurebot{1 :float}
21:37seangroveThe bots are getting uppity
21:37gfredericks,(< 1 1.0)
21:37clojurebotfalse
21:37gfredericks,(<= 1 1.0)
21:37clojurebottrue
21:37vermaif a package in clojars is outdated, what is the recommended way to get the latest jar of it?
21:38gfredericksindure: that sentence is difficult to figure out; I actually didn't realize sorted-maps did this
21:38gfredericksbut I can see why
21:38gfrederickssorted 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:38gfredericksbut for hash-map equality and general equality, they are not equal
21:38gfredericks,(= 1 1.0)
21:38clojurebotfalse
21:39gfredericksthis is pretty edge-casey I think
21:39vermahmmm, may be I am fetching an incorrect version
21:39seangroveI think sorted-maps aren't exercised much in general
21:39gfrederickssometimes I suspect a programming language's utility is directly proportional to how terrible it is
21:40indureif (= 1 1.0) is false, map is being as expected, sorted-map is a surprise
21:40indure'/being/behaving/
21:40gfredericksindure: sorted map is behaving according to <=
21:40gfrederickswhich says that they are equal
21:40gfredericks,(let [=== #(and (<= %1 %2) (<= %2 %1))] (=== 1 1.0))
21:40clojurebottrue
21:41vermaah nice, had an older library version specified in project.clj :)
21:42induregfredericks: could lead to some strange bugs - coverting map to sorted map I mean
21:43gfredericksif you have a map with integers and floats as keys you already have some strange code
21:44indureagreed
21:45induregfredericks: thanks!
21:45hyPiRionIt is way better than the opposite problem
21:46hyPiRionI remember in 1.2, when (assoc {2 1} (denominator 1/2) :foo) returned {2 1, 2 :foo}.
21:46gfrederickscuzof BigInt?
21:46hyPiRiongfredericks: yessir
21:47gfredericksthose were the good ole days
21:47hyPiRionwhen you could do (+ a b) without being afraid of overflow
21:49indurehyPiRion: it still returns that in 1.5 - has that changed?
21:49indure1.5.1 I mean
21:50hyPiRionindure: it returns {2 :foo} for me
21:50seangrove,(assoc {2 1} (denominator 1/2) :foo)
21:50clojurebot{2 :foo}
21:50indureAh oh - typo - my mistake
21:51indureSo what happens here ? Type coercing?
21:51indureIf so, why not for sorted-maps
21:54hyPiRionthat's not type coercing, it's just that (= 2 2N) was false in 1.2 I think
21:58bbloomseangrove: gfredericks: i'll do my best to not become homeless while pursuing computational nirvana
22:06bufferlosswhat 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`cbpbufferloss: the caret is reader syntax to add metadata
22:10`cbpbufferloss: in that case it makes that var have dynamic binding
22:11`cbpbufferloss: which can be exploited with the special form
22:11`cbp"binding"
22:56dissipatewhat the heck. this timed out 'try clojure': (repeat (seq "abcdefghijklmnopqrstuvwxyz"))
22:57bjarealized that I'm slowly accruing clojure.core but for python
22:57dissipatebja, accuring?
22:58bjagaining
22:58dissipatebja, what does this have to do with python?
22:59bjaI was saying that I've been adding a bunch of python versions for various clojure.core functions
22:59dissipatebja, that sounds nasty
23:00bjaget-in, assoc-in, dissoc-in, update-in are really addictive
23:00bjaparticularly when dealing with a bunch of json
23:00bjamerge_with was also necessary
23:03dissipatebja do you know why (repeat (seq "abcdefghijklmnopqrstuvwxyz")) times out the repl?
23:07gfredericksit's infinite
23:08gfrederickstakes a while to print
23:08dsrx,(doc repeat)
23:08clojurebot"([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."
23:08dissipategfredericks, but it's lazy, right?
23:08gfredericksyeah but the repl is trying to print it
23:08dissipategfredericks, the repl is trying to take infinity from it? that's crazy
23:09gfredericksno, it's printing the elements one at a time
23:09bjadissipate, compare (range)
23:10bja(which will also try to print the natural numbers and is unlikely to return)
23:12dissipategfredericks, i see. i just did 'take 5' on it, and it returned.
23:13gfredericksyep