#clojure log - Feb 05 2012

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

0:00 clj_newb: is there any weird situation where {} auto converts to nil

0:05 tomoj: &(seq {})

0:05 lazybot: ⇒ nil

0:06 ibdknox: for those wondering about my rationale for wrapping jquery: https://github.com/ibdknox/jayq

0:44 amalloy: &((constantly nil) {}) ;; this too! "auto converts" doesn't mean much :P

0:44 lazybot: ⇒ nil

0:44 lnostdal_: it's just impossible to communicate things on clojure-dev .. before 1.4 could we please fix defonce? .. it is not thread safe

0:44 and hi btw.

0:48 amalloy: most def-things aren't threadsafe - you're really only supposed to be doing them at compile time (or reload/experiment/repl time, which is also serialized)

0:49 clj_newb: I have this stupid problem. My config of vim/clojure seems to get very slow when I have files of over 1000 lines (not sure what config I'm using that causes this.) Question: is there a way to split a single namespace over multiple files? something like bar00.clj, bar01.clj, bar02.clj, bar03.clj, ...

0:50 Raynes: I highly doubt you want to split up a single namepace.

0:50 You want to split a single namespace into multiple namespaces.

0:50 clj_newb: no no, I have a giant namespace of all editor commands

0:50 that I may key binings to

0:50 mostly, I have namespaces with 20-30 definitions; but in this particular case, I really want one gigantic namespace

0:53 lnostdal_: ok ..

0:54 ..and i guess if each of the def-things had a lock things might deadlock etc.

0:54 why is it even possible to use def at a non top-level location then

0:54 i mean if it's a "bad idea"

0:55 amalloy: (if (slime-detected) (def slime-connection (create-slime-connection))) ;; for example

0:56 lnostdal_: perhaps all the def and compiler stuff should be handled by an agent or something

0:56 amalloy: (let [x (compute expensive compile-time constant)] (defn foo [bar] (+ bar x))) ;; more common

0:57 ibdknox: and other macro-y goodness

0:58 amalloy: i think you're working really hard at a particular solution to a problem, and the solution you've chosen is probably not the best one for whatever your problem is. defonce at runtime shouldn't happen

0:59 it only really gets used for "don't reset this when i reload the file in the repl"

0:59 lnostdal_: i'm using it to spawn a thread via a call to future .. but only on the first invocation of some function

0:59 amalloy: *shrug* so use a delay and force it

1:00 ibdknox: delays are one of those things no one really talks about

1:00 lol

1:01 amalloy: &(let [a (atom 0), action (delay (swap! a inc)), f #(force a)], [(f) (f) (f)])

1:01 lazybot: ⇒ [#<Atom@136b5df: 0> #<Atom@136b5df: 0> #<Atom@136b5df: 0>]

1:01 amalloy: &(let [a (atom 0), action (delay (swap! a inc)), f #(force action)], [(f) (f) (f)])

1:01 lazybot: ⇒ [1 1 1]

1:01 ibdknox: which is generally a good thing, since you shouldn't use them often, but they have some handy uses

1:01 amalloy: delays are awesome, man. i disagree with your claim you shouldn't use them often. i mean, uses for them don't come up *that* often, but they're pretty common if you know where to look

1:02 lnostdal_: so delay the future .. x)

1:02 amalloy: indeed

1:02 ibdknox: like?

1:02 (not disagreeing, just curious)

1:03 amalloy: (cond (and (cheap-test1) (expensive-test)) thing1, (or (cheap-test2) (expensive-test)) thing2, :else (expensive-test))

1:04 ibdknox: yeah, I guess I would normally let such a thing

1:04 amalloy: but you might never need its value at all

1:04 if test1 is false, and test2 is true

1:04 ibdknox: yeah

1:05 amalloy: i write a little let-later macro like the one chouser showed at the conj (except iirc his used the cljs analyzer instead of symbol-macrolet)

1:05 *wrote

1:05 ibdknox: refheap?

1:06 amalloy: impl: https://github.com/flatland/useful/blob/develop/src/useful/utils.clj#L184 and usage: https://github.com/flatland/useful/blob/develop/test/useful/utils_test.clj#L148

1:07 ibdknox: that's really nice

1:07 amalloy: the idea of using delays i invented independently (along with dozens of other people, i'm sure), but using metadata as a flag i stole from chouser

1:08 ibdknox: I need to learn more about symbol-macrolet

1:08 hadn't really seen it

1:08 amalloy: egamble (clojure dabbler in my area) folded it into his let-else at https://github.com/egamble/let-else

1:10 ibdknox: huh, interesting

1:10 amalloy: ibdknox: the good news is, there's nothing left to learn about symbol-macrolet - you just learned it all

1:10 ibdknox: lol

1:11 I wanted to do something similar with keywords a while back

1:11 amalloy: you mean, keywords as let "bindings"?

1:11 ibdknox: sort of

1:12 it was for korma over objects

1:12 just a sec

1:12 https://refheap.com/paste/630

1:12 I want to be able to use :t to mean (:t some-obj)

1:13 then I could do (> :t 2)

1:13 * Raynes swears he didn't spike ibdknox's koolaid and that he went to refheap willingly.

1:13 amalloy: i see

1:13 ibdknox: Raynes: I dunno, that koolaid *was* pretty tasty...

1:14 Raynes: ibdknox: Did you paste that with refheap.vim?

1:14 ibdknox: yep

1:14 that vim plugin is why I use it

1:14 lol

1:14 amalloy: it's pretty tough to have :t mean two different things inside the select scope

1:14 Raynes: fistbump

1:14 ibdknox: amalloy: I'd only want it in the scope of the where

1:19 amalloy: see, ibdknox, you should follow useful more closely. every tool you find youself wanting gets done before you realize you need it

1:20 ibdknox: I really should

1:20 Raynes: Meh.

1:21 amalloy: it's the only koolaid Raynes inexplicably refuses to drink

1:21 Raynes: It's true.

1:22 &(meta #'filter)

1:22 lazybot: ⇒ {:ns #<Namespace clojure.core>, :name filter, :arglists ([pred coll]), :added "1.0", :static true, :doc "Returns a lazy sequence of the items in coll for which\n (pred item) returns true. pred must be free of side-effects.", :line 2461, :file "clojure/core.clj"}

1:23 ibdknox: ?

1:26 amalloy: he can't afford a real repl, poor soul

1:27 Raynes: Specifying :arglists as metadata should override defn's setting, right?

1:28 amalloy: moooostly. the way def/defn copy symbol meta to var meta is wobbly enough that i wouldn't commit to this being true

1:35 btw, anyone know what affect (if any) ^:constant has in 1.3 or 1.4? it's something i heard about vaguely but i don't know if it actually happened

1:35 effect? this is a case in which i find myself unsure which word is right

1:44 btw ibdknox, another use i had for delays was in transforming (or (f (foo)) (f (bar)) (f (baz))) into (some f [(foo) (bar) (baz)]). the translation isn't correct, because of side effects. so i wrote a macro that expands (lazy (foo) (bar) (baz)) into (list (delay (foo)) (delay (bar)) (delay (baz)))

1:46 actually, i guess it expands to (map force (list ...))

1:50 hiredman: I often end up using thunks where I should use a delay

1:51 amalloy: me too. they're an easy tool to forget

1:51 hiredman: delays have locals clearing so you are less likely to hold onto the head of a seq

1:51 amalloy: interesting

1:52 hiredman: (well, really fns with the undocumented :once do, which both lazy-seq and delays use)

1:53 amalloy: ah! i wondered what :once did

1:53 hiredman: :once causes the result to be cached

1:53 and because the result is cached the compiled can clear closed over values and such

1:54 amalloy: wild. so if i wanted to start abusing my new-found knowledge, where could i put :once?

1:56 hiredman: ,(^:once fn [x] x)

1:56 clojurebot: #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@b8d171>

1:56 hiredman: ,(^:once fn* [x] x)

1:56 clojurebot: #<sandbox$eval55$fn__56 sandbox$eval55$fn__56@16a7e0b>

1:56 hiredman: it must only work with fn*

1:56 anyway examples are in core.clj

1:56 amalloy: right, because fn macroexpands to fn* without looking at the meta

1:57 ~def delay

1:58 hiredman: ,(let [f (^:once fn* [x] x)] [(f 1) (f 2)])

1:58 clojurebot: [1 2]

1:58 hiredman: :|

1:59 amalloy: &(let [x 10, f (^:once fn* [] x)] [(f) (f)])

1:59 lazybot: ⇒ [10 10]

2:00 daaku: anyone familiar with lein newnew? i'm trying to write a template with github/travis-ci/marginalia and it seems to be failing with "No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil" -- full trace here: https://gist.github.com/329032db7a4dda3f4676 -- full source here: https://github.com/nshah/os-template.clj

2:01 * Raynes knows nothing about it.

2:01 Raynes: Oh wait, I wrote it. Shit.

2:02 daaku: Raynes: heh, didn't see you there

2:02 amalloy: those two statements are not mutually exclusive

2:02 ibdknox: heh

2:02 Raynes: daaku: Give me a moment to take a look.

2:02 daaku: Raynes: thanks. i'm probably doing something stupid

2:03 emezeske: ;/away

2:05 Raynes: daaku: I suspect this has something to do with the hyphen in the template name.

2:05 Probably a bug on my part.

2:05 daaku: Raynes: ah. lemme try without that

2:07 Raynes: Meanwhile, I'll try to understand my code.

2:07 daaku: Raynes: yep, that was it

2:07 switching to _ fixed it

2:08 Raynes: Yeah. That's a bug on my part. I'm actually (as we speak, coincidentally) hacking on a bunch of stuff I've been meaning to do. Can you make an issue? I'll have this fixed/released by tomorrow evening.

2:08 amalloy: btw Raynes, naming a function new seems rather dangerous. i imagine technomancy did this in lein itself as well, but ##(let [new (constantly 1)] (new String))

2:08 lazybot: ⇒ ""

2:09 daaku: Raynes: awesome, will do -- will file an issue

2:09 Raynes: thanks

2:09 Raynes: amalloy: I avoid such issues by qualifying the name where necessary. The rest of lein seems to handle it okay (I imagine it uses resolve).

2:09 But yeah, in general it's a bad idea.

2:10 amalloy: fair enough. i don't know why i thought you might not be aware of the issue - you've surely run into it already by now

2:10 Raynes: :p

2:12 daaku: Also, fantastic work with reporting the issue. You put the thing up on Github and everything.

2:13 It's nice when people aren't all like "omgwtf Y plugin no werk?"

2:14 daaku: Raynes: :) i definitely understand the issues with the lack of repro steps

2:15 i'd be more proud if i could send you a pull request though

2:15 Raynes: You can.

2:16 daaku: src/leiningen/new/templates.clj line 54: 'template' needs wrapped in a call to sanitize.

2:17 daaku: "Hardcore Forking Action"

2:17 Raynes: Haha :)

2:19 daaku: Raynes: i think you mean name needs to be wrapped in sanitize?

2:19 Raynes: Nope.

2:19 amalloy: sanitize everything. it's the only way to be sure

2:19 Raynes: The problem is that the template is called os-template but your directory (to the mustache templates) was os_template.

2:20 It was making it look in the wrong place for your mustache templates.

2:21 daaku: Raynes: oops, you're right -- i assumed name was project name

2:21 Raynes: I never said it wasn't confusing.

2:21 ;)

2:22 daaku: Raynes: sent

2:23 Raynes: Thanks! You get an ecookie.

2:23 daaku: remember no eggs

2:23 Raynes: I wouldn't dream of it.

2:26 amalloy: max out the gluten and peanuts, in case someone with a different allergy tries to steal his cookies

2:26 Raynes: Hahahaha

2:27 daaku: hahaha

2:27 i'm cool with that

2:27 throw in some other nuts too

2:27 and some milk

2:28 amalloy: oh yeah, milk. how could i miss that one

2:29 * amalloy realizes his approach to cookie-making is like the RIAA's approach to the internet

2:29 Raynes: My throat hurt.

2:29 (pluralize *1)

2:37 amalloy: Present for you https://refheap.com/paste/624

2:39 amalloy: Raynes: git-core comes with a __git_ps1 function

2:39 substantially more in-depth

2:40 hiredman: it figures that as soon as I start on an s3 library weavejester releases one

2:41 Raynes: amalloy: How so?

2:41 hiredman: of course mine doesn't use the amazon sdk

2:42 amalloy: it has more useful status outputs iirc

3:36 tfaro: hello

3:37 Please am a new clojure newbie/user...need to setup the clojure environment on my system

3:37 preferrably on an ide. whats on site talks about running clojure on terminal.

3:37 thats not what i want

3:46 Raynes: daaku: 0.2.0 released. Fixes ALL the things.

3:46 daaku: Raynes: nice, thanks

3:46 Raynes: I just closed 6 issues in one push.

3:49 daaku: Raynes: no egg ecookie

3:49 Raynes: daaku: I ran out. Get over it.

4:51 lnostdal_: seems impossible to debug this stuff .. trying to figure out why stuff is spinning at 100% CPU leads to java.lang.Thread/sleep .. ... doesn't make sense

4:51 some Clojure STM thing or Java NIO ..i have no idea really .. sigh

4:52 visualvm is not much help .. what do you guys use?

6:52 manuel_: hi

6:52 is it more efficient to conj in a list and then reverse, or conj into a vector?

6:52 or both the same?

6:52 (adjusting from CL here)

7:01 raek: conj to a vector, I think

7:02 lucian: manuel_: conj into a list and reverse is O(n)

7:02 i believe vectors are pre-allocated so resizes aren't to often

7:10 manuel_: lucian: yeah i guess the vector way is ok

7:12 lucian: manuel_: also, vectors aren't entirely contiguous, since they're in a tree of depth 32

7:12 manuel_: sometimes appending is cheap, just making a brand new vector

7:13 manuel_: sounds cheaper than reversing a lst and recreating all the cons cells though

7:14 or is there some tree rebalancing involved?

7:14 sorry about the noob questions

7:14 still used to the "array is a block of memory and realloc is expensive" mindset

7:15 Licenser: manuel_ do you need the reversed list often?

7:15 lucian: manuel_: reversing a list is really terrible, it requires iterating over everything

7:15 copies are way cheaper usually

7:15 especially since overallocation and sharding make copies rarer

7:16 Licenser: I wonder why there isn't a data structure that is like a reversed list

7:16 manuel_: sorry sharding and overallocation?

7:16 Licenser: overalloaction means that your vecotr keeps N empty cells at hand for further assignments

7:16 so you don't have to resize on any append

7:16 manuel_: Licenser: not really, it's just that (iterate (cons into a result list)) finally (reverse result) is a common idiom in lisp

7:17 Licenser: it's called a list i think

7:17 :}

7:17 there is hard work

7:17 oops

7:18 Licenser: but then why the need to reverse it :P I mean there could be a reverse-list that append to the back not the front

7:18 manuel_: doubly linked list

7:18 but that's not available in common lisp :)

7:19 anyway i'm staying with conj into a vector solution

7:19 i'm slowing going through the 4clojure problem set

7:19 before doing any actual work which will probably be more heads-on grinding

7:19 Licenser: heh

7:19 for 4clojure the vector is most likely the better aproach, it keeps your code shorter

7:23 manuel_: heh i'm not sure about the shortness, not trying to golf

7:41 gtrak`: the first load on heroku is kinda slow, is that just a jvm startup time issue or something I can speed up with AOT, etc.?

8:04 jondot: gtrak`, thats how long heroku takes to spin up your app.

8:04 if you really want to keep a free instance up - ping it. but thats not so ethical to my opinion.

8:09 i'm trying to upload my cookbooks for the first time to a shared opscode server, i took the opscode cookbooks and added mine

8:12 im getting this ERROR: Cookbook nodejs-support depends on cookbook nodejs::npm version >= 0.0.0

8:13 while this is my cookbooks https://github.com/jondot/cookbooks

8:13 this cookbook exist in the /nodejs cookbook

8:14 hmm i should have done 'include_recipe' instead perhaps..

8:15 ah nevermind, i had a mixup of terminology, it should depend on 'nodejs'

9:53 mrBliss: core.logic question: how can I refresh all lvars in an expression? One does not simply walk over a logic expression replacing lvars with fresh ones.

10:01 kephale: are there some conditions under which java hashmaps are faster than clojure hashmaps?

10:01 thheller: ibdknox: are you arround?

10:01 got a question related to jayq

10:03 just noticed that you released that yesterday and I basically went down the same route wanting to use jquery since I'm very familiar with it and basically know no closure (lib) at all

10:03 but in my test using jquery direclty breaks {:optimizations :advanced}

10:04 :none and :simple work fine :(

10:04 but now i'm not sure if its due to my unfamiliarty with cljs itself or if its just the nature of jquery

10:56 noidi: is there any reason to use `find` over `get`?

10:56 ,(doc find)

10:56 clojurebot: "([map key]); Returns the map entry for key, or nil if key not present."

10:56 noidi: ,(doc get)

10:56 clojurebot: "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."

10:57 noidi: ah, got it

10:57 find returns a MapEntry while get returns the value

11:03 dgrnbrg: If I use eval to make myself a function, will that function be as fast as if I'd compiled it normally? That is, is eval a tool for making high performance runtime code structures?

11:07 raek: dgrnbrg: yes.

11:07 dgrnbrg: raek: very cool :)

11:08 raek: dgrnbrg: do you mean something like this guy did? http://www.learningclojure.com/2010/09/clojure-faster-than-machine-code.html

11:11 dgrnbrg: raek: along those line, yes

11:12 I'm glad to see that I won't be trailblazing and that it does work

11:12 Although I don't see if he uses primitive type annotations to further increase the speed of his eval'ed code

11:26 powrtoc: is anyone here using clojurescript one?

11:27 I'd like to use it as a base of a new application, but it's not entirely clear about how you rip out the sample and replace it with your own

11:44 cran1988: incanter has a macro for easy calculation ($= 1 +1 ) ... will clojure 1.4.0 will have it in the core ?

11:47 TimMc: cran1988: What does that do?

11:48 cran1988: rather than typing (+ (- 1 1) 1) you just type ($= 1 - 1 + 1)

11:53 morphling: cran1988: infix math is unlikely to ever go into core

11:53 cran1988: why?

11:53 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

11:55 TimMc: cran1988: There's no point. You're using a lisp, prefix notation is a killer feature.

11:56 cran1988: TimMc prefix notation is killer notation for macro developers

11:57 TimMc: Look, if you use infix notation everywhere in your Clojure code, everyone is going to look at you funny.

11:57 manuel__: on the other hand writing math in prefix when you have all the formulas in infix is tiresome

11:57 and doesn't make for easy communication with the world

11:58 TimMc: manuel__: Oh, for formulas for a journal article? I guess that would make sense.

11:59 Also, you can totally use greek symbols directly in your code, if you don't mind pissing off people with poor UTF-8 support. :-)

11:59 manuel__: i remember i used a infix macro heavily when doing some CNC calculations

11:59 cran1988: i care only about infix notation in maths and it is boring all the time to call incanter.core for just a macro.

11:59 manuel__: because the prefix notation would just mess with my head over time

12:00 i use a reader macro, dunno if there is someting like that in clojure

12:01 TimMc: Nope.

12:01 morphling: manuel__: no. under the hood the reader is extensible, but the interface for doing so is not (yet) exposed

12:01 manuel__: ok

12:02 take sounds like an easy one for lazy languages

12:02 oops

12:05 ibdknox: thheller: my rationale talks a little about that. But in order to use jquery in advanced mode you just need to add the extern for it :)

12:23 jweiss: this surprised me - if you re-execute a def form that, say, sets variable x, all the fn's that refer to it also need to be re-evaluated, otherwise they still see the "old" x?

12:24 eg (def ^:dynamic x 1) (defn blah [n] (+ n x)) (blah 5) -> 6

12:24 (def ^:dynamic x 2) (blah 5) -> 6

12:24 i would have expected 7

12:25 TimMc: Might be different between 1.2 and 1.3.

12:25 jweiss: TimMc: i'm running 1.3

12:26 it's as if vars unique id's are not their names, i would have expected them to be

12:27 i guess it's not clear whether x should be closed over since it's dynamic. it does get closed over

12:27 TimMc: It is odd behavior.

12:28 I thought the defn would be recompiled.

12:28 cran1988: actually to me show 7

12:28 jweiss: cran1988: TimMc actually you're right, i oversimplified my example

12:28 hang on

12:29 cran1988: how clojurebot works here ?

12:30 jweiss: well now it is behaving like i would expect... let me fiddle more, may be case of not enough coffee

12:31 TimMc: ,(println "cran1988: Use a comma at the beginning of the line to run some Clojure.")

12:31 clojurebot: cran1988: Use a comma at the beginning of the line to run some Clojure.

12:32 TimMc: cran1988: If you want to just play around with it, you can /msg clojurebot and run stuff there.

12:32 cran1988: ,(def ^:dynamic x 1) (defn blah [n] (+ n x)) (blah 5)

12:32 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

12:32 cran1988: ,(def ^:dynamic x 1)

12:32 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

12:32 AimHere: ,(println "Extra clojure hacker bonus points for breaking the bot despite the sandboxing")

12:32 clojurebot: Extra clojure hacker bonus points for breaking the bot despite the sandboxing

12:32 TimMc: cran1988: And of course, def is excluded in the sandbox!

12:33 cran1988: pfff...

12:33 TimMc: AimHere: clojurebot is Easy mode, lazybot is Hard mode.

12:33 AimHere: I permanently run in noob mode, so I don't think I'll break either of them

12:36 cran1988: ,(eval (list + 1 1 ))

12:36 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

12:36 cran1988: ,'(eval )

12:36 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

12:36 TimMc: cran1988: Please try in /msg

12:36 cran1988: ok sorry

12:37 TimMc: cran1988: And don't worry too much about breaking the bot -- it gets restarted automatically every 10 minutes. :-)

12:38 ...which should give you a sense of how bad the security is on that one.

12:39 cran1988: :) hmm....

12:40 TimMc: lazybot is faster and much more robust, but it currently forbids the 'binding macro, so you'll have to use clojurebot to demonstrate anything that uses that.

12:44 cran1988: i am working on bypassing AccessControlException in clojurebot

12:49 TimMc: cran1988: The worst you can do is probably redefine things in Clojure -- hiredman has undoubtedly set up JVM sandboxing policies around the bot as well, which will prevent network connections and file access.

12:52 cran1988: pfff...

12:53 or I can use all of his RAM and CPU (for 10 min) ... yes i am evil

12:54 TimMc: There are timeouts. You might be able to bypass them...

12:54 I wouldn't be surprised. I've seen the bot take like 3 minutes to respond to a request at times.

12:55 cran1988: aarrgh! i saw it just now

12:56 great work ! China will make good use of it in Great Firewall ;)

13:11 rlb: Is there already a command that will let you run a subprocess with the stdout and/or stderr just connected to the console? i.e. (system "tar" "-tf" ...)

13:12 TimMc: There are several libs that let you shell out, and they have various options. Let me take a look...

13:13 rlb: Most of the ones I know of only return the full out/err after the command has finished.

13:13 But that won't help if you want to be able to see the command's progress.

13:14 (i.e. (:out (sh ...)))

13:14 TimMc: Check if http://clojuredocs.org/clojure_core/clojure.java.shell/sh does what you want by default.

13:14 Oops, no.

13:15 rlb: https://github.com/Raynes/conch

13:17 rlb: TimMc: thanks -- that looks like something I worked on a while back (but appears to be better).

13:26 cran1988: is there any library for networking ? like a wrapper or something like that ?

13:30 AimHere: clojure.java.io looks like it might do at least some things you're after; bundled with clojure itslf

13:32 TimMc: AimHere: Nah, it stores the results of stdout and stderr instead of passing them through.

13:32 cran1988: mumble mumble aleph lamina gloss mumble mumble

13:33 cran1988: Well, those are for binary protocols. You mean HTTP?

13:34 there are a bunch

13:34 AimHere: There's always slurp

13:34 TimMc: haha, yeah

13:34 AimHere: ,(slurp "http://www.goatse.cx")

13:34 cran1988: thanks ,no http, just for networking

13:35 TimMc: ^ NSFW

13:35 Just in case there is anyone here who is new to the internet.

13:35 AimHere: Yeah. Doesn't appear to be safe for bots either, given the lack of response

13:35 clojurebot: #<AccessControlException java.security.AccessControlException: access denied (java.net.SocketPermission www.goatse.cx:80 connect,resolve)>

13:35 TimMc: ,(+ 1 1) ; you awake?

13:35 clojurebot: 2

13:35 TimMc: AimHere: No, just slow.

13:36 Oh, and I think the site no longer has its famous image -- didn't it get sold?

13:36 *infamous

13:36 AimHere: I wouldn't know.

13:37 It's been some years since I was last tricked into gazing into the abyss that is goatse man

13:42 muhoo: awesome, slurp works on http too. didn't know what

13:42 that

13:43 help, i have work i have to do, but i can't stop playing with clojure

13:43 it's ruining my life.

13:43 AimHere: What do you need a life for, you have clojure?

13:43 muhoo: good point.

13:45 funny thing is, i'm still too retarded in clojure to actually do work in it. so i'm in this weird limbo state. work requires me to deal with php, js, and java, and i'm rejecting that on an immunological level now.

13:45 damn you clojure

13:45 oakwise: you should probably just write a clojure->php compiler

13:45 shouldn't be too hard right?

13:46 muhoo: not any harder than writing cljs, i guess. but that was/is a big project.

13:46 AimHere: It'd be easier the other way

13:47 Write a clojure interpreter in php

13:47 muhoo: again, a project on the scope of cljs. i don't think i'm quite ready for that.

13:48 but, it would be cool, true.

13:48 dhkl: muhoo: I feel your pain. Ruby/Rails guys here, but couldn't stop messing with clojure.

13:48 AimHere: Just write a teensy weensy lisp interpreter in it. When anyone asks, remind them of Greenspun's tenth law

13:48 Scriptor: well, there's close-to-clojure->php compilers out there

13:49 cran1988: muhoo: i had the same problem , now i am happy and unemployed

13:49 dhkl: cran1988: damn

13:49 muhoo: cran1988: that's inspirational and frightening at the same time.

13:49 Scriptor: muhoo: check out http://scriptor.github.com/pharen/ it's not quite clojure but borrows heavily from it

13:50 muhoo: Scriptor: wow, that's really neat, nice project.

13:50 dnolen: muhoo: CLJS is shockingly small :) only ~1200 lines of code for the actual compiler

