2012-01-03
| 00:37 | amalloy | alexbaranosky: it should be possible if you have interfaces to mock out, but if you have to mock any concrete classes i think it's just not technically possible on the jvm |
| 00:38 | alexbaranosky | amalloy, I may have misunderstood, but all the Java mocking libraries mock classes |
| 00:38 | graphbum | has anyone grabbed the entire clojure.contrib/complete 1.3 via leiningen successfully? |
| 00:39 | alexbaranosky | amalloy, that's not much of a consolation thought, because I'm sill having a hard time figuring out how to mesh it into Midje's architecture nicely etc etc |
| 00:40 | amalloy | alexbaranosky: well, i don't know a lot about how the java mocking libs work |
| 00:41 | alexbaranosky | amalloy, one option is to try to use a mock library under the hood, instead of implementing it myself... but that has its own issues |
| 00:42 | alexbaranosky | because ideally it'd be nice to build off of the already-existing Metaconstant |
| 00:42 | alexbaranosky | oh, perhaps if I made the particular Metaconstant be a `spy` then it owuld still have all the features of a meta constant, but also get mocking |
| 00:43 | alexbaranosky | I'm going to have to explore that direction |
| 00:46 | graphbum | (:dependencies [org.clojure.contrib/standalone "1.3.0-SNAPSHOT"]) worked |
| 01:06 | replaca | technomancy: are you there? |
| 01:09 | technomancy | replaca: briefly |
| 01:11 | replaca | technomancy: what's the issuse with slamhound & pprint? |
| 01:11 | replaca | *issue |
| 01:18 | replaca | technomancy: still here? |
| 01:19 | amalloy | replaca: i think the issue is nothing to do with pprint specifically, but pretty-printing generally. producing good-looking ns-forms is what he claims to have trouble doing |
| 01:19 | replaca | yeah, but I what to know what it makes vs. what he's after |
| 01:19 | replaca | pprint is pretty tweakable and I bet I can get it right for him |
| 01:22 | replaca | that should have been "what I want" - it's been a long weekend |
| 01:59 | graphbum | is there a way to set up project templates for leiningen? say I want to change the default template set by "lein new", to include some dependencies by default, is there a way to do that? |
| 02:12 | replaca | graphbum: I happen to have the leiningen source open at the moment and I see that you can do it, but I don't understand to much about it. Look at https://github.com/technomancy/leiningen/blob/master/src/leiningen/new.clj and the new/ directory |
| 02:12 | replaca | I don't know if there's doc somewhere about it |
| 02:19 | graphbum | replaca: ah, cool. looks like it's just a function call.....so I can probably rip off the existing default template, see how that's invoked, and pipe in a modified version |
| 02:23 | graphbum | replaca: leiningen.new.templates/renderer looks promising |
| 02:24 | graphbum | replaca: in new/templates.clj |
| 02:25 | replaca | graphbum: great, glad that help. |
| 02:26 | replaca | off to bed now! almost to a new autodoc release, finally (by torturing leiningen) |
| 02:30 | graphbum | replaca: rock on. thanks for the pointer. |
| 03:22 | guns | Is it possible to wrap a namespace (p) with your own (q), so that loading q will provide functions from both p and q? |
| 03:23 | guns | Simply requiring p in q doesn't seem to work. |
| 04:16 | noidi | guns, maybe this could work? http://clojuredocs.org/clojure_core/clojure.core/load |
| 04:16 | guns | noidi: thanks, will check it out |
| 04:17 | guns | noidi: That's kind of a nuclear option isn't it? |
| 04:19 | noidi | yeah, it's quite low-level. I have no idea if its use is frowned upon, never had the need for it myself |
| 04:21 | guns | There must be a Clojure-esque way of wrapping a namespace. Or perhaps this is the pain point people seem to whine about wrt namespaces |
| 04:21 | noidi | the biggest pain point seems to be the syntax of the ns from |
| 04:21 | Fossi | people whine about that? |
| 04:21 | guns | hmm. I like it |
| 04:21 | Fossi | weird |
| 04:22 | Fossi | well, haters gonna hate |
| 04:22 | noidi | I've been using clojure for 3 years and I still have to occasionally copy and paste those parts to get them right :) |
| 04:22 | noidi | I always forget which parts should be wrapped in vectors and whatnot |
| 04:24 | noidi | guns, is this the same scenario that you're dealing with? https://groups.google.com/group/clojure/browse_thread/thread/c5d711a75e940c3b/a4fc53176cd68990 |
| 04:25 | guns | noidi: Yes it is. So the solution is to jam everything in one ns to avoid the problem altogether? |
| 04:27 | Fossi | meh |
| 04:27 | Fossi | i can understand the intention |
| 04:28 | Fossi | but i'm not sure it feels 'right' |
| 04:28 | guns | Redeclaring requires for every file doesn't really bother me (that's good C practice for instance). |
| 04:28 | guns | But if q provides the some of the same functions as p, you have to import [p :exclude [foo bar]] |
| 04:29 | guns | so you'd have to know the conflicts between p and q before bringing them into the same ns |
| 04:29 | guns | If q could wrap and provide p, then that would be nice |
| 04:30 | guns | And in C, you always put guard clauses around the sensitive #defines |
| 04:31 | Fossi | well, that's inherent to the lookup |
| 04:32 | Fossi | i'd rather say it's bad to just :use everything |
| 04:32 | guns | well, that's a solution |
| 04:32 | noidi | I agree |
| 04:32 | Fossi | in the same way that import java.semothing.* is bad |
| 04:33 | Fossi | we always :require [foo :as foo] |
| 04:33 | Fossi | and call foo/someith |
| 04:33 | guns | I see. Wean myself off the sugar then |
| 04:33 | Fossi | use is only for essentials imho |
| 04:33 | Fossi | for exampre in a test, we use the ns under test |
| 04:34 | noidi | but if for some reason you find it inconvenient to use :require or :use with specific symbols, there's https://code.google.com/p/clj-nstools/ |
| 04:34 | Fossi | so you don't have to write it *all* the time |
| 04:34 | noidi | (disclaimer: I've never used it) |
| 04:34 | guns | Well, what Fossi says is reasonable. Clarity wins over magic. I'm just coming over from Ruby-land |
| 04:35 | noidi | Fossi, that's my only use case for indiscriminating use, too |
| 04:35 | Fossi | well, we have some where we :use :only |
| 04:35 | Fossi | like (:use |
| 04:35 | Fossi | [clojure.contrib.def :only [defvar-]] |
| 04:35 | Fossi | [clojure.contrib.string :only [as-str]]) |
| 04:36 | noidi | sure |
| 04:36 | Fossi | because those happen to be used often and some are even in core now |
| 04:36 | Fossi | so we don't have to rewrite so much when we upgrade |
| 04:36 | noidi | but I only :use without :only when I'm pulling the ns under test into the test ns |
| 04:37 | noidi | everywhere else I :use :only or :require |
| 04:38 | Fossi | yeah |
| 04:39 | Fossi | the ml post talks about a slightly different case though |
| 04:39 | Fossi | if you write a library, it might make sense to "reexport" other stuff |
| 04:40 | Fossi | then, i never found any lib weird to use because of this |
| 04:41 | Fossi | most good libs are either abstracting away lower methods, so i only have to require those when i do something bare-bones |
| 04:41 | Fossi | or the case discussed sounds more like a 'util' lib that's additional to set and whatnot |
| 04:42 | Fossi | in both cases i like the explicit require |
| 05:15 | ghengis | hi |
| 08:52 | TimMc | Fossi: Haters gonna make some good points. |
| 08:53 | Fossi | TimMc: since i haven't seen any discussion, i can't say :) |
| 08:54 | Fossi | what's bad about it? |
| 08:56 | TimMc | Fossi: Honestly? The documentation is the worst part. |
| 08:56 | TimMc | It's not so bad once you know how to use it. |
| 08:56 | TimMc | Beyond that, require vs. :require. |
| 08:58 | Fossi | TimMc: yeah, i can recall that |
| 08:58 | Fossi | it's pretty cryptic |
| 08:58 | Fossi | can't be so hard to rewrite that though, if that's really the main point |
| 09:04 | TimMc | Rewrite the docs? File a ticket and pray. |
| 09:17 | Fossi | TimMc: this is getting too meta on me ;) |
| 10:04 | TimMc | Fossi: Oh, just snarking about the development process of Clojure. |
| 10:05 | Fossi | i figured ;) |
| 10:06 | Fossi | and i guess since i've signed the agreement, but it's still in my drawer, because i can't be bothered with snail mail, i can relate. even if that's a different point ;) |
| 10:32 | bweaver | How do `send` and `future` interact with the dynamic environment? Are the values of dynamic bindings introduced by `binding` guaranteed to remain the same? |
| 10:34 | bweaver | e.g. in `(do (def ^:dynamic foo 0) (binding [foo 1] (future (println foo))))`, is the value of `foo` in the future's body guaranteed to be 1? |
| 10:34 | TimMc | bweaver: New thread, different dynamic scope entirely. |
| 10:35 | TimMc | Same problem with lazy seqs. |
| 10:35 | bweaver | TimMc: That's what I was afraid of. I just wonder because it seems to retain the value when testing in the REPL, but threads are tricky :( |
| 10:35 | bweaver | So I won't rely on that behavior then. |
| 10:35 | bweaver | Thanks! |
| 10:35 | cemerick | bweaver: That's not true in clojure 1.3. |
| 10:35 | cemerick | TimMc: ^^ |
| 10:35 | TimMc | bweaver: Drop a let in around that future and you should be good. |
| 10:36 | TimMc | cemerick: Oh? |
| 10:36 | bweaver | OK, I'm using 1.3 |
| 10:36 | bweaver | So dynamic bindings are retained during the execution of a future or a send? |
| 10:36 | cemerick | Var bindings are transferred when using send, send-off, future, pmap, etc. |
| 10:36 | bweaver | Excellent! |
| 10:37 | TimMc | How does *that* work? |
| 10:37 | cemerick | The only way to avoid carrying along dynamic scope is if you start a new thread on your own. |
| 10:37 | TimMc | What about lazy seqs? |
| 10:38 | gko | what's the idiom to convert a list of integers (<= 255) into a Java array of bytes? (byte-array (map int-to-byte seq)) where int-to-byte[i] is (byte (if (> i 127) (- i 256) i))) ? |
| 10:39 | cemerick | TimMc: realization of values in lazy seqs continue to occur outside of any "original" dynamic scope. |
| 10:41 | TimMc | cemerick: Is that an intended difference? Or is there a technical roadblock to consistent behavior? |
| 10:45 | TimMc | So... the lazy seq is realized on another user thread, but futures and sends are computed on a Clojure "system" thread. |
| 10:45 | gtrak`` | TimMc: futures and sends are on an unbounded thread pool |
| 10:46 | gtrak`` | rather, futures use the unbounded one, sends use the bounded one, send-offs use the unbounded one, consider https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java |
| 10:47 | cemerick | TimMc: values in a lazy seq are realized on whatever thread forces their evaluation. |
| 10:47 | bweaver | TimMc: I'm new to Clojure, so I don't understand your question about lazy sequences? Would you mind pasting a simple example? |
| 10:48 | gtrak`` | in core.clj:future-call "(.submit clojure.lang.Agent/soloExecutor ^Callable f)" |
| 10:49 | TimMc | cemerick: I guess that lazy seqs *shouldn't* carry the original dynamic scope with them, because that could be a memory leak. |
| 10:50 | cemerick | Right. |
| 10:50 | TimMc | whereas future and agent code has a relatively short lifetime. |
| 10:50 | TimMc | ...is this documented anywhere? :-/ |
| 10:51 | gtrak`` | TimMc: also make sure to not wrap your future in a dynamic scope, since dynamic scopes are thread-local |
| 10:52 | mcrittenden | not strictly a clojure question, but how can I set up "lein run" as a cron job so that it restarts whenever it's not running? problems: 1) lein run expects to be run from the correct directory, and 2) how can I tell if it's already running? bash script that greps ps? |
| 10:52 | cemerick | TimMc: not that I'm aware of; there are wiki pages discussing the changes, though I can't seem to find them at the moment. |
| 10:53 | cemerick | TimMc: The current state of affairs is well covered in our book, FWIW. </shilling> |
| 10:53 | mcrittenden | (also just realized there's a #leiningen room so I posted that there as well) |
| 10:53 | gtrak`` | mcrittenden: why not use an uberjar instead? |
| 10:53 | bweaver | cemerick: Which book? |
| 10:53 | mcrittenden | gtrak``: I'm not familiar with uberjar? |
| 10:54 | gtrak`` | err, well technically you shouldn't be using lein for serving up a production site, i think that's what you're trying to do? |
| 10:55 | cemerick | bweaver: http://www.clojurebook.com |
| 10:55 | mcrittenden | gtrak``: yeah, I'm playing with noir and it comes bundled with jetty, and lein run just basically starts jetty on the specified port |
| 10:55 | mcrittenden | maybe that's not the correct way to put a noir site on prod, but I've had a lot of trouble finding best practices |
| 10:55 | gtrak`` | mcrittenden: here I've got an upstart script for ubuntu running my uberjar, which you can create with lein uberjar |
| 10:55 | gtrak`` | https://github.com/gtrak/garytrakhman.com/blob/master/scripts/upstart |
| 10:59 | TimMc | gtrak``, cemerick: You seem to disagree on whether futures can be wrapped in a binding. |
| 10:59 | gtrak`` | I'm probably wrong :-) |
| 11:02 | cemerick | TimMc, gtrak``: https://gist.github.com/ac8ef5515291e77a7a34 |
| 11:03 | gtrak`` | cemerick: hmm, why would that work? |
| 11:04 | raek | futures inheriting bindings is new in 1.3, right? |
| 11:04 | cemerick | gtrak``: Because the dynamic scope where `future` is evaluated is carried along to the evaluation of the future's body. |
| 11:04 | cemerick | raek: yeah |
| 11:04 | gtrak`` | ah, fishsticks |
| 11:05 | raek | this is how you would do it without that new feature: (future-call (bound-fn [] a)) |
| 11:05 | raek | bound-fn is like fn, but it remembers the bindings that were in place when the fn expression was evaled |
| 11:06 | gtrak`` | that's really interesting, I don't remember reading about bound-fn |
| 11:07 | TimMc | So if I really thought it was a good idea to make a lazy seq that remembered *all* the bindings... |
| 11:09 | raek | maybe something like this: (def foo-seq (bound-fn f [x] (lazy-seq (when ... (cons ... (f ...)))))) |
| 11:10 | raek | sorry, that doesn't work. |
| 11:11 | raek | (defn foo-seq [x] (let [f (bound-fn f [x] (lazy-seq (when ... (cons ... (f ...)))))] (f x)) |
| 11:11 | raek | maybe this |
| 11:12 | raek | ...or you can simply let the current value of the dynamic var and close over that |
| 11:12 | TimMc | And that doesn't leak *arbitrary* bindings. |
| 11:12 | raek | (defn foo-seq [x] (let [y *y*, f (fn f [x] (lazy-seq (when ... (cons ... (f ...)))))] (f x)) |
| 11:22 | erewhon | & |
| 11:22 | lazybot | java.lang.RuntimeException: EOF while reading |
| 11:39 | notsonerdysunny | The combination of slime and swank-clojure gives you complete access to the call-graph at an interactive level.. However, I was wondering if I can export the call-graph to an external file? |
| 11:40 | notsonerdysunny | is there some command/plugin which can do this... |
| 11:40 | notsonerdysunny | ? |
| 11:46 | jsnikeris | Hi all. Is there a good way to inspect java objects from the REPL? I'd like to see the current values of all fields regardless of access modifiers |
| 11:57 | holo | hi |
| 12:01 | holo | (loop [i 0] (when (< i 5) (println "i:" i) (recur (inc i)))) |
| 12:02 | holo | "Evaluates the exprs in order, then, in parallel, rebinds..." where does recur evaluate in order? in front or behind? it looks confusing |
| 12:04 | cgray | I think the thing you are quoting refers to loop. It evaluates the expressions between the square brackets in order. |
| 12:05 | holo | cgray, how can inc i be executed, if it recurs before it? |
| 12:06 | TimMc | holo: (recur (inc i)) -> (recur (inc 3)) -> (recur 4) |
| 12:06 | ipostelnik | holo, if you had (loop [i 0 j 0] ... (recur (inc i) (inc j)) then (inc i) is executed before (inc j) |
| 12:06 | cgray | recur acts just like a recursive function call |
| 12:12 | holo | ok, my question is why not ( (inc i) recur ) |
| 12:14 | ipostelnik | holo, (inc i) doesn't change value of i |
| 12:14 | ipostelnik | it returns the value of i+1 |
| 12:15 | TimMc | &(let [a 4, b (inc i)] [a b]) |
| 12:15 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: i in this context |
| 12:15 | ipostelnik | holo, recur "magically" jumps to (loop) and rebinds i |
| 12:15 | TimMc | &(let [a 4, b (inc a)] [a b]) ; holo |
| 12:15 | lazybot | ⇒ [4 5] |
| 12:17 | TimMc | holo: Do you understand this? (fn [i] (when (< i 5) (println "i:" i) (f (inc i)))) |
| 12:17 | TimMc | oops |
| 12:17 | TimMc | (fn f [i] (when (< i 5) (println "i:" i) (f (inc i)))) |
| 12:17 | TimMc | (Forgot to name the function.) |
| 12:23 | holo | TimMc, I understand |
| 12:25 | TimMc | holo: In that normal recursion example, you are *effectively* rebinding i and starting over. |
| 12:26 | TimMc | holo: because the return value of (f i) is the return value of (f (inc i)). |
| 12:26 | TimMc | loop/recur gives you the same computational power, as long as the recursive call is in the tail position. |
| 12:31 | holo | TimMc, i+1 rebinds with what in loop [i 0] ? OK I will imagine loop is a function, and what is inside [] are its input parameters. will it bind with first symbol it finds? |
| 12:34 | cgray | holo: it's almost right to imagine that what's inside [] are input parameters -- they're really input parameters and initial values... so [i 0], means an input parameter i with an initial value of 0 |
| 12:38 | holo | cgray, OK, I see now |
| 12:38 | holo | thanks TimMc, cgray |
| 12:52 | TimMc | jsnikeris: It's technically feasible, but I don't know offhand. You might find a Java lib that knows how to inspect private fields, then wrap that in a Clojure API. |
| 13:02 | Raynes | TimMc: http://clojuredocs.org/clojure_contrib/1.2.0/clojure.contrib.java-utils/wall-hack-field |
| 13:03 | Raynes | Not in a new-contrib library as far as I know, but small enough to snatch. |
| 13:07 | cemerick | TimMc, jsnikeris: Java already gives you all you need in the reflection API. :-) What Raynes said, too. |
| 13:08 | TimMc | Is there any danger in leaving fields and methods accessible? |
| 13:09 | TimMc | Not from a security standpoint. |
| 13:09 | cemerick | Like what? |
| 13:10 | TimMc | I guess it only matters for libs that use reflection, like TUnit. |
| 13:10 | cemerick | Even if you closed the door behind you, the reflection API ensures that it's never locked. |
| 13:10 | TimMc | *Junit |
| 13:10 | cemerick | ah |
| 13:10 | cemerick | Evil things. :-) |
| 13:11 | cemerick | The odds of an issue are probably very low. |
| 13:11 | cemerick | The private field/method would have to match whatever nutty criteria such libraries are looking for. |
| 13:14 | cemerick | "Nullary methods with a name starting with 'test' within classes with names starting with 'IT'" |
| 13:14 | cemerick | (That gem courtesy of Maven's failsafe plugin. :-P) |
| 13:15 | rallie` | (str '3a) gives me a NumberFormatException. How would I convert a symbol that begins with a number to a string? |
| 13:15 | hiredman | rallie`: thats not a legal symbol |
| 13:18 | rallie` | hiredman: ok, I see, it has to be a valid symbol |
| 13:18 | hiredman | well, for the reader to read it |
| 13:18 | hiredman | the mailing list is so bad |
| 13:19 | pandeiro | cemerick: do you have any opinion on using Clutch vs. an ORM tool (ie clj-record) + RDBMS? Ie which use cases benefit from the former or latter? |
| 13:19 | cemerick | hiredman: not getting the sort of applicants you were hoping for? ;-) |
| 13:20 | hiredman | the clojure mailing list is the only programming langauge list I am on, are the rest of them so full of stupid ideas? |
| 13:21 | hiredman | like this thread about extending namespaces to allow for multiple return values? what the hell |
| 13:21 | pandeiro | (i realize my question isn't exactly clojure-related, and apologize... i am at a little bit of a crossroads designing an app i want to implement) |
| 13:21 | devinus | anybody testing clojure with http://code.google.com/p/openjdk-osx-build/wiki/OpenJDK8MLVM ? |
| 13:23 | cemerick | pandeiro: It seems to me that RDMBS' big wins are (a) typed data and (b) ability to perform absurd ad-hoc queries. |
| 13:23 | cemerick | 'course, RDBMS' data model are generally pretty weak |
| 13:23 | ibdknox | pandeiro: I missed the question |
| 13:23 | hiredman | they are only absurd until you need them |
| 13:24 | cemerick | hiredman: indeed |
| 13:24 | pandeiro | ibdknox: i am designing an app and at a bit of a crossroads choosing the persistance layer |
| 13:24 | cemerick | pandeiro: IMO, the ideal combination would be something like couch, with data replicated to an RDBMS for reporting purposes. |
| 13:24 | ibdknox | pandeiro: it depends on the app :) |
| 13:24 | pandeiro | i am self-taught and learned CouchDB first and feel comfortable, but the more i model the data, the more relational it seems to get |
| 13:25 | cemerick | I've personally found Cloudant's _search view to be flexible enough to cover all my query needs for now, actually. |
| 13:25 | pandeiro | cemerick: that's an addon they've implemented, yeah? |
| 13:26 | cemerick | pandeiro: it's part of bigcouch, which is couchdb hoisted on top of a dynamo ring |
| 13:26 | ibdknox | pandeiro: honestly, do what you're comfortable with and grow out of it as you go if it doesn't suit your needs in the long run |
| 13:26 | ibdknox | what you start with now, will likely not be what you end with for any non-trivial app :) |
| 13:27 | pandeiro | ibdknox: hmmm, i guess i have to accept that in order to get started |
| 13:27 | cemerick | ibdknox: this means I'm doomed to scale up to PHP and mysql? ;-D |
| 13:27 | ibdknox | pandeiro: yeah, better to just run with it |
| 13:27 | ibdknox | cemerick: totally :D |
| 13:28 | pandeiro | cemerick: that is interesting re: big couch, i didn't realize it had additional features aside from the sharding support |
| 13:28 | hiredman | https://github.com/hiredman/php.lisp/blob/master/lisp.php for all your php needs |
| 13:29 | ibdknox | (inc hiredman) |
| 13:29 | lazybot | ⇒ 9 |
| 13:29 | cemerick | pandeiro: yup |
| 13:29 | hiredman | there is an unfinished compiler too |
| 13:29 | cemerick | I think cloudant + their _search view + clojurescript views will end up suiting me nicely for a long while. |
| 13:30 | cemerick | hiredman: you need another hobby ;-) |
| 13:30 | hiredman | I need to get serious about my baking |
| 13:30 | pandeiro | cemerick: you don't see the overhead of the closure stuff in cljs views being an issue? |
| 13:30 | cemerick | more importantly, Why? Please tell me you're actually using it! |
| 13:30 | cemerick | pandeiro: overhead? |
| 13:30 | pandeiro | (goog closure stuff i mean) |
| 13:31 | pandeiro | the cljs views need a bunch of google stuff to compile, right? |
| 13:31 | hiredman | I used it for a little web scraper I wrote for a friend |
| 13:31 | cemerick | pandeiro: the gclosure stuff isn't included in the compiled cljs output |
| 13:32 | cemerick | The resulting views *are* large (~30k min), but that shouldn't impact anything notably. |
| 13:32 | pandeiro | why are they large, namespacing and stuff? |
| 13:33 | cemerick | The clojurescript core lib comes along for the ride. |
| 13:33 | pandeiro | ah i see |
| 13:34 | pandeiro | and you think spidermonkey can chew through that 30k every time a view is updated w/out issue? |
| 13:35 | cemerick | I pounded away at it pretty good, without any detectable issue. |
| 13:35 | pandeiro | doesn't couch need to execute the view's JS every time a doc is created? |
| 13:36 | cemerick | it executes the view's js every time a view is accessed, and modifications have been made since the last access. |
| 13:37 | pandeiro | i see... sorry to have taken this way off topic, appreciate the input |
| 13:37 | cemerick | So if you touch a view, and 1000 documents are added/changed/deleted, then the view js will be loaded once to process those 1000 changes the next time you touch the view. |
| 13:38 | cemerick | Compared the amount of json being pushed around, 30k of js is negligible. |
| 13:38 | pandeiro | yeah i had forgotten that it isn't on write, it's on read |
| 13:39 | cemerick | That's not *entirely* true in bigcouch/cloudant, but at that scale, you shouldn't worry about 30k anyway. |
| 13:39 | pandeiro | is the latency of a roundtrip to their servers from wherever your app is an issue at all? |
| 13:40 | pandeiro | or is that just the price you pay for any PaaS ? |
| 13:40 | cemerick | They have clusters in AWS, rackspace, and softlayer IIRC. |
| 13:40 | cemerick | So you can have your data put whereever is good for you. |
| 13:41 | cemerick | At some scale, they'll manage a dedicated cluster. |
| 13:50 | cemerick | hiredman: f(x) notation! :-D |
| 13:51 | hiredman | :/ |
| 13:52 | thickey1 | is there a way to run tests against multiple JDK versions with clojure-maven-plugin? |
| 13:56 | wingie | how do i search for a keyword in the documentation from the REPL? |
| 13:57 | ibdknox | ,(doc find-doc) |
| 13:57 | devinus | if you accidentally completely pollute your swank repl with a use, how would you back that up? |
| 13:57 | clojurebot | "([re-string-or-pattern]); Prints documentation for any var whose documentation or name contains a match for re-string-or-pattern" |
| 13:57 | ibdknox | wingie: ^ |
| 13:57 | wingie | ibdknox: thnkas! |
| 13:57 | raek | devinus: remove-ns is one way |
| 13:58 | devinus | raek: (remote-ns 'ns) would undo all of them? |
| 13:58 | wingie | more langs should have a REPL like clojure's |
| 13:58 | ibdknox | wingie: what do you need other languages for? ;) |
| 13:58 | raek | devinus: it removes that namespace completely |
| 13:59 | TimMc | &(doc remove-ns) |
| 13:59 | lazybot | ⇒ "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace." |
| 13:59 | devinus | hrm… that might not be what i need |
| 13:59 | raek | lets say you accidentally used a namespace bar in namespace foo |
| 13:59 | devinus | what my problem is |
| 13:59 | devinus | i accidentally, say (use 'clojure.contrib.string) |
| 13:59 | raek | (in-ns 'user) (remove-ns 'foo) (require 'foo) (in-ns 'foo) |
| 13:59 | devinus | and now suddently, take and several other core fns are shadowed |
| 14:00 | raek | devinus: in which namespace did you do this? a namespace "connected" to a file or "user"? |
| 14:00 | devinus | raek: user |
| 14:00 | wingie | ibdknox: js for browser:) |
| 14:00 | ibdknox | wingie: ClojureScript! :D |
| 14:01 | wingie | ibdknox: have to use ExtJS :) |
| 14:01 | devinus | i tried to do (use 'clojure.core) but then it complains that the fns are being shadowed |
| 14:01 | wingie | and Sproutcore |
| 14:01 | devinus | when it didnt the other way around |
| 14:01 | raek | devinus: you could do something like this: (ns 'temp) (remove-ns 'user) (ns 'user) (use 'clojure.repl) (remove-ns 'temp) |
| 14:01 | wingie | but i hope clojurescript will be gaining momentum so we have alternatives |
| 14:02 | raek | devinus: you can also use ns-unalias on each symbol that was affected |
| 14:02 | raek | and then refer-clojure |
| 14:03 | devinus | hrm |
| 14:03 | devinus | (ns 'temp) gives me "clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol" |
| 14:03 | devinus | is it seeing 'temp as a PersistentList? |
| 14:03 | raek | sorry |
| 14:03 | TimMc | devinus: (quote temp) |
| 14:03 | raek | devinus: (ns temp) |
| 14:03 | devinus | ah |
| 14:04 | raek | was mixing the syntax with in-ns... |
| 14:05 | devinus | i wonder why (ns) doesnt use a symbol... |
| 14:05 | hiredman | why do you think it doesn't? |
| 14:06 | raek | devinus: ns is a macro, unlinke the other ones which are functions |
| 14:06 | hiredman | devinus: if temp is not a symbol, what is it? |
| 14:06 | devinus | hiredman: i figured ns was a macro like raek said |
| 14:07 | hiredman | "i wonder why (ns) doesnt use a symbol" |
| 14:07 | devinus | hiredman: i needed my suspicion confirmed before i looked like an idiot |
| 14:08 | devinus | guess i did it anyway though |
| 14:08 | TimMc | :-P |
| 14:08 | raek | well "temp is a symbol" and "'temp is a symbol" can both be true, but on different levels |
| 14:08 | hiredman | 'temp is a quoted symbol |
| 14:09 | TimMc | 'temp evaluates to a symbol, temp reads as a symbol |
| 14:10 | raek | but it evaluates to that symbol, so 'temp "is" the symbol temp in the same sense as x "is" 3 in (let [x 3] ___) |
| 14:13 | hiredman | ,(let [temp 'temp] temp) |
| 14:13 | clojurebot | temp |
| 14:13 | raek | devinus: this is another way to undo the use: (dorun (map #(ns-unmap *ns* %) (keys (ns-publics 'clojure.string)))) (refer-clojure) |
| 14:14 | TimMc | &(let [let 'let] let) |
| 14:14 | lazybot | ⇒ let |
| 14:14 | devinus | raek the temp ns solution seems...cleaner |
| 14:15 | amalloy | TimMc: have you read let over lambda? he has a lovely common-lisp quine using only 'let |
| 14:15 | devinus | hiredman: that makes sense. lispy ways of binding to variables confuses me still sometimes |
| 14:16 | amalloy | it doesn't translate to clojure because our backtick form is dramatically different |
| 14:18 | TimMc | amalloy: You pasted that in #4clojure at one point. |
| 14:18 | TimMc | It was pretty neat. |
| 14:18 | TimMc | I have LoL open in a browser tab, but I don't know when I'll really get around to it. |
| 14:22 | amalloy | TimMc: the online-free version is only the first couple chapters |
| 14:23 | cemerick | amalloy: our backtick has a certain on-stage flair? |
| 14:24 | cemerick | sorry, had to do it. :-P |
| 14:24 | amalloy | it has a tendency to soliloquize |
| 14:24 | cemerick | I would have pegged it as having a spot-on MPD. |
| 14:25 | cemerick | Definitely a character actor. |
| 14:25 | amalloy | uhoh, MPD is not an acronym i can find anywhere |
| 14:26 | cemerick | multiple personality disorder |
| 14:27 | Raynes | cemerick: Those intros and outros on Chris' interview is fantastic. |
| 14:27 | Raynes | s/is/are/ |
| 14:27 | cemerick | Raynes: Yeah, I like 'em a lot too. |
| 14:27 | ibdknox | the part where Chris is talking is total crap though, I'd skip it. |
| 14:28 | cemerick | Apparently he worked for Micro$oft. feh. |
| 14:28 | ibdknox | must be evil. |
| 14:28 | Raynes | He wasn't much fun to talk to at the conj. |
| 14:28 | Raynes | That's why I only spent until like 1AM with him. |
| 14:29 | rien | Raynes: did you see my message? |
| 14:30 | Raynes | rien: I don't think so. |
| 14:30 | rien | Raynes: I was just saying that nixeagle never replied :/ |
| 14:30 | Raynes | rien: Oh. I've talked with him recently. He is working on it. There are a couple of bugs he is cleaning up. |
| 14:31 | rien | beautiful then. did he say he'd put it on his github acct once he was done? |
| 14:31 | Raynes | rien: Yeah. |
| 14:31 | rien | all I needed to know. I'll be checking his github every once in a while then. thanks, man. |
| 14:34 | clj_newb | I need to read/write sexps to file. What functions shoudl I run doc on ? |
| 14:35 | clj_newb | alright, let's try something else. Clojure sucks. It doesn't even provide basic IO for sexps. |
| 14:36 | clj_newb | alright, let's try something else. Clojure sucks. It doesn't even provide basic IO for sexps. Prove me wrong. :-) |
| 14:36 | gtrak``` | ,kick clj_newb |
| 14:36 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: kick in this context, compiling:(NO_SOURCE_PATH:0)> |
| 14:36 | technomancy | ~io |
| 14:36 | clojurebot | Pardon? |
| 14:37 | technomancy | ~io is generally done with clojure.java.io, which is explained at http://copperthoughts.com/p/clojure-io-p1/ |
| 14:37 | clojurebot | Ok. |
| 14:37 | clj_newb | gtrak```: shouldn't that be ,(kick 'clj_newb) ? |
| 14:38 | cemerick | clj_newb: read-string/pr-str, and read/pr/reader/writer when you are working with large files. |
| 14:38 | cemerick | And, trolling sucks. |
| 14:38 | Raynes | <amalloy> he's just choosing to phrase "guys how do i do io" in a more fun way |
| 14:38 | mcrittenden | http://bash.org/?152037 |
| 14:39 | amalloy | sweet, Raynes, thanks for the implicit permission to paste anything you say into #clojure |
| 14:39 | Raynes | amalloy: You're welcome, bro. |
| 14:39 | TimMc | clj_newb: lrn2patience |
| 14:40 | cemerick | mcrittenden: Ah, crap. :-D |
| 14:40 | clj_newb | TimMc: What about the three virtues of a programmer? :-) |
| 14:41 | cemerick | I thought the more problematic thing was for people to paste things said in #clojure elsewhere? |
| 14:41 | cemerick | What's said in #clojure, stays in #clojure. |
| 14:41 | TimMc | cemerick: The public logs already do that. |
| 14:41 | amalloy | except in the 3+ public logs |
| 14:41 | brett_h | technomancy: do you know clojure-jack-in would raise this error given the path is set and the binary is found? http://pastebin.com/7dfxyTAR |
| 14:42 | cemerick | **this channel is logged?!?!111!!** |
| 14:42 | jodaro | time to stop drinking |
| 14:42 | TimMc | $google "this channel is logged?!" |
| 14:42 | jodaro | or |
| 14:42 | lazybot | [Channels | ZFTalk] http://zftalk.com/channel/ |
| 14:42 | jodaro | start |
| 14:42 | seancorfield | privacy is an illusion :) |
| 14:42 | clj_newb | nice; there's a slurp function that goes file->string? very nice |
| 14:42 | technomancy | brett_h: whoa; that's a weird one |
| 14:42 | technomancy | I thought you could always trust exec-path |
| 14:42 | amcnamara | clj_newb: there's also a spit function to do the opposite |
| 14:42 | gtrak | brett_h: you could always do lein swank in a shell and then M-x slime-connect |
| 14:43 | brett_h | gtrak: sure, I was hoping to get this working though |
| 14:43 | cemerick | seancorfield: Hey Sean, how goes it? :-) |
| 14:43 | brett_h | technomancy: yeah, fwiw same conf worked on Ubuntu 11.10 + emacs-snapshot yesterday ... I just switched to Arch with emacs-bzr ... no idea what else is different |
| 14:43 | brett_h | technomancy: could be different* |
| 14:43 | amalloy | slurp actually is more general: inputty-thing->string |
| 14:43 | Raynes | http://www.raynes.me/logs/irc.freenode.net/clojure/today.txt |
| 14:44 | clj_newb | ~io |
| 14:44 | clojurebot | io is generally done with clojure.java.io, which is explained at http://copperthoughts.com/p/clojure-io-p1/ |
| 14:44 | clj_newb | nice :-) |
| 14:44 | clj_newb | I like this blog post. |
| 14:44 | technomancy | brett_h: start-process explicitly states that it honors exec-path in its docstring, so unless you've changed clojure-swank-command it's gotta be an emacs bug? |
| 14:44 | clj_newb | alright, spit/slurp gives me file <-> string. How do I go sexp <-> string? |
| 14:45 | seancorfield | ,(doc pr-str) |
| 14:45 | clojurebot | "([& xs]); pr to a string, returning it" |
| 14:45 | clj_newb | pr-str : sexp -> string |
| 14:45 | clj_newb | how about string -> sexp ? |
| 14:45 | seancorfield | ,(doc read-string) |
| 14:45 | clojurebot | "([s]); Reads one object from the string s" |
| 14:46 | langmartin | clj_newb: the laziness that's the traditional virtue of a programmer has to do with respecting your own time enough to not do boring things; not disrespecting other people's time |
| 14:46 | clj_newb | dumb question: is there a way the names are pr-str/read-string, i.e. the str/string inconsistency? |
| 14:47 | clj_newb | langmartin: I was mocking my own impatience @ pasting the same question 3 times within 1 minutes; not on laziness/hubris :-) |
| 14:48 | seancorfield | ,(apropos "read") |
| 14:48 | clojurebot | (read-line pop-thread-bindings thread-bound? read *read-eval* ...) |
| 14:48 | seancorfield | &(apropos "read") |
| 14:48 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: apropos in this context |
| 14:48 | langmartin | ok, but now there's a link called getting started on the clojure homepage, immediately followed by "reader" which covers all this |
| 14:48 | seancorfield | bah |
| 14:49 | TimMc | ,(require 'clojure.repl) |
| 14:49 | clojurebot | nil |
| 14:49 | TimMc | ,(apropos "read") |
| 14:49 | clojurebot | (read-line pop-thread-bindings thread-bound? read *read-eval* ...) |
| 14:49 | TimMc | \o/ |
| 14:51 | seancorfield | TimMc: that's what i already did |
| 14:51 | seancorfield | it was &(apropos "read") that failed :) |
| 14:52 | seancorfield | &(require 'clojure.repl) |
| 14:52 | lazybot | ⇒ nil |
| 14:52 | seancorfield | &(apropos "read") |
| 14:52 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: apropos in this context |
| 14:52 | seancorfield | &(clojure-version) |
| 14:52 | lazybot | ⇒ "1.3.0" |
| 14:52 | TimMc | Oh, I see -- it was the lazybot command that failed. |
| 14:52 | seancorfield | yeah |
| 14:52 | seancorfield | &(do (use 'clojure.repl) (apropos "read")) |
| 14:52 | lazybot | ⇒ (repl-read read-line pop-thread-bindings thread-bound? read *read-eval* read-string get-thread-bindings load-reader push-thread-bindings *print-readably* read-findfn-args thread-stopper thread-local* useful.utils.proxy$java.lang.ThreadLocal$0 thread-local if-exists... https://gist.github.com/1556599 |
| 14:53 | Raynes | amalloy: Still don't want to blacklist use? |
| 14:53 | seancorfield | so, in answer to clj_newb's Q: why is it read-string but pr-str (not pr-string)? |
| 14:54 | brett_h | technomancy: it works if I use emacs -nw or spawn the emacs GUI from a shell. interesting, going to check out start-process's C |
| 14:54 | amalloy | no, why would i? it's a little tasteless to do a bare-use like that, but it let people do what they wanted to do with the bot and caused no harm |
| 14:54 | TimMc | Hysterical raisins. |
| 14:54 | seancorfield | &(clojure.repl/apropos "read") |
| 14:54 | lazybot | ⇒ (repl-read read-line pop-thread-bindings thread-bound? read *read-eval* read-string get-thread-bindings load-reader push-thread-bindings *print-readably* read-findfn-args thread-stopper thread-local* useful.utils.proxy$java.lang.ThreadLocal$0 thread-local if-exists... https://gist.github.com/1556607 |
| 14:55 | Raynes | amalloy: Which they could have done with require. |
| 14:55 | Raynes | Or apparently without require. |
| 14:55 | seancorfield | ah, so it's required, just not refered |
| 14:55 | amalloy | seancorfield: well it wasn't required until you did it |
| 14:55 | Raynes | amalloy: I just restarted the bot. |
| 14:55 | amalloy | Raynes: he could have done it just with the lambda calculus by rewriting apropos himself, but it's more convenient this way |
| 15:05 | Raynes | 4Clojure just hit one hundred thousand solutions. |
| 15:05 | ibdknox | Congrats! |
| 15:05 | Raynes | Dance party. |
| 15:05 | amalloy | *obligatory embarrassing dance-failure* |
| 15:05 | koeien | interesting website. i'll try it. |
| 15:06 | wingie | clojure is the new black |
| 15:19 | brett_h | technomancy: got it, the problem wasn't exec-path, it's the fact that it pipes to another shell |
| 15:20 | brett_h | technomancy: that shell didn't have the PATH to find lein |
| 15:31 | wingie | could clojure be used to create a web server like in node.js? |
| 15:31 | ivan | yep |
| 15:31 | wingie | if so is there a web framework making it easy? |
| 15:32 | ibdknox | wingie: Noir - http://www.webnoir.org |
| 15:32 | wingie | like express for node.js |
| 15:32 | wingie | that one is the defacto? |
| 15:32 | hiredman | web frameworks usually aren't used to "create a web server" |
| 15:33 | wingie | hiredman: what do you mean? |
| 15:33 | wingie | i mean web server frameworks like express for node.js |
| 15:33 | mcrittenden | wingie: I was in your position a week ago and decided to go with noir. it seems to have the most momentum, has pretty decent docs and is full featured (sessions, cookies, form validation, etc.). but the server itself is jetty, which just comes bundled with it, so you're not "creating a web server" by using it |
| 15:34 | koeien | am i correct in assuming the following: if i write (let [f (expr)] ...), i cannot use f in expr ? |
| 15:34 | hiredman | correct |
| 15:34 | ibdknox | mcrittenden: you can use netty or tomcat or GAE or... whatever too :) |
| 15:34 | koeien | so i would have to use a y-combinator or something, to do this. |
| 15:35 | ibdknox | ,(doc letfn) |
| 15:35 | wingie | mcrittenden: i see .. kinda like php using apache |
| 15:35 | mcrittenden | ibdknox: oh for sure, I just meant that in node.js you actually create the server using native node.js code, whereas here you just use a 3rd party server |
| 15:35 | clojurebot | "([fnspecs & body]); fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+) Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body." |
| 15:35 | raek | koeien: you can give an anonymous function a name it can use in itself: (fn f [...] ...) |
| 15:35 | wingie | im too used to how node.js do things =) |
| 15:35 | koeien | thank you. |
| 15:36 | wingie | but how does jetty handle concurrency? |
| 15:36 | raek | also, (letfn [(f [...] ...)] ...) is nearly the same thing as (let [f (fn f [...] ...)] ...) |
| 15:36 | ibdknox | wingie: you can use it on netty, which is non-blocking IO |
| 15:36 | ibdknox | just like node |
| 15:36 | wingie | i see |
| 15:37 | wingie | so it's better than jetty since it's not using threads? |
| 15:37 | ibdknox | no |
| 15:37 | ibdknox | not at all |
| 15:37 | raek | ...but it also allows all function letted functions to refer to each other |
| 15:37 | koeien | raek, ibdknox: thank you for the pointers. i was a bit confused at the error message, this clears it up and provides the solution. |
| 15:37 | ibdknox | a threaded server is significantly faster for fire and forget |
| 15:37 | ibdknox | for long running connections NIO is better |
| 15:37 | gtrak | wingie: processes are not *better* than threads |
| 15:38 | ibdknox | basically are you doing long polling or websockets? If so use Netty |
| 15:38 | ibdknox | otherwise something like Jetty will do you well |
| 15:38 | wingie | ibdknox: yeah i have to have multiple users connected |
| 15:38 | ibdknox | wingie: what do you mean by connected? |
| 15:39 | wingie | using web sockets |
| 15:39 | ibdknox | ah |
| 15:39 | wingie | or whatever underlying protocol |
| 15:39 | ibdknox | aleph + Noir should do it for you then |
| 15:39 | ibdknox | wingie: https://gist.github.com/1257857 |
| 15:41 | wingie | ibdknox: looks cool thanks |
| 15:42 | ibdknox | wingie: fwiw, I got significantly better performance on the JVM than node |
| 15:42 | ibdknox | working with websockets |
| 15:42 | ibdknox | scaling to 100k+ on a single box |
| 15:43 | wingie | cool |
| 15:43 | wingie | i have to make some performance tests |
| 15:45 | lucian | ibdknox: what are you using on node and jvm? |
| 15:46 | ibdknox | lucian: I used socket.io on node and a netty version of socket.io that I wrote |
| 15:46 | lucian | ibdknox: right, so not entirely comparable |
| 15:46 | lucian | of course, if it's faster it's a good idea to just use it |
| 15:47 | lucian | but that high up the stack, the performance issues could be anywhere |
| 15:47 | ibdknox | it's entirely comparable |
| 15:47 | ibdknox | websockets on node vs websockets on netty |
| 15:48 | lucian | that means some websockets library on node vs some other websockets library on the jvm |
| 15:48 | TimMc | Well, it's the whole stack that matters. |
| 15:48 | wingie | is aleph similar to socket.io? |
| 15:48 | ibdknox | it's pointless to say "node is fast" but actually using it is slow because the defacto standard lib sucks |
| 15:49 | ibdknox | that's not a valuable thing to say |
| 15:49 | ivan | ibdknox: is that 100K threads, or are there some event loops? |
| 15:49 | ibdknox | ivan: netty and node are both non-blocking |
| 15:49 | ibdknox | so event loops :) |
| 15:51 | amalloy | ibdknox: you can implement a fast fibonacci server in node. QED |
| 15:51 | ibdknox | amalloy: haha |
| 15:51 | lucian | TimMc: yeah, that's what i meant |
| 15:52 | lucian | ibdknox: v8 isn't that fast really, hotspot beats it almost always |
| 15:52 | TimMc | v8 is fast compared to other JS VMs. |
| 15:52 | ibdknox | lucian: If you mean what TimMc meant, then we don't disagree? :) |
| 15:52 | lucian | but network programs are almost always io bound, and in such cases the libraries underneath matter a lot more |
| 15:53 | lucian | TimMc: sure |
| 15:54 | lucian | it's really really fast or a JS vm indeed |
| 15:54 | lucian | about as fast as, say, PyPy |
| 16:02 | wingie | im exploring the use cases for clojure for me .. it seems doing pretty well as a web backend |
| 16:02 | ibdknox | wingie: best I've ever used and I've used most of them :) |
| 16:02 | wingie | will I be able to build Android apps with Clojure? |
| 16:02 | gtrak | it's a general purpose programming language |
| 16:03 | wingie | or use the Java frameworks like Sencha's GWT with it? |
| 16:03 | OlegYch | i had pretty bad experience with extgwt |
| 16:04 | OlegYch | you must feel lucky you can't use it with language other than java |
| 16:05 | wingie | okay im using their Ext |
| 16:05 | wingie | that one is really awesome |
| 16:05 | gtrak | can't write frontend GWT code, since GWT goes straight from java source to js. Clojure goes straight from clojure source to bytecode. |
| 16:05 | wingie | have someone here used Google's GWT? (or what its called) |
| 16:05 | mcrittenden | wingie supposedly you can use clojure for android apps. there are a couple guides out there like this one (http://riddell.us/ClojureAndAndroidWithEmacsOnUbuntu.html) |
| 16:05 | lazybot | The riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you. |
| 16:06 | mcrittenden | but I've never tried it so ymmv |
| 16:06 | wingie | is lazybot a bot? |
| 16:06 | mcrittenden | yes |
| 16:06 | gtrak | for android, you might have better luck with clojurescript and phonegap |
| 16:07 | wingie | who commanded it to print out the "use leiningen" tip? |
| 16:07 | wingie | cant see the command |
| 16:07 | hiredman | I would not recommend using clojure for android apps |
| 16:07 | hiredman | the runtime footprint is just too large currently |
| 16:08 | mcrittenden | wingie it is programmed to say that whenever someone posts a riddell.us link apparently. |
| 16:08 | lazybot | The riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you. |
| 16:08 | mcrittenden | hehe oops |
| 16:08 | wingie | riddell.us |
| 16:08 | lazybot | The riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you. |
| 16:08 | wingie | :) |
| 16:08 | wingie | yeah leiningen kicks ass |
| 16:08 | wingie | i am using it's repl wrapper |
| 16:09 | TimMc | wingie: I've used GWT. It's kind of terrible. |
| 16:10 | wingie | TimMc: google's one? |
| 16:10 | wingie | or Sencha's |
| 16:11 | TimMc | I wasn't aware there were multiple. Google's. |
| 16:12 | TimMc | It might be tolerable once Java has lambdas. |
| 16:12 | TimMc | proper ones |
| 16:12 | wingie | http://www.sencha.com/gxtdocs/ |
| 16:12 | zilti | TimMc: Will that ever happen? |
| 16:12 | TimMc | Don't ask me. |
| 16:12 | TimMc | I thought we were getting them in JDK 7. |
| 16:13 | amalloy | allegedly that might have been the case for a while |
| 16:13 | zilti | If that are "real" lambdas |
| 16:13 | amalloy | now, allegedly, it might be the case that we're getting syntax sugar for lambdas in JDK 8 |
| 16:14 | zilti | I'm using the "or" function of sqlkorma. I have a function which takes a list as input. Now I need to turn a list like ("first" "second" "third") into (or {:field "first"} {:field "second"} {:field "third"}) but how? |
| 16:23 | TimMc | If `or` is a function, you can (apply or ...). |
| 16:24 | TimMc | That ... can be the result of a map or for expression over the list |
| 16:25 | amalloy | i imagine korma has an "in" or something like it |
| 16:25 | zilti | Oh wait, "or" isn't a function :( |
| 16:25 | zilti | yes, there's an "in" |
| 16:53 | MenTaLguY | hm |
| 16:53 | MenTaLguY | so what does this error mean? |
| 16:53 | MenTaLguY | Exception in thread "main" java.lang.IllegalArgumentException: No single method: accepting_state_QMARK_ of interface: hx.fsm.AbstractState found for function: accepting-state? of protocol: AbstractState (fsm.clj:31) |
| 16:54 | gtrak | sounds like something's not compiled correctly? |
| 16:55 | amalloy | no, sounds like you're calling a protocol function with incorrect args |
| 16:55 | hroarke | MenTalguY: I've gotten somthing similar to that if I reload a namespace that defines a protocol, but then try to use it's functions on an object I created before reloading. |
| 16:56 | amalloy | ah, that's another strong possibility |
| 16:56 | MenTaLguY | hmm |
| 16:57 | MenTaLguY | I think it's incorrect args in this case |
| 16:57 | MenTaLguY | clojure error message aren't that helpful, especially as they give you unqualified filenames |
| 16:57 | MenTaLguY | I'll have to figure out where it's happening |
| 16:57 | amalloy | are you trying to write a protocol with &args? |
| 16:59 | MenTaLguY | nope |
| 16:59 | MenTaLguY | does that work? |
| 16:59 | MenTaLguY | (I wouldn't have expected it to...) |
| 17:00 | MenTaLguY | I found it, it's incorrect args |
| 17:00 | MenTaLguY | thanks |
| 17:06 | AWizzArd | Can a Leiningen plugin overwrite the version number of a project? |
| 17:07 | technomancy | AWizzArd: it's just an assoc away =) |
| 17:07 | AWizzArd | For example, that hypothetical plugin could read the version number from the most current tag in my Mercurial repo. |
| 17:08 | technomancy | oh, you'd have to add a hook to read-project to make it take effect in other tasks |
| 17:08 | technomancy | but it's possible |
| 17:08 | _Vi | What is the main difference between clojure 1.3.0-alpha4 and 1.3.0? On alhpa4 my program works, on release it fails <RuntimeException java.lang.RuntimeException: 4: Failure> |
| 17:09 | AWizzArd | technomancy: Currently my procudure is this. I do Semantic Versioning. So when I am ready, I update the version number in my project.clj and possibly in a readme, and then I commit this with a commit message in the format: "Release x.y.z". |
| 17:10 | AWizzArd | Then I tag this revision, also with x.y.z, which causes another commit on top of what I currently have. |
| 17:10 | TimMc | _Vi: The most important difference is that 1.3.0 is what you should be using. :-P That's pretty weird, though. |
| 17:10 | AWizzArd | But the Mercurial build script itself for example reads its version number from the latest tag. |
| 17:11 | amalloy | AWizzArd: eh? tags create a commit? |
| 17:11 | amalloy | they don't in git, but i guess i don't know about hg |
| 17:11 | AWizzArd | amalloy: in HG they do. Tagging something is part of the project history. |
| 17:19 | AWizzArd | amalloy: the Mercurial philosophy is to remember who set a tag at what time, and make this just one more commit. |
| 17:22 | technomancy | AWizzArd: there's been talk of supporting programmatically-modifiable project.clj files in lein 2 |
| 17:23 | technomancy | an optional alternative to defproject would just be (def project {:name myproject :version "1.0.0-SNAPSHOT" [...]}) |
| 17:23 | technomancy | which would be a lot easier to parse and munge from plugins |
| 17:23 | technomancy | aaaaaactually that might even unintentionally work in lein 1 |
| 17:23 | AWizzArd | Yes, that could be interesting. I remember, a long time ago, when the discussion started about changing the build system from Ant to Maven, there was a lot of talk about hashes, reading data from the git repo, etc. |
| 17:24 | TimMc | how low can you go |
| 17:24 | cemerick | AWizzArd: that's high on my todo list BTW (i.e. a "release" plugin for lein) |
| 17:24 | technomancy | it would be higher on my list if I were more careful about tagging and made releases more often. =) |
| 17:24 | AWizzArd | (: |
| 17:25 | cemerick | Releasing from a working copy scares me too much to not prioritize it. :-) |
| 17:25 | technomancy | cemerick: for whatever stupid reason I called version 1.0.0 of the tar plugin "lein-release" |
| 17:25 | technomancy | but it's been deprecated since like the week after it was released, so it's probably safe to take it over |
| 17:25 | cemerick | Easy fix. No one produces tar files anymore. |
| 17:25 | technomancy | hah |
| 17:26 | technomancy | well I moved it to lein-tar, which still exists and has users. |
| 17:26 | cemerick | I only see them when downloading various dubious OS X 'wares. FancyMacApp.tgz |
| 17:27 | technomancy | cemerick: how would you deploy a non-webapp that needs scripts and can't be just an uberjar? |
| 17:27 | technomancy | wait, I'm being trolled. |
| 17:27 | technomancy | macs have their own crazy installer thingies |
| 17:28 | amalloy | technomancy: i'm finding it really hard to resist rising to cemerick's bait also |
| 17:28 | solussd | can I force clojure.xml/emit to use double quotes around attribute values? it currently uses single quotes and creates malformed xml if the string contains a single quote |
| 17:29 | amalloy | chouser: btw, how do you feel about removing (at least temporarily) the whitespace test for data.xml so that we can put out a release that people can actually use? |
| 17:30 | cemerick | technomancy: those apps are usually of the the drag-to-/Applications variety |
| 17:30 | cemerick | technomancy: and: scripts? huh, what scripts? |
| 17:30 | cemerick | oh, non-webapp |
| 17:30 | cemerick | OS X .app, or NSIS installer for windows. |
| 17:31 | technomancy | cemerick: I mean server-side |
| 17:31 | TimMc | solussd: Wait, it doesn't escape quotes? wtf |
| 17:31 | solussd | TimMc: I was surprised too |
| 17:31 | amalloy | TimMc: clojure.xml is badly broken in a lot of ways; it's a halfway solution |
| 17:32 | AWizzArd | cemerick: that plugin would be very nice, especially since one can not forget anymore to update the version file. But the question stays: what about other mentions of the version number, for example in a readme file, or in accompanying html docs? |
| 17:32 | amalloy | data.xml does a pretty good job but is lacking (a) some feature you might want, and (b) an officially-blessed release |
| 17:32 | cemerick | technomancy: what scripts are we talking about again? :-P |
| 17:32 | TimMc | How can it *not* do that? That's like the first thing I would write a test for. |
| 17:33 | solussd | ,(-> {:tag :Blah :attrs {:a "it's broken"}} clojure.xml/emit with-out-str) |
| 17:33 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.xml> |
| 17:33 | cemerick | You should know me well enough by now that I find was around writing scripts. :-) |
| 17:33 | technomancy | cemerick: daemonization stuff, setting -Xmx, stuff like that |
| 17:34 | amalloy | ,(require 'clojure.xml) |
| 17:34 | clojurebot | nil |
| 17:34 | technomancy | I would like to do deploys like that using .debs, but the fact that you can't have multiple versions installed at once basically makes that useless |
| 17:34 | amalloy | ,(-> {:tag :Blah :attrs {:a "it's broken"}} clojure.xml/emit with-out-str) |
| 17:34 | clojurebot | "<?xml version='1.0' encoding='UTF-8'?>\n<Blah a='it's broken'/>\n" |
| 17:34 | solussd | ,(-> {:tag :Blah :attrs {:a "it's broken"}} clojure.xml/emit with-out-str) |
| 17:34 | clojurebot | "<?xml version='1.0' encoding='UTF-8'?>\n<Blah a='it's broken'/>\n" |
| 17:34 | solussd | grr |
| 17:34 | solussd | i guess I can escape it myself. :/ |
| 17:34 | amalloy | solussd: are you married to clojure.xml? there are several better solutions |
| 17:35 | solussd | am alloy, not in the slightest- I'd prefer to be able to feed it the same :tag :attrs :content map though |
| 17:35 | solussd | *amalloy ^ (damn you autocorrect) |
| 17:35 | cemerick | amalloy: a set of tickets to fix hardcore bugs like that seem called for |
| 17:36 | amalloy | well, that's the format data.xml uses (though it also accepts hiccup/prxml-style [:tag {:attrname attrval} content content content]) |
| 17:37 | hiredman | clojurebot: xml solution is <reply> the best solution is not to use xml at all |
| 17:37 | clojurebot | Ok. |
| 17:37 | hiredman | clojurebot: do you know of an xml solution? |
| 17:37 | clojurebot | Cool story bro. |
| 17:37 | hiredman | clojurebot: jerk |
| 17:37 | clojurebot | Cool story bro. |
| 17:37 | amalloy | sadly until an official release comes out (which will heopfully be soon), i have to recommend you to an unofficial fork like http://clojars.org/org.clojars.ninjudd/data.xml |
| 17:37 | technomancy | clojurebot: jerk is <reply>you cut me deep, man. |
| 17:37 | clojurebot | Ok. |
| 17:38 | amalloy | technomancy: you're ruining his desire to reply with actual capitalization |
| 17:38 | amalloy | clojurebot regards irc as a high-formality medium, with caps and punctuation |
| 17:38 | TimMc | "Sincerely, clojurebot" |
| 17:38 | technomancy | clojurebot: it's hard to stay in character. |
| 17:38 | clojurebot | It's greek to me. |
| 17:39 | cemerick | technomancy: jsvc has always served me well for stuff like that. *shrug* |
| 17:40 | cemerick | Is that considered ghetto these days? |
| 17:40 | cemerick | Or, not ghetto enough? ;-) |
| 17:40 | AWizzArd | technomancy: could this get-the-version-externally-hook be made in such a way that it will run very early, before any other task has the chance to see the version number? So that Marginalia for example would also see the updated thing? |
| 17:40 | cemerick | AWizzArd: you mean you're looking to update version numbers in-place as well? Yeah, that'll be supported as well. |
| 17:41 | technomancy | cemerick: doesn't seem to solve the -Xmx problem |
| 17:41 | cemerick | technomancy: how so? |
| 17:41 | technomancy | AWizzArd: sure, as long as you hook read-project |
| 17:41 | cemerick | AWizzArd: I get a headache every time I need to tweak project.clj **and** README.asciidoc. :-) |
| 17:42 | technomancy | cemerick: if you just distribute an uberjar for it to run, you still need a mechanism for getting other config values deployed |
| 17:42 | AWizzArd | cemerick: so that plugin or hook or optional behaviour of Leiningen 2 could *maybe* also update some files. |
| 17:43 | cemerick | AWizzArd: absolutely. |
| 17:43 | hiredman | technomancy: well, that depends, like for us everything else is mostly done by chef |
| 17:43 | hiredman | with default configs in the jar |
| 17:43 | cemerick | technomancy: That's what pallet is for. |
| 17:43 | cemerick | Right, or chef, etc. |
| 17:44 | cemerick | Though really, I've been deploying everything as webapps lately, even if they could be "headless". Ends up being easier all around. |
| 17:45 | technomancy | yeah, I guess you wouldn't really need a tarball for that |
| 17:45 | cemerick | i.e. do you *really* need all that extra config goop? Often, not really — just get good defaults in there, and homogenize the hosts underneath. |
| 17:46 | hiredman | well, it's kind of a tension between static configs written by whatever, and dynamic discovery |
| 17:46 | cemerick | like, if you had a good deployment platform that could set up services for you and stuff… ;-) |
| 17:46 | hiredman | I prefer the later, but we do more of the former |
| 17:46 | bweaver | What's the preferred way to indicate success or failure to the called of a `send`? |
| 17:47 | bweaver | Sorry s/called/caller/ |
| 17:49 | bweaver | Like if I had an agent with a map in it and I did something like `(send the-agent replace key val)` where `put` is supposed to fail if `key` doesn't already exist in the map. |
| 17:49 | bweaver | And the caller of the `send` is interested in knowing if a failure occured or not. |
| 17:50 | bweaver | Erg s/`put`/`replace`/ |
| 17:50 | technomancy | bweaver: if the caller needs to know about failures, perhaps an asynchronous mechanism isn't suited? |
| 17:51 | cemerick | bweaver: What technomancy said; beyond that, you can use agent-error to get the error caught by a failed agent. Also, see the docs for `agent` for the various error-handling options that exist. |
| 17:53 | _Vi | In Clojure 1.3.0-alhpa4 I get "SftpException 4: Failure" in (catch ...). In Clojure 1.3.0 I get RuntimeException with SftpException inside... |
| 17:54 | bweaver | cemerick: Thanks, :error-handler might do the trick. |
| 17:54 | technomancy | _Vi: I got bit by that very issue yesterday. annoying. |
| 17:54 | technomancy | I believe the justification is something like mumble mumble checked exceptions? |
| 17:54 | _Vi | technomancy, Who is wrapping this in RuntimeException? Clojue or Jsch? |
| 17:55 | technomancy | clojure is |
| 17:55 | _Vi | How to catch specific exceptions then? |
| 17:55 | hiredman | it's a bug in clojure in 1.3 and 1.4-SNAPSHOT |
| 17:55 | hiredman | the reflector boxes exceptions |
| 17:56 | AWizzArd | Btw, what are the main goals for Clojure 1.4? |
| 17:56 | _Vi | hiredman, So, stick with alhpa4 or workaround in the code (how?)? |
| 17:57 | _Vi | Or catching specific exceptions Considered Bad in Clojure? |
| 17:57 | cemerick | AWizzArd: Possible directions: http://dev.clojure.org/display/design/Release.Next+Planning |
| 17:57 | AWizzArd | thx |
| 17:57 | technomancy | _Vi: no, it's just creating new exception classes that's discouraged |
| 17:57 | hiredman | http://dev.clojure.org/jira/browse/CLJ-855 |
| 17:58 | hiredman | _Vi: there is no work around |
| 17:58 | _Vi | hiredman, So should I stick with 1.3.0-alhpa4 until this is fixed? |
| 17:58 | hiredman | I dunno |
| 17:59 | hiredman | I have been fiddling with my own patch for this too |
| 18:08 | solussd | amalloy: is data.xml usable? Says it isn't 'released' yet. ;) |
| 18:08 | amalloy | solussd: <amalloy> data.xml does a pretty good job but is lacking (a) some feature you might want, and (b) an officially-blessed release |
| 18:10 | solussd | thanks |
| 18:10 | technomancy | is there a built-in function to do this? (when-let [matches (re-find re s)] (matches n)) |
| 18:12 | amalloy | technomancy: you're just...looking for the Nth matching group? |
| 18:13 | technomancy | yeah |
| 18:13 | amalloy | &(get (re-find #"(foo)bar" "zfoobarbaz") 1) |
| 18:13 | lazybot | ⇒ "foo" |
| 18:13 | amalloy | &(get (re-find #"(foo)bar" "zfrbaz") 1) |
| 18:13 | lazybot | ⇒ nil |
| 18:14 | technomancy | oh, of course. I always forget get. |
| 18:14 | technomancy | thanks |
| 18:15 | amalloy | you're quite welcome |
| 18:19 | AWizzArd | OT but interesting: http://www.nlp-class.org/ |
| 18:23 | wingie | anyone here is using clojurescript? |
| 18:23 | wingie | for frontend apps? |
| 18:23 | wingie | wanna know it's maturity |
| 18:24 | technomancy | its maturity is ... low |
| 18:30 | jordandanford | I'm trying to learn Clojure by rewriting a simple Python project, but I'm having some trouble – any help? |
| 18:30 | jordandanford | http://stackoverflow.com/questions/8720073/idiomatic-clojure-equivalent-of-this-python-code |
| 18:32 | alexbaranosky | jordandanford, sure |
| 18:35 | Narvius | Hello. |
| 18:36 | Narvius | I have a question; I have a map containing a map, among others, and I want to (assoc) something in the in the inner map. |
| 18:36 | technomancy | ,(doc assoc-in) |
| 18:36 | clojurebot | "([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created." |
| 18:36 | Narvius | Now, (assoc) of course returns a new map instead of modifying the old one. So, is there a non-mess... |
| 18:36 | Narvius | Oh. Thanks. |
| 18:36 | technomancy | heh; np =) |
| 18:36 | Narvius | :D |
| 18:37 | technomancy | clojure: it's thought of everything! |
| 18:37 | technomancy | except... well, let's not get into that right now |
| 18:37 | Narvius | xD |
| 18:37 | Narvius | I'd be interested to hear that, though. |
| 18:38 | jordandanford | alexbaranosky: Thoughts? |
| 18:39 | alexbaranosky | jordandanford, sorry, I got distracted, let me look |
| 18:39 | technomancy | Narvius: non-transitive AOT compilation, a command-line interface, flexible thread pools, and increased debuggability, for starters. |
| 18:43 | technomancy | so... I'm making a change to a library. I want a tool that will use clojuresphere's data and allow me to run all the tests of the dependent libraries against my changes. |
| 18:43 | technomancy | yes? |
| 18:43 | clojurebot | yes is is_rhickey_is_a_minor_god? |
| 18:43 | wingie | im reading programming clojure it says there is a function called "show" but it cannot find it |
| 18:43 | wingie | to show memebers of objects |
| 18:43 | technomancy | wingie: (use 'clojure.repl) I think |
| 18:44 | wingie | java.lang.Exception: Unable to resolve var: show in this context (NO_SOURCE_FILE:17) |
| 18:45 | alexbaranosky | jordandanford, what question do you have about the code? |
| 18:45 | technomancy | wingie: are you using slime? |
| 18:45 | jordandanford | alexbaranosky: I'm asking how to idiomatically translate it into Clojure |
| 18:45 | technomancy | bugger; clojuresphere doesn't seem to have an API |
| 18:45 | wingie | technomancy: no .. im using lein |
| 18:46 | technomancy | hm; someone who doesn't use slime would know what happened to show |
| 18:46 | wingie | technomancy: what is slime? |
| 18:46 | technomancy | it's this crazy emacs thing |
| 18:47 | technomancy | http://www.x-entertainment.com/articles/0946/ani1.gif |
| 18:47 | technomancy | or rather, https://github.com/technomancy/swank-clojure |
| 18:48 | wingie | :) |
| 18:54 | wingie | who is rich hickey in here? |
| 18:54 | mrb_bk | who _isn't_ ? |
| 18:55 | wingie | what do you mean by that |
| 18:55 | amalloy | rhickey doesn't come in here often |
| 18:57 | amalloy | jordandanford: you might find https://github.com/amalloy/clusp interesting, wherein i implement a vm for an intentionally-obtuse language, snusp |
| 18:58 | jordandanford | amalloy: Thanks, I'll check it out |
| 19:01 | amalloy | wingie: which version of clojure? show only exists in clojure.contrib.repl-utils, which is not 1.3-compatible |
| 19:01 | amalloy | clojurebot: show is <reply>Show only exists in clojure.contrib.repl-utils, which is not 1.3-compatible. For a 1.3 replacement, consider clojure.reflect/reflect. |
| 19:01 | clojurebot | In Ordnung |
| 19:03 | wingie | amalloy: im using "lein repl", how do i check which clojure version it uses? |
| 19:03 | amalloy | ,*clojure-version* |
| 19:03 | clojurebot | {:major 1, :minor 3, :incremental 0, :qualifier nil} |
| 19:04 | wingie | 1.2.1 |
| 19:05 | wingie | hmm, anyone knows how i can use 1.3.0 in lein repl? |
| 19:06 | wingie | since "clj" is using 1.3.0.. but "lein repl" is using 1.2.1 |
| 19:06 | technomancy | clojurebot: clj? |
| 19:06 | clojurebot | Pardon? |
| 19:06 | technomancy | amalloy: you want to take this one? |
| 19:07 | amalloy | haha clojurebot already have enough of my vitriol. you can tell him why clj is evil |
| 19:08 | technomancy | oh, I thought you already had a factoid in there |
| 19:09 | technomancy | wingie: clj is just some script whipped up by whoever happened to package clojure for your package manager; there's no official supported shell script for clojure |
| 19:09 | adiabatic | If I can do (first (sorted-set 1 2 3)) and (rest (sorted-set 1 2 3)), why can't I use destructuring assignment to break a sorted-set into a head and the rest of it? |
| 19:10 | technomancy | wingie: if you create a new project and set the clojure version to 1.3.0 inside project.clj, you can get lein repl to use that version of clojure |
| 19:13 | cgray | adiabatic: I guess the short answer is that sorted-set doesn't support nth |
| 19:13 | adiabatic | cgray: yeah, that's the UnsupportedOperationException that's been flying in my face |
| 19:14 | adiabatic | s/flying in/hugging/ |
| 19:15 | amalloy | technomancy: last time i looked at clj it wasn't actually even something from a package manager. it's actually this thing you have to go to a ton of work to get going |
| 19:15 | amalloy | and what you get out is way less useful than just "download lein and hit Go" |
| 19:16 | cgray | adiabatic: :) destructuring uses nth behind the scenes (because if you did (let [[first second third] (sorted-set 1 2 3)]) it'd want to get the first, second, and third quickly) |
| 19:16 | cgray | s/quickly/somehow/ |
| 19:16 | adiabatic | amalloy: wasn't that bad, here. wget to ~/bin, chmod u+x, download clojure-foo-bar-baz.jar to ~/Library/Classpath (a new directory), and edit .bashrc to also have `export CLOJURE_EXT="$HOME/Library/Classpath"` |
| 19:17 | amalloy | adiabatic: compare to lein: "wget to ~/bin" |
| 19:17 | amalloy | and iirc clj also recommended setting up clojure-contrib, which was a bad idea then and a dreadful mistake now |
| 19:18 | wingie | technomancy: it worked .. thanks |
| 19:19 | adiabatic | Sure, but then you have to learn how lein works. "run `clj foo.clj` repeatedly" is a newbie workflow that's fairly popular for lots of other languages, compiled, interpreted, interpiled, and otherwise |
| 19:20 | adiabatic | At some level of complexity lein will be the least silly option, but I don't think I'm there yet. |
| 19:20 | adiabatic | program complexity* |
| 19:20 | technomancy | wingie: you can also do "lein plugin install lein-repl13 1.0.0; lein repl13" |
| 19:21 | technomancy | as of about thirty seconds ago |
| 19:21 | amalloy | pft |
| 19:22 | amalloy | technomancy: i need lein-repl13-with-data.xml-and-incanter plz |
| 19:23 | technomancy | amalloy: pull requests welcome |
| 19:23 | technomancy | I don't even know if I should push this to github, it's just so silly |
| 19:24 | technomancy | it's ten lines, it's on clojars; problem solved. |
| 19:35 | wingie | is this a feature good to have: (third "hello world") |
| 19:35 | wingie | since after third we have fourth, fifth, sixth and all others with "nth" |
| 19:36 | wingie | but third is spelled with rd .. doesn't seem to be that nice using (nth "hello world", 3) |
| 19:36 | wingie | you are following me? |
| 19:39 | jodaro | https://gist.github.com/8c3da82eb9183baae5b1 |
| 19:39 | jodaro | having some trouble with gloss |
| 19:39 | jodaro | if those that know it can take a look |
| 19:42 | adiabatic | wingie: eh, not really |
| 19:43 | wingie | haha ok |
| 19:44 | adiabatic | "second" seems OK because it's like peeking one past the first |
| 19:44 | adiabatic | but third seems like overkill |
| 19:44 | wingie | it fits better with the english |
| 19:45 | wingie | =) |
| 19:45 | wingie | is there a second last? |
| 19:46 | wingie | if no, then second seems not that good to me |
| 19:46 | cgray | ,(doc butlast) |
| 19:46 | clojurebot | "([coll]); Return a seq of all but the last item in coll, in linear time" |
| 19:47 | wingie | no i mean the second last item |
| 19:47 | adiabatic | evidently there's no "penultimate" |
| 19:47 | wingie | (1 2 3 4) .. the value 3 in this case |
| 19:48 | technomancy | ,((comp last butlast) [1 2 3 4]) |
| 19:48 | clojurebot | 3 |
| 19:51 | wingie | that was cool one |
| 19:52 | amalloy | not very efficient at all, though. if you really want to do that, you should make the thing a vector first |
| 19:52 | amalloy | (or, ideally, it would already be a vector) |
| 19:52 | amalloy | &((comp peek pop) [1 2 3 4]) |
| 19:52 | lazybot | ⇒ 3 |
| 19:54 | technomancy | well hello mister fancy pants. |
| 19:54 | technomancy | http://www.youtube.com/watch?v=bj563ViG7Qg |
| 19:54 | technomancy | (youtube needs a way to link to just a certain slice of a video) |
| 19:55 | wingie | that would be a cool feature |
| 19:55 | amalloy | technomancy: you can link to an offset |
| 19:55 | adiabatic | they have a way to do that with …yeah |
| 19:55 | technomancy | oh? |
| 19:55 | technomancy | I thought that died with google video |
| 19:56 | technomancy | wouldn't work here because I want to specify the end range, but whatever |
| 19:56 | amalloy | right |
| 19:56 | technomancy | should have just used this one instead http://www.youtube.com/watch?v=FPxY8lpYAUM |
| 19:56 | technomancy | since it's 100% relevant! |
| 19:57 | amalloy | technomancy: add a fragment identifier: youtube/whatever?foo=bar#0m20s |
| 19:57 | technomancy | cool beans |
| 19:57 | amalloy | haha i didn't know there was a zelda cartoon |
| 19:59 | technomancy | it's pretty great! |
| 19:59 | technomancy | well, that particular catchphrase is |
| 20:00 | technomancy | the cartoon as a whole is probably awful |
| 20:00 | technomancy | also relevant: http://qwantz.livejournal.com/112122.html |
| 20:11 | wingie | should i use java 6 or 7 for clojure? |
| 20:15 | technomancy | wingie: shouldn't make a difference |
| 20:16 | hiredman | that is not true |
| 20:16 | hiredman | the main revolutionary change people have been harming on in java 7 (invokedynamic) is not used by clojure |
| 20:16 | hiredman | but there are other changes as well |
| 20:17 | amalloy | right, like java7 adds a bunch of filesystem stuff that's supposed to be cool but in practice people seem to have trouble using |
| 20:18 | wingie | should i be concerned about jdk or just jvm when using clojure? |
| 20:18 | hiredman | http://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html |
| 20:18 | wingie | im new to java world |
| 20:18 | AWizzArd | Also Java 7 Update 2 ships (under Windows) with JavaFX. |
| 20:18 | technomancy | oh that's right; you can chmod and stuff now |
| 20:19 | technomancy | wingie: debuggers need a jdk; depends on if you care about that |
| 20:30 | wingie | does java 7 refer to jvm 7 or javase 7? |
| 20:31 | hiredman | the jvm comes either has part of the java runtime environment (jre) or java developement kit (jdk) |
| 20:32 | hiredman | java 7 is the brand name for the 1.7 version of the jre or the jdk |
| 20:33 | adiabatic | Mildly offtopic: I'm using Aquamacs (emacs 24) and when I M-x eval-buffer my init.el, I get "Symbol's value as variable is void: package-archives". Should I not bother to add Marmalade plumbing to my init.el? |
| 20:34 | hiredman | use a real emacs |
| 20:34 | hiredman | as #emacs will tell you, aquamacs doesn't count |
| 20:35 | adiabatic | emacs 22 real enough, or just real old? |
| 20:35 | hiredman | too old |
| 20:35 | hiredman | http://emacsformacosx.com/ |
| 20:35 | hiredman | you can get the nightlies of 24 from there too |
| 20:36 | adiabatic | Should I get a nighly of 24? I know C-x C-s and C-x C-c, and that's about it. |
| 20:36 | technomancy | aquamacs is not very well-supported |
| 20:36 | technomancy | the 24 nightlies are rock-solid in my experience |
| 20:37 | hiredman | yeah, they work fine |
| 20:37 | jodaro | emacs for mac os x at that link works great |
| 20:37 | jodaro | i'm using it as we type |
| 20:38 | adiabatic | cute, the whole front page is an SVG element pretty much |
| 20:43 | technomancy | what would a good default be for a regex to omit from stack trace printing? |
| 20:44 | amalloy | ^$ |
| 20:44 | adiabatic | "Symbol's value as variable is void: package-archives" |
| 20:44 | technomancy | amalloy: from swank, so it's at least #"swank" |
| 20:45 | amalloy | yeah, that's fair. i'm sure there's a ton of stuff in stacktraces that really just makes them hard to use, but ik'm a grumpy old man |
| 20:45 | technomancy | the question is whether clojure.lang.Compiler and clojure.lang.Var are likely to ever be useful to anyone not savvy enough to switch off :to-omit |
| 20:46 | hiredman | :/ |
| 20:46 | hiredman | I just hate to optimize for the case of people who don't know what they are doing anyway |
| 20:46 | hiredman | why can't we optimize for experts? |
| 20:46 | technomancy | because experts know how to read documentation and turn off :to-omit |
| 20:47 | amalloy | technomancy: anyone who's not in this room right now won't know to look for such an option |
| 20:47 | amalloy | is my objection |
| 20:47 | hiredman | technomancy: but why should I have to do that vs. making non-experts read the docs and turn it off? |
| 20:48 | hiredman | like, I've invested more time and energy into reading stack traces that non-experts, so why not make my life easier than theirs? |
| 20:48 | adiabatic | Nonexperts are likely to be overwhelmed anyway. |
| 20:48 | technomancy | hiredman: you can fit a trimmed trace into a quarter of your screen. |
| 20:48 | hiredman | they can go cry to mommy |
| 20:48 | hiredman | technomancy: so? if the information I want is trimmed out what good is that? |
| 20:48 | technomancy | it's not |
| 20:49 | hiredman | how is a regex supposed to know? |
| 20:50 | technomancy | if you can come up with a scenario where the fact that clojure.lang.Compiler.eval was invoked is helpful to someone who isn't writing their own compiler, maybe there'd be a case |
| 20:51 | technomancy | I am unable to come up with one |
| 20:51 | technomancy | and I value my screen space |
| 20:56 | wingie | is there some commercial support behind clojure? |
| 20:56 | wingie | or is it by contributors only? |
| 20:59 | technomancy | there's http://clojure.com |
| 21:02 | technomancy | http://www.blindfiveyearold.com/wp-content/uploads/2011/08/kirk-and-spock-needs-quote.png |
| 21:02 | lazybot | java.lang.RuntimeException: EOF while reading |
| 21:07 | TimMc | technomancy: Maybe it could look for ~/.im-a-clojure-badass and not ilter the stacktraces if the file is present. |
| 21:16 | amalloy | ~/.lein/stop-babying-me-dammit |
| 21:16 | clojurebot | No entiendo |
| 21:16 | jodaro | bleh gloss |
| 21:16 | jodaro | y u no have sufficient bytes to decode frame |
| 21:20 | TimMc | jodaro: The previous gist is still relevant? |
| 21:20 | jodaro | looking |
| 21:20 | jodaro | https://gist.github.com/8c3da82eb9183baae5b1 |
| 21:20 | jodaro | yeah |
| 21:21 | TimMc | jodaro: What should I put in my project.clj to get the gloss you have? |
| 21:21 | jodaro | i'm actually pullingin aleph |
| 21:21 | jodaro | let me look |
| 21:22 | jodaro | i think 0.2.0 is the version |
| 21:22 | jodaro | [gloss "0.2.0"] |
| 21:22 | TimMc | aleph 0.2.0? |
| 21:22 | jodaro | or yeah |
| 21:22 | jodaro | i have aleph in there |
| 21:24 | jodaro | the fact that something i pulled from the wiki not working makes me think i've done something horribly wrong somewhere |
| 21:24 | TimMc | jodaro: So, :d in that first example is "a string of length >= 0" |
| 21:25 | jodaro | yeah |
| 21:25 | jodaro | basically, the protocol i'm trying to model looks like |
| 21:25 | TimMc | How do I get a quick hex dump of that bytebuffer? |
| 21:26 | jodaro | yeah, i'm still trying to figure that out as well |
| 21:26 | jodaro | its a java.nio.HeapByteBuffer |
| 21:26 | TimMc | I'll take a look. |
| 21:26 | jodaro | which apparently lets you call .asCharBuffer |
| 21:26 | jodaro | but then i just get chinese in the repl |
| 21:26 | TimMc | haha |
| 21:27 | jodaro | (and i don't know chinese, nor do i expect it) |
| 21:29 | jodaro | oh, right, i was describing the protocol |
| 21:29 | jodaro | its like "\0FOO int32 int32 string" |
| 21:29 | jodaro | where string might be empty |
| 21:29 | jodaro | or it might be one or more strings delimited by \0 |
| 21:29 | TimMc | Is gloss 1.3-compatible? |
| 21:30 | tmciver | you could use hexdump to view the data on the repl ... if only it accepted HeapByteBuffer |
| 21:30 | jodaro | but i haven't even gotten to handling that last part |
| 21:30 | jodaro | TimMc: there is a clj-1.3 branch |
| 21:30 | tmciver | but you could just pass in a seq of the byte array returned byt the array() method. |
| 21:33 | TimMc | (mapcat #(.array %) g) => (98 97 114 102 102 111 111 100 0 0 0 4 0 0 0 2) |
| 21:34 | TimMc | good enough |
| 21:34 | jodaro | ahh |
| 21:34 | TimMc | g is a seq of byte buffers |
| 21:35 | TimMc | Oh, and gloss' decode is definitely not 1.3 compatible. |
| 21:35 | TimMc | some var not marked dynamic |
| 21:35 | jodaro | i think 0.2.1-SNAPSHOT is the latest on clojars |
| 21:36 | TimMc | jodaro: It's out of order! You're using a map. |
| 21:36 | jodaro | oh hmmm |
| 21:36 | jodaro | yeah that won't work |
| 21:36 | jodaro | i guess if its a sequence it will stay in order |
| 21:36 | TimMc | It's in :d :m :s :t order |
| 21:39 | jodaro | thats a bummber |
| 21:39 | jodaro | -b |
| 21:40 | jodaro | switched my implementation to use a vector and i think it works |
| 21:40 | jodaro | but |
| 21:40 | jodaro | that still doesn't explain the animal decode one |
| 21:40 | jodaro | unless the map isn't always in the same order or something |
| 21:40 | clj_newb | in a zipper, are nodes allowed to have variadic # of children; or are all nodes required to have a constant # of children? |
| 21:45 | jodaro | TimMc: thanks for pointing that out |
| 21:49 | TimMc | jodaro: Yeah, I don't get it either. |
| 21:50 | TimMc | Unless the {} form is supposed to be like a struct... which it isn't. |
| 21:50 | jodaro | yeah [] is working as expected |
| 21:50 | jodaro | though i'm still not sure about something, but it should be clear in a sec when i shove some packets at the server |
| 21:53 | tmciver | jodaro: how about gloss.core/ordered-map? |
| 21:54 | jodaro | looking |
| 21:54 | tmciver | jodaro: this is a shameless plug but you might want to try out my hexdump util on clojars. You could be the first one to try it out! :) |
| 21:55 | TimMc | Yeah, stick that in dev-dependencies. |
| 21:55 | TimMc | tmciver: You have pushed a release to clojars, right? Right? |
| 21:55 | tmciver | but you have to create a seq of the HeapByteBuffer a la TimMc's example. |
| 21:55 | tmciver | yup |
| 21:56 | TimMc | excellent |
| 21:56 | tmciver | I used it on jodaro's gist and it showed that "barf" was the only data in the buffer. |
| 21:57 | TimMc | tmciver: ^ about 40 lines back -- all the data was there |
| 21:57 | tmciver | :o |
| 21:58 | amalloy | augh *seriously*, java doesn't have a builtin for comparing arrays to each other except for equality? |
| 21:58 | TimMc | amalloy: What, like substring and common prefix? |
| 21:58 | tmciver | TimMc: Ahh, g is a collection of HeapByteBuffers. |
| 21:59 | TimMc | tmciver: hence the mapcat |
| 21:59 | amalloy | TimMc: at the moment i want strcmp, but on a byte[] |
| 21:59 | tmciver | TimMc: got it. |
| 21:59 | tmciver | TimMc: nice use of mapcat, forgot about it. |
| 21:59 | amalloy | i can call seq on them and sort the Comparable seqs that come out but that's so wasteful |
| 22:01 | semperos | trying to try out clj-stacktrace, followed instructions on README |
| 22:01 | semperos | if I use the code for ~/.lein/init.clj provided, I get a "Var user/settings is unbound" error |
| 22:02 | semperos | if I edit that snippet and run everything outside the (try) form, then I get: java.io.FileNotFoundException: Could not locate leiningen/hooks/clj_stacktrace_test__init.class |
| 22:02 | semperos | anyone have any pointers? |
| 22:02 | TimMc | 0xDEADBEEF |
| 22:02 | semperos | :) |
| 22:04 | clj_newb | I've recently written my own macro (def-typed-record [& args]) so that it's used like (def-typed-record [ a? a, b? b, c? c, d? d, e? e]) which does an (assert (and (a? a) (b? b) (c? c) (d? d) (e? e))) followed by a regular defrecord. Is there an idiomatic/existing way to do this in clojure? [or my hand rolled solution the best I can use] |
| 22:05 | clj_newb | the idea is that constructors run a predicate on their arguments (or assert), so that type errors are caught earlier |
| 22:05 | TimMc | semperos: You've done the install, yeah? So it should be there... |
| 22:05 | semperos | yep, it's there in ~/.lein/plugins |
| 22:38 | TimMc | technomancy: I think the uberjit thing actually needs to be a hook, not a plugin. |
| 22:39 | TimMc | technomancy: nvm, I see that a plugin may *contain* hooks. |
| 23:44 | clj_newb | amalloy: congrats on the 100K solved problems at 4clojure.com! (saw it on front page of news.yc) |
| 23:45 | amalloy | thanks! traffic for today is through the roof (comparatively, anyway) as a result of the two mentions on news.yc |
| 23:46 | clj_newb | amalloy: btw where do you currently work / set of skills? it seems like "I built 4clojure.com" is worth more than most 2-3 page resumees; seems like you could trivially get into google / yc |
| 23:47 | amalloy | well, that would be an embellishment. i didn't start the project, and i'm not the only one working on it now |
| 23:47 | amalloy | but i'm working at geni.com with the folks in http://github.com/flatland |
| 23:48 | clj_newb | with that level of honesty; you're clearly not going to start the next facebook |
| 23:49 | amalloy | i promise to keep your personal details safe (for certain definitions of "promise", "personal", and "safe") |
| 23:49 | clj_newb | hmm; kind of cool how geni also solves the fake profile / dientity problem |
| 23:49 | clj_newb | much harder to fake an entire geneology tree |
| 23:52 | clj_newb | if this doesn't violate your NDA -- whdy do you guys use postgresql? do you actually need transactions for anthing? |
| 23:53 | amalloy | probably, but i dunno. not my problem |
| 23:54 | clj_newb | her'es a crazy idea |
| 23:54 | clj_newb | is ther ea db binding in clojure |
| 23:54 | clj_newb | where clojure transactions (via STM) are mapped onto db transactions? |