#clojure log - Sep 09 2012

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

0:01 cark: so the 2 things bothering me are : first i have to pass the full state around, and i feel like a person "object" should not be concerned about the full database

0:01 second: integer id's are not the data they represent

0:01 replace "object" by namespace

0:03 S11001001: lenses also need context to acquire data

0:03 cark: right

0:04 frio: quick question; i've been googling, but haven't yet found the answer

0:04 how do i use multiple args with ->? ie. (-> [arg1 arg2] func1 func2 func3)

0:04 (where arg1 arg2 will be applied to func1)

0:05 S11001001: ,(doc ->)

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

0:05 S11001001: frio: ^^^ "second item", "if it is not a list already"

0:06 Sgeo: You could do something like ... wait, hmm

0:06 Suddenly I really want thrush

0:06 frio: i read that, but im not grokking it :). im guessing i should make func1 take a list, rather than 2 args?

0:06 Sgeo: Or -<>

0:07 S11001001: frio: also look at ->> to better understand what -> is

0:07 frio: ##(doc apply)

0:07 lazybot: java.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IFn

0:07 S11001001: oh really

0:07 whatever lazybot

0:07 ,(doc apply)

0:07 clojurebot: "([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."

0:08 frio: will do S11001001. I had a look at apply, but it didn't seem to be quite what I wanted... unless I did something like (-> [arg1 arg2] #(apply func1 %) func2 func3)?

0:09 S11001001: frio: hint: -> has nothing to do with functions

0:09 frio: (which seems ugly; i figured there might be a better way of getting there)

0:09 hrm S11001001. OK. im obviously missing something a little more fundamental :)

0:09 S11001001: ,(require 'clojure.walk)

0:09 clojurebot: nil

0:10 metellus: if f1 f2 f3 only take 2 args, then (->> [arg1 arg2] (apply f1) (apply f2) (apply f3)) should work

0:10 err, with just 1 apply. as you already said.

0:10 frio: OK, thanks :).

0:11 cheers S11001001 and metellus, ill go back to tinkering/googling/scribbling

0:12 seancorfield: tolstoy: yes, i just blogged about project-specific lein 2 tasks today and referred folks to the documentation! http://corfield.org

0:13 tolstoy: seancorfield: cool. I'm going with hooks in project.clj (as per Raynes' hint). Taking a look at your post.

0:13 seancorfield: i added a project-specific higher-order task to modify the behavior of an existing lein 2 task...

0:14 tolstoy: Ah, so technomancy stuck with the .lein-classpath thing.

0:15 Ha! I missed that heading completely.

0:15 seancorfield: i found it about the same time xeqi pointed out a google groups discussion about project-specific tasks...

0:59 tolstoy: seancorfield: Typo second sentence! ;)

1:00 seancorfield: darn... i read it thru several times... what did i miss?

1:00 tolstoy: We having been using ....

1:00 seancorfield: doh! thanx

1:01 fixed...

1:02 tolstoy: You mean you didn't have to go through a change review board? *shocked*

1:04 Raynes: seancorfield: Twitter is fun.

1:04 tolstoy: Kinda wish .lein-classpath was in project.clj. That hidden file feels like something I'd spend days missing if it were someone else's project.

1:05 Raynes: I write each of my tweets to you about 10 times until I get it small enough to fit in a tweet.

1:05 It's amusing how we're both in IRC and having an argument on twitter...

1:17 seancorfield: The most frustrating tweets are the political arguments - because it's so hard to cram a coherent counter-argument into just 140 characters!

1:18 tolstoy: yeah .lein-classpath is a bit of a weird fish...

1:21 tolstoy: I've been re-doing Emacs today (newbie), but seem to have lost that auto indent in Clojure. Or is that something that's never there?

1:38 seancorfield: tolstoy: what did you install? clojure-mode? starter-kit?

1:38 tolstoy: Nope. clojure mode off of melba.

1:39 I'm wondering if newline-and-indent is the key.

1:39 Maybe it's the diff between marmalade and melpa? Anyway, now reading Brian Carper. ;)

1:43 (add-hook 'clojure-mode-hook '(lambda () (local-set-key (kbd "RET") 'newline-and-indent)))

1:43 seancorfield: hmm, i didn't have to do that...

1:45 ro_st: the current datomic docs show how to make a new partition, but not how to write data into one. my guess is that :db/id needs to use that partition? irc://irc.freenode.org:6667/#db/id%5B:db.part/my-domain-partition] or (tempid :db.part/my-domain-partition). is that right?

1:45 tolstoy: clojure mode 1.11.5 from melba. I've no idea if that's "old"

2:06 seancorfield: i have 1.11.5 (from marmalade but should be the same)

2:07 but i also installed the starter-kit 2.0.3 (hmm, and starter-kit-lisp 2.0.3) which may help?

2:09 tolstoy: I've never installed that, but perhaps some other thing I had somehow set things up right.

2:09 Anyway, works now.

2:16 nsxt: urgh... just moved to lein2 tonight - i can reference other namespaces declared in my project dependencies through lein repl, but not through my vimclojure repl (filenotfoundexception)

2:18 is there some classpath configuration i need to handle, or should these :dependencies now go in :dev-dependencies, or...?

2:19 ro_st: are they in jars, or in checkouts?

2:20 actually, nevermind. it should just pick em up if they're in checkouts

2:21 nsxt: i was under the impression they were all downloaded to ~/.m2?

2:21 ro_st: yup

2:22 nsxt: maybe it's my totally ass-backwards vimclojure setup then

2:22 ro_st: i don't use vimclojure so i'm not sure what to suggest

2:22 seancorfield: i think :dev-dependencies has been replaced by :profiles {:dev {:dependencies ...}}

2:22 but some :dev-dependencies have moved to :plugins (if they are lein plugins)

2:23 and the swank-clojure dev-dependencies entry has become lein-swank "1.4.4" under :plugins

2:24 nsxt: understood, thanks guys. fairly sure it's my vimclojure configuration, and the fact that it's not taking into account anything in ~/.m2

2:24 seancorfield: btw, the precate plugin for lein1 did a pretty good job of creating a valid lein2 verson of your project.clj

2:24 nsxt: i'm actually just starting a new noir project

2:24 seancorfield: isn't there a lein template for noir?

2:25 nsxt: yeah

2:25 but while trying to get enlive working, i can't reference it from my vimclojure repl, which is a huge pita

2:26 seancorfield: hmm, didn't know folks used enlive with noir

2:27 first time i've tried the noir template... very slick... lein new noir ntest; cd ntest; PORT=8123 lein run ... instant web app...

2:27 nsxt: i love hiccup, but i've a ton of predefined html and would rather keep it as markup (working with a designer...)

2:28 seancorfield: yeah, i hear that... it's why fw/1 uses enlive and why we use it for html emails at world singles

2:28 i need to update the fw/1 template so it works out of the box with lein2... sigh

2:28 nsxt: what's fw/l?

2:29 * ro_st inserts enfocus + cljs into the conversation: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/

2:30 nsxt: whoa, the lein-tarsier plugin is crazy magic

2:44 seancorfield: nsxt: fw/1 is a lightweight convention-based web app framework i wrote back in 2009 in cfml - and ported to clojure a while back

2:45 i haven't done much to promote it yet tho'... but it's very popular in the cfml world

2:45 darn this lein-template stuff... wonder what i'm missing?

2:45 * seancorfield heads off to #leiningen

2:50 nsxt: seancorfield: are you guys over at world singles still hiring?

3:01 seancorfield: yup http://bit.ly/worldsingleshiring

3:01 currently interviewing

3:14 Raynes: &((fn [& col] col) 1 2 3)

3:14 lazybot: java.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IFn

3:15 Raynes: $login

3:15 lazybot: You've been logged in.

3:15 Raynes: $reload

3:19 seancorfield: fw/1 template fixed now (0.1.1) ... sigh ... missing [ ] in :use ... doh!

3:20 &*clojure-version*

3:20 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

3:35 seancorfield: Raynes: how do I send someone mail via lazybot?

3:36 Raynes: seancorfield: $mail nick message

3:36 seancorfield: thanx

3:36 Raynes: &((fn [& col] col) 1 2 3)

3:36 lazybot: ⇒ (1 2 3)

3:36 Raynes: &((fn [& col] list col) 1 2 3)

3:36 lazybot: ⇒ (1 2 3)

3:37 Raynes: Hrm.

3:37 Not sure what this twitter guy was doing

3:37 seancorfield: $mail amalloy DPRIMAP-1 is fixed in 0.0.2-SNAPSHOT (currently waiting for Hudson to see the changes and run a build - will cut a new release once it passes the matrix)

3:37 lazybot: Message saved.

3:37 seancorfield: the japanese guy?

3:39 (fn [& col] list col) is (fn [& col] (do list col)) which evaluates to col (and throws away list which resolves to clojure.core/list)

3:40 Raynes: I know.

3:40 seancorfield: &((fn [& col] (list col)) 1 2 3)

3:40 lazybot: ⇒ ((1 2 3))

3:40 Raynes: But I don't understand if he thought he was doing something clever, or...

3:40 *shrug*

3:40 seancorfield: i don't speak japanese so i don't know either :)

3:41 i replied tho'...

3:41 Raynes: I replied pointing out (fn [& col] col)

3:41 seancorfield: me too :) and that (list col) would be ((1 2 3))

3:42 bedtime...

3:47 Sgeo: How common/acceptable is it to use agents as a .. thing to send side-effecting functions to without actually caring what value the agent holds?

4:06 tomoj: should it be possible to write cljs macros which check the compilation target?

4:11 hiredman: tomoj: http://dev.clojure.org/display/design/Feature+Expressions

4:22 tomoj: hmm, I guess I can detect my own features too, don't need cljs compiler to provide them

4:22 since for the browser I may want features that can't be determined by cljs anyway..

4:23 well, no..

4:23 obviously that won't work

4:25 leonardoborges: Hi everyone - I got a question about Clojure compilation. While debugging some code I realised top level function calls get evaluated during compile time as well as during runtime. The Clojure compilation docs provide little information as to why that's the case.

4:25 Could anyone shed some light on this or point me somewhere that could clarify this?

4:26 michaelr525: leonardoborges: funny, i'm dealing with such a thing right now..

4:26 antares_: leonardoborges: defn is a macro, so it is expanded at compile time. Vars are then looked up at runtime because they can be replaced at runtime.

4:27 but that is not compilation, just a hash map lookup, basically

4:27 michaelr525: just changed the problematic (def)'s to (defn)s

4:28 leonardoborges: antares_: sure. but if you actually call (some-fn …), it will get evaluated at compile time as well

4:28 antares_: leonardoborges: what do you mean "evaluated at compile time"?

4:29 michaelr525: my def's are evaluated when I run 'lein repl'

4:29 antares_: functions are compiled to classes, a function call means instantiating a class and calling #invoke on it

4:29 michaelr525: and how do you expect REPL to work without compiling your code?

4:30 michaelr525: in Clojure, namespaces are compiled when they are loaded

4:30 leonardoborges: antares_: I should have mentioned that this behaviour happens when doing AOT compilation

4:31 I sent a message to the clojure user group a couple of days ago. If you'd like to have a look: https://groups.google.com/forum/?fromgroups#!topic/clojure/LNd8kAnB0-g

4:31 it has more information about the issue.

4:31 hiredman: http://clojure-log.n01se.net/date/2008-11-12.html#16:07

4:32 leonardoborges: yeah, so don't do that

4:33 leonardoborges: hiredman: so when you say don't do that. You mean AOT compiling? or Calling functions at the top-level namespace?

4:33 hiredman: both

4:33 leonardoborges: I now know that if I'm AOT compiling my code, I shouldn't do it. But what I'm after is a little extra info as to why that is the case.

4:33 hiredman: that log link clarifies some of it. tks for that.

4:33 hiredman: do you need to aot compile your code?

4:34 if not, then don't

4:34 if you don't know, then that means you don't have a reason to, so don't

4:35 michaelr525: antares_: maybe i'm completely wrong about it but I think I read somewhere that a def is evaluated the first time it is referenced or something like that..

4:35 leonardoborges: I don't really need. However I stumbled upon this when deploying to Heroku. If using leiningen 2, they default to AOT compile your project. Which is why I started to dig into this

4:35 Raynes: leonardoborges: AOT is indeed something you don't usually want to do. Unless you need it done, you don't want it.

4:35 antares_: michaelr525: I highly doubt that is true

4:37 michaelr525: antares_: ok

4:37 :)