13:50 Scriptor: thanks :)

13:52 cran1988: Scriptor : It is great tool !!

13:53 muhoo: wow, defmacro in php. that's kinky.

13:53 * muhoo clones

13:53 cran1988: i like the tail recursion in php

13:57 muhoo: hm, will hiccup work in it?

13:57 Scriptor: the tail recursion is useful for some things, but at least preliminary benchmarks showed that when traversing a lists containing less than 10,000 elements tail rec and regular rec are about the same

13:58 muhoo: hiccup?

13:59 muhoo: Scriptor: i see, you have html.php instaed

13:59 ,hiccup

13:59 Scriptor: oh, right clojure's hiccup

13:59 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hiccup in this context, compiling:(NO_SOURCE_PATH:0)>

13:59 Scriptor: yea, html.php isn't very useful, it's only there for a tutorial

13:59 cran1988: hmm... thanx Scriptor , but it now i am thinking for start-up

14:00 Scriptor: and it just uses functions, where's hiccup uses heavy macro work

14:00 muhoo: it's a very neat project. i can see areas to contribute to fill it out more like cljs, i.e. making it dynamically compile, putting in a repl like cljs has, some project management and dependency stuff (integrfation with lein?) etc

14:01 Scriptor: if you want to contribute that'd be great!

14:01 there's already a repl, but it's very clunky

