#clojure log - Feb 04 2013

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

0:01 Frozenlock: durka42: Not pro, but I did use it. Question?

0:16 I'm tempted to use a reader literal for an application... is there some thing I should be careful with?

0:19 durka42: Frozenlock: I think I'm all set

0:20 I wanted the cholcov() function from matlab

0:20 but I realized I can just look at the matlab source and port it

0:20 Frozenlock: alright

0:21 Btw, if you want an alternative to matlab, https://www.gnu.org/software/octave/

0:21 durka42: oh I know :p

0:21 but I hate the matlab language also

0:21 so I'm trying to use clojure as my alternative

0:38 zerokarmaleft: durka42: julia might be worth looking into as well, and its perf is impressive

0:38 durka42: true

0:53 sshack: Other than emacs, what's the editor de jour for Clojure on OSX these days?

0:58 JanxSpirit: if I run a 'lein repl' in my project directory, the repl should load with the project dependencies on the classpath correct?

1:00 durka42: sshack: I'm using macvim with vim-clojure-static and foreplay

1:01 sshack: durka42: I should have remembered about vim.

1:02 durka42: oh, and RainbowParentheses :)

1:03 xeqi: JanxSpirit: yes

1:03 though you start in the user namespace, and might need to change or (require ..) them

1:04 sshack: durka42: So you've recreated a scene from "Hackers" then?

1:04 JanxSpirit: xeqi: so I have added the monger dependency, but when I try to require it, clojure can't find it

1:04 durka42: sshack: don't think I've seen that one

1:04 JanxSpirit: sorry - I'm new to lein/clojure - just trying to figure out what I have wrong

1:05 durka42: but, probably :)

1:05 sshack: durka42: It's an absolute classic.

1:06 A gritty, real life look at the hacker scene in the 90's.;

1:06 durka42: okay, I'll put it on the list of "absolute classics I have to get to sometime"

1:06 xeqi: JanxSpirit: did you start the repl after adding monger to the :dependencies in project.clj?

1:07 JanxSpirit: I did

1:07 sshack: durka42: http://www.youtube.com/watch?v=Ql1uLyuWra8

1:07 JanxSpirit: and lein classpath shows the jar on the path

1:07 sshack: Good soundtrack too.

1:11 xeqi: JanxSpirit: https://www.refheap.com/paste/9390 ; what are you trying to require?

1:14 lynaghk: dnolen: if we change to `fnc` do you think we should also change `defc` to `defnc` to be consistent?

1:17 dnolen: lynaghk: yeah that's probably a good idea - I don't think many people are relying yet on `defc` and it's an easy change to account for.

1:18 JanxSpirit: xeqi: I had everything except the '

1:18 xeqi: (:require [monger.core :as mg])

1:18 xeqi: thanks - what does the ' mean?

1:19 xeqi: JanxSpirit: if you (:require ..) is used in (ns ...). (require '...) is used outside the (ns ..) declaration

1:19 s/if you//

1:19 JanxSpirit: ah gotcha

1:19 xeqi: ' makes it a symbol

1:19 JanxSpirit: thanks!

1:19 lynaghk: dnolen: cool, pushed.

1:21 dnolen: lynaghk: I'm kinda leaning towards something that looks like this http://gist.github.com/4705272

1:21 lynaghk: would mean putting the unifier in it's own namespace, and changing the api somewhat

1:21 lynaghk: dnolen: not sure what goes in the dots. Why a special let keyword?

1:22 dnolen: lynaghk: it's annoying that you can't name subforms

1:22 lynaghk: :let would allow you to do that

1:24 lynaghk: gist updated

1:25 lynaghk: dnolen: whoaaa this is confusing. Same as (unifier '((?y ?z) ?a) '(?b [1 2 3])) ?

1:26 that can't be right. in that example you're not using ?x twice

1:26 dnolen: lynaghk: pretty much, the point of :let is that we don't have anything like :as like when you destructuring

1:26 sorry, the example is a bit silly

1:28 lynaghk: updated the gist again

1:29 lynaghk: ?y and ?z would be bound to "foo" and 9? the unifier doesn't respect the concrete types, right?

1:29 dnolen: lynaghk: updated yet again w/ comment

1:29 lynaghk: ah, I see.

1:29 dnolen: lynaghk: yes, sorry the point is to get some of the flexibity of destructuring

1:30 you want to name ?y ?z and also the list that contains them.

1:30 lynaghk: dnolen: Yeah, sure---presumably this would be useful when you want to twiddle the inside of some form but pass that entire form to a constraint

1:30 dnolen: lynaghk: yeah

1:31 perhaps let is bad

1:31 here

1:31 changing to as

1:31 lynaghk: updated

1:31 lynaghk: dnolen: I think as is better. I'm surprised to see "let" and then a map instead of a binding vector.

1:31 dnolen: lynaghk: agreed

1:32 lynaghk: dnolen: do you remember what syntax we agreed on for constraints of multiple lvars?

1:33 dnolen: lynaghk: I think options as map is better - I'm not sure what else we'll want to add, and keywords args stink unless you're really certain about the api

1:33 lynaghk: a set / vector

1:33 lynaghk: dnolen: a vector as the key, with the constraint having the realized values in the same order?

1:34 we can't do a set because of the ordering.

1:34 dnolen: lynaghk: so we can do both!

1:34 lynaghk: set if you don't care, vector if you do.

1:34 lynaghk: dnolen: options map is fine with me. I won't be able to say much until I try expressing the grammar of graphics rewrites in this system

1:34 dnolen: lynaghk: but maybe I'm forgetting precisely what you want to do?

1:35 as far as constraints on multiple vars

1:35 lynaghk: dnolen: here's the old wishlist: https://gist.github.com/4004131

1:35 dnolen: lynaghk: oh I remember

1:35 a constraint relationship between two vars

1:35 lynaghk: dnolen: yeah

1:37 dnolen: the simplest being a predicate taking [dataset, dimension] to see if, say, that dimension has string values or numeric values.

1:37 dnolen: gist updated

1:37 lynaghk: dnolen: yeah, looks great.

1:38 the quoting lvars is annoying, but not sure if there's a nice way to get around that without too much hackery/surprise

1:39 dnolen: lynaghk: yeah I don't really see what we can do about that at all

1:40 lynaghk: dnolen: do you need me to submit the fnc stuff via JIRA, or is the github fork okay?

1:41 dnolen: lynaghk: if you like we could just get you push rights to core.logic :)

1:42 lynaghk: dnolen: dude, I can't handle that! I haven't read any of the miniKanren papers yet!

1:43 dnolen: lynaghk: :P

1:43 lynaghk: I'm sure you can handle it

1:43 lynaghk: go ahead add a patch to JIRA and I'll ping clojure-dev so that things are easier in the future.

1:44 lynaghk: as far as the defc -> defnc - did you grep for that in the whole project

1:44 lynaghk: okay, sounds good.

1:44 yeah

1:44 dnolen: it's used in a couple places I think

1:44 ok cool

1:53 lynaghk: dnolen: okay, after going through JIRA and getting git to spit out a patch I changed my mind and am happy to have commit rights on github =)

3:52 borkdude: a while ago there was this library on twitter about doing OO in Clojure - I know it sounds evil, but what was this library?

3:52 p_l: borkdude: ummm, clojure is pretty fine with OO...

3:52 just maybe not with Java-ish COP

3:53 borkdude: p_l I mean the more Java-ish OO then

4:07 broquaint: Was it this, borkdude - https://github.com/bodil/pylon

4:16 borkdude: broquaint tnx

6:26 bosie: how common is it to write tests immediately in the function?

6:27 babilen: bosie: Are you referring to something like doctests in Python?

6:28 bosie: babilen: yes. and i saw the same happening in clojure

6:29 babilen: Oh, I haven't. /me waits for an answer too

6:35 bosie: babilen: are you using vim for clj?

6:35 babilen: yes, I am

6:36 bosie: babilen: vimclojure?

6:36 babilen: i am trying to find a way to re-indent code

6:36 babilen: I used to, but I switched to foreplay and lein's nrepl ever since Meikel endorsed it

6:36 bosie: ok

6:37 babilen: bosie: Select the code you want to re-indent (visual mode) and run "="

6:37 bosie: yea that doesn't work

6:37 trying foreplay now

6:37 qz: babilen: are you using paredit?

6:38 babilen: bosie: It does! I am using it every single day :)

6:38 qz: No, I can't stand it (i.e. "Have not yet grown accustomed to it")

6:39 qz: babilen: i'm very new to lisp syntax and editing files without it is such a pain..

6:45 Bodil: Oops... prebooka speakers for DevoxxFR er annonsert. http://www.devoxx.com/display/FR13/Devoxxians

6:45 Darth Odersky, we meet at last...

6:46 whoa, wrong channel :)

6:46 Too early in the morning for internets.

7:46 hyPiRion: How dare you fill up #clojure with old norse

7:49 vagmi: \q

8:06 pablo__: Hi

8:07 I have a little interop question.

8:08 I'm doing some Java interop, and I'm trying to access an entry in a Clojure map, but the keys are keywords (like :my-key). Is there a way to create a Keyword object from Java or should I convert all my keys to string before handing them over to Java?

8:18 Sgeo: ,(class :foo)

8:18 clojurebot: clojure.lang.Keyword

8:18 Sgeo: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Keyword.java

8:19 Hmm

8:19 ,(clojure.lang.Keyword/intern "foo")

8:19 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

8:20 Sgeo: http://ideone.com/Exsxb3

8:20 So I guess it's clojure.lang.Keyword("foo") to get :foo

8:20 erm, oops

8:20 clojure.lang.Keyword.intern("foo")

8:21 pablo__, ^

8:23 pablo__: Sgeo: thanks

8:23 Sgeo: You're welcome

8:25 pablo__: Sgeo: hum, looks like the String param of intern() is the nsname...

8:25 Sgeo: I think I found another solution in the end: clojure.walk/stringify-keys

8:26 Sgeo: http://ideone.com/hGnsfA

8:26 (= :foo (clojure.lang.Keyword/intern "foo")) gave me true

8:27 Hmm, are you sure you want to do it like that? That will also affect nested maps

8:27 ,(require 'clojure.walk)

8:27 clojurebot: nil

8:27 Sgeo: ,(clojure.walk/stringify-keys {:foo {:bar :baz}})

8:27 clojurebot: {"foo" {"bar" :baz}}

8:28 pablo__: I have to read a map from Java, so either I create Keywords in Java or I convert all the Keywords to Strings...

8:29 Sgeo: ,(= "foo" "foo)

8:29 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>

8:29 Sgeo: ,(= "foo" "foo")

8:29 clojurebot: true

8:29 Sgeo: ,(identical? "foo" "foo")

8:29 clojurebot: true

8:29 * Sgeo forgot whether Java strings are mutable

8:30 Sgeo: Ah, ok, immutable

8:30 good

8:30 pisketti: yes, unlike anything else

8:42 joegallo_: ,(identical? "foo" (String. "foo"))

8:42 clojurebot: false

8:43 joegallo_: not all strings are interned, though, so you shouldn't necessarily assume that equivalent strings are identical

9:14 pjstadig: ,(identical? "foo" (.intern (String. "foo")))

9:14 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

9:14 pjstadig: interesting

9:15 normally that would be true, except for clojurebot's security

9:17 alexnixon: and for fun: &| [(identical? 42 42) (identical? 142 142)] |&

9:17 lazybot: ⇒ [true false]

9:18 cemerick: alexnixon: only integers < 128 are fixnums

9:18 that's a jvm thing

9:18 I guess they're all jvm things :-P

9:18 p_l: ... dafuq. Can't you use the 4byte ones?

9:19 alexnixon: well I think /technically/ it's a Java thing (i.e. it's the implementation of Integer.valueOf, rather than some JVM magic)

9:20 and I've used up my week's pedantry quota in one sentence

9:20 cemerick: quite right

9:20 p_l: well, internally, there are bytes <-127,127>, shorts (16bit signed), integers (32bit signed) and I think longs were also "native" (64bit signed)

9:20 isnt' it?

9:20 cemerick: alexnixon: you use up a budget; you meet a quota.

9:21 Fight pedantry with pedantry, amirite?

9:21 ;-)

