#clojure logs

2012-02-05

00:00clj_newbis there any weird situation where {} auto converts to nil
00:05tomoj&(seq {})
00:05lazybot⇒ nil
00:06ibdknoxfor those wondering about my rationale for wrapping jquery: https://github.com/ibdknox/jayq
00:44amalloy&((constantly nil) {}) ;; this too! "auto converts" doesn't mean much :P
00:44lazybot⇒ nil
00:44lnostdal_it's just impossible to communicate things on clojure-dev .. before 1.4 could we please fix defonce? .. it is not thread safe
00:44lnostdal_and hi btw.
00:48amalloymost 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)
00:49clj_newbI 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, ...
00:50RaynesI highly doubt you want to split up a single namepace.
00:50RaynesYou want to split a single namespace into multiple namespaces.
00:50clj_newbno no, I have a giant namespace of all editor commands
00:50clj_newbthat I may key binings to
00:50clj_newbmostly, I have namespaces with 20-30 definitions; but in this particular case, I really want one gigantic namespace
00:53lnostdal_ok ..
00:54lnostdal_..and i guess if each of the def-things had a lock things might deadlock etc.
00:54lnostdal_why is it even possible to use def at a non top-level location then
00:54lnostdal_i mean if it's a "bad idea"
00:55amalloy(if (slime-detected) (def slime-connection (create-slime-connection))) ;; for example
00:56lnostdal_perhaps all the def and compiler stuff should be handled by an agent or something
00:56amalloy(let [x (compute expensive compile-time constant)] (defn foo [bar] (+ bar x))) ;; more common
00:57ibdknoxand other macro-y goodness
00:58amalloyi 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
00:59amalloyit only really gets used for "don't reset this when i reload the file in the repl"
00:59lnostdal_i'm using it to spawn a thread via a call to future .. but only on the first invocation of some function
00:59amalloy*shrug* so use a delay and force it
01:00ibdknoxdelays are one of those things no one really talks about
01:00ibdknoxlol
01:01amalloy&(let [a (atom 0), action (delay (swap! a inc)), f #(force a)], [(f) (f) (f)])
01:01lazybot⇒ [#<Atom@136b5df: 0> #<Atom@136b5df: 0> #<Atom@136b5df: 0>]
01:01amalloy&(let [a (atom 0), action (delay (swap! a inc)), f #(force action)], [(f) (f) (f)])
01:01lazybot⇒ [1 1 1]
01:01ibdknoxwhich is generally a good thing, since you shouldn't use them often, but they have some handy uses
01:01amalloydelays 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
01:02lnostdal_so delay the future .. x)
01:02amalloyindeed
01:02ibdknoxlike?
01:02ibdknox(not disagreeing, just curious)
01:03amalloy(cond (and (cheap-test1) (expensive-test)) thing1, (or (cheap-test2) (expensive-test)) thing2, :else (expensive-test))
01:04ibdknoxyeah, I guess I would normally let such a thing
01:04amalloybut you might never need its value at all
01:04amalloyif test1 is false, and test2 is true
01:04ibdknoxyeah
01:05amalloyi 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)
01:05amalloy*wrote
01:05ibdknoxrefheap?
01:06amalloyimpl: 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
01:07ibdknoxthat's really nice
01:07amalloythe 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
01:08ibdknoxI need to learn more about symbol-macrolet
01:08ibdknoxhadn't really seen it
01:08amalloyegamble (clojure dabbler in my area) folded it into his let-else at https://github.com/egamble/let-else
01:10ibdknoxhuh, interesting
01:10amalloyibdknox: the good news is, there's nothing left to learn about symbol-macrolet - you just learned it all
01:10ibdknoxlol
01:11ibdknoxI wanted to do something similar with keywords a while back
01:11amalloyyou mean, keywords as let "bindings"?
01:11ibdknoxsort of
01:12ibdknoxit was for korma over objects
01:12ibdknoxjust a sec
01:12ibdknoxhttps://refheap.com/paste/630
01:12ibdknoxI want to be able to use :t to mean (:t some-obj)
01:13ibdknoxthen I could do (> :t 2)
01:13amalloyi see
01:13ibdknoxRaynes: I dunno, that koolaid *was* pretty tasty...
01:14Raynesibdknox: Did you paste that with refheap.vim?
01:14ibdknoxyep
01:14ibdknoxthat vim plugin is why I use it
01:14ibdknoxlol
01:14amalloyit's pretty tough to have :t mean two different things inside the select scope
01:14Raynesfistbump
01:14ibdknoxamalloy: I'd only want it in the scope of the where
01:19amalloysee, ibdknox, you should follow useful more closely. every tool you find youself wanting gets done before you realize you need it
01:20ibdknoxI really should
01:20RaynesMeh.
01:21amalloyit's the only koolaid Raynes inexplicably refuses to drink
01:21RaynesIt's true.
01:22Raynes&(meta #'filter)
01:22lazybot⇒ {: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"}
01:23ibdknox?
01:26amalloyhe can't afford a real repl, poor soul
01:27RaynesSpecifying :arglists as metadata should override defn's setting, right?
01:28amalloymoooostly. the way def/defn copy symbol meta to var meta is wobbly enough that i wouldn't commit to this being true
01:35amalloybtw, 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
01:35amalloyeffect? this is a case in which i find myself unsure which word is right
01:44amalloybtw 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)))
01:46amalloyactually, i guess it expands to (map force (list ...))
01:50hiredmanI often end up using thunks where I should use a delay
01:51amalloyme too. they're an easy tool to forget
01:51hiredmandelays have locals clearing so you are less likely to hold onto the head of a seq
01:51amalloyinteresting
01:52hiredman(well, really fns with the undocumented :once do, which both lazy-seq and delays use)
01:53amalloyah! i wondered what :once did
01:53hiredman:once causes the result to be cached
01:53hiredmanand because the result is cached the compiled can clear closed over values and such
01:54amalloywild. so if i wanted to start abusing my new-found knowledge, where could i put :once?
01:56hiredman,(^:once fn [x] x)
01:56clojurebot#<sandbox$eval27$fn__28 sandbox$eval27$fn__28@b8d171>
01:56hiredman,(^:once fn* [x] x)
01:56clojurebot#<sandbox$eval55$fn__56 sandbox$eval55$fn__56@16a7e0b>
01:56hiredmanit must only work with fn*
01:56hiredmananyway examples are in core.clj
01:56amalloyright, because fn macroexpands to fn* without looking at the meta
01:57amalloy~def delay
01:58hiredman,(let [f (^:once fn* [x] x)] [(f 1) (f 2)])
01:58clojurebot[1 2]
01:58hiredman:|
01:59amalloy&(let [x 10, f (^:once fn* [] x)] [(f) (f)])
01:59lazybot⇒ [10 10]
02:00daakuanyone 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
02:01RaynesOh wait, I wrote it. Shit.
02:02daakuRaynes: heh, didn't see you there
02:02amalloythose two statements are not mutually exclusive
02:02ibdknoxheh
02:02Raynesdaaku: Give me a moment to take a look.
02:02daakuRaynes: thanks. i'm probably doing something stupid
02:03emezeske;/away
02:05Raynesdaaku: I suspect this has something to do with the hyphen in the template name.
02:05RaynesProbably a bug on my part.
02:05daakuRaynes: ah. lemme try without that
02:07RaynesMeanwhile, I'll try to understand my code.
02:07daakuRaynes: yep, that was it
02:07daakuswitching to _ fixed it
02:08RaynesYeah. 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.
02:08amalloybtw 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))
02:08lazybot⇒ ""
02:09daakuRaynes: awesome, will do -- will file an issue
02:09daakuRaynes: thanks
02:09Raynesamalloy: I avoid such issues by qualifying the name where necessary. The rest of lein seems to handle it okay (I imagine it uses resolve).
02:09RaynesBut yeah, in general it's a bad idea.
02:10amalloyfair 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
02:10Raynes:p
02:12Raynesdaaku: Also, fantastic work with reporting the issue. You put the thing up on Github and everything.
02:13RaynesIt's nice when people aren't all like "omgwtf Y plugin no werk?"
02:14daakuRaynes: :) i definitely understand the issues with the lack of repro steps
02:15daakui'd be more proud if i could send you a pull request though
02:15RaynesYou can.
02:16Raynesdaaku: src/leiningen/new/templates.clj line 54: 'template' needs wrapped in a call to sanitize.
02:17daaku"Hardcore Forking Action"
02:17RaynesHaha :)
02:19daakuRaynes: i think you mean name needs to be wrapped in sanitize?
02:19RaynesNope.
02:19amalloysanitize everything. it's the only way to be sure
02:19RaynesThe problem is that the template is called os-template but your directory (to the mustache templates) was os_template.
02:20RaynesIt was making it look in the wrong place for your mustache templates.
02:21daakuRaynes: oops, you're right -- i assumed name was project name
02:21RaynesI never said it wasn't confusing.
02:21Raynes;)
02:22daakuRaynes: sent
02:23RaynesThanks! You get an ecookie.
02:23daakuremember no eggs
02:23RaynesI wouldn't dream of it.
02:26amalloymax out the gluten and peanuts, in case someone with a different allergy tries to steal his cookies
02:26RaynesHahahaha
02:27daakuhahaha
02:27daakui'm cool with that
02:27daakuthrow in some other nuts too
02:27daakuand some milk
02:28amalloyoh yeah, milk. how could i miss that one
02:29RaynesMy throat hurt.
02:29Raynes(pluralize *1)
02:37Raynesamalloy: Present for you https://refheap.com/paste/624
02:39amalloyRaynes: git-core comes with a __git_ps1 function
02:39amalloysubstantially more in-depth
02:40hiredmanit figures that as soon as I start on an s3 library weavejester releases one
02:41Raynesamalloy: How so?
02:41hiredmanof course mine doesn't use the amazon sdk
02:42amalloyit has more useful status outputs iirc
03:36tfarohello
03:37tfaroPlease am a new clojure newbie/user...need to setup the clojure environment on my system
03:37tfaropreferrably on an ide. whats on site talks about running clojure on terminal.
03:37tfarothats not what i want
03:46Raynesdaaku: 0.2.0 released. Fixes ALL the things.
03:46daakuRaynes: nice, thanks
03:46RaynesI just closed 6 issues in one push.
03:49daakuRaynes: no egg ecookie
03:49Raynesdaaku: I ran out. Get over it.
04:51lnostdal_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
04:51lnostdal_some Clojure STM thing or Java NIO ..i have no idea really .. sigh
04:52lnostdal_visualvm is not much help .. what do you guys use?
06:52manuel_hi
06:52manuel_is it more efficient to conj in a list and then reverse, or conj into a vector?
06:52manuel_or both the same?
06:52manuel_(adjusting from CL here)
07:01raekconj to a vector, I think
07:02lucianmanuel_: conj into a list and reverse is O(n)
07:02luciani believe vectors are pre-allocated so resizes aren't to often
07:10manuel_lucian: yeah i guess the vector way is ok
07:12lucianmanuel_: also, vectors aren't entirely contiguous, since they're in a tree of depth 32
07:12lucianmanuel_: sometimes appending is cheap, just making a brand new vector
07:13manuel_sounds cheaper than reversing a lst and recreating all the cons cells though
07:14manuel_or is there some tree rebalancing involved?
07:14manuel_sorry about the noob questions
07:14manuel_still used to the "array is a block of memory and realloc is expensive" mindset
07:15Licensermanuel_ do you need the reversed list often?
07:15lucianmanuel_: reversing a list is really terrible, it requires iterating over everything
07:15luciancopies are way cheaper usually
07:15lucianespecially since overallocation and sharding make copies rarer
07:16LicenserI wonder why there isn't a data structure that is like a reversed list
07:16manuel_sorry sharding and overallocation?
07:16Licenseroveralloaction means that your vecotr keeps N empty cells at hand for further assignments
07:16Licenserso you don't have to resize on any append
07:16manuel_Licenser: not really, it's just that (iterate (cons into a result list)) finally (reverse result) is a common idiom in lisp
07:17manuel_Licenser: it's called a list i think
07:17manuel_:}
07:17manuel_there is hard work
07:17manuel_oops
07:18Licenserbut then why the need to reverse it :P I mean there could be a reverse-list that append to the back not the front
07:18manuel_doubly linked list
07:18manuel_but that's not available in common lisp :)
07:19manuel_anyway i'm staying with conj into a vector solution
07:19manuel_i'm slowing going through the 4clojure problem set
07:19manuel_before doing any actual work which will probably be more heads-on grinding
07:19Licenserheh
07:19Licenserfor 4clojure the vector is most likely the better aproach, it keeps your code shorter
07:23manuel_heh i'm not sure about the shortness, not trying to golf
07:41gtrak`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.?
08:04jondotgtrak`, thats how long heroku takes to spin up your app.
08:04jondotif you really want to keep a free instance up - ping it. but thats not so ethical to my opinion.
08:09jondoti'm trying to upload my cookbooks for the first time to a shared opscode server, i took the opscode cookbooks and added mine
08:12jondotim getting this ERROR: Cookbook nodejs-support depends on cookbook nodejs::npm version >= 0.0.0
08:13jondotwhile this is my cookbooks https://github.com/jondot/cookbooks
08:13jondotthis cookbook exist in the /nodejs cookbook
08:14jondothmm i should have done 'include_recipe' instead perhaps..
08:15jondotah nevermind, i had a mixup of terminology, it should depend on 'nodejs'
09:53mrBlisscore.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:01kephaleare there some conditions under which java hashmaps are faster than clojure hashmaps?
10:01thhelleribdknox: are you arround?
10:01thhellergot a question related to jayq
10:03thhellerjust 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:03thhellerbut in my test using jquery direclty breaks {:optimizations :advanced}
10:04thheller:none and :simple work fine :(
10:04thhellerbut now i'm not sure if its due to my unfamiliarty with cljs itself or if its just the nature of jquery
10:56noidiis there any reason to use `find` over `get`?
10:56noidi,(doc find)
10:56clojurebot"([map key]); Returns the map entry for key, or nil if key not present."
10:56noidi,(doc get)
10:56clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
10:57noidiah, got it
10:57noidifind returns a MapEntry while get returns the value
11:03dgrnbrgIf 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:07raekdgrnbrg: yes.
11:07dgrnbrgraek: very cool :)
11:08raekdgrnbrg: do you mean something like this guy did? http://www.learningclojure.com/2010/09/clojure-faster-than-machine-code.html
11:11dgrnbrgraek: along those line, yes
11:12dgrnbrgI'm glad to see that I won't be trailblazing and that it does work
11:12dgrnbrgAlthough I don't see if he uses primitive type annotations to further increase the speed of his eval'ed code
11:26powrtocis anyone here using clojurescript one?
11:27powrtocI'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:44cran1988incanter has a macro for easy calculation ($= 1 +1 ) ... will clojure 1.4.0 will have it in the core ?
11:47TimMccran1988: What does that do?
11:48cran1988rather than typing (+ (- 1 1) 1) you just type ($= 1 - 1 + 1)
11:53morphlingcran1988: infix math is unlikely to ever go into core
11:53cran1988why?
11:53clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
11:55TimMccran1988: There's no point. You're using a lisp, prefix notation is a killer feature.
11:56cran1988TimMc prefix notation is killer notation for macro developers
11:57TimMcLook, if you use infix notation everywhere in your Clojure code, everyone is going to look at you funny.
11:57manuel__on the other hand writing math in prefix when you have all the formulas in infix is tiresome
11:57manuel__and doesn't make for easy communication with the world
11:58TimMcmanuel__: Oh, for formulas for a journal article? I guess that would make sense.
11:59TimMcAlso, you can totally use greek symbols directly in your code, if you don't mind pissing off people with poor UTF-8 support. :-)
11:59manuel__i remember i used a infix macro heavily when doing some CNC calculations
11:59cran1988i care only about infix notation in maths and it is boring all the time to call incanter.core for just a macro.
11:59manuel__because the prefix notation would just mess with my head over time
12:00manuel__i use a reader macro, dunno if there is someting like that in clojure
12:01TimMcNope.
12:01morphlingmanuel__: no. under the hood the reader is extensible, but the interface for doing so is not (yet) exposed
12:01manuel__ok
12:02manuel__take sounds like an easy one for lazy languages
12:02manuel__oops
12:05ibdknoxthheller: 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:23jweissthis 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:24jweisseg (def ^:dynamic x 1) (defn blah [n] (+ n x)) (blah 5) -> 6
12:24jweiss(def ^:dynamic x 2) (blah 5) -> 6
12:24jweissi would have expected 7
12:25TimMcMight be different between 1.2 and 1.3.
12:25jweissTimMc: i'm running 1.3
12:26jweissit's as if vars unique id's are not their names, i would have expected them to be
12:27jweissi guess it's not clear whether x should be closed over since it's dynamic. it does get closed over
12:27TimMcIt is odd behavior.
12:28TimMcI thought the defn would be recompiled.
12:28cran1988actually to me show 7
12:28jweisscran1988: TimMc actually you're right, i oversimplified my example
12:28jweisshang on
12:29cran1988how clojurebot works here ?
12:30jweisswell now it is behaving like i would expect... let me fiddle more, may be case of not enough coffee
12:31TimMc,(println "cran1988: Use a comma at the beginning of the line to run some Clojure.")
12:31clojurebotcran1988: Use a comma at the beginning of the line to run some Clojure.
12:32TimMccran1988: If you want to just play around with it, you can /msg clojurebot and run stuff there.
12:32cran1988,(def ^:dynamic x 1) (defn blah [n] (+ n x)) (blah 5)
12:32clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
12:32cran1988,(def ^:dynamic x 1)
12:32clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
12:32AimHere,(println "Extra clojure hacker bonus points for breaking the bot despite the sandboxing")
12:32clojurebotExtra clojure hacker bonus points for breaking the bot despite the sandboxing
12:32TimMccran1988: And of course, def is excluded in the sandbox!
12:33cran1988pfff...
12:33TimMcAimHere: clojurebot is Easy mode, lazybot is Hard mode.
12:33AimHereI permanently run in noob mode, so I don't think I'll break either of them
12:36cran1988,(eval (list + 1 1 ))
12:36clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
12:36cran1988,'(eval )
12:36clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
12:36TimMccran1988: Please try in /msg
12:36cran1988ok sorry
12:37TimMccran1988: And don't worry too much about breaking the bot -- it gets restarted automatically every 10 minutes. :-)
12:38TimMc...which should give you a sense of how bad the security is on that one.
12:39cran1988:) hmm....
12:40TimMclazybot 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:44cran1988i am working on bypassing AccessControlException in clojurebot
12:49TimMccran1988: 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:52cran1988pfff...
12:53cran1988or I can use all of his RAM and CPU (for 10 min) ... yes i am evil
12:54TimMcThere are timeouts. You might be able to bypass them...
12:54TimMcI wouldn't be surprised. I've seen the bot take like 3 minutes to respond to a request at times.
12:55cran1988aarrgh! i saw it just now
12:56cran1988great work ! China will make good use of it in Great Firewall ;)
13:11rlbIs 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:12TimMcThere are several libs that let you shell out, and they have various options. Let me take a look...
13:13rlbMost of the ones I know of only return the full out/err after the command has finished.
13:13rlbBut that won't help if you want to be able to see the command's progress.
13:14rlb(i.e. (:out (sh ...)))
13:14TimMcCheck if http://clojuredocs.org/clojure_core/clojure.java.shell/sh does what you want by default.
13:14TimMcOops, no.
13:15TimMcrlb: https://github.com/Raynes/conch
13:17rlbTimMc: thanks -- that looks like something I worked on a while back (but appears to be better).
13:26cran1988is there any library for networking ? like a wrapper or something like that ?
13:30AimHereclojure.java.io looks like it might do at least some things you're after; bundled with clojure itslf
13:32TimMcAimHere: Nah, it stores the results of stdout and stderr instead of passing them through.
13:32TimMccran1988: mumble mumble aleph lamina gloss mumble mumble
13:33TimMccran1988: Well, those are for binary protocols. You mean HTTP?
13:34TimMcthere are a bunch
13:34AimHereThere's always slurp
13:34TimMchaha, yeah
13:34AimHere,(slurp "http://www.goatse.cx&quot;)
13:34cran1988thanks ,no http, just for networking
13:35TimMc^ NSFW
13:35TimMcJust in case there is anyone here who is new to the internet.
13:35AimHereYeah. Doesn't appear to be safe for bots either, given the lack of response
13:35clojurebot#<AccessControlException java.security.AccessControlException: access denied (java.net.SocketPermission www.goatse.cx:80 connect,resolve)>
13:35TimMc,(+ 1 1) ; you awake?
13:35clojurebot2
13:35TimMcAimHere: No, just slow.
13:36TimMcOh, and I think the site no longer has its famous image -- didn't it get sold?
13:36TimMc*infamous
13:36AimHereI wouldn't know.
13:37AimHereIt's been some years since I was last tricked into gazing into the abyss that is goatse man
13:42muhooawesome, slurp works on http too. didn't know what
13:42muhoothat
13:43muhoohelp, i have work i have to do, but i can't stop playing with clojure
13:43muhooit's ruining my life.
13:43AimHereWhat do you need a life for, you have clojure?
13:43muhoogood point.
13:45muhoofunny 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:45muhoodamn you clojure
13:45oakwiseyou should probably just write a clojure->php compiler
13:45oakwiseshouldn't be too hard right?
13:46muhoonot any harder than writing cljs, i guess. but that was/is a big project.
13:46AimHereIt'd be easier the other way
13:47AimHereWrite a clojure interpreter in php
13:47muhooagain, a project on the scope of cljs. i don't think i'm quite ready for that.
13:48muhoobut, it would be cool, true.
13:48dhklmuhoo: I feel your pain. Ruby/Rails guys here, but couldn't stop messing with clojure.
13:48AimHereJust write a teensy weensy lisp interpreter in it. When anyone asks, remind them of Greenspun's tenth law
13:48Scriptorwell, there's close-to-clojure->php compilers out there
13:49cran1988muhoo: i had the same problem , now i am happy and unemployed
13:49dhklcran1988: damn
13:49muhoocran1988: that's inspirational and frightening at the same time.
13:49Scriptormuhoo: check out http://scriptor.github.com/pharen/ it's not quite clojure but borrows heavily from it
13:50muhooScriptor: wow, that's really neat, nice project.
13:50dnolenmuhoo: CLJS is shockingly small :) only ~1200 lines of code for the actual compiler
13:50Scriptorthanks :)
13:52cran1988Scriptor : It is great tool !!
13:53muhoowow, defmacro in php. that's kinky.
13:53cran1988i like the tail recursion in php
13:57muhoohm, will hiccup work in it?
13:57Scriptorthe 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:58Scriptormuhoo: hiccup?
13:59muhooScriptor: i see, you have html.php instaed
13:59muhoo,hiccup
13:59Scriptoroh, right clojure's hiccup
13:59clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hiccup in this context, compiling:(NO_SOURCE_PATH:0)>
13:59Scriptoryea, html.php isn't very useful, it's only there for a tutorial
13:59cran1988hmm... thanx Scriptor , but it now i am thinking for start-up
14:00Scriptorand it just uses functions, where's hiccup uses heavy macro work
14:00muhooit'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:01Scriptorif you want to contribute that'd be great!
14:01Scriptorthere's already a repl, but it's very clunky
14:01muhooin my case i can't use it right now because the project i'm dealing with is wedded to yii framework
14:04danieljamesAnyone know how to run -main from IntelliJ CE?
14:04muhooif i have to start a new project that requires php, i'll at least try using pharen instead
14:05Scriptorthanks, I'll be in #pharen if you have questions
14:06ibdknoxScriptor: hiccup doesn't use macros at all?
14:06ibdknoxI think it has one
14:06muhooScriptor: thank you for writing it. this may save me from insanity later on.
14:07Scriptoribdknox: nono, I'm saying hiccup does, the html.php in pharen doesn't
14:07ibdknoxsorry that wasn't very clear. Hiccup doesn't use macros at all
14:07Scriptoroh, interesting
14:07ibdknoxit's all just functions
14:07Scriptorhuh, I guess that makes sense actually
14:07Scriptorsince it takes vectors anyway
14:08ibdknoxyep
14:08cjfriszPlease excuse a noob question, but what dep should I add to my project.clj so I can use clojure.contrib.def?
14:09danieljamesI 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:10ibdknoxdanieljames: do you have (:gen-class) in your ns decl with the -main function?
14:10dnolencjfrisz: contrib is dead, you shouldn't use it
14:10ibdknox~contrib
14:10clojurebotMonolithic 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:10danieljamesyes
14:10ibdknoxcjfrisz: ^
14:11danieljamesthe example from clojure.org/compilation
14:12ibdknoxdanieljames: are you using leiningen?
14:12ibdknoxor are you trying to compile and do it exactly how they show?
14:12danieljamesIntelliJ with La-Clojure plugin
14:12ibdknoxso how are you running it then?
14:13cjfriszI know that def is in core.incubator, but what version should I be using?
14:14ibdknoxcjfrisz: they're on github
14:14danieljamesUsing the run icon... probably not sure I understand what you mean
14:14ibdknoxdanieljames: then you probably need to call (-main)
14:15ibdknoxthe -main concept is specific to running a jar through java
14:15danieljamesok, what do I need to do to start the application through the run icon?
14:16ibdknoxat the end of your file type (-main)
14:16cjfriszSo 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:16ibdknoxI assume. Not many people here use la-clojure, I think
14:16ibdknoxso I'm not much help in regards to specifics there
14:16danieljamesspot on
14:17muhooone 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:17ibdknoxcjfrisz: it looks like 0.1.0 is on maven
14:17ibdknoxcjfrisz: http://search.maven.org/#search%7Cga%7C1%7Ccore.incubator
14:18cjfriszOk, I've got 0.1.0, so maybe I'm actually having a different problem.
14:18danieljamesI'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:18oakwiseibdknox: the pinot split is looking great! cheers on that work
14:18ibdknoxdanieljames: totally, I don't use emacs either :)
14:19ibdknoxdanieljames: also I used to the be PM for C# and VB in VS at Microsoft :)
14:19ibdknoxoakwise: :)
14:19ibdknoxcjfrisz: that version appears to be quite old, you might want to just use a checkout for it if you're using lein
14:21danieljamesok well so far I have tried Eclipse and counterclockwise, but I found it extremely slow. What's your recommendation?
14:21cjfriszibdknox: I'll give that a shot, thanks.
14:22ibdknoxdanieljames: 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:22ibdknoxdanieljames: one thing I would suggest is using leiningen though
14:23manuel__i had a short peak at using la-clojure
14:23manuel__peek
14:25luciandanieljames: emacs is good at editing lisp
14:27danieljamesyes, 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:27lucianlaclojure also looks nice, indeed
14:28danieljamesI am impressed with the 'intellisense' feature in it
14:29oakwiseibdknox: what is the `fn? selector` case doing in `(def $...` in jayq?
14:29vijaykiranLa-Clojure is fairly easy to work with so +1 for it. (I use emacs though).
14:30TimMcdanieljames: Agreed, don't try to learn a new editor at the same time as a new language.
14:30AimHereHow do people cope with language-specific IDEs then?
14:31TimMc*new high-powered text editor
14:31TimMc*new editor paradigm
14:31TimMc:-P
14:32manuel__so then is the opinion of a single individual
14:32manuel__oops
14:32manuel__la-clojure is ok, but it's no match to slime
14:33manuel__though i use idea for java/php/javascript
14:33vijaykiranI use IDEA for Java
14:33vijaykiranfor 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:34manuel__yep
14:34manuel__and you have a repl and can enjoy yourself
14:34vijaykiran:)
14:34vijaykiranclojure console in la-clojure is fair enough - with completion etc.
14:35manuel__it doesn't show doc on typing though iirc
14:35vijaykiranin the editor it does
14:36vijaykiranand also the usual goto "source" and paramter list work fine
14:36vijaykiranso it is pretty decent
14:36manuel__yep
14:36manuel__i was just a bit surprised by the repl thing
14:36manuel__but apparently it causes some bug in idea
14:37vijaykiranhmm .. no idea. But the only thing that i couldn't figure out is compile stuff
14:37vijaykiranI had to do (compile blah) everytime .. the default intellij compile doesn't work the way slime C-c C-k for me
14:38gtrak`is there any way to get heroku to not hang for 15 seconds on the first request?
14:39vijaykirangtrak`: you need to pay for it I guess :-) or some program and keep pinging it
14:40gtrak`:-) they won't notice?
14:41gtrak`I was also considering a reverse jdbc, i wonder if anyone's tried something like that
14:41vijaykiranI 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:41gtrak`in mother russia, database connects to you..
14:41danieljamesI 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:42rlbI'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:42gtrak`danieljames: it's much easier to type a bit of code and run it in clojure
14:42rlb(CopyOption is an interface)
14:44vijaykiranrlb: code ? (sorry if you have already posted it)
14:44danieljamesgtrak`: 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:44TimMcdanieljames: Well, `lein repl` is a pretty damn fast way of getting to test out ode.
14:44rlbvijaykiran: (Files/move src-path dest-path StandardCopyOption/ATOMIC_MOVE)
14:44TimMc*code
14:45TimMcrlb: What is Files?
14:45rlbgiven an import [java.nio.file Files StandardCopyOption]
14:45TimMcOK
14:45gtrak`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:45gtrak`snippet*
14:45TimMcrlb: Is that some JDK 7 thing?
14:46pandeirohow can I debug a ClassNotFoundException? I'm using lein and I can the .class file there in lib/
14:46rlbyes: docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html
14:46gtrak`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:46TimMcI only have JDK 6 here.
14:47gtrak`i suppose it wouldn't be too hard to make a wrapper server
14:47TimMcWow, not at all a fan of Oracle's javadoc format for JDK 7
14:47vijaykiranyeah looks completely unreadable
14:47rlbTimMc: don't think it's an improvement either.
14:47vijaykirandon't have java7 here too..
14:48TimMcrlb: Oh, it's a varargs thing.
14:48rlbIf it matters, I'm running Debian openjdk-7-jdk
14:48TimMc"[Ljava.nio.file.CopyOption;" means java.nio.file.CopyOption[]
14:48vijaykiran[L = Array of Longs .. I think
14:48vijaykiranor just array
14:49TimMc&(class (to-array [(Object.)]))
14:49lazybot⇒ [Ljava.lang.Object;
14:49TimMcArray of objects.
14:49rlbhttp://docs.oracle.com/javase/7/docs/api/java/nio/file/CopyOption.html
14:49rlbhttp://docs.oracle.com/javase/7/docs/api/java/nio/file/StandardCopyOption.html
14:49rlbif it helps
14:49TimMcrlb: No, see what I said above.
14:50TimMcvarargs are a Java illusion, they don't exist in the JVM itself.
14:50rlbOh, wait -- should I be using $ to access the enum value?
14:50TimMcno
14:51TimMcThe signature (Path source, Path target, CopyOption... options) means you should write (Files/move src-path dest-path (to-array [StandardCopyOption/ATOMIC_MOVE]))
14:51vijaykiranI think you need to pass an Array instead of single enum value
14:51vijaykiranwhat TimMC said :)
14:52rlbOh, right, thanks -- I don't think I would have figured that out immediately -- didnt' realize that's how varargs should be handled.
14:53TimMcIt's not obvious.
14:54cjfriszIt's taking me a stupidly long amount of time to figure out how I can use defvar
14:54pandeiroany help with debugging ClassNotFoundException for a dependency in lein?
14:54vijaykiranpandeiro: can you paste the stacktrace somwhere ?
14:55cjfriszI have core.incubator jar in my libs directory, and I've got (:use [core.contrib.def :only [defvar]]) in my namespace declaration.
14:55cjfriszWhat am I doing wrong?
14:55rlbTimMc: fwiw, might need to be (into-array ...)
14:56TimMcOh, depends on how types need to be handled.
14:56rlbYeah, in this case I needed into-array.
14:57TimMcinto-array can guess the type based on the first arg, right
14:57TimMcrather, will use that type
14:57pandeirovijaykiran: http://sprunge.us/FDgN
14:58rlb(Now I get to fight with nio/move -- don't know why it's throwing the exception it is...)
14:58TimMcpandeiro: Does `lein classpath` illuminate anything?
14:59powrtocIs anyone here using clojurescript one?
14:59TimMcpandeiro: It's also pretty much impossible to help without knowing whether this is a javac issue, jar dependencies issue, etc.
14:59vijaykiranpandeiro: when exactly you get this erro ?
15:00vijaykiranpandeiro: I get this in my repl whenever a pop-up comes up that is just a namespace not a real "class"
15:01pandeiroTimMc: lein classpath shows webbit in the classpath
15:01pandeirovijaykiran: i get it when trying to import the class in SLIME, REPL, or as part of another namespace with :import
15:01trptcolincjfrisz: are you on 1.3? seems like all the functionality from defvar is now part of def (though args are ordered differently)
15:02pandeiropowrtoc: i have been, yeah
15:02powrtocpandeiro: I'm struggling to replace the sample application with a simple hello world in my own namespace
15:02pandeiroTimMc: not sure how i can tell if it's a javac, jar dep issue...
15:03pandeiropowrtoc: yeah there are a lot of interconnected parts
15:03cjfrisztrptcolin: In what namespace does def live?
15:03TimMcpandeiro: Well, is this something you brought in via :dependencies? Then it is a jar dependency.
15:03cjfriszAnd yes, I am using 1.3
15:03pandeiroi actually wrote a script to change all the one.sample.* namespaces over to my own
15:03TimMcpandeiro: There are many different ways you can have a classpath problem.
15:03pandeiroTimMc: yes, via :dependencies
15:03pandeiroand lein fetched it fine
15:03trptcolincjfrisz: it's a special form, always available
15:03vijaykirancjfrisz: def is a special form
15:03TimMcOK, so you're probably not using the right package/namespace to import/require it.
15:04pandeiroit'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:04pandeiroTimMc: how do I determine the proper name?
15:04vijaykiranpandeiro: not sure, since I get this error when I'm typing namespaces .. I'd like to know how to fix it too..
15:04TimMcAPI documentation.
15:05rlbTimMc: is this likely to be the way varargs are handled long-term?
15:06TimMcrlb: No idea.
15:06rlb(if you know -- it's a little wordy when you don't have any options)
15:06TimMcI don't think the JVM gives us much choice.
15:07rlbNot a big deal anyway -- you can always define an empty array somewhere and just use that.
15:07TimMcrlb: As long as it is the right type. :-/
15:07TimMcpandeiro: What path did you follow in the jar file to get to the .class file? That's the package.
15:08rlbTimMc: right, just meant as a shorthand (let [no-lopts (into-array java.nio.file.LinkOption [])] ...)
15:10pandeiroTimMc: org/webbitserver/WebServers.class
15:11pandeirohuh... maybe just a syntax issue? did import syntax change from 1.2 to 1.3?
15:15trptcolinpandeiro: no, pretty sure it didn't. what's the import statement you're using?
15:18pandeirogah... so i guess the webbit project changed the name from webbit to org.webbitserver
15:18vijaykiranpandeiro: (:import [org.webbitserver WebServer WebServers WebSocketHandler]
15:18pandeirotrptcolin: i think that will fix it, sorry... my import was fine
15:18vijaykiran [org.webbitserver.handler StaticFileHandler]))
15:18trptcolincool
15:18pandeirovijaykiran: thanks, yeah that's it
15:18vijaykiranI just created a project .. and that works :)
15:18pandeiroi am such a java ignoramus
15:20vijaykiranpandeiro: http://blog.jayfields.com/2011/02/clojure-web-socket-introduction.html
15:20vijaykiransee the comment there
15:20pandeirovijaykiran: yep i just saw that comment too :)
15:21pandeiroso i can just assume since the path to the .class file is org/webbitserver/WebServers.class, the package name is org.webbitserver
15:21pandeirothat will always hold true for java libs?
15:21vijaykiranyes
15:22vijaykiranit 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:23muhooor in a jar inside com/blah/super/awesome/Amazing.class , right?
15:23vijaykiranyeah inside a jar
15:25dgrnbrgif 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:26muhoowhen would you be calling a function without knowing what args it wants?
15:27dgrnbrgmuhoo, I have a function (defn tuplefn [f i] (fn [tuple] (assoc tuple i (apply f tuple))))
15:27dgrnbrgwhich I use to map over seqs of tuples
15:28dgrnbrgwhere I want to only modify 1 element of the tuple, but the modification could take any # of args
15:28dgrnbrgand I want to use anonymous functions to write the modifiers
15:28dgrnbrgso sometimes the anonymous functions only care about a prefix of the arguments
15:28dgrnbrgand then the code doesn't work
15:29rlbHmm, didn't realize that finally clauses don't fire in the case of a C-c.
15:29dgrnbrgunless I do something dumb like: #(do %5 (f %2)) to ensure 5 argument forms
15:29rlbSo I can't really use them to implement with-temp-file as I'd hoped...
15:29muhooor varargs
15:30vijaykiranrlb: because System.exit doesn't fire finally .. ?
15:30rlbvijaykiran: don't know -- I haven't investigated what actually happens on a C-c yet.
15:32vijaykiranrlb: I'd guess C-c is Sys.exit. But not sure why you want to have C-c based code :)
15:33rlbmight need a sigint (and sigterm) override
15:34rlbvijaykiran: pretty much mandatory for some useful command line tools.
15:34vijaykiranrlb: oh okay.
15:34rlband *any* program should make sure it doesn't DTWT on SIGINT/SIGTERM
15:38AimHeredgrnbrg, 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:39vijaykiranrlb: -Xrs option seem to be related to what you want
15:40dgrnbrgAimHere: is there a way to do it with iterate/takewhile to play nicely w/ apply?
15:40dgrnbrgAnd I thought there was a way to query a function for its arity
15:40AimHeredgrnbrg, there possibly is. In fact, if you check out the source code to partial, it probably is in there
15:40AimHereBecause otherwise how could it be implemented?
15:41rlb(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:41dgrnbrgAimHere: it's implemented by apply's use of fixed and varargs portions
15:41dgrnbrgreturning a function that fixes one arg at a time
15:41dgrnbrgI could do it w/ an exception handler too
15:41dgrnbrgto catch when I overflow the args
15:41dgrnbrgbut that kinda sucks...
15:42vijaykiranrlb: I think it can be done during startup ..
15:42AimHereWell there's the part of the exception handler that complains that you've got the wrong number of args
15:42AimHereCould easily be written in Java, though
15:43rlbvijaykiran: 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:43vijaykiranrlb: np
15:50dgrnbrgI've decided to ignore it
15:50dgrnbrgand refactor other things
15:50dgrnbrgI have some gloriously complex macros that could be untangled
16:13danieljamesDoes anyone know how to load the project under the ide into the repl under intelliJ?
16:15vijaykiranyou just need to start Clojure Console
16:15vijaykirandanieljames: shameless plug but checkout the blogpost I wrote - http://vk.cx/zfrt7A
16:16vijaykirandanieljames: I used IntelliJ
16:16danieljameshmm that link doesn't work for me
16:16vijaykiranhttp://www.vijaykiran.com/2012/01/11/web-application-development-with-clojure-part-1/
16:18danieljamesthanks. I think I have done everything correctly, but at the point of the use, it fails to locate 'frob__init.class'
16:18danieljamesI did find that blog post earlier actually!
16:18vijaykirancan you check the classpath that is printed in the console ?
16:18danieljamesclojure.lang.RT.load
16:18danieljames(RT.java:430)
16:19vijaykiranit shoule be really long :)
16:19danieljamesCould not locate frob__init.class or frob.clj on classpath: clojure.lang.RT.load (RT.java:430)
16:19vijaykiranI meant when you start the repl/console it will printout the complete path.
16:20danieljamesyes I see that, what should it contain- it does contain a load of java paths
16:21danieljamesat 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:21vijaykiranyeah .. it should have your project dir and the libs ..
16:21vijaykiranyou used leiningen to create the project .. right ?
16:22danieljamesnope
16:22danieljamesinstant fail?
16:22vijaykiran:) I suggest use leiningen .. less painful
16:22vijaykiranand easy to setup classpaths etc..
16:23danieljamesI shall go back and follow your wise instruction, I had assumed that the La Clojure plug in would be enough!!
16:23vijaykiranLa Clojure is just for editing/repl starting
16:23vijaykiranlein is the one that sets up the project.
16:34cjfriszSo I notice that if I have a backquoted list containing "fn," then it gets resolved to clojure.core/fn in the output
16:34cjfriszAnd I understand why this is based on the Reader documentation
16:34cjfriszIt's not really a problem, but is there anyway to just get "fn" to show up in the list?
16:37morphling,`(~'fn)
16:37clojurebot(fn)
16:38cjfriszOh nice, thank you.
16:38cjfriszShould have thought of that.
16:39morphlingnp
16:42danieljamesvijaykiran: REPL main class, clojure.main - is that right?
16:54danieljameshas 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:55danieljamesI'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:58danieljamesvijaykiran: 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:59vijaykirandanieljames: did you execute lein deps ?
16:59danieljamesyes, it downloaded successfully
17:00vijaykiranok, can you check if the lib folder is listed under module dependencies ?
17:01danieljamesi see 1.6 (java version "1.6.0_29" and under that <Module source>
17:01the-kennySetting up a nice IDE is the single biggest step in learning a LISP.
17:02brehautthe-kenny: the simple answer is to not let setting up a nice IDE get in the road of learning then ;)
17:02the-kennyyup, but that's hard
17:02the-kennybrehaut: Some years ago when I wanted to learn Common LISP, I was a die-hard Vim user.
17:02vijaykiranyou ned to have the lib folder as well ..
17:02vijaykiranmac or windows ?
17:03vijaykiranor linux :) ?
17:03the-kennyvijaykiran: me?
17:03vijaykiranoops .. sorry no, danieljames
17:03the-kennyno problem
17:03danieljamesvijaykiran: Sorry, which lib folder? OS X. Also I just noticed the REPL is at 1.2.0 now :-(
17:04vijaykirandanieljames: you are almost there .. :) Command + ; and open module settings
17:04vijaykirandanieljames: should look like this http://cl.ly/092Z2I303P0F2X2c0m0F
17:05danieljamesok, added
17:06vijaykirandanieljames: nice. Now just Cmd Shift F10
17:06brehautthe-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:06danieljamesok that worked, but unable to resolve defproject ...!!!
17:07vijaykirandanieljames: Make sure you are not running the current file .. just open the console
17:08danieljamesAll my problems are stemming from my inability to follow extremely clear and simple instructions..
17:08danieljamesok that is working, and now I am at Clojure 1.3.0
17:08vijaykirandanieljames: terrific. Hack away then :)
17:08danieljameswhoa cowboy..
17:08vijaykirandanieljames: you can type (use 'whateveryourproject.core)
17:09danieljamesmeh, same as before 'could not locate dango__init.class' or dango.clj on classpath
17:09vijaykirandanieljames: hmm interesting
17:10danieljamesinteresting, as the 'intellisense' is actually picking up my project name
17:10vijaykirandanieljames: what did you type exactly ?
17:10danieljames(use 'dango)
17:10vijaykirandanieljames: I think it would be (use 'dango.core)
17:10vijaykirandanieljames: if you used leiningen
17:11vijaykirandanieljames: unless you renamed the namespace in src/dango/core.clj
17:11danieljames...nil
17:11vijaykirandanieljames: that's it :)
17:12danieljamesand my functions will go into dango:xxx?
17:13vijaykiranyes. for starters.
17:14danieljamesOk this has been a great help, I still can't call a function but it looks like everything is set up
17:14vijaykiranyou IDE part is done. Now you can just focus on clojure awesomeness
17:18danieljamesstill 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:19vijaykiranfirst you need to (use 'dango.core)
17:19danieljamesyep
17:19vijaykiranwhich will bring your functions to repl
17:19vijaykiranthen you can call the functions without a prefix
17:19danieljamessame error
17:20danieljames"unable to resolve symbol: hello in this context"
17:20vijaykirandid you add function after starting repl ?
17:21danieljamesalso, 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:21danieljameseven with something that cannot possibly compile
17:21vijaykiranyeah, that's the limitation rightnow with IntelliJ
17:21vijaykiranwhen you "compile" using IDE that classes aren't picked up by repl
17:22vijaykiranI couldn't figure out why .. but there's a work around
17:22vijaykiran(compile 'dango.core)
17:22danieljamescompile that's not working anyway, "unable to resolve symbol: defproject"
17:22danieljamesok I'll try that- seems painless
17:23danieljamesthat seems to do exactly what I'd expect
17:24RaynesUh
17:24Raynes(use 'dango.core :reload)
17:24RaynesYou don't want to call compile.
17:26vijaykirandanieljames: ^^ this is better
17:26danieljamesok
17:26danieljamesthat seems good
17:27danieljamessoon I am sure I will see user=> (hello) followed by Hello World!
17:27danieljamesYES!
17:27vijaykiranyay!
17:28danieljamesexciting times
17:29danieljamesvijaykiran: thanks
17:29vijaykirandanieljames: np, enjoy hacking
17:45amalloyrlb: hava.io.File has .deleteOnExit
18:48cjfriszSemi-random question: Is there a way for a Clojure namespace to export a subset of the symbols that it defines?
18:48cjfriszSomething like a Scheme library?
18:49cjfrisz(by the way, I'm a long-time Scheme programmer who wrote his first Clojure code yesterday)
18:50dnolencjfrisz: not possible. Side note: I <3 Scheme, particularly after read Dan Friedman's work.
18:51dnolenreading
18:52cjfriszdnolen: Funny you should say that, because I'm actually messing with Clojure thanks to Dan Friedman
18:52cjfriszHe and Will Byrd have been glowing since they got back from Clojure/Conj
18:53dnolencjfrisz: yeah I work on core.logic, I helped sneak them into Clojure/Conj ;)
18:57cjfriszdnolen: I've been messing with core.match and I have to say it's quite nice.
18:57cjfriszWell done, sir
18:59dnolencjfrisz: thanks, it's actually in need of some serious attention but the basics work.
19:00amalloydnolen, cjfrisz: it's that just a namespace with some ^:private definitions?
19:00amalloy*isn't
19:01cjfriszdnolen: 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:02cjfriszI use it for a lot of stuff and it's pretty featureful.
19:02cjfriszI'm mostly impressed with core.match because it reflects most of the functionality I get with Scheme match.
19:02dnolencjfrisz: Dan showed it to me, but I haven't looked at it closely enough
19:02cjfriszAhh
19:02cjfriszIt is indeed a pretty dense set of macros.
19:04dnolencjfrisz: yeah, for that kind of thing I definitely appreciate Clojure's approach to macros.
19:05dnolencjfrisz: core.match mostly taken from a OCaml paper, and some examinations of Racket's match
19:07cjfriszdnolen: Ahh...I'm very much a Chez Schemer, so I'm not familiar with Racket's match.
19:07cjfriszThough I met a lot of the Racket team a couple weeks ago and they seem like a good group of people.
19:10dnolencjfrisz: Chez Scheme seems quite cool, I've only played around with Petite
19:11cjfriszdnolen: I got to take my undergrad compilers class with Kent Dybvig, so I've got a lot of Chez Scheme love.
19:12dnolencjfrisz: that's amazing! Seems like there's some incredible knowledge trapped away in the Chez Scheme implementation.
19:15cjfriszdnolen: 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:11dgrnbrgDoes clojure have a bit set?
20:12amalloyi would say it has millions of bits set
20:18dnolendgrnbrg: http://docs.oracle.com/javase/1.4.2/docs/api/java/util/BitSet.html
20:19dgrnbrgdnolen: that one's not functional
20:19amalloyjava's bitset is sorta trash, though
20:19dgrnbrgyou can def. make a purely functional bit set by packing arrays of bits at nodes
20:53lynaghkHas anyone sucessfully packaged up non-ClojureScript-generated JS in a JAR and used it from another project?
20:54lynaghkI'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:29emezeskelynaghk: Yes, I have.
21:30lynaghkhttps://github.com/lynaghk/cassowary-coffee/tree/cljs-jar
21:30lynaghkThis is what I've got sofar, I'm not exactly sure what's going wrong--two issues.
21:31emezeskelynaghk: I think you might want to look at leiningen's :resource-path
21:31lynaghkFirst 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:31lynaghkfor getting JS into the JAR, or making it available on the classpath for a dependent library?
21:32emezeskelynaghk: For getting the JS into the JAR.
21:32emezeskeThen, I think the dependent library will see it in the classpath without anything special
21:32lynaghkI got it into the jar fine with :compile-path "out/js"
21:32lynaghkthe dependent library is not seeing it. I think the issue could be that I'm using js/ClassName
21:33emezeskeRegarding the :libs thing, I'm unfortunately not very knowledgable about that :/
21:33lynaghkbut even if I throw a (:require [ClassName :as cn]) into the namespace, they don't seem to be getting pulled in.
21:35lynaghkemezeske: thanks anyway
21:36emezeskeNP, good luck!
21:36codeforkjeffis there a way to tell what libraries you've pulled into the current ns?
21:37emezeskecodeforkjeff: Maybe someone on this page will help? http://clojure.org/namespaces
21:37emezeskens-map or something?
21:38emezeske,(ns-map *ns*)
21:38clojurebot{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:39codeforkjeffexactly what i was looking for, thanks!
21:39emezeskeNP.
21:42oakwisehas 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:42emezeskeoakwise: I am working on that right now
21:42emezeskeThere was a problem last night that ibdknox fixed this morning
21:42emezeskeUpdated recently?
21:43oakwiseemezeske: I saw that. Doesn't seem to be related.
21:44oakwiseemezeske: 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:44oakwiseseems to be the way the post request is getting formatted
21:44oakwisehave you had success?
21:44emezeskeoakwise: Hmm, I almost have my code finished, I will relate my success/failure in a bit
21:45oakwisethanks!
21:45ibdknoxoakwise: emezeske: it's entirely possible I broke it, I'll take a look shortly
21:46emezeskeibdknox: thanks.
21:46oakwiseibdknox: cool thanks. It's also entirely possible I'm missing something obvious :)
22:08emezeskeoakwise: Okay, I got my thingie working, and I am seeing a similar error: Invalid number: 0=null&3=null& - (class java.lang.NumberFormatException)
22:08oakwiseemezeske: great, it's not just me then :)
22:09emezeskeibdknox: 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:11emezeskeibdknox: Maybe a probleml with fetch.core/->data ?
22:14emezeskeibdknox: I think I tracked down the bug
22:14ibdknoxemezeske: what'd you find?
22:14emezeskeibdknox: I don't think fetch.remotes/remote-callback should call pr-str
22:15emezeskeibdknox: I think it should pass the map through, as ->data will eventually map->js it
22:15ibdknoxthat sounds right
22:16ibdknoxI translated that back from using the jquery stuff
22:17ibdknoxso that it wouldn't have that dependency and messed it up. Remotes are like the only thing I'm not currently using heh
22:18emezeske^_^
22:34ibdknoxokidoke
22:34ibdknoxgot it all working again
22:34ibdknoxwill push in a sec
22:35oakwisehurray
22:35ibdknoxemezeske: oakwise: ^
22:35oakwiseibdknox: much obliged
22:35dgrnbrgIs there a total order on keywords?
22:35dgrnbrgthat is, is there a unique ordering for every set of keywords
22:36ibdknoxoakwise: emezeske: pushed
22:36lynaghkibdknox, 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:36ibdknox,(sort :b :d :c :a)
22:36clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core$sort>
22:36ibdknox,(sort [:b :d :c :a])
22:36clojurebot(:a :b :c :d)
22:37ibdknoxdgrnbrg: they're sorted like strings, unless I'm not understanding your question
22:37ibdknoxlynaghk: I added the 3rd party stuff to deps.js
22:37offbytwoTry (sort [:b :d :c :a])
22:37dgrnbrgibdknox: I mean if I use a sorted-set of keywords, will a seq on that set always be =?
22:38emezeskeibdknox: You da man!
22:38dgrnbrgare all keywords interned?
22:38ibdknoxyes they are
22:39dgrnbrg,(class #{})
22:39clojurebotclojure.lang.PersistentHashSet
22:39ibdknoxwhy seq before comparing?
22:39dgrnbrgso, i'm serializing sets
22:39lynaghkibdknox: 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:40ibdknoxlynaghk: that has not been my experiene
22:40ibdknoxexperience*
22:40ibdknoxbut that was a long time ago
22:40lynaghkhmm
22:40dgrnbrgthe set has a bunch of keywords, and the keywords each need to corresponding to specific indices, like an enum
22:41lynaghkI'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:41lynaghkthanks for the pointer
22:42ibdknoxlynaghk: 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:42lynaghkyeah, that's how I'm feeling right now
22:43lynaghkBut 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:44ibdknoxlynaghk: the change to find libs and externs on the classpath was really recent
22:44lynaghkThat would be terrible, just terrible. Also, everytime you git submodule Leiningen cries a little.
22:44ibdknoxgot an up-to-date cljs?
22:45lynaghkfeb 3
22:45ibdknoxhm
22:46clj_newbis 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:46lynaghkI wonder if Closure or ClojureScript is assuming one goog.provides per JS file
22:46lynaghkI'm pretty sure Closure doesn't care about that.
22:47ibdknoxah
22:47ibdknoxthat would be a reasonable assumption
22:47ibdknoxI think that deps.js is how you get around it
22:47lynaghkclj_newb: depends on the use case. If you're doing sparse linear algebra there are some benefits in other data structures
22:48emezeskeibdknox: Cool, the latest fetch is working for me!
22:48ibdknoxemezeske: awesome :)
22:49clj_newbis 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:49emezeskeclj_newb: Depends on what you mean by better :)
22:50clj_newbefficient?
22:50clj_newbhmm; soudns like i'm in the realm of premature optimization
22:50clj_newbs/efficient/idiomatic/
22:51emezeskeclj_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:52ibdknoxin general it depends on the operations you'll want to do on it
22:52clj_newbit's create once, read many many times
22:52ibdknoxlinearly?
22:52ibdknoxerr, sequentially is a better question
22:55clj_newbokay; i am now convinced of what the right thing to do is
22:55clj_newbthanks everyone :-)
22:55seancorfieldis the findfn thing in the bot available separately (or is it a matter of taking it out of the source of the bot)?
22:56seancorfield(and which bot is it part of?)
22:56ibdknoxseancorfield: https://github.com/Raynes/findfn
22:57seancorfieldthanx!
23:12lynaghkibdknox, whoooa apparently has something to do with goog.scope()
23:12lynaghkClojureScript for some reason really needs it, even though the same codebase works fine with Closure.
23:12graphbumduring 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:12ibdknoxlynaghk: lol I don't even know what that is
23:14lynaghk*shrug*
23:14lynaghkonto the next error now. I'll write something up if I ever figure out what is going on.
23:15ibdknoxplease do :)
23:19arohnergraphbum: inner classes are named foo$bar
23:19arohnergraphbum: and for simplicity, try referring to the absolute name first, com.foo$bar
23:22graphbumarohner: thanks. I'll rub my brain on that and see if I can get at the JUNG libraries.
23:23dnolenibdknox: lynaghk: fwiw, I'm paying attention :)
23:23lynaghkoh, hey David
23:24lynaghkAll of this is for cassowary-coffee
23:24lynaghkI've been trying to release it as a JAR for the past few hours. It's, um, taking longer than I thought
23:24ibdknoxheh
23:25lynaghkIf you want to play along:
23:25lynaghkhttps://github.com/lynaghk/cassowary-coffee/tree/cljs-jar
23:25lynaghkhttps://github.com/lynaghk/profile-cljs
23:25dnolenlynaghk: I haven't messed much w/ packaging external JS stuff, so any insights on how to make it better - I'm listening.
23:25graphbumarohner: working, I was using the name from import, not the absolute name. going with the absolute name looks like the ticket. thanks.
23:25lynaghkI'm trying to suck the former into the latter.
23:25lynaghkWell, I think Chris must have figured it out once, because that's how I got the idea. Pinot depends on goog-jar
23:26lynaghkwhich 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:26arohnergraphbum: 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:26lynaghkso I thought I'd be able to do the same thing.
23:26ibdknoxlynaghk: important distinction, my goog-jar completely replaces the closure library though
23:27lynaghkRight 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:28lynaghkibdknox, 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:29ibdknoxI do remember that the only way I got it to work was through declaring all of the 3rd party libs in deps.js
23:29lynaghkThat's how I'm using closure on the command line, so my guess is that clojurescript is interfacing with it differently
23:29lynaghkwhat 3rd party libs did you add? I took a look at it and everything seemed to be in the Closure library already
23:29dnolenlynaghk: yuck
23:30dnolenlynaghk: you're territory that I'm not familiar with, but it sounds like it shouldn't require so much trouble
23:31lynaghkall yak shaving problems do = )
23:31lynaghkbut yeah, I'm surprised considering that all of the JS works fine with Closure already.
23:33dnolenlynaghk: it would be super helpful to see a doc on the various aspects of the issue.
23:33lynaghkwriteup what exactly I'm trying to do and what is/isn't working, you mean?
23:33dnolenlynaghk: CLJS dev should be as simple as CLJ dev as far as deps
23:33dnolenlynaghk: yes
23:34lynaghkyeah, I'll work on that tomorrow
23:34dnolenlynaghk: awesome, thx
23:34lynaghkProbably cut back and put together a minimal-example repo
23:34lynaghkthank you
23:35lynaghkI 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:36lynaghkexpect something from me by Tuesday afternoon. For now I'm going to grab some dinner
23:36lynaghkthanks for your help too Chris
23:36dnolenlynaghk: that doesn't sound like fun. Sooner this stuff is ironed out the better.
23:37lynaghkdnolen, yeah that's why I've been punting on it---hoping that maybe LukeVanderHart would write blog post #2 documenting everything else =)
23:42dnolenlynaghk: I have a feeling you're digging into scalable CLJS dev more than most folks :)