14:01 muhoo: in my case i can't use it right now because the project i'm dealing with is wedded to yii framework

14:04 danieljames: Anyone know how to run -main from IntelliJ CE?

14:04 muhoo: if i have to start a new project that requires php, i'll at least try using pharen instead

14:05 Scriptor: thanks, I'll be in #pharen if you have questions

14:06 ibdknox: Scriptor: hiccup doesn't use macros at all?

14:06 I think it has one

14:06 muhoo: Scriptor: thank you for writing it. this may save me from insanity later on.

14:07 Scriptor: ibdknox: nono, I'm saying hiccup does, the html.php in pharen doesn't

14:07 ibdknox: sorry that wasn't very clear. Hiccup doesn't use macros at all

14:07 Scriptor: oh, interesting

14:07 ibdknox: it's all just functions

14:07 Scriptor: huh, I guess that makes sense actually

14:07 since it takes vectors anyway

14:08 ibdknox: yep

14:08 cjfrisz: Please excuse a noob question, but what dep should I add to my project.clj so I can use clojure.contrib.def?

14:09 danieljames: I can run things through the REPL but I can't even run a basic hello world application with a (defn -main function. Any ideas?

14:10 ibdknox: danieljames: do you have (:gen-class) in your ns decl with the -main function?

14:10 dnolen: cjfrisz: contrib is dead, you shouldn't use it