9:21 * p_l sees how it could fail the identical? check

9:21 alexnixon: -.-

9:21 p_l: it's hitting the infamous integer cache?

9:21 the one that let's you make 2+2 equal 6?

9:22 and otherwise returns freshly-allocated object wrappers and does EQ check on them?

9:24 alexnixon: yeah it's the cache, though I'm not sure I've seen the 2+2=6 example

9:27 p_l: alexnixon: there's a "logic bomb" posted somewhere which slowly corrupts the cache

9:31 jcrossley3: llasram: awesome damballa sponsorship of atl-clj!

10:04 a|i: when interoping with java, which way is the most used one?: (Classname. args*) or (new Classname args*)

10:04 Ember-: (Classname. args*) imho

10:10 biff_tannen: how can i make lein re-generate my README file based on changes in my project.clj ?

10:11 joegallo_: like what changes?

10:11 https://github.com/technomancy/leiningen/blob/master/resources/leiningen/new/default/README.md

10:11 looking at the template itself, i'm not sure it would do anything differently.

10:11 hyPiRion: biff_tannen: Sounds like something a plugin could do, but leiningen isn't sentient yet :)

10:11 biff_tannen: well, i dont mean automatically

10:12 just a command that will re-write the readme ..

10:12 right now my readme has all the default 'FIXME' stuff in it

10:12 hyPiRion: biff_tannen: Yeah, I get that, but i just wonder what you'd like to have in it.

10:12 joegallo_: right. that's for you to correct with an editor.

10:13 biff_tannen: oh ... so that wasn't generated? that was an assumption on my part

10:13 joegallo_: it is generated. it says "FIXME", and if you regenerated it (somehow), it would still say "FIXME". that part of the template isn't parameterized.

10:13 see link above.

10:13 biff_tannen: ok i understand

10:14 harrigan: in Datomic, is it possible to create a query that will return all entities with a :db.type/bytes attribute having a given value?

10:17 llasram: jcrossley3: Thanks! If we're going to be the ~1 Atlanta-based company using Clojure in production, it seemed like a good idea :-)

10:18 jcrossley3: llasram: :)

10:23 a|i: wat's the equivalent of javascript (var foo = foo || bar) in clojure?

10:24 llasram: a|i: (let [foo (or foo bar)] ...), although it isn't an especially common idiom in Clojure

10:25 a|i: llasram: I want to fetch a big xml only once in repl, in next evaluations I want to re0use that fetched string. what's a better way than the above?

10:26 llasram: a|i: Why not just (def xml-glob (fetch-xml-glob))

10:26 You can use `defonce` instead of `def` it appears where it will be repeated evaluated

10:27 nDuff: ...if it weren't in a repl but an actual program, I'd consider a delay -- (def xml-glob (delay (fetch-xml-glob))); that way, it won't try to be fetched during compilation

10:27 llasram: Or even (defonce ... (delay ...)) :-)

10:30 a|i: why not defonce with a fn to avoid fetching during compilation?

10:35 llasram: a|i: Then your semantics conflict. A delay is essentially a zero-argument fn with memoized result.

10:35 a|i: If you just defonce a fn, you're storing the fn itself, and thus not caching the result

10:36 a|i: llasram: ah I was looking for a way to have a 0 arg memoizer :)

10:36 llasram: Well there you go then :-)

10:37 (inc nDuff)

10:37 lazybot: ⇒ 3

10:38 * nDuff is surprised that lazybot doesn't prefer, say, (swap! llasram inc)

10:40 llasram: Good point... It is rather surprising that (inc nickname) doesn't return the same value every time :-)

10:41 a|i: llasram: does delay require a special treatment in repl?

10:41 just trying the example in repl doesn't work: http://clojuredocs.org/clojure_core/clojure.core/delay

10:41 giving @my-delay to repl gives me back: @my-delay

10:42 nDuff: a|i: I can't reproduce that.

10:42 S11001001: ,(let [del (delay 100)] [(type del) (type @del) del @del])

10:42 Anderkent: a|i: can't reproduce

10:42 clojurebot: [clojure.lang.Delay java.lang.Long #<Delay@4cbe83ae: 100> 100]

10:42 S11001001: a|i: looks right

10:43 hyPiRion: a|i: What repl do you use? lein repl or clojure?

10:43 a|i: hyPiRion: I use sublimerepl, which I think uses lein.

10:43 * nDuff tested in lein repl (lein2, Clojure 1.4.0)

10:43 nDuff: That's a Mac-only thing, no? Can't test here.

10:44 hyPiRion: a|i: Check if there's an issue with sublimerepl. It may be that sublimerepl treats @ differently.

10:44 a|i: it worked after I started a fresh repl.

10:44 hyPiRion: Hmm, funny.

10:44 a|i: I think I don' understand repl oriented development.

10:44 when I keep evaluating my clojure files into the repl,.. things get built up.

10:44 so previous definitions can have a side effect.

10:45 is evaluating the file into the repl repeatedly the right way?

10:45 Anderkent: well, you don't want your namespaces to side-effect on being loaded, most of the time

10:45 and some things like deftype really don't take well to being reloaded (which is kinda dissapointing, really)

10:46 but in general you should be able to just reevaluate or require :reload your ns

10:46 nDuff: a|i: In nrepl.el, there are key combinations to recompile your current file as a whole, so it's not _just_ building things up.

10:46 a|i: ...couldn't speak to whatever they've got for sublime.

10:59 ToBeReplaced: How do you configure clojurescript-mode with lein-cljsbuild? Is that the preferred way to develop cljs now with emacs?

11:01 I think i'm confused because I'm not sure whether i should be checking out the clojurescript repos and setting the environment variable myself or whether lein-cljsbuild is meant to take care of that for you

11:12 the-kenny: ToBeReplaced: I'm not familiar with clojurescript-mode, but with lein-cljsbuild, you don't need to clone the repo or similar to build your cljs-project

11:13 My workflow usually consists in running lein cljsbuild auto and working with clojure-mode on my cljs-files. No repl, though

11:22 hyPiRion: Hrrm, anyone familiar with Erlang here?

11:22 Just wondering if there's any persistent map equivalent.

11:23 Which can be used for destructuring.

11:25 S11001001: I bet reiddraper's pretty familiar with it :)

11:26 hyPiRion: based on my limited knowledge of erlang, I doubt very much you'll find such a thing though

11:27 hyPiRion: S11001001: yeah, looks like there's no keyword arguments either

11:27 Oh well, I just have to remember the order then.

11:27 S11001001: hyPiRion: yeah, erlang style seems to prefer tuples for that sort of thing over maps

11:30 hyPiRion: boo

11:39 Clojure has spoiled me. Why aren't these goodies available in every language I use? :(

11:40 DaReaper5: Hi, does anyone know a good robust lib for working with excel data?

11:40 If not clojure lib then java lib is acceptable

11:41 hyPiRion: DaReaper5: http://liebke.github.com/incanter/excel-api.html

11:41 nDuff: Thought I'd seen a Clojure wrapper around the dominant Java library

11:41 DaReaper5: (What I need to do is work with an uploaded excel file (possibly has errors) and mass import the data to my DB)

11:42 Ya i saw excel-api. Just thought I would ask you guys anyways ;)

11:42 nDuff: ...ahh; https://github.com/mebaran/clj-excel is what I had in mind.

11:42 hyPiRion: Incanter is the dominant data analysis library, though I don't know if it's good for excel data.

11:43 I would suppose so.

11:43 nDuff: anyhow, Apache POI (which they wrap) is definitely robust and well-

11:43 ...-supported

11:43 TimMc: DaReaper5: https://poi.apache.org/

11:43 Specifically https://poi.apache.org/spreadsheet/index.html

11:43 "HSSF" stands for "Horrible SpreadSheet Format"

11:44 DaReaper5: I briefly looked at incanter. It looks like it does not work well with formulas

11:44 as in it wont take the value or formula it would just leave it blank

11:44 hyPiRion: That sounds like a useless library then.

11:44 nDuff: POI proper supports formula evaluation -- see https://poi.apache.org/spreadsheet/eval.html

11:44 DaReaper5: ya

11:45 http://data-sorcery.org/2010/05/31/xls-files/

11:47 hyPiRion: Humm, I've noticed I'm probably doing "Let over Lambda" (not read the book), where I define functions taking initial values, prepare some values and returns a function utilizing those prepared values plus some input. Is that a common pattern? Bad/good?

11:48 nDuff: hyPiRion: Using closures is not considered a bad thing.

11:49 Sgeo: How do people live without closures, exactly/

11:49 ?

11:49 ohpauleez: Sgeo: I don't know, and I don't ever want to know

11:50 nDuff: Sgeo: Badly.

11:50 durka421: well, they're just denied closure...

11:50 (i'll show myself out)

11:50 ohpauleez: but for real, they use objects or globals

11:50 hyPiRion: nDuff: Nono, I just wonder if the (defn prepare-fn [p] (let [p* (prepare p)] (fn [v] ...))) is idiomatic, or if it's kind of premature optimization

11:51 gtrak: hyPiRion: you could implement let with just function args, mit-scheme has 'instantaneous evaluation' of all let bindings, which is a similar semantics to a function call. If you want it sequential like we have it, you could keep building up functions with 1-arg, 2 args, etc..

11:51 hyPiRion: gtrak: Yeah, I know. I've read SICP ;)

11:51 gtrak: :-)

11:52 so let and partial and closures are not so different

11:53 hyPiRion: Hmm, making it multiarg seems smart, maybe that's the solution.

11:54 Maybe I'm a Haskeller at heart, sans the type system.

11:55 * hyPiRion <- not written any Haskell his life.

11:56 DaReaper5: Does anyone here use incanter with excel?

11:57 * Sgeo rewrites that into

11:57 Sgeo: not written any Haskell in his life >>= \hyPiRion ->

12:00 hyPiRion: Sgeo: I know some of those characters, but not in that combination

12:01 Anderkent: hyPiRion: it's a trick, because he implied a `do` statement wrapping your message

12:13 gfredericks: <- doesn't normally mean anything without do, does it?

12:15 Anderkent: indeed, though I don't know if it can be overriden

12:19 bawr: you could, but that way lies madness

12:19 madness, I say!

12:20 Anderkent: but... but... emoticon code! \ -> . <- /

12:32 gfredericks: did somebody say that a #bytes default data reader would be added eventually?

12:32 or more directly, is that the case?

12:32 TimMc: Yes, in version 3.12 "Querulous Quinoa".

12:33 hiredman: gfredericks: someone (I think stu) mentioned something about maybe adding something like that

12:33 I imagine it would be #base64 "..."

12:33 gfredericks: #base65 for those who want the extra power

12:34 hiredman: people have asked about it for datomic, so I imagine it has some change of happening

