2012-09-21
| 01:02 | quizme | has anybody tried to change go-lang syntax to be like clojure ? |
| 01:05 | clj_newb_2345 | i was thinking about the right way to do ajax in clojurescript -- and then i realized: I want ajax calls to behave like future objects in clojure |
| 01:05 | clj_newb_2345 | so does clojurescript support future objects? |
| 01:05 | tomoj | no |
| 01:05 | clj_newb_2345 | i.e. the computation waits until the object returns |
| 01:06 | tomoj | this is why I spent the last 10 minutes looking through a thesaurus |
| 01:06 | clj_newb_2345 | tomj: ? |
| 01:06 | clj_newb_2345 | does this mental model of ajax calls even make sense? |
| 01:06 | tomoj | whatever clojurescript might support, it's not "futures" |
| 01:06 | clj_newb_2345 | clojurescript supports atoms |
| 01:06 | brainproxy | clj_newb_2345: having a future/promise that worked in the same way for clojurescript as w/ clojure would be rather tricky |
| 01:06 | clj_newb_2345 | I think that's about all it supports |
| 01:07 | brainproxy | i mean besides the fact that you don't have threads |
| 01:07 | clj_newb_2345 | brainproxy: what's a minimal tricky example? |
| 01:07 | clj_newb_2345 | brainproxy: doesn't javascript handle this by making everything async? |
| 01:07 | clj_newb_2345 | then allowing event handelrs to interrupt other code |
| 01:07 | brainproxy | yeah, that's kind of the point, w/ javascript/clojurescript you need to deal with callbacks one way or another |
| 01:07 | brainproxy | for async i/o |
| 01:08 | tomoj | clojure doesn't have a suitable reference type |
| 01:09 | brainproxy | tomoj: right, and the fact that there wouldn't be an easy way to "block" the thread until the quasi-future had returned when dereferencing |
| 01:10 | brainproxy | you can sort of fake sleep with a while/for loop, but not in a way that would be useful in production |
| 01:10 | brainproxy | and not in a way that would be friendly to what async i/o, which can't properly "call back" until at least another tick of the event loop |
| 01:11 | ivan | clj_newb_2345: there are Deferreds in Closure Library, and someone wrote some promises in Clojure |
| 01:12 | clj_newb_2345 | http://code.google.com/p/closure-library/source/browse/trunk/third_party/closure/goog/mochikit/async/deferred.js?r=195 <-- does this have documentatino / example code? :-) |
| 01:12 | brainproxy | what might be interesting is a nice "(mostly) idiomatic clojure" wrapper for the Q library and the superagent library |
| 01:12 | ivan | clj_newb_2345: it's easier to understand the Python version first in Twisted |
| 01:12 | brainproxy | i'm not sure right off hand what wrappers for those might look like |
| 01:12 | tomoj | I don't think we should wrap q but write our own |
| 01:12 | ivan | clj_newb_2345: http://ezyang.com/twisted/defer2.html http://twistedmatrix.com/documents/current/core/howto/defer.html |
| 01:12 | brainproxy | but I like Q for JS promises, and superagent for ajax |
| 01:12 | ivan | clj_newb_2345: the JavaScript version is basically the same |
| 01:13 | brainproxy | tomoj: sure, maybe better to write a new lib, though I think it would be useful to reference Q |
| 01:13 | tomoj | definitely |
| 01:13 | brainproxy | it's been awhile but I once read through all of Q a few times until I understood it |
| 01:13 | tomoj | I'm working on my promise type now and have taken some inspiration from q |
| 01:13 | brainproxy | and was pretty impressed at how it's built up |
| 01:14 | clj_newb_2345 | what's Q ? |
| 01:14 | brainproxy | what about a wrapper for superagent? still better to start from scratch you think? |
| 01:15 | clj_newb_2345 | this seems ungoogable |
| 01:15 | ivan | https://github.com/kriskowal/q apparently |
| 01:15 | ivan | 'q library' got me there |
| 01:15 | brainproxy | ^ yep, that's right |
| 01:15 | tomoj | I dunno, ideally I'd want to use closure's ajax stuff |
| 01:15 | brainproxy | tomoj: any particular reason why? |
| 01:16 | tomoj | not a really good one, just would rather avoid external libraries |
| 01:16 | brainproxy | gotcha |
| 01:17 | tomoj | anyway you could probably extend your protocol q promises and whatever superagent returns |
| 01:17 | clj_newb_2345 | i have conflicted about renting an amazon instnat video called "death by entertainment" |
| 01:17 | ivan | do Q promises compose properly? |
| 01:18 | brainproxy | ivan: can you give an example of what would constitute proper vs. improper? |
| 01:18 | ivan | proper = sub-task needs no knowledge of outer task; can return a promise that will be waited on |
| 01:19 | brainproxy | the latter yes, for sure |
| 01:19 | tomoj | looks like superagent doesn't even have a promise type? |
| 01:19 | brainproxy | tomoj: no, but you can use superagent w/ Q |
| 01:19 | brainproxy | for example |
| 01:20 | tomoj | I wonder if tj will ever see the light |
| 01:20 | brainproxy | tomoj: well the callback pattern can be converted to the promise pattern w/o a lot of trouble |
| 01:20 | brainproxy | Q provides a convenience fn for that |
| 01:21 | brainproxy | so I think most of the lib writers see that as a separate concern |
| 01:21 | brainproxy | i.e. if you want promises, interface w/ the callback-oriented lib using a lib like Q |
| 01:22 | brainproxy | anyway, time for bed, ttyl |
| 01:23 | tomoj | that makes some sense |
| 01:30 | tomoj | ivan: do you mean like promise.then(fnThatReturnsAPromise) would be a promise that resolves to the inner promise's value? |
| 01:30 | tomoj | rather than a promise of a promise |
| 01:31 | Sgeo | Clojurescript has macros, right? So shouldn't it be possible to write a macro that converts to CPS form and lets you write code that doesn't look CPS? |
| 01:31 | Sgeo | I guess monads already do something like that, bind sort of takes a continuation |
| 01:31 | Sgeo | (And there is a monad for continuations) |
| 01:31 | tomoj | I think bbloom is trying to do that https://github.com/brandonbloom/clojurescript/tree/cps |
| 01:32 | tomoj | but I don't understand it yet |
| 01:32 | tomoj | hmm |
| 01:32 | tomoj | wrong place https://github.com/brandonbloom/cljs-cps |
| 01:33 | Sgeo | tomoj, awesome |
| 01:33 | tomoj | I don't see why you need call-cc and return yet |
| 01:33 | Sgeo | Except maybe trying to fake call/cc is a bad idea, Oleg has some paper about delimited continuations being more powerful than undelimited continuations |
| 01:33 | lnostdal | using nrepl and nrepl.el; anyone know of a workaround or some way to get (.start (Thread. #(println "foo"))) and (.start (Thread. #(/ 42 0))) not end up in the *nrepl-server* buffer? |
| 01:35 | Sgeo | tomoj, one of the things you can do is pass in a continuation to a function that takes a callback. That callback/continuation will, when called, give control back to what called the function that takes the callback in the first place. |
| 01:36 | Sgeo | Note that it might need a little more plumbing/mutation than that. |
| 01:36 | Sgeo | I'm not entirely sure of the details |
| 01:36 | Sgeo | But you can implement any control flow with call-cc + mutation |
| 01:36 | Sgeo | I think |
| 01:37 | Sgeo | Lake Norman High School |
| 01:37 | Sgeo | oops |
| 01:37 | Sgeo | http://blog.sigfpe.com/2011/10/quick-and-dirty-reinversion-of-control.html |
| 01:38 | tomoj | hmm |
| 01:38 | tomoj | I wonder if continuations would be the plumbing for what I'm thinking of |
| 01:39 | tomoj | I imagine something sort of like aleph's async macro |
| 01:40 | tomoj | walk the code and lift invoked functions to accept and return promises |
| 01:41 | Sgeo | They can be used as a poor-mans co-operative threading |
| 01:41 | tomoj | and do special stuff for special forms, like (fmap a-promise f) could be (let [a-val a-promise] (f a-val)) |
| 01:41 | tomoj | (async (let ...)) |
| 01:44 | tomoj | the confusing thing about a cps transform to me is that I thought the point was to make the async code look just like the sync code |
| 01:44 | tomoj | but if I have to write shift/reset or whatever, that's different from the sync code |
| 01:45 | Sgeo | I think the idea is that you write shift/reset or whatever in functions as a library to wrap around whatever callback-taking library you want to you |
| 01:45 | ivan | tomoj: yes, that would be the right behavior |
| 01:45 | Sgeo | use |
| 01:45 | ivan | (resolving a value in the chain) |
| 01:46 | Sgeo | You could then use the library that wraps around it directly, without mentioning shift/reset. I think. |
| 01:46 | tomoj | ah, I'd hoped that was the case |
| 01:46 | tomoj | ivan: interesting, to me that seems like the wrong behavior :) |
| 01:46 | Sgeo | But, it's similar to making a nice functional wrapper around a Java API so that the user doesn't need to use Java interop directly |
| 01:46 | tomoj | but convenient |
| 01:46 | Sgeo | I may be wrong though |
| 01:47 | Sgeo | I think, in a language that doesn't natively support call/cc or similar, you'd still probably have to wrap your code in some macro |
| 01:48 | tomoj | djanatyn: ##(do (map println [1 2 3]) nil) |
| 01:48 | lazybot | ⇒ nil |
| 01:48 | tomoj | &(do (first (map println [1 2 3])) nil) |
| 01:48 | lazybot | ⇒ 1 2 3 nil |
| 01:48 | ivan | tomoj: it might be the right behavior if you think of Deferreds as a not-yet-known value. functions can return either a value or the Deferred. of course, the illusion completely breaks without a macro that transforms your entire program. |
| 01:49 | tomoj | &(do (first (map println (vec (range 100)))) nil) |
| 01:49 | lazybot | ⇒ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 nil |
| 01:49 | ivan | this cps looks very cool |
| 01:49 | clojurebot | Huh? |
| 01:50 | tomoj | djanatyn: moral of the story is, don't use map for side-effects, use doseq (in spit-{all,java}-pages) for example |
| 01:51 | tomoj | also ##(do (first (map println (iterate inc 0))) nil) |
| 01:51 | lazybot | ⇒ 0 nil |
| 01:51 | ivan | there's an argument to be made for not checking if anything is a Deferred. I haven't really tried that approach to know if it sucks :) |
| 01:52 | tomoj | my library auto-lifts values into deferreds |
| 01:52 | tomoj | my deferred type implements IPending right now but I might take that out |
| 01:52 | djanatyn | I was thinking, "man, it's pretty lame that I'm using map when I'm just throwing away the results. I should probably look up a better function" |
| 01:53 | tomoj | then there is never any need to check |
| 01:53 | tomoj | I keep flip-flopping between IEventual and IObservable |
| 01:54 | tomoj | djanatyn: btw, if you want to keep the results but want strictness (not lazy), there is mapv and friends |
| 01:54 | Sgeo | ,(doc mapv) |
| 01:54 | clojurebot | "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments." |
| 01:54 | tomoj | you can also write (dorun (map side-effect coll)) but doseq is better imo |
| 01:55 | Sgeo | Surely doall? |
| 01:55 | Sgeo | ,(doc doall) |
| 01:55 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time." |
| 01:55 | Sgeo | ,(doc dorun) |
| 01:55 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil." |
| 01:57 | Sgeo | I think reader is the only monad I can think of off the top of my head where Reader r (Reader r a) is useless |
| 01:57 | Sgeo | And it still supports it |
| 01:58 | Sgeo | (And I'm not sure that it's useless, but that seems unlikely. And supporting it is still necessary for the monad laws) |
| 02:01 | tomoj | hard (impossible?) to not support it in haskell, right? |
| 02:26 | Sgeo | Are there any wrappers for JBoss stuff in Clojure? |
| 02:27 | Sgeo | I should clarify that I'm asking because I think seeing examples in Clojure will help me understand what JBoss _is_, exactly, not because I want to use JBoss features in Clojure. |
| 02:31 | dhofstet | Sgeo: there is Immutant, a clojure app server built on top of JBoss: http://immutant.org/ |
| 02:32 | tomoj | I don't understand the immutant.clj stuff |
| 02:33 | tomoj | why don't they just give us a dep to put in project.clj? |
| 02:33 | Sgeo | I guess I'm wondering, why would I want an "application server", what exactly does it do? |
| 02:34 | tomoj | oh |
| 02:34 | tomoj | they fixed that |
| 02:34 | tomoj | there is an :init :immutant project.clj option |
| 02:34 | tomoj | I didn't think to start swank in immutant.clj |
| 02:34 | tomoj | maybe I'll actually try it now |
| 02:40 | tomoj | I _think_ the Event monad works fine without a proper Future monad |
| 02:42 | tomoj | ..unless you want to have an Event (Future a) |
| 02:42 | tomoj | wait, no, that works |
| 02:47 | Raynes | tomoj: I don't understand immutant at all, so you win. |
| 02:47 | Raynes | Sgeo: I've had that exact question answered and explained to me at least 5 times and still don't get it. |
| 02:47 | Raynes | :\ |
| 02:48 | tomoj | big pile of features? |
| 02:48 | tomoj | maybe that's an unfair description |
| 02:52 | tomoj | sweet, it looks like you can (:require [foo :as f]) (:require-macros [foo.macros :as f]) |
| 02:55 | Raynes | tomoj: I figured it was a pile of something. Didn't know it was features though. ;) |
| 02:58 | tomoj | I just don't understand well what capabilities are provided |
| 02:58 | tomoj | but the infinispan cache thing looks sweet |
| 02:58 | Sgeo | infinispan cache? |
| 02:58 | Sgeo | How are these capabilities not merely libraries, but manage to warrant "application server"? |
| 02:59 | tomoj | http://immutant.org/documentation/current/apidoc/immutant.cache-api.html |
| 03:00 | tomoj | infinispan is part of the jboss package |
| 03:00 | tomoj | er, 'bundle' I guess |
| 03:00 | tomoj | you can run it separately too it seems |
| 03:00 | dhofstet | Sgeo: they are single libraries, the application server bundles them |
| 03:00 | tomoj | but I don't know how that would work with immutant? |
| 03:01 | Sgeo | Are filtered methods basically what Clojure does? |
| 03:06 | tomoj | "We use the qualifiers :filter :sign in the method definitions to indicate that we indeed want to use the :sign filter for method selection." |
| 03:07 | tomoj | http://www.p-cos.net/documents/filtered-dispatch.pdf |
| 03:07 | tomoj | is it redundant, or more flexible than multimethods? |
| 03:11 | Sgeo | Uh, defn does stuff that fn doesn't do? |
| 03:11 | Sgeo | (docstring for example) |
| 03:11 | Sgeo | Just looking at the source |
| 03:20 | tomoj | Sgeo: since docstrings go on the var |
| 03:23 | Sgeo | What does .setMacro on a var do? |
| 03:37 | tomoj | Sgeo: so what's wrong with protocol-monads? |
| 03:37 | Sgeo | tomoj, I forget. I do remember having complaints that I later retracted. |
| 03:38 | Sgeo | Um, well, it still doesn't separate out Functor and Applicative properly. |
| 03:38 | tomoj | Sgeo: the reader looks at that to see whether to macroexpand instead of invoking |
| 03:39 | amalloy | tomoj: the compiler |
| 03:39 | tomoj | ah yes |
| 03:39 | Sgeo | And I do think that the Maybe monad isn't ideal for a dynamically typed languag |
| 03:39 | Sgeo | language |
| 03:41 | tomoj | http://www.randomhacks.net/articles/2007/03/15/data-set-monad-haskell-macros interesting |
| 03:42 | tomoj | "Unfortunately, GHC won’t let us use the built-in do syntax." |
| 03:44 | muhoo | yes, i just put ";; ??? profit!" in the middle of a (-> ) chain |
| 03:53 | edmund_ | muhoo, Hilarious ! |
| 05:46 | kral | namaste |
| 05:49 | muhoo | clojurebot: logging |
| 05:49 | clojurebot | Pardon? |
| 05:49 | muhoo | clojurebot: java logging |
| 05:49 | clojurebot | java logging is clown shoes |
| 05:49 | muhoo | bot++ |
| 05:57 | samaaron | how might I get a the docstring of a namespace? |
| 06:02 | Sgeo | In Seesaw, one of the things this guide does is (-> f pack! show!) |
| 06:02 | Sgeo | I take it that pack! and show! actually return their argument? |
| 06:02 | Sgeo | Why? Isn't it more typical for side-effectors to return nil, and use doto instead of ->? |
| 06:10 | laurastrep | hello, i work as a system admin, I do a lot of scripting usually due to my work nature, I use Python and Perl for my advanced scripts, would clojure be good for me? |
| 06:11 | pyr | laurastrep: depends on what type of pb you want to tackle, clojure is not the go-to language for short-lived scripts |
| 06:11 | aperiodic | samaaron: (-> (find-ns 'sweet.namespace.bro) meta doc) |
| 06:11 | pyr | laurastrep: that being said i do a lot of ops work with clojure |
| 06:12 | aperiodic | samaaron: that is (-> (find-ns ...) meta :doc) (doc should be keyword, not symbol) |
| 06:13 | laurastrep | pyr: I wont mind spending few months learning it, but if I do that i would like to see replacing my other languages (means it should have nice verbose syntax and good regex support) |
| 06:14 | samaaron | aperiodic: that's what I tried, I just kept getting nil |
| 06:16 | aperiodic | samaaron: did the namespace always have metadata? i added a docstring to my ns, but had to restart my swank server to see the metadata, even though i was eval-ing the ns form |
| 06:19 | samaaron | oh weird, it works for other namespaces |
| 06:20 | samaaron | yesterday i was trying it with 'clojure.repl |
| 06:20 | aperiodic | how do you mean 'other namespaces', exactly? |
| 06:20 | samaaron | so it works with 'clojure.core and 'quil.core |
| 06:20 | samaaron | but not with 'clojure.repl |
| 06:21 | samaaron | i.e. namespaces other than 'clojure.repl :-) |
| 06:22 | aperiodic | weeeeird |
| 06:22 | aperiodic | what could possibly be causing that? |
| 06:23 | samaaron | god knows |
| 06:23 | samaaron | i just happened to have been trying with that ns yesterday, which is why I couldn't get it to work |
| 06:26 | aperiodic | so clojure.repl attaches its metadata with #^, which is not a reader macro i've seen before, and it's not documented on clojure.org/reader |
| 06:26 | samaaron | ahhhh |
| 06:26 | aperiodic | https://github.com/clojure/clojure/blob/master/src/clj/clojure/repl.clj#L11 |
| 06:28 | samaaron | I think it might have been old syntax? |
| 06:28 | aperiodic | yeah, looks like it: https://github.com/clojure/clojure/commit/787938361128c2bc21ed896dd4523651b59cb420 |
| 06:28 | aperiodic | guess he missed a spot! |
| 06:28 | samaaron | yup |
| 06:29 | samaaron | well, i guess that explains why i'm missing some hair today :-) |
| 06:30 | aperiodic | you can still use it, though, it just... does nothing? |
| 06:31 | aperiodic | the reader seems to just eat it |
| 06:32 | samaaron | yeah, that's the weird thing |
| 06:33 | samaaron | perhaps the reader should throw an error? |
| 06:33 | aperiodic | that's what i'd expect |
| 06:33 | aperiodic | probably a jira should be opened, which I would do if I had any expectation that it would do anything, and also if it weren't jira |
| 06:35 | naeg | you guys saw shake already? http://sunng.info/blog/2012/09/shake-every-program-can-be-a-clojure-function/ |
| 06:36 | naeg | the blog seems not to be on planet clojure |
| 06:37 | Sgeo | naeg, are the programs _functions_ or are they _macros_? |
| 06:38 | Sgeo | Functions may be more useful, even if they're slightly uglier to use |
| 06:38 | naeg | not sure, didn't take a deeper look at it yet |
| 06:38 | Sgeo | For example, with wc as a function, you can map over a sequence of filenames. Can't do that with a macro, at least not easily |
| 06:38 | Sgeo | Although I guess with a macro, #(wc %) would work |
| 06:39 | Sgeo | Still, that's about as ugly as Java methods not being functions. |
| 06:40 | aperiodic | they have to be macros; he doesn't define -a before he uses it |
| 06:40 | naeg | they are: https://github.com/sunng87/shake/blob/master/src/shake/core.clj |
| 06:40 | naeg | not much code anyway |
| 06:40 | clojurebot | sharing code between client and server is not as simple or great as it sounds: http://blog.ianbicking.org/2011/03/30/js-on-server-and-client-is-not-a-big-deal/ |
| 06:43 | aperiodic | yeah, that's not very interesting to me, since macros like that don't compose at all |
| 06:45 | samaaron | if only clojure had fexprs |
| 06:46 | aperiodic | i like hugo duncan's approach with pallet: http://hugoduncan.org/post/2010/shell_scripting_in_clojure_with_pallet.xhtml |
| 06:47 | aperiodic | Sgeo: i think that would end up running "wc <some crazy gensym'd symbol>" |
| 06:48 | Sgeo | samaaron, fexprs do cause some issues: In particular, pretty sure you can't sanely write a code-walker in a language with fexprs |
| 06:49 | Sgeo | But in general I think they're probably more elegant |
| 06:49 | samaaron | Sgeo: yeah, that makes sense |
| 06:49 | Sgeo | (I may be mistaken about one or both of those conclusions) |
| 06:55 | Sgeo | Actually, I like the Tcl way of doing things (although still makes code-walking impossible |
| 06:59 | Sgeo | Basically: Whether or not evaluation of code occurs in a call occurs at the call site, not as a decision made by the function being called |
| 07:17 | Sgeo | If I want to make a Clojure value that's compatible with with-open, I need to implement a .close somehow? What's the recommended way to do that? |
| 07:21 | cemerick | Sgeo: reify |
| 07:21 | clgv | Sgeo: yeah you just need some object having a close theod |
| 07:21 | clgv | *method |
| 07:22 | Sgeo | cemerick, I thought reify is for implementing protocols and interfaces. So wouldn't I need to define a protocol with a close method? |
| 07:22 | clgv | Sgeo: if you have no suitable interface at hand you can create one with definterface and then use reify |
| 07:23 | cemerick | Sgeo: .close is defined by java.io.Closeable |
| 07:24 | Sgeo | Ah |
| 07:24 | Sgeo | There's also a java.lang.AutoCloseable |
| 07:24 | Sgeo | But that's 1.7 and Closeable is 1.5 |
| 07:25 | cemerick | Implementing any interface that has a .close() method will work. |
| 07:30 | Sgeo | Why isn't it a generic function that defaults to trying .close? |
| 07:30 | Sgeo | What if I want a map that contains a :close key to be usable with with-open? |
| 07:31 | clgv | Sgeo: well the macro is pretty simple so you can easily adopt it to your need |
| 07:33 | clgv | Sgeo: you just need to replace the call in the finally-block |
| 07:50 | bruce | hi, guys. I'm wondering how to see the output from multi-process programs? for example, I'm currenlty porting a hadoop project from java into clojure. When I try to upload a file with some progress-hint support(print out some "." to indicate upload progress), but the output all goes to somewhere else instead of the repl. I'm using ritz with slime currently. How can I display those "."? Thanks. |
| 08:01 | powrtoc__ | bruce: I think you need to rebind *out* before you spawn the thread... bindings on new threads default to their root value, which almost certainly isn't what ritz is using |
| 08:02 | SrPx | Hello guys. Just to make sure I do not mess things up. What is the best way to install clojure on os x, providing I'm going to use VIM? Any thing I should specifially do, or just install from the site? |
| 08:03 | xeqi | SrPx: leiningen.org + https://github.com/sattvik/lein-tarsier |
| 08:04 | SrPx | xeqi: Thank you. |
| 08:04 | xeqi | bruce: ##(doc bound-fn) might work |
| 08:04 | lazybot | ⇒ "Macro ([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place." |
| 08:08 | SrPx | xeqi: just to be sure, lein already comes with Clojure, right? I can delete clojure-1.4.0.jar I just downloaded? |
| 08:09 | xeqi | SrPx: short answer: yes |
| 08:10 | SrPx | xeqi: fine! Thank you. |
| 08:10 | xeqi | long answer: lein will manage downloading a clojure jar (along with any other dependencies you want) and setting up the classpath correctly |
| 08:11 | emil``` | does anyone have a clue as to why google closure won't provide goog.ui when using cljsbuild? used to work, then all of the sudden stopped working |
| 08:12 | SrPx | I see |
| 08:13 | SrPx | So I'm now following tarsier installation guide, but: The file /Users/myuser/.lein/profiles.clj does not exist. (*/.lein has just a folder called self-installs) |
| 08:14 | xeqi | SrPx: one is not made by default |
| 08:14 | SrPx | I can just create and it'll be fine? |
| 08:14 | xeqi | you can add the `{:user {:plugins [[lein-tarsier "0.9.3"]]}}` line to the new file |
| 08:14 | xeqi | yep |
| 08:15 | SrPx | so the file is just that line ? |
| 08:15 | xeqi | yep |
| 08:15 | SrPx | okay |
| 08:21 | jondot` | hey guys. any ring middleware for logging based on logback and slf? |
| 08:25 | SrPx | xeqi: "If you are on Unix-like system, you will need to build the client as follows: (...) cp ng ~/bin/" that folder does not exist. Should I just create it? How to put it on path? Can I create a different folder instead? Or even better, is not there alrady an bin folder somewhere? |
| 08:25 | Cheiron | Hi, any Clojure library to help with i18n ? |
| 08:28 | jsabeaudry | had, to reboot, did I miss any answers to Cheiron's question? (I'm also wondering about i18n) |
| 08:29 | Cheiron | jsabeaudry: I'm checking this now https://github.com/ptaoussanis/tower |
| 08:33 | xeqi | SrPx: from a shell you should be able to do `echo $PATH` to see what folders are on the path already |
| 08:33 | jsabeaudry | Cheiron, thanks that looks like an interesting library, even more so when the "TODO" is completed |
| 08:34 | SrPx | xeqi: I have just placed it on /usr/bin instead, is this fine? |
| 08:34 | xeqi | I would expect so |
| 08:42 | SrPx | xeqi: Hey sorry again, are you busy? |
| 08:43 | SrPx | I'm trying to install lein-tarsier, but I got this error on the process: http://www.heypasteit.com/clip/0HJ1 any idea what that means? |
| 08:44 | jsabeaudry | SrPx, lein version ? |
| 08:45 | elzibub | Hello, any Counterclockwise (Eclipse) users here? Sometimes if I close the REPL, it won't start back up again. Anyone know a solution please? |
| 08:45 | SrPx | jsabeaudry: lein 1.7.1 on java 1.6.0_33 |
| 08:45 | emil``` | does anyone have a clue as to why google closure won't provide goog.ui when using cljsbuild? used to work, then all of the sudden stopped working |
| 08:46 | jcromartie | is there any way to resolve a local binding, like (let [x 1] (eval 'x)) |
| 08:47 | jsabeaudry | SrPx, the github page seems to say that lein vimclojur eis deprecated in favor of lein nailgun ? |
| 08:47 | clgv | jcromartie: what are you really trying to accomplish? |
| 08:48 | jcromartie | clgv: to evaluate a list of symbols but leave any that don't have values |
| 08:48 | clgv | jcromartie: concrete usage example? |
| 08:49 | SrPx | jjsabeaudry Im not sure, just trying to use Clojure on OS X. Someone pointed I should install lein-tarsier so I just followed their steps on github. I dont even know what it or vimclojure is yet, was expecting to find out after installation |
| 08:49 | SrPx | jjsabeaudry * |
| 08:49 | jcromartie | a macro for evaluating shell commands that lets you say (ls -l x) where x has a value |
| 08:50 | SrPx | (woops, sorry...my irc is bugging. again: jsabeaudry ) |
| 08:50 | jcromartie | clgv: or (find . -name pattern) where pattern is bound to a string value |
| 08:50 | chouser | you can't even do that in bash. You need $x and $pattern |
| 08:51 | xeqi | SrPx: hmm, thats strange, looks like someone else hit the same thing tho https://github.com/sattvik/lein-tarsier/issues/9 :/ |
| 08:51 | clgv | jcromartie: ah. and find is a macro? |
| 08:51 | samaaron | SrPx: do you already use vim? |
| 08:51 | jcromartie | yes |
| 08:51 | jcromartie | clgv: yeah, specifically, I'm trying to address some issues in this library that popped up today https://github.com/sunng87/shake |
| 08:52 | jsabeaudry | SrPx, not very familiar with clj on osx but, I can see a problem with your setup, it seems you have lein 1.7.1 but I can see earlier on the channel log that you used the instructions for lein2 ({:user {:plugins.... |
| 08:53 | SrPx | jsabeaudry: can I just install lein 2 then ? |
| 08:54 | xeqi | SrPx: thats the recommended version right now |
| 08:54 | clgv | jcromartie: I think you cant tel apart local bindings and symbols that you use as flags/parameternames |
| 08:54 | xeqi | its stable, just not "released" yet cause we need ot make a change in a different part of the ecosystem |
| 08:54 | clgv | jcromartie: an easy way would be to use keywords for flags/parameternames |
| 08:55 | jsabeaudry | SrPx, also, have you tried using clojure on OSX without tarsier plugin? |
| 08:55 | SrPx | jsabeaudry: not yet |
| 08:56 | jsabeaudry | SrPx, I would suggest so, smaller steps make it easier to isolate the problem |
| 08:56 | SrPx | jsabeaudry: just ran 'lein repl' and typed (+ 1 2) to make sure it was working |
| 08:56 | SrPx | if that's what you mean |
| 08:56 | jsabeaudry | SrPx, Yes that's pretty much what I meant |
| 08:56 | SrPx | I have to go now, will install lein 2 when I'm back, hopefully this will solve it. thank you |
| 08:57 | SrPx | see you |
| 08:58 | clgv | jcromartie: oh wait, there is a possibility. you got the implicit &env parameter which should contain all local bindings |
| 08:59 | jcromartie | clgv: hm really |
| 09:01 | jondot` | is there another way to measure time code runs except 'with-profile-data' ? |
| 09:07 | jcromartie | how the heck do I use &env |
| 09:09 | jcromartie | doesn't look like you can get the values huh |
| 09:22 | jcromartie | blech |
| 09:22 | jcromartie | this thing is close to the top story on HN |
| 09:22 | jcromartie | and it's crap |
| 09:22 | jcromartie | http://sunng.info/blog/2012/09/shake-every-program-can-be-a-clojure-function/ |
| 09:25 | chouser | jcromartie: why is it crap? |
| 09:25 | jcromartie | chouser: it's useless |
| 09:25 | jcromartie | except for running static pre-defined shell commands |
| 09:27 | jcromartie | (ls /usr/local) ;; oops, that doesn't work |
| 09:27 | jcromartie | (ls "/usr/local") ;; OK there we go |
| 09:28 | jcromartie | (ls (str home "/" dir)) ;; nope |
| 09:28 | jcromartie | (ls (System/getenv "HOME")) ;; nope |
| 09:28 | jcromartie | etc. |
| 09:28 | jsabeaudry | from the exemples given, I would have expected (ls /home) to work, it doesnt? |
| 09:29 | jcromartie | ,/home |
| 09:29 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: /home> |
| 09:29 | jcromartie | it pretty much doesn't work at all, except for when your symbols are nice symbols and you don't have to use any variables or evaluation |
| 09:29 | jcromartie | hence my &env questions |
| 09:31 | jcromartie | you could quote symbols starting with "-" to start, I suppose |
| 09:32 | jcromartie | or maybe use a format specifier |
| 09:34 | chouser | jcromartie: I see. good analysis. |
| 09:35 | chouser | Can't say I'm surprised. I messed with interfaces between Clojure and shell before with similar goals as this project, but found it to be pretty tricky to do well with enough feature completeness to be worth while. |
| 09:36 | chouser | I've gone the route of supporting ~ like (sh ls ~(str home "/foo")), but again that only gets you part way there |
| 09:37 | jcromartie | yeah |
| 09:37 | chouser | All of which is why clojure.java.shell doesn't even try |
| 09:37 | jsabeaudry | Even if it is incomplete and incorrect in some ways, I find it is still an interesting demonstration |
| 09:37 | jcromartie | there's no good isomorphism between clojure functions and shell invocations |
| 09:38 | jcromartie | the substitutions and redirects and all that stuff are just too insane |
| 09:41 | chouser | jcromartie: That's essentially been my conclusion. I have a friend who hasn't given up yet. |
| 09:41 | octagon | hi, i'm experimenting with cljs, and when i try to implement IPrintWithWriter protocol the compiler can't find it. do i need to :require cljs.core or something? |
| 09:47 | pandeiro | you guys are talking about shake? |
| 09:49 | pandeiro | i am shelling out a couple dozen commands in the app i'm writing and i'm pretty happy doing (def ls (partial sh "ls")) |
| 09:50 | pandeiro | octagon: i don't know the specifics but I think some protocols in cljs lack the initial "I" they have in the JVM version |
| 09:50 | octagon | pandeiro: i'm looking at this guy: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L260 |
| 09:51 | octagon | pandeiro: in my cljs repl i can resolve cljs.core/IPrintable, but not cljs.core/IPrintWithWriter |
| 09:52 | octagon | and when i extend a record to implement the IPrintable using the example at line #391 in that file my repl doesn't print my record using that protocol |
| 09:53 | pepijndevos | What would be an interesting thing to demo in Clojure in 2 minutes? |
| 09:54 | `fogus | Light Table? |
| 09:54 | clojurebot | mutable state is bad |
| 09:55 | antares_ | pepijndevos: overtone |
| 09:55 | _bob | antares_: even Aaron can't demo that in 2 minutes ;-) |
| 09:56 | `fogus | You can download and start LT in ~1 minute (depending on your connection) |
| 09:57 | clgv | jcromartie: to access local binding values you can do something like this: (defmacro env [] (let [symbols (keys &env)] (zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols))) |
| 09:57 | antares_ | _bob: you can demo (some) results :) |
| 09:58 | pepijndevos | `fogus: does it run on clojure-py? i'm going to a python meetup :D |
| 09:58 | `fogus | I doubt it |
| 09:58 | pepijndevos | maybe i'll do some numpy :) |
| 10:00 | antares_ | pepijndevos: then incanter may be a good choice |
| 10:00 | octagon | does anyone know of an example of customizing how the printer prints a record or type in cljs? |
| 10:01 | octagon | by "the printer" i mean like prn and friends, not a HP laser jet printer :) |
| 10:02 | clgv | antares_: incanter depends on java libs. is there a port to clojure-py? |
| 10:03 | antares_ | clgv: I did not realize pepijndevos needs it to run on clojure-py specifically |
| 10:04 | pepijndevos | well, I don't need to, but demoing java to a python crowd is not a nice idea |
| 10:05 | _bob | pepijndevos: and you have to demo tinight? |
| 10:13 | pepijndevos | _bob: well, sortof. I'm going to talk5 minutes, and I thought I should do 2 minutes about clojure-py :P |
| 10:14 | jcromartie | so really |
| 10:14 | jcromartie | how do I bind a reader function with *data-readers* |
| 10:14 | jcromartie | ,(binding [*data-readers* {'x println}] (eval '(#x what))) |
| 10:14 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag x> |
| 10:15 | jcromartie | I'd say there is a function for tag x… but that's just me. |
| 10:25 | jkkramer | ,(binding [*data-readers* {'x #'pr-str}] (read-string "#x what")) |
| 10:25 | clojurebot | "what" |
| 10:26 | jkkramer | jcromartie: the literal #x gets read before any of your binding code has evaluated |
| 10:29 | pandeiro | anyone else have invisible text in light table? |
| 10:30 | jcromartie | ah ha thanks jkkramer |
| 10:30 | jcromartie | I knew it had to be something silly |
| 10:38 | zoldar | I've started using nrepl along with nrepl.el and so far it's doing alright (save for a couple strange hangups). Now the thing that I miss a bit form slime is the hint of function's arguments in the echo area. I know about C-c d but it outputs to a buffer. Should it be possible to accomplish from elisp level, or are there some information that nrepl should expose for that purpose? |
| 11:08 | maleghast | Hello All |
| 11:11 | maleghast | Quiet in here... |
| 11:12 | chronno | Hi there :-) |
| 11:12 | maleghast | chronno: Hello :-) |
| 11:13 | maleghast | chronno: Is everyone busily writing Clojure, or is the channel full of people who simply leave themselves logged in for days on end..? |
| 11:14 | chronno | Nah, the channel has been quiet for about half an hour. |
| 11:14 | nDuff | Some combination of both. |
| 11:14 | maleghast | Fairy snuff :-) |
| 11:14 | chronno | he |
| 11:14 | maleghast | My entire experience of IRC seems to be wandering into channels just as they go quiet - talk about useless super-power! |
| 11:14 | maleghast | ;-) |
| 11:18 | abalone | is it bad to leave oneself logged in? |
| 11:18 | scriptor | nope, why would it be? |
| 11:18 | scriptor | it's pretty common to just idle in several channels |
| 11:18 | maleghast | abalone: No, not at all - it's just with over 400 people in the channel and no conversation going on I was wondering... |
| 11:18 | abalone | ok. sometimes i sleep. |
| 11:19 | maleghast | I miss sleep (young kids in the house) |
| 11:19 | scriptor | lots of people also use irc through a vps so that they're on 24/7 |
| 11:19 | scriptor | discounting downtimes |
| 11:20 | abalone | maleghast: sleep training was tough but it worked. |
| 11:20 | abalone | sorry. i'll use PMs for that |
| 11:20 | maleghast | abalone: You are giving me hope - did you let them cry it out? My wife can't bring herself to go that route... |
| 11:20 | maleghast | abalone: Yeah PM is probably better… Talk about OT ;-) |
| 11:22 | Hodapp | http://concur.rspace.googlecode.com/hg/talk/concur.html#landing-slide - gotta say I rather like these slides |
| 11:27 | maleghast | Hodapp: They are great - and interesting too... |
| 11:30 | abalone | maleghast: hope you got my PMs. |
| 11:39 | gtrak | hey, is it possible to create reusable functions that have assertions in them and have clojure.test show more informative source locations on FAIL? At the moment, it only shows the location in the assertion function, which is pretty useless |
| 11:40 | gtrak | I can make them all macros but that sucks |
| 11:41 | pandeiro | anyone using light table? |
| 11:42 | abalone | i sure hope so. i'm making progress on paredit for codemirror which it uses |
| 11:42 | maleghast | I've tried Lighttable, but it's not "ready" yet, so I have gone back to emacs... |
| 11:43 | abalone | pandeiro: a bug blocked me from using it. it had to do with not showing my namespaces |
| 11:43 | abalone | i haven't checked recently to see if it was fixed |
| 11:43 | pandeiro | abalone: latest version? |
| 11:44 | abalone | it's probably a very specific bug if it still exists. i'd bet it won't affect most people who try it |
| 11:44 | pandeiro | i am wondering what kind of reflection is possible |
| 11:44 | pandeiro | or discoverability i mean |
| 11:44 | pandeiro | i remember ibdknox's presentation showing some docstrings or sources |
| 11:45 | pandeiro | vaguely |
| 11:45 | pandeiro | maybe i am making that up |
| 11:45 | xeqi | gtrak: I ended up making macro sfor a similar thing. you might be able to do something with a `with-redefs` on #'clojure.test.file-and-line |
| 11:45 | xeqi | though it would be ugly |
| 11:48 | duck1123 | gtrak: could you get and parse a stacktrace to get the parent of the assertion and display that info when it fails? |
| 11:50 | gtrak | duck1123: yea I was hoping there'd be a better way though |
| 11:50 | gtrak | for instance what if I want to compose them? |
| 11:50 | duck1123 | If there is, I don't know of it. |
| 11:51 | gtrak | I'd have to keep a stack of invocations to parameterize file-and-line |
| 11:51 | ejackson | is there a way to do a lazy flatten ? |
| 11:53 | ejackson | i guess (comp lazy-seq flatten) :) |
| 11:54 | ejackson | explicitly though, as its a macro. |
| 11:54 | duck1123 | it's probably better to try to produce the right shape in the first place |
| 11:57 | ejackson | duck1123: for sure. I'm being sneaky using def to create a lazy collection of stuff from a db. Must be lazy or it won't load compile the ns w/o the db present. |
| 11:57 | ejackson | the frisson of naughtiness keeps things exciting |
| 11:58 | ejackson | wow, it wasn't that dreadful ! |
| 12:09 | pandeiro | answering myself: docstrings in light table via (doc ...) in instarepl only, i guess |
| 12:11 | pandeiro | i still don't understand the point of removing editors in light table |
| 12:12 | pandeiro | also suspicious that there is an impl bug with that |
| 12:12 | scriptor | removing editors? |
| 12:12 | pandeiro | they don't go away, they just get disabled and you can't do anything with them |
| 12:13 | scriptor | which editors, the per-function blocks? |
| 12:13 | scriptor | hmm, they go away for me |
| 12:21 | pandeiro | scriptor: they just were going black for me |
| 12:21 | pandeiro | don't actually disappear |
| 12:21 | scriptor | pandeiro: which OS are you on? |
| 12:22 | pandeiro | i'm using the light table terminology, it says Ctrl-K removes an editor |
| 12:22 | pandeiro | sorry, Ctrl-D |
| 12:22 | pandeiro | Linux |
| 12:22 | scriptor | hmm, must be a bug then |
| 12:22 | varna | hi, i bought the clojure programming book, and my head started spinning for the first chapter, its like it assumes you are already a clojure programmer and want to re-learn it, is there any other sources to start learning clojure?! |
| 12:23 | S11001001 | varna: do you come from land of java or lisp? |
| 12:23 | scriptor | varna: which one did you get, the o'reilly book? |
| 12:23 | varna | i bought the oreilly one scriptor , S11001001 i am a php/python programmer |
| 12:24 | scriptor | hmm, I thought that one was supposed to be for beginners, maybe it assumes jvm knowledge |
| 12:24 | scriptor | varna: you can start with the tutorial on http://tryclj.com/ |
| 12:24 | pandeiro | varna: it is going to take you a few months to grok it, i'd give that book more than one chapter, but a book alone isn't enough obviously |
| 12:24 | cemerick | scriptor: It doesn't, but I suppose it's not working for varna :-( |
| 12:25 | varna | cemerick: i really tried but it keeps saying: like in all lisps! I have never tried lisp! :( |
| 12:25 | clgv | varna: you can try "programming clojure" from Stuart Halloway as an alternative. I read its first edition without prior clojure knowledge and got started pretty fast |
| 12:26 | nDuff | varna: Which book? The O'Reilly one? |
| 12:26 | Adeon | do you think it would be a good idea to recommend lisp books that aren't about clojure specificially, in case the lisp world is completely unknown? |
| 12:26 | pandeiro | programming clojure is good, clojure in action is also good if you prefer to just see sample code mostly |
| 12:26 | scriptor | Adeon: sounds risky, considering how different clojure can be from, say, CL |
| 12:26 | varna | nDuff: yes the oreilly one |
| 12:27 | Adeon | hmm, yes, that might indeed be risky |
| 12:27 | technomancy | nDuff: when I read the sample chapter from that book I ended up more confused than when I started |
| 12:27 | cemerick | varna: We draw a lot of comparisons to Ruby, Python, and Java. There are very few comparisons to other lisps… |
| 12:28 | varna | cemerick: i really still cant pass the first chapter! its sooo heavy ! |
| 12:29 | cemerick | varna: Then by all means dig into the practicums, e.g. web development and such, and return to the introductory stuff later on? |
| 12:30 | varna | cemerick: will try that, i bought the book already and have to try my best with it.. |
| 12:30 | pandeiro | sometimes easier to synthesize theoretical knowledge yourself from practical examples well explained |
| 12:30 | dnolen | varna: it might be worth trying to explain what you feel like you're getting tripped up on. |
| 12:30 | pandeiro | and try writing some code, especially |
| 12:30 | scriptor | varna: also, it's very useful to have a repl in front of you while reading |
| 12:31 | scriptor | instead of reading in long blocks without actually writing any code |
| 12:31 | varna | ok will give few examples on what makes me feel lost |
| 13:27 | emezeske | dnolen: Did you see http://www.50ply.com/cljs-bench/55.png ? |
| 13:34 | TimMc | Whoa. What caused that 10x speedup? |
| 13:38 | gtrak | this one: https://github.com/clojure/clojurescript/commit/c8bc05ca8e3c7e30a85148dd67398aa4d0e6b468 |
| 13:38 | duck1123 | If that graph can be trusted, that's awesome |
| 13:39 | mpan | what is a more general use for syntax-quote and unquote outside of macros? |
| 13:40 | emezeske | duck1123: The graph can be trusted. Actually, the gains are much bigger in older browsers not shown (like IE8) |
| 13:40 | duck1123 | yay perf improvements, then |
| 13:41 | emezeske | :) |
| 13:41 | emezeske | That change really helps for apps that use pr-str as a serialization format |
| 13:42 | gtrak | mpan: what if you had to use cons all the time, wouldn't that get tedious? I see it as a templating tool |
| 13:42 | ibdknox | pandeiro: the point is necessarily to remove them, so much as it is to only open the ones you care about. |
| 13:42 | ibdknox | pandeiro: more often than not, you are not concerned with a whole file at once |
| 13:42 | ibdknox | pandeiro: but rather pieces from many files |
| 13:42 | gtrak | ,(eval (let [a 2] `(+ 1 a)) |
| 13:42 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 13:43 | gtrak | ,(eval (let [a 2] `(+ 1 a))) |
| 13:43 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 13:43 | gtrak | &(eval (let [a 2] `(+ 1 a))) |
| 13:43 | lazybot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 13:43 | gtrak | you get the point, ... (eval (let [a 2] `(+ 1 ~a))) |
| 13:43 | pandeiro | ibdknox: got ya, i was getting some inconsistent behavior with chromium on linux but it seems to have fixed itself (intelligent software!) |
| 13:43 | mpan | but like, what's the case where you want (eval `(+ 1 ~a)) over just (+ 1 a) ? |
| 13:44 | technomancy | mpan: I do something like that in die-roboter for distributed messaging |
| 13:44 | pandeiro | one shortcoming i am noticing is that i cannot access project ns's that are included in my project.clj if they aren't already required/used in a clj file prior to connecting |
| 13:45 | ibdknox | pandeiro: not sure I understand what you mean there |
| 13:45 | mpan | technomancy: what distinguishes the use-case as one where just directly calling the fn is insufficient? |
| 13:45 | technomancy | mpan: it's somewhat common in tooling as well; like the nrepl.el client. very uncommon in application code though. |
| 13:45 | gtrak | mpan: the issue is that lists eval to applying to the first arg the last args, and quote is a way out |
| 13:45 | technomancy | mpan: well in this case you construct the form on one machine and eval it on another after sending it over a message queue |
| 13:46 | loliveira | does somebody knows a good text classifier? What is your take on incanter.bayes? |
| 13:46 | ibdknox | pandeiro: as in if you add a new dependency? |
| 13:46 | pandeiro | ibdknox: should i be able to Ctrl-S a (ns ... (:require ... :as foo)) and then access foo/whatever at the scratch window? |
| 13:46 | technomancy | so it almost never makes sense to quote and eval something together in the same line like that |
| 13:46 | pandeiro | dependency is already mentioned in project.clj |
| 13:47 | mpan | gtrak: if you want to make something to eval, though, why wouldn't you arrange to have the thing to eval in the first position? Sorry, I don't understand the case you're describing |
| 13:47 | ibdknox | pandeiro: as long as you've eval'd the new ns form you should be able to |
| 13:47 | mpan | technomancy: that sounds cool. Is that generally applicable for storing "code" as an intermediate in a system? |
| 13:47 | pandeiro | ibdknox: ok, let me be sure i am not doing anything too stupid |
| 13:47 | gtrak | ,(eval (cons + (cons 2 (cons 1)))) |
| 13:47 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 13:47 | pandeiro | otherwise i will add something to the bug tracker if that would help |
| 13:48 | ibdknox | pandeiro: yeah, if you can give me a solid reproduction I can get in there and fix it :) |
| 13:48 | technomancy | mpan: yeah, so that would be either for distributed systems, IDE-type tooling, or things like leiningen plugins where you have to cross process boundaries. |
| 13:48 | gtrak | mpan: because you don't want it to eval while you're building it |
| 13:48 | mpan | gtrak, oh, as in you're constructing that at runtime! thanks for clarifying |
| 13:48 | gtrak | in other words the 'value' of a list is by default a function application |
| 13:48 | mpan | I had a weird idea once where you had a game where the objects in the game carry their own code in their stored representation |
| 13:49 | mpan | and users with sufficient privilege could "reprogram" the game's objects from within the game |
| 13:49 | ibdknox | mpan: no so weird of an idea, I built something like that :) |
| 13:49 | ibdknox | and that's actually how light table works now |
| 13:49 | mpan | ibdknox: how did you deal with the security-related issues? |
| 13:50 | mpan | i.e. how does one do this without essentially exposing a shell with the privileges of the game process? |
| 13:50 | ibdknox | mpan: I didn't the point *was* for people to be able to reprogram the game. But you'd deal with it the ordinary manner you deal with security. It's no different than an admin area in a website really |
| 13:51 | mpan | like, if someone does bad things with an average admin panel, they ruin the state of that program, but not everything else on the machine that the account can access |
| 13:51 | ibdknox | mpan: that's just a matter of sandboxing |
| 13:51 | synx | cheezey |
| 13:52 | mpan | good point |
| 13:52 | mpan | thanks! |
| 13:53 | mpan | ibdknox: btw is the source for that game you made available? |
| 13:53 | ibdknox | mpan: not exactly, but you can extrapolate from this: https://github.com/ibdknox/live-cljs |
| 13:54 | mpan | awesome! thanks! |
| 13:54 | cheezey | hi synx |
| 14:02 | juhu_chapa | Hi all! Is freed memory when (dissoc)iating a coll? |
| 14:08 | nDuff | juhu_chapa: Only when there's no longer a reference to the old, non-dissoc'ed object. |
| 14:10 | harob | Hi! I'm running an API server built on compojure+jetty , and I'm having problems with the first requests to it taking multiple seconds every time I redeploy to production. What is the best practice for deploying/compiling/starting an app like this in production? I'm guessing it's not `lein run` like I'm doing right now... |
| 14:11 | ibdknox | harob: lein trampoline run |
| 14:12 | ibdknox | harob: that will exit the lein process and just let your process run |
| 14:12 | ibdknox | harob: though that won't help you with the jvm startup time |
| 14:12 | harob | ibdknox: Won't that still be slow due to JIT compilation when the server gets hit with first serious request? |
| 14:13 | ibdknox | harob: that I solved by using a reverse proxy |
| 14:13 | ibdknox | wait until the server is fully up before switching to the new process |
| 14:14 | harob | Ah so you have two servers going behind a reverse proxy, and have one take the load while the other is starting up? |
| 14:14 | ibdknox | yessir |
| 14:14 | gtrak | harob: just create a dummy request in your startup script howabouts? |
| 14:14 | ibdknox | something along those lines is how virtually all no-downtime deploys work |
| 14:14 | technomancy | harob: also it's not a bad idea to perform `lein compile :all` in your build process |
| 14:15 | technomancy | harob: how you build a deployable artifact? |
| 14:16 | harob | Right now I'm just shipping off the source and running lein run, which I am going to guess is not the right way. I was going to switch to `lein uberjar` on the deployer and then `java -jar …` on the server. Would that be a good way to do things? |
| 14:17 | ibdknox | both work :) |
| 14:17 | technomancy | the main thing you want to avoid is fetching dependencies at deploy time |
| 14:17 | technomancy | so if you use lein in production you want to 0) be sure you're using trampoline and 1) deploy a project dir that has a preloaded local repo |
| 14:18 | juhu_chapa | nDuff: thank you! |
| 14:18 | technomancy | typically this is done by having the CI server test and then tarring up the build dir upon a successful test run, and then using offline mode in production to ensure snapshots don't get updated, though of course avoiding snapshots in deployed code is even better |
| 14:19 | technomancy | anyway, you can make it work with lein trampoline run, but an uberjar is a lot simpler |
| 14:19 | harob | Ok, sounds good, I think I'll go the uberjar route :) |
| 14:20 | harob | Thanks for the help, btw I'm a huge fan of both leiningen and light table! |
| 14:20 | hiredman | lein run vs. uberjar is unlikely to effect runtime and jvm warmup |
| 14:21 | pandeiro | what is the difference re: deps with lein run and lein trampoline run? i'm missing something |
| 14:22 | technomancy | yeah, the things that'll affect startup time are full AOT at build time and possibly using bootclasspath and tiered compilation if you have an uberjar |
| 14:22 | technomancy | pandeiro: trampoline saves memory by allowing leiningen's JVM to exit before launching the project |
| 14:23 | hiredman | aot is unlikely effect jvm warm uptime either, unless you are loading more code after your application has "started" |
| 14:23 | hiredman | warm up |
| 14:24 | hiredman | a lot of this really depends on what you mean by "the first requests are taking multiple seconds" |
| 14:25 | hiredman | the first requests after the app has started? the first requests after typing `lein run` and switching to your webbrowser and hitting referesh? |
| 14:28 | harob | I haven't got too far in working out what's really going on, but the first ~10 API requests that actually make it through to compojure just after post-deploy start-up take ~8seconds rather than ~0.05. Unfortunately things seems to fail in a cascading fashion after that. This is on a server that receives ~30 QPS. |
| 14:28 | harob | Actually, does anyone know what knobs, if any, I should tuning on Jetty in production? |
| 14:30 | hiredman | the first thing to do is look through your code for anything (database connections, etc) that happen the first time through |
| 14:30 | harob | Well I do connect to a local postgres DB using out-of-the-box Korma. What would I tune on that? |
| 14:31 | hiredman | korma may be doing a lot of stuff |
| 14:31 | hiredman | I am not overly familiear with it, but at the very least I think it is spinning up a connection pool |
| 14:32 | harob | Yes. I have a "warmup" route that I call before putting the newly-deployed box into live traffic that makes a DB request, which I was thinking would cause all that to get spun up. |
| 14:34 | hiredman | and it hits the db? |
| 14:34 | harob | Yes |
| 14:34 | hiredman | what middleware are you using? |
| 14:36 | harob | For the web app: composure's handler/site. For the DB it's whatever korma uses under the hood, which I believe is JDBC |
| 14:37 | hiredman | it is possible that the initial slow requests are due to the code not being jitted yet, which is the most annoying to deal with |
| 14:38 | harob | Would the `lein compile :aot` or the `lein uberjar` beforehand fix that? |
| 14:38 | technomancy | harob: you could put :aot :all in a :release profile and then do `lein with-profile release uberjar` |
| 14:38 | hiredman | the HFT guys talk about sending warmup messages through, a single request doesn't cut it, and they have to be a realistic set of data to warm up on |
| 14:39 | hiredman | harob: unlikely |
| 14:39 | hiredman | generally all the clojure code will already be loaded and compiled (to bytecode) before you the web server starts |
| 14:40 | technomancy | not saying it'll fix the exact problem you're seeing, just that it's a general good idea |
| 14:40 | harob | technomancy: will do |
| 14:41 | harob | hiredman: when you say "a single request doesn't cut it", do you mean that I should hit all clojure source files, or something else? |
| 14:45 | hiredman | harob: if the issue is requests are slob becuase the code has not been jitted yet (which hasn't been proven) |
| 14:45 | hiredman | the jit works by run time profiling and using that to drive compilation |
| 14:46 | hiredman | if you drive the jit with data that doesn't match real data your code will not be optimized for real data |
| 14:47 | technomancy | hotspot doesn't attempt optimization until IIRC around 10k hits to a given codepath |
| 14:47 | technomancy | if you're talking about JVM-level jit rather than Clojure compilation |
| 14:47 | harob | Wow, that is a lot more sophisticated than I had assumed |
| 14:47 | hiredman | technomancy: right |
| 14:49 | pandeiro | ibdknox: fyi problem was on my end, able to require stuff fine. one question: will it be possible to somehow render html created with a hiccup template? (i assume it's not possible at the moment) |
| 14:49 | hiredman | harob: yeah, but we have no smoking gun that code warm up in the jit is the issue for you |
| 14:50 | loliveira | does somebody knows a good text classifier? What is your take on incanter.bayes? |
| 14:52 | harob | hiredman: Any idea on how I could diagnose what it is? |
| 14:53 | hiredman | harob: you can try and strip it down to a minimally reproducable case, which may tell you what it is, or then you start profiling the minimal case |
| 14:54 | harob | Makes sense. What do you use for profiling? And is there anything that could work in a production-ish setting (e.g. if I tee of a small subset of traffic)? |
| 14:57 | hiredman | harob: visualvm/jvisualvm is sort of the go to profiler because it is free and comes with jdk, but it may be difficult to get working in a production setting |
| 14:58 | nz- | harob: korma is using c3p0 connection pool, are you sure you have enough connections? |
| 15:01 | harob | nz-: Ah, I have not looked into that at all. I'll google around. Any pointers on where and to what values to tweak that connection pool? |
| 15:02 | hiredman | yeah, so if in the process of stripping it down to the minial reproducable case, and the minial case with korma has the slow down, and without doesn't, then you know it is something with korma |
| 15:04 | harob | hiredman: Makes sense. And I'll try out visualvm. |
| 15:08 | nz- | harob: basically just check that size of connection pool is large enough you are having large number of simultaneous connections |
| 15:11 | em-dash | is there a clojure bundle newer than swanodette's [1] and with more features than mmcgrana's [2] (eg., repo integration)? [1] https://github.com/swannodette/textmate-clojure [2] https://github.com/mmcgrana |
| 15:11 | em-dash | s/repo/repl/ |
| 15:11 | em-dash | er, Clojure bundle for TextMate, I mean |
| 15:11 | technomancy | em-dash: no; no one has worked on that in ages |
| 15:16 | technomancy | now that textmate is free maybe someone will revive it though |
| 15:19 | dnolen | em-dash: nope, I started that years ago when cake made it doable. SublimeText 2 has a simple Clojure integration story though it's not clear to me how active the SublimeREPL work on Clojure support is. |
| 15:30 | em-dash | dnolen: I was wondering if lein 2.0's 'repls/cljsh' plugin might make integration fairly straightforward (eg., similar effort as cake) |
| 15:31 | em-dash | but I'm a n00b, so I'm fumbling my way through |
| 15:31 | em-dash | bbl |
| 15:31 | dnolen | em-dash: maybe, but to be honest I think TextMate just doesn't offer a good experience for Lisp dev |
| 15:48 | technomancy | something about how its extension mechanism just doesn't support having external code change buffer contents? |
| 15:51 | technomancy | though vim has the same problem, and people make it work |
| 15:52 | dnolen | technomancy: it could probably be done, but you can't split views, which kind of what you want when working w/ a REPL |
| 15:53 | dnolen | technomancy: TextMate had a bad habit of showing Ruby output in a whole new WebKit based window, so it's oriented towards showing output that way. |
| 15:53 | dnolen | technomancy: good enough *maybe* for Rails - crappy for Lisp. |
| 15:55 | technomancy | so the difference is that vim is already in a terminal and can use screen/tmux splits, I guess |
| 15:56 | scriptor | makes integration with the editor difficult, though |
| 15:59 | broquaint | What's the best way to view the 1.4.0 docs given clojuredocs.org is lagging? |
| 15:59 | hiredman | ,(doc doc) |
| 15:59 | clojurebot | "([name]); Prints documentation for a var or special form given its name" |
| 16:00 | technomancy | (but in your own repl, not in this channel) |
| 16:00 | dakrone | broquaint: or http://clojure.github.com/clojure/ |
| 16:00 | jkkramer | or http://clojure.github.com/clojure/ |
| 16:01 | broquaint | Thanks :) |
| 16:02 | broquaint | I've found (doc) more useful when I already know what it that I want explained :) |
| 16:14 | duck1123 | clojureatlas is good for when you know the ype of operation you want, but not what it's called |
| 16:20 | aperiodic | also, findfn |
| 16:20 | aperiodic | is there any way to use findfn besides talking to a lazybot instance? |
| 16:21 | amalloy | $google raynes findfn |
| 16:21 | lazybot | [Raynes/findfn · GitHub] https://github.com/Raynes/findfn |
| 16:23 | aperiodic | grazie |
| 16:23 | Raynes | README is probably outdated because I changed function signatures. |
| 16:23 | Raynes | Look at the tests for examples. |
| 16:31 | aperiodic | is it just me, or is it slower than it used to be? |
| 16:31 | amalloy | much |
| 16:32 | amalloy | security concerns |
| 16:32 | aperiodic | is there any way i could turn all that off i'm just, you know, using it in my repl? |
| 16:32 | aperiodic | i'll take full responsibility for whatever happens |
| 16:33 | amalloy | aperiodic: probably, but you underestimate how chaotic it would be if totally unsandboxed |
| 16:33 | aperiodic | amalloy: scare me |
| 16:35 | Raynes | aperiodic: I managed to replace eval with defstruct. |
| 16:35 | Raynes | :p |
| 16:35 | Raynes | Though not scary. |
| 16:35 | Raynes | Amusing nonetheless. |
| 16:35 | Raynes | Actually it was xeqi that did that. |
| 16:36 | uvtc | aperiodic: You don't know the elemental forces you're trifling with! |
| 16:36 | Raynes | aperiodic: Anyways, you can't turn sandboxing off. It isn't there for outside users, it's there to make sure that even if you're using it in the repl you don't blow up your computer. |
| 16:37 | aperiodic | Raynes: how do you mean 'blow up'? take up too much CPU, allocate untold gigabytes of memory, rm -rf /, ...? |
| 16:37 | Raynes | Well, you go through every single function. |
| 16:37 | aperiodic | it's not obvious to me what awful things could happen here, since i have only the faintest idea of what's going under the hood |
| 16:38 | Raynes | aperiodic: It goes through every single function in clojure.core and some other nses and runs them against the arguments you pass. |
| 16:38 | aperiodic | sure. but i thought that's how it used to work, and it was pretty fast then (i remember being surprised at how zippy it was) |
| 16:39 | Raynes | Yes, because it simply looked at var names. |
| 16:39 | amalloy | aperiodic: no, it attempted sandboxing but was just not very thorough about it |
| 16:39 | Raynes | But if you don't actually run the code in the sandbox, nothing gets expanded. |
| 16:39 | amalloy | if you went back to that behavior you'd probably be happy |
| 16:39 | amalloy | it's "turn off the sandbox entirely" that would be a disaster |
| 16:39 | Raynes | So 'defstruct' is not directly sandboxed and since it isn't expanded, 'def' isn't caught. |
| 16:40 | Raynes | As an example. |
| 16:40 | aperiodic | oh. well, i would like to take my chances with that in my own repl |
| 16:40 | aperiodic | amalloy: is there an easy way to go back to that? |
| 16:40 | Raynes | Ugh. |
| 16:40 | Raynes | Back up the commits back to where it was broken, I guess. |
| 16:43 | devth_ | anyone know why clojure.xml/parse would 403 on me, while a simple curl or GET via http.async.client works fine? |
| 16:45 | hiredman | devth_: I'd check the exception to see what resource the 403 is for |
| 16:48 | devth_ | it's a runtime exception. stacktrace originates in javax.xml.parsers.SAXParser.parse |
| 16:53 | aperiodic | Raynes: wee, nice and zippy now. also, i updated the examples in the README (check your pull requests) |
| 16:54 | Raynes | Coolio. Thanks. |
| 16:55 | aperiodic | de nada |
| 16:55 | jkkramer | devth: I've found it best to use a proper http lib like clj-http, then parse the resulting string/inputstream/etc. who knows what strange things the default http fetcher does |
| 16:55 | Sgeo | Should I attempt to get ritz going, or should I just use nrepl.el? |
| 16:55 | Sgeo | What would I lose out on with just nrepl.el? |
| 16:58 | devth_ | jkkramer: yeah, sounds like a better way to go. |
| 16:59 | Sgeo | Someone should make a leiningen plugin or something that gives a function at the repl that effectively does lein deps but in a way to let the repl access new stuff |
| 16:59 | Sgeo | (i.e. does the corresponding add classpath hacks) |
| 17:02 | technomancy | I nominate ... Sgeo! |
| 17:02 | aperiodic | seconded |
| 17:02 | Sgeo | I could try, but I have a feeling that there's more to lein deps than looking at the dependencies, adding them if there are new ones, and warning if some were removed |
| 17:03 | technomancy | it's all abstracted away nicely in pomegranate |
| 17:04 | technomancy | src/leiningen/deps.clj is all about pretty-printing the full tree |
| 17:04 | hugod | ritz now lets you reload the project.clj file, or even switch to a different one |
| 17:05 | Sgeo | hugod, oh cool |
| 17:05 | technomancy | whoa fancy |
| 17:05 | Sgeo | Maybe I should figure out how to use ritz instead of nREPL then |
| 17:05 | Sgeo | erm nrepl.el |
| 17:05 | mpan | given a clojure data structure (possibly nested, possibly contains fn), is there a general sort of serialization? preferably as source that can be fed to read/eval |
| 17:06 | technomancy | ,(doc pr-str) |
| 17:06 | clojurebot | "([& xs]); pr to a string, returning it" |
| 17:06 | mpan | thanks! |
| 17:06 | mpan | ,(pr-str (fn [x] (+ x 1))) |
| 17:06 | clojurebot | "#<sandbox$eval51$fn__52 sandbox$eval51$fn__52@355876c6>" |
| 17:06 | dnolen | mpan: I don't think you can serialize fns tho. |
| 17:07 | technomancy | mpan: you need serializable-fn for that |
| 17:07 | technomancy | built-in functions are just bytecode, and there's no decompiler |
| 17:07 | technomancy | err--functions produced by clojure.core/fn rather |
| 17:07 | mpan | oh, just goes straight through and discards source? |
| 17:08 | technomancy | yeah, serializable-fn is a 3rd-party hack to save source and attach it to the fn |
| 17:09 | mpan | what happens with regard to scope/bindings? |
| 17:09 | amalloy | mpan: friggin' magic is what happens |
| 17:09 | technomancy | it attempts to serialize lexical scope |
| 17:09 | mpan | thanks guys! |
| 17:09 | technomancy | it might even work |
| 17:10 | amalloy | aw man, i made it work like five times. why you gotta be implying i can't make stuff work? |
| 17:11 | technomancy | the extent of my experience with serialize-fn was two hours in a coffee shop writing it and hitting "MERGE THAT SUCKA" a few times in github so I don't exactly have a lot of grounds for confidence =) |
| 17:12 | Raynes | technomancy: Man, stop calling it a hack. |
| 17:12 | Sgeo | In Common Lisp at least, macros have access to the fact that some lexical bindings exist, and implementations generally allow for knowing what symbols are lexically bound, but not their values. |
| 17:12 | Sgeo | Which makes sense |
| 17:12 | Raynes | technomancy: You realize that clojail is *entirely based* on serializable-fn, right? |
| 17:12 | Raynes | technomancy: Like, the whole thing. |
| 17:13 | amalloy | Sgeo: so does clojure |
| 17:13 | Raynes | It would be utterly broke as shit and hideous if serializable-fn didn't exist. |
| 17:13 | ivaraasen | wow, Factor looks really cool |
| 17:13 | technomancy | Raynes: no kidding? |
| 17:13 | Raynes | No kidding. |
| 17:13 | amalloy | technomancy: it used to work fine without serializable-fn |
| 17:13 | ForSpareParts | Is it possible to write macros that use weird pattern matching to get non-lispy syntax? |
| 17:13 | technomancy | Raynes: I knew it was used, but I thought it wasn't for core functionality |
| 17:14 | Raynes | technomancy: https://github.com/flatland/clojail/blob/master/src/clojail/testers.clj |
| 17:14 | Sgeo | define "non-lispy syntax" |
| 17:14 | ForSpareParts | Say, trigger a macro application without parens around it. |
| 17:14 | ForSpareParts | For making DSLs, that kind of thing. |
| 17:14 | Raynes | ForSpareParts: Still needs to be readable by Clojure. |
| 17:14 | ForSpareParts | Syntax shortcut. |
| 17:14 | ForSpareParts | *shortcuts. |
| 17:15 | technomancy | I hereby retract my self-disparagements =D |
| 17:15 | Raynes | As long as you keep it readable by Clojure's reader, you can do pretty much whatever. |
| 17:15 | mpan | is there like, a class of things I shouldn't be passing into serializable-fn? |
| 17:15 | Raynes | mpan: Anything that can't be printed. |
| 17:15 | Raynes | Printed and read back, I mean. |
| 17:15 | technomancy | IO streams n stuff |
| 17:16 | amalloy | and even then you'll be okay as long as you don't actually try to deserialize |
| 17:16 | amalloy | ie, it will still work fine as an ordinary function |
| 17:16 | ForSpareParts | Raynes, (sorry if this is a dumb question) what are the limits of Clojure's reader? |
| 17:16 | mpan | how does this compare vs storing un-read source? |
| 17:17 | Raynes | ForSpareParts: Well, the reader can only read Clojure. |
| 17:17 | Raynes | You can't, for example, read illegal symbols, or triple quoted strings, etc. |
| 17:17 | Raynes | You can't just do whatever you want in a macro. |
| 17:18 | technomancy | ForSpareParts: you also need matched delimiters |
| 17:18 | aperiodic | in the end, your program still has to consist of readable s-expressions |
| 17:18 | ForSpareParts | aperiodic, OK, I think that's what I was trying to figure out. |
| 17:18 | Raynes | technomancy: The testers used to be a mosh pit of symbols, packages, functions, etc. Now it's just a few simple serializable functions. |
| 17:18 | technomancy | you could build do/end style delimiters on top of a tree of sexprs though |
| 17:18 | technomancy | if you were completely insane |
| 17:18 | technomancy | Raynes: <3 |
| 17:19 | Raynes | I had to do crazy shit with that ClojailPackage type though. |
| 17:19 | Raynes | Because print-dup vs print-method nonsense. |
| 17:19 | Raynes | Er, ClojailWrapper |
| 17:19 | ForSpareParts | Thank you guys for indulging my curiosity/noobishness. |
| 17:20 | Sgeo | How extreme do the extendible readers allow? |
| 17:21 | technomancy | not much |
| 17:21 | technomancy | they're just transformations on something that's already been read |
| 17:22 | Sgeo | If Ritz allows project.clj reloading, I wonder if it's possible to allow it via a leiningen plugin |
| 17:23 | Sgeo | Ritz already implemented my idea I guess, but in a way that's not useful for non-ritz users? |
| 17:23 | technomancy | wouldn't really be a leiningen plugin, it would be a runtime dependency |
| 17:24 | Sgeo | Hmm |
| 17:24 | hugod | ritz has it a little easier, as it is controlling a vm over debug connection, so doesn't have to do this in a single vm |
| 17:24 | technomancy | you can depend upon leiningen-core and call something from http://leiningen.org/reference.html#leiningen.core.classpath |
| 17:26 | hugod | that's the easy bit |
| 17:26 | mpan | what does double-colon prefixing an identifier mean? |
| 17:26 | Raynes | &::hi |
| 17:26 | lazybot | ⇒ :clojure.core/hi |
| 17:26 | hugod | Sgeo: here's ritz code that does that if you would like an example https://github.com/pallet/ritz/blob/develop/nrepl/src/ritz/nrepl/project.clj |
| 17:26 | Raynes | Namespace qualifies it. |
| 17:27 | mpan | is that a keyword? |
| 17:27 | hugod | Sgeo: the difficult bit is juggling the classloaders |
| 17:27 | mpan | ,(type ::hi) |
| 17:27 | mpan | is that valid? |
| 17:27 | clojurebot | clojure.lang.Keyword |
| 17:28 | Sgeo | If I decide to just try to get nrepl.el going, how difficult will it be for me to switch that over to Ritz? |
| 17:28 | mpan | ,::hi |
| 17:28 | clojurebot | :sandbox/hi |
| 17:28 | casion | Sgeo: I've switched back and forth a few times in the last 2 weeks |
| 17:28 | mpan | ,(= ::hi :sandbox/hi) |
| 17:28 | clojurebot | true |
| 17:28 | Sgeo | I still don't have an independent emacs install. I mean, I used lisp-cabinet, but I feel awkward with that |
| 17:28 | mpan | oh I see, cool |
| 17:30 | Sgeo | ,(doc type) |
| 17:30 | clojurebot | "([x]); Returns the :type metadata of x, or its Class if none" |
| 17:31 | Sgeo | ,(doc class) |
| 17:31 | clojurebot | "([x]); Returns the Class of x" |
| 17:31 | antares_ | mpan: ::keyword makes it namespaced. For example, Friend uses namespaced keywords for its session identifier key to not interfere with any other session keys your app may have. |
| 17:32 | mpan | is it explicitly a kw in a namespace, or a kw that happens to be named w/ the prefix? |
| 17:32 | Sgeo | "M-x nrepl-jack-in: Launch an nrepl server and a repl client. Prompts for a project root if given a prefix argument." |
| 17:32 | Sgeo | What is meant by a "prefix argument"? |
| 17:32 | casion | Sgeo: c-u usually |
| 17:33 | casion | Sgeo: so try c-u m-x nrepl-jack-in |
| 17:33 | casion | you'll be prompted for a project root |
| 17:34 | Sgeo | Can I issue Leiningen commands from emacs? |
| 17:34 | casion | using a shell? |
| 17:34 | technomancy | there's a helper thing, but I think it's pretty pointless; M-x shell or M-x eshell is the way to go |
| 17:35 | casion | you can use shell-command as well (M-!) |
| 17:36 | Sgeo | Hmm. I should be able to start an nREPL server with an arbitrary classpath from the shell, right? |
| 17:36 | Sgeo | Currently, I find myself doing java -cp somestuff;clojure-1.4.0 clojure.main a lot |
| 17:37 | hugod | technomancy: ritz now also lets you run lein commands in the repl vm, so you avoid at least one vm startup time |
| 17:38 | Sgeo | hugod, are you just a user of ritz, or author? |
| 17:39 | hugod | Sgeo: the latter, although it owes a big debt to swank-clojure |
| 17:40 | Sgeo | Hmm, so with ritz, I can't just start a repl in emacs, I need to start a server from the shell? |
| 17:40 | technomancy | hugod: huh, so leiningen-core and leiningen become runtime dev deps? |
| 17:41 | hugod | technomancy: they get added automatically to a separate classloader |
| 17:42 | hugod | Sgeo: jack-in exists for ritz, but it's not as smooth yet |
| 17:42 | Sgeo | Is this obsolete? http://dev.clojure.org/display/doc/Getting+Started+with+Emacs |
| 17:43 | casion | Sgeo: yes |
| 17:43 | hugod | Sgeo: I would recommend starting with nrepl.el and see what you miss |
| 17:43 | Sgeo | I'm fairly confident I'm going to miss reloading package.clj |
| 17:44 | Sgeo | I have a blog I only posted to once, I should do a step-by-step on getting started with nrepl.el |
| 17:45 | casion | Sgeo: what OS are you using? |
| 17:45 | Sgeo | Windows 7 |
| 17:46 | casion | ah |
| 17:46 | hugod | Sgeo: helping update the official nrepl.el docs might be beneficial too, if you find them lacking |
| 17:46 | casion | that would be a welcome tutorial then |
| 17:46 | casion | seems lots of people have difficutly with setting up nrepl on windows |
| 17:46 | Sgeo | I kind of want to write it at school, so I have a clean slate machine |
| 17:47 | casion | Sgeo: use a vm? |
| 17:48 | Sgeo | My computer has 2GB, and I don't think I have any legal copies of Windows XP or 7 around |
| 17:48 | Sgeo | *2GB RAM |
| 17:48 | Sgeo | Hmm. Is wget or curl preferred? |
| 17:53 | nDuff | Sgeo: wget has been around longer, curl is (far, far!) saner for scripted use. |
| 17:57 | amalloy | Sgeo: technomancy will probably hate you if you write a blog instead of contributing to the docs. because your blog will get out of date eventually, just like scores of swank blogs |
| 17:58 | Sgeo | But is there really an appropriate place to put them? Considering that I want to show everything from installing leiningen to getting nREPL.el set up |
| 18:00 | emezeske | Sgeo: You could always improve the docs for each component, and then on your blog just say "follow this doc, then this doc, then this doc" |
| 18:00 | technomancy | composability! |
| 18:00 | technomancy | it's the best |
| 18:01 | amalloy | it'll be like the Blog monad |
| 18:01 | amalloy | compose together all these install functions |
| 18:02 | technomancy | for url in $INSTALL_INSTRUCTION_URLS; do eval $(curl -s $url); done |
| 18:04 | xeqi | heh, looks like I missed a fun conversation about findfn, clojail and serialize-fn |
| 18:04 | xeqi | will need to look at that last one more later |
| 18:04 | SegFaultAX | amalloy: Really you just need Maybe Blog |
| 18:04 | SegFaultAX | amalloy: And each of the links to docs can be of type Maybe Doc |
| 18:06 | scriptor | so Nothing is the new 404? |
| 18:06 | SegFaultAX | scriptor: Exactly! |
| 18:06 | SegFaultAX | scriptor: Either NoDoc Doc seems like overkill |
| 18:07 | scriptor | following multiple tutorials in sequence can be a pain, though |
| 18:07 | scriptor | if they're written by different authors |
| 18:08 | Raynes | xeqi: Summary: aperiodic complained about how long findfn takes now and I whined because he wanted to go back to the unsafe way it was in his local repl; technomancy bashed himself because he didn't think serializable-fn was awesome and I explained how clojail relies on it now |
| 18:09 | Sgeo | I wish Clojail allowed for writing macros |
| 18:09 | technomancy | symbol-macrolet |
| 18:10 | technomancy | has it been ported? |
| 18:10 | Sgeo | technomancy, I believe so |
| 18:10 | amalloy | technomancy: yes, clojure.tools.macro |
| 18:10 | Sgeo | algo.monads uses it iirc |
| 18:10 | Raynes | Sgeo: clojail theoretically does, but I don't allow it in lazybot because all code runs in the same sandbox/namespace. |
| 18:11 | amalloy | &(use 'clojure.tools.macro) |
| 18:11 | lazybot | ⇒ nil |
| 18:11 | Sgeo | Raynes, ah, and you don't want someone to write a macro named after a confusing function? |
| 18:11 | technomancy | actually isn't a macro just a fn with special metadata set? |
| 18:11 | amalloy | &(macrolet [(m [x] `(inc ~x))] (m 5)) |
| 18:11 | lazybot | ⇒ 6 |
| 18:11 | Sgeo | Erm, not macro named after confusing function, but macro named in a confusing way |
| 18:12 | amalloy | Sgeo: no, because he doesn't want to allow defs of any kind |
| 18:12 | amalloy | technomancy: yes, and? |
| 18:12 | technomancy | ow ow macrolet |
| 18:12 | technomancy | y u use a binding vector and then not bind to a name |
| 18:12 | amalloy | technomancy: huh? |
| 18:12 | Sgeo | It doesn't look different from letfn |
| 18:12 | SegFaultAX | macrolet seems pretty neat. |
| 18:12 | amalloy | it looks just like letfn, presumably for exactly that purpose |
| 18:12 | Sgeo | In how it binds |
| 18:13 | technomancy | yeah, I hate letfn syntax =( |
| 18:13 | xeqi | Raynes, amalloy: rofl, I can use macrolet to get eval |
| 18:13 | Sgeo | &eval |
| 18:13 | lazybot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 18:13 | Sgeo | xeqi, oh? |
| 18:14 | Raynes | xeqi: Yay, tell everyone. |
| 18:14 | amalloy | xeqi: by doing the eval at compile time or something? it's not obvious to me how you'd do it |
| 18:14 | Sgeo | Assuming clojail does macroexpand-all before doing its jaily stuff, that makes no sense. And doing macroexpand-all seems like the only sensible thing to do |
| 18:14 | Sgeo | I might be missing something |
| 18:14 | Raynes | It does macroexpand-most. |
| 18:14 | Raynes | :D |
| 18:14 | xeqi | Raynes: yeah, sorry :/ |
| 18:15 | xeqi | technomancy: I think he's already cursed me |
| 18:15 | hiredman | https://github.com/hiredman/syntax-quote/blob/master/src/syntax_quote/core.clj#L3 smacro-let! |
| 18:15 | technomancy | huh; .setMacro |
| 18:16 | Sgeo | &(macrolet [(do-eval [] (eval '(prn "Hi")))] (do-eval)) |
| 18:16 | lazybot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 18:16 | mpan | what if you constructed the symbol through roundabout means? |
| 18:16 | technomancy | heh; which is just alter-meta |
| 18:16 | technomancy | I guess it has to be a java method for bootstrapping reasons |
| 18:17 | mpan | &symbol |
| 18:17 | lazybot | ⇒ #<core$symbol clojure.core$symbol@1d2a83> |
| 18:17 | Sgeo | &(symbol "eval") |
| 18:17 | lazybot | ⇒ eval |
| 18:17 | Sgeo | ,(doc resolve) |
| 18:18 | clojurebot | "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)" |
| 18:18 | Sgeo | &(-> "eval" symbol resolve) |
| 18:18 | lazybot | java.lang.SecurityException: You tripped the alarm! resolve is bad! |
| 18:18 | Raynes | That was the first thing anyone ever tried. |
| 18:19 | Sgeo | Wish there was a better way to block it than blocking resolve |
| 18:19 | SegFaultAX | For clojurebot, what's the difference between & and ,? |
| 18:19 | SegFaultAX | And ## for that matter |
| 18:19 | Raynes | Why do people assume lazybot and clojurebot are the same thing? |
| 18:19 | Raynes | All these questions. |
| 18:19 | Raynes | The world may never know. |
| 18:19 | Sgeo | Maybe make resolve accessible as a functionw wrapping around the real resolve? |
| 18:20 | Sgeo | You can use ## anywhere in your line of chat, it's as easy as ##(+ 1 1) being 2 |
| 18:20 | lazybot | ⇒ 2 |
| 18:20 | Raynes | Sgeo: That's basically what we've done with the '.' special form, only a lot more complicated. I have plans to do something like this. |
| 18:20 | Raynes | Well, to generalize this sort of thing. |
| 18:20 | Raynes | SegFaultAX: lazybot and clojurebot are two different bots. Entirely different. Not even remotely similar. In fact, they're like different continents. |
| 18:21 | Raynes | Different planets. Perhaps galaxies too. |
| 18:21 | SegFaultAX | Raynes: I see. |
| 18:21 | Raynes | :p |
| 18:21 | Sgeo | &#'eval |
| 18:21 | lazybot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 18:21 | Raynes | Blocks vars too. :P |
| 18:21 | Sgeo | So, what's xeqi's super secret macro based method? |
| 18:22 | Raynes | Sgeo: gfredericks has an idea for replacing eval in the sandbox and allowing it too. I just haven't tried it yet. |
| 18:22 | mpan | make the expansion process use eval? |
| 18:22 | Sgeo | Raynes, cool |
| 18:22 | mpan | would that get blocked? |
| 18:22 | Sgeo | I still think that newLisp may be better for a Lisp-based codenomic. |
| 18:22 | Raynes | We're not telling anyone how to break the sandbox, guys. |
| 18:22 | Raynes | Not until we fix it, anyways. |
| 18:22 | aperiodic | you're no fun |
| 18:22 | mpan | wait, that means it IS possible? |
| 18:23 | mpan | known, even |
| 18:23 | Raynes | xeqi: See what you've done! |
| 18:23 | mpan | I thought he was just joking with ideas |
| 18:23 | Raynes | Sgeo didn't actually figure anything out. |
| 18:23 | Raynes | xeqi is my break-shit-constantly-then-make-me-fix-it guy. |
| 18:25 | mpan | there's something I want to try but let me figure out the syntax in my local repl |
| 18:25 | mpan | &(do (println "Hi")) |
| 18:25 | lazybot | ⇒ Hi nil |
| 18:26 | xeqi | haha, yes you caught me, I was joking |
| 18:27 | sorenmacbeth | ahoy |
| 18:28 | xeqi | I would never attempt to break lazybot, I <3 lazybot |
| 18:28 | mpan | see, now you've gotten me trying to make a macro that does interesting stuff at compile time |
| 18:28 | sorenmacbeth | I'm trying to pass some lazy seqs around back and forth between some thrift services. I'm seeing weird behaviour in that is seems like the data is getting corrupted along the way |
| 18:29 | sorenmacbeth | do I need doall the seqs before I pass them around or something? |
| 18:29 | mpan | wait, how are you passing them? |
| 18:29 | mpan | if they're lazy? |
| 18:30 | sorenmacbeth | passing them into a thrift client interface |
| 18:31 | aperiodic | maybe technomancy can write serializible-unrealized |
| 18:31 | aperiodic | sorenmacbeth: if that doesn't realize them then i'd imagine you'd lose a lot of what you're trying to transfer |
| 18:32 | mpan | but, what would it even MEAN? |
| 18:32 | sorenmacbeth | aperiodic: yeah, the count of the seqs are the same on both sides of the connection, but the data seems to be corrupted somehow |
| 18:33 | sorenmacbeth | my thrift interface turns them into a java List, which I guess should realize them anyway |
| 18:33 | sorenmacbeth | I'm sort of grasping at straws here :p |
| 18:33 | aperiodic | oh, yeah, i don't think laziness is the issue here |
| 18:33 | aperiodic | could you provide any detail on how the corruption is evinced? |
| 18:35 | mpan | wait, is macrolet supposed to be in core? |
| 18:35 | sorenmacbeth | I'm serializing some byte array using kryo and passing a seq (List) of them across the wire |
| 18:35 | dnolen | mpan: no |
| 18:35 | technomancy | aperiodic: oh man I wish |
| 18:35 | technomancy | what we need are serializable continuations |
| 18:35 | mpan | ah, and the bot just refers it? |
| 18:35 | technomancy | once you have that, problem solved |
| 18:35 | sorenmacbeth | when I try to deserialize the byte arrays on the other side, I get deserialization errors |
| 18:37 | mpan | &(macrolet [(m [] 10)] (m)) |
| 18:37 | lazybot | ⇒ 10 |
| 18:39 | Sgeo | &(macrolet [(do-eval [stuff] `(eval ~stuff))] (do-stuff '(+ 1 1))) ; worth a shot |
| 18:39 | lazybot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 18:39 | sorenmacbeth | aperiodic: like so: https://www.refheap.com/paste/29b4feb20135b4ad5342e00f9 |
| 18:40 | mpan | sgeo: is there a way to resolve "eval"? |
| 18:40 | mpan | that's the part I'm stuck on |
| 18:41 | mpan | not even interested in getting it to eval passed-in stuff, first trying to get it to eval anything |
| 18:41 | aperiodic | sorenmacbeth: and that first map is what's being passed to the thrift thing that turns it into a list? |
| 18:41 | sorenmacbeth | aperiodic: yep |
| 18:45 | mpan | hm, I think I got something (?) |
| 18:47 | aperiodic | sorenmacbeth: and the thing being passed to byte-array implements Iterable? |
| 18:48 | aperiodic | sorenmacbeth: that is, the thing that comes out of (.remaining x) |
| 18:49 | sorenmacbeth | I'm iterating over a List, and calling (.remaining x) on each item |
| 18:50 | aperiodic | sorenmacbeth: can you test if ret is equal to the byte array that came out of the serializer in the beginning? |
| 18:51 | sorenmacbeth | aperiodic: I could, yeah, I haven't yet, but I guess that's what I need to do next |
| 18:52 | aperiodic | sorenmacbeth: i don't think you are constructing ret properly |
| 18:53 | aperiodic | oh, |
| 18:53 | aperiodic | i see |
| 18:53 | mpan | curses! I'm foiled :( |
| 18:53 | aperiodic | the .get puts the next thing from the byte buffer into the ret |
| 18:53 | sorenmacbeth | yeah |
| 18:54 | sorenmacbeth | (.remaining x) gets the size of the data portion of the byte buffer |
| 18:55 | sorenmacbeth | and (.get x ret), puts those bytes into the new byte-array of (.remaining) size |
| 18:55 | aperiodic | yeah man, i got nothing. looks fine to me |
| 18:56 | sorenmacbeth | aperiodic: ok, looks like I just nailed it down to the kryo serializer/deserializer that is corrupting the data |
| 18:57 | sorenmacbeth | if I don't serialize and just wrap in byte buffers and send them along, all is good |
| 18:57 | sorenmacbeth | aperiodic: thanks for the extra set of eyes though |
| 18:58 | aperiodic | sorenmacbeth: no problem |
| 19:02 | Cheiron | hi, what is the defacto clojure library to work with xml? |
| 19:04 | uvtc | Cheiron: Not sure, but there's a contrib lib for that listed at http://dev.clojure.org/display/doc/Clojure+Contrib . |
| 19:04 | uvtc | data.xml |
| 19:05 | aperiodic | technomancy: serializable continuations would require serializing up to the entire evaluation environment, no? |
| 19:08 | Sgeo | Suppose I do (map prn (range)) |
| 19:08 | Sgeo | Is there any way to, say, just do the third prn? |
| 19:09 | Sgeo | ,(doc nth) |
| 19:09 | clojurebot | "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences." |
| 19:09 | Sgeo | ,(nth (map prn (range)) 3) |
| 19:09 | clojurebot | 0 |
| 19:09 | clojurebot | 1 |
| 19:09 | clojurebot | 2 |
| 19:09 | clojurebot | 3 |
| 19:09 | clojurebot | 4 |
| 19:09 | clojurebot | 5 |
| 19:09 | clojurebot | 6 |
| 19:09 | clojurebot | 7 |
| 19:09 | clojurebot | 8 |
| 19:09 | Sgeo | uh |
| 19:09 | clojurebot | 9 |
| 19:09 | Sgeo | :( |
| 19:09 | clojurebot | 10 |
| 19:09 | clojurebot | 11 |
| 19:09 | clojurebot | 12 |
| 19:09 | clojurebot | 13 |
| 19:09 | clojurebot | 14 |
| 19:09 | clojurebot | 15 |
| 19:09 | emezeske | hahahah |
| 19:09 | clojurebot | 16 |
| 19:09 | clojurebot | 17 |
| 19:09 | clojurebot | 18 |
| 19:09 | clojurebot | 19 |
| 19:09 | clojurebot | 20 |
| 19:09 | clojurebot | 21 |
| 19:09 | clojurebot | 22 |
| 19:09 | thorbjornDX | omg |
| 19:09 | clojurebot | 23 |
| 19:09 | clojurebot | 24 |
| 19:09 | clojurebot | 25 |
| 19:09 | clojurebot | 26 |
| 19:09 | clojurebot | 27 |
| 19:09 | clojurebot | 28 |
| 19:09 | Sgeo | ,cancel |
| 19:09 | gfredericks | 30 |
| 19:09 | clojurebot | 29 |
| 19:09 | clojurebot | 30 |
| 19:10 | clojurebot | 31 |
| 19:10 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: cancel in this context, compiling:(NO_SOURCE_PATH:0)> |
| 19:10 | SegFaultAX | Sgeo: Smooth. |
| 19:10 | thorbjornDX | that works |
| 19:10 | emezeske | Nice fix! |
| 19:10 | aperiodic | lol, sweet save |
| 19:10 | mpan | was that an infinite loop? |
| 19:10 | pjstadig | no |
| 19:10 | pjstadig | you didn't do anything |
| 19:10 | xeqi | haha, that was funny |
| 19:10 | pjstadig | it was realizing the first 32 elements of a chunked sequence |
| 19:11 | aperiodic | ah, good call |
| 19:11 | mpan | ah |
| 19:11 | mpan | it's smart enough not to go forever? |
| 19:11 | emezeske | pjstadig: Ahhh |
| 19:11 | aperiodic | (inc pjstadig) |
| 19:11 | lazybot | ⇒ 2 |
| 19:11 | emezeske | pjstadig: The timing on ,cancel was just too funny then :) |
| 19:12 | Sgeo | What I did would make total sense in Haskell, and would work as expected |
| 19:12 | Sgeo | :( |
| 19:12 | mpan | &pjstadig |
| 19:12 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: pjstadig in this context |
| 19:12 | pjstadig | the (nth ... 3) was causing it to realize only the first 32 elements of an infinitely lazy chunked sequence |
| 19:12 | mpan | that's odd o_O |
| 19:12 | pjstadig | emezeske: yes, the timing was perfect :) it just wasn't doing what we thought it was doing |
| 19:12 | mpan | &(pr-str pjstadig) |
| 19:12 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: pjstadig in this context |
| 19:13 | gfredericks | ,this-sentence-is-false |
| 19:13 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: this-sentence-is-false in this context, compiling:(NO_SOURCE_PATH:0)> |
| 19:13 | aperiodic | mpan: it's the lazybot karma system; (inc $nick-in-channel), and (dec $nick-in-channel) |
| 19:13 | mpan | ah thanks! |
| 19:13 | aperiodic | mpan: there's no evaluation actually going on there |
| 19:13 | mpan | I was wondering how people def'd ANYTHING |
| 19:13 | mpan | because I thought the bot banned def |
| 19:14 | gfredericks | def comedy ban |
| 19:14 | thorbjornDX | gfredericks: heh |
| 19:14 | mpan | there's two things I'm wondering |
| 19:14 | Sgeo | I want to try a version that I think will work correctly |
| 19:14 | mpan | is there a generic irc bot framework? |
| 19:14 | Sgeo | But kind of scared |
| 19:14 | mpan | and is there interop with jython? |
| 19:15 | aperiodic | Sgeo: you can /msg the bots, too |
| 19:15 | mpan | well, the bot spitting an infinite number of items into his private messages |
| 19:16 | mpan | is only marginally better than into the channel? |
| 19:16 | Sgeo | ,((nth (map #(partial prn %) (range)) 3)) |
| 19:16 | clojurebot | 3 |
| 19:17 | mpan | &(doc prn) |
| 19:17 | lazybot | ⇒ "([& more]); Same as pr followed by (newline). Observes *flush-on-newline*" |
| 19:17 | Sgeo | This stuff makes far more sense in Haskell |
| 19:17 | Sgeo | :( |
| 19:19 | aperiodic | Sgeo: only one prn was ever called, so that's the one you see |
| 19:20 | Sgeo | aperiodic, yes, and I understand why |
| 19:21 | Sgeo | But mapping the equivalent of prn in Haskell would result in a list of actions, and resolving the portions of the list wouldn't do anything unless you specifically executed one of the elements |
| 19:23 | Sgeo | ,(-> (map #(delay (prn %)) (range)) (nth 3) force) |
| 19:23 | clojurebot | 3 |
| 19:23 | Sgeo | Also, I really could have used -<> there |
| 19:24 | mpan | ,(doc -<>) |
| 19:24 | clojurebot | Titim gan éirí ort. |
| 19:24 | Sgeo | Look for swiss-arrows |
| 19:24 | mpan | ,(doc swiss-arrows) |
| 19:24 | clojurebot | Excuse me? |
| 19:24 | mpan | I don't understand |
| 19:24 | Sgeo | Although -<> also annoys me because I don't see a way to put the <> in the middle of a complex form |
| 19:24 | Sgeo | Google for swiss-arrows |
| 19:24 | Sgeo | https://github.com/rplevy/swiss-arrows |
| 19:24 | mpan | ah thanks |
| 19:25 | mpan | the first result was very confusing |
| 19:25 | Sgeo | Actually, delays are kind of useless if you want to do the side effects twice |
| 19:25 | Sgeo | Ugh I'm starting to think Clojure has a really poor model of I/O |
| 19:27 | Sgeo | Here's a Haskell-inspired way to do it: Functions like prn just return a value, let's call it IO |
| 19:27 | Sgeo | The exe function is the only truly side-effecting function, and it performs the I/O |
| 19:27 | SegFaultAX | Sgeo: You wanna know something funny about Clojure? |
| 19:27 | Sgeo | SegFaultAX, what? |
| 19:27 | SegFaultAX | Sgeo: It isn't Haskell. |
| 19:27 | aperiodic | Sgeo: clojure's model for dealing with side-effects is the honor system |
| 19:28 | Sgeo | I guess the thing is, it would sometimes be convenient to manipulate I/O doing stuff as values |
| 19:28 | mpan | aperiodic: what do you mean by that metaphor? |
| 19:28 | Sgeo | I guess wrapping it in an fn could be sufficient |
| 19:29 | SegFaultAX | mpan: It's up to you to make sure that you do side-effecting computation safely and reasonably. |
| 19:29 | aperiodic | mpan: ^ |
| 19:30 | Sgeo | ,((nth (map #(fn [] (prn %)) (range)) 3)) |
| 19:30 | clojurebot | 3 |
| 19:30 | mpan | ah thanks |
| 19:30 | mpan | is it bad to explicitly state flow instead of using the arrows? |
| 19:30 | SegFaultAX | mpan: (The language won't get in your way if you want to do something stupid. Or at least it gets in your way less than, say, Haskell) |
| 19:31 | mpan | aha! I remember that |
| 19:31 | mpan | I was wondering why my print statements were never happening |
| 19:31 | mpan | not that long ago |
| 19:31 | Sgeo | ,(letfn [(do-func [f] (f))] (-> (map #(fn [] (prn %)) (range)) (nth 3) do-func)) |
| 19:31 | clojurebot | 3 |
| 19:31 | Sgeo | There has to be a better built-in alternative than writing do-func like that |
| 19:31 | SegFaultAX | Sgeo: Why are you trying to thunkify IO in Clojure? |
| 19:32 | Sgeo | Because thinkified IO can be convenient sometimes? |
| 19:32 | Sgeo | *thunkified |
| 19:32 | SegFaultAX | Sgeo: Then you've already given at least 3 examples of how to do it. |
| 19:32 | SegFaultAX | Sgeo: delay being the most concise IMHO. |
| 19:32 | Sgeo | Delay isn't good if you want to do the thunk repeatedly |
| 19:33 | Sgeo | ,(doto (delay (prn 5)) force force) |
| 19:33 | clojurebot | 5 |
| 19:33 | clojurebot | #<Delay@54c03555: nil> |
| 19:33 | SegFaultAX | Sgeo: For side-effecting code, you could use partial as you did above. |
| 19:34 | SegFaultAX | Sgeo: I don't know what you're still going on about this. Clojure doesn't do what you're proposing, but there are plenty of ways to make it work that way if you desire. |
| 19:34 | Sgeo | partial doesn't work for that pre-1.5 for a side-effecting function with 0 arguments. |
| 19:35 | SegFaultAX | Sgeo: Do you need the extra container for a nullary function? |
| 19:35 | Sgeo | I guess I just feel that that outputting of 32 elements was bizarre and unexpectted behavior |
| 19:35 | Sgeo | SegFaultAX, ... oh right |
| 19:35 | Sgeo | Although, ugh, that's special casing for the nullary function case, if I wanted to write macros that dealt with this stuff. Although in that case I could go the fn route |
| 19:36 | SegFaultAX | Sgeo: Then write a partial function that can apply zero or more arguments, I guess. |
| 19:39 | Sgeo | I could just write functions thunkify, taking an fn and returning a version that takes its arguments and returns a thunk, and dothunk |
| 19:40 | Sgeo | Not sure if anyone would bother using these though |
| 19:41 | SegFaultAX | Sgeo: Or re-write the IO monad in Clojure, if it hasn't already been done. |
| 19:41 | cemerick | Looks like cljs is a no-go with Clojure 1.5.0…? |
| 19:41 | Sgeo | ,(macroexpand-1 '(defthunk thunky-java-method .someMeth)) |
| 19:41 | clojurebot | (defthunk thunky-java-method .someMeth) |
| 19:42 | Sgeo | I thought the reader usually translates .blah into a . form? |
| 19:43 | cemerick | Sgeo: only in function position |
| 19:43 | cemerick | ,(macroexpand-1 '(.foo bar)) |
| 19:43 | clojurebot | (. bar foo) |
| 19:43 | Sgeo | ,(macroexpand-1 '(doto blah .foo .bar)) |
| 19:43 | clojurebot | (clojure.core/let [G__212 blah] (.foo G__212) (.bar G__212) G__212) |
| 19:43 | Sgeo | ,(macroexpand-all '(doto blah .foo .bar)) |
| 19:44 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macroexpand-all in this context, compiling:(NO_SOURCE_PATH:0)> |
| 19:44 | Sgeo | ,(use 'clojure.walk) |
| 19:44 | clojurebot | nil |
| 19:44 | Sgeo | ,(macroexpand-all '(doto blah .foo .bar)) |
| 19:44 | clojurebot | (let* [G__292 blah] (. G__292 foo) (. G__292 bar) G__292) |
| 19:44 | Sgeo | Hmm. |
| 19:44 | Sgeo | So... what does the .thing to dot form conversion? Doesn't look like the reader |
| 19:45 | Sgeo | Also, what's let* |
| 19:54 | Sgeo | http://coderwall.com/p/1mwy7g |
| 19:54 | Sgeo | Please shoot me now? |
| 20:01 | gfredericks | Sgeo: let* is the special form version of let |
| 20:01 | gfredericks | let is a macro that expands to let* |
| 20:01 | gfredericks | I think the only difference is that let supports destructuring |
| 20:02 | gfredericks | and I think fn/fn* and loop/loop* are analogous |
| 20:07 | SegFaultAX | pallet is a pretty neat project. |
| 20:09 | Sgeo | Is there a way to thumbs down a post on coderwall? |
| 20:10 | amalloy | Sgeo: copy-paste it to reddit and then downvote yourself |
| 20:11 | amalloy | or stop ever looking at coderwall, which is a nice way to downvote everything there all at once |
| 20:12 | emezeske | I can confirm that amalloy's second approach works |
| 20:12 | Sgeo | I liked one of the Clojure pages on Facebook, and I think it's connected to a feed that aggregates a bunch of Clojure related stuff |
| 20:12 | Sgeo | Blogposts etc. |
| 20:12 | Sgeo | I think it helped me get and stay interested in Clojure, but sometimes it links to silly things |
| 20:15 | technomancy | non-ironic use of the word "protip" =( |
| 20:18 | emezeske | lol I accidentally upvoted it, and can't undo it! Nooooooooo |
| 20:18 | gfredericks | opinions are idempotent |
| 20:20 | pjstadig | i've never changed my opinion |
| 20:20 | pjstadig | FACT |
| 20:21 | technomancy | "YES" |
| 20:22 | gfredericks | :D |
| 20:22 | technomancy | wait that's steve yegge |
| 20:23 | pjstadig | my opinion is "i have no opinion" |
| 20:23 | gfredericks | DOES NOT COMPUTE |
| 20:24 | gfredericks | I imagine if you had a single opinion it might be a very intimate thing to share |
| 20:24 | SegFaultAX | pjstadig: Technically, your opinion /has/ never changed. Your brain is not place-oriented. /datomic-jokes. |
| 20:24 | pjstadig | its like that episode of the prisoner where they build a machine that can answer every question |
| 20:24 | pjstadig | and the prisoner give it the question "why?" and the machine blows up |
| 20:25 | SegFaultAX | pjstadig: Checkmate. http://www.wolframalpha.com/input/?i=why%3F |
| 20:26 | pjstadig | oh was that it? |
| 20:26 | pjstadig | i was trying to find it |
| 20:26 | pjstadig | haha |
| 20:26 | pjstadig | oh nevermind you silly guy |
| 20:26 | SegFaultAX | I'm pretty sure that wolfram alpha is just a working title for skynet. |
| 20:27 | pjstadig | it was actually titled "The General" http://www.youtube.com/watch?v=ljGH07Unfe8 |
| 20:27 | Sgeo | Um, given how memory is so imperfect, I think it would make sense to call the brain place-oriented |
| 20:28 | Sgeo | Also, wishing that Datomic was F/OSS |
| 20:33 | Sgeo | I think I have a love/hate relationship with the Clojure community. |
| 20:35 | casion | Sgeo: why? |
| 20:36 | emezeske | People gotta make monies |
| 20:36 | Sgeo | On the one hand, the size of the community does mean a bunch of cool libraries |
| 20:36 | Sgeo | On the other hand, there are also a lot of clueless people in the community. |
| 20:36 | SegFaultAX | emezeske: Strange way for an unproven technology to make monies in a space where several of the top competitiors are free and open source. |
| 20:37 | Raynes | I can think of one in particular. |
| 20:37 | casion | Sgeo: can you PLEASE point me to a community with no clueless people? This magical land must be studied |
| 20:38 | casion | I think i can convince a few universities to drop everything theyr'e doing and join me in this study |
| 20:38 | Sgeo | casion, I guess I can't, but I feel like the cluelessness is less prominent in Haskell land |
| 20:38 | emezeske | SegFaultAX: Well, you're of course entitled to release your competing database software free |
| 20:38 | casion | lol |
| 20:38 | Raynes | Sgeo: How long have you been in the Haskell community? |
| 20:39 | SegFaultAX | emezeske: Fair enough. Like I said, it's just a little strange to me. Not bad or evil, just strange. |
| 20:39 | Sgeo | A while, I guess. Maybe I've just been seeing different parts |
| 20:39 | casion | I spent 4 months in #haskell, and often it was 'people with a clue' disagreeing on how the language worked |
| 20:40 | Raynes | Jon Harrop, Sgeo. |
| 20:40 | casion | let alone the many many many people asking basic questions in the middle of their first public project |
| 20:40 | Raynes | I think lots of people in the Haskell community consider him clueless. |
| 20:40 | Raynes | Don't hold me to it though. |
| 20:40 | Raynes | I recall some stuff going on there though. |
| 20:40 | casion | though, it is a nice community |
| 20:41 | casion | certainly has no lack of clueless folks, even among the more well-informed |
| 20:41 | Sgeo | Someone I know on IRC has some harsh criticisms of #haskell , come to think of it |
| 20:41 | Sgeo | In particular, lambdabot's oddities can confuse newbies |
| 20:41 | Sgeo | (Well, not that that's the only criticism, but that's one) |
| 20:43 | SegFaultAX | Sgeo: I think it's a sampling problem. The number of clueless people may appear smaller, but then the size of the total community may also be smaller. Python for instance might seem to have a lot more clueless people, but then there are probably quite a lot more people using Python on a daily basis. |
| 20:44 | SegFaultAX | As opposed to Haskell, say, which I think has a fairly small to mid sized community compared to Python or Ruby or Perl. |
| 20:44 | Sgeo | Oh, I just remembered a horrible Haskell library I once used |
| 20:45 | casion | most of the FRP libraries are awful that I've tried |
| 20:45 | Sgeo | ftphs iirc |
| 20:46 | Sgeo | Used lazy I/O. Thus often needed to force things to get it to work |
| 20:46 | casion | given I don't fully understand FRP yet, but the documentation is awful and when I ask how to do basic things I get a "You can't do that yet" |
| 20:47 | casion | but when you ask how do deal with UIs effectively, you get pointed to some FRP stuff |
| 20:47 | SegFaultAX | Sgeo: Also, you can't rule out that you are clueless. (Eg Dunning-Kruger) |
| 20:47 | Sgeo | SegFaultAX, now I'm sad. |
| 20:48 | Sgeo | How do I determine objectively whether or not I am clueless? |
| 20:48 | SegFaultAX | Merit I guess. |
| 20:48 | casion | Sgeo: write something non-trivial |
| 20:49 | Sgeo | Last time I wrote something non-trivial it was in Tcl, but the code was horrifically ugly :( |
| 20:49 | SegFaultAX | casion: That's easy. Writing something of genuine value or utility to more than just one's self, that's a little harder. |
| 20:49 | casion | SegFaultAX: I think that falls under my idea of 'non-trivial' |
| 20:49 | SegFaultAX | It's easy to write a complicated pile of shit. |
| 20:50 | SegFaultAX | Sgeo: Then maybe you are clueless, but you're too clueless to know it? ;) |
| 20:51 | Sgeo | :( |
| 20:54 | SegFaultAX | Sgeo: Read about the Dunning-Kruger effect. It's pretty interesting stuff. |
| 21:00 | SegFaultAX | Sgeo: I'd also like to say that I'm not calling you clueless. Only pointing out that only a clueless person would reject the possibility of their being clueless outright. |
| 21:02 | duck1123 | That's why I hate when people say "judge your skill in ___ from 1 to 10" |
| 21:02 | casion | how much do you hate that, on a scale from 1 to 10? |
| 21:03 | duck1123 | the more you know, the more you realize how much else you have to learn |
| 21:03 | SegFaultAX | duck1123: It's almost impossible to do so. It /is/ impossible to do so objectively. |
| 21:03 | casion | it's also worth realizing that the question is asked with the DK effect in mind |
| 21:03 | casion | if you answer 10, suspicion is often immediately raised |
| 21:04 | SegFaultAX | casion: That's usually a cause for dismissal during an interview with me. |
| 21:04 | duck1123 | I'm sure Hawking only rates himself at a 7 or 8 in physics |
| 21:05 | SegFaultAX | casion: Not that I want a candidate to be modest necessarily. But I ask any question to a 10 on a tech, and they have any hesitancy, they've effectively just lied to me. |
| 21:05 | metellus | Dunning-Kruger effect |
| 21:05 | SegFaultAX | Because I take a 10 to mean perfect knowledge of a thing. |
| 21:05 | SegFaultAX | But if I ask* |
| 21:05 | casion | that's not really fair though |
| 21:06 | casion | since the question can be interpretted in various ways |
| 21:06 | SegFaultAX | casion: It is if I'm explicit about the scale. |
| 21:06 | SegFaultAX | casion: As in "10 means you know everthing there is to know about a thing" |
| 21:06 | SegFaultAX | I've had people tell me they're a 9 or 10 at linux, which usually means a 5 at user-land and a 0 at kernel-land. |
| 21:07 | casion | well, if that's the case, anyone answering that is probably an idiot |
| 21:07 | casion | 10 at linux |
| 21:07 | casion | lol |
| 21:07 | SegFaultAX | Exactly. |
| 21:07 | amalloy | that makes it not a very useful scale, though |
| 21:07 | casion | is there even anyone who could answer 7+ on that though? |
| 21:07 | Sgeo | I think I'd rather describe what I know than attempt to place it on a numeric scale |
| 21:07 | amalloy | 10 should be "as much as anyone else knows" |
| 21:07 | casion | so that seems a bit silly other than trying to trick people |
| 21:07 | casion | which I guess is useful |
| 21:07 | SegFaultAX | amalloy: That's why I don't ask that unless it's a question given to me. |
| 21:08 | casion | but I'd think there's better ways of that |
| 21:08 | SegFaultAX | Generally I just skip the rate yourself and ask progressively harder questions. |
| 21:08 | SegFaultAX | Their skill level will become self evident. |
| 21:08 | casion | don't you mean knowledge? |
| 21:09 | casion | skill isn't exactly proved through question answering in most contexts |
| 21:11 | SegFaultAX | casion: It's impossible to measure absolute skill during an interview. |
| 21:12 | casion | not in my experience, but perhaps you work in a more rigid environment |
| 21:12 | SegFaultAX | casion: But you're right, I probably do mean knowledge. And more specifically, just problem solving for certain classes of common things. |
| 21:12 | casion | I've hired a few dozen people over the course of owning 2 businesses, and I take a 'well… show me' approach |
| 21:13 | casion | if they claim a skill, I ask them to demonstrate |
| 21:13 | SegFaultAX | casion: If it's something they've done before or rehearsed, that's not a fair assessment. |
| 21:14 | casion | in my case it is :) |
| 21:14 | casion | but I can see what you're saying in some technical contexts |
| 21:14 | SegFaultAX | casion: Your tasks might be highly mechanical |
| 21:14 | casion | you are correct |
| 21:14 | SegFaultAX | casion: I need people who can solve something they haven't before encountered. And measured the way in which they approach the solution, even if they never actually get a solution in the alloted time. |
| 21:15 | SegFaultAX | If I ask them to do something they've done many times before, that doesn't tell me how well they can problem solve. Or leverage their existing knowledge. |
| 21:15 | casion | SegFaultAX: so a question on that, I've discussed this with a few people, if you pull someone aside in an interview and say "Here's this problem, please solve it" |
| 21:16 | Sgeo | I've never even been on an interview before |
| 21:16 | Sgeo | Barely wrote a resume |
| 21:16 | casion | and the interviewee hops right on google… but gets it solved before a more skilled person has (or would) |
| 21:16 | casion | who do you favour in that situation? |
| 21:16 | SegFaultAX | Depends on the position I guess. |
| 21:16 | SegFaultAX | Google is a fantastic resource IFF you understand the system you're using. |
| 21:16 | Sgeo | How well is that person able to understand what they see on Google for future use? |
| 21:17 | Sgeo | Copy/paste vs comprehension? |
| 21:17 | SegFaultAX | But if all you know how to do is glue together snippets from SO and can't explain why that solution worked, that's less useful. |
| 21:17 | SegFaultAX | Or perhaps flatly inappropriate. |
| 21:17 | casion | well, SO is blocked on my network |
| 21:17 | casion | as are a few other sites |
| 21:17 | SegFaultAX | casion: That helps. |
| 21:18 | SegFaultAX | (In an interview) |
| 21:18 | Sgeo | casion, blocked from interviewee's access, or blocked for developers? |
| 21:18 | casion | interviewee, I have a special network for visitors |
| 21:18 | casion | which includes interviewees |
| 21:18 | SegFaultAX | casion: I've hired at least 1 NNPP in my time. I prefer not to make that mistake again. |
| 21:19 | Sgeo | NNPP? |
| 21:19 | SegFaultAX | Sgeo: Net Negative Producing Programmer. |
| 21:19 | casion | nnpp = someone who breaks more shit than they fix |
| 21:19 | SegFaultAX | Sgeo: http://www.software-thoughts.com/2009/08/net-negative-producing-programer.html |
| 21:19 | SegFaultAX | Also, that ^ |
| 21:20 | casion | I've only hired 3 developers, and interviewed around 25 |
| 21:20 | casion | I found it a fun process overall |
| 21:20 | SegFaultAX | And I've worked on teams (recently, even) that had one or more NNPPs. It's an awful environment to be in especially when those persons are in authoritative positions. |
| 21:20 | casion | particularly since I required a relatively specific set of skills, and I got quite a few people who only possessed a small portion of them |
| 21:20 | casion | and thought they could fake it |
| 21:21 | SegFaultAX | casion: Ouch. |
| 21:21 | SegFaultAX | Hopefully that fell out during the interview. |
| 21:21 | casion | coincidentally, 2 of the people I _did_ hire didn't have the required skillset, but they were honest and direct about it |
| 21:21 | casion | and were very interested in learning, even off-hours |
| 21:21 | casion | which I found rather valuable, at the time at least |
| 21:22 | SegFaultAX | That's something I look for. Driven developers that actually enjoy writing software can be really valuable, even if they lack experience at the time of hiring. |
| 21:23 | SegFaultAX | People who just do this as their day job can be quite fantastic too, but then I'm more sentitive about their experience level. There is a balance. |
| 21:23 | casion | well, both times they were people who had the programming skills already |
| 21:23 | casion | I can teach mechanical/machine skills... |
| 21:24 | Sgeo | " Don't just type random gibberish as fast as you can on the screen, unless you're a Perl programmer." |
| 21:24 | SegFaultAX | Sgeo: "... unless you're an APL/J programmer" FTFY |
| 21:24 | casion | I don't have the patience to teach C, let alone embedded development, to a python programmer |
| 21:24 | casion | in fact, I rather lose a leg |
| 21:25 | casion | maybe even both |
| 21:26 | Sgeo | On Windows 7, should I bother trying to get EmacsW32 working, or should I just go for the official GNU version? |
| 21:26 | casion | Sgeo: you should probably ask on #emacs, but they will also probably tell you to not use W32 |
| 21:27 | casion | emacsw32 isn't really an issue afaik, it just includes a bunch of extra stuff, and is behind a version or two |
| 21:37 | Sgeo | I wonder if I could write in Clojure a program to install emacs and set it up |
| 21:38 | Sgeo | And leiningen etc. |
| 21:44 | Sgeo | :( addpm is missing |
| 21:53 | cgag | Sgeo, pallet is for that kind of thing isn't it? |
| 21:54 | Sgeo | Hmm, I guess |
| 22:07 | Sgeo | Um |
| 22:07 | Sgeo | Is clojure-mode and nREPL suppposed to provide me with menu options? Because they aren't. |
| 22:11 | Sgeo | Also, pressing enter at the C-u M-x nrepl-jack-in prompt does nothing |
| 22:28 | Sgeo | Are Clojure-mode and nREPL.el supposed to make menus? Because for me they aren't. |
| 23:07 | Sgeo | Should I give up on Emacs and just deal with Eclipse? |
| 23:08 | hoover_damm | Sgeo, try it and see what happens |
| 23:08 | hoover_damm | Sgeo, if your dealing with too much pain on emacs it might be easier |
| 23:09 | Sgeo | I just want some menus that show nREPL and Clojure stuff, so I don't have to memorize keybindings immediately |
| 23:12 | hoover_damm | the emacs you installed lack a gui? |
| 23:12 | hoover_damm | usually the menus are in the gui version of emacs (x11 or cocoa) at least |
| 23:12 | hoover_damm | at least last time I was using repl |
| 23:12 | Sgeo | It has a GUI |
| 23:13 | Sgeo | But clojure-mode and nREPL mode don't seem to offer any additional menus |
| 23:14 | amalloy | i doubt they went to the trouble |
| 23:15 | Sgeo | :( |
| 23:57 | duck1123 | Most of the clojure-mode keybindings wouldn't make good menu options |
| 23:57 | casion | menu options? emacs? |
| 23:57 | duck1123 | load file, eval buffer, run lisp |
| 23:57 | casion | why would you ever want to touch your mouse? |
| 23:58 | duck1123 | you don't that's why menu options are rarely used |
| 23:58 | Lajjla | casion, |
| 23:58 | duck1123 | still, they can be nice to have at times if they're provided. (and you have the mode on) |
| 23:58 | Lajjla | I am the ZvZ master, 20-1 in my last 21 ZvZ games, I play this coinflip with two heads baby. |
| 23:59 | casion | I was 83% in zvz in season 3 |
| 23:59 | casion | #2 in my master's division |
| 23:59 | casion | zvp however… needs work |
| 23:59 | Lajjla | Same here, my ZvP is pretty bad |