14:10 ibdknox: ~contrib

14:10 clojurebot: Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

14:10 danieljames: yes

14:10 ibdknox: cjfrisz: ^

14:11 danieljames: the example from clojure.org/compilation

14:12 ibdknox: danieljames: are you using leiningen?

14:12 or are you trying to compile and do it exactly how they show?

14:12 danieljames: IntelliJ with La-Clojure plugin

14:12 ibdknox: so how are you running it then?

14:13 cjfrisz: I know that def is in core.incubator, but what version should I be using?

14:14 ibdknox: cjfrisz: they're on github

14:14 danieljames: Using the run icon... probably not sure I understand what you mean

14:14 ibdknox: danieljames: then you probably need to call (-main)

14:15 the -main concept is specific to running a jar through java

14:15 danieljames: ok, what do I need to do to start the application through the run icon?

14:16 ibdknox: at the end of your file type (-main)

14:16 cjfrisz: So is the standard method to clone core.incubator off of github and build against that or is there a better, automated way to do it with leiningen/cake?

14:16 ibdknox: I assume. Not many people here use la-clojure, I think

14:16 so I'm not much help in regards to specifics there

14:16 danieljames: spot on

14:17 muhoo: one of my customers is developing a single-sign-on system. i heard someone wishing for everyauth for clj. if anyone is interested in an open-source clj/cljs wrapper for the sign-on system, that'd be a way i can get someone to pay me to write in clj, which would make me happy.

14:17 ibdknox: cjfrisz: it looks like 0.1.0 is on maven

14:17 cjfrisz: http://search.maven.org/#search%7Cga%7C1%7Ccore.incubator

14:18 cjfrisz: Ok, I've got 0.1.0, so maybe I'm actually having a different problem.

14:18 danieljames: I'm coming from c# with another jetbrains product and vs2010. I don't think I can cope with the conceptual overload of moving to emacs at the same time as learning clojure

14:18 oakwise: ibdknox: the pinot split is looking great! cheers on that work

14:18 ibdknox: danieljames: totally, I don't use emacs either :)

14:19 danieljames: also I used to the be PM for C# and VB in VS at Microsoft :)

14:19 oakwise: :)

14:19 cjfrisz: that version appears to be quite old, you might want to just use a checkout for it if you're using lein

14:21 danieljames: ok well so far I have tried Eclipse and counterclockwise, but I found it extremely slow. What's your recommendation?

14:21 cjfrisz: ibdknox: I'll give that a shot, thanks.

14:22 ibdknox: danieljames: whatever you feel most comfortable with. Like you said I don't think it's wise to try and learn too much at once. Clojure will be different enough. I personally use VIM, but that's because I have about 8 years of muscle memory for it.

14:22 danieljames: one thing I would suggest is using leiningen though

14:23 manuel__: i had a short peak at using la-clojure

14:23 peek

14:25 lucian: danieljames: emacs is good at editing lisp

14:27 danieljames: yes, I can see that it has the most functionality. I just can't put the graft in to learn it- I just want to play with clojure in the evenings and that has to be fun or I may as well do paying work 24/7!!

14:27 lucian: laclojure also looks nice, indeed

14:28 danieljames: I am impressed with the 'intellisense' feature in it

14:29 oakwise: ibdknox: what is the `fn? selector` case doing in `(def $...` in jayq?

14:29 vijaykiran: La-Clojure is fairly easy to work with so +1 for it. (I use emacs though).

14:30 TimMc: danieljames: Agreed, don't try to learn a new editor at the same time as a new language.

14:30 AimHere: How do people cope with language-specific IDEs then?

14:31 TimMc: *new high-powered text editor

14:31 *new editor paradigm

14:31 :-P

14:32 manuel__: so then is the opinion of a single individual

14:32 oops

14:32 la-clojure is ok, but it's no match to slime

14:33 though i use idea for java/php/javascript

14:33 vijaykiran: I use IDEA for Java

14:33 for other stuff - now I'm in emacs always. But for starters, who are coming from IDE world la-clojure is fairly quick to setup and start.

14:34 manuel__: yep

14:34 and you have a repl and can enjoy yourself

14:34 vijaykiran: :)

14:34 clojure console in la-clojure is fair enough - with completion etc.

14:35 manuel__: it doesn't show doc on typing though iirc

14:35 vijaykiran: in the editor it does

14:36 and also the usual goto "source" and paramter list work fine

14:36 so it is pretty decent

14:36 manuel__: yep

14:36 i was just a bit surprised by the repl thing

14:36 but apparently it causes some bug in idea

14:37 vijaykiran: hmm .. no idea. But the only thing that i couldn't figure out is compile stuff

14:37 I had to do (compile blah) everytime .. the default intellij compile doesn't work the way slime C-c C-k for me

14:38 gtrak`: is there any way to get heroku to not hang for 15 seconds on the first request?

14:39 vijaykiran: gtrak`: you need to pay for it I guess :-) or some program and keep pinging it

14:40 gtrak`: :-) they won't notice?

14:41 I was also considering a reverse jdbc, i wonder if anyone's tried something like that

14:41 vijaykiran: I hope so :) but you can't stop it from idling unless you have either good amount of traffic or keep pinging it to keep alive

14:41 gtrak`: in mother russia, database connects to you..

14:41 danieljames: I think I am spoiled by coming from Borland and Visual Studio where it is easy to type a bit of code and run it.