12:34 llasram: I'd like a default #byte-string or such which turned strings with "\\xHH" into byte-arrays

12:35 Also, a pony!

12:35 gfredericks: #pony {:name "Buttercups"}

12:36 llasram: heh

12:42 biff_tannen: any tuts on clojurescript ? i am able to deploy a running web-server with clojure using ring and clojure, but with implementing clojurescript , i can use some help ...

12:44 dnolen: biff_tannen: http://github.com/magomimmo/modern-cljs

12:45 biff_tannen: awesome thx dnolen

12:48 lancepantz: dnolen: i'm sure you get bugged about this all the time, do do you know what the status of source mapping is in clojurescript?

12:48 gfredericks: waiting on tools.reader and 1.5 was the last thing I heard

12:49 lancepantz: i've been out of the loop for a bit

12:50 gfredericks: is tools.reader a todo? or just waiting for a merge?

12:50 gfredericks: I have no idea :( I didn't even know the project formally existed already

12:51 lancepantz: k

12:51 gfredericks: woah I didn't know namespace prefixes could have .'s

12:51 I apparently don't know anything about clojure

12:53 dnolen: lancepantz: I do get bugged about it a lot :)

12:54 lancepantz: dnolen: i have permission to spend time on it, if there's anything i can do

12:54 dnolen: lancepantz: there's a source map branch that relies on 1.5.0, when 1.5.0 goes out the door I want to merge it in

12:54 lancepantz: as soon as that happens it'll be easier for people to contribute and I'm happy to explain how it works

12:55 lancepantz: dnolen: k, just let me know, you know how to reach me :)

12:55 dnolen: lancepantz: once in - we should look at making sure tools.reader gives us column information for symbols - then switch to tools.reader away from the Clojure reader

12:56 lancepantz: I'd like all symbol emission to go through emit :var, right now emission of symbols is very unprincipled

12:57 lancepantz: that's sweet you've got permission to work on it - could definitely use more help! :)

12:57 lancepantz: dnolen: so right now, cljs uses the same reader as clojure?

12:57 dnolen: lancepantz: it does

12:57 lancepantz: i would expect that to cause problems with interop

12:58 dnolen: lancepantz: which means that any reader changes have to go through Rich which is understandably slow

12:58 lancepantz: right

12:59 dnolen: lancepantz: which is why I was excited about blind -> tools.reader

12:59 lancepantz: dnolen: right right

12:59 dnolen: lancepantz: you can poke around the source-map branch feel free to ask me any questions

13:01 lancepantz: http://github.com/clojure/clojurescript/compare/source-map

13:01 I just brought it in sync w/ master

13:02 lancepantz: dnolen: alright, will do, this is the first i've touched of clojurescript, so i have some catching up to do first

13:03 dnolen: but we are going to start using it, we've been working with ztellman on an open source metrics system based on aleph, figured we might as well do the ui in cljs

13:03 dnolen: lancepantz: cool!

13:04 lancepantz: it's a neat project, essentially a statsd/graphite replacement

13:05 * nDuff perks up his ears

13:06 lancepantz: still way early, although we have ran some trials of it in production: https://github.com/flatland/telemetry

13:07 durka42: lancepantz: you win the award for vague README.md :)

13:07 lancepantz: durka42: let me rephrase, still waaaaaaay early

13:07 definitely don't want anyone using it!

13:07 durka42: fair enough

13:12 pbostrom: Is there a consensus on :require :refer vs :use :only? I had thought that :require :refer was strongly preferred, but I could be making that up

13:14 Frozenlock: pbostrom: I had a weird mindset where I used :use and :only... now I regret it. Really better to use :require. (And not refer, just required). IMO it keeps everything cleaner. Also easier if you want to swap libraries or something of this kind.

13:14 rasmusto: pbostrom: from what I know, :use/:only turns into :require/:refer in a macro, so you should just use :require/:refer in the first place

13:14 technomancy: pbostrom: :require :refer was introduced specifically to replace :use :only

13:14 Frozenlock: :require library :as lib ----> lib/some-fn

13:17 pbostrom: ok, that's what I thought, I was skimming through "ClojureScript: Up and Running", and saw :use :only with no mention of :require :refer, perhaps it was an oversight

13:25 reiddraper: hyPiRion: late reply, but there is no equivalent of map destructuring in erlang, unfortunately

13:27 hyPiRion: you _can_ do that with records though, which are basically just macros around tuples

13:32 magnars: lein midje --lazytest works fine. lein midje (with no --lazytest) does not, but fails with this error: Could not locate bultitude/core__init.class or bultitude/core.clj on classpath http://pastie.org/6045137 --- any ideas?

13:33 never mind me, turns out I was using a really old midje version *blush*

13:35 ack, that wasn't it either :P still same error

13:35 technomancy: magnars: I heard that was fixed in the latest midje RC or something

13:35 magnars: technomancy: excellent, thanks

13:37 yes, that did resolve the issue, thanks - I'm still getting seemingly random hangs from leiningen tho - its task is done, but I have to sigint it to stop.

13:38 technomancy: probably the task is leaving a thread pool open

13:38 magnars: makes sense

13:38 bosie: how would you solve querying states for a user? like "if the user has a store and is older than 3month and is XXX then do ABC; else if the user has a store and is older than 1month and is XYZ then do BBC; else....."

13:39 almost thinking of doing this with core.logic somehow

13:40 goracio: hi can it be simplier ? (vec (map str (vec "world")))

13:40 hiredman: ,(mapv str "world")

13:40 clojurebot: ["w" "o" "r" "l" "d"]

13:40 goracio: great thanks

13:41 jcromartie: must… save… sanity… must… write… Lisp…

13:41 * jcromartie dies

13:41 wink: yay, more zombie coders!

13:42 goracio: why split returns this btw ?

13:42 ,(clojure.string/split "world")

13:42 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: string$split>

