2012-08-25
| 00:25 | shaungilchrist | djantayn: wow thanks for mentioning quil - super impressive. |
| 00:34 | Frozenlock | I'm disappointed... I discovered Catnip, found it impressive and so wanted to look at the cljs source. Turns out it's just javascript. |
| 00:58 | Sgeo | I should really write lift-m-fn |
| 00:58 | Sgeo | lift-m doesn't need to be a macro afaict |
| 00:58 | Sgeo | Oh, m-lift |
| 01:24 | Sgeo | Are monads made with one or the other of the monad libraries made to automatically work with map? |
| 01:24 | Sgeo | Because that would be nice |
| 01:37 | Sgeo | Also, applicative should be made into its own thing somehow. |
| 01:38 | Sgeo | And perhaps a more general framework for making these kinds of things. |
| 03:27 | tomoj | any ideas on cljs webworkers? |
| 03:27 | tomoj | I guess |
| 03:28 | tomoj | .. 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:38 | Sgeo | How bloated is Eclipse usually? |
| 04:03 | amalloy | i 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:21 | Sgeo | Oh hey olabini visits here |
| 04:58 | gerry1 | i have fixed why "lein repl" can't assign address" in my box |
| 04:59 | gerry1 | i have to setup 127.0.0.1 to localhost |
| 05:00 | gerry1 | in /etc/hosts |
| 05:01 | gerry1 | weird? |
| 05:01 | clojurebot | Something weird that I noticed: & (use '[clojure.contrib.json :as json]) & &| (json/pprint-json nil) |& |
| 05:01 | lazybot | java.lang.RuntimeException: No such namespace: json |
| 05:42 | ro_st | anyone 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:48 | hyPiRion | Is sort and sort-by stable? |
| 05:49 | ro_st | demo code is now working, finally: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/ |
| 05:54 | ejackson | ro_st interesting ! |
| 05:55 | ro_st | :-) it works really well |
| 05:56 | ro_st | in 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:56 | ro_st | i love that i can use precisely the same html templates on the server side with enlive, as well |
| 05:57 | ro_st | pretty soon i'm going to build a ring + cljs pjax wrapper (the way the new basecamp works) |
| 06:02 | ejackson | enlive is magical code |
| 06:02 | ejackson | i'm using it a lot these days for .xml file parsing |
| 06:04 | ro_st | is it tolerant of funny unicode characters? |
| 06:05 | ro_st | i have html that i need to validate for ms-word-pasted funny characters |
| 06:06 | ejackson | no idea ! |
| 06:14 | raek_ | ro_st: if you give it a Reader that you configed with the correct encoding, then yes |
| 06:15 | raek_ | enlive can create the Reader itself, but then it guesses the encoding |
| 06:16 | raek_ | so if you pass it (io/reader filename :encoding "UTF-8") rather than just filename you should be safe |
| 06:16 | ro_st | awesome, raek, thank you! |
| 06:18 | ejackson | enlive for president |
| 06:20 | ro_st | heh |
| 06:21 | ro_st | i'm just so glad enfocus exists. it's made cljs painless |
| 06:24 | ejackson | how do you feed it the templates ? |
| 06:24 | ejackson | just with links ? |
| 06:25 | ro_st | it knows how to download them with xhr |
| 06:25 | ro_st | so just give it a path from / |
| 06:25 | ejackson | ok, brilliant |
| 06:25 | ro_st | same as with enlive |
| 06:25 | ro_st | https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/blob/master/src-cljs/depr/view.cljs |
| 06:26 | ro_st | https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/blob/master/resources/public/templates/templates.html |
| 06:26 | ejackson | hah... |
| 06:26 | ro_st | defaction is a fn that runs on the live dom |
| 06:26 | ro_st | whereas defsnippet (as with enlive) returns populated html nodes for putting into the dom |
| 06:27 | ro_st | initially i tried to write one set of code for both enlive and enfocus |
| 06:27 | ejackson | a reach too far ? |
| 06:28 | ro_st | but 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:28 | nz- | how do you integrate normal js libs with cljs? |
| 06:28 | ro_st | with externs |
| 06:29 | ro_st | http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html Externs heading |
| 06:30 | ro_st | we'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:30 | ejackson | ro_st: that's small |
| 06:30 | ro_st | that's with all the caching and gzip stuff turned up to 11 |
| 06:30 | ejackson | i was just pulling in stuff like jquery and not giving a damn... but the app was huge |
| 06:31 | ro_st | and that's across 11 requests, i think |
| 06:31 | ro_st | it's damn fast |
| 06:31 | ro_st | easy to do if you decide to make it a priority before you start :-) |
| 06:31 | ro_st | 10 requests |
| 06:31 | ejackson | yeah, I was just trying to make something work |
| 06:32 | ejackson | and jquery is damned useful ! |
| 06:32 | ro_st | it is. enfocus does the job just as nicely, although no huge plugin library |
| 06:33 | ejackson | its all about that - having things like widgets galore is very helpful. I'm using kendoUI for example |
| 06:33 | ro_st | i'll probably end up bringing bootstrap.js in |
| 06:33 | ro_st | those components are just too damn handy |
| 06:34 | ro_st | we want to be performant on mobile as well |
| 06:34 | ro_st | so having small download sizes and tight JS is important |
| 06:35 | tomoj | so no jqm or jqtouch though? |
| 06:35 | ejackson | yeah, mine's an internal app, so that's not a problem |
| 06:35 | naeg | piranha: hey, I managed to transliterate the conways game of life from clojure to python |
| 06:35 | ro_st | no. same codebase for everyone |
| 06:35 | piranha | naeg: did it become much bigger? :) |
| 06:35 | naeg | piranha: http://bpaste.net/show/2RM4RfewQbrCJr1Hnf6p/ |
| 06:35 | ro_st | feature detects and media queries to control mouse vs touch and the display size |
| 06:36 | naeg | piranha: it's almost 1:1, but unidiomatic, functional python |
| 06:36 | naeg | the clojure one: http://bpaste.net/show/s5aUgEV54mHZ9CGx5ALo/ |
| 06:36 | naeg | piranha: 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:37 | ro_st | and i'm off |
| 06:41 | Sgeo | : |
| 06:42 | Sgeo | The entire Clojure monad community is wrong. I am going to fix their wrongness. |
| 06:43 | hyPiRion | Sgeo: What did you expect, we are a bunch of conservative programmers. |
| 06:47 | ejackson | who you calling a programmed conservative ? |
| 06:47 | ejackson | :p |
| 06:49 | Sgeo | At a first attempt (I don't have a repl open): |
| 06:52 | Sgeo | (defn m-lift-fn [fun & args] (apply fun (m-seq args))) |
| 06:52 | Sgeo | Hmm, maybe that needs to be defmonadfn and not defn |
| 06:56 | hyPiRion | ejackson: ;) |
| 06:57 | Sgeo | Wait, that doesn't quite do it |
| 07:00 | Sgeo | I think I could just wrap it in m-result |
| 07:01 | Sgeo | (defmonadfn m-lift-fn [fun & args] (m-result (apply fun (m-seq args)))) |
| 07:02 | Sgeo | ...I suspect that that's horribly broken, actually |
| 07:02 | Sgeo | Even though the little typechecker in my brain thinks it's good. |
| 07:07 | Sgeo | I need to think a bit more. |
| 07:08 | ejackson | Sgeo: aaah yes, the often heard call of the monad-bird. |
| 07:09 | Sgeo | For what it's worth, I'm pretty sure implementing tardis-t will require a new macro and changes to the current ones |
| 07:09 | Sgeo | Since it only works with MonadFix monads |
| 07:09 | Sgeo | But right now I'm thinking about the little problem |
| 07:22 | Sgeo | I think I know how to do it |
| 07:22 | Sgeo | But it's probably inefficient |
| 07:22 | Sgeo | (At least the way I have in mind) |
| 07:41 | erwagasore | Hi, 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:41 | erwagasore | Need help |
| 07:42 | piranha | naeg: eh, sorry, a bit busy right now :( |
| 07:42 | piranha | but I'm interested anyway, will read code a bit later :) |
| 07:42 | gerryxiao | cemerick: does lein hard-coded "localhost" in? |
| 07:43 | cemerick | gerryxiao: for? |
| 07:43 | gerryxiao | i do "lein repl",i got "couldn't bind to address" error |
| 07:44 | gerryxiao | but after change /etc/hosts, set localhost to 127.0.0.1,it works |
| 07:45 | cemerick | oh, interesting |
| 07:45 | cemerick | someone else had that error yesterday |
| 07:46 | cemerick | gerryxiao: yes, localhost is the default |
| 07:47 | cemerick | You can set 127.0.0.1 here: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L129 |
| 07:48 | cemerick | Honestly, I don't actually know the difference between 127.0.0.1 and localhost. Something to do with network interfaces and such. |
| 07:50 | gerryxiao | i have changed localhost to othername in my archlinux |
| 07:51 | cemerick | gerryxiao: what was it resolving to previously? |
| 07:52 | gerryxiao | localhost can't be resolved |
| 07:52 | gerryxiao | localhost not equal 127.0.0.1 |
| 07:53 | cemerick | really? `host localhost` yielded nothing prior to your changing /etc/hosts? |
| 07:54 | Bronsa | hmmm. |
| 07:55 | Bronsa | what's the point of hasheq? |
| 07:56 | gerryxiao | host? i have no host command |
| 07:56 | cemerick | hrm, ok. |
| 07:56 | gerryxiao | ping localhost not work previously |
| 07:57 | cemerick | OK; isn't that generally a problem? |
| 07:57 | gerryxiao | no problem but "lein repl" |
| 07:57 | gerryxiao | :) |
| 07:58 | gerryxiao | hostname is better than localhost |
| 07:59 | gerryxiao | i think |
| 08:00 | gerryxiao | in project.clj :host 0.0.0.0 option do what job? |
| 08:02 | cemerick | gerryxiao: that's just an example |
| 08:02 | cemerick | You can set it to anything, so "127.0.0.1" should fix things for you without your having to change /etc/hosts |
| 08:02 | gerryxiao | ok,thx |
| 08:03 | Sgeo | Does Clooj handle Leinengen stuff? |
| 08:17 | Sgeo | Oh, I think my original code would work |
| 08:18 | Sgeo | No it wouldn't, type error |
| 08:21 | Sgeo | (defmonadfn m-lift-fn [f & args] (m-bind (m-seq args) (partial apply f))) |
| 08:21 | Sgeo | Wait, no |
| 08:22 | Sgeo | (defmonadfn m-lift-fn [f & args] (m-bind (m-seq args) #(m-return (apply f %)))) |
| 08:23 | Sgeo | oops |
| 08:23 | Sgeo | (defmonadfn m-lift-fn [f & args] (m-bind (m-seq args) #(m-result (apply f %)))) |
| 08:23 | Sgeo | Can't imagine why I'd possibly call it 'return' |
| 08:37 | Sgeo | Someone please ping me if jim comes in here? |
| 08:39 | mikem | hi, 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:45 | tomoj | mikem: `lein version`? |
| 08:47 | tomoj | hmm |
| 08:48 | Sgeo | Oh hey I can |
| 08:48 | mikem | tomoj: 2.0.0-preview9, Java 1.6 |
| 08:49 | tomoj | mikem: it looks like a problem with the maven lucene indices.. |
| 08:49 | tomoj | maybe try deleting ~/.lein/indices ? |
| 08:50 | tomoj | or maybe a repo you use is causing trouble |
| 08:54 | Sgeo | https://github.com/Sgeo/algo.monads/commit/65169fed45c10d604b5ab616c400e98c7d35ed16 |
| 09:00 | mikem | tomoj: I removed the indices and am re-running lein outdated in a project... it's taking a while. will keep you updated :-) |
| 09:07 | Sgeo | Do people get notified when someone forks their project on github? |
| 09:22 | RonnieDk | I'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:22 | RonnieDk | maybe not use leiningen-2.0.0? |
| 09:23 | majyk | I also couldn't get preview9 to work, same error. I went back to preview8 |
| 09:23 | tomoj | same error here I think too |
| 09:23 | tomoj | for me, the fix was to go into a directory with a lein2-compatible project.clj and run it once |
| 09:23 | tomoj | then after that it works |
| 09:24 | xeqi_ | using https://raw.github.com/technomancy/leiningen/2.0.0-preview8/bin/lein will get you preview8 |
| 09:24 | mikem | tomoj: ok, looks like there's a dependency in my project which messes lein outdated up. it works fine in the leiningen repo |
| 09:24 | xeqi_ | I have a feeling preview10 will be out soon |
| 09:24 | mikem | too bad the error message doesn't say which |
| 09:25 | Sgeo | I want the person I forked from to see my code but don't want to say "my code's actually usable" |
| 09:25 | majyk | tomoj, I just tried what you said and it does indeed work. Thanks! |
| 09:25 | Sgeo | Because I didn't test it _at all_ |
| 09:26 | xeqi | Sgeo: 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:26 | Sgeo | xeqi, ah, ok |
| 09:26 | Sgeo | All I did was add one function, that I believe should replace a macro. |
| 09:26 | RonnieDk | preview8 works for me. Thanks |
| 09:27 | RonnieDk | or may not entirely. Some artifacts could not be found |
| 09:29 | Sgeo | But honestly, the entire library should be rethought. |
| 09:30 | Sgeo | It's too monad specific. |
| 09:30 | Sgeo | There are useful non-monad functors and applicatives. |
| 09:34 | Sgeo | Oh hey, jduey already did what I was complaining about not being the case for the past day. |
| 09:42 | dhm | Sgeo: (re: don't want to say "my code's actually usable") make a feature/unstable/test branch |
| 09:45 | Sgeo | Is there a way to effectively say "If something implements this protocol, it implements this other protocol via this code"? |
| 09:47 | xeqi | Sgeo: I dont know of anything |
| 09:47 | wjc | hi |
| 09:47 | Sgeo | Darn |
| 09:48 | wjc | I've got a clojurescript question, is this the right place? |
| 09:48 | Sgeo | Maybe I should describe the use case (fixing jduey's library) |
| 09:48 | antares_ | wjc: yes, CLJS is discussed here |
| 09:48 | xeqi | wjc: yes |
| 09:48 | wjc | nice |
| 09:48 | wjc | right |
| 09:48 | wjc | so I'm using cljsbuild |
| 09:48 | Sgeo | All Monads are Applicatives, and all Applicatives are Functors. But not all Functors are Applicatives and not all Applicatives are Monads. |
| 09:48 | wjc | and i've declared 2 js files as externs |
| 09:49 | wjc | 3 files |
| 09:49 | wjc | jquery, jqtouch, and jqtouch-jquery |
| 09:49 | Sgeo | If something is a Monad, then an implementation for the Applicative and Functor abilities can be automatically derived. |
| 09:49 | wjc | everyting works well on a simple build |
| 09:49 | wjc | but if I switch optimizations to advanced |
| 09:50 | wjc | I get an infinite loop |
| 09:50 | Sgeo | However, at the same time, it should be possible to implement non-monad applicatives and functors. |
| 09:50 | wjc | which spews js code |
| 09:50 | wjc | on stdout |
| 09:50 | wjc | what could I have missed? |
| 09:50 | Sgeo | Ideally, monads should be definable by implementing only the Monad protocol, and the Applicative and Functor defintions filled in. |
| 09:53 | xeqi | Sgeo: 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:54 | xeqi | but theres no builtin peice for protocols to do implementation sharing or heirarchy |
| 10:00 | nz- | I am getting this exception when running lein cljsbuild once: java.lang.RuntimeException: No such var: clojure.core/require-macros |
| 10:07 | nz- | the offending code is basically this: (ns ruuvi-ui.app (:require [enfocus.core :as ef]) (:require-macros [enfocus.macros :as em])) |
| 10:08 | nz- | the require-macros thing is a part of the cljs but it is not found when compiling |
| 10:09 | wjc | should I be using :foreign-libs instead of :externs? |
| 10:28 | xeqi | nz-: is your file named .clj ? |
| 10:28 | xeqi | instead of .cljs |
| 10:32 | john2x | how do I turn [:a :b :c] [1 2 3] into {:a 1 :b 2 :c 3}? |
| 10:33 | jeremyheiler | zipmap |
| 10:33 | jeremyheiler | &(zipmap [:a :b :c] [1 2 3]) |
| 10:33 | lazybot | ⇒ {:c 3, :b 2, :a 1} |
| 10:34 | jeremyheiler | john2x^ |
| 10:38 | john2x | thanks! |
| 10:39 | lozenged | hi, am trying to use aset in conjuection with map, and it seems like the call to aset is being skipped |
| 10:39 | lozenged | (let [ar (double-array 1 0)] |
| 10:39 | lozenged | (map (fn [x] (aset ar 1 x)) (list 5.5)) |
| 10:39 | lozenged | (vec ar)) |
| 10:40 | hyPiRion | lozenged: map is lazy, enforce with doall |
| 10:40 | nz- | xeqi: ah, that was it |
| 10:40 | hyPiRion | or doseq, even better |
| 10:40 | lozenged | aha, cool thanks |
| 10:48 | nz- | (inc xeqi) |
| 10:48 | lazybot | ⇒ 1 |
| 10:52 | dpritchett | Morning #clojure |
| 10:52 | jeremyheiler | mornin' |
| 11:03 | dpritchett | I'd like to be able to refer to clojure.repl/doc from within any namespace at the repl. Is that a pipe dream? |
| 11:18 | dpritchett | I guess I could put some sort of self-referential workon macro in ~/.lein/user.clj |
| 11:25 | jeremyheiler | dpritchett, i thought clojure.repl/doc was there by default? |
| 11:29 | dpritchett | jeremyheiler: it seems to go away when i switch to a new namespace |
| 11:29 | dpritchett | that is, it's only availabe in the user namespace |
| 11:29 | dpritchett | but if i try (ns something-else.core) then i have to refer to doc as clojure.repl/doc |
| 11:29 | ejackson | jeremyheiler: used to be, but not for a while. |
| 11:29 | jeremyheiler | it seems to be there for me in my lein2 repl |
| 11:30 | jeremyheiler | (implying I already changed the ns) |
| 11:30 | dpritchett | I got this far: https://gist.github.com/3467119 |
| 11:31 | jeremyheiler | what repl are you using? |
| 11:31 | dpritchett | That lets me have access to .repl/doc from any namespace without having to explicitly reference in the source files |
| 11:31 | dpritchett | lein repl |
| 11:31 | jeremyheiler | lein2 ? |
| 11:31 | dpritchett | 1.7 i think |
| 11:31 | dpritchett | I didn't pull from source I just do the occasional self-install |
| 11:32 | dpritchett | 1.7.1 |
| 11:32 | jeremyheiler | ah, ok. well, lein2's repl works like you want |
| 11:33 | dpritchett | sweet! when does it go live? |
| 11:33 | jeremyheiler | i'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:36 | dpritchett | I'll have to give it a second look, thanks |
| 12:32 | dancarper | hey 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:35 | jeremyheiler | dancarper: tip, use (defn foo [args] ...) instead of (def foo (fn [args] ...)) |
| 12:35 | mybuddymichael | dancarper: (square [1 2 3 4]) won't work with how you've defined it. |
| 12:35 | mybuddymichael | dancarper: You've defined it as a binary function and you're passing it one argument (a vector). |
| 12:36 | dancarper | jeremyheiler: thanks will do ;) |
| 12:36 | hyPiRion | dancarper: I suppose you error when you do (+ (map square args)) |
| 12:36 | dancarper | mybuddymichael: `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:37 | hyPiRion | I think you forgot an apply before the plus |
| 12:37 | dancarper | hyPiRion: i also didn't understand that |
| 12:37 | jeremyheiler | also (+ (map square args)) doesn't work because map returns a sequence. in this case you would want (apply + (map square args)) |
| 12:37 | hyPiRion | ,(let [square (fn [x] (* x x)) sum-squares (fn [& a] (apply + (map square a)))] (sum-squares 1 2 3 4)) |
| 12:37 | clojurebot | 30 |
| 12:38 | dancarper | my initial thought was that (apply + (1 2 3 4)) would return (1 2 3 4), as (+ 1) returns 1 |
| 12:38 | jeremyheiler | no, (apply + [1 2 3 4]) is like saying (+ 1 2 3 4) |
| 12:39 | hyPiRion | jeremyheiler is right. |
| 12:39 | dancarper | ahh okay cool, sorry longtime OO'er practically no experience with functional though |
| 12:39 | jeremyheiler | not a problem, glad to help :-) |
| 12:39 | hyPiRion | dancarper: no problemo, I think we've all been there ;) |
| 13:08 | azkesz | hi, 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:09 | casion | how long is what you have now? |
| 13:09 | azkesz | 7 chars |
| 13:10 | azkesz | stumbled on it by mistake, and it was fun=) |
| 13:11 | pepijndevos | azkesz, I can't think of anything shorter just yet |
| 13:11 | xeqi | azkesz: from a repl? |
| 13:12 | azkesz | yes, I don't actually know any other way to run, yet |
| 13:12 | xeqi | is is (range) ? |
| 13:12 | xeqi | *is it |
| 13:13 | azkesz | no but that works too ? |
| 13:13 | hyPiRion | ,(recur) |
| 13:13 | azkesz | awesome |
| 13:13 | casion | range is lazy, I got the feeling that his question excluded lazy seqs |
| 13:13 | clojurebot | Execution Timed Out |
| 13:13 | xeqi | thats why I was wonder |
| 13:13 | azkesz | yeah what hyPiRion said, I had |
| 13:14 | hyPiRion | A less expensive one would be ##@(promise) |
| 13:14 | azkesz | xeqi that's why you asked if from repl, cause it evaluates even if they return lazy |
| 13:14 | lazybot | Execution Timed Out! |
| 13:14 | azkesz | I was hoping there's one with some weird chars like % |
| 13:15 | azkesz | ,(#(= %%) 1) |
| 13:15 | clojurebot | true |
| 13:15 | azkesz | ,(#(=%%) 1) |
| 13:15 | clojurebot | true |
| 13:16 | pepijndevos | ,(#(% %) #(% %)) |
| 13:16 | azkesz | hyPiRion, that's clever with the dereferencing promise:) |
| 13:16 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError> |
| 13:17 | hyPiRion | azkesz: And completely useless :) |
| 13:17 | azkesz | I didn't know you could call recur without loop, that's how I found out |
| 13:17 | azkesz | yeah but kinda fun=) |
| 13:17 | pepijndevos | How do I call a clojurescript function from js? |
| 13:18 | madsy | pepijndevos: You're not meant to |
| 13:18 | xeqi | the.namespace.function(..) |
| 13:18 | xeqi | though you have to ^:export w/ advanced compilation |
| 13:18 | madsy | Unless something changed since I started |
| 13:19 | pepijndevos | xeqi, thanks :) |
| 13:20 | azkesz | hyPiRion, 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:21 | azkesz | by examples I mean like some small but functional program that illustrates the(all possible) uses of the documented function |
| 13:22 | hyPiRion | azkesz: well, in the nrepl, you have cdoc |
| 13:22 | hyPiRion | so whenever you run `lein repl` you can do that |
| 13:22 | xeqi | which pulls from clojuredocs.org |
| 13:22 | hyPiRion | It's not exhaustive though, but it's good. |
| 13:22 | hyPiRion | oh |
| 13:22 | hyPiRion | ,(read) |
| 13:22 | clojurebot | #<ReaderException clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: EOF while reading> |
| 13:23 | hyPiRion | Worth a try, I suppose. |
| 13:23 | azkesz | =) |
| 13:23 | azkesz | so it pulls from that site, and i need lein.bat ? for windows |
| 13:23 | xeqi | how are you running things currently? |
| 13:24 | azkesz | i have ccw+eclipse |
| 13:25 | casion | could someone explain the benefits of nrepl to me? |
| 13:26 | casion | the 'why nrepl?' on github doesnt exactly make sense to me |
| 13:26 | xeqi | hmm, cdoc comes from reply.. not sure what ccw is using under the hood |
| 13:27 | xeqi | well, cdoc really comes from cd-client, which reply uses |
| 13:27 | azkesz | xeqi, 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:27 | dnolen | xeqi: pepijndevos: that's not true, your have ^:export |
| 13:27 | xeqi | sorry, reply is the repl frontend lein uses |
| 13:27 | dnolen | you have |
| 13:27 | dnolen | xeqi: pepijndevos: re calling CLJS from JS |
| 13:28 | pepijndevos | dnolen, thanks :) |
| 13:29 | pepijndevos | Is it recommended to use the closure library? And what are some good examples? |
| 13:30 | azkesz | xeqi, i see that leiningen-2.0.0-preview9-standalone.jar has "reply" inside the .jar :) |
| 13:30 | dnolen | pepijndevos: Closure is of uneven quality. Low-level stuff seems good, not sure about widgets or higher level abstractions. |
| 13:31 | dnolen | pepijndevos: transports, math, date, string, and various things to abstract away browser differences is very solid. |
| 13:31 | dnolen | pepijndevos: but I wouldn't touch their canvas wrapper - it's the pits. |
| 13:32 | pepijndevos | dnolen, I want to write a contenteditable editor, so should I avoid their widgets? There are some browser inconsistencies there too |
| 13:33 | pepijndevos | ther eis this thing |
| 13:33 | pepijndevos | http://closure-library.googlecode.com/svn/docs/class_goog_editor_ContentEditableField.html |
| 13:33 | dnolen | pepijndevos: I haven't tried their editor so can't say - might be good? |
| 13:33 | xeqi | casion: the benefits compared to the previous repls? |
| 13:33 | pepijndevos | ok, i'll try |
| 13:33 | dnolen | pepijndevos: try it, doesn't usually take long to figure out if it's worth it or not. |
| 13:33 | casion | xeqi: yes, assuming I'm asking a reasonable question |
| 13:34 | jml | is there a way to tell if I'm requiring any names that I'm not using? |
| 13:36 | xeqi | casion: it splits the repl server from the repl frontend, so that lein, emacs, vim, ccw can all talk to the same backend |
| 13:36 | dnolen | jml: not really, but perhaps things are moving along (scape, core.logic) such that those tools are not that far off. |
| 13:36 | xeqi | instead of each trying to write there own repl |
| 13:36 | jml | dnolen: cool, thanks. |
| 13:36 | casion | xeqi: ok, that makes more sense |
| 13:37 | xeqi | aslo, it allows injecting new functionality; for example piggieback is a middleware to turn it into a cljs repl |
| 13:37 | azkesz | awesome, (cdoc recur) is showing examples, thanks hyPiRion and xeqi |
| 13:38 | xeqi | drawbridge allows you to connect over http(s), for places like heroku |
| 13:39 | azkesz | it is much better just going at the site, easier copy/paste (in pindows) |
| 13:44 | casion | hmm, seems not worth my time to mess with nrepl then (yet?) |
| 13:45 | Frozenlock | I'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:46 | Frozenlock | Oh wait- |
| 13:47 | Frozenlock | nvm |
| 13:48 | azkesz | ,(cdoc recur) |
| 13:48 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: cdoc in this context, compiling:(NO_SOURCE_PATH:0)> |
| 13:49 | azkesz | ,(use 'cd-client.core) |
| 13:49 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate cd_client/core__init.class or cd_client/core.clj on classpath: > |
| 13:50 | pepijndevos | dnolen, 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:50 | azkesz | so loop rebinds like let (serially?) but recur rebinds in parallel ? right? |
| 13:50 | dnolen | pepijndevos: ask on the ML other people have done this. |
| 13:51 | dnolen | pepijndevos: or check StackOverflow too. |
| 13:51 | dnolen | pepijndevos: not necessarily the editor but other UI widgets. |
| 13:51 | azkesz | well actually makes sense, nvm=) |
| 13:53 | pepijndevos | clojurescript 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:57 | shanmu | Hello, 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:58 | shanmu | Hello, I am trying out nrepl.el in emacs, how do I quit the repl? , |
| 13:58 | shanmu | does not seem to work (like in slime). Can someone please help? |
| 14:01 | shanmu | hi |
| 14:01 | shanmu | is there full document on exiting nrepl repl from emacs, started using nrepl-jack-in? |
| 14:02 | pepijndevos | why does requireing goog.dom work fine, but not goog.editor? |
| 14:06 | scalabl3 | i'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:07 | antares_ | scalabl3: Spyglass has some java bits and was compiled for JDK 6 |
| 14:07 | antares_ | you probably have 5 |
| 14:07 | shanmu | scalabl3: that means your java version is older than the class you are trying to run |
| 14:07 | scalabl3 | ah |
| 14:07 | scalabl3 | let me check |
| 14:08 | shanmu | anyone for nrepl.el help, please? |
| 14:08 | antares_ | scalabl3: actually, 51 means JDK 7 |
| 14:08 | antares_ | so I guess I did not specify any JDK version |
| 14:08 | scalabl3 | yeah i have build 1.6.0_33-b03-424-11M3720) |
| 14:08 | antares_ | it's easy to correct, there is no JDK 7-specific code |
| 14:08 | jaley | am I right in thinking there's no function to add to tail of a sequence? just conj to a vector? |
| 14:08 | scalabl3 | oh are you the author antares_? |
| 14:08 | scalabl3 | :) |
| 14:09 | scalabl3 | just standard mac jdk default here |
| 14:10 | antares_ | scalabl3: I am |
| 14:11 | antares_ | scalabl3: pushed 1.0.1 compiled for JDK 6. You can get JDK 7 for OS X from java.com. |
| 14:11 | scalabl3 | i am running this example by my co-worker analyzing reddit with clojure/spyglass/couchbase: https://github.com/apage43/reddalyzr |
| 14:12 | scalabl3 | sweet |
| 14:12 | scalabl3 | so i update the project.clj with 1.0.1 then right? |
| 14:13 | antares_ | scalabl3: correct |
| 14:13 | xeqi | shanmu: question? |
| 14:13 | scalabl3 | antares_: tks! and you can ignore my googlegroup post hehe, same thing |
| 14:14 | shanmu | xeqi: Is there a clean way to disonnect/quit the repl in nrepl.el? |
| 14:15 | shanmu | xeqi: I started using nrepl-jack-in |
| 14:15 | xeqi | kill *nrepl-server* buffer |
| 14:15 | pepijndevos | Do I need to tell leiningen I want google closure? It just plain not working. |
| 14:15 | shanmu | xeqi: thanks! I was hoping there might be a cleaner way than that :) |
| 14:16 | scalabl3 | antares_: can i do sasl? so I can specify a bucket? |
| 14:16 | xeqi | pepijndevos: are you using lein-cljsbuild ? |
| 14:16 | pepijndevos | xeqi, yes |
| 14:17 | antares_ | 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:17 | scalabl3 | yeah 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:18 | scalabl3 | antares_: don't actually need to specify password, just don't know syntax |
| 14:18 | antares_ | scalabl3: http://code.google.com/p/spymemcached/wiki/Examples |
| 14:19 | antares_ | scalabl3: (net.spy.memcached.MemcachedClient. servers "bucket" "password") |
| 14:20 | antares_ | then use it as you would a client instantiated via spyglass/bin-connection and such. See http://clojurememcached.info |
| 14:20 | antares_ | hm, I realize that the function that builds a list of servers from Clojure collections is private |
| 14:21 | Frozenlock | noir-cljs is killing lein cljsbuild o_O If I add noir-cljs to the dependencies, it can't compile :( |
| 14:21 | antares_ | 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:22 | antares_ | scalabl3: do I need Couchbase Server 1.8? |
| 14:23 | scalabl3 | antares_: yeah it's the stable one, 2.0 is still unstable (pre-beta) |
| 14:23 | antares_ | 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:24 | antares_ | ok, downloading |
| 14:24 | scalabl3 | antares_: you don't have to do it now :) i am mostly curious |
| 14:24 | scalabl3 | i work for Couchbase, lol |
| 14:24 | antares_ | scalabl3: ah :) |
| 14:24 | antares_ | that changes everything |
| 14:25 | scalabl3 | i do sample apps mostly in ruby/rails/eventmachine, but getting into jruby and clojure now |
| 14:25 | antares_ | scalabl3: I added Couchbase support to the readme after one of your folks helped me get CI running against it on travis |
| 14:25 | antares_ | I don't know about JRuby but Spyglass and I guess just about any JVM language uses SpyMemcached |
| 14:26 | scalabl3 | yep |
| 14:26 | antares_ | scalabl3: I need to make sure memcached is not running before I start couchbase, right? |
| 14:26 | scalabl3 | well for couchbase you can also use Couchbase Java SDK |
| 14:27 | scalabl3 | antares_: oh, yeah probably, same ports |
| 14:27 | scalabl3 | antares_: couchbase *is membase server + persistence |
| 14:27 | antares_ | wow, it is a Mac .app? that's unexpected :) |
| 14:27 | scalabl3 | you can drop it in as a replacement, will work the same |
| 14:27 | antares_ | scalabl3: is there a binary package I can run in the shell? :) |
| 14:28 | scalabl3 | you mean to start/stop? |
| 14:28 | antares_ | yes |
| 14:28 | scalabl3 | there are command line tools, right click couch icon in menu to install, i think, i am running 2.0 on this machine |
| 14:28 | scalabl3 | hold on, let me check my other machine |
| 14:29 | antares_ | scalabl3: ok, I think I have it running |
| 14:30 | scalabl3 | k |
| 14:30 | scalabl3 | antares_: https://www.couchbase.com/docs/couchbase-manual-1.8/couchbase-admin-cmdline-couchbase-cli.html |
| 14:31 | scalabl3 | oh doesn't have start stop for mac, i guess you just quit/start it |
| 14:31 | antares_ | scalabl3: yeah, I can always kill -sQUIT it |
| 14:31 | scalabl3 | yeah |
| 14:32 | antares_ | ok, give me 15 minutes to look at SpyMemcached source and see what's the best way to support Couchbase-specific connections |
| 14:32 | antares_ | scalabl3: does couchbase use binary protocol? |
| 14:32 | antares_ | or both? what do people typically use? |
| 14:32 | scalabl3 | antares_: 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:32 | scalabl3 | yes |
| 14:33 | scalabl3 | memcached protocol |
| 14:33 | antares_ | scalabl3: I understand. But do most clients use binary or text protocol primarily? |
| 14:33 | scalabl3 | binary |
| 14:33 | antares_ | ok |
| 14:33 | scalabl3 | binary much faster |
| 14:33 | scalabl3 | i think we removed REST services in lieu of using client lib's with binary |
| 14:34 | scalabl3 | we still have REST mgmt services tho |
| 14:36 | scalabl3 | our founder wrote spymemcached :) |
| 14:36 | scalabl3 | one of our 6 founders |
| 14:39 | antares_ | 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:42 | antares_ | 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:42 | antares_ | 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:42 | scalabl3 | sure, of course |
| 14:43 | scalabl3 | not 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:43 | scalabl3 | memcached client -> couchbase = yes, couchbase client -> memcached = not sure |
| 14:44 | scalabl3 | hehe |
| 14:44 | scalabl3 | i can ask dustin tho |
| 14:44 | antares_ | scalabl3: FYI, it is really painful to find Maven dependency in the Java client docs |
| 14:44 | antares_ | github README sends me to some getting started guide that sends me to another guide that sends me back |
| 14:45 | scalabl3 | grrr, yeah we're working on our docs, many improvements coming |
| 14:45 | scalabl3 | let me make a note of that tho |
| 14:45 | antares_ | make it dead obvious, any non-trivial project will use some kind of dependency management tool that uses Maven for dependencies :) |
| 14:46 | antares_ | 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:46 | antares_ | LOL. search.maven.org suggests spelling correction for "couchbase" to "asyncbase couch" |
| 14:47 | scalabl3 | hehe is there such a thing? |
| 14:48 | antares_ | scalabl3: probably not. But you never know, kids with their async coffeescripts these days… |
| 14:48 | antares_ | scalabl3: ok, finally found the repo :) http://files.couchbase.com/maven2/ |
| 14:49 | scalabl3 | i just sent all that to our java sdk peeps and doc peeps |
| 14:51 | scalabl3 | i gotta take my kids to the museum (my wife is rolling her eyes at me), i'll be back in a few lol |
| 14:51 | antares_ | scalabl3: have fun. And thanks for reminding that I need to finish Couchbase support. |
| 14:51 | scalabl3 | i use bouncer so feel free to send me notes or suggestions |
| 14:51 | scalabl3 | i'll pass them on, either on channel or pm, either or works |
| 14:51 | scalabl3 | tks |
| 14:51 | scalabl3 | ! |
| 15:14 | Frozenlock | Is 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:21 | wires | hello! is there some way to store and manipulate a clojure datastructure on disc instead of in memory? |
| 15:23 | drewr | wires: carbonite maybe |
| 15:23 | drewr | don't know about manipulation, but it's got the storage part |
| 15:23 | wires | i see, yes so this is not really what i'm looking for |
| 15:24 | wires | The problem is that the data potentially doesn't fit into memory |
| 15:24 | wires | so ideally I'd just work on disk. |
| 15:24 | drewr | save sexps to files and stream them lazily |
| 15:25 | wires | is this possible? |
| 15:25 | wires | I understand that I could reimplement the foundational clojure interfaces, but then my whole application is running from disc.. |
| 15:25 | drewr | echo '{:foo 1}\n{:bar 2}' > /tmp/baz .... user> (map read-string (line-seq (io/reader (io/file "/tmp/baz")))) |
| 15:25 | lazybot | '{:foo 1}\n{:bar 2}' > /tmp/baz .... user> (map read-string (line-seq (io/reader (io/file "/tmp/baz")))) |
| 15:25 | wires | hehe, thank you lazybot |
| 15:26 | drewr | you don't need io/file there, btw |
| 15:26 | wires | ok, but this processes line by line |
| 15:27 | drewr | right |
| 15:27 | drewr | I don't know of a disk-backed implementation of clojure data structures |
| 15:27 | wires | ok |
| 15:27 | drewr | seems like it would be too slow to be useful |
| 15:27 | wires | Well, it would basically be an immutable database |
| 15:28 | wires | with proper caching and 'page management' it should be okay |
| 15:29 | Frozenlock | wires: You can also use the many clojure wrapper for databases. |
| 15:29 | Frozenlock | I like congomongo very much. It transforms clojure map data to their mongodb counterparts transparently. |
| 15:30 | wires | Frozenlock, hmm, could you suggest one? How does this play with the persistency of the datastructure? |
| 15:30 | wires | Ah congomongo |
| 15:32 | antares_ | scalabl3: I am hitting http://www.couchbase.com/issues/browse/JCBC-91 :( with a perfectly fine URI :/ |
| 15:33 | wires | hmm, 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:33 | wires | basically mirroring the 'trie' storage that is used in memory |
| 15:34 | wires | of course I could dump every version, but ideally I'd like to share data |
| 15:41 | Frozenlock | "And there you have it - a complete overtone controller in about 20 minutes." -ibdknox |
| 15:41 | Frozenlock | ... and it took me a week to finally understand everything. Sheeeesh! |
| 15:42 | erider | do you need to know java to use clojure |
| 15:42 | Frozenlock | I learned java using clojure. So no, but it can be really helpful. |
| 15:43 | Frozenlock | Especially if you want to use java libraries |
| 15:48 | erider | ok thanks |
| 15:55 | Frozenlock | Any clever use of jayq (or cljs in general) I could look at to help me understand this wild environment? :P |
| 16:02 | uvtc | Ran 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:02 | uvtc | But then after that, if I try something else, I get a 2nd exception message. |
| 16:03 | uvtc | For 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:04 | uvtc | Maybe this is something better posted to the ML. Also, it's pretty quiet around here on weekends. :) |
| 16:14 | uvtc | Ok, posted to ML. |
| 16:22 | hyPiRion | it's rather silent here as of now, yes. |
| 16:22 | Frozenlock | On weekends, no one can hear you scream. Tan tan taaaaaaan |
| 16:22 | hyPiRion | uvtc: yeah, I can reproduce it. |
| 16:22 | hyPiRion | so it's not just you |
| 16:45 | Frozenlock | Is 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:49 | gfredericks | you'd have to detect the current state, right? via the css "display" attribute maybe? |
| 16:50 | gfredericks | after that it's just a function with an if in it. |
| 16:50 | gfredericks | unless you want to do something complicated with "in progress" detection for animations |
| 16:50 | Frozenlock | I'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:51 | gfredericks | oh so you track the state independently |
| 16:51 | Frozenlock | Yes |
| 16:52 | gfredericks | (fn [f1 f2] (let [a (atom false)] (fn [] (if @a (f1) (f2)) (swap! a not)))) |
| 16:52 | gfredericks | maybe true would be a more sensible default there |
| 16:52 | Frozenlock | You don't need to define the atom outside the function? |
| 16:52 | gfredericks | s/default/initial |
| 16:52 | gfredericks | what I gave is a function that returns the toggler function |
| 16:53 | gfredericks | so the atom is defined outside the toggler |
| 16:53 | gfredericks | but inside the toggler-factory\ |
| 16:53 | gfredericks | er, togglerFactoryBean |
| 16:54 | Frozenlock | That's really nice! Thank you :) |
| 16:55 | Frozenlock | But is there any risk for `a' to clash with another `a' in the same namespace? |
| 16:55 | gfredericks | np |
| 16:55 | gfredericks | no it's a local |
| 16:55 | gfredericks | I mean it could clash with something external but that doesn't matter because no other a is being used there |
| 16:56 | gfredericks | so you (defn toggler-factory [f1 f2] (let [a (atom true)] (fn [] (if @a (f1) (f2)) (swap! a not)))) |
| 16:57 | gfredericks | and then (def fade-toggle (toggler-factory fade-in fade-out)) |
| 16:57 | gfredericks | I guess that doesn't work if you need to pass args to fade-in/fade-out |
| 16:57 | Frozenlock | I'm going to try that immediately :) |
| 16:57 | hyPiRion | fns all the way down. |
| 16:57 | Frozenlock | (defn toggler-factory [f1 f2 arg].... |
| 16:57 | gfredericks | (defn toggler-factory [f1 f2] (let [a (atom true)] (fn [& args] (apply (if @a f1 f2) args) (swap! a not)))) |
| 16:58 | gfredericks | I guess if the arg is always the same you can give it to the factory that way |
| 16:58 | Frozenlock | Oh no it's even better without the args hardcoded! |
| 16:59 | hyPiRion | Hmmm |
| 17:00 | gfredericks | I guess factories are nouns. make-toggler would probably be better. |
| 17:00 | gfredericks | togglify |
| 17:00 | gfredericks | togglomerate |
| 17:00 | gfredericks | ticlke |
| 17:00 | Frozenlock | gfredericks: It works flawlessly! |
| 17:01 | Frozenlock | (def toggle-fade (toggler-factory j/fade-in j/fade-out)) |
| 17:01 | Frozenlock | And then (toggle-fade any-dom-object) |
| 17:01 | gfredericks | excellent |
| 17:01 | hyPiRion | Well, that's a bit fast. |
| 17:01 | amalloy | gfredericks: 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:02 | hyPiRion | amalloy: And even then it really depends on what you want the toggle to do if the function throws an error. |
| 17:02 | gfredericks | amalloy: do we have to think about thread-safety in JS yet? |
| 17:02 | hyPiRion | Should it skip the toggle, or should it retry the same fn? |
| 17:02 | amalloy | gfredericks: it builds character |
| 17:02 | gfredericks | amalloy: hard to take it seriously when you can't use refs |
| 17:02 | Chousuke | why do you need to call it a factory, wouldn't just "toggler" be enough? :P |
| 17:03 | uvtc | It 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:03 | gfredericks | uvtc: s/function/var/ |
| 17:04 | uvtc | gfredericks: right. Thanks. |
| 17:04 | amalloy | gfredericks: 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:04 | uvtc | But why two similar ways to do the same thing? |
| 17:04 | amalloy | uvtc: my understanding is that in early versions of clojure, reader metadata was harder to use |
| 17:05 | uvtc | Oh, ok. Historical reasons then. Thanks. |
| 17:06 | gfredericks | amalloy: 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:06 | bosie | is there a way to write this quicker: #(or (= 0 (mod %1 3)) (= 0 (mod %1 5))) |
| 17:06 | hyPiRion | bosie: quicker as in more performant? |
| 17:06 | bosie | hyPiRion: less code |
| 17:06 | gfredericks | #(zero? (* (mod % 3) (mod % 5))) |
| 17:07 | amalloy | gfredericks: for a single reference, you never need refs; you can build thread-safety with just an atom |
| 17:07 | gfredericks | amalloy: how would you implement a queue with an atom? |
| 17:07 | bosie | gfredericks: creative |
| 17:07 | hyPiRion | #(= 0 is even shorter. |
| 17:08 | uvtc | bosie: but I think your way explains to the reader more what you mean. :) |
| 17:09 | bosie | oki |
| 17:09 | gfredericks | there is also (some #{0} [(mod % 3) (mod % 5)]) |
| 17:09 | uvtc | bosie: btw, I think when you're only using one arg, it's more typical to use % instead of %1 |
| 17:09 | uvtc | . |
| 17:10 | bosie | uvtc: esp. with modulo that seems… risky ;) |
| 17:10 | gfredericks | ha |
| 17:10 | uvtc | hehe |
| 17:11 | amalloy | gfredericks: put an extra slot in the atom for storing the return value: https://gist.github.com/3471005 |
| 17:11 | Frozenlock | gfredericks: 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:11 | amalloy | Frozenlock: that's why it's a factory |
| 17:12 | gfredericks | amalloy: that is clever-ass. I'm glad I axed. |
| 17:12 | bosie | gfredericks: looking at the last code you put up, some takes a predicate |
| 17:12 | rolyp | Is this a good place to get cljsbuild help? |
| 17:12 | bosie | gfredericks: predicate being what? |
| 17:12 | gfredericks | Frozenlock: excellent point. move the args to the top I guess. |
| 17:12 | gfredericks | bosie: sets can be predicates |
| 17:13 | hiredman | amalloy: there still thread safety issues there |
| 17:13 | gfredericks | mostly predicates |
| 17:13 | amalloy | hiredman: you mean that take doesn't block? yes, i'm not implementing a whole LBQ |
| 17:13 | hiredman | amalloy: someone else can call take before you look at ret |
| 17:14 | technomancy | anyone know an https host using a self-signed cert off the top of their head? |
| 17:14 | gfredericks | hiredman: I was just looking for how you can use an atom and return something other than the new value |
| 17:14 | amalloy | hiredman: so? |
| 17:14 | gfredericks | hiredman: aside from taking-when-empty I think it's good |
| 17:14 | amalloy | i'm not re-dereffing it, i'm using the return value from the swap |
| 17:14 | hiredman | amalloy: ah, I see |
| 17:15 | gfredericks | only minor downside is garbage collection |
| 17:16 | amalloy | gfredericks: ? |
| 17:16 | gfredericks | amalloy: the last thing popped off can't be GC'd until take is called again |
| 17:17 | gfredericks | I guess you could get around that with an extra swap at the end |
| 17:17 | amalloy | gfredericks: you can swap! the :ret back out |
| 17:17 | Frozenlock | gfredericks: To the top? Meaning creating a new toggling function for each item? |
| 17:17 | gfredericks | Frozenlock: (defn make-toggler [f1 f2 & args] (let [a (atom false)] (fn [] (apply (if (swap! a not) f1 f2) args)))) |
| 17:18 | Frozenlock | Ok so yes, create a function for every item. |
| 17:19 | gfredericks | yeah; otherwise you'd have to keep the state somewhere else |
| 17:19 | gfredericks | or have an internal map from arguments to state, which seems a little gross |
| 17:19 | amalloy | Frozenlock: why not just use jquery's .toggle? |
| 17:19 | Frozenlock | amalloy: Because I didn't know there was such a thing... |
| 17:19 | Frozenlock | Still it's a great exercise :) |
| 17:20 | amalloy | i just googled jquery toggle |
| 17:22 | dreish | Well 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:22 | dreish | What's the point of running unit tests if it isn't testing the latest code? |
| 17:25 | Frozenlock | amalloy: How would that be called from cljs? js/jQuery.toggle doesn't seem to work. |
| 17:26 | hiredman | dreish: 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:27 | dreish | This 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:28 | dreish | It 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:28 | hiredman | maybe take it to #leiningen |
| 17:30 | hiredman | I'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:30 | dreish | I was not doing anything exotic. |
| 17:31 | dreish | Unless renaming all the namespaces counts. |
| 17:31 | ejackson | aot will eat your unborn first son. |
| 17:31 | ejackson | avoid it. |
| 17:31 | hiredman | as I said, I've seen transient issues like that, that are generally fixed by restarting the repl |
| 17:32 | dreish | I *never* asked it to AOT compile anything. |
| 17:32 | dreish | It just does it. |
| 17:32 | dreish | Hell, I've rebooted at least five times since the rename. |
| 17:33 | hiredman | anyway, 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:33 | hiredman | your |
| 17:33 | technomancy | :main implies AOT since uberjars don't work without it |
| 17:33 | dreish | I do have a :main |
| 17:33 | technomancy | you can do :main ^:skip-aot my.name.space |
| 17:36 | hiredman | dreish: it sounds like you didn't rename the namespace in your tests anyway |
| 17:36 | dreish | Correct, I forgot to do taht. |
| 17:36 | dreish | If 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:37 | technomancy | we tried doing that for a while, but it broke a lot of protocols and records |
| 17:38 | technomancy | most 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:39 | dreish | I understand, I just hate it when the answer to a problem is, "Never make that particular mistake". |
| 17:41 | technomancy | I can't remove the ":main implies :aot" rule though I wish I could |
| 17:41 | technomancy | but I might be able to move that logic to only apply during uberjar |
| 17:41 | hiredman | the 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:42 | gfredericks | it 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:43 | dreish | All I had to do to discover the problem was run "lein clean ; lein test". |
| 17:43 | dreish | Perhaps if there are old (>1 month?) files under classes/, warn "You have old files in classes/; consider running lein clean" |
| 17:44 | hiredman | technomancy: isn't lein supposed to automatically figure out when to run 'clean'? |
| 17:44 | hiredman | dreish: what version of lein? |
| 17:44 | dreish | Leiningen 1.7.1 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM |
| 17:44 | technomancy | hiredman: yeah, this is one of two exceptions |
| 17:46 | hiredman | would it really break anything if test ran clean first? |
| 17:46 | dreish | Could it be painful for very large projects? |
| 17:46 | technomancy | yeah, it would be very very slow |
| 17:47 | technomancy | you can add it to :prep-tasks in the :test profile if you'd rather take the hit |
| 17:47 | hiredman | ah, test! |
| 17:47 | dreish | My 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:47 | hiredman | dreish: have you seen test! ? |
| 17:47 | dreish | "lein test!" ? |
| 17:47 | clojurebot | ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an")) )] (testar 10 25)) |
| 17:47 | hiredman | dreish: yes |
| 17:47 | dreish | No, does that do a clean first? |
| 17:47 | hiredman | it runs clean and deps first |
| 17:47 | dreish | Ah yes, I see. Thanks. |
| 17:48 | hiredman | technomancy: have you seen https://github.com/relevance/org-html-slideshow |
| 17:48 | technomancy | hiredman: yeah, I think a few clojurewest talks used it |
| 17:49 | Frozenlock | Any only online example of the product it gives? |
| 17:50 | technomancy | I really really hate the org-mode code-quoting syntax, but it's better than latex |
| 17:50 | gfredericks | Frozenlock: https://github.com/abedra/geekfest-linux-kernel-joystick-api |
| 17:51 | Frozenlock | thanks |
| 17:51 | technomancy | hiredman: how's the hardware hacking going? |
| 17:52 | hiredman | technomancy: my beaglebone seems to have a died, so it is stalled |
| 17:52 | technomancy | shame |
| 17:52 | hiredman | but before it did I had a little rover I could drive around via repl |
| 17:52 | technomancy | at some point I want to get something like that set up for the tree house in the back yard |
| 17:52 | hiredman | with a webcam on the front |
| 17:52 | technomancy | maybe something that could open the locks on a trap door |
| 17:53 | hiredman | it was still wired in for power and network, but that should be pretty easy to solve |
| 17:54 | hiredman | it was lots of fun till I realized I wasn't going to finish before the end of my vacation |
| 17:58 | emezeske | Is there an active Clojure OpenGL library out there? Penumbra looks cool, but claims to not be under active development. |
| 18:20 | nvy | I profess my love to you, clojurebot |
| 18:25 | uvtc | ~clojurebot |
| 18:25 | clojurebot | clojurebot is a cold unfeeling genderless mechanism |
| 18:28 | erider | when 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:30 | jeremyheiler | i think it depends if file you loaded changes the ns. |
| 18:31 | erider | (ns foo) sets it right |
| 18:31 | jeremyheiler | yes |
| 18:31 | erider | so I should be able to type foo at the repl and be in the ns right? or no? |
| 18:32 | uvtc | erider: try experimenting with it. :) |
| 18:33 | codedreams | yes, If you type (ns foo) then your prompt will change and you will be in the foo namespace |
| 18:34 | erider | thanks for the help |
| 18:34 | erider | its good now |
| 18:36 | hiredman | load-file will not change the namespace |
| 18:38 | hiredman | load-file creates a fresh binding for *ns*, and any changes will be popped off after the file is loaded |
| 18:47 | gfredericks | (.set #'*ns* 0) is a great way to crash your repl |
| 18:57 | jeremyheiler | hiredman: 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:58 | hiredman | I mean any changes to *ns* |
| 18:58 | jeremyheiler | ah ok, cool. |
| 19:20 | gfredericks | &(.set #'*ns* 42) |
| 19:20 | lazybot | java.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad! |
| 19:21 | amalloy | gfredericks: SANBOX DENIED |
| 19:21 | gfredericks | ,(.set #'*ns* 42) |
| 19:21 | clojurebot | 42 |
| 19:21 | gfredericks | ,(+ 1 2) |
| 19:21 | clojurebot | 3 |
| 19:21 | gfredericks | ,*ns* |
| 19:21 | clojurebot | #<Namespace sandbox> |
| 19:21 | gfredericks | clever |
| 19:24 | uvtc | What's a good ncurses-like library for use with Clojure? |
| 19:24 | Bronsa | ,(do (.set #'*ns* 42) *ns*) |
| 19:24 | clojurebot | #<CompilerException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Namespace, compiling:(NO_SOURCE_PATH:0)> |
| 19:26 | Cr8 | uvtc: for java there's Lanterna http://code.google.com/p/lanterna/ |
| 19:26 | Cr8 | and sjl's wrapper for it; https://github.com/sjl/clojure-lanterna |
| 19:26 | uvtc | Ah. Right. From the "Caves of Clojure" series of articles. Thanks, Cr8. |
| 19:27 | uvtc | Lanterna seems to be pretty actively-developed. |
| 19:31 | Cr8 | Hm |
| 19:31 | Cr8 | Is there a way to make the REPL just pprint everything? |
| 19:33 | gfredericks | that would be cool if repls had hooks for things like that |
| 19:34 | technomancy | you mean ... a reppl? |
| 19:34 | gfredericks | pfff |
| 19:34 | uvtc | teehehe |
| 19:35 | gfredericks | is nrepl hookable like that? |
| 19:35 | gfredericks | I'm thinking a pre-read hook, a post-read hook, and a rebindable printer |
| 19:35 | amalloy | gfredericks: clojure.repl is hookable like that |
| 19:35 | technomancy | gfredericks: I thought you were joking |
| 19:35 | gfredericks | no I don't know most things actually |
| 19:35 | amalloy | but really a repl that pprints everything would get tiring quickly |
| 19:36 | S11001001 | amalloy: I've run slime/cl that way; seems alright |
| 19:36 | gfredericks | amalloy: I see nothing in clojure.repl that looks relevant |
| 19:36 | amalloy | maybe it's clojure.main/repl? i forget where the entry point is |
| 19:37 | technomancy | gfredericks: (clojure.main/repl :print pprint) |
| 19:37 | gfredericks | holy fishsticks |
| 19:38 | technomancy | you can use clojure.main repl as an sql console |
| 19:38 | technomancy | everything is replaceable |
| 19:38 | technomancy | except for loop I guess |
| 19:43 | emezeske | I want a REPL that on every 17th loop interprets my input as Fortran |
| 19:43 | gfredericks | that sounds surprisingly like cicadas |
| 19:45 | amalloy | :eval #((rand-nth [bash irb python fortran eval]) %) |
| 19:46 | gfredericks | amalloy: shuffle them and apply until one of them doesn't throw |
| 19:46 | emezeske | amalloy: Now you've done it -- someone at my work will be enjoying a horrible, horrible prank sometime soon |
| 19:48 | hiredman | I 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:49 | amalloy | emezeske: or they'll just learn to write their programs like http://www.ioccc.org/2000/tomx.c |
| 19:49 | hiredman | it 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:50 | emezeske | amalloy: Hahah... clever hack |
| 19:51 | gfredericks | if 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:51 | Frozenlo` | Whenever I reload the page to which I have my repl connected, it brokes the `pipes': java.net.SocketException: Broken pipe |
| 19:51 | Frozenlo` | Is there a way to avoid it? |
| 19:53 | amalloy | emezeske: when run as a shell script, it invokes make using itself as the makefile, which compiles itself as a C program |
| 19:53 | amalloy | (it wasn't obvious to me that it works as a shell script as well; the obvious parts are C and make) |
| 19:54 | emezeske | Whoa, I didn't catch the shell script part either |
| 19:54 | amalloy | emezeske: it's the false task/goal |
| 19:54 | hiredman | https://raw.github.com/gist/3422228/b97aa2e1e0e58ac35b6f768099d014f4dc0de1ac/nrepl.sh |
| 19:55 | emezeske | amalloy: Damn that's tricky |
| 19:55 | amalloy | gfredericks: on error resume next...for ruby! |
| 19:56 | gfredericks | amalloy: what language is that? |
| 19:56 | amalloy | vb |
| 19:56 | scalabl3 | antares_ my znc crashed, but I saw you found an issue JCBC-91? |
| 20:04 | amalloy | oh wow, the ioccc started back up last year? |
| 20:06 | scalabl3 | antares_: if you run/ran into more issues let me know, i'm back online |
| 20:15 | emezeske | I bet a lisp obfuscation contest would be interesting |
| 20:16 | amalloy | emezeske: start by writing a macro that compiles C |
| 20:16 | emezeske | hahahaha |
| 20:16 | emezeske | oh the pain |
| 20:22 | michaeltomer | I 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:23 | michaeltomer | It should just take a moment. The script is less than 1,000 characters. |
| 20:23 | hiredman | ~style |
| 20:23 | clojurebot | style is http://paste.lisp.org/display/81021 |
| 20:24 | michaeltomer | I had a feeling my indentation was sub-optimal. |
| 20:26 | michaeltomer | When 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:26 | scalabl3 | they should add syntax so it's like )^6 |
| 20:26 | scalabl3 | instead of )))))) |
| 20:27 | Cr8 | I feel like that would make editing a bit janky |
| 20:27 | amalloy | michaeltomer: without paying attention to the file content, https://gist.github.com/3472749 is the normal way to format that |
| 20:27 | napping | use an editor that matches parens, and just let them pile up |
| 20:27 | michaeltomer | amalloy: Awesome, thanks! |
| 20:27 | S11001001 | michaeltomer: you're supposed to go for new records; I've done 14 |
| 20:28 | S11001001 | michaeltomer: and indeed, there is no workable alternative to what napping suggests |
| 20:28 | michaeltomer | S11001001: lol. I imagine I'll adjust once I've stared at it a bit longer. |
| 20:29 | S11001001 | michaeltomer: 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:29 | napping | is it meant to be called with three arguments? |
| 20:29 | michaeltomer | S11001001: That's probably true. |
| 20:30 | michaeltomer | napping: Two arguments in common use, but the third (optional) argument is supplied when the function recurses. |
| 20:31 | michaeltomer | Is that unusual? |
| 20:31 | shawnlewis | how 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:31 | S11001001 | michaeltomer: depends on whether the 3rd arg is intended to be available as external API also |
| 20:32 | michaeltomer | S11001001: No, I don't think I'd want it to be part of the public API. |
| 20:32 | uvtc | 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:33 | S11001001 | michaeltomer: then make a lambda and call it inside the single arity you want public |
| 20:33 | S11001001 | michaeltomer: ((fn [...]) pub pub 0) |
| 20:33 | Raynes | michaeltomer: If parentheses start to pile up in hard to read ways, just factor the function into more smaller functions. |
| 20:34 | michaeltomer | S11001001: Interesting. I'll give that a try. Thanks! |
| 20:34 | S11001001 | rather, ((fn whatever [...] do-stuff (whatever ...)) whatever-args) |
| 20:34 | michaeltomer | Raynes: 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:35 | uvtc | michaeltomer: 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:35 | Raynes | michaeltomer: No real guidelines. I mean, it's common sense. You'll know when your function is too long. |
| 20:35 | shawnlewis | basically i want a single namespace to be a proxy to a bunch of others |
| 20:35 | michaeltomer | uvtc: I think I saw that in the docs. I'll read up on that. Thanks! |
| 20:35 | uvtc | michaeltomer: y/w |
| 20:35 | Raynes | michaeltomer: Your function is reasonable, for example. |
| 20:36 | Raynes | Those closing parens don't bother me in the slightest. |
| 20:36 | amalloy | michaeltomer: see also quot and rem instead of fooling around to get / to do what you want |
| 20:36 | michaeltomer | I haven't encountered rem yet. I'll look that up. |
| 20:37 | michaeltomer | You guys are awesome! Thanks for all the help. |
| 20:37 | gfredericks | (inc you-guys) |
| 20:37 | lazybot | ⇒ 2 |
| 20:37 | hyPiRion | (inc you guys) |
| 20:37 | lazybot | ⇒ 1 |
| 20:37 | gfredericks | $karma you |
| 20:37 | lazybot | you has karma 0. |
| 20:37 | gfredericks | $karma you guys |
| 20:37 | lazybot | you has karma 0. |
| 20:37 | gfredericks | o_O |
| 20:37 | hyPiRion | hm |
| 20:38 | hyPiRion | $karma "you guys" |
| 20:38 | lazybot | "you has karma 0. |
| 20:38 | hyPiRion | ,'(inc you guys) |
| 20:38 | clojurebot | (inc you guys) |
| 20:38 | lazybot | ⇒ 2 |
| 20:38 | gfredericks | oh the $karma is ignoring it I see |
| 20:38 | xeqi | $karma you\ guys |
| 20:38 | lazybot | you\ has karma 0. |
| 20:38 | hyPiRion | heh. |
| 20:40 | michaeltomer | (inc amalloy) |
| 20:40 | lazybot | ⇒ 27 |
| 20:41 | michaeltomer | (inc S11001001) |
| 20:41 | lazybot | ⇒ 3 |
| 20:41 | michaeltomer | (inc utvc) |
| 20:41 | lazybot | ⇒ 1 |
| 20:42 | Cr8 | Perhaps it should take a vector :) |
| 20:42 | michaeltomer | (inc Raynes) |
| 20:42 | lazybot | ⇒ 16 |
| 20:42 | michaeltomer | Cr8: I was just thinking that. |
| 20:43 | michaeltomer | Too many clojurians (clojurites? clojuristas?) are helpful to only be able to provide a single argument at a time. |
| 20:44 | hyPiRion | gfredericks: https://github.com/jhulten/lazybot/blob/master/src/lazybot/plugins/karma.clj#L68 |
| 20:44 | Cr8 | I've used "clojurian" before. |
| 20:44 | hyPiRion | that's the bummer. |
| 20:44 | uvtc | ,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println "(inc" nm ")")) |
| 20:44 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: nm in this context, compiling:(NO_SOURCE_PATH:0)> |
| 20:45 | uvtc | ,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println "(inc" n ")")) |
| 20:45 | clojurebot | (inc michaeltomer ) |
| 20:45 | lazybot | ⇒ 1 |
| 20:45 | clojurebot | (inc hyPiRion ) |
| 20:45 | lazybot | ⇒ 1 |
| 20:45 | clojurebot | (inc gfredericks ) |
| 20:45 | lazybot | ⇒ 1 |
| 20:45 | Cr8 | there's a clever dan. |
| 20:45 | hyPiRion | $karma gfredericks |
| 20:45 | lazybot | gfredericks has karma 8. |
| 20:45 | hyPiRion | So the space messes it up :p |
| 20:45 | Cr8 | hm, did It swallow the space there? |
| 20:45 | Raynes | hyPiRion: That's not the right repo. |
| 20:46 | Raynes | https://github.com/flatland/lazybot |
| 20:46 | Cr8 | why is there even a space |
| 20:46 | uvtc | Ooops. Yeah, should've been `(println (str ...))`. |
| 20:46 | Cr8 | oh, right, I saw a str where there wasn't one |
| 20:46 | hyPiRion | Raynes: I am amazing at linking to wrong forks. |
| 20:46 | hyPiRion | or forks at all, for that matter. |
| 20:47 | emezeske | Personally I prefer the term "clojuror", kind of like sorceror |
| 20:47 | hyPiRion | ,(doseq [n '[foo baz bar]] `(increment ~n)) |
| 20:47 | clojurebot | nil |
| 20:47 | Cr8 | but not like juror |
| 20:47 | Frozenlo` | So there's emacs wizards and clojure sorceror? :) |
| 20:47 | uvtc | "clojurino" ... gets that elementary particle vibe goin' on. |
| 20:48 | michaeltomer | Woot, my first karma point. If video games have taught me anything, it's that karma points will make me all glow-y. |
| 20:48 | hyPiRion | ,(doseq [n '[foo baz bar]] (prn `(increment ~n))) |
| 20:48 | clojurebot | (sandbox/increment foo) |
| 20:48 | clojurebot | (sandbox/increment baz) |
| 20:48 | clojurebot | (sandbox/increment bar) |
| 20:48 | hyPiRion | asdff.d |
| 20:49 | uvtc | ,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println (str "(inc" n ")"))) |
| 20:49 | clojurebot | (incmichaeltomer) |
| 20:49 | clojurebot | (inchyPiRion) |
| 20:49 | clojurebot | (incgfredericks) |
| 20:49 | uvtc | ,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println (str "(inc " n " )"))) |
| 20:49 | clojurebot | (inc michaeltomer ) |
| 20:49 | lazybot | ⇒ 2 |
| 20:49 | clojurebot | (inc hyPiRion ) |
| 20:49 | lazybot | ⇒ 2 |
| 20:49 | clojurebot | (inc gfredericks ) |
| 20:49 | lazybot | ⇒ 2 |
| 20:49 | uvtc | ,(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println (str "(inc " n ")"))) |
| 20:49 | hyPiRion | we should just give up on this. |
| 20:49 | clojurebot | (inc michaeltomer) |
| 20:49 | lazybot | ⇒ 1 |
| 20:49 | clojurebot | (inc hyPiRion) |
| 20:49 | lazybot | ⇒ 1 |
| 20:49 | clojurebot | (inc gfredericks) |
| 20:49 | lazybot | ⇒ 9 |
| 20:49 | uvtc | there |
| 20:49 | uvtc | Sorry. We now resume your regular programming. |
| 20:50 | michaeltomer | hyPiRion: So long as I'm getting karma points, I'm a happy camper. |
| 20:50 | napping | do you want minimal numbers of coins? |
| 20:50 | michaeltomer | napping: We've got coins too? How many until I get an extra life? |
| 20:52 | michaeltomer | napping: If I get one more life, I figure that'll put me at 1. |
| 20:59 | amalloy | michaeltomer: https://gist.github.com/3472749 is two implementations of the same algorithm that might interest you |
| 20:59 | amalloy | using language features you're not familiar with yet, but should introduce you to what is possible, at least |
| 21:00 | michaeltomer | amalloy: Awesome! I'll go through these with a fine-toothed comb. Thanks! |
| 21:00 | michaeltomer | (inc amalloy) |
| 21:00 | lazybot | ⇒ 28 |
| 21:02 | michaeltomer | napping: 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:02 | michaeltomer | napping: However, yes. I am trying to return the smallest number of coins. |
| 21:08 | gfredericks | amalloy: I spent about 7 seconds believing that gist was your first attempt at clojure |
| 21:08 | Cr8 | ahahaha |
| 21:13 | michaeltomer | gfredericks: am alloy just catches on quickly. |
| 21:16 | hyPiRion | burr. |
| 21:17 | hyPiRion | or very high up in the northern one |
| 21:19 | gfredericks | does the earth's angular momentum vector point north or south? |
| 21:19 | gfredericks | the X-hand rule does you no good if you can't remember whether it's right or left |
| 21:20 | tmciver | north |
| 21:20 | gfredericks | oh good. |
| 21:20 | uvtc | Right-hand-rule says it points north. |
| 21:21 | gfredericks | is that an arbitrary choice? is there any physical reason you'd want it pointing one way rather than the other? |
| 21:22 | hoover_damm | gfredericks, north sometimes needs to be reset |
| 21:23 | hoover_damm | gfredericks, it's a feature to be able to 'reset' where north is |
| 21:23 | hyPiRion | gfredericks: I believe it's just practical for the matrix representation |
| 21:24 | gfredericks | hoover_damm: I'm talking more about rotational physics than about planetary stuff |
| 21:24 | hoover_damm | gfredericks, yeah I gathered that now :) |
| 21:24 | uvtc | gfredericks: I think everyone just agreed on a convention to make sure all the signs come out right. |
| 21:24 | hoover_damm | gfredericks, sorry about that. |
| 21:24 | gfredericks | hoover_damm: no problem; it was an interesting reminder |
| 21:24 | gfredericks | rotation is the 17th weirdest thing |
| 21:28 | michaeltomer | gfredericks: What's number 16? |
| 21:29 | gfredericks | high-dimensional geometry |
| 21:34 | gfredericks | somewhere on the list there is a theorem about how languages of subsequences of arbitrary languages are always regular |
| 21:38 | Cr8 | is that ruby? |
| 21:39 | gfredericks | yeah |
| 21:46 | technomancy | released leiningen 2.0.0-preview10 addressing the out-of-project issues |
| 21:47 | tomoj | getting a 404 and `/home/tom/bin/lein2: line 180: downoad_failed_message: command not found` |
| 21:50 | technomancy | oh man, are you serious |
| 21:50 | technomancy | well, you should only be seeing that if it's already broken |
| 21:51 | technomancy | what's the URL you're getting a 404 on? |
| 21:51 | Cr8 | oh |
| 21:51 | Cr8 | i get the same |
| 21:51 | tomoj | can't tell |
| 21:51 | tomoj | ..or don't know how to tell |
| 21:51 | tomoj | oh |
| 21:51 | tomoj | fixed line 180, then "Failed to download https://github.com/downloads/technomancy/leiningen/leiningen-2.0.0-preview10-standalone.jar" |
| 21:51 | Cr8 | fixing the "downoad" typo nets |
| 21:52 | Cr8 | curl: (22) The requested URL returned error: 404 |
| 21:52 | Cr8 | Failed to download https://github.com/downloads/technomancy/leiningen/leiningen-2.0.0-preview10-standalone.jar |
| 21:52 | technomancy | oh, my uberjar upload failed |
| 21:52 | technomancy | that's easy to fix; hang on |
| 21:53 | mefisto` | 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:55 | technomancy | mefisto`: I recommend just running a -main function with a run-jetty call from slime |
| 21:56 | technomancy | tomoj, Cr8: upload succeeded; try again? |
| 21:56 | Cr8 | got it |
| 21:56 | technomancy | cool |
| 21:56 | Cr8 | lein version ✭ |
| 21:56 | Cr8 | Leiningen 2.0.0-preview10 on Java 1.7.0_06 Java HotSpot(TM) 64-Bit Server VM |
| 21:57 | technomancy | cools |
| 21:58 | tomoj | somehow I got "The self-install jar already exists at /home/tom/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar" |
| 21:58 | tomoj | but, working |
| 22:01 | mefisto` | oh, nevermind I see what I was doing wrong |
| 22:01 | mefisto` | technomancy: thanks for answering nevertheless |
| 22:33 | Frozenlo` | Is there the inverse of the clj->js function? |
| 22:54 | tomoj | Frozenlock: js->clj ? |
| 22:54 | tomoj | cljs.core/js->clj |
| 22:56 | Frozenlock | Oh wait you're not joking! |
| 22:56 | Frozenlock | It's there! :D |
| 22:56 | Frozenlock | Thanks |
| 23:01 | Frozenlock | I must be doing something wrong... #<RangeError: Maximum call stack size exceeded> |
| 23:01 | tomoj | is the js object cyclic? |
| 23:02 | Frozenlock | cyclic? Calling itself? |
| 23:03 | Frozenlock | I don't think so, I'm grabbing a simple paragraph. |
| 23:03 | Frozenlock | (js->clj (first ($ :p)) :keywordize-keys true) |
| 23:03 | tomoj | e.g. var foo = {}; foo.foo = foo; |
| 23:03 | tomoj | that's a dom node? |
| 23:03 | amalloy | dom nodes are mad cyclic, aren't they? |
| 23:03 | Frozenlock | Ehh I will go with `dunno' |
| 23:04 | amalloy | Frozenlock: they have parent and children references |
| 23:05 | Frozenlock | Is there a way to strip this down? |
| 23:06 | amalloy | dom 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:08 | Frozenlock | I was hoping to discover these properties by looking at the resulting map... oh well |
| 23:08 | emezeske | Frozenlock: Use your browser's javascript debugger/inspector |
| 23:11 | WuHoUnited | Does anybody know what the difference between the 2 jar files that leinegen produces is. One says standalone, the other doesn't |
| 23:11 | Frozenlock | Standalone has everything you need to run it alone :) |
| 23:11 | Frozenlock | (clojure is included) |
| 23:12 | WuHoUnited | so the difference is just that clojure core is included? |
| 23:12 | WuHoUnited | so if the clojure.jar were on my classpath then i would just need the non-standalone one? |
| 23:13 | tomoj | right. and the standalone one (called an "uberjar") also contains all your dependencies |
| 23:13 | WuHoUnited | thank you. |
| 23:23 | WuHoUnited | i can go to sleep happy. i finally was able to make a class in clojure and call it from java. |
| 23:32 | clj_newb_2345 | I 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:32 | clj_newb_2345 | Anyone here know of good tutorials / guidelines for dealing this task? |
| 23:33 | mybuddymichael | clj_newb_2345: Are you looking for more information on how Javascript works? |
| 23:33 | clj_newb_2345 | I recently skimmed "javaScript the good parts" |
| 23:34 | clj_newb_2345 | though I don't do javascript; I think I understand it well enough to udnerstand what the code is doing |
| 23:34 | clj_newb_2345 | I guess I should first identify where exactly I'm stuck. |
| 23:46 | wmealing_1 | clj_newb_2345: good on you.. its good that you are working to learn your own shortcomings |
| 23:46 | wmealing_1 | that is one of the steps to expertise |
| 23:47 | clj_newb_2345 | lol; unfortunately, as I look over this code, I can't help but think: |
| 23:47 | Frozenlock | What does it mean when a function start with a hyphen? |
| 23:47 | clj_newb_2345 | it's only 4K Lines of Javascript. I bet I can write it in 1K of Clojure from scratch instead. |
| 23:47 | clj_newb_2345 | Frozenlock: that it's private, not included when used with (:use namespace) |
| 23:48 | clj_newb_2345 | wait wait, maybe that's defn- |
| 23:48 | clj_newb_2345 | Frozenlock : ignore what I just said. I was confused. |
| 23:48 | wmealing_1 | you mean like -main ? |
| 23:48 | Frozenlock | I mean like a whole bunch in https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs |
| 23:48 | clj_newb_2345 | Frozenlock: is this in the context of genclass? |
| 23:49 | tomoj | it just denotes the low-level protocol fn on top of which more sophisticated fns are implemented |
| 23:49 | wmealing_1 | i believe its a java interface |
| 23:49 | wmealing_1 | i think |
| 23:49 | tomoj | it doesn't actually mean anything except by convention |
| 23:49 | clj_newb_2345 | it's a *.cljs file |
| 23:49 | clj_newb_2345 | how can it be java? :-) |
| 23:50 | wmealing_1 | that was my understanding, i never use them |
| 23:50 | tomoj | Frozenlock: e.g. consider (-conj [coll o]) vs (conj [coll x & xs]) |
| 23:51 | Frozenlock | Oh excellent, I can then put this in my `disregard' mental bin! |
| 23:51 | clj_newb_2345 | tomoj: I don't understand your example |
| 23:51 | clj_newb_2345 | what is the point of "-" here? |
| 23:51 | wmealing_1 | https://groups.google.com/forum/?fromgroups=#!topic/clojure/rzvMp44ZN0I |
| 23:52 | tomoj | as I said it just denotes that -conj is the lower-level protocol fn on top of which conj is implemnted |
| 23:52 | wmealing_1 | ah so it is protocol, just not java |
| 23:52 | wmealing_1 | thanks tomoj |
| 23:52 | clj_newb_2345 | so if I repalced "-conj" with low_level_impl-conj everywhere, then semantics remains the same? |
| 23:52 | Frozenlock | Thanks indeed. |
| 23:53 | tomoj | yes, see the post wmealing_1 linked |
| 23:53 | tomoj | in particular "The dash has no special significance as far as the compiler is concerned, it's just part of the name." |
| 23:53 | clj_newb_2345 | hmm, From Stuart Sierra -- authorative enough :-) |