14:42 rlb: I'm sure I'm missing something obvious, but how do I pass ATOMIC_MOVE to Files/move? Using StandardCopyOption/ATOMIC_MOVE causes java.lang.ClassCastException: java.nio.file.StandardCopyOption cannot be cast to [Ljava.nio.file.CopyOption;

14:42 gtrak`: danieljames: it's much easier to type a bit of code and run it in clojure

14:42 rlb: (CopyOption is an interface)

14:44 vijaykiran: rlb: code ? (sorry if you have already posted it)

14:44 danieljames: gtrak`: I just meant I was spoiled by the IDEs, obviously clojure code itself is far easier to understand and get hacking with immediately than, say C or C++

14:44 TimMc: danieljames: Well, `lein repl` is a pretty damn fast way of getting to test out ode.

14:44 rlb: vijaykiran: (Files/move src-path dest-path StandardCopyOption/ATOMIC_MOVE)

14:44 TimMc: *code

14:45 rlb: What is Files?

14:45 rlb: given an import [java.nio.file Files StandardCopyOption]

14:45 TimMc: OK

14:45 gtrak`: yea... i mean, even with eclipse, in java, I'm like, I want to try out a snipped... have to start a new project, have to create a test-case, pain..

14:45 snippet*

14:45 TimMc: rlb: Is that some JDK 7 thing?

14:46 pandeiro: how can I debug a ClassNotFoundException? I'm using lein and I can the .class file there in lib/

14:46 rlb: yes: docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html

14:46 gtrak`: is there such a thing, where I can make a database connect to my web-app over http and register itself, with db calls sent over the live connection? :-)

14:46 TimMc: I only have JDK 6 here.

14:47 gtrak`: i suppose it wouldn't be too hard to make a wrapper server

14:47 TimMc: Wow, not at all a fan of Oracle's javadoc format for JDK 7

14:47 vijaykiran: yeah looks completely unreadable

14:47 rlb: TimMc: don't think it's an improvement either.

14:47 vijaykiran: don't have java7 here too..

14:48 TimMc: rlb: Oh, it's a varargs thing.

14:48 rlb: If it matters, I'm running Debian openjdk-7-jdk

14:48 TimMc: "[Ljava.nio.file.CopyOption;" means java.nio.file.CopyOption[]

14:48 vijaykiran: [L = Array of Longs .. I think

14:48 or just array

14:49 TimMc: &(class (to-array [(Object.)]))

14:49 lazybot: ⇒ [Ljava.lang.Object;

14:49 TimMc: Array of objects.

14:49 rlb: http://docs.oracle.com/javase/7/docs/api/java/nio/file/CopyOption.html

14:49 http://docs.oracle.com/javase/7/docs/api/java/nio/file/StandardCopyOption.html

14:49 if it helps

14:49 TimMc: rlb: No, see what I said above.

14:50 varargs are a Java illusion, they don't exist in the JVM itself.

14:50 rlb: Oh, wait -- should I be using $ to access the enum value?

14:50 TimMc: no

14:51 The signature (Path source, Path target, CopyOption... options) means you should write (Files/move src-path dest-path (to-array [StandardCopyOption/ATOMIC_MOVE]))

14:51 vijaykiran: I think you need to pass an Array instead of single enum value

14:51 what TimMC said :)

14:52 rlb: Oh, right, thanks -- I don't think I would have figured that out immediately -- didnt' realize that's how varargs should be handled.

14:53 TimMc: It's not obvious.

14:54 cjfrisz: It's taking me a stupidly long amount of time to figure out how I can use defvar

14:54 pandeiro: any help with debugging ClassNotFoundException for a dependency in lein?

14:54 vijaykiran: pandeiro: can you paste the stacktrace somwhere ?

14:55 cjfrisz: I have core.incubator jar in my libs directory, and I've got (:use [core.contrib.def :only [defvar]]) in my namespace declaration.

14:55 What am I doing wrong?

14:55 rlb: TimMc: fwiw, might need to be (into-array ...)

14:56 TimMc: Oh, depends on how types need to be handled.

14:56 rlb: Yeah, in this case I needed into-array.

14:57 TimMc: into-array can guess the type based on the first arg, right

14:57 rather, will use that type

14:57 pandeiro: vijaykiran: http://sprunge.us/FDgN

14:58 rlb: (Now I get to fight with nio/move -- don't know why it's throwing the exception it is...)

14:58 TimMc: pandeiro: Does `lein classpath` illuminate anything?

14:59 powrtoc: Is anyone here using clojurescript one?

14:59 TimMc: pandeiro: It's also pretty much impossible to help without knowing whether this is a javac issue, jar dependencies issue, etc.

14:59 vijaykiran: pandeiro: when exactly you get this erro ?

15:00 pandeiro: I get this in my repl whenever a pop-up comes up that is just a namespace not a real "class"

15:01 pandeiro: TimMc: lein classpath shows webbit in the classpath

15:01 vijaykiran: i get it when trying to import the class in SLIME, REPL, or as part of another namespace with :import

15:01 trptcolin: cjfrisz: are you on 1.3? seems like all the functionality from defvar is now part of def (though args are ordered differently)

15:02 pandeiro: powrtoc: i have been, yeah

15:02 powrtoc: pandeiro: I'm struggling to replace the sample application with a simple hello world in my own namespace

15:02 pandeiro: TimMc: not sure how i can tell if it's a javac, jar dep issue...

15:03 powrtoc: yeah there are a lot of interconnected parts

15:03 cjfrisz: trptcolin: In what namespace does def live?

15:03 TimMc: pandeiro: Well, is this something you brought in via :dependencies? Then it is a jar dependency.

15:03 cjfrisz: And yes, I am using 1.3

15:03 pandeiro: i actually wrote a script to change all the one.sample.* namespaces over to my own

15:03 TimMc: pandeiro: There are many different ways you can have a classpath problem.

15:03 pandeiro: TimMc: yes, via :dependencies

15:03 and lein fetched it fine

15:03 trptcolin: cjfrisz: it's a special form, always available

15:03 vijaykiran: cjfrisz: def is a special form

15:03 TimMc: OK, so you're probably not using the right package/namespace to import/require it.

15:04 pandeiro: it's there and when i open up the jar in emacs, I can see a .class file with the name of the class I want to import...

15:04 TimMc: how do I determine the proper name?

15:04 vijaykiran: pandeiro: not sure, since I get this error when I'm typing namespaces .. I'd like to know how to fix it too..

15:04 TimMc: API documentation.

15:05 rlb: TimMc: is this likely to be the way varargs are handled long-term?

15:06 TimMc: rlb: No idea.

15:06 rlb: (if you know -- it's a little wordy when you don't have any options)

15:06 TimMc: I don't think the JVM gives us much choice.

15:07 rlb: Not a big deal anyway -- you can always define an empty array somewhere and just use that.

15:07 TimMc: rlb: As long as it is the right type. :-/

15:07 pandeiro: What path did you follow in the jar file to get to the .class file? That's the package.

15:08 rlb: TimMc: right, just meant as a shorthand (let [no-lopts (into-array java.nio.file.LinkOption [])] ...)

15:10 pandeiro: TimMc: org/webbitserver/WebServers.class

15:11 huh... maybe just a syntax issue? did import syntax change from 1.2 to 1.3?

15:15 trptcolin: pandeiro: no, pretty sure it didn't. what's the import statement you're using?

15:18 pandeiro: gah... so i guess the webbit project changed the name from webbit to org.webbitserver

15:18 vijaykiran: pandeiro: (:import [org.webbitserver WebServer WebServers WebSocketHandler]

15:18 pandeiro: trptcolin: i think that will fix it, sorry... my import was fine

15:18 vijaykiran: [org.webbitserver.handler StaticFileHandler]))

15:18 trptcolin: cool

15:18 pandeiro: vijaykiran: thanks, yeah that's it

15:18 vijaykiran: I just created a project .. and that works :)

15:18 pandeiro: i am such a java ignoramus

15:20 vijaykiran: pandeiro: http://blog.jayfields.com/2011/02/clojure-web-socket-introduction.html

15:20 see the comment there

15:20 pandeiro: vijaykiran: yep i just saw that comment too :)

15:21 so i can just assume since the path to the .class file is org/webbitserver/WebServers.class, the package name is org.webbitserver

15:21 that will always hold true for java libs?

15:21 vijaykiran: yes

15:22 it is actually the otherway round - if your class name is com.blah.super.awesome.Amazing.class then it must be in com/blah/super/awesome/Amazing.java

15:23 muhoo: or in a jar inside com/blah/super/awesome/Amazing.class , right?

15:23 vijaykiran: yeah inside a jar

15:25 dgrnbrg: if I have a function f that takes an unknown # of args, and I want to do (apply f some-list), where some-list could be longer or shorter than the number of args that f takes, how can I do this?

15:26 muhoo: when would you be calling a function without knowing what args it wants?

15:27 dgrnbrg: muhoo, I have a function (defn tuplefn [f i] (fn [tuple] (assoc tuple i (apply f tuple))))

15:27 which I use to map over seqs of tuples

15:28 where I want to only modify 1 element of the tuple, but the modification could take any # of args

15:28 and I want to use anonymous functions to write the modifiers

15:28 so sometimes the anonymous functions only care about a prefix of the arguments

15:28 and then the code doesn't work

15:29 rlb: Hmm, didn't realize that finally clauses don't fire in the case of a C-c.

15:29 dgrnbrg: unless I do something dumb like: #(do %5 (f %2)) to ensure 5 argument forms

15:29 rlb: So I can't really use them to implement with-temp-file as I'd hoped...

15:29 muhoo: or varargs

15:30 vijaykiran: rlb: because System.exit doesn't fire finally .. ?

15:30 rlb: vijaykiran: don't know -- I haven't investigated what actually happens on a C-c yet.

15:32 vijaykiran: rlb: I'd guess C-c is Sys.exit. But not sure why you want to have C-c based code :)

15:33 rlb: might need a sigint (and sigterm) override

15:34 vijaykiran: pretty much mandatory for some useful command line tools.

15:34 vijaykiran: rlb: oh okay.

15:34 rlb: and *any* program should make sure it doesn't DTWT on SIGINT/SIGTERM

15:38 AimHere: dgrnbrg, if you want a dumb, horrible way of getting what you want, you could use the 'partial' function to take a function of one arg, then repeatedly partial and feed single args to it until it's happy

15:39 vijaykiran: rlb: -Xrs option seem to be related to what you want

15:40 dgrnbrg: AimHere: is there a way to do it with iterate/takewhile to play nicely w/ apply?

15:40 And I thought there was a way to query a function for its arity

15:40 AimHere: dgrnbrg, there possibly is. In fact, if you check out the source code to partial, it probably is in there

15:40 Because otherwise how could it be implemented?

15:41 rlb: (Though I suppose whether or not a program should interrupt shutdown long enough to clean up (possibly large) temp files is not necessarily obvious...)

15:41 dgrnbrg: AimHere: it's implemented by apply's use of fixed and varargs portions

15:41 returning a function that fixes one arg at a time

15:41 I could do it w/ an exception handler too

15:41 to catch when I overflow the args

15:41 but that kinda sucks...

15:42 vijaykiran: rlb: I think it can be done during startup ..

15:42 AimHere: Well there's the part of the exception handler that complains that you've got the wrong number of args

15:42 Could easily be written in Java, though

15:43 rlb: vijaykiran: thanks -- wrt -Xrs. Though I think if I do decide I want "guaranteed" temp cleanup in this app, I might just want a shutdown hook.

15:43 vijaykiran: rlb: np

15:50 dgrnbrg: I've decided to ignore it

15:50 and refactor other things

15:50 I have some gloriously complex macros that could be untangled

16:13 danieljames: Does anyone know how to load the project under the ide into the repl under intelliJ?

16:15 vijaykiran: you just need to start Clojure Console

16:15 danieljames: shameless plug but checkout the blogpost I wrote - http://vk.cx/zfrt7A

16:16 danieljames: I used IntelliJ

16:16 danieljames: hmm that link doesn't work for me

16:16 vijaykiran: http://www.vijaykiran.com/2012/01/11/web-application-development-with-clojure-part-1/

16:18 danieljames: thanks. I think I have done everything correctly, but at the point of the use, it fails to locate 'frob__init.class'

16:18 I did find that blog post earlier actually!

16:18 vijaykiran: can you check the classpath that is printed in the console ?

16:18 danieljames: clojure.lang.RT.load

16:18 (RT.java:430)

16:19 vijaykiran: it shoule be really long :)

16:19 danieljames: Could not locate frob__init.class or frob.clj on classpath: clojure.lang.RT.load (RT.java:430)

16:19 vijaykiran: I meant when you start the repl/console it will printout the complete path.

16:20 danieljames: yes I see that, what should it contain- it does contain a load of java paths

16:21 at the end it has clojure.jar and something that looks like my project directory- but it's not obvious to me how it actually ties up

16:21 vijaykiran: yeah .. it should have your project dir and the libs ..

16:21 you used leiningen to create the project .. right ?

16:22 danieljames: nope

16:22 instant fail?

16:22 vijaykiran: :) I suggest use leiningen .. less painful

16:22 and easy to setup classpaths etc..

16:23 danieljames: I shall go back and follow your wise instruction, I had assumed that the La Clojure plug in would be enough!!

16:23 vijaykiran: La Clojure is just for editing/repl starting

16:23 lein is the one that sets up the project.

16:34 cjfrisz: So I notice that if I have a backquoted list containing "fn," then it gets resolved to clojure.core/fn in the output

16:34 And I understand why this is based on the Reader documentation

16:34 It's not really a problem, but is there anyway to just get "fn" to show up in the list?

16:37 morphling: ,`(~'fn)

16:37 clojurebot: (fn)

16:38 cjfrisz: Oh nice, thank you.

16:38 Should have thought of that.

16:39 morphling: np

16:42 danieljames: vijaykiran: REPL main class, clojure.main - is that right?

16:54 has anyone other than Vijay managed to get IntelliJ to work with the REPL? I still can't get it to work, and it seems un-googleable.

16:55 I'm starting to think that as a beginner I am wasting my time with the IDEs and should just suck it up and use a regular editor and copy and paste code to a separate REPL

16:58 vijaykiran: I managed to create the project with lein and open the project, and the REPL launches, but now I can't actually compile the code because of 'clojure classes are not attached to module'

16:59 vijaykiran: danieljames: did you execute lein deps ?

16:59 danieljames: yes, it downloaded successfully

17:00 vijaykiran: ok, can you check if the lib folder is listed under module dependencies ?

17:01 danieljames: i see 1.6 (java version "1.6.0_29" and under that <Module source>

17:01 the-kenny: Setting up a nice IDE is the single biggest step in learning a LISP.

17:02 brehaut: the-kenny: the simple answer is to not let setting up a nice IDE get in the road of learning then ;)

17:02 * brehaut learnt clojure with textmate

17:02 the-kenny: yup, but that's hard

17:02 brehaut: Some years ago when I wanted to learn Common LISP, I was a die-hard Vim user.

17:02 vijaykiran: you ned to have the lib folder as well ..

17:02 mac or windows ?

17:03 or linux :) ?