13:42 goracio: ,(clojure.string/split "world" #"")

13:42 clojurebot: ["" "w" "o" "r" "l" ...]

13:42 hiredman: read the docs for split?

13:42 jcromartie: goracio: that' san empty regex

13:43 goracio: empty regex matches nothing (i.e. anything)

13:43 bosie: jcromartie: why would it return "" though?

13:43 TimMc: ,(clojure.string/split "" #"")

13:43 clojurebot: [""]

13:43 TimMc: ,(clojure.string/split "1" #"")

13:43 clojurebot: ["" "1"]

13:43 TimMc: Seems legit. :-)

13:43 bosie: TimMc: right

13:44 but why would it do that?

13:44 jcromartie: it's an odd case for sure

13:44 goracio: can split return vector without "" ?

13:44 bosie: ,(clojure.string/split nil #"")

13:44 clojurebot: #<NullPointerException java.lang.NullPointerException>

13:44 jcromartie: but the empty regex in this case actually matches the nothingness before and after the 1

13:45 TimMc: bosie: Can you come up with an argument for a different answer?

13:45 bosie: TimMc: ["" "1" ""]

13:45 jcromartie: that might make more sense

13:45 ,(re-seq #"" " ")

13:45 clojurebot: ("" "")

13:45 goracio: may be pattern should be of some kind ?

13:46 jcromartie: goracio: what are you trying to do?

13:46 bosie: goracio: you could use (filter...) to remove the empty strings

13:46 goracio: jcromartie: i mean we cann't make split to return it without "" ?

13:47 jcromartie: goracio: are you looking for the sequence of single-character strings that make up the string?

13:47 ,(re-seq #"." "hello world")

13:47 clojurebot: ("h" "e" "l" "l" "o" ...)

13:47 gerunddev: ,(rest (clojure.string/split nil #""))

13:47 clojurebot: #<NullPointerException java.lang.NullPointerException>

13:47 jcromartie: split is for dividing a string on boundaries

13:47 gerunddev: ,(rest (clojure.string/split "" #""))

13:47 clojurebot: ()

13:47 goracio: exactly

13:48 jcromartie: an empty regex is pretty much never the answer ;)

13:48 goracio: ok thanks have to experiment more on this stuff )

13:50 jcromartie: experimenting is good

13:56 TimMc: ,(map str "hello")

13:56 clojurebot: ("h" "e" "l" "l" "o")

13:56 TimMc: goracio: ^ even simpler

13:56 goracio: TimMc: it will return seq

13:56 i need vector _

13:56 )

13:57 ro_st: ,(vec (map str "try this"))

13:57 clojurebot: ["t" "r" "y" " " "t" ...]

13:57 goracio: ,(mapv str "hello")

13:57 clojurebot: ["h" "e" "l" "l" "o"]

13:57 goracio: that's fine

13:57 ro_st: or use mapv :-)

13:57 -learns something new-

13:57 Frozenlock: jcromartie: What about an empty string? If I want to remove something in a string, I usually use the replace function with an empty replacement. Is there a better way?

13:58 Oh wow mapv... could be used at so many places instead of (into [] (map....

13:59 #clojure is amazing, it's as if I was learning by osmosis.

14:00 bawr: Frozenlock: aye, good language channels work like that. :)

14:00 babilen: Frozenlock: https://github.com/jonase/kibit/ catches things like this (not sure about this particular one though)

14:00 jcromartie: yeah, mapv is handy

14:02 Frozenlock: babilen: I'm somehow afraid it will scream at me :p

14:03 babilen: Frozenlock: That's ok -- It tells you how to silence it :)

14:10 mmitchell: dakrone

14:11 dnolen: for people who have been burned by the CLJS Closure third-party dependency issues - please try this out - http://dev.clojure.org/jira/browse/CLJS-418

14:15 ToBeReplaced: i can't even get the browser repl running following the instructions from: https://github.com/clojure/clojurescript/tree/ad0e4af1b20fe829ea3a7feb1b7067250309b1cc/samples/repl ... i just get "Page not found" :(

14:18 jro_: in (source +), what is reduce1: ([x y & more] (reduce1 + (+ x y) more)))

14:19 Bronsa: because + is defined before reduce

14:19 ro_st: dnolen: thanks, will give it a go

14:20 tbaldridge: jro_: it's a simpler form of reduce that lacks the features of the normal version, but can be defined before all the stuff reduce needs has been created.

14:20 jro_: it's only really used in core.clj

14:24 ToBeReplaced: Any suggestions for how to get the CLJS browser repl server to accept a connection? if i connect via firefox i just get shipped back "Page not found".

14:29 Frozenlock: ToBeReplaced: What works and what doesn't? Did you specify a repl-listen-port in your cljsbuild config? What does your html file looks like?

14:31 ToBeReplaced: Frozenlock: I am running directly from clojurescript/script/repl... no leiningen, no lein-cljsbuild, no html file

14:31 Frozenlock: Oh... never tried that :(

14:40 warz: S11001001, yesterday we were talking about reify. i've been reading up about it and messing around with it in the repl and stuff. how would you do the equivalent of a Java Annotation on a class member method, though?

14:41 S11001001: hehe, no annotations last I checked

14:41 warz: dang! heh ok.

14:41 yea i mean, i did look around for how to do so, but didn't come up with anything.

14:42 i wonder if i should just use java for these darn plugins.

14:43 S11001001: warz: I'd suggest considering scala instead, in concert with https://github.com/joshcough/MinecraftPluginsScalaExample

14:43 warz: Alternatively, any non-annotation-based approach will work.

14:45 warz: well ive got it working entirely using the gen-class approach, in clojure. im pretty sure i could eventually figure out my original question yesterday as well, which was just creating my own class constructor so that i could pass in and store a reference to the main plugin object.

14:46 S11001001: warz: what I mean is, consider java last

14:46 warz: but yea, the server im using, called Bukkit, requires these Annotations.

14:46 dnolen: I thought Clojure had annotation support

14:46 S11001001: dnolen: I have no idea really

14:46 warz: ah yea, only reason im even messing around with the JVM, any Bukkit at all, is because i want to learn Clojure

14:46 hiredman: dnolen: in some places for somethings

14:47 warz: yea, based on my readings of the docs and stuff, gen-class seems to support the most of these features

14:47 hiredman: http://dev.clojure.org/jira/browse/CLJ-948 made it in to 1.5

14:47 Sgeo: Someone did make a mod or something for Minecraft in Clojure

14:48 Frozenlock: Sgeo: I think it was to make `bots'

14:48 Sgeo: http://metaphysicaldeveloper.wordpress.com/2012/04/20/conjcraft-a-minecraft-mod-implemented-in-clojure/

14:49 warz: i was only tangentially interested in minecraft server mods because i knew it was java, and thought itd be something fun to keep my interest while learning clojure. haha.

14:49 Frozenlock: https://www.youtube.com/watch?v=cV7zbzH37Qo clojurecraft

14:49 warz: it has turned out that java interop can get hairy kinda quick, though.

14:49 so probably not the best way to learn.

14:50 Sgeo: Java interop gets impure from a Clojure perspective

14:50 ,(map inc [1 2 3])

14:50 clojurebot: (2 3 4)

14:50 warz: i did manage to make one server mod that logs in-game events to mixpanel analytics: https://github.com/ryancole/com.rycole.bukkit.mixpanel

14:50 Sgeo: ,(map .toString [1 2 3])

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

14:50 S11001001: warz: true.

14:50 Sgeo: ,(map #(% .toString) [1 2 3])

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

14:50 Sgeo: ,(map #(.toString %) [1 2 3])

14:50 clojurebot: ("1" "2" "3")

14:50 warz: yea thats pretty simple stuff, though

14:50 Sgeo: .toString is not a Clojure function

14:51 S11001001: warz: definitely you're missing out on the clojure experience if using gen-class, because gen-class is tedious, and not at all in the spirit of true clojurian development

14:52 Sgeo: Write a macro to abstract out the gen-class usage as needed?

14:52 warz: yea i get that feeling. i just need to think of something cool to make.

15:02 svedubois: How I can translate this java code to clojure? https://www.refheap.com/paste/9408

15:04 ToBeReplaced: dnolen: my cljs problem was caused by this: http://dev.clojure.org/jira/browse/CLJS-418 ... was really hard for me to figure that out trying to set this up for the first time since it breaks the script/repl. this thread had my exact issue and fix https://groups.google.com/forum/?fromgroups=#!searchin/clojure/brent/clojure/DmnPwrVvfW8/qgnp6MTVWusJ ... thanks for the PSA

15:06 amalloy: svedubois: what have you tried?

15:06 dnolen: ToBeReplaced: no problem, sooner people confirm the fix the sooner we get a new release that doesn't have the issue

15:13 svedubois: I have tried something like this https://www.refheap.com/paste/9409

15:15 hiredman: I would start off reading the docs for for

15:15 dnolen: svedubois: I suggest taking a step back and getting a book on Clojure designed for people coming from Java and other imperative languages - I hear the O'Reilly book is good.

15:20 jcromartie: That's not a bad first try

15:20 svedubois:

15:21 cemerick: svedubois: maybe https://www.refheap.com/paste/9410

15:21 jcromartie: but I'm a little bit wary of this RealSum class...

15:21 cemerick: svedubois: and perhaps check out http://clojurebook.com

15:21 "numerical instabilities"

15:22 jcromartie: yeah

15:22 cemerick: sounds like the IEEE floating point spec

15:22 jcromartie: is this an image library?

15:23 I'd guess http://code.imagej.net/trac/imglib/browser/imglib2/core/src/main/java/net/imglib2/util/RealSum.java?rev=a340a39990fbea0e061121c884a128e698341cf0

15:25 pbostrom: cemerick: iterator-seq might not be necessary since input implements Iterable

15:25 cemerick: pbostrom: oh, right, I misread that as 'Iterator'

15:27 svedubois: cemerick: It works well, thanks

15:43 ollivera: hi, .. I am parsing a csv file and I would like to sum all the values of the key "sc-bytes". http://pastebin.com/TPahzhRx

15:43 * nDuff scowls at the pastebin.com link

15:44 nDuff: ollivera: If you're privileged enough to be using an adblocker and thus not see them -- pastebin.com is full of annoying, animated ads. Perhaps you might consider refheap.com (which, being written in Clojure, would also be dogfooding), or gist, or otherwise something different?

15:44 hyPiRion: reiddraper: But {foo, A, bar, B} != {bar, B, foo, A}, right? So the ordering is still important (though it fails if you give it the arguments in the wrong order, which is something at least)

15:44 (late reply for me as well)

15:46 ollivera: nDuff, https://www.refheap.com/paste/9412

15:46 okay, nice! :)

15:48 dnolen_: man, another paren thread on the mailing list

15:50 devlol: hello jcromartie

15:50 rboyd: ollivera: maybe something like this? (reduce #(+ %1 (Integer. (get %2 "sc-bytes"))) 0 rows)

15:50 ollivera: where rows is a seq of your csv rows (maps)

15:50 nDuff: Heh. What I was coming up with was thus: (reduce + (map #(Integer/parseInt (get % "sc-bytes")) data))

15:51 could also make that (apply + ...)

15:51 ollivera: Hum, thanks, I will try

15:51 Frozenlock: Not really clojure related, but this makes me really happy http://blog.chromium.org/2013/02/hello-firefox-this-is-chrome-calling.html

15:51 amalloy: dnolen_: newcomers begging to remove parens is the Other Lisp Curse

15:54 tbaldridge: dnolen: don't they know the first rule of Lisp fight club? (you don't talk about the parens)

15:57 hyPiRion: tbaldridge: What parentheses?

15:59 ohpauleez: amalloy: haha

16:00 I think we should just reply, "Remember the first time you tried beer - it was bitter, you hated it, you didn't understand why people drank it. Then you stuck with it, and you realized how beautiful it was."

16:01 rasmusto: how about we replace )))))) with #] or something?

16:02 ohpauleez: rasmusto: I rarely pay attention to a long list of closing parens

16:02 amalloy: rasmusto: :(((((((((((((((((

16:02 rasmusto: amalloy: #]

16:02 ohpauleez: overtime, your eyes gloss over it, and with paren highlighting in your editor, it's easy to place them when you need to

16:02 amalloy: #] or an equivalent is a disaster: it serves no purpose, and makes code harder to edit

16:03 ohpauleez: yeah, it's totally break paredit

16:03 it'd**

16:03 amalloy: ohpauleez: it's worse than that, because it's no longer possible to just wrap some expression with parens

16:03 even manually

16:03 clojurebot: It's greek to me.

16:03 ohpauleez: for sure

16:04 rasmusto: amalloy: wasn't it in a lisp of olde at some point? (btw, I'm 100% joking about putting it in)

16:04 amalloy: rasmusto: i think some schemes have had it

16:12 * technomancy resets the "It has been [ ] days since someone suggested alternate paren-free Clojure syntax on the mailing list" sign

16:14 rasmusto: technomancy: someone else brought it up :#]

16:14 technomancy: we should maintain a list of every time it's been discussed

16:16 hyPiRion: The qsort example made me wonder how I could implement it with juxt.

16:17 Must be some way.

16:20 TimMc: juxt-sort

16:23 S11001001: 1

16:24 Bronsa: dnolen_: just added line/column metadata on symbols FYI

16:24 amalloy: hyPiRion: (interpose [pivot] ((juxt filter remove) smaller xs))?

16:26 hyPiRion: amalloy: I was thinking of (juxt > == <) somehow.

16:43 seangrove: Has anyone thought about a paren-free dialect of clojure?

16:43 dnolen_: Bronsa: sweet!

16:44 tbaldridge: seangrove: thought about? yes.

16:44 hiredman: seangrove: no, no one ever has, please bring your great wisdom down from the mount

16:45 seangrove: Well, it could be a good way of spending time debating its merits...

16:45 :P

16:45 I'm curious why it couldn't just be an editor-level thing though

16:45 hyPiRion: Success

16:45 ,(let [qsort (fn qs [[p :as l]] (if p (let [{f 1 p 0 l -1} (-> (partial compare p) (group-by l))] (lazy-cat (qs f) p (qs l)))))] (qsort [5 1 8 3 2 0]))

16:45 clojurebot: (0 1 2 3 5 ...)

16:45 tbaldridge: (waves Jedi hands) : you do not want paren-free lisp....

16:45 hyPiRion: Not with juxt though.

16:45 seangrove: Parsing clojure is pretty straight-forward, seems like if someone wanted to do it they could just make an emacs-mode

16:45 tbaldridge: (waves Jedi hands) : You want to go home and re-think your life

16:45 :-P

16:45 amalloy: seangrove: because the whole premise is absurd

16:46 there's not enough information without the parens

16:46 seangrove: Meh, you'd have to introduce additional semantics, etc

16:46 But clojure has to be one of the easiest language for someone (who wants that) to do it

16:46 No need to request it, it seems

16:46 hyPiRion: The most difficult thing would be destructuring.

16:47 If you're going to be delimiter-free

16:47 gfredericks: O_O

16:47 seangrove: Ah, good point

16:48 Doesn't seem like a very high-value project, personally

16:48 dnolen_: seangrove: paren-free Lisps are an old idea with few success stories - Dylan being a notable exception, but the macro system looks more like syntax-rules (for better or worse)

16:48 technomancy: many people have tried it with other lisps, and it works about as well as you'd expect from a project explicitly designed for newbies to abandon once they achieve proficiency

16:49 seangrove: Heh, sorry, I was speaking tongue-in-cheek about suggesting it

16:49 Pure troll, didn't mean for it to be taken very seriously

16:50 gfredericks: what about a language that is like clojure but with more parentheses

16:50 seangrove: haha

16:50 Raynes: seangrove: People have.

16:50 cemerick: TimMc has been pioneering that for a while

16:50 hyPiRion: gfredericks: And more sharp-quoting!

16:50 rasmusto: gfredericks: ( is a macro for (((((

16:50 bawr: how about...

16:50 pjstadig: uuids!

16:50 Raynes: And they get surprised when the realize nobody cares about a non-pareny syntax.

16:50 bawr: a clojure with more APL syntax? xD

16:51 hiredman: don't make me figure out how to load pl in to clojurebot again

16:51 gfredericks: at the very least we can have mandatory metadata

16:51 hyPiRion: (let ((a 10)) (+ a a)) vs (let [a 10] (+ a a)), count the parens.

16:51 amalloy: gfredericks: like clojure but with more parens? common lisp is a winner

16:52 gfredericks: (ommon li)(p

16:52 hyPiRion: And remove car and cdr, such that you have to do destructuring for those values.

16:53 amalloy: lixp?

16:54 hyPiRion: Hmm, you could probably make a brainfuck-like version of lisp, where () denotes a function, (()) denotes another function and (() ()) denotes a function call, etc.

16:54 jballanc: hyPiRion: I've seen raw lambda calculus implementations like that

16:54 hyPiRion: Not sure how you distinguish (()) from ( () ) though,

16:54 jcromartie: devlol: hello?

16:54 gfredericks: hyPiRion: whitespace sensitive s-expressions?

16:54 hyPiRion: jballanc: Oh, that sounds nice.

16:55 gfredericks: it's the opposite of clojure: ' ' is not whitespace

16:55 hyPiRion: gfredericks: Hmm.

16:55 That's the opposite of every language in existence though, except Python.

16:55 gfredericks: you could use two different kinds of spaces and treat them like brackets that have to be balanced

16:56 hyPiRion: I meant opposite in the sense that clojure has an extra char \, which is whitespace

16:56 bawr: gfredericks: you evil, evil man.

16:56 hyPiRion: like ' ' and ' '?

16:56 gfredericks: hyPiRion: sure

16:56 jcromartie: you're talking about church numerals?

16:56 hyPiRion: oh, humm.

16:56 jballanc: yup, that's the term I was looking for

16:56 http://en.wikipedia.org/wiki/Church_encoding

16:56 hyPiRion: ,(let [  10] (+   2))

16:56 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in sandbox:>

16:56 hyPiRion: ,(let [  10] (+   2))

16:56 clojurebot: 12

16:56 jcromartie: http://en.wikipedia.org/wiki/Church_encoding

16:57 derp

16:57 amalloy: hyPiRion: binary lambda calculus

16:57 http://www.ioccc.org/2012/tromp/hint.html

16:57 jcromartie: "sexpression crimes"

16:58 hyPiRion: amalloy: That looks nice.

16:58 technomancy: gfredericks: I'd trade tabs as non-whitespace for non-breaking space as whitespace

16:58 hyPiRion: I wonder what ' ' munges into.

16:58 amalloy: it's pretty amazing, yes. i'm glad the IOCCC is finally back in business

16:59 hyPiRion: We should have IOCLJCC, so that people could hone their Swearjure skills.

17:00 technomancy: lightning talk on swearjure at clojurewest

17:00 gfredericks: "Ew, look at those swearjure skills. Have you thought about maybe honing them?"

17:00 TimMc: now you have to come to clojurewest

17:01 TimMc: That's what I hear.

17:01 hyPiRion: What, Swearjure is a topic on Clojurewest?

17:01 like, an actual talk?

17:01 gfredericks: TimMc is presenting

17:02 hyPiRion: They better be filming it

17:02 /s/be filming/film/

17:02 gfredericks: with lots of bleeps

17:02 TimMc: gfredericks: You are such a troublemaker.

17:02 gfredericks: TimMc: I still can't believe they made it a keynote

17:03 TimMc: I hear that next year it will be SwearjureWest

17:03 gfredericks: TimMc: quick what's the smallest swearjure expression that evaluates to "conf"

17:04 TimMc: Not sure I can do that.

17:04 I could probably get you some of those letters as chars.

17:05 gfredericks: I think this is a minimum requirement for you having your own conference

17:05 TimMc: It's a shame that inc doesn't work on chars.

17:06 I could produce a seq which, when pretty-printed, shows a raster rendering of "CONF" though.

17:06 I'm not *going* to, mind you.

17:06 gfredericks: good to know

17:07 technomancy: is that a threat then? =)

17:07 hyPiRion: TimMc: I'll make one for you. For free and all.

17:08 TimMc: aw

17:08 abp: What to use to internationalize libs for web development?

17:09 There's tower, using an atom for the whole config, but I haven't thougt about wether that's good..

17:10 TimMc: ,(`[~@(`[~@'`(~+)](*))](+))

17:10 clojurebot: clojure.core/concat

17:10 bawr: abp: internationalize... libs?

17:10 I'm not sure I follow

17:11 abp: bawr, yes, validation with default translations and the like.. Well mostly validation libraries..

17:11 augustl: TimMc: can clojurebot do JavaScript? :)

17:12 bawr: abp: what are you trying to achieve?

17:13 augustl: abp: I like to use thread local variables for config in servlet settings

17:14 s/servlet settings/servlets/

17:14 reiddraper: hyPiRion: '{foo, A, bar, B} != {bar, B, foo, A},', correct, but that's not something people do in erlang, idiomatically anyway

17:15 hyPiRion: gfredericks: I demand that "Macros: Why, When, and How" should be renamed into "Why `{~% ~@%} is legal Clojure and how to utilize it".

17:15 abp: bawr: Using https://github.com/jkk/formative in a german web app. It uses https://github.com/jkk/verily for validation. I can overwrite the messages all the time, for each validation definition, but changing the defaults would be cleaner.

17:16 hyPiRion: *will

17:16 gfredericks: hyPiRion: aaack!

17:16 bawr: abp: Oooh, I see.

17:16 hyPiRion: reiddraper: Okay, thanks for confirming.

17:16 (inc reiddraper)

17:16 lazybot: ⇒ 1

17:16 bawr: abp: In that case, not sure. :-)

17:16 abp: augustl, so your approach sure would work, to define translation maps in different ns or one gigantic translation map for all supported languages.

17:17 pjstadig: i'm going to start a mechanical turk service for obfuscating clojure code, that is basically just a bridge to this irc channel

17:17 augustl: abp: didn't think of the limitation in most validation frameworks of messages being hardcoded and/or only settable once

17:17 bawr: pjstadig: pshaw! make a bot thhat learns obfuscations for this channel.

17:18 *FROM

17:18 hyPiRion: pjstadig: "Hello guys, how do you do (mapv + [1 2 3] [4 5 6]) in swearjure?"

17:18 bawr: arrgh

17:18 augustl: abp: one hack could of course be to make the messages strings of localization tokens etc

17:18 hyPiRion: Meh, I'm still frustrated that I can't do vararg mapv in Swearjure.

17:19 TimMc: vararg mapv?

17:19 That's (mapv f v1 v2 ...)?

17:19 hyPiRion: TimMc: Variable maps, yesh.

17:20 I can't do apply or partial, that's the issue.

17:21 abp: augustl, sure, but I prefer to "solve" that not only for my app(s).

17:21 hyPiRion: Oh hey, I think I can do quicksort in Swearjure. Going to take me some time though.

17:22 hiredman: why don't you just write a clojure to sweajure compiler?

17:22 then you are done

17:23 bawr: that would be cheating

17:23 unless it's written in swearjure

17:23 hiredman: after you write it you would run it on it

17:24 hyPiRion: hiredman: TimMc has something on that, but I want to figure out if we can map every piece of Clojure to Swearjure. We have some issues with eval, apply, partial etc right now.

17:24 bawr: *unless it's written in swearjure to begin with

17:27 TimMc: hiredman: I've started work on one that translates a *very* limited subset of Clojure.

17:28 * dnolen waits for the clojure <---> sweajure compiler in core.logic

17:28 gfredericks: is core.logic good for handling code yet?

17:29 e.g., vectors vs seqs?

17:29 hyPiRion: gfredericks: Actually, I think it may be interesting. Let me find the link of something which may be relevant.

17:30 http://www.youtube.com/watch?v=5Q9x16uIsKA#t=1104s

17:30 dnolen: gfredericks: we try to preserve the original type. Far as dealing w/ source there are a couple more tweaks to be made - but making it easy to work with source is a goal.

17:30 hyPiRion: If we filter out those with alphanumerics, then we're good to go.

17:30 gfredericks: dnolen: and then let the quine generation begin?

17:31 TimMc: Generation Quine

17:31 gfredericks: "A new generation of programmers who call themselves 'The Quine Generation' have ..."

17:31 hyPiRion: developed a Swearjure Quine.

17:32 dnolen: gfredericks: heh, well you can already do that today - generate quines relational that can be passed to eval.

17:32 relationally

17:34 gfredericks: so you (defn evalo [expr res] ...)?

17:35 technomancy: http://ceaude.twoticketsplease.de/js-lisps.html

17:35 dnolen: gfredericks: if you mean to ask if you do what Will & Dan demo at their talks - yes

17:36 gfredericks: technomancy: where's the corresponding list of JS impls written in lisp?

17:36 technomancy: gfredericks: []

17:36 actually I think there's one

17:37 gfredericks: this demonstrates that lisp is not JS-complete

17:37 qz: how do i make thread-local var? i'm doing (def ^:dynamic var (SomeClass.)) and i'm getting crashes because of not synchnorized access to the SomeClass object

17:37 technomancy: [https://mxr.mozilla.org/mozilla/source/js2/semantics/README?force=1]

17:37 gfredericks: qz: its value is not thread-local until you use binding

17:37 TimMc: Is it possibly to tell programmatically that a Clojure macro is hygienic?

17:37 gfredericks: qz: so (def ^:dynamic var) (binding [var (SomeClass.)] (do stuff))

17:38 TimMc: something to do with &env maybe?

17:38 qz: gfredericks: aha, will try now

17:39 amalloy: qz: you can also use https://github.com/flatland/useful/blob/develop/src/flatland/useful/utils.clj#L197 to create a real ThreadLocal object

17:39 devlol: jcromartie: I googled about compojure + swagger documentation and ended up with a chatlog from this channel. I'm currently on the same path you were on september. Did you pursue this way (generating doc from compojure routes) ?

17:39 jcromartie: ah ha

17:39 amalloy: TimMc: i doubt it

17:39 qz: gfredericks: do i have to work with var only within binding block ?

17:39 jcromartie: devlol: I think the answer is metadata on vars

17:40 qz: amalloy: will take a look, thanks.. but i thought clojure supported thread local vars out of the box

17:40 jcromartie: I never got it wokring

17:40 amalloy: it supports manual, temporary redefinition of vars per thread

17:40 jcromartie: but mostly because I was moved off the project after embarassing the Java devs

17:40 :P

17:40 amalloy: it doesn't have anything built-in for automatically giving each thread its own copy of something

17:45 jcromartie: devlol: I do believe that compojure will let you do (defroutes ^{:foo :bar} route-var …)

17:45 then swagger can inspect a namespace

17:46 er

17:46 you can write a routing that inspects a namespace

17:46 to speak Swagger

17:46 devlol: jcromartie: ok, i see. I have something working https://gist.github.com/b15be97304bee4e56092 which can then output json for iodocs

17:47 jcromartie: interesting, did you write your own GET/PUT?

17:48 devlol: yes, i wrote a small lib on top of compojure which allow groups with docs & wrappers

17:49 hyPiRion: TimMc: qsort progress: https://www.refheap.com/paste/40edd5d1d3764c7cbb8aff056

17:50 It seems fairly straightforward from here on actually, so now we have a useful program without alphanumerics.

17:50 devlol: jcromartie: i'm still unsure about whether use swagger or iodocs and wanted to be sure i was not missing something that may already exist for clojure

17:50 jcromartie: I think they're all kind of silly actually

17:52 I'd rather just see some good human writing.

17:52 because Swagger et al just always seem to end up with some quirk in the API that can't be expressed easily

17:55 devlol: jcromartie: true, however i think having doc in sync with routes definition can be really useful especially if you are in a small team

17:55 jcromartie: yes, definitely

17:58 qz: amalloy: flatland utils worked like charm for thread locals, thanks :)

17:58 Raynes: You're welcome.

18:04 TimMc: hyPiRion: Nice. That looks compilable, too.

18:05 devlol: jcromartie: thank you for your response :)

18:05 hyPiRion: TimMc: Now we can preach the power of Swearjure to everyone

18:05 I wonder if I ever get to the point where I implement Dijkstra's algorithm in Swearjure.

18:06 TimMc: hyPiRion: I bet that whole thing could be modified to emit a fn instead of taking hardcoded input.

18:06 That's the real blocker to adoption, I'm sure of it.

18:07 hyPiRion: TimMc: I'm all ears. How do you do it?

18:07 The #()'s inside a #(), I mean.

18:08 TimMc: Well, this problem doesn't require a general-case partial.

18:08 I don't have a technique yet, just a hunch.

18:08 hyPiRion: I'll have a look after some way of getting partial and apply as well. I need it for my mapv.

18:33 rodnaph: core.logic question - i tried doing (dec x) which i didn't expect to work and didn't - but not sure where to look to explore where to go next - is this anything to do with the fd namespace?

18:43 TimMc: hyPiRion: OK, maybe not. :-)