4:38 leonardoborges: I'm actually putting a post together with all I went through 'cause it was a bit of a rabbit whole - mostly because Heroku decided to default to compile :all with lein 2. I am just lacking that extra knowledge as to why the compilation process also loads the namespace

4:38 which, according to that link hiredman sent, seems to be in order to make macros and function s they use available.

4:38 so that explains it I guess.

4:39 antares_: leonardoborges: because some Clojure features require that. Everything is highly dynamic and may be used by macros.

4:39 yes, this is a very good explanation

4:40 leonardoborges: great. I'll add that as a reference to the post I'm writing. I basically ran into this issue since code that connects to the database used to be at the top level and relied on env vars - e.g.: (System/getenv …) which isn't available during compilation on Heroku.

4:41 hiredman: putting your database connection in a def is gross

4:42 you switch from OOP to FP, and suddenly people think globals are cool

4:43 antares_: leonardoborges: it is a very bad idea to have that kind of code at the top level

4:43 leonardoborges: do that in main (well, functions you call from main)

4:43 leonardoborges: hiredman: it was in a def. It was a macro that expanded to a defence - in korma - and that got loaded at compile time.

4:43 antares_: some libraries will block on initialization (like Quartzite) and if you have that code in the top level ns, your compilation will never finish

4:43 leonardoborges: antares_: yes, that's what I changed the code to now.

4:43 Sgeo: Go learn Haskell. You'll get rid of your global addiction

4:44 hiredman: for a number of reasons, what happens when you want to talk to more than one database? who reconnects to the database if the connection dies? who reports errors? etc etc etc

4:44 Sgeo: Although, in Haskell, there are situations where one does want to use globals :/

4:44 (Particularly, I wanted to make a wrapper for a non-threadsafe C library, and so wanted to have a global lock)

4:48 leonardoborges: so the way korma connect to the database - using defonce - is frowned upon?

4:50 michaelr525: leonardoborges: i think it's delayed

4:50 leonardoborges: it will not open the connection until you actually try to query the db

4:54 tomoj: hmm.. can clojure-mode be made to indent cljs try*/catch correctly?

4:59 leonardoborges: michaelr525: true. but it'll bind the db spec using defence. If defonce then depends on any System/getenv calls, and those are not available at compile time, problems could arise.

4:59 which is why in the end I moved my db init code into a function call under main-

5:00 anyway.. tks everyone for the help. It did explain a lot to me.

5:40 tomoj: would be kinda cool if (= nil ((fn [& [y :or {y 3}]] y) nil))

5:41 .. nil?

5:42 huh, actually..

5:43 (fn [{(or foo 3) :foo}]), (fn [& [(or foo 3)]]) ? looks weird

6:21 ro_st: if i want to map two functions over a single collection, how would that look?