17:03 the-kenny: vijaykiran: me?

17:03 vijaykiran: oops .. sorry no, danieljames

17:03 the-kenny: no problem

17:03 danieljames: vijaykiran: Sorry, which lib folder? OS X. Also I just noticed the REPL is at 1.2.0 now :-(

17:04 vijaykiran: danieljames: you are almost there .. :) Command + ; and open module settings

17:04 danieljames: should look like this http://cl.ly/092Z2I303P0F2X2c0m0F

17:05 danieljames: ok, added

17:06 vijaykiran: danieljames: nice. Now just Cmd Shift F10

17:06 brehaut: the-kenny: i dont know much about common lisp other than dabbling with it about 10 years ago, but clojure is quite managable with a bare minimum text editor setup + a non-connected repl

17:06 danieljames: ok that worked, but unable to resolve defproject ...!!!

17:07 vijaykiran: danieljames: Make sure you are not running the current file .. just open the console

17:07 * vijaykiran thinks "I should make a quick screencast - that should be helpful right"

17:08 danieljames: All my problems are stemming from my inability to follow extremely clear and simple instructions..

17:08 ok that is working, and now I am at Clojure 1.3.0

17:08 vijaykiran: danieljames: terrific. Hack away then :)

17:08 danieljames: whoa cowboy..