18:44 hyPiRion: TimMc: :'(

18:45 This is getting a bit hairy.

18:45 Oh well.

18:45 TimMc: The central problem is that of binding.

18:47 hyPiRion: Indeed. I have just 12 functions in this qsort, so even larger problems may be hairy.

18:48 I think the main concern is that of function literals inside function literals.

18:48 TimMc: There's probably some combinator that would provide the necessary currying, but I can't imagine that the combinator could be written without function nesting.

18:49 hyPiRion: TimMc: Have you looked at the #= macro?

18:49 I couldn't manage to make anonymous functions with it.

18:49 But maybe there's some loophole

18:52 OH

18:53 #= resolves symbols, i.e. #=(+ 1 2) takes the actual symbol and resolves it.

18:53 If we could just prepare a form to #= and let it read it, we could use apply and concat.

18:54 TimMc: Interesting, but the call-position has to be a literal symbol.

18:54 hyPiRion: Yeah, that's the problem. Hmm.

18:54 TimMc: #=((or + *) 1 2) ;; ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol

18:55 hyPiRion: Same for `[#=~(prepare-form)].

18:55 TimMc: ...and we don't have read, anyway

18:56 I think "(" is the only valid follower of #=.

18:56 You can

18:56 You can't unquote into the readerm anyhow.

18:57 hyPiRion: Yeah, true.

18:57 TimMc: Oh, we can get various chars, by the way.

18:57 hyPiRion: Oh?

18:57 TimMc: ,[\+ \ \"]

18:57 clojurebot: [\+ \space \"]

18:58 hyPiRion: Well, space looks interesting.

18:58 TimMc: We don't have str, int, or char. :-/

18:58 hyPiRion: We don't have much, do we.

19:01 TimMc: ,#!/bin/bash

19:01 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

19:02 hyPiRion: ,;;what

19:02 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

19:02 hyPiRion: It expects a value before comments/"eof" I suppose

19:04 TimMc: ,(. #"" '"test")

19:04 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: quote for class java.util.regex.Pattern>

19:04 TimMc: Bleh.

19:04 That "would have worked" in Java.

19:06 ,'(. #"some-regex" '"test") ;; for clarity

19:06 clojurebot: (. #"some-regex" (quote "test"))

19:06 hyPiRion: Humm

19:07 I thought that was static

19:07 TimMc: It is.

19:08 Java will allow "new Pattern(...).quote(...)".

19:08 hyPiRion: Weird.

19:09 Maybe it's for uncompiled patterns

19:09 TimMc: What, quote?

19:09 amalloy: TimMc: you can refer to static members non-statically if you want

19:10 hyPiRion: Wait. Hrm.

19:10 amalloy: (in java, not the jvm)

19:10 TimMc: amalloy: So Java translates someRegex.quote("") into Patter.quote("")?

19:10 *Pattern

19:10 hyPiRion: That makes sense.

19:10 amalloy: javac does that, yes

19:10 hyPiRion: TimMc: Try out ((Pattern) null).quote(...)

19:11 amalloy: i presume it still produces someRegex and then throws it away, in case of side effects

19:11 TimMc: Ah, sure.

19:11 Well, I'll sleep on it.

19:11 Raynes: Sleep!?!?!111!

19:12 It's only 4:12PM!

19:12 It's awesome how quickly I stop caring about my old timezone after I've moved to a different one.

19:12 hyPiRion: Raynes: 1:12 am here.

19:12 cbp: hi

19:13 hyPiRion: Raynes: But you were up very late for some weeks ago for your timezone, I think?

19:13 Raynes: I was always up late for my timezone, hyPiRion.

19:13 I used to go to sleep at 7AM.

19:13 cbp: Is there a sqrt function around that returns a BigDecimal?

19:13 Raynes: Now I have to get up at like 8:45AM. It's ruthless, this.

19:13 callenbot: Raynes: I wake up at 6:30 am so I can commute for 1:45 each way.

19:13 yedi: i'm starting a webapp in clojure, how should I go about getting up to speed w/ clojure on the web? my plan is to checkout the compojure and ring docs/tuts, but if anyone knows of other great resources lemme know

19:14 callenbot: Raynes: fuck you man :(

19:14 I figured out my request context thingy I wanted.

19:14 Raynes: callenbot: Yeah, I'll probably have to get up earlier if they move the office. I already have to take a 40 minute or so bus.

19:14 callenbot: it's a dynamic var of an atom of a map.

19:14 Raynes: that's pretty bad for most people actually.

19:14 Raynes: callenbot: Any new music for me? I'm sitting in the office jamming in the corner.

19:14 cbp: or more like a nicely precise sqrt function

19:16 callenbot: Raynes: http://toogl.es/#/view/VeU5bM_ccXo

19:16 hyPiRion: cbp: http://stackoverflow.com/questions/1384919/are-there-libraries-for-square-root-over-bigdecimal

19:16 So apparently it's uglier than I suspected.

19:16 Raynes: callenbot: What is this crap?

19:16 callenbot: Raynes: the closest thing I could find to Firefly-esque music.

19:17 Raynes: want some unicorn rainbows instead?

19:17 Raynes: No, I meant this website.

19:17 callenbot: Raynes: angularjs magick.

19:17 cbp: thank you

19:19 callenbot: also I need to remember to run the type-hinted laser results and integrate them into the test results.

19:19 Raynes: don't let me forget ^^

19:20 Raynes: what did you see when you ran them?

19:20 tmciver: callenbot: what's the video from?

19:20 Raynes: Uh, I can't remember. It was a little faster, callenbot.

19:30 callenbot: tmciver: I didn't pay any attention to that bit. I just wanted the music.

19:31 Raynes: cool, I'll post the results tonight.

19:31 tmciver: Ah, looked kinda cool.

19:31 I was especially interested because you mentioned Firefly.

19:32 callenbot: tmciver: I think the movie is Final Fantasy or something.

19:32 Raynes: I guess I should watch that show.

19:32 callenbot: Raynes: firefly is godly.

19:32 tmciver: callenbot: yeah, looks like it.

19:32 Frozenlock: Raynes: yes, do it.

19:32 callenbot: Raynes: I don't even like TV usually and Firefly was worth every minute.

19:32 Frozenlock: And then the movie.

19:32 Raynes: I saw one episode.

19:32 tmciver: Yes! Best Sci-Fi TV show to be cancelled after one season, ever!

19:32 ohpauleez: You have to stick with it

19:32 Raynes: It was kind of meh.

19:32 ohpauleez: watch them in order

19:33 then the movie

19:33 Raynes: I've never watched a show out of order. Except for Family Guy and such.

19:33 tmciver: Raynes: you watch your mouth!

19:33 ohpauleez: then you'll be like, "now I understand"

19:33 Raynes: But yeah, I'll watch the rest.

19:33 I wasn't turned off by the first episode or anything, I just never got around to watching the rest.

19:33 ohpauleez: Doctor Who is the same way - you need to stick with it, and watch it in order

19:33 but then you totally get it

19:34 Raynes: Doctor Who <3

19:34 Frozenlock: ohpauleez: I was dissapointed but the last seasons...

19:34 Raynes: Frozenlock: you watch your mouth!

19:34 ohpauleez: Frozenlock: I haven't seen the MOOOOST recent ones

19:34 Frozenlock: *by the last seasons

19:34 I guess I'm not fond of the new doctor.

19:35 seangrove: Frozenlock: No one ever is

19:35 I don't even watch Doctor Who and I know that

19:35 Raynes: I love Matt Smith.

19:36 So your argument is invalid.

19:37 Frozenlock: At least he has a bow tie. Bow ties are cool.

19:37 I also want to critique how they overused the weeping angels.

19:51 imeredith: Frozenlock: i really liked the new doctor - i thought that it would suck without David Tenant, but Matt Smith is better imo

19:52 callenbot: Raynes: http://toogl.es/#/view/0Q35mUz2TOY Listen to a song about Elizabeth Bathory now.

19:54 Frozenlock: imeredith: but what about Christopher Eccleston? :P

19:54 imeredith: i had the same feelings when he left, but he was the worst :P

19:54 combataircraft: what is the clojure equivalent of socket.io?

19:55 technomancy: it wasn't fair to Smith to make him follow Tennant

19:55 imeredith: Amy and Rory have been the best companions so far too

19:55 Raynes: technomancy: That's true.

19:56 imeredith: technomancy: idk, i think it would have been worse for Tennant to follow Smith...

19:59 combataircraft: any ideas?

19:59 technomancy: combataircraft: what is it?

19:59 Raynes: $google socket.io

19:59 lazybot: [Socket.IO: the cross-browser WebSocket for realtime apps.] http://socket.io/

20:00 combataircraft: it's a cool NodeJS library that simplifies real-time communication between server and browser

20:00 ivan: combataircraft: http://thegeez.net/2012/04/03/why_browserchannel.html

20:01 Socket.IO et al will lose/reorder data

20:01 combataircraft: oh, come on…

20:02 ivan: feel free to think about its HTTP transport for 5 minutes

20:06 Frozenlock: ivan: for someone who isn't very literate in these communication stuff, what's the difference between clj-browserchannel and fetch?

20:07 ivan: Frozenlock: I don't think fetch can push some data from the server to the client

20:08 Frozenlock: Oh! No I don't think so. Or at least I didn't see anything to do so.

20:08 hiredman: amalloy: the "140KB of Clojure source!" made me chuckle

20:08 ivan: (the basic trick to that is keeping an HTTP request open until the server has something to respond with, and the fun part is setting up reliable message queues and ACKs on both sides)

20:09 BrowserChannel has already implemented everything

20:09 amalloy: hiredman: given clojure's density, that's probably enough to rewrite chrome from the ground up

20:09 hiredman: reason number 64 I refuse to look at midje

20:10 callenbot: hiredman: sorry?

20:10 hiredman: I'm not familiar with midje, what don't you like about it?

20:10 amalloy: hiredman: is the 78MB git-clone reason 63 or 65?

20:11 hiredman: amalloy: it's in there somewhere

20:12 amalloy: i shouldn't poke fun, though. midje isn't really my style, but i suspect it's pretty cool if you're into that sort of thing

20:12 hiredman: #1 is the guy who wrote is constantly hitting these kind of issues, can never figure them out, and goes to the clojure mailing list with "what is going on?"

20:12 technomancy: running the tests on load is =(

20:12 Raynes: Laser's tests use midje. Just cuz.

20:12 technomancy: Well, you can wrap them in deftests if you want.

20:12 hiredman: you'd think after the second time he would have stopped and learned some clojure/jvm internals

20:13 technomancy: also: macros and dynamic binding over simple things like with-redefs

20:14 hiredman: to steal a turn of phrase from technomancy: it's clown shoes

20:14 technomancy: callenbot: the biggest reason though is just that you can do so much with only learning 2 forms from clojure.test, and anything that adds additional concepts on top of that should have to pay significant dividends for additional conceptual overhead

20:15 callenbot: technomancy: it did seem like an awful lot of code.

20:15 hiredman: running tests are load is horrible, I wasn't aware it did that

20:15 callenbot: technomancy: I'm not convinced clojure.test isn't fine. OTOH, I'm one of those Python people that like unittest/unittest2 fine.

20:15 technomancy: relevant: http://technomancy.us/118

20:16 amalloy: hiredman: that's just a bad convention, at least, and not an actual requirement. he just has (fact ...) instead of (deftest foo (fact ...)) like any sane person would recommend

20:16 callenbot: technomancy: this is fucking sweet, thans.

20:16 technomancy: I've made a lot of progress in hacking up web apps in Clojure. I'm beginning to settle on a micro-framework

20:17 technomancy: thanks for posting bludgeon, I like it.

20:17 technomancy: this is actually a good sanity checker for libraries.

20:18 technomancy: it's really not, but it does make a point

20:18 Raynes: technomancy: You're getting more cynical than I am, I think.

20:19 technomancy: Raynes: heh, that post was from 2008

20:19 Raynes: technomancy: I was referring to the message right before I said that.

20:19 Frozenlock: Does one get more, or less cynical with time?

20:19 technomancy: ...which is right around the time I stopped doing ruby, actually. hm.

20:19 abp: callenbot: will your micro-framework be released?

20:19 technomancy: Raynes: well, I mean it's a joke.

20:20 ivan: would anyone but me have a use for a thing that made it easy to turn Clojure output into org-mode trees? I've often had a need for something as simple as stdout but with collapsible trees. (The annoying part is getting streaming output working)

20:20 technomancy: you have to think about conceptual overhead vs value provided, and I don't think either can be measured with `wc -l`

20:20 gfredericks: has somebody mentioned running bludgeon on itself yet?

20:21 technomancy: gfredericks: probably not since 2008

20:21 Frozenlock: ivan: org-mode trees? Like: *title 1 **subtitle1 and such?

20:21 gfredericks: oh I didn't realize this wasn't new

20:21 no wonder it's about ruby

20:21 ivan: Frozenlock: right. the idea is that you could look through a big pile of output with a lot less pain

20:23 qz: technomancy: you stopped doing ruby completely, or just switched to clojure for some tasks?

20:23 technomancy: qz: I still use ruby for small things

20:23 things under the bludgeon threshold =)

20:23 but it's only recently that I've needed it again

20:23 qz: technomancy: but for all web stuff you use clojure now?

20:23 Frozenlock: I see how this could be usefull for maps. But I'm not sure I would take the time to transfer them into a new buffer. But something like it in the repl would be amazing. (with-fold my-map) ----> {:key1 ... \n :key2 ...}

20:23 technomancy: I don't really do much web stuff

20:24 just clojars and syme really

20:24 ivan: Frozenlock: yeah, I'll have to do something horrible with nrepl.el

20:25 Frozenlock: ivan: If it's worth something, you have my whole moral support to implement something like this :P

20:25 ivan: cool :)

20:25 qz: technomancy: nice, now i know how proper web app in clojure looks like

20:25 hyPiRion: TimMc: All hail the quicksort: https://www.refheap.com/paste/15a076693ba66105e21b44a1c

20:25 gfredericks: clojars: a proper web app.

20:26 Frozenlock: ivan: actually I just made code to convert a java object into a map. Only problem is when I print it in the repl it's often too big. Folding it would be perfect.

20:26 technomancy: qz: it's pretty good considering its age. we're in a bit of an awkward point right now transitioning between data stores, so it's not as clean as it could be

20:27 yedi: is jdbc pretty much the standard for db manipulation (i'll be using postgresql most likely)

20:27 hyPiRion: Okay, give me a month and I'll make Dijkstra in Swearjure. Better be good.

20:27 gfredericks: yedi: meaning clojure.java.jdbc the contrib lib?

20:27 yedi: yea, it's a contrib lib?

20:28 qz: gfredericks: what do you think about korma for sql stuff?

20:28 yedi: so i guess that means it's basically standard or at teh very least a really great api

20:28 technomancy: it's not really a shining example of a great API

20:28 but it is widely used

20:28 I think there's a rewrite on a branch

20:28 (of the API at least)

20:29 gfredericks: qz: I think lots of conflicting things

20:29 craigbro: hehe

20:29 technomancy: ^ talking about c.j.jdbc

20:30 yedi: qz: korma is another popular option? have you used it and if so how'd you like it?

20:32 qz: yedi: it works and i like the api, but again, i'm new to clojure and we should listen to more experienced people here ;)

20:33 gfredericks: hyPiRion: "Practical Swearjure"?

20:33 yedi: just found this: https://github.com/korma/Korma/issues/62

20:34 hyPiRion: gfredericks: Yeah, you can use Quicksort to sort a vector.

20:34 If that isn't practical then I don't know.

20:34 gfredericks: technomancy: my favorite is #64: "Korma is not simple."

20:34 yedi: ^ meant that for you

20:34 technomancy: ^ did not mean that for you. carry on.

20:34 technomancy: gfredericks: zarro boogs found

20:35 gfredericks: hyPiRion: I just meant it sounds like a book you're working on

20:35 hyPiRion: gfredericks: Do you think it will sell well?

20:36 * ivan checks if you can pass in a connection factory now

20:36 hyPiRion: I believe a lot of corporations would enjoy using Swearjure as their back-end connecting to their database

20:36 yedi: oh korma is built on top of jdbc

20:36 gfredericks: hyPiRion: yes it will sell quite well

20:37 hyPiRion: It sounds like Korma is built on top of Swearjure by all the bashing of it

20:37 qz: technomancy: but again, writing raw sql becomes boring very soon. what are alternatives besides jdbc?

20:37 hyPiRion: gfredericks: Excellent, I'll start writing today.

20:37 technomancy: qz: if you don't want to write raw SQL you should use Korma or implement something new based on honeysql

20:38 yedi: honeysql looks tasty

20:38 qz: technomancy: i just got used to activerecord for simple db stuff :(

20:38 xeqi: super alpha https://github.com/seancorfield/jsql

20:39 yedi: it's interesting to see the different API approaches

20:40 abp: xeqi: that seems to be in there too: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc/sql.clj

20:40 xeqi: abp: ah, hadn't looked at the latest c.j.jdbc

20:41 I saw the ml post where the dynamic vars are no longer required

20:41 abp: xeqi: for now it looks strange with all the = for everything.

20:44 qz: technomancy: are you gonna migrate from korma in clojars?

20:45 technomancy: qz: yeah, our data set is trivial, so it's not a good fit for SQL at all

20:45 we are switching to two in-memory atoms and a lucene index

20:45 qz: technomancy: migrate to.. ?

20:45 oh

20:46 so everything that persists will be stored in lucene?

20:46 technomancy: users/groups will just be in the atom and event logs

20:47 deployed artifacts will be in lucene

20:47 https://groups.google.com/group/clojars-maintainers/browse_thread/thread/8ea301d80b95a78c

20:48 yedi: if paredit-mode for emacs is working correct, i shouldn't be able to delete closing parens right? and typing an open paren should automatically close it?

20:48 xeqi: technomancy: I seem to remember it might need to be three atoms, but I forget why off hand

20:49 technomancy: xeqi: there are three event logs

20:49 but I don't think deploys need to be queried outside lucene

20:51 yedi: oh, i guess paredit doesn't automatically turn on when you open a new buffer

20:54 qz: wish there was paredit for vim that's not horribly broken..

20:54 Raynes: qz: I didn't have trouble with it when I used it. What's wrong with it?

20:54 xeqi_: technomancy: artifact pages for old version wouldn't be in lucene :/

20:55 qz: Raynes: i had problems with <leader>W (it just does W w/out leader) and some other keybindings

20:56 worst of it is that it doesnt work, then you type it again and it works..

20:56 amalloy: https://github.com/clojure/clojure/commit/974a64c06917861b7557fd73154254195b2de548 for anyone who isn't watching the read-eval jira ticket

20:57 Raynes: omg

20:57 qz: and last thing was trying to do <leader>W on "blah" with cursor on first quote.. ("blah") as result ? nooo.. (")blah"

21:03 bttf: anyone had their cljs repl hang on them ? i'm using lein-cljsbuild 0.3.0

21:04 Frozenlock: bttf: what do you mean 'hang on them'. Sometimes (not often) the REPL stop responding. If I look in the js console there's an usually an error from a bad command I entered.

21:06 bttf: well i started a repl server with repl-listen

21:06 did a simple (+ 2 2) and it hung

21:06 (+ 2 2) on the cli

21:06 clojurebot: 4

21:09 bttf: i see an error with the GET request in the js console on the webpage that im trying to connect to the repl ... maybe its related

21:11 Frozenlock: bttf: You can try to reload the page. Also make sure the repl/connect function is used only after the page is loaded.

21:12 tuor: dauterive: Are you Val who used to work at BNR/Nortel?

21:13 technomancy: xeqi: oh, those can just hit the disk straight

21:13 oh, but not the listing

21:14 ChongLi: what sort of data structure would be best at representing the current value of the keyboard?

21:14 I was previously using a set

21:14 georgek: hi, I'm getting a ConcurrentModificationException because I'm removing an element from a Java Set while iterating over it -- the Java HashSet has a remove method (which I'm using) but perhaps Clojure is putting some other iterable in between that's making it not work, or...?

21:14 ChongLi: but I think I need something else to take into account weird contradicting keys

21:14 georgek: I'm doing it in a doseq

21:15 technomancy: xeqi: I think we might just have to change the index to have a latest? y/n field

21:15 along with a published_at field

21:23 amalloy: georgek: that's just as illegal in java as what you're doing in clojure. iterators specifically tell you not to do that

21:24 if you really, really want to remove items from a set while you iterate it (hint: you don't), you have to use the iterator's .remove method

21:25 ChongLi: is there a data structure which acts like a stack and a set?

21:25 georgek: amalloy: that's the funny thing, I am using the .remove method on HashSet, which says " if the set is modified at any time after the iterator is created, in any way except through the iterator's own remove method, " -- so I need to get an iterator of the hashset first

21:27 ah, I see, I just need iterator() -- sorry for the noob question

21:27 this is also a good explanation, http://tech.puredanger.com/2009/02/02/java-concurrency-bugs-concurrentmodificationexception/

21:27 ChongLi: hmm I guess I should just use a list

21:28 georgek: chongli: maybe an ordered set?

21:28 ChongLi: well there's a sorted set

21:28 but I want it sorted like a stack

21:28 amalloy: ChongLi: the best stack+set duo that i know of is a stack and a set glued together

21:29 ChongLi: first in last out

21:29 it's designed to handle keyboard input in an annoying complex way

21:29 the question I keep banging my head into a wall over is what happens when you press left and right at the same time?

21:30 I don't think it should cancel out

21:31 it should always be moving in some direction, allowing you to switch from left to right without stopping in between

21:31 except when no keys are down

21:32 georgek: what are you using to get input?

21:32 ChongLi: flapjax

21:32 (F/extractEventE js/window "keydown")

21:32 eetc.

21:33 merging it all into one event stream that produces a simple value of the keyboard at that moment

21:35 perhaps this is the wrong approach altogether

21:35 hmm

21:40 georgek: when I ask for an iterator() for the HashSet and then do the modification, I then get " Don't know how to create ISeq from: java.util.HashMap$KeyIterator clojure.lang.RT.seqFrom (RT.java:494)"

21:41 so what is a better idea -- iterate over a copy of the HashSet?

21:43 Frozenlock: ChongLi: I used sets. Not that it should be used as an example. https://github.com/Frozenlock/zyzanie

21:43 xumingmingv: &(.iterator (hash-set 1 2))

21:43 lazybot: ⇒ #<SeqIterator clojure.lang.SeqIterator@127a744>

21:43 ChongLi: how does this handle left and right at the same time?

21:44 I guess that doesn't really make sense in emacs

21:44 amalloy: georgek: same way as anything else in clojure: don't mutate things. compute a new set by applying a pure function to the old set, and then use the new one

21:44 Frozenlock: ChongLi: Let me try that...

21:47 tomoj: I think an ordered set makes sense

21:47 why do you say LIFO? doesn't the order in which the keyups arrive determine the order in which elements are removed?

21:48 ChongLi: tomoj: you're right

21:49 so what order should the set be in?

21:49 Frozenlock: ChongLi: Interesting... doesn't work :/ I'll have to correct this bug.

21:50 ChongLi: for this example sequence of events: keydown "left" -> keydown "right" -> keyup "left" -> keyup "right"

21:50 tomoj: #{} #{:left} #{:left :right} #{:right} #{}

21:50 ordered set could implement IPersistentStack so peek would be the most recent key

21:50 ChongLi: yeah I get that part

21:51 tomoj: (I meant those as ordered sets)

21:51 ChongLi: what I want to know is what direction will be resolved during each step of that sequence

21:51 I don't want contradicting keys to cancel out

21:52 this allows you to chord from left to right without stopping in the middle

21:52 or having some weird reversal of direction

21:52 tomoj: doesn't peek give you the direction you want on the events above?

21:53 ChongLi: let me try

21:53 tomoj: ..assuming it returns the last element of the ordered set, the most recent key

21:53 dnolen: core.logic protocols/interface finally moved into their own namespace, hacking on core.logic should now be less tedious

21:59 ChongLi: I think I'll just use a list and just use contains? to prevent duplicates

21:59 is that idiomatic? heh

22:00 tomoj: use contains?, on a list?

22:00 ChongLi: why not?

22:00 dnolen: ChongLi: contains? only works on associative data structures

22:01 tomoj: &(contains? '(1 2 3) 2)

22:01 lazybot: ⇒ false

22:01 ChongLi: hmm

22:01 guess I have to use some

22:03 yeah this works really well

22:03 some and remove

22:04 I'm still using sets though (for the predicate) :)

22:05 S11001001: ChongLi: sorted maps pointing to constant values are sorted sets

22:05 ChongLi: I'm not sure I follow

22:05 I want a set that preserves insertion order

22:07 piranha: Frozenlock: speaking about key bindings handling, I recently wrote JS lib for that and instead of binding to elements I choose the way of manually enabled namespaces. I was really determined to do former, but then experience turned out to be that in my case context of key bindings has changed, but focus is somewhere not on the actual nested element (i.e. in menu, where you just switched a tab or something). I'm not sure what I'm trying to te

22:07 ll, just sharing experience. :)

22:08 Frozenlock: piranha: what do you mean manually enabled namespaces?

22:09 Oh you just missed what I asked didn't you...

22:09 piranha: what do you mean manually enabled namespaces?

22:09 piranha: Frozenlock: https://github.com/piranha/keymage#scopes

22:09 no, I somehow got it :)

22:10 S11001001: ChongLi: ah

22:10 tomoj: ChongLi: right, an ordered set

22:10 https://github.com/flatland/ordered

22:10 Frozenlock: piranha: What is chat, if not an element?

22:10 tomoj: no cljs though :(

22:10 ChongLi: yeah I'm on cljs

22:10 tomoj: I'll port it someday

22:10 piranha: Frozenlock: just an arbitrary chosen name for a scope

22:11 Frozenlock: so let's imagine I have multiple sections in my application, and I can switch between them (it's a single-page app), then when I go to chat, I call setScope('chat')

22:11 and when I go to contact list management, I call setScope('contacts')

22:11 tomoj: as a stopgap for implementing an ordered set you could just write your own functions that work with a vector and set

22:11 ordered-conj etc

22:12 Frozenlock: Isn't it the same as a container with "chat"?

22:12 Oh I see, it could be divided into two parts in the page...

22:12 piranha: Frozenlock: and when in chat, if I press some 'search for a contact' button, I do pushScope('quicksearch'), which handles some shortcuts for this search

22:12 ChongLi: using a list with some, conj and remove seems to work well enough

22:12 piranha: Frozenlock: exactly!

22:12 ChongLi: some to guard against duplicate insertion

22:12 piranha: that was my problem with elements

22:12 when you switched with a mouse, your focus is not in the #chat, but in #menu

22:12 tomoj: yeah.. since the number of keys pressed will always be small

22:13 ChongLi: yeah it's not like I'm dealing with a long list

22:13 tomoj: a list could be faster than an ordered set anyway

22:13 ChongLi: yeah the constant factor with a list is fairly small

22:13 though I'm not sure how it works in cljs

22:14 Frozenlock: piranha: I dealt with the focus problem with this: https://github.com/Frozenlock/zyzanie/blob/master/src/zyzanie/core.cljs#L295

22:15 piranha: I'm not really sure I understand your problem with chat VS menu however :P

22:17 piranha: Frozenlock: <ul id="menu"><li data-tab="chat">chat</li></ul><div id="tabs"><div id="chat"></div></div> - your focus is in #menu, since you just clicked 'chat' li. Your shortcuts, which are bound to #chat, won't work.

22:17 that was my main problem

22:19 Frozenlock: piranha: ah ok. What did you do? Manually changed the focus when pressed a tab?

22:21 piranha: argh, my connection is abysmal

22:21 Frozenlock: from 1 min ago:

22:21 piranha: ah ok. What did you do? Manually changed the focus when pressed a tab?

22:21 piranha: Frozenlock: well, I just do keymage.setScope('chat') there :)

22:21 I really don't want to play with focus :))

22:22 so all my shortcuts are global, but then application switches scopes when it needs to

22:24 Frozenlock: I like that. Stealing focus was really a dirty hack on my part.

22:24 In fact the whole lot is a dirty hack from when I was learning cljs (without ever touching JS).

22:25 xeqi: amalloy: the whitelist in the read-eval change allows you to remove namespaces :/

22:28 hmmm, what inherits from clojure.lang.Fn?

22:30 dnolen: read eval fix from rhickey - http://github.com/clojure/clojure/commit/974a64c06917861b7557fd73154254195b2de548, http://github.com/clojure/clojure/commit/38a129f2631a75ed999b52d8e0440f730b00da1f

22:31 ChongLi: yay!

22:32 dnolen: and fixes to support flexvec in 1.5.0, hells yeah!

22:32 Frozenlock: \o/

22:32 ChongLi: some weird commit message

22:32 doesn't seem related!

22:33 I guess github abbreviates it

22:33 ah yeah

22:34 this is basically a must if we're going to be able to trust edn right?

22:35 otherwise users could stick arbitrary clojure code in there and it'd be eval'd?

22:35 Frozenlock: If you read it.

22:36 technomancy: you can fix the default yourself without this

22:36 technically this just helps catch cases where you forgot to rebind it when reading user data

22:36 xeqi: I actually think this commit is bad

22:36 ChongLi: why?

22:36 clojurebot: ChongLi: because you can't handle the truth!

22:37 technomancy: but since the consequences of getting it wrong are so bad and the likelihood of actually realizing it if you did make that mistake, the default matters all the more

22:37 dnolen: technomancy: the patch actually fixes more - classForName via the read no longer loads classes.

22:37 (I think)

22:37 xeqi: with that patch (read-string "#=(clojure.lang.Namespace/remove user)") will remove the namespace

22:37 testing it for more holes atm

22:38 ChongLi: did you look further down?

22:38 #= has been changed

22:38 to include a quote

22:38 xeqi: I typed it into a 1.5.0-RC5

22:38 ChongLi: #="

22:38 technomancy: oh, I haven't read the patch

22:38 xeqi: which is on sonatype-oss with this commit

22:39 ChongLi: 1864

22:39 - w.write("#="); 1870

22:39 + w.write("#=\"");

22:39 gah, tabs

22:41 dnolen: xeqi: it's RC6 that has those commits

22:43 xeqi: dnolen: RC5 has https://github.com/clojure/clojure/commit/974a64c06917861b7557fd73154254195b2de548

22:43 but I missed the RC6 release

22:43 pulling that now

22:55 ivan: nice find re: that hole

22:58 dnolen: xeqi: oh anything on the *read-whitelist*

22:59 xeqi: dnolen: yep, just send off to -dev

22:59 *sent

23:01 dnolen: xeqi: yeah, seems like only find is really needed

23:01 * ivan wonders if anyone is relying on read-string not creating Number/Collection/Map/Namespace/Fn with *read-eval* bound to false

23:06 yedi: this line throws an "Unparsable namespace form:" error -- (ns skateproj.db (:use korma.db))

23:09 Frozenlock: ivan: I don't but I'm bound to forget it one day or another.

23:16 * ivan gets something far worse:

23:16 ivan: user> (ns skateproj.db (:use korma.db))

23:16 CompilerException java.lang.ClassFormatError: Truncated class file, compiling:(clojure/java/jdbc.clj:299:3)

23:19 yedi: i just ran it in the repl (instead of lein ring server) and i got this instead: FileNotFoundException Could not locate korma/db__init.class or korma/db.clj on classpath: clojure.lang.RT.load (RT.java:432)

23:20 ivan: a repl started by lein repl?

23:21 amalloy: xeqi: the Collection and Map entries on the whitelist scare me way more than Namespace

23:22 xeqi: amalloy: why so?

23:22 amalloy: even using a non-classloading version of Class/forName there's got to be potential for invoking static methods on dangerous subclasses of Map

23:23 technomancy: a dos via Namespace/remove is a pretty serious improvement over arbitrary execution still =)

23:23 xeqi: technomancy: theres no workaround in RC6 tho

23:25 ivan: just have to bind *read-whitelist* too now

23:25 xeqi: amalloy: true, I was looking for a class with fun static methods earlier

23:25 ivan: the tribal knowledge expands

23:25 xeqi: ivan: ... your right

23:25 thanks

23:26 amalloy: the non-classloading version of Class/forname means no static initializer problems right?

23:26 yedi: ivan: nrepl in emacs

23:26 amalloy: probably, though i haven't looked at it

23:26 * xeqi hits his limits of classloading knowledge

23:27 ivan: yedi: did you use nrepl-jack-in to start it? did it find the right project.clj? does that project.clj mention korma?

23:28 tomoj: is there a flexmap which supports fast merge?

23:29 xeqi: #=(var ..) looks dangerous, but would require some application code to help it

23:29 yedi: my project.clj has korma as a dependency

23:30 ivan: i did use nrepl-jack-in

23:30 not sure if it found the right project.clj, though i assume so

23:31 amalloy: xeqi: the application code would have to be explicitly setting *read-eval* to true, right?

23:32 so i don't think there's any need to worry about that

23:35 ivan: nope, #=(var does things with *read-eval* false

23:35 xeqi: amalloy: even with false and RC6, using #=(var ..) causes it to return the resolved var;

23:36 imagine someone expecting a map and doing (expected-map :x)

23:43 yedi: all the dependencies in project.clj get added to your classpath right?

23:48 mabes: anyone know of a command-line friendly debugger for clojure?

Logging service provided by n01se.net