6:21 (map #(2nd (1st %)) coll) is what i have now.

6:21 i guess i could use comp

6:24 hyPiRion: ro_st: comp is probably the way to go.

6:24 ro_st: i just don't like that it's in reverse order. doesn't read as well as #(-> % 1st 2nd)

6:25 guess i'll use -> :-)

6:43 tomoj: ouch, if you require clojure.browser.repl on node.js, the output is broken since Element doesn't exist

6:44 this means funky cljsbuild comments for target, I guess

6:44 even if we have feature-cond and a target feature passed from cljs compiler, we can't use it in ns

6:44 ro_st: that's painful

6:45 tomoj: that or you tell cljsbuild to ignore certain files in certain targets

6:45 ro_st: sticky :-(

6:45 tomoj: wonder if the funky cljsbuild macros can be easily separated from crossover stuff...

6:53 am I just daft or do you have to do something other than sign up to comment on an atlassian wiki comment thread

6:54 hiredman: another possible reason we need features in the reader, ns ^

6:54 hmm

6:54 well, clojure.browser.repl could use feature-cond and that specific problem would go away

6:55 but :{use,require}-macros still suggest the need for reader features to me

7:19 sweet, def{types,records} can be in closures in cljs

7:36 hyPiRion: Huh, seems like making recursive, anonymous fns is rather hard.

7:37 *memoized ^

7:37 memoized, recursive anonymous, I meant.

7:54 Radar: Trying to add readline support to my repl, but can't find where homebrew has installed clojure.jar. Anyone got some tips on where it could be?

7:57 jballanc: Radar: Have you checked /usr/local/Cellar/clojure ?

7:58 Radar: jballanc: Ah, that's where it is. Thanks!

7:58 jballanc: np

8:29 kryft: Hmm, how can I prevent the *nREPL error* buffer from jumping into the foreground every time I make a mistake in the repl buffer? :P

9:06 Ah, found my answer: (setq nrepl-popup-stacktraces nil)

9:06 Apparently this possibility was only patched into nrepl.el a few weeks ago. :P

9:15 sattvik: xeqi: I'll look into converting to core.contracts.

9:23 nz-: is there a way to make clojurescript compiler issue an error if I am trying to use undelcared variable? e.g. made a typo in variable name. Now I get just a warning, probably from google closure compiler.

9:41 _KY_: I used "doseq" to evaluate something, but it still seems to be lazy... is that normal?

9:41 But if I add a "print" to debug it, it evaluates fully

9:41 doseq is supposed to force evaluation, right?

9:42 ssideris: _KY_: try doall

9:49 _KY_: ssideris: still the same... inside the doseq I call other functions with lazy sequences inside... could that be the problem?

9:50 michaelr`: hello

9:56 _KY_: Ohh I see the problem.... I used some asynchronous update...

10:36 wmealing: i'm trying to understand a form, and I don't know what it does.. the irclj library..

10:36   (let [{:keys [in] :as connection} (connection/create-connection host port)

10:36 i dont see where "in" is defined

10:36 http://raynes.me/hfiles/narrow.html

10:39 xeqi: that says bind in to the (:in (connection/create-connection host port)). it'll be defined there

10:41 tmciver: wmealing: it's map destructuring; :in should be a key in connection.

10:42 wmealing: reading both of you guys comment, and trying to fully understand it, this may take a few minutes.

10:44 tmciver: wmealing: read up on map destructuring. It does take a bit to get your head around, imo.

10:46 wmealing: similar t how erlang does it.. ok

10:49 and the rabbit hole goes deeper

10:54 thanks both xeqi and tmciver, i have a better understanding now :)

13:38 seneth: when evaluating ((print "works")(print "works")) I get "NullPointerException user/eval1284 (NO_SOURCE_FILE:1)worksworks". Whay is that?

13:39 can you evaluate more expressions with just wrapping them in () or do you have to explicity use (do)?

13:39 xeqi: seneth: its trying to call the result of (print "works") with the result of the other (print "works")

13:41 pisketti: seneth: you have to use do

13:41 seneth: so is it treating first result of print like a function call and second result of print like an argument?

13:41 pisketti: yes

13:41 seneth: but why there is no whitespace?

13:42 Sgeo: *like a function

13:42 seneth: (fun-name arg) isnt this syntax to call a fun?

13:42 (fun-namearg) shouldnt work?

13:42 pisketti: yes

13:43 huh?

13:44 I don't follow

13:44 seneth: (print"works") is the same as (print "works") didnt know that

13:44 i have tried it and it works

13:44 pisketti: I'll be damn, it does ;)

13:44 seneth: seems like I dont have to put a whitespace befor first argument

13:45 pisketti: well, it has to be a string literal I guess

13:45 Sgeo: Or perhaps just something that the reader will separate into different parts

13:45 ,(+1(+ 2 3))

13:45 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

13:46 Sgeo: hm

13:46 ,(+1 (+ 2 3))

13:46 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

13:46 Sgeo: ,(+ 1(+ 2 3))

13:46 clojurebot: 6

13:46 cark: +1 is a valid symbol name

13:46 seneth: for a fun with more then one param you have to put a whitespace, with just one you dont have to.Its not consistent

13:46 Sgeo: seneth, that's not what's going on

13:46 ,(+ 1(+ 2 3)(+ 4 5))

13:46 clojurebot: 15

13:46 cark: it's not a matter fo white space, but of reader understanding things are different as sgeo said

13:47 keugaerg: (+ 1 2)

13:47 clojurebot: 3

13:47 keugaerg: ,(+ 1 2)

13:47 clojurebot: 3

13:47 cark: (let [+1 inc] (+1 2))

13:47 ,(let [+1 inc] (+1 2))

13:47 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.Exception: Unsupported binding form: 1>

13:47 keugaerg: nice :-)

13:47 chouser: is there a way to so "not" in core.logic?

13:47 Sgeo: cut-fail? /me ducks

13:47 hyPiRion: ,+1

13:47 clojurebot: 1

13:48 chouser: specifically, that a sublist does not appear in a longer list

13:48 Bronsa: +1 is the number 1

13:48 cark: right =/

13:49 it's still an "atom" and the reader interprets it as a single thing

13:49 atom in the old lisp sense

13:49 Bronsa: (not (coll? )) :)

13:51 Sgeo: ,(*1)

13:51 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/*1>

13:51 Sgeo: ,(+(+ 1 1))

13:51 clojurebot: 2

13:55 chouser: or even just an exclusive-or in core.logic? Like a then/else, rather that the "any" that conde gets you

13:56 seneth: i don˙t get it. Why this works (+ 1(+ 2 3)) => 6 ? There is no whitespace. Does the interpreter know where the second argument starts cuz of the "("??

13:56 lazybot: seneth: Uh, no. Why would you even ask?

13:56 Sgeo: seneth, yes

13:56 Because 1( is not a valid symbol

13:57 Incidentally, lazybot should be slapped

13:57 lazybot, should you be slapped??

13:57 lazybot: Sgeo: Uh, no. Why would you even ask?

13:57 Sgeo: Yes.

13:57 Sgeo: Ok then...

13:58 hyPiRion: heh

13:59 Consider every "(" as " ("

13:59 Sgeo: It works with other things too

13:59 (let [foo "foo"] (str foo"bar"))

13:59 ,(let [foo "foo"] (str foo"bar"))

13:59 clojurebot: "foobar"

14:00 Sgeo: ,(str"foo""bar")

14:00 clojurebot: "foobar"

14:00 seneth: Then why this doesnt work (+2.0 1)?

14:00 mk: (+123b_d)

14:00 ,(+123b_d)

14:00 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: +123b_d>

14:00 Sgeo: seneth, because +2.0 reads as a number

14:01 chouser: Well, shoot. I'm stuck.

14:01 Sgeo: Does core.logic have cut?

14:03 chouser: ah, that's the word I needed!

14:03 conda

14:03 conda might be what I need. Thanks!

14:04 Sgeo: o.O you're welcome

14:07 chouser: seriously. I've been grepping through the code and tutorials looking for "not", "complement", etc. Using "cut" found the set of functions that I think will work.

14:08 RonnieDk: I've been using Korma to connect to and read data from a WordPress MySQL. But I'm experiencing difficulty with datetime fields. Korma says: java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 4 to TIMESTAMP ... is the datetime type not support?

14:11 jballanc: what date would 0000-00-00 be?

14:12 I guess 0000-01-01 should work?

14:13 hmm...

14:13 RonnieDk: jballanc: all the zeros is the default value for the field

14:13 jballanc: ,(++2.0 1)

14:14 clojurebot: #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: ++2.0, compiling:(NO_SOURCE_PATH:0)>

14:14 jballanc: guess not

14:14 RonnieDk: yeah, that's what I thought...

14:14 just wondering if the adapter doesn't know that?

14:14 (I'm a Korma newbie myself)

14:14 seneth: Finally I got it thanks. Still dont udnerstand why would you let that form of expression to work.

14:15 RonnieDk: jballanc: I wonder why it says TIMESTAMP in the exception and not DATETIME

14:16 uvtc: cemerick: Does clutch work well with CouchDB 1.0.1? That's the version which is available via apt, but the couchdb install instructions recommend installing 1.2.0 using an alternative method.

14:18 llasram: uvtc: Debian sid has a 1.2.0 package which you should be able to rebuild for your environment w/o too much trouble. There have been enough bugfixes and improvements since 1.0 that I personally highly recommended it even if your client-side is compatible w/ 1.0

14:18 danslamo: other than indenting, is a common way of making nested map applications more readable?

14:18 ,(apply str (map char (map (partial + 32) (map int (seq "ABCDEFG")))))

14:18 clojurebot: "abcdefg"

14:19 jballanc: RonnieDk: I think that depends on the JDBC driver, no? I can't imagine it wouldn't

14:19 danslamo: other than indenting, is [there] a common way of making nested map applications more readable?

14:19 llasram: &(->> (seq "BCDEFG) (map int) (map partial + 32) (map char) (apply str))

14:19 lazybot: java.lang.RuntimeException: EOF while reading string

14:19 danslamo: , (map char (map (partial + 32) (map int (seq "ABCDEFG"))))

14:19 clojurebot: (\a \b \c \d \e ...)

14:19 llasram: &(->> (seq "BCDEFG") (map int) (map partial + 32) (map char) (apply str))

14:19 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$_PLUS_

14:20 uvtc: llasram: The couch install instructions recommend installing from source using "build-couchdb". I'm on the most recent Xubuntu. Have you used build-couchdb?

14:20 llasram: Third time is the charm...

14:20 &(->> (seq "BCDEFG") (map int) (map (partial + 32)) (map char) (apply str))

14:20 lazybot: ⇒ "bcdefg"

14:20 danslamo: :llasrm very cool thanks!

14:20 RonnieDk: jballanc: maybe I should try out clojureql instead. Have you?

14:20 llasram: uvtc: I have not. We just used the sid package, tweaked the dependency list, and rebuilt for Debian squeeze

14:20 clojurebot: list* doesn't actually make a `list?`

14:20 uvtc: llasram: thanks.

14:21 clojurebot: what is your least-favorite class this semester?

14:21 clojurebot: add-classpath is bad, avoid it. I mean it!

14:22 danslamo: lol

14:22 hyPiRion: what's up with clojurebot?

14:22 * uvtc wonders who's teaching that one...

14:22 hyPiRion: is someone trying to make it sentient?

14:23 uvtc: hyPiRion: I assume it's just using some heuristics to try and guess what you're asking it about.

14:23 hyPiRion: clojurebot: what are you planning?

14:23 clojurebot: Cool story bro.

14:24 jballanc: RonnieDk: only played a little with clojureql, and only with Postgres

14:24 hyPiRion: uvtc: okay for me, as long it doesn't improve that heurestic.

14:24 RonnieDk: jballanc: why do think in general? ClojureQL vs. Korma?

14:25 jballanc: clojurebot: recite the litany against cons

14:25 clojurebot: (def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead

14:25 jballanc: hmm...yeah, someone's been messing with clojurebot methinks

14:25 RonnieDk: I like ClojureQL's approach better, but I like Korma's activity profile more :-/

14:26 mthvedt: clojurebot: do you know any songs

14:26 clojurebot: Excuse me?

14:28 jballanc: i.e. I think Korma is the better supported library at the moment

14:28 RonnieDk: jballanc: and maybe less complete as well.

14:28 jballanc: clojurebot: litany against cons

14:28 clojurebot: litany against cons is "I must not cons. Cons is the perf-killer. Cons is the little death that brings total obliteration. I will face my cons and permit it to pass over me and through me, and when it has gone past I will turn my GC to see its path. And where it has gone there will be nothing; only I will remain."

14:29 jballanc: there we go

14:29 RonnieDk: You mean Korma is less complete? I had the impression that ClojureQL was missing more, IIRC

14:30 RonnieDk: jballanc: the code base for ClojureQL is larger and it's at v1 vs. 0.3 beta, though it may not say much

14:32 Hodapp: okay, this <LocalLeader> noise is confusing me in :help vimclojure

14:34 nevermind, just needed to save the file as a .clj for it to work

14:41 RonnieDk: jballanc: Might have found the problem. The mysql-connector-java on clojars is way outdated

14:41 jballanc: the datetime stuff was a known bug in mysql years ago

14:44 jballanc: oh, good catch :)

14:45 RonnieDk: jballanc: maven is more uptodate.

14:45 raek: jdbc connectors are usually hosted on maven

14:46 RonnieDk: raek: I followed the sqlkorma docs and tricked me up :)

14:46 Hodapp: blaaargh I just want to code shit with Quil, not spend 2 hours debugging the environment

14:50 Frozenlock: If I compile cljs, does everything need to be in the same js file, or can clojure be in one, another namespace in another, etc. ?

14:52 Hodapp: https://github.com/quil/quil - I'm trying to run the example here, but if I do it in vim (I installed lein-tarsier and such) and do /ef to run the entire file, I just get a long stack trace like...

14:52 java.io.FileNotFoundException: Could not locate for_the_glory_of_art__init.class or for_the_glory_of_art.clj on classpath:

14:52 basicsensei: ,(javax.tools.ToolProvider/getSystemJavaCompiler)

14:52 clojurebot: nil

14:53 Hodapp: and I don't know what I'm supposed to be doing differently here.

14:53 basicsensei: hey guys, I just noticed something: (javax.tools.ToolProvider/getSystemJavaCompiler) returns nil if it's jdk7, and works with jdk6u33 or so

14:53 possibly related to this "bug": http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7181951

14:54 jdk6u31 is the one I tested it to work actually

14:55 why is this relevant you ask ? lein uberjar will err: lein-javac: system java compiler not found; a JDK (vs. JRE) install is required.

14:56 hmm it may be possible that lein (in that case) is using jre7 instead of jdk7 ?

14:57 I ask because, all jdk6 and 7 that I have , they have tools.jar in lib only

14:57 naeg: someone having a neat idea for a algorithm to check a connect four field using core.logic?

14:57 can't really come up with something that really makes use of LP

14:58 Hodapp: https://github.com/quil/quil - can anyone more familiar with leiningen than myself explain how to run that code example they give, in a way that is not just pasting it into a REPL?

14:59 basicsensei: naeg you reminded me of this tweet from @blcooley "Some people, when confronted with a problem, think, I'll use #clojure core.logic. Now they have a problemo."

15:00 naeg: basicsensei: I'm just curious :P someone in here said that I could try that (programming a connect four game currently)

15:00 but I can't come up with something which is really a logic solution

15:01 basicsensei: naeg, to be hones I've no idea what core.logic does , or what you said :) I am new to clojure, but I did notice that tweet

15:01 xeqi: Hodapp: whats the path of the file you saved it in?

15:01 Hodapp: xeqi: test.clj

15:01 in the project directory that lein created

15:01 xeqi: so.. not in the src directory?

15:02 raek: Hodapp: the project directory is not added to the classpath, but the src/ directory is

15:02 pepijndevos: Are there any ring router libs that use core.match or other pattern matching? Seems like an obvious thing to do.

15:02 xeqi: and if it is test.clj, then change the namespace as well

15:02 Hodapp: gah, what should the namespace be?

15:03 xeqi: if the file is src/test.clj then (ns test ...)

15:03 raek: Hodapp: the name in the (ns ...) line should be the same as the filename, but where there is - in the ns name, there should be _ in the file name

15:03 and . in the ns name correspond to / in the file name

15:04 Hodapp: hmm, I sort of wish that the authors behind 'quil', if they're going to include in instructions for getting started using lein, would refrain from half-assing them and leaving out details like that

15:04 chouser: naeg: I'm exploring working with tic-tac-toe boards in core.logic. Haven't gotten very far yet.

15:04 basicsensei: lol

15:04 Hodapp: so with the source code put in 'src', how might I go about running this?

15:05 xeqi: pepijndevos: I haven't seen anything. thought the same thing

15:05 naeg: chouser: similar problem, but when doing tic-tac-toe I'd just check pre-stored winning combinations (there aren't that much on a field of 3x3)

15:05 raek: Hodapp: you can then load the code and enter the namespace by running (require 'the-namespace-name) (in-ns 'the-namespace-name)

15:05 chouser: naeg: sure

15:05 pepijndevos: xeqi: I made an half-assed attempt, and it seems to work.

15:05 raek: this will evaluate all the top-level stuff in that file and put the repl in the namespace you just loaded

15:05 basicsensei: Hodapp: it says: "For more detailed instructions head over to the wiki." https://github.com/quil/quil/wiki/Installing

15:05 chouser: but for a learning experience, one can still attempt a more general solution, even if you've only got a 3x3

15:06 Hodapp: basicsensei: I'm looking at those, but I'm not particularly interested in pasting all my code into a REPL.

15:06 naeg: chouser: it's actually also what I'm doing with clojure without using core.logic - don't really need it for that. (69 winning combinations for 6x7 btw)

15:07 xeqi: I don't know enough about quil to awnser that... it looks like defsketch starts up the gui, os `lein run -m test/example` might or might not work

15:07 depending on the underlieing implementation

15:08 I gave a brief demo using that yesterday, but could just C-c C-k from emacs to nrepl. Not sure the vim equivalent

15:08 Hodapp: q

15:09 pepijndevos: This is what… something… compojure ore moustache uses, apparently: https://github.com/weavejester/clout/blob/master/src/clout/core.clj

15:09 basicsensei: Hodapp: you have a point, they don't quite tell you where in the file to paste the code and what ns changes would that require

15:09 pepijndevos: No macros involved <3

15:11 naeg: basicsensei: about your tweet - do you actually get the joke in it without knowing what core.logic is about? ;

15:11 ;)

15:11 basicsensei: how can I make lein spit out what java (jdk or jre or path to the exe) it's using? lein version doesn't seem to tell me jdk or jre

15:11 naeg, probably not, unless it's related to the "o" in problemo :)

15:12 pepijndevos: My attempt, there was something awkward about this: https://github.com/pepijndevos/Baard/blob/master/src/baard.clj

15:12 basicsensei: naeg, can you tell me though? curious:)

15:12 Hodapp: alrighty. putting source code in the correct namespace allows me to run it from lein-tarsier with \ef but I don't actually know what \ef is doing (as far as, for instance, a lein command)

15:13 naeg: basicsensei: I can send you the link to a nice talk about it

15:13 basicsensei: naeg, much obliged thanks

15:15 gfredericks: oh man I just had apparent cause in my cljs code to make an atom that holds an atom O_O

15:15 I think I am using too many atoms

15:16 naeg: basicsensei: http://blip.tv/clojure/dan-friedman-and-william-byrd-minikanren-5936333

15:16 Hodapp: okay, this is odd. If I take that example from quil's github intro, and then run it with 'lein -m for-the-glory-of-art', it works properly, but it also gives the error:

15:16 naeg: I think it's that one

15:16 Hodapp: Exception in thread "main" java.lang.ClassNotFoundException: for-the-glory-of-art

15:16 basicsensei: doesn't it need a -main ?

15:16 which would maybe do (sketch example) ?

15:17 raek: ah, yes

15:17 basicsensei: naeg, thanks, checking

15:17 Hodapp: basicsensei: perhaps, but why would it run just fine without this?

15:17 raek: Hodapp: the convention for "runnable" namespaces is to have a function in it that is called "-main"

15:17 naeg: basicsensei: if you're really interested in core.logic, I can send you a few more talks and articles. just ping me

15:17 raek: Hodapp: because this code does not do its work when the -main function is called. it does its work when the file is compiled

15:18 basicsensei: Hodapp: in which way you say it works? does it like display the example as in (sketch example) ?

15:18 cause I would guess it doesn't, just as raek said

15:18 raek: "Finally defsketch a convenience macro around sketch ties everything together, specifies a title and size and starts things running."

15:19 Hodapp: basicsensei: everything is drawn, and it continues to loop and draw more

15:19 basicsensei: oh i see:)

15:19 raek: so it's like a defn that does both (def foo (fn ..)) and (foo)

15:20 I wouldn't name such a macro "def___"

15:20 Hodapp: I'm just trying to figure out what VimClojure is doing when I do \ef to run the whole file

15:20 xeqi: it probably has a repl running in the background and sends the file to it

15:20 basicsensei: raek, so in the process of trying to evaluate that .clj file to then call -main it evaluates (foo) which causes it to "start" and then shows the lack of main ?

15:20 raek: Hodapp: some people use another convention where you run a script by just evaluating everything in a file though

15:21 Hodapp: because it has to be run with 'lein' to set up the classpath, I'm guessing

15:21 raek: this approach has some problems though

15:21 Hodapp: but what command would I run?

15:21 raek: and lein does not support it

15:21 Hodapp: in this case I would add a (defn -main [] nil) line to the for_the_glory_of_art.clj file

15:22 Hodapp: and then run the whole thing using "lein run -m for-the-glory-of-art"

15:22 Hodapp: ahh, okay

15:22 basicsensei: ,*clojure-version*

15:22 clojurebot: {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}

15:22 pepijndevos: Does Meikel Brandmeyer com in here sometime?

15:23 basicsensei: how would we get the java version ? I figure maybe need to use java interop but don't know how to get it in java either

15:23 Hodapp: raek: Thanks, this is working

15:24 konr: Why would I want to share code between Clojure and ClojureScript?

15:25 Sgeo: Because some libraries might be useful in either language

15:25 Such as algo.monads

15:25 raek: Hodapp: also, if you add a :main for-the-glory-of-art entry to the project.clj file, make sure you write it like this: :main ^{:skip-aot true} for-the-glory-of-art

15:25 xeqi: basicsensei: what does `java -version` give you?

15:25 basicsensei: naeg, I'm getting that video to watch it later

15:25 xeqi: should be what lein is using unless you're doing something to change it

15:26 raek: ...otherwise you will get mysterious problems when reloading code interactively

15:26 Hodapp: raek: why?

15:26 basicsensei: xeqi, kind of the same as lein version , can't tell if it's jre or jdk

15:26 xeqi, you're right I think and it's in c:\windows\system32\java.exe =)

15:26 raek: (ahead of time compilation is enableod here for historical reasons and backwards compatibility)

15:27 if you use AOT compilation you will get .class-file versions of your source files, which will have precedence

15:28 so when you update the source, clojure won't pick up the changes when you reload the namespace using (require '... :reload)

15:29 basicsensei: xeqi: guess what? I stopped being stubborn and assumed it's jre6, therefore i placed tools.jar inside jre7\lib and now lein uberjar doesn't give me the now famous: lein-javac: system java compiler not found; a JDK (vs. JRE) install is required.

15:29 raek: or maybe :skip-aot is the default in lein2?

15:29 basicsensei: xeqi, thanks ;)

15:29 Sgeo: What's the difference between jre and jdk?

15:30 gfredericks: jdk has the compiler and scuch

15:30 basicsensei: xeqi, any sugestions that I can do so that others know how to fix this?

15:30 naeg: basicsensei: what core.logic basically does is bringing prolog-like (logic) problem solving to clojure - you define rules and facts, which make up a knowledge base and you then query this knowledge base to get results

15:30 basicsensei: gfredericks: yeah, but lein was using the jre which java.exe was in system32

15:31 Hodapp: raek: thanks.

15:31 basicsensei: naeg, oh that gives me some clues

15:31 xeqi: could try an summarize this in a pull request or issue. Not sure I understand what you did there

15:31 basicsensei: xeqi, I was thinking the same thing, thanks

15:35 Hodapp: raek: Seeing no difference (with lein 2) with or without ^{:skip-aot true} when I just do 'lein run'.

15:35 raek: Hodapp: does stuff appear in the classes/ directory?

15:36 Hodapp: hmm, it's empty now

15:37 raek: if it is empty the you should be fine

15:37 Hodapp: the :main option lets you run your project using just "lein run"

15:37 Sgeo: Does the JDK come with the JRE? Should I uninstall JRE before installing JDK if so?

15:38 Hodapp: JDK comes with JRE, typically

15:45 lnostdal: is it possible to express things like (fn [x & _] (* x x)) using the #(...) reader form somehow?

15:45 gfredericks: yes but it's very ugly

15:46 basicsensei: Sgeo, jdk will install jre afaik, I don't think you can opt-out of having jre installed when installing the jdk, and they seem to reside in two folders, for windows (the 64bit jdk) it made 'jdk1.7.0_06' and 'jre7' folders in 'C:\Program Files\' and I also have leftover folders like 'jdk1.7.0_05' but the java in 'jre7' folder is always from the last jdk installed(or does it keep the highest version? unsure), and it also puts the

15:46 gfredericks: ,(#(do %& (* % %)) 7 8 9 10)

15:46 clojurebot: 49

15:47 lnostdal: mmh, yeah, i thought of that, but ugly indeed

15:47 gfredericks: lnostdal: any instance of %& in the form will make it varargy; even #_%&, currently

15:47 basicsensei: what does the (do %& part do ?

15:47 Sgeo: I guess the question is since I already have JRE installed, do I need to uninstall it before installing JDK

15:47 gfredericks: but I think that should be considered a bug

15:47 Sgeo: Or will the JDK's version replace the JRE smoothly?

15:48 gfredericks: basicsensei: mentions %& but ignores it

15:48 basicsensei: Sgeo, it will replace/upgrade the existing jre i believe, unless(and maybe even then) you're installing an older jdk

15:48 gfredericks: ,((comp #(* % %) first list) 7 8 9 10)

15:48 clojurebot: 49

15:49 basicsensei: gfredericks: oh it makes sense now, I was thinking that it function calls but it didn't have the ()

15:49 casion: so if I'm using something like http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html#read(byte%5B%5D) is there any other way to use 'b' in the same statement, or do I have to wrap everything in a (do)

15:50 Sgeo: ,(#(do (* % %)) 7 8 9 10)

15:50 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox$eval87$fn>

15:51 basicsensei: ,(#(do %& (* % %)) 7 8 9 10)

15:51 clojurebot: 49

15:51 basicsensei: that's very clever! if you don't mention %& it has like 1 arity

15:52 ,(#(do (* %1 %2)) 7 8 9 10)

15:52 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox$eval176$fn>

15:52 basicsensei: ,(#(do (* %1 %2)) 7 8)

15:52 clojurebot: 56

15:52 basicsensei: ok the arity is determined by however many are used, cool:)

15:53 gfredericks: so that's why you had to mention %&

15:53 gfredericks: exactly

15:53 basicsensei: I like finding out things like this=)

15:55 Sgeo: Might it be easier to just use fn for this stuff?

15:55 lnostdal: i think fn looks cleaner in this case, yes, Sgeo

15:55 it's 3 extra chars, but cleaner IMHO

15:56 ,((fn [x & _] (* x x)) 7 8 9 10)

15:56 clojurebot: 49

15:57 Sgeo: Oh hey now I understand what's going on

15:57 lnostdal: i think clojure 1.5.x supports custom reader macros though

15:57 gfredericks: wat

15:57 basicsensei: lnostdal: those with # ?

15:58 lnostdal: yeah, basicsensei .. i haven't looked at it yet .. they are maybe not the same as e.g. Common Lisp reader macros

15:59 gfredericks: lnostdal: I cannot believe that is the case

15:59 basicsensei: lnostdal: I don't know anything about the lisp ones, but I think I've stumbled upon a case where they were defined and used with lein , if I could only remember where to take a second look

16:00 gfredericks: because as I understood it the 1.4 data readers were partially intended to avoid a need for custom reader macros

16:01 lnostdal: 1.4 actually, yes; https://github.com/clojure/clojure/blob/master/changes.md .. but never mind .. it's not a big deal

16:03 Sgeo: I've asked this before, but I don't think I got an answer.

16:03 gfredericks: that makes me curious if you could use data readers to emit code

16:03 Sgeo: How acceptable is it to use an agent as a place to send functions to without using the actual value of the agent for anything

16:04 gfredericks: Sgeo why not futures?

16:04 basicsensei: actually that's what I saw: https://github.com/clojure/clojure/blob/master/changes.md#21-reader-literals

16:04 with the data_readers.clj :)

16:05 (so it wasn't with lein, my bad)

16:14 can I specify java version to be used when compiling ? in project.clj maybe?

16:14 raek: Sgeo: why not thread pools? An agent is basically just a thread pool + state handling.

16:15 Sgeo: http://blog.raek.se/2011/01/24/executors-in-clojure/

16:15 Sgeo: I know what a thread is, but.... what's a thread pool?

16:15 Is it going to be some kind of hack on the JVM to work around threads being heavyweight or something?

16:15 raek: Sgeo: well, yeah.

16:15 * Sgeo cries

16:16 raek: an Executor is an object that accepts tasks to be executed

16:16 it is backened by some threads

16:17 clojure functions implement the Runnable interface, so you can submit them as they are to executors

16:18 an agent is just a state transition mechanism built on top of an executor

16:19 Sgeo: What's the difference between reify and proxy?

16:22 raek: Sgeo: reify was added later and was designed together with defprotocol, deftype and defrecord

16:22 both Clojure and ClojureScript have reify, defprotocol, deftype, and defrecord

16:23 but only Clojure has proxy (which is more JVM/CLR centric)

16:23 you can use reify on java interface in Clojure though, so reify and proxy overlap there

16:26 beffbernard: I'm having some trouble with decoding my .lein/credentials.clj.gpg file. I get the follow error: gpg: can't query passphrase in batch mode.. when I issue a lein command.. Any thoughts?

16:45 tomoj: think we can get bound-fn* in cljs?

16:46 seems unlikely..

16:49 danslamo: I'm becoming a clojure junky. Is closure a gateway language? Should I be worried about a future addiction to harder languages like Haskell?

16:50 chouser: danslamo: I wouldn't say /worried/, but there's a definite risk.

16:50 Although intimate familiarity with macros may be a sufficient antidote.

16:52 danslamo: I have not yet tried macros

16:52 AimHere: You might go full loper and demand that your computers become Lisp, all the way down

16:52 chouser: I think love of Clojure is unlikely to lead that direction.

16:54 danslamo: I wanted to try a macro for this, but have not yet attempted. http://tinyurl.com/8k5esyd

16:55 I am working on going full loper

16:56 gfredericks: danslamo: without reading more that 30 seconds I think currj can do that

16:56 danslamo: I decided to learn fn programming the hard way by writing a lambda calculus complier / reducer

16:57 I will try that

16:57 writing a lambda calculus complier / reducer in clojure is hard when you don't really understand either

17:03 konr: In a clojurescript REPL connected to a browser, how can I examine more thoroughly the objects? For example, typing 'js/console' returns no information on the object's methods and attributes

17:09 tomoj: konr: well, you can at least do (js-keys js/console)

17:10 js->clj doesn't work on js/console because its type isn't directly Object

17:11 melipone: hello! Can I "slurp" a java hashmap that I wrote out with "spit"? I'm getting a string but I can't make it into a hashmap with read-string. Help!

17:11 chouser: No, java objects aren't readable, generally

17:11 melipone: that's what I was afraid of. Any work around?

17:12 chouser: melipone: is this a one-off thing (you're trying to manually recover data)?

17:12 melipone: chouser: no, it

17:12 chouser: or you intend to do it regularly? In that case, I'd just convert it to a clojure map first.

17:12 melipone: it's not a one-time thing

17:13 chouser: okay, I thought that might be a way to go but wanted to check first

17:13 chouser: well, you could customize the printer so as to print it as if it were a clojure map

17:14 of course it would get read as a PersistentMap. Would that be good enough for your purposes?

17:14 melipone: I need the java hashmap because I want to rerun the same function without re-populating the hashmap again

17:14 chouser: yes, I can just convert it to a hashmap I guess

17:15 chouser: are they nested inside each other, or the hashmap's keys and values normal printable things (like strings, numbers)

17:15 melipone: chouser: how do you customize the printer?

17:16 chouser: yes, the keys are numbers (hashcodes really) and the values are string

17:17 chouser: ,(into {} (java.util.HashMap. {"a" 1 "b" 2}))

17:17 clojurebot: {"b" 2, "a" 1}

17:17 chouser: ,(read-string (pr-str (into {} (java.util.HashMap. {"a" 1 "b" 2}))))

17:17 clojurebot: {"b" 2, "a" 1}

17:17 melipone: chouser: thanks, that's easy

17:17 chouser: that's probably the easiest

17:18 customizing the printer would involve doing a defmethod on clojure.core/print-method. doable, but if 'into' will work for you, that's probably better.

17:21 muhoo: wait, deploying to clojars requires gpg signing now?

17:21 i missed that meeting.

17:22 Raynes: It doesn't require it yet. It's just that there will be two repos on the future, one with requirements (where gpg signing is one) and one where anything goes. You generally want your artifacts to be in the one with requirements.

17:22 If you set up gpg, leiningen will sign your jars for you if you use `lein deploy clojars`.

17:23 muhoo: thanks. lein deploy clojars gave me an error, wasnt' clear to me if it succeeded or not

17:25 zenoli: So, I've got some code that generates a stream of vectors describing events (changes in a graph). I have a number of consumers (one of whch is a Java graph visualization library) that may want to act on these events. What's the best way to implement something like an Observer pattern?

17:25 It seems like maybe an agent with a watcher?

17:26 chouser: that's an option. what about a lazy-seq?

17:27 danslamo: :gfredericks Is currj more efficient that partial?

17:28 [than]

17:28 zenoli: chouser: Hm...how would that work? So, let's say I've got two sinks, a visualizer and a file-writer for this stream of events, and I want to keep them decoupled from the rest of the code. But if there are no observers, I don't want any state hanging around.

17:29 Where would the lazy-seq live, in that case?

17:30 chouser: zenoli: not sure. I guess you'd need a way for a new observer to jump into the stream, so perhaps a function that returns the most recent seq head?

17:31 then observers would just call .more, get the next event, call .more on that, etc. Sometimes calling .more would block until the next event comes in.

17:32 I guess that would force observers to give up a thread to block on the next event.

17:33 if you wanted async, where they provide a callback and your publisher provides the thread, a watcher is closer to what you want, though you could do it on any reference type, not just an agent.

17:33 muhoo: Raynes: um, is there any reason the lein deploy clojars should fail because there's no gpg?

17:33 becuause, i think it just did.

17:33 gfredericks: danslamo: I suspect so but I haven't measured anything

17:33 Raynes: muhoo: > technomancy

17:34 muhoo: *sigh*

17:34 gfredericks: danslamo: certainly in the case where there are parts of your function that are independent of the remaining arguments, it will compute that stuff ahead of time and only once

17:34 zenoli: chouser: For a quick test, I stuck a PersistentQueue in a ref, which works if there is exactly one consumer.

17:35 For the lazy-seq, how would I go about making sure the implementation didn't hang on to the head? lazy-seq is one of those features that I don't grok intuitively yet.

17:37 chouser: this would be a somewhat unusual use of lazy-seq anyway, but if you don't mind the observers blocking, it might work out quite nicely. The producer would just hang on to only the most recent cell, so nothing would be leaked there.

17:38 the consumers would have to drop each cell as they do .next to move on. If they failed to drop and move on, then the seq between what it's holding and what the producer is producing would remain on the heap.

17:39 technomancy: muhoo: you can put `:sign-releases false` in the clojars entry under repositories. I'm working on a library to let all that happen entirely inside the JVM; certain parts of it currently rely on assumptions of sane infrastructure that don't hold on most non-gnome systems

17:41 gfredericks: danslamo: note the main reason I wrote than lib was for the eager partial evaluation; to simply defer to partial when fewer args are passed would be a much simpler macro, and I suspect there are a few floating around

17:44 zenoli: chouser: So, trying to think through the producer...I've got a simulation that does a world-step, which includes a list of all the graph changes since the last round. Before those changes are applied to make the new simulation state for the next cycle, there's a place to hook the code to do...something else with the vector of events. It was obvious what to do with the ref...just conj the new events onto it. How would the lazy-seq dip i

17:44 chouser: zenoli: that got cut off at "lazy-seq dip i" .. but it's a tricky question. let me see if I can slap together an example.

17:45 zenoli: "...its toe into the stream?" was the end.

17:45 chouser: Cheers, I appreciate the time.

17:46 chouser: to be clear, I'm not confident this is the better solution, just an option to consider.

17:49 zenoli: It's quite an interesting idea...abusive edge cases can be quite useful in getting one's hands around language features.

17:50 So, if I go the agent route, could I make the "state" that it holds be just the latest change? Will the registered watchers be guaranteed a sequential view of all the states?

17:53 muhoo: technomancy: No matching ctor found for class org.sonatype.aether.repository.Authentication

17:55 security/auth always seems to be the boss-level of any otherwise simple task which needs to get done. alas.

17:56 chouser: zenoli: https://gist.github.com/3687532

17:57 zenoli: chouser: Thanks, taking a look.

18:02 muhoo: technomancy: nm, i bypassed deploy clojars and just used the scp method.

18:06 zenoli: chouser: Nifty! I had to think about it for a bit, but that's really slick.

18:07 chouser: zenoli: of course I don't know how well that will fit your model or needs.

18:07 zenoli: It's the piece with the atom that was eluding me when trying to think through where the "identity" of the seq would live.

18:08 chouser: yeah, I didn't explain that well. You could of course hide the atom inside a closure or something, so consumers would call that instead of derefing an atom in order to start consuming

18:09 ...on the other hand, if you were to do it as written, consumers could choose to use either .next on the lazy seq *or* install a watcher on the atom.

18:09 that would allow a consumer to be either blocking or async.

18:19 zenoli: chouser: So, figuring out where the events are added to the stream is still a bit hazy...the cons needs to be looking at some data structure that either holds or is producing the events...but the producer is running even if nobody is looking.

18:20 Thanks for the very interesting suggestion, I'll poke at it for a bit and see how it fits in.

18:21 chouser: zenoli: you're saying your model has a mismatch with my code because your producer is always running?

18:22 konr: I'm trying to use jayq in my clojurescript demo, yet 'google.require' cannot find the 'jayq.core' I'm trying to import. The jar file is in /lib and the require line is right in the .cljs file: do I need to do anything else to make the library available?

18:38 zenoli: chouser: Not saying for certain its a mismatch, just that there's a piece I haven't seen to the end of, yet. In your example, the clock is off doing its own thing.

18:39 chouser: zenoli: so you'd like a busy looping producer to be able to toss items into the outgoing queue whenever, right?

18:39 zenoli: chouser: yes, and have those items fall through and disappear if nobody is waiting around for them.

18:41 chouser: hm, maybe a linkedblockingqueue between the producer and the atom...

18:44 zenoli: chouser: Have to step away from the computer for a while, but I really appreciate the suggestions. I'll play with the code a bit later tonight.

18:44 chouser: zenoli: ok. I'll update the gist with a blockingqueue thing, if it looks useful.

18:53 Hodapp: is there a standard way of getting documentation on a function? Quil says it has an 'explorable' API but the functions they mention just list function names, and I am wondering if I can get other documentation or at least a signature or description

18:54 skelternet: (doc doc) ?

18:54 clojurebot: "([name]); Prints documentation for a var or special form given its name"

18:54 Hodapp: there we go.

19:00 gfredericks: konr: are you compiling incrementally somehow? There is some bug in cljs that makes it spit out namespaces out of order. I occasionally have to restart lein-cljsbuild (auto) and that fixes it

19:00 konr: gfredericks: yes, I was. Let me try that

19:05 gfredericks: I think this is not the problem, as there are no 'jayq' tokens at all besides requires in the main js file. I can keep it at the .jar at libs/, right, with no need to unzip it to src-cljs?

19:05 gfredericks: konr: lein1 or lein2?

19:06 konr: gfredericks: lein 1(.7.1)

19:06 gfredericks: and you have jayq listed in the project.clj?

19:06 konr: yes

19:06 gfredericks: so it's in /lib because lein put it there?

19:06 konr: yes

19:07 gfredericks: that sounds pretty standard

19:07 it oughta just work

19:08 konr: do you have more than one :require clause in the ns decl?

19:09 konr: gfredericks: no, just a :require for clojure.browser.repl and :use for jayq.core - let me upload the code

19:10 gfredericks: konr: if you use :use you should add an :only

19:10 or switch to :require with :refer

19:10 in any case, just one clause of each I think

19:11 `thomas: is (System/exit 0) the best way to quit a clojure process under emacs nrepl?

19:24 konr: gfredericks: in the end, it was that bug you mentioned! Thanks for pointing out!

19:25 gfredericks: it's a shifty little thing

19:25 oh the other thing I do

19:25 I forgot to say

19:25 is to always `rm -rf .lein-cljs*` before starting it back up again

19:26 mostly I do it out of paranoia but maybe that would have solved your problem faster

19:26 Hodapp: hrm, it can't resolve 'doc' in this REPL for some reason :|

19:26 but works if I do 'lein repl'

19:26 gfredericks: (use 'clojure.repl)

19:27 Hodapp: huh, thanks

19:31 syntaxfree: short one: to change the default file path read by 'load-file ?

19:32 gfredericks: I don't know for sure but would not be surprised if it weren't possible

19:32 i.e., if it were tied to the jvm's CWD

19:35 if that's the case and you really don't like it, the fs library might interest you

19:37 syntaxfree: at some point this is going to be tied in some more permanent way to The System. which The Dev folks are too busy to explain to me. I agreed to be a technical consultant and provide prototype Matlab code but now I find myself crash learning me some actual software development.

19:38 gfredericks: oh noes!

19:40 mdeboard: oh YES

19:41 syntaxfree: Yes, I took Scheme in college and prior to that I was self-taught in Haskell and had a snarky blog, and I wrote BASICA.EXE games as a kid. that said, I basically understood I was entering in a partnership with a tech startup doing the mathy stuff, but it's more of a social marketing company and The Dev Group who wrote all the system are all of the two founders. the entire company is me, the two founders and a salesman. And they're so focused on tryin

19:41 to make some actual money to make everyone's time worth it, they seem to be losing touch of the tech stuff.

19:42 gfredericks: just toss in a few parentheses and it'll all work out

19:42 syntaxfree: it's not nearly as orthogonal as they want to. I tried to lie to myself too, after it sank that Matlab prototypes in Octave weren't scaling.

19:43 gfredericks: orthogonal?

19:44 syntaxfree: It's mostly a blob of PHP that writes a csv edge list, gets delicious mathy sprinkles on Octave (a Matlab partial reimplementation) and gets muched back into the system. They keep saying they want to move into Python, which at least has some access to linear algebra primitives (I`m disturbed by the lack of sparse matrix support in Incanter, btw), but Python is really wordy and unreliable.

19:45 last time I tried to prototype something in python for other reasons? Kept stumbling on 3/2 = 1 bugs.

19:46 gfredericks: well you'll be happy to know that ##(= 3/2 1)

19:46 lazybot: ⇒ false

19:47 gfredericks: also ##(= (/ 3 2) 1)

19:47 lazybot: ⇒ false

19:47 syntaxfree: anyway, now I'm trying to design an abstract interface. if some part of my corner of the system ends up being written in clojure, it will probably communicate with that. but trying to take software engineering in five days is not like, say, trying to take Erlang in 5 days.

19:48 and they don't have much engineering in The System to begin with. Worst yet? I agreed to do it for a cut of the company. And they keep missing the point, possibly because they want to make money faster.

19:48 The point is that by integrating merchant user DBs into our Big DB we have a Big DB to draw intelligence from, and this snowballs as we get more clients. At least that was why I bought in.

19:49 It's such a shame, seeing a bad dev become a bad marketer.

19:52 wmealing_: syntaxfree: which place can he do less damage ?

19:53 jballanc: hmm...and I correct in guessing that type hinting does not allow you to dispatch on type?

19:54 gfredericks: correct!

20:00 unlink: jballanc: multimethods and protocols are Clojure's type dispatch features.

20:26 jballanc: unlink: sure, I guess I was just hoping to be able to short-circuit that with type hints

20:27 casion: you could always write a macro ;)

20:28 unlink: jballanc: Protocols are actually rather concise.

20:28 Sgeo: If I want to wrap around a thread-unsafe C API, does it make sense to have functions that call the API directly be sent to a single agent?

20:29 casion: Sgeo: if it's thread-unsafe… that'd kind of be exactly what you'd want to avoid

20:29 Sgeo: Should I just make a lock?

20:30 How do I do locks in Clojure?

20:30 gfredericks: casion: why would the agent be bad?

20:30 Sgeo: I think an agent would be fine

20:31 technomancy: Sgeo: one option is to use a linked blocking queue or the like; that way you avoid the whole "serialization through a reference type" messiness

20:31 agents have queues in them, but that's not what they're designed for

20:31 casion: gfredericks: agents can read from a state at an arbitrary time can't they?

20:31 gfredericks: casion: he wouldn't be using the state

20:31 technomancy: push stuff onto a regular j.u.c queue and only consume it from a single thread.

20:31 chouser: I updated https://gist.github.com/3687532 for anyone who cares.

20:31 technomancy: no agents needed

20:32 clojurebot: java.util.concurrent?

20:32 clojurebot: java.util.concurrent is "When I find myself in times of trouble / Prof. Doug Lea comes to me / Coding lines of wisdom / j.u.c."

20:32 technomancy: that is all

20:32 casion: gfredericks: that would depend on the API I'd think

20:32 Sgeo: But I don't want to think of concurrency in a Java-esque way

20:32 gfredericks: casion: the agent forces the method calls to be sequential

20:32 technomancy: Sgeo: java's linked blocking queues are just fine

20:33 Sgeo: the reason Clojure doesn't provide what you want is that the built-in JVM stuff is perfectly reasonable and we don't need to NIH our way away from it

20:35 casion: gfredericks: I see what you mean

20:41 konr: When I connect a REPL to a browser, what should I call to be able to access one namespace? (load-namespace) returns an empty string and apparently does nothing. (ns) does give me some of its symbols, such as functions, but nothing from its dependencies, defined with :use and :require

20:42 gfredericks: konr: I'm not an expert but whenever I'm in that situation I just repeat the whole dang ns decl

20:42 or create a new one and import whatever I'm interested in

20:43 I don't really know what's going on behind the scenes there...

20:50 konr: clojurescript is really light on the whole namespace-and-var thing, so for now it can be awkward when you're trying to be interactive

21:06 l1x: hey guys, how can i perform the same operation on all the members of a lazyseq which consists of vecotrs? ( [1 2 3] [5 3 2] ..... )

21:06 i would like to filter and get the vectors which third number is bigger than 0

21:07 S11001001: l1x: vectors aren't special; just use normal filter and test your condition

21:07 gfredericks: ,(filter #(pos? (nth % 3)) [[1 2 3] [ 5 3 2] [-3 -2 -1] [3 54 -3 6 7]])

21:07 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException>

21:07 S11001001: gfredericks: off by one :P

21:07 gfredericks: waps

21:07 S11001001: gfredericks: been smalltalking lately?

21:08 gfredericks: no; maybe it's because I'm evesdropping at the same time

21:08 hoover_damm: oops

21:08 gfredericks: ,(filter #(pos? (nth % 2)) [[1 2 3] [ 5 3 2] [-3 -2 -1] [3 54 -3 6 7]])

21:08 clojurebot: ([1 2 3] [5 3 2])

21:10 l1x: thx

21:10 gfredericks: apparently mine will fail if your vectors are too small though :)

21:10 (nth 3 '(1 2))

21:11 ,(nth 3 '(1 2))

21:11 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.Number>

21:11 gfredericks: ,(nth '(1 2) 3)

21:11 clojurebot: #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>

21:11 gfredericks: clojure is hard

21:11 S11001001: gfredericks: moreover I don't see why you are using nth

21:11 gfredericks: don't ever let them tell you clojure is easy kids; I've been using clojure for years and I still can't find things in a list

21:12 S11001001: what would you use besides nth?

21:12 S11001001: gfredericks: function calling

21:12 clojure's easy, l1x, gfredericks is jus' joshin' ya

21:13 ,(ifn? [1 2 3])

21:13 clojurebot: true

21:13 l1x: :))

21:13 gfredericks: ,([38 4 2] 48)

21:13 clojurebot: #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>

21:13 gfredericks: ,(get [28 3] 283)

21:13 clojurebot: nil

21:13 gfredericks: there's the nilly way to get it

21:14 S11001001: bottoms out in pos?

21:14 gfredericks: oh crap

21:14 we need a nilly pos?

21:14 S11001001: nah, that's what -?> from core.incubator is for

21:14 * gfredericks registers the @nillypos twitter handle

21:14 l1x: S11001001: and how would you apply the max function to the seq where i am looking for the max value of the first number in the vectors?

21:14 S11001001: l1x: map first

21:15 gfredericks: (def mxmpfst (comp (partial apply max) (partial map first)))

21:15 S11001001: l1x: break down your task into individual operations: first, obtain a list of all the first numbers; then, obtain the max of that list

21:16 l1x: och i see

21:16 S11001001: thanks

21:16 gfredericks: I think I'm only spreading FUD tonight...

21:16 l1x: gfredericks: :))

21:20 hoover_damm: gfredericks, first step is acknowledgement

21:21 gfredericks: second step: embracement

21:24 l1x: ,(reduce max (map first (map reverse '([2 2 2] [2 1 0] [2 0 0]))))

21:24 clojurebot: 2

21:24 l1x: how bad is this?

21:26 tmciver: l1x: it's rather expensive to reverse a vector.

21:26 dnolen: tmciver: that's not true.

21:26 tmciver: dnolen: oh, no?

21:27 l1x: i thought it is not, since it is a tree where you can obtain the nth element with O(c)

21:28 afaik

21:28 dnolen: tmciver: er sorry actually you're right about the reverse fn itself. was thinking about rseq.

21:28 l1x: pls note you are reversing the [] only

21:29 well i can time it :)

21:29 gfredericks: if they're all length-3 then it's not a huge difference anyways

21:29 l1x: yeah

21:30 Sgeo: Is there a quick-and-easy way to make lein repl see a jar?

21:30 tmciver: l1x: if you're looking for max of the last item of each vector, might it be better to just use 'last'?

21:30 l1x: yep

21:31 i was reading the last doc atm

21:32 gfredericks: ew last isn't fast on vectors :/

21:33 Sgeo: ,(count? '())

21:33 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: count? in this context, compiling:(NO_SOURCE_PATH:0)>

21:33 Sgeo: ,(countable? '())

21:33 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: countable? in this context, compiling:(NO_SOURCE_PATH:0)>

21:33 Sgeo: Bluh

21:33 gfredericks: ,(counted? ())

21:33 clojurebot: true

21:33 Sgeo: o.O Isn't count slow on lists?

21:34 ,(counted (map identity '())

21:34 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

21:34 Sgeo: ,(counted? (map identity '())

21:34 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

21:34 Sgeo: ,(counted? (map identity '()))

21:34 clojurebot: false

21:34 gfredericks: ,(counted? (list* (range 100000)))

21:34 clojurebot: false

21:34 Sgeo: ,(doc list*)

21:34 clojurebot: "([args] [a args] [a b args] [a b c args] [a b c d & ...]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."

21:35 dnolen: Sgeo: not on persistent lists since they can easily keep their count, sequences yes.

21:35 l1x: ,(time last (vec (range 1e6))

21:35 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

21:35 l1x: ,(time last (vec (range 1e6)))

21:35 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (2) passed to: core$time>

21:35 gfredericks: l1x: you'd want to create the vec outside the time

21:35 ,(let [v (vec (range 1000000))] (time (last v)) (time (last (seq v))))

21:35 clojurebot: "Elapsed time: 460.981717 msecs"

21:36 "Elapsed time: 693.845984 msecs"

21:36 999999

21:36 gfredericks: ,(let [v (vec (range 1000000))] (time (count v)) (time (count (seq v))))

21:36 clojurebot: "Elapsed time: 0.042897 msecs"

21:36 "Elapsed time: 104.769792 msecs"

21:36 1000000

21:36 l1x: i see

21:36 gfredericks: so count optimizes with countables while last doesn't

21:36 I guess countable is different from indexable

21:37 I don't know if there's an interface/protocol for that

21:38 Sgeo: Is there an option I can pass to lein repl to let me specify additional classpath stuff?

21:38 I just want to toy around with a local jar

21:43 gfredericks: Sgeo: if there's anything it's probably in the leiningen sample project.clj

21:47 technomancy: Sgeo: if you're just messing around you can put it on :source-paths

22:16 gfredericks: gaughhug

22:16 suddenly lein cljsbuild silently does nothing

22:36 dnolen: wow this is a bit of a head scratcher

22:37 http://jsperf.com/stl-pd

22:37 CLJS transient PVs come out faster to build in Chrome 21 than regular arrays ...

22:41 gfredericks: do transients just punch a single array underneath?

22:41 dnolen: gfredericks: no

22:42 gfredericks: even for size < 32?

22:43 dnolen: gfredericks: oh, yes I think it does mutate the tail

22:56 Raynes: dnolen: That sounds sexy.

23:23 chouser: dnolen: I was looking for a sort of "not" in core.logic. conda got me quite a ways, but I'm again wanting "not"

23:23 Any hints?

23:24 I mean, I want to say that if x unifies with y, this branch is a dead end.

23:26 hm, I think I found a way to use membero in this case, to force x to be one of a set that doesn't include y.

23:29 muhoo: um, ok, nrepl wat? https://www.refheap.com/paste/4972

23:30 chouser: looks like all your threads threw NPEs at once.

23:30 muhoo: that's different. i was able to get a repl back by killing *nrepl-connection*, so no real problem, except, wow.

23:31 chouser: as if all the threads did (refer nil)

23:33 dnolen: chouser: negation is a serious challenge in a Prolog-like system.

23:33 chouser: I have some ideas for a solution but it's bit farther out.

23:34 chouser: I don't mind adding something though note that like Prolog if your vars aren't ground you'll run into a lot of toruble.

23:38 chouser: if I add a not goal - I definitely recommend using it only as a last resort. It's basically (defn not [g] (fn [a] (if (nil? (g a)) a)))

23:41 chouser: dnolen: interesting. Don't add it for me -- I don't know what I'm asking for.

23:46 I'm intrigued at how much I can get done without actually defining any relations.

23:46 This is pleasing because that means I'm avoiding global mutable state.

Logging service provided by n01se.net