17:08 vijaykiran: danieljames: you can type (use 'whateveryourproject.core)

17:09 danieljames: meh, same as before 'could not locate dango__init.class' or dango.clj on classpath

17:09 vijaykiran: danieljames: hmm interesting

17:10 danieljames: interesting, as the 'intellisense' is actually picking up my project name

17:10 vijaykiran: danieljames: what did you type exactly ?

17:10 danieljames: (use 'dango)

17:10 vijaykiran: danieljames: I think it would be (use 'dango.core)

17:10 danieljames: if you used leiningen

17:11 danieljames: unless you renamed the namespace in src/dango/core.clj

17:11 danieljames: ...nil

17:11 vijaykiran: danieljames: that's it :)

17:12 danieljames: and my functions will go into dango:xxx?

17:13 vijaykiran: yes. for starters.

17:14 danieljames: Ok this has been a great help, I still can't call a function but it looks like everything is set up

17:14 vijaykiran: you IDE part is done. Now you can just focus on clojure awesomeness

17:18 danieljames: still can't call a function. I notice in your example, you are not having to qualify your 'start' with a namespace when you call it. I am having the ide pick up my 'hello' function, but only when qualified, and even then when I execute it I get 'unable to resolve symbol'

17:19 vijaykiran: first you need to (use 'dango.core)

17:19 danieljames: yep

17:19 vijaykiran: which will bring your functions to repl

17:19 then you can call the functions without a prefix

17:19 danieljames: same error

17:20 "unable to resolve symbol: hello in this context"

17:20 vijaykiran: did you add function after starting repl ?

17:21 danieljames: also, I am a little confused, since if I type garbage into core.clj, I can't see where it is picked up, since I can still do (use 'dango.core) and it returns nil

17:21 even with something that cannot possibly compile

17:21 vijaykiran: yeah, that's the limitation rightnow with IntelliJ

17:21 when you "compile" using IDE that classes aren't picked up by repl

17:22 I couldn't figure out why .. but there's a work around

17:22 (compile 'dango.core)

17:22 danieljames: compile that's not working anyway, "unable to resolve symbol: defproject"

17:22 ok I'll try that- seems painless

17:23 that seems to do exactly what I'd expect

17:24 Raynes: Uh

17:24 (use 'dango.core :reload)

17:24 You don't want to call compile.

17:26 vijaykiran: danieljames: ^^ this is better

17:26 danieljames: ok

17:26 that seems good

17:27 soon I am sure I will see user=> (hello) followed by Hello World!

17:27 YES!

17:27 vijaykiran: yay!

17:28 danieljames: exciting times

17:29 vijaykiran: thanks

17:29 vijaykiran: danieljames: np, enjoy hacking

17:45 amalloy: rlb: hava.io.File has .deleteOnExit

18:48 cjfrisz: Semi-random question: Is there a way for a Clojure namespace to export a subset of the symbols that it defines?

18:48 Something like a Scheme library?

18:49 (by the way, I'm a long-time Scheme programmer who wrote his first Clojure code yesterday)

18:50 dnolen: cjfrisz: not possible. Side note: I <3 Scheme, particularly after read Dan Friedman's work.

18:51 reading

18:52 cjfrisz: dnolen: Funny you should say that, because I'm actually messing with Clojure thanks to Dan Friedman

18:52 He and Will Byrd have been glowing since they got back from Clojure/Conj

18:53 dnolen: cjfrisz: yeah I work on core.logic, I helped sneak them into Clojure/Conj ;)

18:57 cjfrisz: dnolen: I've been messing with core.match and I have to say it's quite nice.

18:57 Well done, sir

18:59 dnolen: cjfrisz: thanks, it's actually in need of some serious attention but the basics work.

19:00 amalloy: dnolen, cjfrisz: it's that just a namespace with some ^:private definitions?

19:00 *isn't

19:01 cjfrisz: dnolen: I haven't read all the literature attached to it, but have you seen the Scheme pattern matcher that Dan Friedman, Erik Hilsdale, and Kent Dybvig wrote?

19:02 I use it for a lot of stuff and it's pretty featureful.

19:02 I'm mostly impressed with core.match because it reflects most of the functionality I get with Scheme match.

19:02 dnolen: cjfrisz: Dan showed it to me, but I haven't looked at it closely enough

19:02 cjfrisz: Ahh

19:02 It is indeed a pretty dense set of macros.

19:04 dnolen: cjfrisz: yeah, for that kind of thing I definitely appreciate Clojure's approach to macros.

19:05 cjfrisz: core.match mostly taken from a OCaml paper, and some examinations of Racket's match

19:07 cjfrisz: dnolen: Ahh...I'm very much a Chez Schemer, so I'm not familiar with Racket's match.

19:07 Though I met a lot of the Racket team a couple weeks ago and they seem like a good group of people.

19:10 dnolen: cjfrisz: Chez Scheme seems quite cool, I've only played around with Petite

19:11 cjfrisz: dnolen: I got to take my undergrad compilers class with Kent Dybvig, so I've got a lot of Chez Scheme love.

19:12 dnolen: cjfrisz: that's amazing! Seems like there's some incredible knowledge trapped away in the Chez Scheme implementation.

19:15 cjfrisz: dnolen: I've been hanging out with Kent's PhD student lately, and there's nothing much more fun than talking about how Chez Scheme works.

20:11 dgrnbrg: Does clojure have a bit set?

20:12 amalloy: i would say it has millions of bits set

20:18 dnolen: dgrnbrg: http://docs.oracle.com/javase/1.4.2/docs/api/java/util/BitSet.html

20:19 dgrnbrg: dnolen: that one's not functional

20:19 amalloy: java's bitset is sorta trash, though

20:19 dgrnbrg: you can def. make a purely functional bit set by packing arrays of bits at nodes

20:53 lynaghk: Has anyone sucessfully packaged up non-ClojureScript-generated JS in a JAR and used it from another project?

20:54 I'm looking at ibdknox's pinot's usage of goog-jar (containing Closure Library JS), but I can't figure out why it's working.

21:29 emezeske: lynaghk: Yes, I have.

21:30 lynaghk: https://github.com/lynaghk/cassowary-coffee/tree/cljs-jar

21:30 This is what I've got sofar, I'm not exactly sure what's going wrong--two issues.

21:31 emezeske: lynaghk: I think you might want to look at leiningen's :resource-path

21:31 lynaghk: First question, is passing a vector to :libs argument of the clojurescript compiler the only way to get it to notice things? I think not, since Pinot just threw goog-jar on the classpath and everything seems to come out of the goog.provides there fine

21:31 for getting JS into the JAR, or making it available on the classpath for a dependent library?

21:32 emezeske: lynaghk: For getting the JS into the JAR.

21:32 Then, I think the dependent library will see it in the classpath without anything special

21:32 lynaghk: I got it into the jar fine with :compile-path "out/js"

21:32 the dependent library is not seeing it. I think the issue could be that I'm using js/ClassName

21:33 emezeske: Regarding the :libs thing, I'm unfortunately not very knowledgable about that :/

21:33 lynaghk: but even if I throw a (:require [ClassName :as cn]) into the namespace, they don't seem to be getting pulled in.

21:34 * emezeske can't help. :(

21:35 lynaghk: emezeske: thanks anyway

21:36 emezeske: NP, good luck!

21:36 codeforkjeff: is there a way to tell what libraries you've pulled into the current ns?

21:37 emezeske: codeforkjeff: Maybe someone on this page will help? http://clojure.org/namespaces

21:37 ns-map or something?

21:38 ,(ns-map *ns*)

21:38 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, unchecked-inc-int #'clojure.core/unchecked-inc-int, ...}

21:39 codeforkjeff: exactly what i was looking for, thanks!

21:39 emezeske: NP.

21:42 oakwise: has anyone got remotes in the split out "fetch" library from pinot working? something seems to be going weird when I try and call remotes from cljs

21:42 emezeske: oakwise: I am working on that right now

21:42 There was a problem last night that ibdknox fixed this morning

21:42 Updated recently?

21:43 oakwise: emezeske: I saw that. Doesn't seem to be related.

21:44 emezeske: I'm trying to just have a simple single-arg `defremote` that `str`s its arg. When I load up a clj repl and use `call-remote`, I have no problem. But when I try and call it from cljs with e.g. `6`, I get: java.lang.NumberFormatException: Invalid number: 6=null&

21:44 seems to be the way the post request is getting formatted

21:44 have you had success?

21:44 emezeske: oakwise: Hmm, I almost have my code finished, I will relate my success/failure in a bit

21:45 oakwise: thanks!

21:45 ibdknox: oakwise: emezeske: it's entirely possible I broke it, I'll take a look shortly

21:46 emezeske: ibdknox: thanks.

21:46 oakwise: ibdknox: cool thanks. It's also entirely possible I'm missing something obvious :)

22:08 emezeske: oakwise: Okay, I got my thingie working, and I am seeing a similar error: Invalid number: 0=null&3=null& - (class java.lang.NumberFormatException)

22:08 oakwise: emezeske: great, it's not just me then :)

22:09 emezeske: ibdknox: The body of my /pinotremotecall POST request is as follows: 0=null&3=null&%7B=null&%3A=null&r=null&e=null&m=null&o=null&t=null&%20=null&%22=null&c=null&u=null&d=null&-=null&a=null&%2C=null&p=null&s=null&%5B=null&n=null&%5C=null&F=null&f=null&%7D=null&%5D=null

22:11 ibdknox: Maybe a probleml with fetch.core/->data ?

22:14 ibdknox: I think I tracked down the bug

22:14 ibdknox: emezeske: what'd you find?

22:14 emezeske: ibdknox: I don't think fetch.remotes/remote-callback should call pr-str

22:15 ibdknox: I think it should pass the map through, as ->data will eventually map->js it

22:15 ibdknox: that sounds right

22:16 I translated that back from using the jquery stuff

22:17 so that it wouldn't have that dependency and messed it up. Remotes are like the only thing I'm not currently using heh

22:18 emezeske: ^_^

22:34 ibdknox: okidoke

22:34 got it all working again

22:34 will push in a sec

22:35 oakwise: hurray

22:35 ibdknox: emezeske: oakwise: ^

22:35 oakwise: ibdknox: much obliged

22:35 dgrnbrg: Is there a total order on keywords?

22:35 that is, is there a unique ordering for every set of keywords

22:36 ibdknox: oakwise: emezeske: pushed

22:36 lynaghk: ibdknox, do you know if there is anything special about the Closure library JS that lets it work with your goog-jar dependency where other JS wouldn't? I'm fighting to package up some non-ClojureScript generated JS

22:36 ibdknox: ,(sort :b :d :c :a)

22:36 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core$sort>

22:36 ibdknox: ,(sort [:b :d :c :a])

22:36 clojurebot: (:a :b :c :d)

22:37 ibdknox: dgrnbrg: they're sorted like strings, unless I'm not understanding your question

22:37 lynaghk: I added the 3rd party stuff to deps.js

22:37 offbytwo: Try (sort [:b :d :c :a])

22:37 dgrnbrg: ibdknox: I mean if I use a sorted-set of keywords, will a seq on that set always be =?

22:38 emezeske: ibdknox: You da man!

22:38 dgrnbrg: are all keywords interned?

22:38 ibdknox: yes they are

22:39 dgrnbrg: ,(class #{})

22:39 clojurebot: clojure.lang.PersistentHashSet

22:39 ibdknox: why seq before comparing?

22:39 dgrnbrg: so, i'm serializing sets

22:39 lynaghk: ibdknox: there is something special about deps.js? My understanding is that if you throw JS into a JAR that's on the classpath, ClojureScript should be able to pick it up

22:40 ibdknox: lynaghk: that has not been my experiene

22:40 experience*

22:40 but that was a long time ago

22:40 lynaghk: hmm

22:40 dgrnbrg: the set has a bunch of keywords, and the keywords each need to corresponding to specific indices, like an enum

22:41 lynaghk: I'm not sure if that's my experience now either. I'll try throwing in a JS with explicit requires of everything and see if it helps

22:41 thanks for the pointer

22:42 ibdknox: lynaghk: good luck man. That crap was a mess... it took me forever to figure it out and I still don't really know why it worked heh

22:42 lynaghk: yeah, that's how I'm feeling right now

22:43 But I can't in good concience release a library to the community that requires you install node.js and then use my coffeescript fork to compile

22:44 ibdknox: lynaghk: the change to find libs and externs on the classpath was really recent

22:44 lynaghk: That would be terrible, just terrible. Also, everytime you git submodule Leiningen cries a little.

22:44 ibdknox: got an up-to-date cljs?

22:45 lynaghk: feb 3

22:45 ibdknox: hm

22:46 clj_newb: is there a better way to create a 2D array of mxn elements, instead of a vector of m elements, where each element is a vector of n elements?

22:46 lynaghk: I wonder if Closure or ClojureScript is assuming one goog.provides per JS file

22:46 I'm pretty sure Closure doesn't care about that.

22:47 ibdknox: ah

22:47 that would be a reasonable assumption

22:47 I think that deps.js is how you get around it

22:47 lynaghk: clj_newb: depends on the use case. If you're doing sparse linear algebra there are some benefits in other data structures

22:48 emezeske: ibdknox: Cool, the latest fetch is working for me!

22:48 ibdknox: emezeske: awesome :)

22:49 clj_newb: is there a better way to create a 2D array of mxn elements, instead of a vector of m elements, where each element is a vector of n elements? I'm storing objects, not numbers -- i.e. think a large virtual world divided into tiles

22:49 emezeske: clj_newb: Depends on what you mean by better :)

22:50 clj_newb: efficient?

22:50 hmm; soudns like i'm in the realm of premature optimization

22:50 s/efficient/idiomatic/

22:51 emezeske: clj_newb: vector of vectors seems right to me. for efficiency, you could always do a single vector with m*n elements, indexed by (x * n + y)

22:51 * emezeske is not sure if a single vector really is more efficient.

22:52 ibdknox: in general it depends on the operations you'll want to do on it

22:52 clj_newb: it's create once, read many many times

22:52 ibdknox: linearly?

22:52 err, sequentially is a better question

22:55 clj_newb: okay; i am now convinced of what the right thing to do is

22:55 thanks everyone :-)

22:55 seancorfield: is the findfn thing in the bot available separately (or is it a matter of taking it out of the source of the bot)?

22:56 (and which bot is it part of?)

22:56 ibdknox: seancorfield: https://github.com/Raynes/findfn

22:57 seancorfield: thanx!

23:12 lynaghk: ibdknox, whoooa apparently has something to do with goog.scope()

23:12 ClojureScript for some reason really needs it, even though the same codebase works fine with Closure.

23:12 graphbum: during java interop in clojure, how does one access elements nested inside of interfaces? there are some enumerated types I need access to, but I can't seem to specify them using import.

23:12 ibdknox: lynaghk: lol I don't even know what that is

23:14 lynaghk: *shrug*

23:14 onto the next error now. I'll write something up if I ever figure out what is going on.

23:15 ibdknox: please do :)

23:19 arohner: graphbum: inner classes are named foo$bar

23:19 graphbum: and for simplicity, try referring to the absolute name first, com.foo$bar

23:22 graphbum: arohner: thanks. I'll rub my brain on that and see if I can get at the JUNG libraries.

23:23 dnolen: ibdknox: lynaghk: fwiw, I'm paying attention :)

23:23 lynaghk: oh, hey David

23:24 All of this is for cassowary-coffee

23:24 I've been trying to release it as a JAR for the past few hours. It's, um, taking longer than I thought

23:24 ibdknox: heh

23:25 lynaghk: If you want to play along:

23:25 https://github.com/lynaghk/cassowary-coffee/tree/cljs-jar

23:25 https://github.com/lynaghk/profile-cljs

23:25 dnolen: lynaghk: I haven't messed much w/ packaging external JS stuff, so any insights on how to make it better - I'm listening.

23:25 graphbum: arohner: working, I was using the name from import, not the absolute name. going with the absolute name looks like the ticket. thanks.

23:25 lynaghk: I'm trying to suck the former into the latter.

23:25 Well, I think Chris must have figured it out once, because that's how I got the idea. Pinot depends on goog-jar

23:26 which is all of Closure's JavaScript packaged up in a JAR. In his CLJS source, it's just (:require [goog.dom :as dom]) as usual

23:26 arohner: graphbum: I'm pretty sure it's possible to import the inner name, but I don't remember how. try importing foo, then referring to foo$bar

23:26 lynaghk: so I thought I'd be able to do the same thing.

23:26 ibdknox: lynaghk: important distinction, my goog-jar completely replaces the closure library though

23:27 lynaghk: Right now the issue seems to be that ClojureScript is not calculating dependencies properly---I have to list every JS file in the JAR in the :libs [ ] option to cljs compiler and things are only working with :whitespace optimizations

23:28 ibdknox, I didn't consider that. My understanding / hope is that you can just shove tons of JS at Closure, and as long as everything has the appropriate goog.provides it'll figure out dependency ordering, &c.

23:29 ibdknox: I do remember that the only way I got it to work was through declaring all of the 3rd party libs in deps.js

23:29 lynaghk: That's how I'm using closure on the command line, so my guess is that clojurescript is interfacing with it differently

23:29 what 3rd party libs did you add? I took a look at it and everything seemed to be in the Closure library already

23:29 dnolen: lynaghk: yuck

23:30 lynaghk: you're territory that I'm not familiar with, but it sounds like it shouldn't require so much trouble

23:31 lynaghk: all yak shaving problems do = )

