#clojure logs

2012-08-25

00:25shaungilchristdjantayn: wow thanks for mentioning quil - super impressive.
00:34FrozenlockI'm disappointed... I discovered Catnip, found it impressive and so wanted to look at the cljs source. Turns out it's just javascript.
00:58SgeoI should really write lift-m-fn
00:58Sgeolift-m doesn't need to be a macro afaict
00:58SgeoOh, m-lift
01:24SgeoAre monads made with one or the other of the monad libraries made to automatically work with map?
01:24SgeoBecause that would be nice
01:37SgeoAlso, applicative should be made into its own thing somehow.
01:38SgeoAnd perhaps a more general framework for making these kinds of things.
03:27tomojany ideas on cljs webworkers?
03:27tomojI guess
03:28tomoj.. I guess you could have cljsbuild spit out a file that does nothing, then add calls to different entry points at the bottom in different files
03:38SgeoHow bloated is Eclipse usually?
04:03amalloyi don't think that question is well-defined enough to answer. if you want, you can pretend http://icanhascheezburger.files.wordpress.com/2009/12/funny-pictures-cat-is-too-big-for-box.jpg is eclipse fitting into available memory
04:21SgeoOh hey olabini visits here
04:58gerry1i have fixed why "lein repl" can't assign address" in my box
04:59gerry1i have to setup 127.0.0.1 to localhost
05:00gerry1in /etc/hosts
05:01gerry1weird?
05:01clojurebotSomething weird that I noticed: & (use '[clojure.contrib.json :as json]) & &| (json/pprint-json nil) |&
05:01lazybotjava.lang.RuntimeException: No such namespace: json
05:42ro_stanyone interested in ClojureScript with Enfocus for views, PubSub to wire views and logic together, and Remotes for server access? And crossover model code that gets used on both client and server side?
05:48hyPiRionIs sort and sort-by stable?
05:49ro_stdemo code is now working, finally: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/
05:54ejacksonro_st interesting !
05:55ro_st:-) it works really well
05:56ro_stin our production app, i've since moved our model code out to a separate project using 'checkouts', along with its midje tests. Crossovers still work perfectly
05:56ro_sti love that i can use precisely the same html templates on the server side with enlive, as well
05:57ro_stpretty soon i'm going to build a ring + cljs pjax wrapper (the way the new basecamp works)
06:02ejacksonenlive is magical code
06:02ejacksoni'm using it a lot these days for .xml file parsing
06:04ro_stis it tolerant of funny unicode characters?
06:05ro_sti have html that i need to validate for ms-word-pasted funny characters
06:06ejacksonno idea !
06:14raek_ro_st: if you give it a Reader that you configed with the correct encoding, then yes
06:15raek_enlive can create the Reader itself, but then it guesses the encoding
06:16raek_so if you pass it (io/reader filename :encoding "UTF-8") rather than just filename you should be safe
06:16ro_stawesome, raek, thank you!
06:18ejacksonenlive for president
06:20ro_stheh
06:21ro_sti'm just so glad enfocus exists. it's made cljs painless
06:24ejacksonhow do you feed it the templates ?
06:24ejacksonjust with links ?
06:25ro_stit knows how to download them with xhr
06:25ro_stso just give it a path from /
06:25ejacksonok, brilliant
06:25ro_stsame as with enlive
06:25ro_sthttps://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/blob/master/src-cljs/depr/view.cljs
06:26ro_sthttps://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/blob/master/resources/public/templates/templates.html
06:26ejacksonhah...
06:26ro_stdefaction is a fn that runs on the live dom
06:26ro_stwhereas defsnippet (as with enlive) returns populated html nodes for putting into the dom
06:27ro_stinitially i tried to write one set of code for both enlive and enfocus
06:27ejacksona reach too far ?
06:28ro_stbut due to having to use (apply ef/en-content (map item-template items)) instead of being able to use (apply em/content …), due to content being a macro in enfocus, i couldn't
06:28nz-how do you integrate normal js libs with cljs?
06:28ro_stwith externs
06:29ro_sthttp://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html Externs heading
06:30ro_stwe're doing our best to avoid using non-cljs js though. keeps the startup performance good; right now, our app is 230kb over the wire including js, css, webfonts and css sprites
06:30ejacksonro_st: that's small
06:30ro_stthat's with all the caching and gzip stuff turned up to 11
06:30ejacksoni was just pulling in stuff like jquery and not giving a damn... but the app was huge
06:31ro_stand that's across 11 requests, i think
06:31ro_stit's damn fast
06:31ro_steasy to do if you decide to make it a priority before you start :-)
06:31ro_st10 requests
06:31ejacksonyeah, I was just trying to make something work
06:32ejacksonand jquery is damned useful !
06:32ro_stit is. enfocus does the job just as nicely, although no huge plugin library
06:33ejacksonits all about that - having things like widgets galore is very helpful. I'm using kendoUI for example
06:33ro_sti'll probably end up bringing bootstrap.js in
06:33ro_stthose components are just too damn handy
06:34ro_stwe want to be performant on mobile as well
06:34ro_stso having small download sizes and tight JS is important
06:35tomojso no jqm or jqtouch though?
06:35ejacksonyeah, mine's an internal app, so that's not a problem
06:35naegpiranha: hey, I managed to transliterate the conways game of life from clojure to python
06:35ro_stno. same codebase for everyone
06:35piranhanaeg: did it become much bigger? :)
06:35naegpiranha: http://bpaste.net/show/2RM4RfewQbrCJr1Hnf6p/
06:35ro_stfeature detects and media queries to control mouse vs touch and the display size
06:36naegpiranha: it's almost 1:1, but unidiomatic, functional python
06:36naegthe clojure one: http://bpaste.net/show/s5aUgEV54mHZ9CGx5ALo/
06:36naegpiranha: btw, could you take a look at create-world in the clojure one? I'm unsure whether that's good like that. Tried to combine empty-board and populate into one function
06:37ro_stand i'm off
06:41Sgeo:
06:42SgeoThe entire Clojure monad community is wrong. I am going to fix their wrongness.
06:43hyPiRionSgeo: What did you expect, we are a bunch of conservative programmers.
06:47ejacksonwho you calling a programmed conservative ?
06:47ejackson:p
06:49SgeoAt a first attempt (I don't have a repl open):
06:52Sgeo(defn m-lift-fn [fun & args] (apply fun (m-seq args)))
06:52SgeoHmm, maybe that needs to be defmonadfn and not defn
06:56hyPiRionejackson: ;)
06:57SgeoWait, that doesn't quite do it
07:00SgeoI think I could just wrap it in m-result
07:01Sgeo(defmonadfn m-lift-fn [fun & args] (m-result (apply fun (m-seq args))))
07:02Sgeo...I suspect that that's horribly broken, actually
07:02SgeoEven though the little typechecker in my brain thinks it's good.
07:07SgeoI need to think a bit more.
07:08ejacksonSgeo: aaah yes, the often heard call of the monad-bird.
07:09SgeoFor what it's worth, I'm pretty sure implementing tardis-t will require a new macro and changes to the current ones
07:09SgeoSince it only works with MonadFix monads
07:09SgeoBut right now I'm thinking about the little problem
07:22SgeoI think I know how to do it
07:22SgeoBut it's probably inefficient
07:22Sgeo(At least the way I have in mind)
07:41erwagasoreHi, I am using ring for a web app and I am getting this exception in repl "IllegalStateException not-found already refers to: #'ring.util.response/not-found in namespace: onwings.core clojure.lang.Namespace.warnOrFailOnReplace (Namespace.java:88)"
07:41erwagasoreNeed help
07:42piranhanaeg: eh, sorry, a bit busy right now :(
07:42piranhabut I'm interested anyway, will read code a bit later :)
07:42gerryxiaocemerick: does lein hard-coded "localhost" in?
07:43cemerickgerryxiao: for?
07:43gerryxiaoi do "lein repl",i got "couldn't bind to address" error
07:44gerryxiaobut after change /etc/hosts, set localhost to 127.0.0.1,it works
07:45cemerickoh, interesting
07:45cemericksomeone else had that error yesterday
07:46cemerickgerryxiao: yes, localhost is the default
07:47cemerickYou can set 127.0.0.1 here: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L129
07:48cemerickHonestly, I don't actually know the difference between 127.0.0.1 and localhost. Something to do with network interfaces and such.
07:50gerryxiaoi have changed localhost to othername in my archlinux
07:51cemerickgerryxiao: what was it resolving to previously?
07:52gerryxiaolocalhost can't be resolved
07:52gerryxiaolocalhost not equal 127.0.0.1
07:53cemerickreally? `host localhost` yielded nothing prior to your changing /etc/hosts?
07:54Bronsahmmm.
07:55Bronsawhat's the point of hasheq?
07:56gerryxiaohost? i have no host command
07:56cemerickhrm, ok.
07:56gerryxiaoping localhost not work previously
07:57cemerickOK; isn't that generally a problem?
07:57gerryxiaono problem but "lein repl"
07:57gerryxiao:)
07:58gerryxiaohostname is better than localhost
07:59gerryxiaoi think
08:00gerryxiaoin project.clj :host 0.0.0.0 option do what job?
08:02cemerickgerryxiao: that's just an example
08:02cemerickYou can set it to anything, so "127.0.0.1" should fix things for you without your having to change /etc/hosts
08:02gerryxiaook,thx
08:03SgeoDoes Clooj handle Leinengen stuff?
08:17SgeoOh, I think my original code would work
08:18SgeoNo it wouldn't, type error
08:21Sgeo(defmonadfn m-lift-fn [f & args] (m-bind (m-seq args) (partial apply f)))
08:21SgeoWait, no
08:22Sgeo(defmonadfn m-lift-fn [f & args] (m-bind (m-seq args) #(m-return (apply f %))))
08:23Sgeooops
08:23Sgeo(defmonadfn m-lift-fn [f & args] (m-bind (m-seq args) #(m-result (apply f %))))
08:23SgeoCan't imagine why I'd possibly call it 'return'
08:37SgeoSomeone please ping me if jim comes in here?
08:39mikemhi, when I run `lein outdated` I get the error "Fallback to *.zip also failed [...] no segments* file found in org.apache.lucene.store.NIOFSDirectory" -- I just added lein-outdated to my ~/.lein/profile.clj. What's going on? Do I need to set anything else up?
08:45tomojmikem: `lein version`?
08:47tomojhmm
08:48SgeoOh hey I can
08:48mikemtomoj: 2.0.0-preview9, Java 1.6
08:49tomojmikem: it looks like a problem with the maven lucene indices..
08:49tomojmaybe try deleting ~/.lein/indices ?
08:50tomojor maybe a repo you use is causing trouble
08:54Sgeohttps://github.com/Sgeo/algo.monads/commit/65169fed45c10d604b5ab616c400e98c7d35ed16
09:00mikemtomoj: I removed the indices and am re-running lein outdated in a project... it's taking a while. will keep you updated :-)
09:07SgeoDo people get notified when someone forks their project on github?
09:22RonnieDkI'm trying to setup a clojure development environment on Windows for the first time. I managed to get lein self-install downloading leiningen-2.0.0-preview9-standalone.jar but now when I run, say, lein version I get an error: Could not resolve dependencies. I see a few bug reports with a similar wording. Is there an obvious workaround?
09:22RonnieDkmaybe not use leiningen-2.0.0?
09:23majykI also couldn't get preview9 to work, same error. I went back to preview8
09:23tomojsame error here I think too
09:23tomojfor me, the fix was to go into a directory with a lein2-compatible project.clj and run it once
09:23tomojthen after that it works
09:24xeqi_using https://raw.github.com/technomancy/leiningen/2.0.0-preview8/bin/lein will get you preview8
09:24mikemtomoj: ok, looks like there's a dependency in my project which messes lein outdated up. it works fine in the leiningen repo
09:24xeqi_I have a feeling preview10 will be out soon
09:24mikemtoo bad the error message doesn't say which
09:25SgeoI want the person I forked from to see my code but don't want to say "my code's actually usable"
09:25majyktomoj, I just tried what you said and it does indeed work. Thanks!
09:25SgeoBecause I didn't test it _at all_
09:26xeqiSgeo: I get messages when my projects are forked, but if I want to keep track of work on a fork I have to go watch it
09:26Sgeoxeqi, ah, ok
09:26SgeoAll I did was add one function, that I believe should replace a macro.
09:26RonnieDkpreview8 works for me. Thanks
09:27RonnieDkor may not entirely. Some artifacts could not be found
09:29SgeoBut honestly, the entire library should be rethought.
09:30SgeoIt's too monad specific.
09:30SgeoThere are useful non-monad functors and applicatives.
09:34SgeoOh hey, jduey already did what I was complaining about not being the case for the past day.
09:42dhmSgeo: (re: don't want to say "my code's actually usable") make a feature/unstable/test branch
09:45SgeoIs there a way to effectively say "If something implements this protocol, it implements this other protocol via this code"?
09:47xeqiSgeo: I dont know of anything
09:47wjchi
09:47SgeoDarn
09:48wjcI've got a clojurescript question, is this the right place?
09:48SgeoMaybe I should describe the use case (fixing jduey's library)
09:48antares_wjc: yes, CLJS is discussed here
09:48xeqiwjc: yes
09:48wjcnice
09:48wjcright
09:48wjcso I'm using cljsbuild
09:48SgeoAll Monads are Applicatives, and all Applicatives are Functors. But not all Functors are Applicatives and not all Applicatives are Monads.
09:48wjcand i've declared 2 js files as externs
09:49wjc3 files
09:49wjcjquery, jqtouch, and jqtouch-jquery
09:49SgeoIf something is a Monad, then an implementation for the Applicative and Functor abilities can be automatically derived.
09:49wjceveryting works well on a simple build
09:49wjcbut if I switch optimizations to advanced
09:50wjcI get an infinite loop
09:50SgeoHowever, at the same time, it should be possible to implement non-monad applicatives and functors.
09:50wjcwhich spews js code
09:50wjcon stdout
09:50wjcwhat could I have missed?
09:50SgeoIdeally, monads should be definable by implementing only the Monad protocol, and the Applicative and Functor defintions filled in.
09:53xeqiSgeo: you could rite a defmonad type macro do implement the correct protocols with default implementation, or perhaps use multimethods and derive to create a heirarchy
09:54xeqibut theres no builtin peice for protocols to do implementation sharing or heirarchy
10:00nz-I am getting this exception when running lein cljsbuild once: java.lang.RuntimeException: No such var: clojure.core/require-macros
10:07nz-the offending code is basically this: (ns ruuvi-ui.app (:require [enfocus.core :as ef]) (:require-macros [enfocus.macros :as em]))
10:08nz-the require-macros thing is a part of the cljs but it is not found when compiling
10:09wjcshould I be using :foreign-libs instead of :externs?
10:28xeqinz-: is your file named .clj ?
10:28xeqiinstead of .cljs
10:32john2xhow do I turn [:a :b :c] [1 2 3] into {:a 1 :b 2 :c 3}?
10:33jeremyheilerzipmap
10:33jeremyheiler&(zipmap [:a :b :c] [1 2 3])
10:33lazybot⇒ {:c 3, :b 2, :a 1}
10:34jeremyheilerjohn2x^
10:38john2xthanks!
10:39lozengedhi, am trying to use aset in conjuection with map, and it seems like the call to aset is being skipped
10:39lozenged(let [ar (double-array 1 0)]
10:39lozenged (map (fn [x] (aset ar 1 x)) (list 5.5))
10:39lozenged (vec ar))
10:40hyPiRionlozenged: map is lazy, enforce with doall
10:40nz-xeqi: ah, that was it
10:40hyPiRionor doseq, even better
10:40lozengedaha, cool thanks
10:48nz-(inc xeqi)
10:48lazybot⇒ 1
10:52dpritchettMorning #clojure
10:52jeremyheilermornin'
11:03dpritchettI'd like to be able to refer to clojure.repl/doc from within any namespace at the repl. Is that a pipe dream?
11:18dpritchettI guess I could put some sort of self-referential workon macro in ~/.lein/user.clj
11:25jeremyheilerdpritchett, i thought clojure.repl/doc was there by default?
11:29dpritchettjeremyheiler: it seems to go away when i switch to a new namespace
11:29dpritchettthat is, it's only availabe in the user namespace
11:29dpritchettbut if i try (ns something-else.core) then i have to refer to doc as clojure.repl/doc
11:29ejacksonjeremyheiler: used to be, but not for a while.
11:29jeremyheilerit seems to be there for me in my lein2 repl
11:30jeremyheiler(implying I already changed the ns)
11:30dpritchettI got this far: https://gist.github.com/3467119
11:31jeremyheilerwhat repl are you using?
11:31dpritchettThat lets me have access to .repl/doc from any namespace without having to explicitly reference in the source files
11:31dpritchettlein repl
11:31jeremyheilerlein2 ?
11:31dpritchett1.7 i think
11:31dpritchettI didn't pull from source I just do the occasional self-install
11:32dpritchett1.7.1
11:32jeremyheilerah, ok. well, lein2's repl works like you want
11:33dpritchettsweet! when does it go live?
11:33jeremyheileri've been using it for months. it's fairly stable (although the latest preview9 release seems to be causing some issues) if you want, go grab preview8.
11:36dpritchettI'll have to give it a second look, thanks
12:32dancarperhey all. messin around w/ clojure for the first time, trying to implement a sum of squares function and I can't seem to get it to click, anyone wanna help a newb out? ;) https://gist.github.com/3467601
12:35jeremyheilerdancarper: tip, use (defn foo [args] ...) instead of (def foo (fn [args] ...))
12:35mybuddymichaeldancarper: (square [1 2 3 4]) won't work with how you've defined it.
12:35mybuddymichaeldancarper: You've defined it as a binary function and you're passing it one argument (a vector).
12:36dancarperjeremyheiler: thanks will do ;)
12:36hyPiRiondancarper: I suppose you error when you do (+ (map square args))
12:36dancarpermybuddymichael: `map square seq` seems to work in that second print statement, and i thought if using & args, would make args a seq in the function itself
12:37hyPiRionI think you forgot an apply before the plus
12:37dancarperhyPiRion: i also didn't understand that
12:37jeremyheileralso (+ (map square args)) doesn't work because map returns a sequence. in this case you would want (apply + (map square args))
12:37hyPiRion,(let [square (fn [x] (* x x)) sum-squares (fn [& a] (apply + (map square a)))] (sum-squares 1 2 3 4))
12:37clojurebot30
12:38dancarpermy initial thought was that (apply + (1 2 3 4)) would return (1 2 3 4), as (+ 1) returns 1
12:38jeremyheilerno, (apply + [1 2 3 4]) is like saying (+ 1 2 3 4)
12:39hyPiRionjeremyheiler is right.
12:39dancarperahh okay cool, sorry longtime OO'er practically no experience with functional though
12:39jeremyheilernot a problem, glad to help :-)
12:39hyPiRiondancarper: no problemo, I think we've all been there ;)
13:08azkeszhi, what's the shortest clojure code that would run forever? I already have one but I'm curious of more=) might be interesting for 4clojure golfing, or is it just me that thinks so
13:09casionhow long is what you have now?
13:09azkesz7 chars
13:10azkeszstumbled on it by mistake, and it was fun=)
13:11pepijndevosazkesz, I can't think of anything shorter just yet
13:11xeqiazkesz: from a repl?
13:12azkeszyes, I don't actually know any other way to run, yet
13:12xeqiis is (range) ?
13:12xeqi*is it
13:13azkeszno but that works too ?
13:13hyPiRion,(recur)
13:13azkeszawesome
13:13casionrange is lazy, I got the feeling that his question excluded lazy seqs
13:13clojurebotExecution Timed Out
13:13xeqithats why I was wonder
13:13azkeszyeah what hyPiRion said, I had
13:14hyPiRionA less expensive one would be ##@(promise)
13:14azkeszxeqi that's why you asked if from repl, cause it evaluates even if they return lazy
13:14lazybotExecution Timed Out!
13:14azkeszI was hoping there's one with some weird chars like %
13:15azkesz,(#(= %%) 1)
13:15clojurebottrue
13:15azkesz,(#(=%%) 1)
13:15clojurebottrue
13:16pepijndevos,(#(% %) #(% %))
13:16azkeszhyPiRion, that's clever with the dereferencing promise:)
13:16clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>
13:17hyPiRionazkesz: And completely useless :)
13:17azkeszI didn't know you could call recur without loop, that's how I found out
13:17azkeszyeah but kinda fun=)
13:17pepijndevosHow do I call a clojurescript function from js?
13:18madsypepijndevos: You're not meant to
13:18xeqithe.namespace.function(..)
13:18xeqithough you have to ^:export w/ advanced compilation
13:18madsyUnless something changed since I started
13:19pepijndevosxeqi, thanks :)
13:20azkeszhyPiRion, i read that chapter about concurrency from the manning book and found it very exciting and by now i forgot most of it because I didn't try writing code, I was wondering if it would be awesome/acceptable to have examples in each clojure doc ie. (doc recur)
13:21azkeszby examples I mean like some small but functional program that illustrates the(all possible) uses of the documented function
13:22hyPiRionazkesz: well, in the nrepl, you have cdoc
13:22hyPiRionso whenever you run `lein repl` you can do that
13:22xeqiwhich pulls from clojuredocs.org
13:22hyPiRionIt's not exhaustive though, but it's good.
13:22hyPiRionoh
13:22hyPiRion,(read)
13:22clojurebot#<ReaderException clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: EOF while reading>
13:23hyPiRionWorth a try, I suppose.
13:23azkesz=)
13:23azkeszso it pulls from that site, and i need lein.bat ? for windows
13:23xeqihow are you running things currently?
13:24azkeszi have ccw+eclipse
13:25casioncould someone explain the benefits of nrepl to me?
13:26casionthe 'why nrepl?' on github doesnt exactly make sense to me
13:26xeqihmm, cdoc comes from reply.. not sure what ccw is using under the hood
13:27xeqiwell, cdoc really comes from cd-client, which reply uses
13:27azkeszxeqi, i don't have either cdoc or reply in ccw's repl, I'll try get that lein.bat and see or maybe i should get that lein .jar which is v 2.0
13:27dnolenxeqi: pepijndevos: that's not true, your have ^:export
13:27xeqisorry, reply is the repl frontend lein uses
13:27dnolenyou have
13:27dnolenxeqi: pepijndevos: re calling CLJS from JS
13:28pepijndevosdnolen, thanks :)
13:29pepijndevosIs it recommended to use the closure library? And what are some good examples?
13:30azkeszxeqi, i see that leiningen-2.0.0-preview9-standalone.jar has "reply" inside the .jar :)
13:30dnolenpepijndevos: Closure is of uneven quality. Low-level stuff seems good, not sure about widgets or higher level abstractions.
13:31dnolenpepijndevos: transports, math, date, string, and various things to abstract away browser differences is very solid.
13:31dnolenpepijndevos: but I wouldn't touch their canvas wrapper - it's the pits.
13:32pepijndevosdnolen, I want to write a contenteditable editor, so should I avoid their widgets? There are some browser inconsistencies there too
13:33pepijndevosther eis this thing
13:33pepijndevoshttp://closure-library.googlecode.com/svn/docs/class_goog_editor_ContentEditableField.html
13:33dnolenpepijndevos: I haven't tried their editor so can't say - might be good?
13:33xeqicasion: the benefits compared to the previous repls?
13:33pepijndevosok, i'll try
13:33dnolenpepijndevos: try it, doesn't usually take long to figure out if it's worth it or not.
13:33casionxeqi: yes, assuming I'm asking a reasonable question
13:34jmlis there a way to tell if I'm requiring any names that I'm not using?
13:36xeqicasion: it splits the repl server from the repl frontend, so that lein, emacs, vim, ccw can all talk to the same backend
13:36dnolenjml: not really, but perhaps things are moving along (scape, core.logic) such that those tools are not that far off.
13:36xeqiinstead of each trying to write there own repl
13:36jmldnolen: cool, thanks.
13:36casionxeqi: ok, that makes more sense
13:37xeqiaslo, it allows injecting new functionality; for example piggieback is a middleware to turn it into a cljs repl
13:37azkeszawesome, (cdoc recur) is showing examples, thanks hyPiRion and xeqi
13:38xeqidrawbridge allows you to connect over http(s), for places like heroku
13:39azkeszit is much better just going at the site, easier copy/paste (in pindows)
13:44casionhmm, seems not worth my time to mess with nrepl then (yet?)
13:45FrozenlockI'm trying to use noir-cljs. But server can't even start, it chokes on `(cljscript-test.cljs.core/start mode cljs-options) ' on my server.clj. Do I need to require something new in the server.clj when using noir-cljs?
13:46FrozenlockOh wait-
13:47Frozenlocknvm
13:48azkesz,(cdoc recur)
13:48clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: cdoc in this context, compiling:(NO_SOURCE_PATH:0)>
13:49azkesz,(use 'cd-client.core)
13:49clojurebot#<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate cd_client/core__init.class or cd_client/core.clj on classpath: >
13:50pepijndevosdnolen, So far no good. That is, I can't figure out how to tell leiningen or cljsbuild or clojurescript or closure compiler to require goog.editor correctly.
13:50azkeszso loop rebinds like let (serially?) but recur rebinds in parallel ? right?
13:50dnolenpepijndevos: ask on the ML other people have done this.
13:51dnolenpepijndevos: or check StackOverflow too.
13:51dnolenpepijndevos: not necessarily the editor but other UI widgets.
13:51azkeszwell actually makes sense, nvm=)
13:53pepijndevosclojurescript already includes cosure right? Or do i still need it as a dependency? A lot of the stuff I am reading downloads clojurescript and everything manually
13:57shanmuHello, I am tring out nrepl.el in emacs, how do I quit the repl? , does not seem to work (like in slime). Can someone please help?
13:58shanmuHello, I am trying out nrepl.el in emacs, how do I quit the repl? ,
13:58shanmu does not seem to work (like in slime). Can someone please help?
14:01shanmuhi
14:01shanmuis there full document on exiting nrepl repl from emacs, started using nrepl-jack-in?
14:02pepijndevoswhy does requireing goog.dom work fine, but not goog.editor?
14:06scalabl3i'm new to clojure, anyone what does this error usually means? UnsupportedClassVersionError clojurewerkz/spyglass/OperationFuture : Unsupported major.minor version 51.0 java.lang.ClassLoader.defineClass1 (ClassLoader.java:-2)
14:07antares_scalabl3: Spyglass has some java bits and was compiled for JDK 6
14:07antares_you probably have 5
14:07shanmuscalabl3: that means your java version is older than the class you are trying to run
14:07scalabl3ah
14:07scalabl3let me check
14:08shanmuanyone for nrepl.el help, please?
14:08antares_scalabl3: actually, 51 means JDK 7
14:08antares_so I guess I did not specify any JDK version
14:08scalabl3yeah i have build 1.6.0_33-b03-424-11M3720)
14:08antares_it's easy to correct, there is no JDK 7-specific code
14:08jaleyam I right in thinking there's no function to add to tail of a sequence? just conj to a vector?
14:08scalabl3oh are you the author antares_?
14:08scalabl3:)
14:09scalabl3just standard mac jdk default here
14:10antares_scalabl3: I am
14:11antares_scalabl3: pushed 1.0.1 compiled for JDK 6. You can get JDK 7 for OS X from java.com.
14:11scalabl3i am running this example by my co-worker analyzing reddit with clojure/spyglass/couchbase: https://github.com/apage43/reddalyzr
14:12scalabl3sweet
14:12scalabl3so i update the project.clj with 1.0.1 then right?
14:13antares_scalabl3: correct
14:13xeqishanmu: question?
14:13scalabl3antares_: tks! and you can ignore my googlegroup post hehe, same thing
14:14shanmuxeqi: Is there a clean way to disonnect/quit the repl in nrepl.el?
14:15shanmuxeqi: I started using nrepl-jack-in
14:15xeqikill *nrepl-server* buffer
14:15pepijndevosDo I need to tell leiningen I want google closure? It just plain not working.
14:15shanmuxeqi: thanks! I was hoping there might be a cleaner way than that :)
14:16scalabl3antares_: can i do sasl? so I can specify a bucket?
14:16xeqipepijndevos: are you using lein-cljsbuild ?
14:16pepijndevosxeqi, yes
14:17antares_scalabl3: you will need to use Java interop for that right now. I haven't gotten to full Couchbase support. Can you not specify buckets w/o SASL?
14:17scalabl3yeah i think so, just don't know spyglass syntax for that, in ruby memcached gems generally the way is to use bucket-password combo
14:18scalabl3antares_: don't actually need to specify password, just don't know syntax
14:18antares_scalabl3: http://code.google.com/p/spymemcached/wiki/Examples
14:19antares_scalabl3: (net.spy.memcached.MemcachedClient. servers "bucket" "password")
14:20antares_then use it as you would a client instantiated via spyglass/bin-connection and such. See http://clojurememcached.info
14:20antares_hm, I realize that the function that builds a list of servers from Clojure collections is private
14:21Frozenlocknoir-cljs is killing lein cljsbuild o_O If I add noir-cljs to the dependencies, it can't compile :(
14:21antares_oh well, I guess I will have to figure out how to run couchbase now and add a few forms or fns for it
14:22antares_scalabl3: do I need Couchbase Server 1.8?
14:23scalabl3antares_: yeah it's the stable one, 2.0 is still unstable (pre-beta)
14:23antares_scalabl3: also, if you just need a good key/value store, consider using http://clojureriak.info and Riak. I will improve Couchbase support regardless but I really did not expect a newbie needing "nice" support for it right now.
14:24antares_ok, downloading
14:24scalabl3antares_: you don't have to do it now :) i am mostly curious
14:24scalabl3i work for Couchbase, lol
14:24antares_scalabl3: ah :)
14:24antares_that changes everything
14:25scalabl3i do sample apps mostly in ruby/rails/eventmachine, but getting into jruby and clojure now
14:25antares_scalabl3: I added Couchbase support to the readme after one of your folks helped me get CI running against it on travis
14:25antares_I don't know about JRuby but Spyglass and I guess just about any JVM language uses SpyMemcached
14:26scalabl3yep
14:26antares_scalabl3: I need to make sure memcached is not running before I start couchbase, right?
14:26scalabl3well for couchbase you can also use Couchbase Java SDK
14:27scalabl3antares_: oh, yeah probably, same ports
14:27scalabl3antares_: couchbase *is membase server + persistence
14:27antares_wow, it is a Mac .app? that's unexpected :)
14:27scalabl3you can drop it in as a replacement, will work the same
14:27antares_scalabl3: is there a binary package I can run in the shell? :)
14:28scalabl3you mean to start/stop?
14:28antares_yes
14:28scalabl3there are command line tools, right click couch icon in menu to install, i think, i am running 2.0 on this machine
14:28scalabl3hold on, let me check my other machine
14:29antares_scalabl3: ok, I think I have it running
14:30scalabl3k
14:30scalabl3antares_: https://www.couchbase.com/docs/couchbase-manual-1.8/couchbase-admin-cmdline-couchbase-cli.html
14:31scalabl3oh doesn't have start stop for mac, i guess you just quit/start it
14:31antares_scalabl3: yeah, I can always kill -sQUIT it
14:31scalabl3yeah
14:32antares_ok, give me 15 minutes to look at SpyMemcached source and see what's the best way to support Couchbase-specific connections
14:32antares_scalabl3: does couchbase use binary protocol?
14:32antares_or both? what do people typically use?
14:32scalabl3antares_: dude that's super cool, i was just trying to get a sample to run, you should blog about it after and I can promote it
14:32scalabl3yes
14:33scalabl3memcached protocol
14:33antares_scalabl3: I understand. But do most clients use binary or text protocol primarily?
14:33scalabl3binary
14:33antares_ok
14:33scalabl3binary much faster
14:33scalabl3i think we removed REST services in lieu of using client lib's with binary
14:34scalabl3we still have REST mgmt services tho
14:36scalabl3our founder wrote spymemcached :)
14:36scalabl3one of our 6 founders
14:39antares_scalabl3: apparently the code in the wiki is outdated. I believe Couchbase-specific bits were removed from SpyMemcached. I need to investigate SASL support a bit more, worst case scenario would be to have an optional dependency on the CB Java library and a new namespace in Spyglass
14:42antares_scalabl3: yup, found the very same example in your Java client. I am curious if I can just use the CB client for Memcached…
14:42antares_it's not a big deal to have one more dependency or have an optional dependency but it is such a small client that I would prefer only have really essential deps
14:42scalabl3sure, of course
14:43scalabl3not sure about using CB client for a memcached tho, there may be a few things that change over time (might work now, but not later)
14:43scalabl3memcached client -> couchbase = yes, couchbase client -> memcached = not sure
14:44scalabl3hehe
14:44scalabl3i can ask dustin tho
14:44antares_scalabl3: FYI, it is really painful to find Maven dependency in the Java client docs
14:44antares_github README sends me to some getting started guide that sends me to another guide that sends me back
14:45scalabl3grrr, yeah we're working on our docs, many improvements coming
14:45scalabl3let me make a note of that tho
14:45antares_make it dead obvious, any non-trivial project will use some kind of dependency management tool that uses Maven for dependencies :)
14:46antares_I think step 1 here http://www.couchbase.com/develop/java/current should also provide info about Maven artifacts, right after the paragraph about downloads
14:46antares_LOL. search.maven.org suggests spelling correction for "couchbase" to "asyncbase couch"
14:47scalabl3hehe is there such a thing?
14:48antares_scalabl3: probably not. But you never know, kids with their async coffeescripts these days…
14:48antares_scalabl3: ok, finally found the repo :) http://files.couchbase.com/maven2/
14:49scalabl3i just sent all that to our java sdk peeps and doc peeps
14:51scalabl3i gotta take my kids to the museum (my wife is rolling her eyes at me), i'll be back in a few lol
14:51antares_scalabl3: have fun. And thanks for reminding that I need to finish Couchbase support.
14:51scalabl3i use bouncer so feel free to send me notes or suggestions
14:51scalabl3i'll pass them on, either on channel or pm, either or works
14:51scalabl3tks
14:51scalabl3!
15:14FrozenlockIs there a way to get the details of a dom object in cljs? Say I have a paragraph in the variable $p, I would like the repl to give me more info than just #<[object Object]>.
15:21wireshello! is there some way to store and manipulate a clojure datastructure on disc instead of in memory?
15:23drewrwires: carbonite maybe
15:23drewrdon't know about manipulation, but it's got the storage part
15:23wiresi see, yes so this is not really what i'm looking for
15:24wiresThe problem is that the data potentially doesn't fit into memory
15:24wiresso ideally I'd just work on disk.
15:24drewrsave sexps to files and stream them lazily
15:25wiresis this possible?
15:25wiresI understand that I could reimplement the foundational clojure interfaces, but then my whole application is running from disc..
15:25drewrecho '{:foo 1}\n{:bar 2}' > /tmp/baz .... user> (map read-string (line-seq (io/reader (io/file "/tmp/baz"))))
15:25lazybot'{:foo 1}\n{:bar 2}' > /tmp/baz .... user> (map read-string (line-seq (io/reader (io/file "/tmp/baz"))))
15:25wireshehe, thank you lazybot
15:26drewryou don't need io/file there, btw
15:26wiresok, but this processes line by line
15:27drewrright
15:27drewrI don't know of a disk-backed implementation of clojure data structures
15:27wiresok
15:27drewrseems like it would be too slow to be useful
15:27wiresWell, it would basically be an immutable database
15:28wireswith proper caching and 'page management' it should be okay
15:29Frozenlockwires: You can also use the many clojure wrapper for databases.
15:29FrozenlockI like congomongo very much. It transforms clojure map data to their mongodb counterparts transparently.
15:30wiresFrozenlock, hmm, could you suggest one? How does this play with the persistency of the datastructure?
15:30wiresAh congomongo
15:32antares_scalabl3: I am hitting http://www.couchbase.com/issues/browse/JCBC-91 :( with a perfectly fine URI :/
15:33wireshmm, ok this is nice, but I was really hoping that I could say, here if have object a_0, now here is a manipulated version of it, please store the both efficiently.
15:33wiresbasically mirroring the 'trie' storage that is used in memory
15:34wiresof course I could dump every version, but ideally I'd like to share data
15:41Frozenlock"And there you have it - a complete overtone controller in about 20 minutes." -ibdknox
15:41Frozenlock... and it took me a week to finally understand everything. Sheeeesh!
15:42eriderdo you need to know java to use clojure
15:42FrozenlockI learned java using clojure. So no, but it can be really helpful.
15:43FrozenlockEspecially if you want to use java libraries
15:48eriderok thanks
15:55FrozenlockAny clever use of jayq (or cljs in general) I could look at to help me understand this wild environment? :P
16:02uvtcRan into something odd. Not sure if it's a bug. In the repl, if I try `(def x ^{:a 1} 42)`, I get an exception (right, since I can't assign metadata to the value 42).
16:02uvtcBut then after that, if I try something else, I get a 2nd exception message.
16:03uvtcFor example, if I then just type in "hi" at the repl, I get more exception information, as if it was left over from the previous error.
16:04uvtcMaybe this is something better posted to the ML. Also, it's pretty quiet around here on weekends. :)
16:14uvtcOk, posted to ML.
16:22hyPiRionit's rather silent here as of now, yes.
16:22FrozenlockOn weekends, no one can hear you scream. Tan tan taaaaaaan
16:22hyPiRionuvtc: yeah, I can reproduce it.
16:22hyPiRionso it's not just you
16:45FrozenlockIs there an idiomatic way to `toggle' something in cljs? For example, jayq.core/fade-out and jayq.core/fade-in. How could I make a `fade-toggle' function?
16:49gfredericksyou'd have to detect the current state, right? via the css "display" attribute maybe?
16:50gfredericksafter that it's just a function with an if in it.
16:50gfredericksunless you want to do something complicated with "in progress" detection for animations
16:50FrozenlockI'm looking for a more general solution. Perhaps a function that takes two other function (each with an opposite effect) and the use of an atom?
16:51gfredericksoh so you track the state independently
16:51FrozenlockYes
16:52gfredericks(fn [f1 f2] (let [a (atom false)] (fn [] (if @a (f1) (f2)) (swap! a not))))
16:52gfredericksmaybe true would be a more sensible default there
16:52FrozenlockYou don't need to define the atom outside the function?
16:52gfrederickss/default/initial
16:52gfrederickswhat I gave is a function that returns the toggler function
16:53gfredericksso the atom is defined outside the toggler
16:53gfredericksbut inside the toggler-factory\
16:53gfrederickser, togglerFactoryBean
16:54FrozenlockThat's really nice! Thank you :)
16:55FrozenlockBut is there any risk for `a' to clash with another `a' in the same namespace?
16:55gfredericksnp
16:55gfredericksno it's a local
16:55gfredericksI mean it could clash with something external but that doesn't matter because no other a is being used there
16:56gfredericksso you (defn toggler-factory [f1 f2] (let [a (atom true)] (fn [] (if @a (f1) (f2)) (swap! a not))))
16:57gfredericksand then (def fade-toggle (toggler-factory fade-in fade-out))
16:57gfredericksI guess that doesn't work if you need to pass args to fade-in/fade-out
16:57FrozenlockI'm going to try that immediately :)
16:57hyPiRionfns all the way down.
16:57Frozenlock(defn toggler-factory [f1 f2 arg]....
16:57gfredericks(defn toggler-factory [f1 f2] (let [a (atom true)] (fn [& args] (apply (if @a f1 f2) args) (swap! a not))))
16:58gfredericksI guess if the arg is always the same you can give it to the factory that way
16:58FrozenlockOh no it's even better without the args hardcoded!
16:59hyPiRionHmmm
17:00gfredericksI guess factories are nouns. make-toggler would probably be better.
17:00gfrederickstogglify
17:00gfrederickstogglomerate
17:00gfredericksticlke
17:00Frozenlockgfredericks: It works flawlessly!
17:01Frozenlock(def toggle-fade (toggler-factory j/fade-in j/fade-out))
17:01FrozenlockAnd then (toggle-fade any-dom-object)
17:01gfredericksexcellent
17:01hyPiRionWell, that's a bit fast.
17:01amalloygfredericks: you probably ought to (a) use the atom in a thread-safe way, and (b) return the result of f1/f2, not of the swap. so like (fn [& args] (apply (if (swap! a not) f1 f2) args))
17:02hyPiRionamalloy: And even then it really depends on what you want the toggle to do if the function throws an error.
17:02gfredericksamalloy: do we have to think about thread-safety in JS yet?
17:02hyPiRionShould it skip the toggle, or should it retry the same fn?
17:02amalloygfredericks: it builds character
17:02gfredericksamalloy: hard to take it seriously when you can't use refs
17:02Chousukewhy do you need to call it a factory, wouldn't just "toggler" be enough? :P
17:03uvtcIt appears to me that there are two separate ways to add metadata to a function: (A) put it inside a ^{...} right after the `defn`, and (B) put it inside a hash-map after the docstring but before the arg vector. Why are there 2 ways to do it?
17:03gfredericksuvtc: s/function/var/
17:04uvtcgfredericks: right. Thanks.
17:04amalloygfredericks: also, that function you wrote ought to work fine in jvm-clj, except that you're not being thread-safe. looking at the code just sets off all kinds of alarm bells in my head
17:04uvtcBut why two similar ways to do the same thing?
17:04amalloyuvtc: my understanding is that in early versions of clojure, reader metadata was harder to use
17:05uvtcOh, ok. Historical reasons then. Thanks.
17:06gfredericksamalloy: I did think of it at first but wasn't sure I could be thread-safe without refs, but your example is quite good.
17:06bosieis there a way to write this quicker: #(or (= 0 (mod %1 3)) (= 0 (mod %1 5)))
17:06hyPiRionbosie: quicker as in more performant?
17:06bosiehyPiRion: less code
17:06gfredericks#(zero? (* (mod % 3) (mod % 5)))
17:07amalloygfredericks: for a single reference, you never need refs; you can build thread-safety with just an atom
17:07gfredericksamalloy: how would you implement a queue with an atom?
17:07bosiegfredericks: creative
17:07hyPiRion#(= 0 is even shorter.
17:08uvtcbosie: but I think your way explains to the reader more what you mean. :)
17:09bosieoki
17:09gfredericksthere is also (some #{0} [(mod % 3) (mod % 5)])
17:09uvtcbosie: btw, I think when you're only using one arg, it's more typical to use % instead of %1
17:09uvtc.
17:10bosieuvtc: esp. with modulo that seems… risky ;)
17:10gfredericksha
17:10uvtchehe
17:11amalloygfredericks: put an extra slot in the atom for storing the return value: https://gist.github.com/3471005
17:11Frozenlockgfredericks: I just realized the state is associated with the function, not with the argument. So I can't use the same function for 2 different items.
17:11amalloyFrozenlock: that's why it's a factory
17:12gfredericksamalloy: that is clever-ass. I'm glad I axed.
17:12bosiegfredericks: looking at the last code you put up, some takes a predicate
17:12rolypIs this a good place to get cljsbuild help?
17:12bosiegfredericks: predicate being what?
17:12gfredericksFrozenlock: excellent point. move the args to the top I guess.
17:12gfredericksbosie: sets can be predicates
17:13hiredmanamalloy: there still thread safety issues there
17:13gfredericksmostly predicates
17:13amalloyhiredman: you mean that take doesn't block? yes, i'm not implementing a whole LBQ
17:13hiredmanamalloy: someone else can call take before you look at ret
17:14technomancyanyone know an https host using a self-signed cert off the top of their head?
17:14gfrederickshiredman: I was just looking for how you can use an atom and return something other than the new value
17:14amalloyhiredman: so?
17:14gfrederickshiredman: aside from taking-when-empty I think it's good
17:14amalloyi'm not re-dereffing it, i'm using the return value from the swap
17:14hiredmanamalloy: ah, I see
17:15gfredericksonly minor downside is garbage collection
17:16amalloygfredericks: ?
17:16gfredericksamalloy: the last thing popped off can't be GC'd until take is called again
17:17gfredericksI guess you could get around that with an extra swap at the end
17:17amalloygfredericks: you can swap! the :ret back out
17:17Frozenlockgfredericks: To the top? Meaning creating a new toggling function for each item?
17:17gfredericksFrozenlock: (defn make-toggler [f1 f2 & args] (let [a (atom false)] (fn [] (apply (if (swap! a not) f1 f2) args))))
17:18FrozenlockOk so yes, create a function for every item.
17:19gfredericksyeah; otherwise you'd have to keep the state somewhere else
17:19gfredericksor have an internal map from arguments to state, which seems a little gross
17:19amalloyFrozenlock: why not just use jquery's .toggle?
17:19Frozenlockamalloy: Because I didn't know there was such a thing...
17:19FrozenlockStill it's a great exercise :)
17:20amalloyi just googled jquery toggle
17:22dreishWell this sucks. I just found out "lein test" has been testing stale pre-built class files for the last few months. Why would it do that?
17:22dreishWhat's the point of running unit tests if it isn't testing the latest code?
17:25Frozenlockamalloy: How would that be called from cljs? js/jQuery.toggle doesn't seem to work.
17:26hiredmandreish: there are issues with class files generated from defrecord/deftype, generally the runtime compares the last modtime between the source (.clj file) and the compiled class file to determine which to use, but for defrecord and deftypes it just fails to do that, so if you are aot compiling you can end up with stale class files
17:27dreishThis affected everything, not just the two small defrecords I use. I had renamed the whole project a few months ago, so the entire namespace that the test file was bringing in no longer existed.
17:28dreishIt seems to me lein test should run lein clean first, and if someone (for some strange reason) needs otherwise, there should be an additional test-without-clean target.
17:28hiredmanmaybe take it to #leiningen
17:30hiredmanI've never seen anything like that persist for that long, so I am inclined to believe you were doing something out of the ordinary
17:30dreishI was not doing anything exotic.
17:31dreishUnless renaming all the namespaces counts.
17:31ejacksonaot will eat your unborn first son.
17:31ejacksonavoid it.
17:31hiredmanas I said, I've seen transient issues like that, that are generally fixed by restarting the repl
17:32dreishI *never* asked it to AOT compile anything.
17:32dreishIt just does it.
17:32dreishHell, I've rebooted at least five times since the rename.
17:33hiredmananyway, as you issue seems to be with lein, I'd try #leiningen, although I am sure technomancy will explain to you how it is actually clojure's fault and he is working tirelessly to hack around it
17:33hiredmanyour
17:33technomancy:main implies AOT since uberjars don't work without it
17:33dreishI do have a :main
17:33technomancyyou can do :main ^:skip-aot my.name.space
17:36hiredmandreish: it sounds like you didn't rename the namespace in your tests anyway
17:36dreishCorrect, I forgot to do taht.
17:36dreishIf I had, I'm sure it would have worked. I guess I just think it would be nice if .class files corresponding to files that no longer exist get cleaned, but I don't know how practical that is.
17:37technomancywe tried doing that for a while, but it broke a lot of protocols and records
17:38technomancymost of the time if the AOT'd version of a piece of code goes away Clojure is smart enough to fall back, but that doesn't work with protocols and records
17:39dreishI understand, I just hate it when the answer to a problem is, "Never make that particular mistake".
17:41technomancyI can't remove the ":main implies :aot" rule though I wish I could
17:41technomancybut I might be able to move that logic to only apply during uberjar
17:41hiredmanthe real answer to transient environment issues is to have a ci server doing clean builds, but that doesn't really scale down to small projects
17:42gfredericksit could, couldn't it? for a lein project couldn't configging something like that be as simple as "here is my github repo, please run `lein test`"?
17:43dreishAll I had to do to discover the problem was run "lein clean ; lein test".
17:43dreishPerhaps if there are old (>1 month?) files under classes/, warn "You have old files in classes/; consider running lein clean"
17:44hiredmantechnomancy: isn't lein supposed to automatically figure out when to run 'clean'?
17:44hiredmandreish: what version of lein?
17:44dreishLeiningen 1.7.1 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM
17:44technomancyhiredman: yeah, this is one of two exceptions
17:46hiredmanwould it really break anything if test ran clean first?
17:46dreishCould it be painful for very large projects?
17:46technomancyyeah, it would be very very slow
17:47technomancyyou can add it to :prep-tasks in the :test profile if you'd rather take the hit
17:47hiredmanah, test!
17:47dreishMy first reaction was that it should do that, but I realized that doesn't scale so well. I like the idea of warning on old files, though.
17:47hiredmandreish: have you seen test! ?
17:47dreish"lein test!" ?
17:47clojurebot,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an")) )] (testar 10 25))
17:47hiredmandreish: yes
17:47dreishNo, does that do a clean first?
17:47hiredmanit runs clean and deps first
17:47dreishAh yes, I see. Thanks.
17:48hiredmantechnomancy: have you seen https://github.com/relevance/org-html-slideshow
17:48technomancyhiredman: yeah, I think a few clojurewest talks used it
17:49FrozenlockAny only online example of the product it gives?
17:50technomancyI really really hate the org-mode code-quoting syntax, but it's better than latex
17:50gfredericksFrozenlock: https://github.com/abedra/geekfest-linux-kernel-joystick-api
17:51Frozenlockthanks
17:51technomancyhiredman: how's the hardware hacking going?
17:52hiredmantechnomancy: my beaglebone seems to have a died, so it is stalled
17:52technomancyshame
17:52hiredmanbut before it did I had a little rover I could drive around via repl
17:52technomancyat some point I want to get something like that set up for the tree house in the back yard
17:52hiredmanwith a webcam on the front
17:52technomancymaybe something that could open the locks on a trap door
17:53hiredmanit was still wired in for power and network, but that should be pretty easy to solve
17:54hiredmanit was lots of fun till I realized I wasn't going to finish before the end of my vacation
17:58emezeskeIs there an active Clojure OpenGL library out there? Penumbra looks cool, but claims to not be under active development.
18:20nvyI profess my love to you, clojurebot
18:25uvtc~clojurebot
18:25clojurebotclojurebot is a cold unfeeling genderless mechanism
18:28eriderwhen you load-file does it ns change at the repl or do you have to do something to get into the context of the file that was loaded?
18:30jeremyheileri think it depends if file you loaded changes the ns.
18:31erider(ns foo) sets it right
18:31jeremyheileryes
18:31eriderso I should be able to type foo at the repl and be in the ns right? or no?
18:32uvtcerider: try experimenting with it. :)
18:33codedreamsyes, If you type (ns foo) then your prompt will change and you will be in the foo namespace
18:34eriderthanks for the help
18:34eriderits good now
18:36hiredmanload-file will not change the namespace
18:38hiredmanload-file creates a fresh binding for *ns*, and any changes will be popped off after the file is loaded
18:47gfredericks(.set #'*ns* 0) is a great way to crash your repl
18:57jeremyheilerhiredman: what do you mean by "any changes will be popped off"? if I load-file something that sets the ns to foo, but my repl is in user, i can stil reference stuff in the foo namespace.
18:58hiredmanI mean any changes to *ns*
18:58jeremyheilerah ok, cool.
19:20gfredericks&(.set #'*ns* 42)
19:20lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!
19:21amalloygfredericks: SANBOX DENIED
19:21gfredericks,(.set #'*ns* 42)
19:21clojurebot42
19:21gfredericks,(+ 1 2)
19:21clojurebot3
19:21gfredericks,*ns*
19:21clojurebot#<Namespace sandbox>
19:21gfredericksclever
19:24uvtcWhat's a good ncurses-like library for use with Clojure?
19:24Bronsa,(do (.set #'*ns* 42) *ns*)
19:24clojurebot#<CompilerException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Namespace, compiling:(NO_SOURCE_PATH:0)>
19:26Cr8uvtc: for java there's Lanterna http://code.google.com/p/lanterna/
19:26Cr8and sjl's wrapper for it; https://github.com/sjl/clojure-lanterna
19:26uvtcAh. Right. From the "Caves of Clojure" series of articles. Thanks, Cr8.
19:27uvtcLanterna seems to be pretty actively-developed.
19:31Cr8 Hm
19:31Cr8Is there a way to make the REPL just pprint everything?
19:33gfredericksthat would be cool if repls had hooks for things like that
19:34technomancyyou mean ... a reppl?
19:34gfrederickspfff
19:34uvtcteehehe
19:35gfredericksis nrepl hookable like that?
19:35gfredericksI'm thinking a pre-read hook, a post-read hook, and a rebindable printer
19:35amalloygfredericks: clojure.repl is hookable like that
19:35technomancygfredericks: I thought you were joking
19:35gfredericksno I don't know most things actually
19:35amalloybut really a repl that pprints everything would get tiring quickly
19:36S11001001amalloy: I've run slime/cl that way; seems alright
19:36gfredericksamalloy: I see nothing in clojure.repl that looks relevant
19:36amalloymaybe it's clojure.main/repl? i forget where the entry point is
19:37technomancygfredericks: (clojure.main/repl :print pprint)
19:37gfredericksholy fishsticks
19:38technomancyyou can use clojure.main repl as an sql console
19:38technomancyeverything is replaceable
19:38technomancyexcept for loop I guess
19:43emezeskeI want a REPL that on every 17th loop interprets my input as Fortran
19:43gfredericksthat sounds surprisingly like cicadas
19:45amalloy:eval #((rand-nth [bash irb python fortran eval]) %)
19:46gfredericksamalloy: shuffle them and apply until one of them doesn't throw
19:46emezeskeamalloy: Now you've done it -- someone at my work will be enjoying a horrible, horrible prank sometime soon
19:48hiredmanI sent an email to the clojure-dev list a year or more ago asking about making it easier to embedded alternate repls in a running clojure repl (making it possible to share the *1 bindings and that sort of thing) but there did not seem to be any interest
19:49amalloyemezeske: or they'll just learn to write their programs like http://www.ioccc.org/2000/tomx.c
19:49hiredmanit is kind of neat to be able to type (sql-repl) get a sql repl, and when you exit have access to the last returned sql value in *1
19:50emezeskeamalloy: Hahah... clever hack
19:51gfredericksif somebody has domain models that seem to benefit a lot from inheritance, does that indicate s/he ought to use multimethods instead of protocols?
19:51Frozenlo`Whenever I reload the page to which I have my repl connected, it brokes the `pipes': java.net.SocketException: Broken pipe
19:51Frozenlo`Is there a way to avoid it?
19:53amalloyemezeske: when run as a shell script, it invokes make using itself as the makefile, which compiles itself as a C program
19:53amalloy(it wasn't obvious to me that it works as a shell script as well; the obvious parts are C and make)
19:54emezeskeWhoa, I didn't catch the shell script part either
19:54amalloyemezeske: it's the false task/goal
19:54hiredmanhttps://raw.github.com/gist/3422228/b97aa2e1e0e58ac35b6f768099d014f4dc0de1ac/nrepl.sh
19:55emezeskeamalloy: Damn that's tricky
19:55amalloygfredericks: on error resume next...for ruby!
19:56gfredericksamalloy: what language is that?
19:56amalloyvb
19:56scalabl3antares_ my znc crashed, but I saw you found an issue JCBC-91?
20:04amalloyoh wow, the ioccc started back up last year?
20:06scalabl3antares_: if you run/ran into more issues let me know, i'm back online
20:15emezeskeI bet a lisp obfuscation contest would be interesting
20:16amalloyemezeske: start by writing a macro that compiles C
20:16emezeskehahahaha
20:16emezeskeoh the pain
20:22michaeltomerI just started messing with Clojure last night (I've never used a lisp before). I've got a working script ( https://gist.github.com/3472710 ), and I was wondering if anyone could offer some tips on how to make it more idiomatic.
20:23michaeltomerIt should just take a moment. The script is less than 1,000 characters.
20:23hiredman~style
20:23clojurebotstyle is http://paste.lisp.org/display/81021
20:24michaeltomerI had a feeling my indentation was sub-optimal.
20:26michaeltomerWhen I start grouping the parens it starts to look cluttered. I might end up with over a half dozen parens crammed together at the end of a method. What's the accepted wisdom on that?
20:26scalabl3they should add syntax so it's like )^6
20:26scalabl3instead of ))))))
20:27Cr8I feel like that would make editing a bit janky
20:27amalloymichaeltomer: without paying attention to the file content, https://gist.github.com/3472749 is the normal way to format that
20:27nappinguse an editor that matches parens, and just let them pile up
20:27michaeltomeramalloy: Awesome, thanks!
20:27S11001001michaeltomer: you're supposed to go for new records; I've done 14
20:28S11001001michaeltomer: and indeed, there is no workable alternative to what napping suggests
20:28michaeltomerS11001001: lol. I imagine I'll adjust once I've stared at it a bit longer.
20:29S11001001michaeltomer: indentation is what matters readability-wise, and it's much easier to see the indentation flow once you throw out all the extra newlines C style adds
20:29nappingis it meant to be called with three arguments?
20:29michaeltomerS11001001: That's probably true.
20:30michaeltomernapping: Two arguments in common use, but the third (optional) argument is supplied when the function recurses.
20:31michaeltomerIs that unusual?
20:31shawnlewishow can i unify a few different namespaces into one? for example clj-time provides clj-time.core and clj-time.local and i'd like to be able to pull them in with a single require like (require 'mytime).
20:31S11001001michaeltomer: depends on whether the 3rd arg is intended to be available as external API also
20:32michaeltomerS11001001: No, I don't think I'd want it to be part of the public API.
20:32uvtc S11001001 : might be neat if one's editor would display little indentation guides (faint dotted lines) when you're lining up multiple args (and doing the usual vertical aligning of them).
20:33S11001001michaeltomer: then make a lambda and call it inside the single arity you want public
20:33S11001001michaeltomer: ((fn [...]) pub pub 0)
20:33Raynesmichaeltomer: If parentheses start to pile up in hard to read ways, just factor the function into more smaller functions.
20:34michaeltomerS11001001: Interesting. I'll give that a try. Thanks!
20:34S11001001rather, ((fn whatever [...] do-stuff (whatever ...)) whatever-args)
20:34michaeltomerRaynes: Are there any kind of guidelines on how many lines fit into a decently written Clojure function? For instance, I like my Ruby methods with 10 or fewer lines if I can help it.
20:35uvtcmichaeltomer: Also, Clojure gives you some constructs to reduce the number of nested expressions, for example, if-let instead of using `if` and `let` separately.
20:35Raynesmichaeltomer: No real guidelines. I mean, it's common sense. You'll know when your function is too long.
20:35shawnlewisbasically i want a single namespace to be a proxy to a bunch of others
20:35michaeltomeruvtc: I think I saw that in the docs. I'll read up on that. Thanks!
20:35uvtcmichaeltomer: y/w
20:35Raynesmichaeltomer: Your function is reasonable, for example.
20:36RaynesThose closing parens don't bother me in the slightest.
20:36amalloymichaeltomer: see also quot and rem instead of fooling around to get / to do what you want
20:36michaeltomerI haven't encountered rem yet. I'll look that up.
20:37michaeltomerYou guys are awesome! Thanks for all the help.
20:37gfredericks(inc you-guys)
20:37lazybot⇒ 2
20:37hyPiRion(inc you guys)
20:37lazybot⇒ 1
20:37gfredericks$karma you
20:37lazybotyou has karma 0.
20:37gfredericks$karma you guys
20:37lazybotyou has karma 0.
20:37gfrederickso_O
20:37hyPiRionhm
20:38hyPiRion$karma "you guys"
20:38lazybot"you has karma 0.
20:38hyPiRion,'(inc you guys)
20:38clojurebot(inc you guys)
20:38lazybot⇒ 2
20:38gfredericksoh the $karma is ignoring it I see
20:38xeqi$karma you\ guys
20:38lazybotyou\ has karma 0.
20:38hyPiRionheh.
20:40michaeltomer(inc amalloy)
20:40lazybot⇒ 27
20:41michaeltomer(inc S11001001)
20:41lazybot⇒ 3
20:41michaeltomer(inc utvc)
20:41lazybot⇒ 1
20:42Cr8Perhaps it should take a vector :)
20:42michaeltomer(inc Raynes)
20:42lazybot⇒ 16
20:42michaeltomerCr8: I was just thinking that.
20:43michaeltomerToo many clojurians (clojurites? clojuristas?) are helpful to only be able to provide a single argument at a time.
20:44hyPiRiongfredericks: https://github.com/jhulten/lazybot/blob/master/src/lazybot/plugins/karma.clj#L68
20:44Cr8I've used "clojurian" before.
20:44hyPiRionthat's the bummer.
20:44uvtc,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println "(inc" nm ")"))
20:44clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: nm in this context, compiling:(NO_SOURCE_PATH:0)>
20:45uvtc,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println "(inc" n ")"))
20:45clojurebot(inc michaeltomer )
20:45lazybot⇒ 1
20:45clojurebot(inc hyPiRion )
20:45lazybot⇒ 1
20:45clojurebot(inc gfredericks )
20:45lazybot⇒ 1
20:45Cr8there's a clever dan.
20:45hyPiRion$karma gfredericks
20:45lazybotgfredericks has karma 8.
20:45hyPiRionSo the space messes it up :p
20:45Cr8hm, did It swallow the space there?
20:45RayneshyPiRion: That's not the right repo.
20:46Rayneshttps://github.com/flatland/lazybot
20:46Cr8why is there even a space
20:46uvtcOoops. Yeah, should've been `(println (str ...))`.
20:46Cr8oh, right, I saw a str where there wasn't one
20:46hyPiRionRaynes: I am amazing at linking to wrong forks.
20:46hyPiRionor forks at all, for that matter.
20:47emezeskePersonally I prefer the term "clojuror", kind of like sorceror
20:47hyPiRion,(doseq [n '[foo baz bar]] `(increment ~n))
20:47clojurebotnil
20:47Cr8but not like juror
20:47Frozenlo`So there's emacs wizards and clojure sorceror? :)
20:47uvtc"clojurino" ... gets that elementary particle vibe goin' on.
20:48michaeltomerWoot, my first karma point. If video games have taught me anything, it's that karma points will make me all glow-y.
20:48hyPiRion,(doseq [n '[foo baz bar]] (prn `(increment ~n)))
20:48clojurebot(sandbox/increment foo)
20:48clojurebot(sandbox/increment baz)
20:48clojurebot(sandbox/increment bar)
20:48hyPiRionasdff.d
20:49uvtc,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println (str "(inc" n ")")))
20:49clojurebot(incmichaeltomer)
20:49clojurebot(inchyPiRion)
20:49clojurebot(incgfredericks)
20:49uvtc,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println (str "(inc " n " )")))
20:49clojurebot(inc michaeltomer )
20:49lazybot⇒ 2
20:49clojurebot(inc hyPiRion )
20:49lazybot⇒ 2
20:49clojurebot(inc gfredericks )
20:49lazybot⇒ 2
20:49uvtc,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println (str "(inc " n ")")))
20:49hyPiRionwe should just give up on this.
20:49clojurebot(inc michaeltomer)
20:49lazybot⇒ 1
20:49clojurebot(inc hyPiRion)
20:49lazybot⇒ 1
20:49clojurebot(inc gfredericks)
20:49lazybot⇒ 9
20:49uvtcthere
20:49uvtcSorry. We now resume your regular programming.
20:50michaeltomerhyPiRion: So long as I'm getting karma points, I'm a happy camper.
20:50nappingdo you want minimal numbers of coins?
20:50michaeltomernapping: We've got coins too? How many until I get an extra life?
20:52michaeltomernapping: If I get one more life, I figure that'll put me at 1.
20:59amalloymichaeltomer: https://gist.github.com/3472749 is two implementations of the same algorithm that might interest you
20:59amalloyusing language features you're not familiar with yet, but should introduce you to what is possible, at least
21:00michaeltomeramalloy: Awesome! I'll go through these with a fine-toothed comb. Thanks!
21:00michaeltomer(inc amalloy)
21:00lazybot⇒ 28
21:02michaeltomernapping: Sadly, I think I've just finally understood you last comment. For some reason I thought you were offering me coins of some unknown variety. Not sure what's wrong with my brain at the moment.
21:02michaeltomernapping: However, yes. I am trying to return the smallest number of coins.
21:08gfredericksamalloy: I spent about 7 seconds believing that gist was your first attempt at clojure
21:08Cr8ahahaha
21:13michaeltomergfredericks: am alloy just catches on quickly.
21:16hyPiRionburr.
21:17hyPiRionor very high up in the northern one
21:19gfredericksdoes the earth's angular momentum vector point north or south?
21:19gfredericksthe X-hand rule does you no good if you can't remember whether it's right or left
21:20tmcivernorth
21:20gfredericksoh good.
21:20uvtcRight-hand-rule says it points north.
21:21gfredericksis that an arbitrary choice? is there any physical reason you'd want it pointing one way rather than the other?
21:22hoover_dammgfredericks, north sometimes needs to be reset
21:23hoover_dammgfredericks, it's a feature to be able to 'reset' where north is
21:23hyPiRiongfredericks: I believe it's just practical for the matrix representation
21:24gfrederickshoover_damm: I'm talking more about rotational physics than about planetary stuff
21:24hoover_dammgfredericks, yeah I gathered that now :)
21:24uvtcgfredericks: I think everyone just agreed on a convention to make sure all the signs come out right.
21:24hoover_dammgfredericks, sorry about that.
21:24gfrederickshoover_damm: no problem; it was an interesting reminder
21:24gfredericksrotation is the 17th weirdest thing
21:28michaeltomergfredericks: What's number 16?
21:29gfrederickshigh-dimensional geometry
21:34gfrederickssomewhere on the list there is a theorem about how languages of subsequences of arbitrary languages are always regular
21:38Cr8is that ruby?
21:39gfredericksyeah
21:46technomancyreleased leiningen 2.0.0-preview10 addressing the out-of-project issues
21:47tomojgetting a 404 and `/home/tom/bin/lein2: line 180: downoad_failed_message: command not found`
21:50technomancyoh man, are you serious
21:50technomancywell, you should only be seeing that if it's already broken
21:51technomancywhat's the URL you're getting a 404 on?
21:51Cr8oh
21:51Cr8i get the same
21:51tomojcan't tell
21:51tomoj..or don't know how to tell
21:51tomojoh
21:51tomojfixed line 180, then "Failed to download https://github.com/downloads/technomancy/leiningen/leiningen-2.0.0-preview10-standalone.jar&quot;
21:51Cr8fixing the "downoad" typo nets
21:52Cr8curl: (22) The requested URL returned error: 404
21:52Cr8Failed to download https://github.com/downloads/technomancy/leiningen/leiningen-2.0.0-preview10-standalone.jar
21:52technomancyoh, my uberjar upload failed
21:52technomancythat's easy to fix; hang on
21:53mefisto`anyone have any experience with compojure + emacs + slime? I am trying to use ring-serve and the only thing I can get is 404s. I tried it with some basic stuff of my own as well as from the compojure example project
21:55technomancymefisto`: I recommend just running a -main function with a run-jetty call from slime
21:56technomancytomoj, Cr8: upload succeeded; try again?
21:56Cr8got it
21:56technomancycool
21:56Cr8lein version ✭
21:56Cr8Leiningen 2.0.0-preview10 on Java 1.7.0_06 Java HotSpot(TM) 64-Bit Server VM
21:57technomancycools
21:58tomojsomehow I got "The self-install jar already exists at /home/tom/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar"
21:58tomojbut, working
22:01mefisto`oh, nevermind I see what I was doing wrong
22:01mefisto`technomancy: thanks for answering nevertheless
22:33Frozenlo`Is there the inverse of the clj->js function?
22:54tomojFrozenlock: js->clj ?
22:54tomojcljs.core/js->clj
22:56FrozenlockOh wait you're not joking!
22:56FrozenlockIt's there! :D
22:56FrozenlockThanks
23:01FrozenlockI must be doing something wrong... #<RangeError: Maximum call stack size exceeded>
23:01tomojis the js object cyclic?
23:02Frozenlockcyclic? Calling itself?
23:03FrozenlockI don't think so, I'm grabbing a simple paragraph.
23:03Frozenlock(js->clj (first ($ :p)) :keywordize-keys true)
23:03tomoje.g. var foo = {}; foo.foo = foo;
23:03tomojthat's a dom node?
23:03amalloydom nodes are mad cyclic, aren't they?
23:03FrozenlockEhh I will go with `dunno'
23:04amalloyFrozenlock: they have parent and children references
23:05FrozenlockIs there a way to strip this down?
23:06amalloydom nodes have dozens of properties, most of which i'm sure you don't care about. just write a function that gets the things you care about and put them in a map
23:08FrozenlockI was hoping to discover these properties by looking at the resulting map... oh well
23:08emezeskeFrozenlock: Use your browser's javascript debugger/inspector
23:11WuHoUnitedDoes anybody know what the difference between the 2 jar files that leinegen produces is. One says standalone, the other doesn't
23:11FrozenlockStandalone has everything you need to run it alone :)
23:11Frozenlock(clojure is included)
23:12WuHoUnitedso the difference is just that clojure core is included?
23:12WuHoUnitedso if the clojure.jar were on my classpath then i would just need the non-standalone one?
23:13tomojright. and the standalone one (called an "uberjar") also contains all your dependencies
23:13WuHoUnitedthank you.
23:23WuHoUnitedi can go to sleep happy. i finally was able to make a class in clojure and call it from java.
23:32clj_newb_2345I feel I've become pretty good at rewriting Java classes in clojure. However, I'm clueless when it comes to rewriting javascript apps in clojurescript. This whole blahblah.prototype.blahblah thing throws me off.
23:32clj_newb_2345Anyone here know of good tutorials / guidelines for dealing this task?
23:33mybuddymichaelclj_newb_2345: Are you looking for more information on how Javascript works?
23:33clj_newb_2345I recently skimmed "javaScript the good parts"
23:34clj_newb_2345though I don't do javascript; I think I understand it well enough to udnerstand what the code is doing
23:34clj_newb_2345I guess I should first identify where exactly I'm stuck.
23:46wmealing_1clj_newb_2345: good on you.. its good that you are working to learn your own shortcomings
23:46wmealing_1that is one of the steps to expertise
23:47clj_newb_2345lol; unfortunately, as I look over this code, I can't help but think:
23:47FrozenlockWhat does it mean when a function start with a hyphen?
23:47clj_newb_2345it's only 4K Lines of Javascript. I bet I can write it in 1K of Clojure from scratch instead.
23:47clj_newb_2345Frozenlock: that it's private, not included when used with (:use namespace)
23:48clj_newb_2345wait wait, maybe that's defn-
23:48clj_newb_2345Frozenlock : ignore what I just said. I was confused.
23:48wmealing_1you mean like -main ?
23:48FrozenlockI mean like a whole bunch in https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs
23:48clj_newb_2345Frozenlock: is this in the context of genclass?
23:49tomojit just denotes the low-level protocol fn on top of which more sophisticated fns are implemented
23:49wmealing_1i believe its a java interface
23:49wmealing_1i think
23:49tomojit doesn't actually mean anything except by convention
23:49clj_newb_2345it's a *.cljs file
23:49clj_newb_2345how can it be java? :-)
23:50wmealing_1that was my understanding, i never use them
23:50tomojFrozenlock: e.g. consider (-conj [coll o]) vs (conj [coll x & xs])
23:51FrozenlockOh excellent, I can then put this in my `disregard' mental bin!
23:51clj_newb_2345tomoj: I don't understand your example
23:51clj_newb_2345what is the point of "-" here?
23:51wmealing_1https://groups.google.com/forum/?fromgroups=#!topic/clojure/rzvMp44ZN0I
23:52tomojas I said it just denotes that -conj is the lower-level protocol fn on top of which conj is implemnted
23:52wmealing_1ah so it is protocol, just not java
23:52wmealing_1thanks tomoj
23:52clj_newb_2345so if I repalced "-conj" with low_level_impl-conj everywhere, then semantics remains the same?
23:52FrozenlockThanks indeed.
23:53tomojyes, see the post wmealing_1 linked
23:53tomojin particular "The dash has no special significance as far as the compiler is concerned, it's just part of the name."
23:53clj_newb_2345hmm, From Stuart Sierra -- authorative enough :-)