#clojure logs

2012-08-29

00:10l1xhey guys
00:12l1xi am trying to deconstruct a "matrix" (def matrix[[1 2 3][4 5 6][7 8 9]]) but not sure how could i do it i am trying to do something like (let [[[& rest][]] matrix]) an process the vector
00:14gfrederickswhat exactly do you want a binding to?
00:15gfrederickswhat do you want to do with the matrix?
00:15l1xi am trying to implement the "spiral printing" challenge
00:16l1xhttps://gist.github.com/3506753
00:17l1x(you have to print 1 2 3 4 5 6 7 8 9 in this case, so you need to go -> down <- up ->
00:18gfredericks,(let [matrix [[1 2 3][4 5 6][7 8 9]]] (doseq [row matrix, el row] (print el)))
00:18clojurebot123456789
00:19gfredericksif you just want to read through the elements then doseq can do that for you
00:20n00b6502is [ ] literal array or list
00:22gfredericksit's a vector, which is not quite either
00:22gfredericksbut most of the time you only care that it's sequential
00:22gfredericksso it may as well be a list
00:22n00b6502'dynamic array'
00:22gfredericksit's just easier to type as a data literal
00:22gfredericksno not a dynamic array
00:22n00b6502oh clojure is immutable right ?
00:22gfredericksyep
00:22gfredericksso not very dynamic at all
00:23n00b6502'collection optimized for random acess' ?
00:23gfredericksyep
00:23gfredericksunlike lists with which you have to walk from the front to wherever you want to get
00:24n00b6502i'm just dabling with lisp at the minute; clojure looks like it could be fun
00:24gfrederickstwenty billion people can't be wrong
00:25n00b6502thats the size of clojures' future userbase?
00:25gfredericksinevitably
00:26n00b6502its also got curly brace literals.. maps? or 'objects' ?
00:26gfredericksmaps
00:26n00b6502heh maps in fp land. whats a map , a datastruture or a hof
00:26l1xgfredericks: thanks, but check the gist pls.
00:27gfredericksdatastruture
00:27n00b6502what does clojure call the hof that applies a function to a sequence to produce another sequence
00:27gfredericksmap :)
00:28l1xthe challenge is the spiral print part
00:28n00b6502can you map a map
00:28l1x,(let [matrix[[1 2 3] [8 9 4] [7 6 5]]] (doseq [row matrix, el row] (print el)))
00:28clojurebot123894765
00:28mkn00b6502: yes. Do you want to map its values?
00:29n00b6502walking the values and getting key-value pairs i guess would be nice .. map and reduce on that
00:29n00b6502oh its not a sequence so reduce makes no sense perhaps
00:29gfredericksmaps are seqable
00:30gfredericks,(seq {:foo 432 :bar 23})
00:30clojurebot([:foo 432] [:bar 23])
00:30gfredericksso when you use the map function on a map data structure it sees it as a seq of pairs
00:30gfredericksand the output is a seq as well
00:30gfredericks,(reduce concat {:foo 384 :bar 21})
00:30clojurebot(:foo 384 :bar 21)
00:30gfredericks^ you can reduce a map as well
00:31n00b6502can maps function like adhoc objects or do you still want to use classes
00:31n00b6502(i'm thinking of what goes on in python, lua etc)
00:31gfredericksmaps are idiomatically used much more than anything OOey
00:31gfredericksthey are definitely the default
00:31mk,(type (first {:key "val"}))
00:31clojurebotclojure.lang.MapEntry
00:32gfredericksl1x: sorry I didn't notice the gist
00:32l1xnp :)
00:32n00b6502does it have anything like tuples aswell - or would vectors do.
00:32l1xi have a really ugly solution
00:32gfredericksl1x: though it doesn't tell me much more than what you already said
00:32mk,(first (first {:key "val"}))
00:32clojurebot:key
00:33gfredericksn00b6502: vectors for tuples yes
00:33l1xgfredericks: please note, there is a matrix and you need to print the elements following a spiral
00:33gfredericksoh I see
00:33gfredericksyou want a general solution or specific to the 3x3?
00:34mkn00b6502: a MapEntry is effectively a pair, incidentally
00:34l1xwell i have an ugly 3x3 specific one
00:35n00b6502perhaps the implemention can store them like structs , or maybe it needs to be able to garbage collect components
00:35gfredericksl1x: if I had to do it and didn't care too much about performance I'd probably print the first row, then rotate the thing and recurse
00:35gfredericksrotate the rest of the thing rather
00:35mk,(conj {} [:key "val"])
00:35clojurebot{:key "val"}
00:36l1xgfredericks: what do you mean by rotating the thing?
00:37l1xyou mean do a transform on the matrix? hmm sounds legit
00:37gfredericks,(let [matrix [[1 2 3] [8 9 4] [7 6 5]]] ((fn spiral [coll] (when (seq coll) (doseq [x (first coll)] (print x)) (->> coll rest (apply map vector) (recur))))))
00:38clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval161$spiral>
00:38gfredericks,(let [matrix [[1 2 3] [8 9 4] [7 6 5]]] ((fn spiral [coll] (when (seq coll) (doseq [x (first coll)] (print x)) (->> coll rest (apply map vector) (recur)))) matrix))
00:38clojurebot123879465
00:38clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$map>
00:38gfredericksI don't think that's what I meant to do
00:38gfredericksI'll put it in the gist when I figure it out
00:39arohnerdid I hear correctly that someone's utils library has dissoc-in?
00:40l1xgfredericks: brilliant idea
00:41mkn00b6502: not sure how you'd gc components, since they seem visible. There are a few structures that work like maps in clojure. Records, for example.
00:41gfredericksl1x: oh I was missing a reverse I think
00:42gfredericksnow if I can just figure out why it has the map arity error...
00:43l1xhttps://gist.github.com/3506753
00:44l1xthis is what you want to do?
00:44gfredericksI just commented
00:44gfredericksthat one seems to work
00:45gfredericksI just tried it on an 8x7 matrix and seems to work there too
00:47l1xwow
00:47l1xreally nice
00:47l1xwhat is the ->> (i havent reached that in the clojure book yet)
00:47gfredericksit's a macro for unnesting things
00:48gfredericksthat line is equivalent to
00:48gfredericks(recur (reversee (apply map vector rows)))
00:48Scriptorl1x: it's the threading macro
00:48l1xoch i see
00:48Scriptortakes the initial value, inserts it as the last form of the 2nd argument, and so on
00:49Scriptorwell, *a* threading macro to be exact, -> inserts as the 2nd form of each argument
00:50Scriptor(->> foo (a b c) (d e f)) = (d e f (a b c foo))
00:50n00b6502"gc components" . is the whole collection a unit of gc.. or if you have a reference to one component passed along the rest can potentially be freed
00:51n00b6502i suppose it might depend on the size
00:51gfredericksl1x: see next comment for an appaling use of ->>
00:52l1xhaha evil :)
00:53n00b6502hey is that what i think it is... (defn lerp ( lo hi f) (->> (- hi lo)(* f)(+ lo)))
00:54n00b6502playing with lisp i just made a macro "pipe" to do tha
00:55Scriptorthat takes the difference between hi and lo, multiplies it by f, and adds lo to it
00:55amalloyalthough you might just as well use -> there
00:55n00b6502lerp(lo,hi,f)=(hi-lo)*f+lo
00:57n00b6502always makes me feel just that little bit less crazy when i see another implementation of a macro i wanted
01:46emezeskeHey, I'm writing a blog post about my experience building a commercial website out of Clojure and ClojureScript. Is there anything in particular anyone would care to know about?
01:46emezeskeI figured I'd start with a review of the various libraries it's built on top of.
01:47wmealing_how you deployed it.. and upgrade it
01:48emezeskewmealing_: I will be sure to cover that, thanks!
01:49wmealing_as obvious as that sounds, people forget.. ie, intit scripts or stand alone
01:49wmealing_what toolchain was used
01:50emezeskeRight on
01:50LuminousMonkeyWhat wmealing_ said. :)
01:50emezeske:)
01:50akhudekemezeske: I'd be interested more in your experiences with the clojurescript side of things. Did you use much of google clousre? How did you deal with the lack of documentation? How did you find interop?
01:51akhudekalso, did you use advanced optimization or stick with simple?
01:51emezeskeakhudek: Okay, thanks! It might end up as a multi-part blog entry, but that will go in there for sure.
02:02nkkarthikemezeske: this might be sound absurd... but will it be ok to ask for... how we can reproduce/debug a production issue... and possibly fix it on-the-fly... without restart, I mean
02:02nkkarthiknot that we should do it that way, of course
02:03emezeskenkkarthik: I'm not sure if I'll be able to fit that into this particular blog entry, but I will put that on my TO-WRITE list
02:03emezeskenkkarthik: You are talking about things like a REPL in prod?
02:04nkkarthikemezeske: yeah I too felt it wouldn't fit into this... just was curious
02:06emezeskenkkarthik: Sure!
02:08nkkarthikemezeske: repl... hmm... maybe I am new and not sure... but in our case we mostly try to have proper logs... but there are issues with logs... you know the levels should be correct... but still you might not able to get the correct picture of what's happening and... locally reproducing also sometimes fails due to DB stuff
02:08nkkarthikdeveloping is surely interesting... after release, this is one pain point
02:09emezeskeThat is very true, maintaining the working app is super important
02:10nkkarthikwe don't use clojure... I am learning in my free time...
02:10nkkarthikyou know these erlang guys boast about there zero downtime and continuous upgrades or fixes... I looked a little into erlang to for that :)
02:11nkkarthikclojure should also be able to do that I thought
02:15nkkarthikand I heard erlang can connect and debug running prod systems... will have to look into that too... maybe it's a repl
02:16nkkarthikor maybe you can turn on/off *trace* for some time
02:17l1x,(->> [[8 9 4] [7 6 5]] (apply map vector))
02:17clojurebot([8 7] [9 6] [4 5])
02:17l1xcould somebody explain this ^
02:19nkkarthikl1x: this is same as
02:19nkkarthik,(map vector [8 9 4] [7 6 5])
02:19clojurebot([8 7] [9 6] [4 5])
02:20nkkarthikl1x: if you want the exact steps
02:21l1xnkkarthik: thanks, i forgot that map applies the function in this way to multiple parameters
02:21l1xbut now i remember
02:21l1xthnka
02:21nkkarthikl1x: oh ok... so you got it :) cool
02:21l1xyeah
02:23l1xnkkarthik: so now i have only one question :)
02:24l1xif you dont mind
02:24nkkarthikl1x: please shoot
02:24l1xthis is the line of code i wanted to understand (when (seq rows) (->> rows (apply map vector) reverse recur))
02:25l1xnow why cant i just (when (blah) (map vector rows) reverse recur)?
02:27nkkarthikyou want to expand the rows right?... apply does that
02:27nkkarthikthere is a difference between
02:27nkkarthik,(map vector '[[a b c] [1 2 3]])
02:27clojurebot([[a b c]] [[1 2 3]])
02:27nkkarthik,(map vector '[a b c] '[1 2 3])
02:27clojurebot([a 1] [b 2] [c 3])
02:28nkkarthikjust doing (map vector rows) is like the first one (map vector '[[a b c] [1 2 3]])
02:29nkkarthikbut (apply map vector rows) is like (map vector row1 row2 row3..) etc
02:29nkkarthikdid I make sense?
02:29l1xhmm let me re-read
02:29l1xoch i see
02:30l1xsorry my question was not clear
02:30l1xwhy is it better to use the ->> macro?
02:32nkkarthikah... that's just... a style thing I suppose... we could pretty well do the regular (recur (reverse (apply map vector rows)))
02:34l1xoch man, you are awesome
02:34l1xnow it makes sense
02:34nkkarthikthe usual way you have to read inside-out (inner s-exp to outer)... but with -> or ->> you can read left to right
02:35l1xi like to inner to outer way
02:35l1xjust like when in school i learned that parenthesis always should be read this way
02:35l1xkind of feels more natural to me
02:36l1xnow i understand the entire code
02:36l1x<3 clojure
02:37nkkarthikl1x: cool... have fun :)
02:37l1xthanks!
02:37l1xthis lang has the best community :)
02:38nkkarthikl1x: just a suggestion, don't overlook -> , it sometimes makes code more readable
02:41nkkarthiklike (-> camera take-shot convert-to-png save)
02:41l1xi see
02:41nkkarthikmight be more readable than (save (convert-to-png (take-shot camera)))
02:41l1xi am fairly new to clojure so i try to understand the basics
02:42l1xhaha after 2 weeks with clojure actually the second version makes perfect sense to me :))
02:42nkkarthikl1x: yeah sure... just wanned to let you know
02:43nkkarthikah nice :)
02:43l1x:))
02:43l1xi am infected with lispism for life
02:43amalloynkkarthik: it's easy to go too far with ->, though. i like to use it to let me put my "verbs" in whatever order best explains what i'm doing, with the stuff i want to emphasize on the left. for example, perhaps (save (-> (take-shot camera) (convert-to-png)))
02:44amalloythis way you don't have to go far to see that you're saving a camera shot, and convert-to-png is a detail you can ignore
02:47magopianalways very interesting to have this kind of feedback/experience amalloy thanks
02:47nkkarthikamalloy: right... very true
02:48nkkarthikamalloy: I was exaggerating in the process of coming up with some example quickly :)
02:50magopianwhat does "fn*" do? it seems to do the exact same as "fn", but when i print '(fn [] ()) it gives me (fn* ([] ()))
02:50nkkarthikconvert-to-png is likely an implementation detail... but I was thinking of user actions... when they do "Take Shot" then we could have a "Save-as" window where user might select png or jpeg... and save...
02:51magopian*when i str
04:06mmajchrzakHi. It is possible to write andoid apps in clojure ? What are the cons and pros of using clojure for that kind of jobs?
04:09nz-mmajchrzak: it is certainly possible to do scala apps for android, so clojure should be also possible
04:10alcyhttp://www.infoworld.com/d/application-development/clojure-inventor-hickey-now-aims-android-189105 might shed some light
04:10mmajchrzakI 've heard that there is problem with gc on android when app is created in clojure.
04:11n00b6502immutability possibly keeps more garbage around
04:11n00b6502also its possible the dalvik virtual machine is more tuned for their compilers
04:11n00b6502their java compilers
04:12n00b6502i would be interested in this sort of thinng though, i never want to touch java.
04:13mmajchrzakIs there any other jvm language for writing andoird apps ? I have Java on my university and i dont want to touch it anymore.
04:13n00b6502my guess is scala
04:13rojeppF# via mono?
04:14n00b6502f# -> mono -> dalvik ?
04:14rojeppmono har 'mono for android' which supposedly works well.
04:14rojeppCan't say I've tried it though.
04:14n00b6502oh C#/mono is a better java supposedly
04:15n00b6502'java done right'.
04:15rojeppF# is way better than C#
04:17mmajchrzakc# is for java is something like a D for c++.
04:18n00b6502interesting, f# is functional but still allows object.member unlike haskell?
04:19rojeppYes. often called a 'functional first' language. Immutability is default, but you always have the option to go mutable where needed for speed and interop with rest of .Net
04:19augustlsounds a lot like Clojure :)
04:19n00b6502i'm enjoying getting into lisp, but its always the lack of straightforward object.member syntax that starts to grate
04:20n00b6502i can handle writing maths prefix just fine
04:20rojeppIt differs from Clojure in that it's statically typed, and there are no macros. :)
04:20n00b6502ah f# has |>
04:20rojeppThe language is baswed on ML family of languages, most directly from OCaml.
04:21n00b6502gui programming vs functional ...
04:22n00b6502is it easy to dable with this under linux; i'm put off anything originated by microsoft
04:23rojeppWell, MonoDevelop has an F# binding that runs on MacOSX. Haven't tried it on Linux
04:23rojeppbut it should run there as well
04:24n00b6502i think i'leave it..i have enough potential languages to juggle between already
04:24n00b6502hmm. at a glance though it does look pretty goo
04:25rojepp'It is a really nice language, terse *and* readable. Too bad it is from MS. ;-)
04:26n00b6502does clojure actually have object.member
04:26augustlwhat's object.member?
04:26n00b6502or is that too infixy
04:26n00b6502just the syntax for record acess whatever you call it
04:26augustlyou're probably asking the people that already know F# so never mind :)
04:27augustln00b6502: you can call methods on java objects with (.foo my-obj)
04:27n00b6502. in lisp is "slot-value" i think
04:27augustland you typically access maps/record/... with (:member object)
04:27n00b6502(slot-value myobj foo)
04:28mmajchrzakI've found mono for andoird but it isnt open source
04:28n00b6502i was going to guess mono for android sounds like a world of pain
04:29n00b6502anything built directly around jvm sounds more sane, scala / clojure..
04:29n00b6502having said that, how do they get to dalvik
04:29kilonvery few things are originated by microsoft , C# and .NET is not one of them
04:29Fossithey could use the ndk as well
04:30Fossiso via c
04:30n00b6502NDK doesn't expose gui frameworks does it
04:30n00b6502ndk is mostly for opengl games c/c++
04:30Fossinot in a nice way
04:30Fossiafaik you can use them
04:30clojurebotGabh mo leithsc?al?
04:30nz-mmajchrzak: there are some notes about scala&android game development: http://scalandroid.blogspot.fi/
04:30n00b6502hehe they didn't like my question on android-dev... can NDK compile objective-c ...
04:30augustlkilon: according to wikipedia, C# originated at MS, what am I missing? :)
04:31n00b6502yes i thought c# really was designed by a microsoft employee - not bought
04:31kjeldahlIf you're targeting Android, Kawa might not be a bad choice, see http://kjeldahl.net/d7/node/32
04:31kilonaugustl: C# and .NET is not created by mircrosoft, its create mostly by one man, the same man that created Delphi for Borland
04:32Fossia backend for android/dalvik was planned
04:32n00b6502ah then they bought it ok.
04:32augustlkilon: he seems to be a microsoft employee though
04:32kilonwhich in turn he was largerly influenced by smalltalk
04:32kilonhe is
04:32rojeppkilon: Yes, Hejlsberg was hired by Microsoft, what is your point?
04:32nz-mmajchrzak: my guess is that you won't make things easier if you use clojure with android
04:33augustlthen I would say that microsoft made C#
04:33kiloni am not saying that microsoft does not own it as a product
04:33rojeppI'm pretty sure he didn't do it himself either.
04:33n00b6502microsoft paid him more than anyone else would
04:33thorwilby that logic, no product is made by a company ...
04:33n00b6502founder
04:34n00b6502someimtes a product really is made by a founder of a company
04:34kilonyou said "origin"
04:34kilonmicrosoft is good at copying stuff or hiring people working at competitive products
04:35kilonif microsoft as a company had .NET as an idea, even as a vague concept, then yes i would agree
04:41n00b6502does f# have currying
04:47kilonanyway, i do not come across as a troll, it just pains me when i see thing not survivning by their own , see Delphi, and when embraced by a big company they become the second comming of christ, feel like humanity is zombified and completely oblivious to quality software or software of any kind
04:47kilon*I dont not want to come...
04:48rojeppn00b6502: Yes: http://hestia.typepad.com/flatlander/2011/06/partial-function-application-in-f-part-1-the-basics.html
05:02noidiwhat's wrong with my use of `await` here? https://gist.github.com/304b72eb346cdc42898f
05:03noidiit seems to return before all agents are finished
05:03noidiI'm a complete agent newb as you can probably tell :)
05:43alcyhello, have a Q regarding list eval - the clojure prog book gives an example like (eval '(average [1 2 3])) - is there a significance of using the quote here ?
05:43alcyas otherwise also, it will return the value
05:46ejacksonalcy: yes. as given eval will be passed the list (average [1 2 3]) which it will eval. W/o the quote eval is passed the the number 2 to eval
05:46Raynesalcy: Yes.
05:47borkdudealcy yes
05:47borkdude,(eval 9)
05:47clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
05:47borkdude=> 9
05:47Raynesalcy: If you don't use the quote, it'll try to evaluate the code normally. It'd try to call the function average on that vector and then give the result to eval. In this case, you're passing the list itself to eval because you're preventing evaluate.
05:48Raynesevaluation*
05:49RaynesIt isn't immediately obvious because eval returns the same thing regardless. In one case, you're passing the list itself and eval is evaluating and you get the result (a number) and without the quote you're passing the result of the function average itself to eval, and eval just gives you back that same number.
05:50alcyRaynes: ah, right ! many thanks for the explantion
05:50alcyejackson: borkdude thanks
05:51borkdudealcy for saying yes? anytime
06:01kralnamaste
06:02john2xis this valid? (require '[(symbol (str "foo" ".bar")) :as bar])
06:05ro_stno, because :symbols aren't valid namespace definitions
06:06ro_styou're looking for http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ns-resolve
06:06noidiro_st, :keywords begin with a colon
06:06ro_stoh
06:06ro_sthahah
06:06ro_stwhy do i keep mixing those up
06:06ro_stmy apologies
06:06ro_styou still want ns-resolve, though
06:09noidiI just asked this, but just in case you guys missed it, anyone know what's wrong with my `await` call? https://gist.github.com/304b72eb346cdc42898f
06:09noidithe agents seem to keep going after the `await`
06:10john2xah. so it will be (referring to the example in clojuredocs.org): (require '[(ns-resolve *ns* (symbol (str "foo." "bar"))) :as bar])?
06:12noidijohn2x, ns-resolve will return you the var, no need to call require
06:13noidi(let [dynamically-found-var (ns-resolve ...)] (do-something-with dynamically-found-var))
06:13john2xahh.. got it. thanks!
06:16ro_streally would be cool to have such resolution in clojurescript
06:18noidiargh, this agent think is driving me crazy
06:19piskettiCan anyone tell me where have the zip-filter library moved?
06:19piskettifrom clojure.contrib I mean
06:20noidipisketti, http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
06:21piskettinoidi: Thanks a lot!
06:22grahamcarlylehi, has anyone had success with writing a library written in clojure that has its dependencies renamespaced
06:24grahamcarlyleso using a tool like proguard to make the clojure jar and other dependencies not conflict with a client of the jar
06:25grahamcarlylejust wondering whether its possible/wise to do
06:31noidiokay, I figured my `await` problem out
06:31noidiRTFS helped here
06:34noidi`await` works by adding its own action to the agent's queue. I "loop" within agents by sending new actions to *agent* from within an action, and `await` sticks its action between my loops iteration actions.
06:34noidiso there are still iterations to do when `await` returns
06:36noidiI guess I'll just add a promise as a part of each agent's state and deliver to it when done
06:36noidiand instead of `await` deref all the promises
06:55ro_st-grin-
07:10Kneferilishello
07:10Kneferiliswould you say that clojure is more powerful than scala?
07:11ro_styes
07:11ro_stthat was easy!
07:11ejacksonclojure has macros, so is by definition more able. Whether that's helpful/useful/relevent is another question.
07:11ro_stand it has less syntax, which makes it easier
07:12ejacksoni think 'powerful' is context dependent
07:12ro_stalso, its creator plays a guitar and says incredibly thoughtful thought provoking things
07:13naeg+1 ro_st
07:13ro_stultimately, though, if it solves the problem you have, it's powerful enough
07:13Kneferilisbut scala has introduced macros (although experimental at the time)
07:13Kneferiliswould that make scala now, on par with clojure?
07:13ejacksonwithout homoiconicity macros are a cruel joke
07:14naegI guess those macros might be like the C-macros
07:14ejacksonthey're just different - scala is statically typed and it diverges from there
07:14naegbasically bullshit compared to lisp macros
07:15Kneferilishmm, currently I am creating a rpg video game mostly written in JavaScript with some PHP code, next I will create a simulation game in play2 + scala
07:15Kneferiliswhat kind of game could I create in clojure?
07:16ejacksonanything
07:16naeg"effort towards bringing compile-time metaprogramming to Scala. Our flavor of macros is reminiscent of Lisp macros"
07:16naegI probably was too hasty
07:17ejacksonit really doesn't matter
07:17ejacksonprogram in what you like
07:18ro_styeah. like i said: solve the problems.
07:19Kneferilisyes
07:19naegClojure is still an interesting "replacement" for Java or Scala for certain tasks, due to its functional style. also, as much as I can tell scala macros are not as powerful as lisp's, but still much more powerful than those in C
07:20clgva java dev question: where does ${version.number} usually come from in an ant build file?
07:20vijaykirandepends on how it is configured - one guess might be from build.properties
07:22clgvvijaykiran: ah thx. that's right. it is in there
07:22ro_stenjoying your web-app tuts, vijaykiran :-)
07:22vijaykiran:) thanks - I've been meaning to update them to 1.4
07:24ejacksonvijaykiran: link ?
07:24vijaykiranejackson: http://www.vijaykiran.com/2012/02/27/web-application-development-with-clojure-part-5/
07:25ejacksonthanks
07:25ro_stvijaykiran: have you seen my cljs demo app? https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/
07:26ejacksonvery nice
07:26vijaykiranro_st: looks cool - starred :)
07:27vijaykiranro_st: I'm not that comfortable with cljs stuff yet - this will certainly help!
07:27ro_stcool. let me know what you think.
07:27ro_stoh that's good. you'll enjoy this then
07:32rojeppvijaykiran: Thanks, great resource for a total newb like me.
07:34vijaykiranrojepp: yw :)
07:35ro_stvijaykiran: i'm glad you avoided noir, not because noir is bad (it isn't), but because you get to show how all those various things compose
07:35ro_stmany people coming to clj from other web techs are undoubtedly using their home lang's Monolithic Framework ™
07:36vijaykiranAfter using a lot of "Frameworks" - I'm generally less inclined to use anything that has the word in it.
07:37ro_st+1
07:37ro_stmy cljs demo shows just how nicely those 3 libs compose to make an app
07:37ro_styou could use hiccup and jayq instead of enfocus and still use remotes and pubsub
07:38ro_stor toss the remotes and use plain-jane xhr
07:49ejacksonyup, the mantra is "small, composable abstractions" :)
07:49ro_stanyone using an SSD drive here?
07:49ejacksoni'm still figuring out how to do it right
07:50ejacksonro_st: yes
07:50vijaykiranro_st: me.
07:50ro_stis it really worth going for one of the more expensive types?
07:50ejacksonro_st: dunno, I did and am blissful
07:50ro_steg, the OWC Extreme over the OWC non-Extreme
07:50ejackson:D
07:50vijaykiranI have been using the OWC one
07:51vijaykiran"120GB Mercury Extreme" last year model
07:51ro_sti'm looking at this one http://www.bhphotovideo.com/c/product/797516-REG/OWC_Other_World_Computing_OWCSSDMX6G120_Mercury_Electra_6G_Solid.html
07:51ejacksonsamsung 830 6GBs
07:52ro_stmy OS drive is only 70gb of data. all my media is on a secondary drive (yay hackintosh)
07:52ro_stdoes it speed up JVM start times ? :-)
07:53vijaykiranprobably not :) but maven builds are faster - with disk i/o
07:53vijaykiranI use XSlimmer + Clusters that compress many folders and apps
07:53vijaykiranso 120GB is fairly good amount of space for me
07:54ro_stnice
07:54ro_stOSX?
07:54vijaykiran:) yeah
07:56ro_stawesome. i'm going to go for the one i pasted. may it last a long time!
07:57ejacksonyou're gonna be amazed
07:57vijaykiranI got the combo of SSD + exernal enclosure for the current 500GB spinning drive
07:58ro_stmy bro just did his macbookpro
07:58ro_sthe starts the entire adobe cs6 suite up in like 15 seconds
07:58vijaykiranhttp://vimeo.com/21389323 :)
07:59vijaykiranafter SSD upgrade
08:01ro_stthat's just nuts
08:22SgeoHmm
08:22SgeoI wonder if tryclj.com can be broken by exploiting the 0-day?
08:22SgeoOr the bots in here
08:29rojeppSgeo: I have java plugin disabled and tryclj.com works, so no.
08:30rojeppSgeo: oh, you meant break the jvm on the server?
08:30Sgeorojepp, yeah
08:33xeqiSgeo: if http://www.h-online.com/security/features/The-new-Java-0day-examined-1677789.html is correct in explaining it, then yes
08:34SgeoThe clojail would have to be broken too though, I assume?
08:39xeqihmm, yeah. I've broken clojail before, so now it blocks access to the java.security package, which is needed to make the AccessControlContext
08:39xeqiso lazybot might be safe
08:41SgeoWhat is this Expression thing/
08:41hyPiRionclojurebot is probably dangerous.
08:41hyPiRion,'broken?
08:41clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to resolve symbol: pr-str in this context, compiling:(NO_SOURCE_PATH:0)>
08:41hyPiRionwell, somewhat at least.
08:43SgeoClojure> java.security.AccessControlContext
08:43Sgeojava.lang.SecurityException: You tripped the alarm! class java.security.AccessControlContext is bad!
08:44SgeoI think that that's Clojail and java.security.AccessControlException: access denied (java.lang.RuntimePermission setSecurityManager) is JVM sandboxing?
08:45xeqithe clojail portion blocked that
08:46Sgeo"that" being which?
08:47SgeoI assume that things like codepad and ideone aren't vulnerable because they use something outside the language environment's security for security purposes?
08:48xeqiSgeo: https://github.com/flatland/clojail/blob/master/src/clojail/core.clj#L295 -- the "java.security.AccessControlContext" string you sent was blocked by a clojail tester, so it threw an exception before trying to run it
08:49SgeoHmm, so why the different message?
08:49SgeoWait, no, that was the one I thought was clojail
08:50xeqiah, I missread
08:50xeqiyou're right
08:52xeqilooking further, the 0day looks to exploit the default security for jars vs local files. lazybot, clojurebot, and tryclj all have a different java.security that restricts local files further, so they are probably safe
08:53xeqinot that there aren't other ways...
08:54xeqi*by jars I meant applets
08:55jsabeaudrySlime is being abandoned in favor of nrepl?
08:56pjstadigjsabeaudry: it is being deprecated, yes
08:56uvtcjsabeaudry: http://technomancy.us/163
08:57uvtcDoes this fragment of a stack trace ring any bells for anyone? :
08:57uvtcException in thread "main" java.lang.NullPointerException
08:57uvtc at clojure.lang.Numbers.ops(Numbers.java:942)
08:57uvtc at clojure.lang.Numbers.add(Numbers.java:126)
08:57fro0gyou mean swank-clojure is being deprecated
08:58uvtcThe function seems to work fine when tested by itself in isolation...
08:58xeqi&(+ nil nil)
08:58lazybotjava.lang.NullPointerException
08:58SgeoNIL MUST DIE
08:58SgeoNULL MUST BE DESTROYED
08:58jsabeaudrypjstadig, uvtc: thanks for the info, I'll give it a spin I guess
08:58uvtcThanks xeqi . Will explore that.
08:59pjstadigyeah, uvtc, you're probably sending a nil to it at some point
09:01ejacksonuvtc: all *too* damn familiar I'm afraid :)
09:01uvtcGlad it rang a few bells, anyway. :)
09:02pjstadigejackson: are you using migratus?
09:02pjstadigejackson: did you get a notification about this? https://github.com/pjstadig/migratus/issues/8
09:04ejacksonpjstadig: Yeah, sorry dude its on my todo list for today !
09:04ejacksonI'm really excited for it to work :)
09:04pjstadignp i wasn't sure if the notification came through to you
09:05ejacksonsorry, I didn't want to spam up the comments with a "Awesome - I'll check it out"
09:06ejacksonpjstadig: I haven't checked but is migratus lein2 capable now ?
09:06pjstadighehe
09:06pjstadiguh
09:06ejackson:)
09:06pjstadigi don't know
09:06pjstadigi haven't tried, i mostly use lein1
09:07ejacksonnot a biggie, i was just curious
09:07pjstadigi think there's actually an issue for that though
09:14jsabeaudryIs there something like clojure-toolbox.com but for lein plugins? I'd like to see what plugins exist
09:21uvtcxeqi pjstadig ejackson : Ah, found the problem! I was doing a `cond` checking for all possible values of some result `(< x 10)` ... `(and (> x 10) (< x 20))` ... but should've had some >='s in there. :) Thanks!
09:21pjstadiguvtc: glad you figured it out!
09:21ejacksonuvtc: sneaky bug
09:23xeqijsabeaudry: https://github.com/technomancy/leiningen/wiki/Plugins
09:24jsabeaudryxeqi, great, many thanks!
09:24wmealing_since i'm new to this, is there some kind of generic "service/daemon" mechanism or application update mechanism used by java/clojure ?
09:25uvtcwmealing_: What exactly are you looking to do?
09:25wmealing_i have a java app, i want to deploy to mac, lin, win.. different machines
09:26wmealing_i push an update to a server repository.. and ideally id' like to write as little code as possible
09:26wmealing_and have the clients auto-update to the version that is pushed
09:26wmealing_i'd also like some kind of daemon/process manager that will restart them if updated
09:26uvtcOh. "A new version of this program is available! Upgrade now?"
09:27wmealing_without asking.. but yes.
09:27wmealing_i maintain all the machines, so ..
09:27wmealing_i can package it in rpm, (whatever format osx uses) and some kind of .msi installer
09:27wmealing_but that seems stupidly overkill.
09:27wmealing_considering java is supposed to be cross platform
09:27pjstadigwmealing_: i don't know of any off hand, seems like there might be some kind of java something somewhere
09:28wmealing_thats what i'm thinking.. there has to be something
09:28pjstadigwmealing_: have you asked the googles?
09:28wmealing_yeah, not much luck
09:28pjstadighmm
09:28wmealing_i might be using the wrong terms though
09:28pjstadigyou might be able to try someplace where java devs hang out too, a forum or something
09:29wmealing_i came here, because the quality of answer is usually better... :)
09:30wmealing_i kind of expected this to be something that people would have used.
09:33uvtcwmealing_: maybe ask about it on #leiningen.
09:39naegdoes lighttable use noir?
09:45darklajidpjstadig: Would it be possible to bundle your app with java webstart?
09:46pjstadigdarklajid: i suppose so
09:46darklajidI assume that would solve your deployment issues
09:48rojeppnaeg: "Light Table actually uses Noir, so it's certainly still alive. I'm not the primary one driving things day to day right now, Raynes has been helping out with that."
09:49rojeppnaeg: http://yogthos.net/blog/22 in comments
09:49naegthanks, just stumpled upon his tutorial
09:49naegstumbled*
09:50naegI'm new to Clojure and want to create a web interface for connect 4 - what would you suggest to use? Noir?
09:51uvtcnaeg: I find plain Ring + Compojure to be straightforward.
09:51xeqinaeg: thats an ok place to start, and if you decide to clojurescript the frontend you can talk between server/client with fetch
09:53uvtcnaeg: To get started with a new Compojure project using lein 2: `lein new compojure connect4`
09:53clgvuvtc: thats very persuasive ;)
09:54naeguvtc: reading their examples right now
09:55naegI'm also unsure about how to animate that connect four field then. Would that involve ClojureScript?
09:56cshellHas anyone heard when Oracle is going to patch the 0 day exploit in Java?
09:58wmealing_when they want to
09:59cshellyeah, hopefully soon - I think it's a little irrational for everyone to be uninstalling java from their pcs
09:59wmealing_cshell: watch this space http://cve.mitre.org/cgi-bin/cvename.cgi?name=2012-4681
09:59cshellnice, thanks
09:59uvtcnaeg: If you want something like a single-page client-side webapp, then my understanding is that you probably want to check out ClojureScript.
10:00naegcshell: do people do so? I guess it's enough to tell your browser only to run Java on-click (and then just click those you trust or none) and don't run java apps you don't trust yourself
10:00cshellYeah, that's what I'd figure - but a lot of the news media posted stories that told people the only way to completely avoid it is to uninstall it
10:00naegalso, afaik that bug is not in Java 1.6 and most people use this.
10:01clgvcshell: lol yeah. you just have to disable the browser plugin ^^
10:01wmealing_openjdk has a patch
10:01naeguvtc: thanks, noted that stuff down. I guess I'll start with the connect four AI first and create a simple CLI for now
10:01cshellmy java plugin has never worked in chrome, so I wasn't too worried :)
10:02SgeoDoes Minecraft work on OpenJDK? </offtopic>
10:02cshellthe CERT alert says 1.7, but the same news story I saw said that it affected 1.6 too but I haven't seen anything official about that
10:02uvtcnaeg: If you want to make your game as a regular desktop app, maybe use [Quil](https://github.com/quil/quil).
10:02clgvSgeo: if it works on java , I guess so - since its the reference implementation
10:03clgvargs *"java 7" I wanted to say
10:03SgeoHmm.
10:03SgeoMaybe by reading about OpenJDK I will feel more comfortable learning the Java standard library and ecosystem?
10:05naeguvtc: thanks, will consider that too. Actually not the guy doing interface stuff. more interested in coding the AI, but I guess it would be nicer with and some practice for me in clj
10:05clgvI wouldn't know why this would help you, but if it does. good ;)
10:41dgrnbrgI am encountering the strangest of bugs: I have a distributed application that uses leiningen to build an uberjar of its dependencies, then it ships that jar to the local disk of a bunch of remote machines, and then it starts the program on each machine. 40-70% of the time, however, the program fails to start by not finding a random class due to an "invalid LOC header (bad signature)" error caused by the inflaterinputstream used by
10:42dgrnbrgit fails on random classes, like "clojure.core$ffirst", "org.apache.http.HttpException", and others
10:42dgrnbrgand all the jars have the same (correct) md5sum...
10:42dgrnbrgany ideas?
10:43llasramCould the JAR file be not fully written at the time execution starts?
10:43cemerickdgrnbrg: might want to start sending a hash of the file around and checking that as part of the distribution process
10:45jsabeaudryHow can I clear/unload a namespace (I'm working with nrepl.el)?
10:46dgrnbrgLet me do a hash verify on every node, and then i can see if that narrows it down at all
10:47_zachjsabeaudry: possible remove-ns? http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/remove-ns
10:47_zachjsabeaudry: I've not actually used this, but it's a place to start
10:47clgvdgrnbrg: do you use pallet?
10:47dgrnbrgclgv: nope
10:47dgrnbrgMy flow is this:
10:48dgrnbrgI create the jar locally, then copy it to an NFS share in the cluster (slow link). Then, each of the processes copies from the cluster NFS share to their local disk (fast link), and sets the classpath as the local copy of the jar
10:49dgrnbrgif i run the exactly same process 1000x, i see around 50% of the process getting corrupted zips, i think
10:50jsabeaudry_zach, interesting, I'm trying to load the ns again after doing that and nrepl is stuck at "Loading /home/my/file.clj..."
10:50dgrnbrgalso, it seems as if the time delta between copying the file to the cluster share and starting the job has an effect--immediately after the copy, it's less likely to succeed than long after
10:50_zachjsabeaudry: Bah, I really wish I could help you more, but I'm not really sure
10:52jsabeaudryHow do people cleanup the :use and :require declarations? I refactored a lot of stuff and now I'm pretty sure some of my use and requires are not neeeded anymore, I was thinking of removing one and reloading the file but it seems i can remove event those that are still needed
10:53pjstadigjsabeaudry: manually, or you could use slamhound from technomancy
10:56lotiais it possible to start up noir from within an nrepl session? if so, any pointers?
10:56jsabeaudrypjstadig, another great plugin! thanks!
11:03dgrnbrgcemerick: I have checked the hashes of failing startups vs. the hash of the main application, and the jars are identical
11:04dgrnbrgThere must be something crazy happening when I load the class to cause the bad signature error in the classloader
11:05darklajiddgrnbrg: And the clients that fail are random as well? Nothing locally? Or do you use one client, 1000 times?
11:05cemericklotia: noir is just a library; starting it from within nREPL should be the same as starting it from any other REPL.
11:05dgrnbrgdarklajid: the clients that fail are random
11:06dgrnbrgI have a cluster that I start the jobs on
11:06dgrnbrgThe jobs copy the jar locally, print the md5sum, then start the jvm
11:06dgrnbrgrandom ones fail, even though their md5sums are fine
11:07jsabeaudryCan anyone else confirm this potential nrepl.el/nrepl bug? Step1: C-c C-k on a ns of your choice (It loads correctly), Step2: Go to repl and (remove-ns 'yourns), Step3: Try to load the ns again (Does not work)
11:09wmealing_dont you use c-c c-l ?
11:10wmealing_to reload the current namespace..
11:10jsabeaudrywmealing_, same thing happens
11:11jsabeaudrywmealing_, C-c C-k is load current buffer, C-c C-l is load file, the default being the current buffer
11:11wmealing_ah right
11:11wmealing_ok
11:11FrozenlockAny idea what is happening? Exception in thread "main" java.lang.UnsupportedOperationException: Desktop API is not supported on the current platform at org.jdesktop.swingx.hyperlink.HyperlinkAction.<init>(HyperlinkAction.java:131)
11:11FrozenlockI'm not event calling the function that needs this hyperlink!
11:12FrozenlockCould it be that the mere fact that it exists is throwing an error?
11:12samfloreshey folks, is there a way I can implement existing core functions to with with other data? e.g (+ "hello" "world")
11:13samratI need to be able to pass a URL as an argument to a Noir-powered API. what do I do?
11:13pjstadigsamflores: in very few cases you can, but otherwise, no
11:13pjstadigsamflores: in the case of + definitely not
11:14wmealing_you make baby rich cry.
11:14samflores:/
11:14wmealing_sad faces all round
11:14pjstadig+ deals only with numbers, and in common cases actually gets inlined
11:14clgvsamflores: hwy not be specific and use `str`?
11:14pjstadigso you can't even redef it for numbers
11:15pjstadigbut the upside is it's fast :)
11:15samfloresthe example was only to demonstrate my intention :)
11:18jsabeaudrypjstadig, well, looks like slamhound does not work on lein2, what was your "manual" technique?
11:18pjstadighehe
11:18pjstadigjust searching through the file for uses of things in the ns form
11:18pjstadigand removing things that are not mentioned
11:19jsabeaudryhow do you validate your changes?
11:20clgv jsabeaudry: you can comment all your uses and requires and see where you get erros and then include them again
11:20clgvjsabeaudry: or you can try to port slamhound to lein2. there is a decent chance that it might not be too much effort
11:20pjstadigjsabeaudry: well we have a policy never to do a bare use, so a function must specifically be mentioned in the ns form for us to use it
11:20jsabeaudryclgv, what is the most efficient way of recompiling the namespace
11:21pjstadigif it's not used in the body of the file, then it can be removed from the ns form
11:21clgvjsabeaudry: the key shortcut of your ide to reload the namespace
11:21pjstadigand using emacs it's just C-c C-k to recompile and verify
11:22jsabeaudryclgv, sadly, when I remove all requires (even those that are in use) the file still loads properly (as if the previous requires were "remembered" somehow
11:23clgvjsabeaudry: I only see that behavior if I used (use ...) on the repl manually
11:23jsabeaudryclgv, are you using swank, nrepl, or seomthing else?
11:23clgvCCW and thus nrepl
11:25jsabeaudrySomething must be wrong on my side then, I'm using nrepl with emacs, I C-c C-k the file, everything is fine, comment out the :use directive, save the file, C-c C-k again and the ns still loads fine
11:26john2xI'm trying to follow the mouse.clj example in Quil (https://github.com/quil/quil/blob/master/examples/mouse.clj), but I get this error when running it: java.lang.IllegalArgumentException: No matching field found: _mouseX for class quil.applet.proxy$processing.core.PApplet$IMeta$c506c738 any Quil users here?
11:27pjstadigjsabeaudry: yeah you'll have to restart whatever clojure process is compilng your ns, or else it will still have the references to the things you removed
11:28pjstadigyou can also use leiningen at the command line to compile a specific namespace
11:28pjstadigsomething like `lein compile foo.bar.baz` i think
11:28pjstadigor `lein compile :all` if you want to try everything
11:28casionjohn2x: what ver of clojure are you using?
11:28pjstadignot sure if the specifics changed with lein2, i'm still on lein1
11:29casionjohn2x: you need to be on 1.4, it looks like you're using 1.3
11:30john2xcasion: how do I check the clojure version Leiningen is using?
11:31clgvjohn2x: for your project leiningen gets you the clojure version you specified in your project.clj
11:31casionjohn2x: it shoud say in your project.clj
11:32magopianchouser: hello ;) Did you notice that your problem http://www.4clojure.com/problem/130 uses "vector" instead of "list"? nothing bad, just fyi ;)
11:33john2xcasion: ah yes. it was indeed 1.3.0.. thanks! how did you tell from my error message?
11:33casionjohn2x: went through back issues on github
11:34casionjohn2x: https://github.com/quil/quil/issues?page=1&amp;state=closed #20
11:35john2xcasion: awesome.. thanks!
11:35casionnp :)
11:35abalonei thought casion was going to say he was standing behind you
11:35casionlol, no I'm a hermit ;)
11:36casionspend in any one of 3 large rooms with no windows, and no human contact for 14 hours a day
11:36casionspend all day*
11:36wmealing_at least thats what you THINK
11:39chousermagopian: oh, yeah. I wonder how that happened...
11:39jsabeaudryM-4 ( in paredit will wrap the next 4 sexps, is there a fast way to wrap all sexps besides M-9 M-9 M-9 M-9 ( ?
11:41ejacksonjsabeaudry: hold down slurpage until its done
11:41ejackson?
11:51casionM-4 ( does nothing for me :|
11:52zerokarmaleftis that a shortcut for C-u 4 M-(?
12:03bruceadamsjsabeaudry: i think you can select whatever you want to wrap, then just type (
12:09thorbjornDXis a lazy-seq like a python generator?
12:10nDuff...slightly?
12:10thorbjornDXokay, more different in terms of usage or implementation?
12:10TimMcthorbjornDX: It's like a silkworm.
12:10antares_Monger 1.2 is out: https://github.com/michaelklishin/monger/blob/master/ChangeLog.md, http://clojuremongodb.info
12:11thorbjornDXTimMc: got it, thanks :D
12:11nDuff...well, there's chunking, which is something that doesn't happen in Python...
12:11nDuff...now, do you mean "lazy seqs" in general, or the lazy-seq function?
12:11TimMcYou can pull a strand of silk out of it, and once it's out, it's out. You can cut off the end of the silk and throw it away if you don't want it anymore.
12:11thorbjornDXnDuff: the return value of the function, so the structure
12:11casionwhat a fantastic day, new contract and I finally got a pair of sandals that fit me! for the first time in my life
12:11casionwooo!
12:12nDuff...lazy seqs also do things generators don't, ie. caching prior values if there's a reference to the head.
12:12thorbjornDXTimMc: well, you can kind of do thtat with python generators, nDuff: yea, that's a pretty big difference
12:20TimMccasion: Are those good enough for walking around in the metal working rooms?
12:22casionTimMc: yep.
12:23casionI ordered them specifically so I can be barefoot, but I was skeptical they'd find my size
12:24casionsince I have very large feet
12:24casionbut they fit, hurrah!
12:24casionnext step (pun intended) is I may as well try out a standing desk
12:24casionyou guys convinced me to at least give it a go
12:25pipelinecasion: i do the sit/stand thing man
12:25pipelineway better than standing exclusively
12:25pipelinei pace a lot so standing helps with that
12:27zerokarmaleftwhy are hammocks not part of this equation?
12:27casionpipeline: I walk around a lot, but I may as well try a standing workstation
12:27technomancyzerokarmaleft: I wasn't going to mention it because I didn't want to make you guys jealous, but I worked out of a hammock for most of yesterday afternoon.
12:28casionhalf my day is compile, go to another room to test, come back, code for an hour, repeat
12:28casionwith the occasional 'oh shit oh shit, cut the power' moments of running
12:28TimMczerokarmaleft: My physical therapist would probably give me a very disapproving look if I tried that.
12:29casionand sitting/standing repeatedly is pretty difficult for me given my size and physical condition
12:29casionso trying to stay standing is probably a reasonable idea
12:29casion(tall + orthostatic hypotension)
12:29zerokarmalefttechnomancy: were you typing in the hammock or just thinking?
12:30technomancyzerokarmaleft: I was documenting. =)
12:30TimMccasion: If you get a tall chair (architect's chair?) you pretty much just bring your legs up -- your torso hardly moves vertically at all.
12:30TimMcI'd fall over if I got one of those, though -- I tend to lean backwards.
12:31casionTimMc: I've tried that… and I'm sitting in one now
12:31casionit's a 'normal' chair for me
12:31casionyet to find a taller one that'd serve me the indended purpose
12:33zerokarmalefti had a college roommate that swore by his kneeling chair yet never seemed noticed that he was also constantly twisting his back to get his vertebrae aligned
12:33casionI have a zafu that I sit on the floor with when I know I dont have to get up for a while
12:33casionthat I use for morning meditation anyway
12:33casionbut it's rare that such a circumstance comes up
12:36pipelinei have an ergotron arm thing
12:36pipelinewith a keyboard tray
12:36pipelineit goes up and down with a finger pressure
12:36pipelinecounterweighted, like window sashes
12:36dnolenoof, http://stackoverflow.com/questions/12176832/quicksort-in-clojure/12182450
12:37dnolenI like Mike Anderson, but can we please upvote the fast non-macro qsort :)
12:37casionpipeline: that sounds interesting
12:37dnolenwe need to stop disseminating horrible optimization advice.
12:38casionthat is some intense code wow
12:38casionI'll take the few extra ms thank you very much
12:54naegHow would you calculate all the possible diagonal winning combinations for a connect four board?
12:55naegrows and cols are simple list comps, but seems cumbersome for diagonals
13:01scriptornaeg: another alternative is to keep track of the number of valid neighbors with each new piece
13:02scriptorso, when a piece drops it adds 1 to the score of each neighbor, finds the highest value, and stores that as its score
13:02scriptorif it's 4, there's a winner
13:03pipelinethis is a project euler problem btw
13:04ejacksonnaeg: sounds like a good example with which to try out core.logic
13:05naegscriptor: the algorithm I chose to check for a winner is to store all winning combinations in a hash (there are 69 in total), then on each turn pull out those combinations of which the new coordinate is part of
13:07naegejackson: for the whole algorithm to check for a winner or to generate the diagonal winning combinations for that hash solution?
13:07ejacksonthe whole algo
13:07scriptornaeg: can't you go through each combination and check if any of them have 4 of the same color?
13:07scriptor(each relevant combination, that is)
13:08ejacksonyou have a data structure, and some rules that define what a winner looks like, should be doable in core.logic
13:08naegscriptor: that's what I'm doing?
13:08uvtcscriptor: that's the brute-force method, I think.
13:08uvtc(scriptor: I mean the method you just mentioned.)
13:09naegscriptor: e.g. new coin at (0 0) - go through all pre-stored winning combinations which contain (0 0) and see whether there are four of that new coin in any of those combinations
13:09S11001001thorbjornDX: as a heavy user of clojure lazyseqs and python generators, I can attest that nDuff's difference makes the former radically more usable
13:09naegthe max. of possible winning combinations for a new coin is 12 - on the corners its much less
13:10scriptornaeg: where does the diagonal issue come in? I'm picturing each combination being just a list of positions that you can just reduce over, so maybe something like [(0 0) (1 1) (2 2) (3 3)]
13:11scriptoruvtc: wouldn't the brute force solution be check every combination in the entire board with each new coin?
13:12naegscriptor: those are the winning combinations for the rows and columns: http://bpaste.net/show/nkTgFlu8ntchnfLlRcqJ/
13:12uvtcscriptor: Right. Sorry, I wasn't reading closely enough. I think the brute force method is to just check the entire board after every move, and check for a winner.
13:12naeg45 in total, now i need the 24 diagonal winning combinations
13:12naegnot as easy to express with a list comp as rows/cols
13:12scriptornaeg: ah, so you're asking about generating the combinations in the first place, got it
13:13casionnaeg: are you generating combonations or winning positions?
13:13naegyeah, exactly ;)
13:13TimMcnaeg: To get all descending diagonals, take all positions but the last 3 columns and rows and make diagonals from those.
13:13TimMcSame for ascending.
13:13casionif you're trying to get the winning positions, process the playing board 12 blocks of 4
13:13TimMcTHat is, those are the starting positions for the diags.
13:14casionyou only have 4 columns and 3 rows where a diagonal win can take place
13:14casion^ starting position for a 4x4 set
13:14naeggood idea TimMc - first calculate only the starting positions of the diagonals
13:14scriptoruvtc: yep, mine is more of a count as you go along method, you just need to go through the neighbors once for each new coin
13:16naegcasion: not sure, did you mean the same?
13:16casionnaeg: I believe so
13:16SgeoCan I unforce a delay somehow? As in, make it revert to being a computation to do in the future?
13:17casionnaeg: I'm saying just start at the upper left corner and process in blocks of 4 against 2 sets of winning diagonals
13:17naegI'm still curious about what I could do with core.logic as ejackson suggested. With core.logic I can do almost the same as with Prolog, right?
13:17casionthen you only have to 'check' 12 blocks
13:18casionnaeg: it's worth noting that if 'you' are the second move, there's winning positions that will not occur
13:19casionbecause the opponent will win with the prior move
13:19naegcasion: I guess it would not be worth fiddling them out, would it?
13:20naegmax. possible winning combinations are 12 and much less in most cases
13:20casionnaeg: if you have the first move, you can force a win anyway...
13:21casionso it kind of depends on your goal :)
13:21naegcasion: afaik not. the second player, if he's playing perfectly, can make a draw
13:21casionnaeg: nope
13:21casionfirst player can always force a win
13:21naegare you 100% sure?
13:21casionif he desires
13:21casionyes
13:22naegI thought if both play perfect it's a draw
13:22casionhttp://homepages.cwi.nl/~tromp/c4/c4.html
13:23casionwriting a connect four game really only involves writing the portion that plays second player
13:23casionfirst player is trivial
13:24naegI know about victor allis thesis, but a year pasted since I looked into it the last time
13:24naegI plan to implement a minimax algo
13:26casionminimax for a game where player one's best move is always max eval is a bit silly
13:26casionand secong player's best move, is at best 0.00
13:30naegcasion: doesn't victor allis write about the minimax in his thesis too? (but only considering meaningful branches of the tree)
13:30casionI don't recall
13:30casionI thought he generated a table base
13:30naegI just remembered, I might confuse a few things with this one: http://www.ccs.neu.edu/home/eclip5e/classes/csu520/index.html
13:30naegthey use minimax with alpha beta pruning
13:31casionit'd be a good exercise perhaps
13:31casionbut not exactly 'useful'
13:32naegI probably have to dig deeper again before implementing the AI, doesn't matter for now anyway. I might come back to you, if you're interested and having time
13:32casionsure
13:44thorbjornDXS11001001: that makes sense. Whenever I have wanted to use and reuse a python generator, I end up just storing it in a python list/tuple/dict, so there's another layer there
13:52lynaghk`ping: ohpauleez
13:53ohpauleezlynaghk: pong
13:54S11001001thorbjornDX: and that's error-prone as well
13:55S11001001thorbjornDX: https://bazaar.launchpad.net/~scompall/+junk/autoconflate--mainline/view/head:/autoconflate/configure.py#L38 :)
13:58naegis there a replacement for: (fn [loc] [(inc (loc 0)) (inc (loc 1))])
13:59S11001001naeg: mapv inc
13:59naegdidn't know about mapv, thanks
14:00scriptor,(mapv inc [0 1])
14:00amalloythat works only if we're assuming loc is a vector of exactly two elements, right?
14:00clojurebot[1 2]
14:00naegamalloy: yes, it is
14:00FrozenlockIs there way to obtain the last known focus in cljs?
14:01abalone,(mapv inc [4 3 2 1)]
14:01clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
14:01abalonesigh
14:01S11001001I also learned about mapv here not too long ago; it's the circle of #clojure
14:01abalone you know what i mean
14:01abalone,(mapv inc [4 3 2 1])
14:01clojurebot[5 4 3 2]
14:02metellus,(map inc [4 3 2 1])
14:02clojurebot(5 4 3 2)
14:02S11001001,(-> [1 2] reversed reversed class)
14:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reversed in this context, compiling:(NO_SOURCE_PATH:0)>
14:03abaloneamalloy: may i ask, what is the concern?
14:04S11001001,(-> [1 2] rseq rseq class)
14:04clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to resolve symbol: pr-str in this context, compiling:(NO_SOURCE_PATH:0)>
14:04amalloyhuh?
14:04abalone"that works only if we're assuming loc is a vector of exactly two elements, right?"
14:04metellusthe vector returned by mapv will have the same number of elements as loc
14:05metellusbut the question only cared about the first two elements in loc
14:05abaloneah. right
14:05amalloy(mapv inc loc) is not a correct improvement of that function if: loc has five elements but it's intended to use only the first two; or loc is a map with keys 0 and 1; or loc is (fn [x] (case x 0 'foo 1 'bar))
14:05S11001001I guessed what naeg meant
14:09naegand you were right
14:09amalloyyes indeed, it's a guess that's quite likely to be right. i just wanted to make sure it was clear what we were assuming
14:19ro_stohpauleez: ping
14:26ro_stohpauleez: i'm unable to resolve shoreleave-*-0.2.2-SNAPSHOT when doing lein deps
14:36shaungilchristwhat ever happened to incanter?
14:36samnardoniWhat's the best way to go from: [ [:a :b :c] [:d] [:e :f] ] to {:a 0 :b 0 :c 0 :d 1 :e 2 :f 2} (ie
14:37samnardonii.e., go from vector of vectors to map of inner elements to the index of their outer element... (if that makes any sense)
14:37`fogusshaungilchrist: It still out there no?
14:38shaungilchristyep for sure I just heard it was not being actively developed?
14:38shaungilchristI wonder if thatis that just because it has reached a stable/useable state?
14:38ro_stnetiher is 'ls' but you use that, don't you? -grin-
14:38`fogusIf I recall a group of devs in the UK were pushing fixes and updates
14:38`fogusshaungilchrist: ^^
14:39samnardoniI have: (apply hash-map (flatten (map-indexed (fn [i x] (map (fn [z] [z i]) x)) y))) gives the correct result, but doesn't seem like the best way to do it
14:39amalloy~flatten
14:39clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
14:40ro_st*quietly refactors flatten out of his code*
14:42naegHow to get from [0 0] to [0 0] [1 1] [2 2] [3 3]? trying around with mapv and dotimes, but that doesn't work
14:43chouser,(apply merge (map-indexed #(zipmap %2 (repeat %1)) [[:a :b :c] [:d] [:e :f]]))
14:43clojurebot{:e 2, :f 2, :d 1, :c 0, :b 0, ...}
14:43shaungilchristsamnardoni: (let [flat-keys (flatten [[:a :b] [:c :d]])] (zipmap flat-keys (repeat (count flat-keys) 0)))
14:44amalloyoh, i like chouser's. another approach is at https://gist.github.com/3516903
14:45chouserI should have used reduce
14:46SegFaultAX|work2I'm having trouble getting started on this in Clojure: http://www.4clojure.com/problem/84
14:46SegFaultAX|work2I have a working Python version, but I can't get my head around a Clojure solution.
14:47chousernaeg: do you want (for [a (range 4)] [a a]) ?
14:48amalloychouser: any time to look at http://dev.clojure.org/jira/browse/CLJ-865 again? trying to see if i can get this screened while relevance is still in an accepting mood
14:48naegchouser: oh, nope. it's not that regular. it could be [1 0] => [1 0] [2 1] [3 2] [4 3]
14:48ro_stanyone using datomic in production, or working towards doing so?
14:48amalloy&(take 4 (iterate (partial mapv inc) [0 0]))
14:48lazybot⇒ ([0 0] [1 1] [2 2] [3 3])
14:49shaungilchristro_st: working towards doing so - licensing is trickiest aspect for us
14:49naegI tired with iterate too, but didn't think of partial! thanks amalloy
14:50ro_stshaungilchrist: for me too. i can't gauge how much scale i can actually accomplish with the free version
14:51ro_sti very much want to use it. is everything rhickey and stu halloway talk about in their talks in Datomic as it stands now?
14:51shaungilchristro_st: for us it is determining how to include licensing cost in product cost when currently they utilize mssql which the customers usually have license for
14:52ro_stah. for us it's 'merely' a matter of affording it. we plan to use heroku when we scale past our current custom-built vps. can't use datomic free on there.
14:55ro_stseems to be little in the way of how to actually use it with clojure on the web
14:56stuarthallowayseancorfield: you around?
14:56ro_stoh, look, one of datomic's creators
14:58ro_ststuarthalloway: is there a getting-started-with-clojure-and-datomic resource you can point me to?
14:58stuarthallowayro_st: if you follow the tutorial (http://docs.datomic.com/tutorial.html), it is in Java, as you probably noticed
14:59ro_styup, just been scanning through it now
14:59stuarthallowaybut, there is a samples/seattle/getting-started.clj in the distro that covers the same stuff
15:00stuarthallowayand can be evaluated within a REPL launched via bin/repl in the distro
15:00ro_stoh, super
15:00ro_stthanks
15:01ro_stif i were to start with Free, is it obvious how to integrate the storage side into the rest of our stuff, i.t.o. database backup and restore? also, i'm guessing Free is not usable with Heroku, which we plan to use
15:03stuarthallowayro_st: Datomic currently has command-line backup and restore: http://docs.datomic.com/backup.html
15:03stuarthallowayyou should be able to make everything work with Heroku, so long as you can define a trusted network boundary, and have the peers and transactor inside that boundary
15:04stuarthallowayI think several people on the mailing list (datomic@googlegroups.com) are working with Datomic in Heroku, if you plan on going that way you may want to vet the Heroku specifics there
15:04ro_stwhere would the transactor store its data, given that H has ephemerial slug storage?
15:05stuarthallowayI think people have deemed that ephemeral storage, plus an hourly call to backup, as sufficient for their needs
15:05ro_stinteresting!
15:05hiredmanyou may not be able to run the transactor in heroku, unless heroku provides it as a service or whatever
15:05ro_sti'll trawl the list for more. thanks
15:06hiredmansince don't they tend to migrate processes and such?
15:06ro_strich is a great salesman for datomic :-)
15:07ro_stwell, a great salesman for values.
15:08SgeoIs there a convenient way to play with clojars from the REPL?
15:08SgeoWithout needing to make a project?
15:09SgeoSomething similar to quicklisp's quickload
15:09cemerickSgeo: see pomegranate
15:10SgeoMade by you
15:10SgeoIs this going to happen in every language, where there are a few famous creators whose work everyone else relies on?
15:10SgeoAnd they're in the IRC channel too
15:10ro_st'grats on 1.0 for friend, cemerick!
15:10SgeoI don't know why it makes me so uneasy
15:11hiredmanb
15:11clojurebotB is C
15:11cemerickro_st: no, no, no, 0.1.0 :-)
15:11ro_stSgeo: on the contrary, it makes me much more at ease. i can talk to them!
15:11ro_staren't leading zeros silent? -grin-
15:11casionSgeo: this isn't a proprietary environment
15:11SgeoIt makes me think Clojure's bus factor is small
15:11casionif someone disappears there's always someone eles
15:11casionelse*
15:12`fogusSgeo: Not as small as 4 years ago
15:12cemerickwhat `fogus said
15:13cemerickro_st: for these reasons (and others), I do what I can to choose stuff built by people that are accessible; irc > ML > twitter, but random libraries thrown over the wall *does* make me uneasy.
15:14ro_stsure. one has to be critical of what one allows inside the walls
15:14`fogus(inc cemerick)
15:14lazybot⇒ 9
15:14naegthis is how I finally managed to calculate all winning combinations of connect four: http://bpaste.net/show/91gVR4DXl2DiTs1VjmgH/
15:15ro_stwhat i like about OSS in general is that you're using code that solved somebody's problem, rather than something someone made cos they think it's pretty
15:15naegwould be great if someone could take a look and tell me whether that's fine (rly unsure about how i put them all together)
15:16Sgeoro_st, what if my problem is that everyone else's code isn't pretty enough, so I make something because I think it's pretty?
15:17ro_sti'll accuse you of being a pedant -grin-
15:17SgeoI should probably test my fork of the monad stuff
15:17casionnaeg: wouldnt ([0 0] [0 1] [0 2] [0 3]) be a winning column?
15:17ro_stand an engineer
15:17cemerick"pretty" is always a big factor in any case. That's why every language has 40 different database abstractions.
15:18cemerickWell, 4 maybe, but whatever.
15:18naegcasion: sure?
15:18chouserro_st: not as complimentary as "a gentleman and a scholar", but "a engineer and a pedant" is probably more often accurate.
15:18casionnaeg: that's what is generated by rows, I think it maybe mislabled?
15:18`fogussounds redundant to me
15:18casionit confused me for a sec at least
15:18chouser`fogus: :-)
15:19amalloynaeg: (apply concat (for [x foo] (for [y bar] baz))) is (for [x foo, y bar] baz)
15:19SgeoI am also annoyed that the more common monad library on Clojure does the Maybe monad wrongly
15:20chouserSgeo: see also http://www.clojure.net/2012/06/03/Monad-Protocols/
15:20samrathow do I turn off debug mode in Noir? (to avoid the stacktraces showing up)
15:20amalloycasion: a common representation for coordinates in board games on a computer is [y x], where 0 0 is top-left corner. in that context what you asked about is a row
15:20naegcasion: nope, your coords are a winning row - it's [y x]
15:21ro_stchouser, `fogus :-) that's the spirit in which it was… awarded
15:21Sgeochouser, I'm pretty sure that doesn't do Applicative and Functor properly either
15:21SgeoBut it does fix some of my issues with the other one
15:22ro_stsamrat: env LEIN_NO_DEV=true or something like that
15:22naegamalloy: but it's a 3-times nested for?
15:22casionhmm, I don't think I've ever explicitely seen [y x] for a board represetation
15:22xeqisamrat: change :mode you start the server with
15:22ro_stweavejester told me, i can't remember the right name
15:22weavejesterro_st: You got it right
15:23SgeoBut the fact that it uses protocols instead of generic methods might make it harder to _fix_ my problems with the approach
15:23weavejesterIn Lein2 profiles can be used instead of that variable
15:25ro_stohpauleez: you around? shoreleave 0.2.2-SNAPSHOT has done a runner
15:25ro_stthanks for the confirm, weavejester!
15:26naegamalloy: oh, you meant that one at the diagonals - that's right, sorry
15:26amalloychouser: that's pretty cool. i think his suggestion that it's easy to make hash-map a monad is a little off, though - there's no good way to implement bind; i don't think haskell has a monad instance for Data.Map
15:30naegamalloy: also, the last let with a let in the bindings itself does only look weird to me as a newbie?
15:33jsabeaudryWhy is clojuredocs.org trolling me? (Trying searching for "str" "def" "ns"...)
15:34dakronejsabeaudry: type it into the search box but don't press enter and select it from the suggestions
15:34dakronethe search is a little wonky
15:34scriptorjsabeaudry: it's better to use the js drop-down that clojuredocs gives you in the search box
15:34scriptoryea, I don't understand why it doesn't sort the main results in the same way the autocomplete is sorted
15:35jsabeaudryah that is how that tool works, thanks for the info
15:36Sgeoamalloy, the reason Haskell doesn't have a Monad instance for Data.Map is because the type of bind would need to indicate that the keys are orderable
15:38goodieboyis there a way to make "take", return values but using the same collection type that was passed in? For example, (take 3 [1 2 3 4 5]) returns a list. I have a function that uses take, and sometimes lists are passed in, sometimes vectors are passed in. I want the same type returned.
15:39ro_stinteresting question
15:39nz-,(into [] (take 3 [1 2 3 4 5]))
15:39clojurebot[1 2 3]
15:39ro_stnz, i think he's saying that his fn doesn't necessarily know which type it'll be
15:39dnolengoodieboy: no, sequence fns always return sequences.
15:40goodieboyexactly, i don't know what type
15:40llasram&((fn my-take [n coll] (into (empty coll) (take n coll))) [1 2 3 4 5])
15:40lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox65663$eval77151$my-take
15:40goodieboydnolen: ok thanks
15:40llasram&((fn my-take [n coll] (into (empty coll) (take n coll))) 3 [1 2 3 4 5])
15:40lazybot⇒ [1 2 3]
15:40goodieboyahh
15:40llasramBut, why?
15:40ro_stdnolen: your tweets are very diverting. my reading list grows every day!
15:40nz-ro_st: you could build that functionality if know how to get empty version of paramereter vector/list
15:41nz-,(doc empty)
15:41clojurebot"([coll]); Returns an empty collection of the same category as coll, or nil"
15:41Sgeo,(doc into)
15:41clojurebot"([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
15:41jkkramerexcept… ##((fn my-take [n coll] (into (empty coll) (take n coll))) 3 '(1 2 3 4))
15:41lazybot⇒ (3 2 1)
15:41nz-,(into (empty [1 2 3 4 5]) (take 3 [1 2 3 4 5]))
15:41clojurebot[1 2 3]
15:41Sgeo&(into '() [1 2 3])
15:41lazybot⇒ (3 2 1)
15:41ro_stneeeaaat!
15:41dnolenro_st: haha, I'm way behind too, I fear I will never actually catch up.
15:42dnolenRaynes: did you ever try that Node.js CLJS fix?
15:43ro_stnz, sgeo: very cool
15:43ro_stsimple, but very cool!
15:43Sgeoamalloy, hmm, didn't think that through, I should have said set... I think?
15:44amalloySgeo: haskell can't have a monad instance for Map k v, because the type constructor takes two types
15:45amalloybut i think it *also* can't have a monad instance, even for Map Int v, because there's no good way to implement: Map Int v `bind` (v -> Map Int v) :: Map Int v
15:45SgeoI should think about how to implement the reverse state monad
15:46SgeoIt might be easier to ask whether join can be implemented, since that's the same question but may be easier to understand.
15:47SgeoJoining a Map Int (Map Int v) into a Map Int v
15:48amalloyright, that's the same problem as bind
15:48ordnungswidrigdnolen: i skimmed over oz on fd today. this is great stuff. Can you elaborate how kanren is related to oz? Or is it an independent implementation of logic programming?
15:49jsabeaudryAh, too bad CLJ-107 never made it
15:49jsabeaudryseems like most reasonable to me
15:50Sgeoamalloy, there's definitely a function of that type. But I have a feeling that it wouldn't obey the monadic laws with a join defined like that
15:52dnolen_ordnungswidrig: Mozart/OZ was initiated by Peter Van Roy and other folks - Van Roy worked on Aquarius Prolog, an experiment to see if Prolog could possibly compete w/ lower level languages like C.
15:52dnolen_kind like the Orbit Scheme of the Prolog world
15:53dnolen_Mozart/OZ tries to implement enough functionality to simulate all the paradigms - including logic programming.
15:53ordnungswidrigso the algorithms of how to solve the logic problem is implementet as a mozart/oz program?
15:53dnolen_logic programming of course presents many performance issues - one of those being search. So constraints have long been a research topic in the LP community.
15:54abaloneis this a good way to end up with a flattened collection of results? (reduce concat (map some-fn some-list))
15:54ordnungswidrigthat means that one you use this to optimize how core.logic searches for solutions?
15:54dnolen_ordnungswidrig: well Mozart/OZ has a design which makes it easy to express logic programming and a bunch of other things.
15:54dnolen_ordnungswidrig: no, Moart/OZ itself is written in C.
15:55dnolen_ordnungswidrig: but the series of events occurred w/ miniKanren.
15:55llasramabalone: (apply concat ...) is probably better
15:55ivaraasendnolen_: one of my courses next semester is all Mozart/OZ. seems like a pretty cool language, albeit slow
15:55dnolen_ordnungswidrig: Oleg & Dan Friedman wanted to see if they could get something as fast as SWI in Scheme (and note that SWI is not the fastest Prolog)
15:55Sgeo,(doc mapcat)
15:55clojurebot"([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection."
15:56dnolen_ordnungswidrig: they succeeded, but of course they discovered Prolog is not that great for many kinds of problems, so they started exploring CLP.
15:56ordnungswidrigdnolen_: ok, you got me wrong. I thought of the algorithms how fd constraint programming is _implemented_ in oz. and if this can be "mixed into" core.logic
15:56dnolen_ordnungswidrig: the real difference here is that miniKanren is a purely functional implementation of LP, which eliminates many difficulties of lower level implementation.
15:56llasramSgeo, abalone: Oops, I only read so far as (reduce concat ...) didn't even see the rest. Agree for the specific case of (apply concat (map ...)), def just -> (mapcat ..)
15:57Sgeo,(mapcat (fn [x] (vector x (+ 1 x)) [1 2 3 4 5])
15:57clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
15:57Sgeo,(mapcat (fn [x] (vector x (+ 1 x)) [1 2 3 4 5]))
15:57clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$map>
15:57Sgeo,(mapcat (fn [x] (vector x (+ 1 x))) [1 2 3 4 5])
15:57clojurebot(1 2 2 3 3 ...)
15:57abaloneSgeo, llasram: thanks! mapcat does seem to be exactly what i want... but why was apply concat better than reduce concat?
15:57ordnungswidrigdnolen_: so assuming there was an implementation like FD/CLP for OZ in clojure, this could substitute core.logic?
15:58dnolen_ordnungswidrig: there's no need really. Mozart/OZ implementation does a lot of work (i imagine in C). We have CLP in cKanren, but the approach is different since we're working in a functional context.
15:58dnolen_ordnungswidrig: I think you're missing what I'm saying :) we have CLP(FD) in core.logic *today*
15:58SgeoAm I allowed to find it amusing that there's a core.logic discussion occurring concurrently and separately with/from a mapcat discussion?
15:58ordnungswidrigdnolen_: I know, but the "solver" works differently that CLP(FD) in OZ, right?
15:58SgeoBecause they're secretly related.
15:59emezeskeabalone: (apply concat ...) will call concat once, wheras (reduce concat ...) will call concat a bunch of times
15:59abaloneno secrets please. i want to know everything
15:59dnolen_ordnungswidrig: yes, but I'm not sure how that's relevant.
15:59llasramabalone: (reduce concat ...) will call 'concat' once for each item in the input sequence, vs (apply concat ...) just calling concat once with the sequence of all the arguments
15:59dnolen_ordnungswidrig: beyond comparing the approaches of course.
15:59emezeskellasram: jinx
15:59ordnungswidrigSgeo: shh, you're disrupting the entanglement!
15:59llasramman, I type too slow emezeske :-p
15:59emezeskellasram: ^_^
16:00ordnungswidrigdnolen_: I got the impression that the concept of distributors is what make oz more powerful than core.logic (for now)
16:00S11001001abalone: moreover it will call concat a bunch of times in the wrong direction
16:00abaloneemezeske Sgeo llasram: ah thanks! man, so much help around here, i'm afraid i'm going to forget to thank someone
16:01S11001001(using concat iteratively is unsafe in general)
16:01abaloneS11001001: thanks :-P hm. ah.
16:01dnolen_ordnungswidrig: right. You can't customize the strategy.
16:02SgeoI should totally make a newtype library
16:02ordnungswidrigdnolen_: I remember from like 15 years ago, that you need to manually cut in prolog. so I suppose beyond being declarative there is the need to tune the "how-to-solve" as well.
16:03Sgeo...or not, that is a bit silly
16:04SgeoWHY are things like deref working on IDeref not documented outside of the source?
16:04dnolen_ordnungswidrig: being able to define the strategy seems powerful but I don't yet understand all the performance implications nor the complexity for consumers of such an interface.
16:04jimdueySgeo: Konrad talks about the probability monad dist-m here
16:04jimdueyhttp://onclojure.com/2009/04/24/a-monad-tutorial-for-clojure-programmers-part-4/
16:05SgeoOh hey jimduey
16:05jimdueyIt uses a hash-map as its container value.
16:05dnolen_ordnungswidrig: so it's not on the table in the near term for core.logic. unless of course someone else wants to take that on.
16:05jimdueyhey.
16:05ordnungswidrigdnolen_: I have next to no knowledge of kanren, so I trust you regarding this.
16:05SgeoDid you see my fork of ... I guess Konrad's monad stuff?
16:05jimdueynope. been buried
16:05Sgeo(It's just m-lift as a function that doesn't need to know how many arguments)
16:06ordnungswidrigthere will the day that I'll read the little schemer
16:06SgeoAlthough I haven't tested it
16:06jimdueyordnungswidrig: you definitely should. great read, deep code. and all the authors are going to be at Strangeloop next month. :)
16:07Sgeohttps://github.com/Sgeo/algo.monads/blob/master/src/main/clojure/clojure/algo/monads.clj#L270
16:07ordnungswidrigjimduey: between strangeloop and me is a whole ocean
16:07dnolen_ordnungswidrig: it may in fact be simple to do, cKanren has a critical step called force-ans. distributors are all about controlling which possibilities are considered first.
16:07SgeoPlease tell me m-seq returns a monadic value representing a sequence, because that's what I assumed
16:07dnolen_force-ans does this work, but it's naive.
16:08ivaraasenI wish I had the money to go to CUFP this year
16:08ordnungswidrigdnolen_: I supposed that there must be some kind of "branch-logic" at some point. bread vs. deep, picking an element etc.
16:09Sgeojimduey, anyway, it should be possible to define Functors and Applicatives separately from Monads, and I'm disappointed that the libraries I've seen don't allow for that
16:09ordnungswidrig. o O ( when will github fix syntax highlighting for @ in clojure code ? )
16:13FrozenlockI've make dynamic shortcut handling for cljs (kinda like emacs) heavily inspired by https://github.com/AndreasKostler/dyscord. However I'm able to differentiate between local and global shortcut. I would like to offer to possibility to show the key-sequences on screen in a friendly manner (not the log). Any suggestion on how I could do this?
16:15jimdueySgeo: I
16:15shaungilchristFrozenlock - you mean like a growl-like approach perhaps?
16:15FrozenlockWhat's growl-like?
16:15FrozenlockRaaaaAAAAr? :P
16:15shaungilchristwhere the notifications "stack" in what ever corner (usually top right)
16:16shaungilchristand slowly fade out or close on click
16:16jimdueySgeo: I'm not sure the answer to your question above. Will have to go check.
16:16dnolen_ordnungswidrig: actually I think it will be easy. Will probably try to look into after a 0.8.0 release
16:17FrozenlockHmm I'm sure... I would like to show the entire keysequences (which I have stored in an atom).
16:18shaungilchristhttp://boedesign.com/demos/gritter/ is sort of what I meant
16:18Frozenlockshaungilchrist: Looks great!
16:19shaungilchristyeah I'd set the timeout a lot quicker than what they have on the demo so they sort of bubble up and fade quickly to not be too distracting
16:20FrozenlockIndeed. Or I would just discard them once the key sequence is completed.
16:21FrozenlockOh it's jquery :(
16:21amalloyjimduey: did you notice the remark about Map not having a good monad instance? seems like a bad idea to mention it in the blog post
16:21shaungilchristit would be sort of cool to have a key sequence auto complete where it shows the other "branches" you can go from your current key combo
16:21Frozenlockshaungilchrist: Woah, wait I need to complete the basics before :p
16:21shaungilchristfrozenlock: it would not be difficult to implement from scratch using enfocus or what not
16:23FrozenlockWell at this point I could just build it on top of Domina; that's what I'm already using. I'll just make a quick check for "growl" now that I know it's what I'm lookign for.
16:23Frozenlockshaungilchrist: Thanks :)
16:23jmlis there a way to see the source code for a class that gen-class makes?
16:23shaungilchrist*google domina*
16:23shaungilchristI have not seen that
16:23Frozenlockhttps://github.com/levand/domina
16:24jmlI'd like to understand what's going on better
16:24amalloyjml: it doesn't generate (java) source code at all. jvm bytecodes
16:24amalloyyou can disassemble the .class file
16:25abalone"no disassemble!"
16:25Raynesneed inpuuuuuut
16:25abalonehaha
16:25Raynesabalone: <3
16:26RaynesShort Circuit fans, unite!
16:26RaynesForm of, cute robot!
16:26Sgeo...I heard "no disassemble" in a Lemon Demon song
16:27gtrakhuh, 'not' is a function, how about that
16:27ohpauleezIf you pinged me in the last hour or so, I missed it
16:27Rayneshttp://en.wikipedia.org/wiki/Short_Circuit for reference
16:27abaloneis it surprising that not is a fn?
16:27Raynesohpauleez: Oh thank God, we all though you had died.
16:28ohpauleezRaynes: haha
16:28gtraka little, though not when I think about it
16:28Raynes$clojuredocs not
16:28lazybotclojure.core/if-not: http://clojuredocs.org/v/1537; clojure.core/not=: http://clojuredocs.org/v/1530; clojure.contrib.monads/m-when-not: http://clojuredocs.org/v/771; clojure.contrib.except/throw-if-not: http://clojuredocs.org/v/296; clojure.contrib.error-kit/do-not-handle: http://clojuredocs.org/v/289
16:28SgeoAh, so the Lemon Demon song makes a Short Circuit reference
16:28RaynesGood work finding every function except the one I asked for, lazybot
16:28gtrakheh, see?
16:28gtrakeven lazybot is surprised
16:28SgeoI mean, it said "Have they forgotten Johnny 5", but didn't know that Johnny 5 was from a film called Short Circuit
16:29SgeoIt's Clojuredocs. Don't expect sane sorting.
16:29jimdueyamalloy: I saw that. I think you can have a monad that uses a hash-map as its container. The bind would determine what kind of monad it would be.
16:29jml"Since the implementations of the methods of the generated class occur in Clojure functions, they have no access to the inherited protected fields of the superclass." ah, that's the badger.
16:29jimdueyFor instance, a probability monad could be built that way.
16:30amalloyjimduey: yes, but nobody should do it that way because you can only have *one* monad using a hashmap as its container
16:30amalloyplus it wouldn't work on an array-map
16:30Sgeo..Oh, "container" as in...
16:31SgeoI think I see
16:31SgeoWhat you'd do instead of using a data declaration in Haskell
16:31jimdueyamalloy: Precisely the reason I didn't include one in.
16:32jimdueySgeo: I'm not familiar with the data declaration.
16:32naegHow can I iterate over only those items of coll which pass a certain test?
16:32naegthought some would do it, but not really
16:32Sgeojimduey, it's how you make a type in Haskell.
16:33Sgeodata MyType = ConOne String Int | ConTwo [String]
16:33jkkramernaeg: filter
16:33SgeoExamples of MyTypes: ConOne "Hello" 5
16:34SgeoConTwo ["Hello", "Goodbye"]
16:34naegjkkramer: *facepalm* oh yeah
16:34naegthanks
16:34jimdueySgeo: I don't think you need that in clojure
16:34SgeoYeah, you could use a map, with maybe a :con key
16:35SgeoI think you did Maybe correctly, so for reference, here is Maybe in Haskell:
16:35Sgeodata Maybe a = Nothing | Just a
16:35Sgeo(modulo some deriving clauses)
16:45Sgeojimduey, you know what I should do? Write a macro that takes a join function and expands into code to implement a monad
16:46Sgeo(Or maybe just takes a join function and a return function and gives a bind function.)
16:46SgeoFor some monads, it's probably easier to write join than bind
16:46jimdueySgeo: possibly. that could be pretty easy with protocol monads.
16:47amalloySgeo: why would it be a macro? make it a function, right?
16:48Sgeoamalloy, yeah, that makes more sense
16:56FrozenlockIs there something in leiningen to rename a project?
16:56bonegaHi, could someone explain why I would do a var quote in this situation?
16:57bonega(defn animation [x]
16:57bonega (when running
16:57bonega (send-off *agent* #'animation))
16:57bonega (Thread/sleep animation-sleep-ms)
16:57bonega (.repaint @panel)
16:57bonega nil)
16:57jeremyheilerFrozenlock: What would you expect it to do? Change the namespaces in the clj files?
16:58casionbonega: https://www.refheap.com/paste is your friend
16:58Frozenlockjeremyheiler: Well yeah, I'm sure I would mess up something doing it by hand. :P
16:58ChongLiis there a clojure equivalent to haskell's zipWith
16:58ChongLi?
16:58amalloy~zip
16:58clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
16:58ChongLioh, cool
16:59ChongLiwait, that's not the same as zipWith
16:59amalloyyes it is
16:59dnolen_,(map +[1 2 3] [3 2 1])
16:59clojurebot(4 4 4)
16:59bonegacasion: thanks. Here it is https://www.refheap.com/paste/6359d295337d9ef7da4682e67
16:59ChongLioh, okay
16:59ChongLiduh :)
16:59ChongLithanks
16:59SgeoPrelude zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
17:00amalloy(map list a b) ~= zipWith (,) a b
17:00SgeoI want to :/ at the confluencing of list with (,) but meh
17:03casionbonega: http://stackoverflow.com/questions/5964997/clojure-agent-question-using-send-off
17:03jeremyheilerFrozenlock: So really you want a "change all namespaces" tool? lol
17:06Sgeo:/ at that
17:06SgeoSo it's not so easy to change code at the REPL unless you're careful?
17:08S11001001Sgeo: s,you're careful,you write idiomatic clojure and occasionally toss in #' at your shims,
17:08Sgeoshims?
17:08S11001001the borders between whatever execution framework you're using and your actually-doing-stuff code
17:09S11001001likewise, there are for most simple macros two macro implementing strategies
17:09S11001001one that just pours everything into the expansion, and the other which factors as much as reasonable out to a function
17:10S11001001the latter is easier to debug and means you have cascading reloads less often (as you're more likely to have to change just a function instead of a macro, triggering recompile of all its users)
17:11SgeoWait, "triggering recompile".... if I redefine a macro at a REPL, will its users be ... modified, or would I manually have to recompile them?
17:11S11001001latter
17:12SgeoAh, ok
17:12SgeoFormer would be kind of cool
17:12S11001001sure, but it would complicate the compiler, and serves as a good canary right now
17:12S11001001if you are changing macros too often, time to factor parts of them into functions you can manipulate without a reload cascade
17:13bonegaCasion: thanks, but I still don't understand
17:13bonegaif I change the definition of animation and evaluate it I still see the changes regardless of var quote
17:16S11001001bonega: ah, that might be a clj1.2 vs 1.3 thing
17:16S11001001bonega: for that particular example #' would have been needed pre-1.3
17:17bonegaI see, how confusing :D
17:17SgeoWhy is so much Clojure stuff undocumented?
17:17SgeoAs in, deref doesn't explicitely mention IDeref except in the source
17:17shaungilchristkeeps the magic alive
17:17technomancyIDeref is an implementation detail
17:18Sgeo:/ so I shouldn't make my own IDerefs then?
17:18dnolen_Sgeo: because it's only ~5 years old?
17:18dnolen_Sgeo: I disagree w/ technomancy - the lack of documentation around protocols is unfortunate.
17:18technomancywell, I'm not saying it *should* be an implementation detail
17:19dnolen_Sgeo: well, on the JVM they are interfaces - elsewhere the story is a bit better.
17:19bonegaSo, var quote should mostly be used for some weird meta-data or something? Not for code-reloading in >= 1.3?
17:20dnolen_Sgeo: but perhaps in some sense they are subject to change on the JVM and somewhat more considered in CLJS because hindsight is 20/20
17:21Sgeodnolen_, hmm, what's the situation in CLJS?
17:21dnolen_Sgeo: everything is built ontop of protocols.
17:22pjstadigSgeo: multimethods are nice, but usually overkill, and slow compared to protocols
17:22S11001001I agree with shaungilchrist; it's more fun the way it is
17:23hiredmanmultimethods can be much slower due to lock overhead
17:24amalloyhiredman: that patch got accepted for 1.5, i think, right?
17:24technomancyI sure hope so
17:25hiredmanamalloy: I just glanced over the commits and didn't see it in
17:26amalloyyeah, i'm wrong. it's screened now, but not yet accepted or applied
17:35djanatynare there any good clojure libraries for generating graphs and charts?
17:35technomancydjanatyn: I used incanter for http://lein-survey.herokuapp.com
17:35technomancybut it was kind of a pain
17:36brehauttechnomancy: time to make a quil-charts lib
17:37lynaghkdjanatyn: depends how custom you want stuff. I wrote C2 as a set of tools for building custom statistical graphics in Clojure/ClojureScript. It's not exactly a charting library though, since there's no "make me a bar chart" function or anything like that
17:37djanatynI was thinking about using quil
17:37lynaghkdjanatyn: http://keminglabs.com/c2/
17:38djanatynlynaghk: that's exactly what I wanted! thank you.
17:38lynaghkdjanatyn: C2 is only really useful for HTML/SVG output, though, so you'll need to turn to something like phantomjs if you want to rasterize on the serverside.
17:38thorbjornDXdjanatyn: c2 is based on d3.js if you didn't know
17:38Sgeo" 1.1 Earmuffed Vars are No Longer Automatically Considered Dynamic
17:38Sgeo"
17:38thorbjornDXdjanatyn: inspired by
17:39SgeoHmm, that could break code that was written for 1.2, right?
17:39lynaghkdjanatyn: sure thing. Drop me a line if you have any questions about it. We use it on almost all of our projects, but I have no idea what other people are doing with it (if anything).
17:39djanatynhmm. I'll try both Incanter and C2
17:40technomancyhere's what I ended up doing with incanter: https://github.com/technomancy/lein-survey/blob/master/src/lein_survey/results.clj#L51
17:40SgeoOh, it gives warnings
17:45nDuffIs there a way to be within a dosync's scope during the assignment portion of a let, but not in the body (where those values are being used)?
17:45technomancynDuff: you could destructure a dosync
17:45nDuffAhh, that works.
17:46nDuff(not very pretty, but works)
17:47amalloyeh? what does destructure have to do with it? (let [x (dosync ...)] (...use x...))
17:47technomancyamalloy: if you need multiple values calculated in the same transaction
17:47amalloysure
17:47technomancyI'm assuming if he didn't then he wouldn't be asking =)
17:48amalloyoh, i see. you're thinking he wants multiple things bound in the let, all in the same dosync
17:48amalloywhich is probably correct; i didn't get it
17:48SgeoWhy is every-pred called every-pred and some-fn is some-fn?
17:48SgeoWhy not every-pred and some-pred or every-fn and some-fn?
17:49naegchecking connect four field: http://bpaste.net/show/7xHePXFnDd1sRTqH8uQX/
17:49naegwhat do you think? it's quite fast imo
17:50naegcheck-board works, but the return value is strange. () when a player won and all the possible winning combinations for given coordinates if no one won
17:50naeg(saying that it works is quite brave from my side, didn't test it really)
17:58SgeoHow do I sort the problems on 4clojure by number?
18:03hyPiRion,(map #(str "http://www.4clojure.com/problem/&quot; %) (range 153))
18:03clojurebot("http://www.4clojure.com/problem/0&quot; "http://www.4clojure.com/problem/1&quot; "http://www.4clojure.com/problem/2&quot; "http://www.4clojure.com/problem/3&quot; "http://www.4clojure.com/problem/4&quot; ...)
18:06Frozenlo`To package a cljs library, do I just need to lein uberjar as usual and send it to clojars?
18:06amalloy(inc hyPiRion)
18:06lazybot⇒ 2
18:06amalloydoesn't actually work though, because not every problem id is used. some problems got submitted, had ids assigned, and were declined
18:08hiredmanseancorfield: ping
18:10emezeskeFrozenlock: I don't think you should be putting uberjars on clojars
18:10FrozenlockI don't... that's just how I always compile :)
18:10emezeskeFrozenlock: Shouldn't a regular jar be enough?
18:11FrozenlockYes, uberjar gives you both. I'm just used to always getting a uberjar for my own needs.
18:11FrozenlockBut other then that, that's the way to go?
18:11emezeskeFrozenlock: But anyway to respond to your original question:
18:12emezeskeYeah, that's the way to go. In some cases, you might want lein-cljsbuild's :jar option to help with that, but I don't know if it's always necessary
18:12emezeske(You can always like "jar tf ..." to see if the cljs files were included as you expected)
18:13FrozenlockIsn't it what " :cljsbuild {:builds [{:jar true..." is for? (Really, I'm clueless here)
18:14emezeskeYeah, you're on the right track!
18:14FrozenlockYay!
18:14FrozenlockThanks!
18:14emezeskeI'd definitely do a "jar tf" just to make sure that the cljs files were included.
18:14emezeskeOf course there are other ways to test that...
18:15hiredmananyone using java.jdbc having issues with the new (post 1.3) numerics stuff?
18:17naegwhy does this return true instead of a value for that range?
18:17naeg,(some #(= (get-in [[" "], [" "], [" "]] [% 0]) " ") (range 2 -1 -1))
18:17clojurebottrue
18:18hiredmanI think our issues are mostly around clojure.lang.BigInt vs. java.lang.BigDecimal, with java.lang.BigDecimal (as comes out of jdbc) not being = to any bigints from clojure
18:18hiredmannaeg: read the docs on some?
18:18hiredman,(doc some)
18:18clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
18:19Frozenlockemezeske: It doesn't do the uber-cool-google-compile-thingy when wrapping in a jar?
18:19naeghiredman: I thought it should return a x? like in:
18:19naeg,(some #{1} [0 1 2 3])
18:19clojurebot1
18:19naegbut that's because it's a set, right? hm...
18:19emezeskeFrozenlock: So :jar true is for releasing, say, a clojurescript library that other clojurescript code will use (e.g. through requiring it)
18:20emezeskeFrozenlock: To do :advanced compilation, all of the clojurescript source code has to be available at compile-time
18:21naegcorrect like that?
18:21naeg,(some #(if (= (get-in [[" "], [" "], [" "]] [% 0]) " ") % nil) (range 2 -1 -1))
18:21clojurebot2
18:21FrozenlockOk, so it is up to those who uses the library to compile it, correct?
18:21Frozenlock*use
18:21emezeskeYep!
18:22FrozenlockExcellent, thank you very much!
18:22hiredmannaeg: you may what to consider just taking the first of a filter
18:22emezeskeThe 3rd party doesn't have to do anything special, though; if they depend on your jar, and (require ...) something from it, compilation will automatically include it
18:22emezeskeNo prob
18:23naeghiredman: seems better
18:24hyPiRionnaeg:
18:24hyPiRioner
18:24hyPiRionnvm
18:37FrozenlockThere: https://github.com/Frozenlock/zizanie, my first clojurescript library. I intend to add more, but at least it works :-)
18:39FrozenlockI must say, I'm quite surprised by how well the `global-set-key' VS `local-set-key' works.
18:40jeremyheiler(inc Frozenlock)
18:40lazybot⇒ 1
18:44FrozenlockNow, for the notifications part, I will probably use the closure popup api. Any suggestions?
18:44Frozenlock(it's for showing the pending key sequences)
18:50nz-Frozenlock: nice
18:51FrozenlockThanks. Now I just need a working in-browser repl :)
18:51FrozenlockFor some reason I can't get Himera started.
18:59naegis there a way to check whether take-while consumed the whole seq?
19:06emezeskenaeg: I don't think so (at least not without like counting the seq or something)
19:06Sgeo"If you want to see every step of execution you can pass an optional third
19:06Sgeoargument of true to run-push."
19:06emezeskenaeg: The implementation of take-while is super simple, though; it would be easy to make your own that told you whether it hit the end
19:06SgeoUgh, non-keyword boolean arguments are ugly
19:09amalloywat. (= coll (take-while f coll))?
19:13emezeskeamalloy: Doesn't that realize the whole seq?
19:13goodieboyanyone here use cheshire, the json library?
19:13amalloy&(= (range) (take 1 (range)))
19:13lazybot⇒ false
19:13dakronegoodieboy: yes
19:13technomancypretty much everyone
19:14emezeskeamalloy: That makes sense.
19:14goodieboygood! we use it in production, but discovered today that it does not escape unicode characters, which blew up our front-end. Swapping it out with clojure.data.json fixed the problem, but I'm thinking there has to be a way to do this with cheshire?
19:14emezeskeamalloy: I guess I was picturing a huge seq where you might not want to compare the whole thing, but that isn't actually indicated in the question
19:15emezeskenaeg: See amalloys comments above, and don't listen to me.
19:15technomancygoodieboy: why would you want unicode characters escaped?
19:15technomancyUTF-8 is part of the JSON standard
19:16ivannot all Unicode codepoints can be sent through all transports
19:16hiredmantechnomancy: maybe he means unicode characters encoded as something other than utf8?
19:16technomancyhiredman: then it's no longer json
19:17ivan"JSON text SHALL be encoded in Unicode. The default encoding is UTF-8."
19:17hiredmangoodieboy: you might want to check your default file encoding
19:17webbenIndeed. http://tools.ietf.org/html/rfc4627#section-3
19:18hiredmangoodieboy: although whatever method you are using to write data, clojure.data.json and cheshire should end up writing out to the same encoding
19:19hiredmangoodieboy: anyway, I think if you find any differences, I am inclined to call whatever cheshire does as correct
19:20hiredmanclojure.data.json has some provisions for reading hex literals, but I am pretty sure those are not part of json
19:21FrozenlockMy google skills are proving ineffective. Is there really no notifications library for closure? :(
19:21ivangoodieboy wants \uxxxx
19:21goodieboyoops sorry, had to step away for a minute
19:22SgeoWhat happens if I want to use a library that specifies Clojure 1.3.0 in Clojure 1.4.0?
19:23goodieboyivan: yes, like this: \u2028
19:23ivanheh, cheshire fails to do that?
19:23ivan(for that codepoint)
19:23emezeskeSgeo: There's a good chance it will just work -- if your project specifies an explicit clojure version, that's what will be used
19:23emezeskeSgeo: But if the library is broken by some 1.4 change, you're in trouble
19:23goodieboywell, it does handle that, but the unicode (real line separator) breaks our javascript, where as the \u2028 does not
19:23Sgeoemezeske, but if the library's project.clj specifies a different Clojure version...
19:24nDuffSgeo: Yours overrides.
19:24nDuffSgeo: (in general; if version ranges are in use, things get more complicated)
19:25ivangoodieboy: I would file a bug for that
19:25ivanand maybe a bug for \uxxxx'ing all non-ascii
19:25lotiagreetings all. Using lein2 and woking on a noir project in emacs. When I do a "lein repl" in a termainal within the noir project directory, it automatically loads in the correct namespaces.
19:25lotiahow do i get that to work when I call nrepl-jack=in within emacs?
19:26lotias/nrepl-jack=in/nreplc-jack-in/
19:26goodieboyivan: ok thanks!
19:27ivansimplejson does ASCII output by default, and it does \u2028 right in either case
19:31goodieboyivan: is \u2028 hex literal?
19:32ivanit's a six-character sequence with a hexadecimal unicode codepoint
19:34dakronegoodieboy: I can add that feature pretty easily if desired, please put a ticket in so I can do that
19:34dakrone(just to remind me)
19:34ivanman this RFC sucks
19:34ivanit keeps saying "character" but people transfer non-character codepoints
19:35goodieboydakrone: cool thanks! i'll see if i can get that done tonight
19:35dakronegoodieboy: I'll try to get it done tomorrow, if not it may have to wait a couple of weeks while I'm out of the country
19:36goodieboydakrone: awesome thanks! :)
20:00dakronegoodieboy: added in https://github.com/dakrone/cheshire/commit/bacb3acb1dd0489cbf46f5a0596732383e3b4c66 , I will cut a release later tonight
20:08jeremyheilerCan someone help me understand why I am getting this stackplosion? https://www.refheap.com/paste/4723
20:10hiredmanjeremyheiler: double check your mail.clj file to see it really matches what is in the paste
20:10hiredmanmain.clj
20:10RaynesYou don't need that vector around foo.core unless you're actually going to use :refer or :as.
20:10RaynesI don't think that causes this particular error though.
20:11SgeoLamina pipelines remind me of monads
20:11technomancyit's there for loosk
20:11technomancylooks
20:11RaynesFor uglies.
20:11jeremyheilerYeah, I had ":as core" in there, but took it out to simplify it.
20:11technomancynot as much as your face
20:12jeremyheilerhiredman, the only thing different is that all the functions I have in those files are commented with ; at the beginning of each line.
20:12goodieboydakrone: THANKS, very much appreciated
20:12Sgeo*sigh*
20:12SgeoI hate map.
20:12SgeoIf map were sufficiently general, Lamina shouldn't need to provide a map*
20:12SgeoJust define map on its channels
20:12SgeoBut instead, it's defined for sequences only.
20:12ChongLiyou should try Haskell's map
20:13ChongLiit's defined for lists
20:13ChongLiand only one list at that
20:13hiredmanjeremyheiler: are you sure you want foo.core under :main there instead of foo.main?
20:13SgeoAt least there's fmap
20:13ahkurtzfmap however is defined on almost everything
20:13emezeskeSgeo: Isn't there some interface that can be implemented to make something seqable?
20:13ChongLiyeah, it's just silly that fmap has to exist
20:13ChongLibecause map was written so long ago
20:14jeremyheilerhiredman, that was a typo i made in the original paste. it really is ":main foo.main"
20:14Sgeoemezeske, yeah, but it's not applicable to everything that it makes sense to map over
20:14hiredman:(
20:14amalloySgeo: the only way to get a language where everything is exactly as you want it, is to write one yourself
20:14ChongLithis is one of the things that drew me to clojure: the core standard library actually makes use of all the cool stuff
20:14jeremyheileryeah, im going nuts over this lol
20:15emezeskeSgeo: What would it not be applicable to, for example?
20:15hiredmanjeremyheiler: the :( was for asking for help then giving a mistranscribed paste
20:16jeremyheilerI edited it immediately after I pasted it, sorry. didn't think anybody was that quick.
20:16Sgeoemezeske, a continuation monadic value.
20:16hiredmanjeremyheiler: what are you doing that results in that exception? running lein? what command?
20:17SgeoAt least, I don't _think_ it's applicable there
20:17jeremyheileras the paste says, "lein run" (and i "lein clean" just before)
20:17emezeskeSgeo: Well I'm not a monad expert, but I was under the impression that was exactly what fmap was for
20:18emezeskeSgeo: Are you really writing functions that don't know whether they'll be passed a monad or a seq?
20:18Sgeoemezeske, fmap is only called fmap because Haskell's map was not sufficiently general. If there was a do-over, fmap would be called map.
20:20jkkramer4
20:21hiredmanjeremyheiler: my guess is while pasting(and editing) your example you made other changes, most likely turning something like (ns foo.main require [foo.core]) in to what you have in the paste, or you left out some stuff from the paste
20:22hiredmanas the paste is right now there is nothing in foo.core so it does nothing, but maybe in the realy code you have foo.main loading foo.core or something
20:23hiredmanmayber there is (ns foo.main (:use [whatever.bleh :only x])) somewhere
20:25hiredman(and your gist doesn't mention lein run anywhere)
20:25jeremyheilerhiredman: I really have commented out everything except for what is in the paste, and those are the only two files (namespaces) I have. The only thing that seems to change the outcome is removing (:require [foo.core]) from foo.main
20:25jeremyheiler(line 11)
20:26hiredmanis that the complete namespace for foo.core?
20:26hiredmancomplete ns form
20:26jeremyheileryes
20:26hiredmanI don't believe you
20:28hiredmanall evidence points to bad ns form
20:29eriderwhich one is better to use hash-map or {}
20:29hiredman{}
20:30eriderok thanks
20:31FrozenlockTrying to use this in cljs: http://closure-library.googlecode.com/svn/trunk/closure/goog/demos/timers.html
20:32Frozenlock(def asdf (create-delayed-function #(js/alert "ho!") 1000)) => #<[object Object]>
20:32FrozenlockNice, but then when I want to start the timer: (.start asdf) => #<TypeError: Object [object Object] has no method 'start'>
20:33FrozenlockAm I not using the method like I should?
20:35jeremyheilerhiredman: Maybe my computer is just messed up. I kept running "clear; lein clean; lein run" over and over again, and started noticing that I would not constantly get the error (but I would get it most of the time) with out editing any files.
20:36zaargyhi all. i was just trying out something i found on stack overflow and i can't work out why the (.getName d) after the Files in this paste doesn't print out anything for me? http://pastebin.com/FAWSEvf9
20:37zaargyalso wouldn't it be better to have a function that constructs the list and then print it out nicely in another function?
20:38amalloy,(.getName (java.io.File. "/"))
20:38clojurebot""
20:39zaargysure
20:39zaargybut in the above it doesn't print out antyhing
20:39zaargyit works elsewhere
20:39zaargyelsewhere in the function that so was a bit confused about what the different was
20:40amalloy/ is a directory whose name is the empty string
20:40amalloyit successfully prints zero characters
20:41zaargya ha
20:41zaargysorry i see your thing now
20:48FrozenlockEh... I don't know why, but it works when I call the entire name: goog.async.Delay.
20:50emezeskeFrozenlock: Are you aware of the (:require ...) restrictions in cljs?
20:50FrozenlockMaybe... :) I know I need to require the constructor too. --> [goog.async :as async] [goog.async.Delay :as Delay]
20:51tomojI still am confused about that
20:51emezeskeFrozenlock: Requiring the constructor like that looks very wrong to me (but I don't know what would be right)
20:52tomojhttps://groups.google.com/d/topic/clojure/etFN-sdBS6c/discussion http://dev.clojure.org/jira/browse/CLJS-312
20:52FrozenlockIs there another way to make it work? iirc, if I don't require it, I can't call it even when I write goog.async.Delay.
20:52emezeskeFrozenlock: I think for the constructor you should :import instead of :require, maybe?
20:53tomoj:import is not supported yet
20:53FrozenlockOh. I've never used :import o_O
20:53tomoj[goog.async :as async :refer [Delay]] maybe?
20:54emezeskeFrozenlock: I think you need to (:import goog.async.Delay) in your (ns ...)
20:54tomoj:import is not supported yet (or did they sneak it in in another patch or something?)
20:54tomojCLJS-312 "Support :import" is unresolved
20:54emezeskeOh, nevermind me then
20:54emezeskeDamn
20:54emezeskeI have no ide athen
20:54Frozenlocktomoj: bullseye
20:55FrozenlockNow I'm wondering wall requiring the directly the constructor worked :s
20:55FrozenlockAnyway, thanks!
20:56tomoj[goog.async :as async :refer [Delay]] doesn't work?
20:56tomojoh
20:56FrozenlockYes it works.
20:56tomojI read "bullseye" as "bullshit"
20:56Frozenlocklol!
20:58jeremyheilerAre there any known issues with clojure on java 7?
20:59Frozenlockjeremyheiler: Not that I can tell.
21:00uvtcjeremyheiler: I'm using OpenJDK 7 on GNU/Linux and it seems fine.
21:03jeremyheilerI've been using it for a while, too. I'm just getting a lot of weird errors in a project that worked fine on a different machine with jdk6 earlier. Now I am wondering if I've copied in some odd whitespace issues.
21:06casionanyone using nrepl-ritz, and if so how's it working out for you?
21:08dnolenemezeske: ping
21:09emezeskednolen: pong
21:10dnolenemezeske: I thinking about moving forward with the printing patch ...
21:10dnolenemezeske: warning can be separate ticket.
21:11emezeskednolen: Arg, sorry that I haven't gotten around to that yet X_X
21:11dnolenemezeske: no worries, I don't feel like letting that ticket languish since what's there is good.
21:12emezeskednolen: I think that's reasonable -- as long as the warning gets added before the old ways is removed, that should be fine
21:13dnolenemezeske: one question about the implementation ... it seems a bit strange that the printer is a function?
21:13dnolenemezeske: hmm actually I guess not since you leverage it taking multiple args
21:14emezeskednolen: A function as opposed to what?
21:14emezeskednolen: (I'm not at my workstation atm)
21:15dnolenemezeske: it's just that in Clojure it's all done via the JVM Writer inerface - but it's probably not a big deal ...
21:15dnolenemezeske: I was hoping folks w/ review the ticket but no such luck :)
21:16dnolenreview the patch I mean.
21:16emezeskednolen: Ooh, I hadn't thought of that
21:17emezeskednolen: Is there an equivalent interface in cljs?
21:17FrozenlockOk I have this function: (create-delayed-function fn delay). `fn' need to apply the method .dispose on the result of create-delayed-function. I would like to do this without any atoms, so purely functional. Is there a way?
21:18amalloya function seems most natural to me: it's a Writer because java doesn't have functions and Writer is the basic output mechanism; in js the basic output mechanism is a function (console.log)
21:18dnolenemezeske: writer / printer does seem more appropriate given some folks might want to redirect when working with node.js ...
21:19emezeskednolen: Without the source in front of me it's hard to comment
21:20S11001001Frozenlock: I think you've mixed up some of your metasyntactic vars; do you mean by the latter `create-delayed-function' `delay', and by the latter `fn', `create-delayed-function's result'?
21:20ChongLihow would I go about mapping a Java method over a sequence?
21:20emezeskednolen: I could take a look a little later tonight
21:21dnolenamalloy: yes, but given various other places where you might run JS I'm just wondering if there are benefits to a writer protocol?
21:21S11001001ChongLi: #(.getBlah x y z) is a clojure function that calls the java getBlah method on x with args y and z
21:21jeremyheilerChongLi: You can use an anonymous function like &(map #(Math/pow % 2) (range 0 5))
21:21jeremyheilerAh, too slow...
21:22ChongLiI want to map Math/log over a sequence of numbers
21:22Frozenlock(def abc (create-delayed-function fn delay)). The delayed function fn-> (defn fn [] (.dispose abc))
21:23Frozenlockhttp://clojure.github.com/clojure/clojure.core-api.html#clojure.core/trampoline?
21:23clojurebothttp://clojure.org is timeless.
21:23ChongLi(map Math/log (seq 1 2 3 4))
21:23ChongLiunable to find static field: log
21:23ChongLisorry, I'm not a Java programmer
21:23S11001001ChongLi: see lines from jeremyheiler and myself
21:24tmciver,(map #(Math/log %) (seq 1 2 3 4))
21:24clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core$seq>
21:24jeremyheiler,(map #(Math/log %) [1 2 3 4])
21:24clojurebot(0.0 0.6931471805599453 1.0986122886681098 1.3862943611198906)
21:24S11001001aww tmciver
21:24ChongLiahhh thanks
21:24tmciver:(
21:25S11001001jeremyheiler: well if you're just going to give away the answer :)
21:25jeremyheilerI basically did earlier, just with Math/pow lol
21:33dnolenemezeske: added some comments to the ticket, worth pondering a little bit more I think. That said I think we're close.
21:37emezeskednolen: Cool, I'll try to take a look later tonight.
21:38pandeiroemezeske: any horizon for your fetch-esque code to go public?
21:38emezeskepandeiro: Hooo... No, I don't know when I'll have a chance to work on that.
21:38pandeiroi am still trying to figure out the sanest skeleton for writing async-heavy, clojure/cljs apps
21:39emezeskepandeiro: Maybe I can find some way to work that into the blog series I'm doing about my experiences developing my seating charts app
21:39pandeiroemezeske: that would be really cool
21:43FrozenlockScew that, I'll use an atom.
22:05xeqi$findfn [1 2] [1 2 3] true
22:05lazybot[clojure.set/subset? clojure.core/not= clojure.core/distinct?]
22:06amalloyxeqi: are you looking for https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L242 ?
22:07xeqiyep
22:07xeqithanks amalloy
22:11amalloythat impl probably isn't as lazy as it should be, though. i really need to break the (if-let [[x & xs] (seq coll)]) habit
22:11xeqithat one might be more memory efficent then (fn [l1 l2] (= (take (count l1) l2) l1)) ?
22:11xeqiah, its lazier
22:12amalloyxeqi: the simplest impl is (every? true? (map = xs ys))
22:12xeqihaha
22:12amalloybut then you get back true if either one is shorter, which might be what you want, or not
22:13ChongLihttps://www.refheap.com/paste/4726
22:13ChongLianyone have some advice on making this more idiomatic?
22:14ChongLibesides the indentation, which I can't get right on this site
22:15amalloythat looks fine to me. you could use iterate to generate an infinite seq of guesses, and drop-while it's not good-enough? but i doubt that comes out looking better
22:17ChongLihmmm
22:18ChongLiI guess I just need to get better at reading S expressions
22:18ChongLiso my eyes don't get crossed from the parens :)
22:19amalloyChongLi: if the guess function is bothering you, you can use -> to nest the math less
22:20ChongLinot sure how to do that
22:21amalloy(->> (inc (* k 2)) (/ (Math/pow -1 k)) (* 4) (+ o)) would be one way
22:22amalloyor perhaps (-> (Math/pow -1 k) (/ (inc (* k 2))) (* 4) (+ o))
22:25ChongLiyeah that looks nicer
22:27ChongLiit looks really nice when you put each function on its own line
23:30axle_512sorry in advance for the newb question… what is the relationship between clojure.core and other "core" libraries? (e.g. core.match, core.logic, core.cache)
23:30ChongLiI'd like to know this one as well, I'm a newb too :)
23:31jeremyheilerThe other libraries are just not included in the clojure.jar
23:31cshellThey're just additional libraries of clojure functions
23:31cshellso you use only what you need
23:32axle_512any reason why they are labelled as "core"? Does anyone create a library with core.x or are these libraries affiliated with the clojure.core team?
23:32arohner_is there any circumstance where count will return nil?
23:32ChongLialright so who's ready for some more category theory?
23:32ChongLihahaha
23:32ChongLiI love Rich
23:33amalloyarohner: no, it's not possible
23:33arohneraxle_512: many of the contrib libraries labeled 'core' are looking to become part of the official release
23:34axle_512arohner: thanks!
23:34axle_512cshell, jeremyheiler: thanks!
23:34amalloyreally? i don't think that's true except in the quite long term
23:53XPheriorDoes does calling has-a-different result in Clojure complaining that java.lang.Class doesn't implement Differentiate? (type (attribute description)) can resolve to Integer or Long or String and it still dispatches to Class.
23:53XPheriorMeant there to be a "Why" at the beginning of that. Sorry.