23:31 but yeah, I'm surprised considering that all of the JS works fine with Closure already.

23:33 dnolen: lynaghk: it would be super helpful to see a doc on the various aspects of the issue.

23:33 lynaghk: writeup what exactly I'm trying to do and what is/isn't working, you mean?

23:33 dnolen: lynaghk: CLJS dev should be as simple as CLJ dev as far as deps

23:33 lynaghk: yes

23:34 lynaghk: yeah, I'll work on that tomorrow

23:34 dnolen: lynaghk: awesome, thx

23:34 lynaghk: Probably cut back and put together a minimal-example repo

23:34 thank you

23:35 I need to sit back and figure all of this CLJS tooling stuff out though; we've been hacking everything together with submodules thus far, but we're doing enough stuff that it's getting gnarly

23:36 expect something from me by Tuesday afternoon. For now I'm going to grab some dinner

23:36 thanks for your help too Chris

23:36 dnolen: lynaghk: that doesn't sound like fun. Sooner this stuff is ironed out the better.

23:37 lynaghk: dnolen, yeah that's why I've been punting on it---hoping that maybe LukeVanderHart would write blog post #2 documenting everything else =)

23:42 dnolen: lynaghk: I have a feeling you're digging into scalable CLJS dev more than most folks :)

Logging service provided by n01se.net