2011-04-28
| 00:18 | mec | I used a macro within a deftype and now (use :reload 'ns-with-deftype) is throwing Linkage Error: attempted duplicate class definition |
| 00:25 | mec | ah, apparently you cant use types before they're defined ;p |
| 00:26 | tomoj | linkage error? never seen that before |
| 00:27 | mec | I was referring to a type in a macro before i defined it, I guess it created it for some reason |
| 01:21 | technomancy | slamhound just got smarter; works on 92% of our work project's namespaces. |
| 01:22 | chrissbx | How do I create a recursive local definition? Like letrec in Scheme. |
| 01:23 | amalloy | chrissbx: letfn is letrec |
| 01:24 | chrissbx | thanks |
| 01:24 | amalloy | if you don't need mutual recursion, just name your anonymous function: ##((fn ! [n] (if (zero? n) 1 (* n (! (dec n))))) 5) |
| 01:24 | sexpbot | ⟹ 120 |
| 01:26 | chrissbx | aha |
| 01:32 | Vinzent | why enlive is moving into clojure? it's great lib, but I can't see any reason to include it in clojure itself |
| 01:33 | amalloy | citation needed? |
| 01:33 | amalloy | i mean, if you say it it's probably true, but i don't know how i could judge why it's the case without even a link to the evidence that it's happening |
| 01:34 | Vinzent | https://github.com/clojure/data.enlive |
| 01:35 | Vinzent | it's even have its own name! (why not data.templating then) |
| 01:35 | amalloy | i think that indicates that it's moving into the new version of contrib |
| 01:36 | amalloy | eg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging |
| 01:36 | clojurebot | You don't have to tell me twice. |
| 01:36 | Vinzent | yeah, that's what i mean |
| 01:36 | amalloy | contrib is *not* synonymous with clojure. to move into core is very different from moving into contrib |
| 01:37 | amalloy | especially now that it's being split up |
| 01:38 | Vinzent | but contrib (as i see it, maybe i'm wring) is the place for general things, like logging, data structures, etc, and enlive is specialized lib |
| 01:39 | Vinzent | i mean, why not include hiccup, ring and compojure then? |
| 01:40 | amalloy | *shrug* that's pretty subjective. contrib has some kind of server-socket library |
| 01:41 | dnolen | Vinzent: enlive is useful for many kinds of data transformation, also hiccup, ring, compojure, issues of who submitted patches to those projects. |
| 01:43 | seancorfield__ | http://dev.clojure.org/display/design/Contrib+Library+Names |
| 01:44 | seancorfield__ | i am a bit surprised that the enlive name was carried over |
| 01:45 | markoman | what is the difference between hiccup and enlive? |
| 01:45 | dnolen | seancorfield: ah nice, ring *is* getting folded in. |
| 01:45 | amalloy | i'm glad to hear ring is getting in. it's very nice |
| 01:45 | seancorfield__ | the current list of active repos can be seen here https://github.com/clojure |
| 01:45 | chrissbx | Is there a "println" that doesn't add a space between each argument? |
| 01:45 | markoman | im using hiccup on my project, would it be easy to change it to enlive? |
| 01:46 | amalloy | &(prn 1 2) |
| 01:46 | sexpbot | ⟹ 1 2 nil |
| 01:46 | amalloy | &(print 1 2) |
| 01:46 | sexpbot | ⟹ 1 2nil |
| 01:46 | seancorfield__ | ,(println (str "list" "of" "strings")) |
| 01:46 | amalloy | hrm |
| 01:46 | clojurebot | listofstrings |
| 01:46 | chrissbx | yeah, str. |
| 01:46 | amalloy | i mean, for sure you can use str |
| 01:46 | Vinzent | dnolen, ok, i've just been interested in selection criteria for contrib |
| 01:47 | chrissbx | yep, true; thanks for ppointing it out |
| 01:47 | seancorfield__ | i haven't used ring... probably will get to it at some point... especially now it'll be org.clojure/net.ring :) |
| 01:48 | seancorfield__ | Vinzent: a lot of it depends on having someone willing to actively maintain the "new contrib" library - someone with a signed CA on record |
| 01:48 | ambrosebs | hi |
| 01:48 | seancorfield__ | i pushed for c.c.sql to be promoted because i rely heavily on it at work |
| 01:50 | ambrosebs | I'm trying to bind dynamic variables with deftest |
| 01:50 | ambrosebs | (def a 2) |
| 01:50 | ambrosebs | (binding [a 1] |
| 01:50 | ambrosebs | (deftest we |
| 01:50 | ambrosebs | (println a))) |
| 01:50 | ambrosebs | this prints 2 |
| 01:50 | ambrosebs | how do i print 1? |
| 01:50 | amalloy | they're called dynamic because they're not lexical |
| 01:51 | amalloy | if you wanted lexical bindings, you could just use (let...) |
| 01:54 | Vinzent | markoman, enlive follows different (from hiccup and similar templating engines) philosophy, so i think it can require some effort to move from hiccup |
| 01:56 | ambrosebs | the context: I have a macro `with-stevedore-impl` that sets up some bindings, and I want to place deftests inside it |
| 01:57 | markoman | well need to see library itself |
| 01:57 | ambrosebs | it doesn't look like it's possible.. but i don't quite understand why |
| 01:58 | chrissbx | Is there a way to trace all function calls (print function name and arguments, and maybe return value) in some scope? |
| 01:58 | Vinzent | ambrosebs, i think this binds a only at def time, but you need bindings when fn will be called, so place it inside deftest |
| 01:58 | Vinzent | ambrosebs, or around the call of the test |
| 01:59 | ambrosebs | Vinzent: looks like that's the way to go, thanks! |
| 01:59 | markoman | then i have a question. if I store string to datastore and I'd like to evaluate it on clojure, how it is done and what security issues I should handle? |
| 01:59 | markoman | for example: (:k (eval "{:k 1}")) |
| 02:00 | markoman | where "{:k 1}" i stored as a string to data store |
| 02:04 | Vinzent | chrissbx, there are clojure.contrib.trace, that might help |
| 02:05 | Vinzent | markoman, you can use read, but i believe there should be the other way to store collections in your db |
| 02:06 | markoman | the problem is, that "collection" can be things like: "1", "1,2", "{:k 1}", "[1,2,3]", "any string",... |
| 02:07 | markoman | "1,2" not good example |
| 02:08 | Vinzent | &(read-string "1") |
| 02:08 | sexpbot | ⟹ 1 |
| 02:08 | Vinzent | &(read-string "{:a 1}") |
| 02:08 | sexpbot | ⟹ {:a 1} |
| 02:09 | markoman | i may a problem with types then... |
| 02:09 | markoman | &(= (type 1) (read-string "1")) |
| 02:09 | sexpbot | ⟹ false |
| 02:09 | markoman | &(= (type 1) (type (read-string "1"))) |
| 02:09 | sexpbot | ⟹ true |
| 02:09 | markoman | well, maybe not |
| 02:12 | markoman | but this isnt working: (read-string "(println 2)") ? |
| 02:12 | hiredman | markoman: are you kidding? |
| 02:13 | markoman | evaluating any string as a clojure code? |
| 02:13 | Vinzent | markoman, it's only reads a string and returns clojure datastructure, so you are getting plain list; you can eval it then, if you want |
| 02:14 | markoman | ok, that can help with security issues. if they are only datastructures, then there are less possible problems |
| 02:20 | Vinzent | btw, is there a form strongly associated with clojure? like, schemers have call-cc and common lispers have defmacro or (loop (print (eval (read)))). What's about clojure? |
| 02:21 | Vinzent | What a cool name can i pick for my blog? What must be written on my new t-shirt? |
| 02:22 | ambrosebs | xD |
| 02:22 | ambrosebs | sounds like an awesome idea |
| 02:23 | amalloy | (-> (read) (eval) (print) (loop)) is less inside out but not actually legal clojure |
| 02:23 | ambrosebs | was just thinking that |
| 02:23 | ambrosebs | darn |
| 02:27 | Vinzent | amalloy, well, repl is an all-lisp thing (so primarily associated with CL), there should be something more clojurish... something about functions, concurrency, what else? |
| 02:27 | thorwil | Vinzent: lazy blog name must be forced |
| 02:27 | markoman | my eye catches defn, :clojure-keyword and ns clojure.name.space from my codes, but they are not that unique |
| 02:28 | ambrosebs | what about dosync? |
| 02:28 | Vinzent | thorwil, yes, and laziness :) |
| 02:31 | markoman | "Don't know how to create ISeq" is strongly associated with my coding too ;) |
| 02:32 | amalloy | haha |
| 03:18 | thorwil | Enlive has no function that will simply return the content of a file, no selection, no wrapping!? |
| 03:22 | thorwil | question then is how to read files from the resources dir myself |
| 03:23 | ambrosebs | something like slurp? |
| 03:23 | ambrosebs | ,(doc slurp) |
| 03:24 | clojurebot | "([f & opts]); Reads the file named by f using the encoding enc into a string and returns it." |
| 03:25 | thorwil | ambrosebs: yeah, problem is slurp doesn't handle the relative path |
| 03:25 | ambrosebs | ah |
| 03:26 | ambrosebs | seems to work for me |
| 03:27 | thorwil | actually, i'm wrong by one level. the enlive forms will happily work with a "templates/foo.html", but with slurp it must be "resources/templates/foo.html" |
| 03:27 | ambrosebs | ah |
| 03:27 | ambrosebs | ,(. System getProperty "user.dir") |
| 03:27 | clojurebot | java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read) |
| 03:27 | ambrosebs | that should give pwd |
| 03:30 | ataggart | if you're not doing anything with the file contents, why are you slurping it into a string? |
| 03:30 | ataggart | you might find stuff in clojure.java.io more useful |
| 03:32 | thorwil | ataggart: i need the content as argument for an enlive snippet. initially i thought html-resource would be for that case, but it wraps <html> and <body> around the content |
| 03:33 | ataggart | I only went though dnolen's enlive tutorial, but I thought the point of the defsnippet stuff was to have enlive pull the content out of files |
| 03:33 | thorwil | i can't find any mention of "resources" as part of the path, or any use of System in the Enlive source, so i still wonder how it knows to just look inside resources |
| 03:34 | ataggart | clojure.java.io/resource ? |
| 03:35 | ataggart | have you looked at the tutorial? I think the some of the helper files in there had custom paths for the file locations |
| 03:35 | ataggart | https://github.com/swannodette/enlive-tutorial |
| 03:47 | raek | thorwil: it's on the classpath (lein puts it there) |
| 03:49 | thorwil | (-> "resources/templates/404.html" slurp en/html-snippet) does what i want. or it has to be ((en/snippet "templates/404.html" [:p] [])) |
| 03:50 | thorwil | where :p makes it unnecessarily specific, but if i use :*, the content will appear thrice |
| 03:54 | raek | thorwil: I would suggest (-> "templates/404.html" io/resource slurp en/html-snippet) |
| 03:55 | raek | this uses the classpath instead of the current working directory |
| 03:55 | raek | which will also work when if you make an uberjar of your project |
| 03:57 | thorwil | ah, thanks |
| 04:12 | thorwil | i use a single base.html as skeleton for all pages. it references a main.css. it works everywhere, except on /admin/*. here firefox complains about a bad selector and a missing closing } on a line number that doesn't exist in the css file |
| 04:16 | Kerris | it's you |
| 04:16 | Kerris | you are the gremlin |
| 04:23 | thorwil | awesome, for /admin mains.css is served like it should, but for /admin/test one of my handlers is triggered instead. |
| 04:26 | thorwil | and i thought static files served from the war dir had priority over any route i write |
| 04:28 | maacl_ | LauJensen: Are you around? |
| 04:36 | thorwil | all the trouble because i didn't have a / in front of main.css |
| 04:38 | clgv | thorwil: hopefully you learnt that now for next time ;) |
| 04:47 | fortxun | $seen rhickey |
| 04:47 | sexpbot | rhickey was last seen quitting 1 week and 1 day ago. |
| 05:50 | fliebel | What kind of data do you use seque for? I'd think infinite lazy computationally intensive stuff, but I'd love to hear more cases. |
| 05:51 | ilyak | Where do I find help on clojure.lang.Compile command line arguments? |
| 05:55 | fliebel | ilyak: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compile.java#L33 |
| 05:56 | fliebel | Sp basically, it just takes a bunch of files. I don't see any code for handling other stuff. |
| 06:47 | fliebel | I'd rather have something with a FSM and function composition. Or maybe not. I wonder how this is done: https://github.com/cgrand/regex |
| 06:49 | ilyak | ant is pain |
| 06:49 | clgv | fliebel: the last one seems nice. |
| 06:49 | ilyak | still pain after all years |
| 06:50 | fliebel | Yea, as I see it, patter matching is just regex for sequences. |
| 06:52 | clgv | cgrande's regex seems to be a different way to create standard regular expressions which could be useful if you have to build these expresion dynamically since you dont need to build a regex string |
| 06:54 | fliebel | right |
| 06:56 | sid3k | guys, I've decided to give a try to clojure after several months of break but I'm getting the same exact error again |
| 06:56 | sid3k | after I create a new project using lein |
| 06:57 | sid3k | I can't run lein deps without any error. ant produces a long error output |
| 06:58 | sid3k | even though I've recent version of clojure and lein, still it tries to get clojure and install again as I see |
| 06:58 | sid3k | any ideas? |
| 06:59 | sid3k | here is the output: https://gist.github.com/946164 |
| 07:00 | fliebel | sid3k: 1.2 has been released, so these snapshot builds are out of date. |
| 07:00 | fliebel | I'm not sure if they are even around anymore. |
| 07:00 | fliebel | So just using 1.2.0 should be fine. |
| 07:00 | sid3k | yeah, it works that way |
| 07:03 | no_mind | I declared a transient map but when I use assoc! to add key it, the key is not added |
| 07:08 | clgv | no_mind: you have to use the return value of assoc! to see the changes in general - though in some special cases it might work |
| 07:09 | no_mind | k |
| 07:10 | fliebel | how does a transient decide the cost of mutating vs copying? |
| 07:14 | clgv | fliebel: that's a source code lookup question, I guess ;) |
| 07:17 | fliebel | clgv: Okay, there we go… dusting of java knowledge. |
| 07:18 | clgv | *g* |
| 07:18 | clgv | $source transient |
| 07:18 | sexpbot | transient is http://is.gd/WJdgXr |
| 07:18 | clgv | $source TransientVector |
| 07:18 | sexpbot | Source not found. |
| 07:18 | fliebel | clgv: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ATransientMap.java |
| 07:19 | clgv | $source assoc! |
| 07:19 | sexpbot | assoc! is http://is.gd/UU78OT |
| 07:19 | clgv | thx |
| 07:20 | fliebel | still deeper... |
| 07:20 | clgv | hmm no "upper" in fact. doAssoc is abstract ;) |
| 07:21 | fliebel | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L385 |
| 07:22 | clgv | map example: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L198 |
| 07:23 | clgv | ah it has to do with the tree structure |
| 07:23 | fliebel | I see some stuff with the root node, but I don't really understand it. |
| 07:24 | clgv | afair most structures are tree-ish |
| 07:26 | clgv | humm it's strange: TransientHashMap.doAssoc always returns this |
| 07:26 | fliebel | clgv: yes, but this.root is changed or not. |
| 07:27 | fliebel | So I think that if the root of the tree is changed, it behaves like an immutable one, otherwise just a few childs are changed. |
| 07:27 | clgv | that doesnt amtter since you should get the identic jvm object back |
| 07:28 | fliebel | clgv: But if the .get methods use the root attribute, it'd just work, right? |
| 07:28 | clgv | yeah, I think so |
| 07:28 | clgv | assoc! only calls assoc on each key-val-pair. so no magic happening overthere |
| 07:29 | fliebel | I think one needs to understand the tree structure to know what is going on. |
| 07:29 | clgv | no, you dont need to. you do get exactly the same TransientHashMap jvam object back. |
| 07:30 | fliebel | yes, but *maybe* with a different root node. |
| 07:30 | clgv | that doesnt matter since you have to see the change then as well! |
| 07:30 | fliebel | huh, yea… true |
| 07:31 | clgv | would be interesting now, why it behaves differently |
| 07:31 | fliebel | then I don't see how it can return a different map. |
| 07:31 | clgv | I don't either |
| 07:32 | fliebel | Maybe I'll ask again when the side of the globe with clojure/core on it awakes. |
| 07:32 | clgv | yeah. let me know what they answered in case I am not around to read it ;) |
| 07:33 | fliebel | sure :) |
| 07:33 | clgv | atm it looks like black magic ;) |
| 07:52 | mec | what does it mean to have a final variable that is a subclass with non final variables |
| 08:14 | fliebel | What is the syntax for these pre and post conditions? |
| 08:16 | mec | (fn [x y] {:pre [(pos? x) (neg? y)] :post [(= % 10)]} (+ x y)) |
| 08:30 | mec | Is it possible to update from a jdk7 snapshot to a newer one without downloading the whole thing? |
| 08:34 | fliebel | mec: Thanks. |
| 08:37 | jfields | is there a better way to (filter #(= contract-name (:contract-name %)) list-of-maps) |
| 08:38 | jfields | I do that often enough that it feels like there is an idiom I'm missing. |
| 08:40 | Chousuke | well you could make the function point-free but that's not really better. :/ |
| 08:41 | mec | (filter #{contract-name} (map :contract-name list-of-maps)) ; is better for varying degrees of better |
| 08:42 | Chousuke | hmm |
| 08:42 | jfields | what does "make the function point-free" mean? sorry I'm not familiar with that phrase. |
| 08:42 | Chousuke | (filter (comp #{contract-name} :contract-name) list-of-maps) |
| 08:43 | Chousuke | jfields: it means that instead of creating a lambda explicitly, you use function composition and partial application or currying |
| 08:43 | jfields | Chousuke, gotcha, thanks. |
| 08:46 | Chousuke | unfortunately comp and partial are a bit too clumsy in clojure so point-free style is not as idiomatic as in Haskell for example. |
| 08:46 | mec | I gave up on partial, its easier to use #(f a %) than (partial f a) |
| 08:46 | Chousuke | in haskell you can do stuff like map (-) . (+1) [1, 2, 3], but in clojure you'd have to do (map (comp - (partial + 1)) [1 2 3]) |
| 08:47 | mec | Chousuke: . is infix comp? |
| 08:47 | Chousuke | IIRC yes |
| 08:47 | Chousuke | I haven't actually done any haskell beyond some tutorials :/ |
| 08:51 | zdennis | Is there a easy way to convert a clojure file to yaml? |
| 08:51 | zdennis | I see the https://github.com/lancepantz/clj-yaml project |
| 08:52 | zdennis | and was curious if there was another way or if that was recommended |
| 08:56 | fliebel | &(destructure ['a 1 'b 2 ['c 'd] [1 2]]) |
| 08:56 | sexpbot | ⟹ [a 1 b 2 vec__36718 [1 2] c (clojure.core/nth vec__36718 0 nil) d (clojure.core/nth vec__36718 1 nil)] |
| 08:57 | fliebel | zdennis: Why not json? |
| 09:04 | fliebel | How can I tell in a macro if a form was quoted or not? (= (first s) 'quote) maybe? |
| 09:04 | fliebel | feels weird... |
| 09:06 | chouser_ | fliebel: that should be about right, though I would be suspicious of the desire to do it. |
| 09:08 | fliebel | chouser: Well, yes. I am too. I'm considering ways to do destructuring properly. |
| 09:10 | fliebel | I want to do it with functions rather than a huge macro pile, which works mostly. Now I'm trying to add some icing. |
| 09:11 | chouser | to replace the current implementation in clojure.core? |
| 09:11 | fliebel | chouser: Huh? whre? |
| 09:11 | mec | what are you trying to destructure |
| 09:12 | chouser | fliebel: Clojure already does destructuring, so I'm not quite sure what you're trying to do. |
| 09:12 | fliebel | chouser: Oh, no, I mean pattern matching actually. |
| 09:13 | fliebel | I found this one, which uses a lot of weird tricks, with the question marks and quoting. https://github.com/dcolthorp/matchure |
| 09:13 | chouser | ,(destructure '[[a b c] [4 5 6]]) |
| 09:13 | clojurebot | [vec__1177 [4 5 6] a (clojure.core/nth vec__1177 0 nil) b (clojure.core/nth vec__1177 1 nil) c (clojure.core/nth vec__1177 2 nil)] |
| 09:13 | chouser | fliebel: ah, pattern matching. I see. |
| 09:18 | fliebel | chouser: Well, destructure is nice, but does not what I want really. I don't want to bind stuff, just expand it. |
| 09:18 | fliebel | or maybe I do, but.. let me see |
| 09:20 | zdennis | I'd like to play around with a clojure library, I've downloaded it, built it with lein, installed it, but trying to require it in the interactive-clj prompt can't find it. |
| 09:20 | zdennis | This is my first attempt to play with clojure, so I'm sure I'm doing something stupid |
| 09:20 | zdennis | or not doing something |
| 09:20 | zdennis | any pointers? |
| 09:21 | raek | fliebel: fyi, another pattern matching lib: http://www.brool.com/index.php/pattern-matching-in-clojure |
| 09:21 | Chousuke | zdennis: you most likely forgot to include it in the classpath when you started the repl |
| 09:21 | Chousuke | zdennis: you should just be able to run "lein repl" from the library's top level directory |
| 09:21 | raek | I like it's syntax better than matchure's |
| 09:22 | zdennis | Chousuke: thank you, that worked |
| 09:24 | raek | zdennis: "lein install" puts the lib in your local maven repo, but that doesn't automatically make it available whenever you launch clojure somewhere |
| 09:24 | zdennis | raek: is there a way when using the repl to make maven repository available if you want to play around with different libraries? |
| 09:24 | fliebel | raek: This too has a lot of werid stuff going on. It looks a lot more sane though. |
| 09:24 | raek | zdennis: if you are a beginner, then you probably want to create a new lein project, add the lib you are interested in as a dependency and then do lein deps and lein repl |
| 09:25 | chouser | fliebel: I'm not sure that clojure.core/destructure is of any use to a pattern matching lib. |
| 09:25 | raek | clojure does not use the "system wide install" approach which many other languages use |
| 09:26 | raek | which libraries to use, and what versions of them, is handled in a per-project basis |
| 09:26 | fliebel | chouser: Me neither, but it does handle the & stuff. |
| 09:27 | raek | zdennis: you might want to check out cake. it has a "global project", which lets you try a library without creating a project for the "play seesion" |
| 09:28 | zdennis | that sounds like what I need ,thx raek |
| 09:31 | dnolen | fliebel: pattern matching is a special case of predicate dispatch, always looking for help on my pred match work :) |
| 09:34 | fliebel | dnolen: Uhm, okay. Could you explain that? |
| 09:36 | dnolen | fliebel: predicate dispatch is a more generalized form of pattern matching - pattern matching w/ guards is not that dissimilar from predicate dispatch, except that predicate dispatch is open - anybody can add another case later. |
| 09:37 | dnolen | in fact the only novelty I'm introducing is that guards can be predicates that are stored in a logic db, the logic db can use that info to reorder clauses to prevent the kinds of problems you run into w/ pattern matching. |
| 09:39 | fliebel | dnolen: predicate dispatch is the same thing that cond is doing, tight? only faster and more flexible. |
| 09:40 | dnolen | fliebel: if by faster and more flexible you mean - doesn't try clauses in the order you wrote them, and it can be extended :) |
| 09:43 | fliebel | dnolen: tbh, I don't see how that helps much with my problem. If I can help with the dispatch without reading a ton of papers, that'd be fun though. |
| 09:46 | dnolen | fliebel: you could probably use one of those previously mentioned libs and be just fine. But if you're interested, only two papers - Efficient Predicate Dispatch, Compiling Pattern Matching to Good Decision Trees. Both are short and approachable, I think. |
| 10:10 | cemerick | dnolen: congrats on the contrib include :-) |
| 10:27 | fliebel | okay, dnolen, where are those papers of yours? |
| 10:39 | dnolen | cemerick: thx! |
| 10:40 | dnolen | fliebel: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.47.4553, http://moscova.inria.fr/~maranget/papers/ml05e-maranget.pdf |
| 10:40 | fliebel | dnolen: Yea, great to see logos in contrib :) found the papers btw, although your notion of short and understandable seems to be different from mine :) |
| 10:40 | dnolen | fliebel: heh ;) |
| 10:41 | fliebel | I had some trouble find out where the names started and stopped, and then I got the dylan one and all. |
| 10:41 | dnolen | fliebel: the predicate dispatch one is I think pretty easy to understand, it's not important to understand their algorithm tho, just the general idea. |
| 10:41 | clgv | fliebel: lol 31 papers is indeed not short for a paper ;) |
| 10:41 | clgv | s/papers/pages/ |
| 10:41 | sexpbot | <clgv> fliebel: lol 31 pages is indeed not short for a paper ;) |
| 10:41 | dnolen | fliebel: the Maranget paper seems mathematical, it's not really, it's just notation so they don't have to write OCaml |
| 10:42 | fliebel | anyway, I'll see if I can read some of it later. I'm going to play with CPS first :) |
| 10:43 | dnolen | fliebel: nice |
| 10:53 | no_mind | I have a nested map and a sequence which contains the path (hierarchy) of the key for value to fetch. Is there a function which will let me fetch the key from nested map ? Or do I need to iterate over the map ? |
| 10:54 | mec | (get-in map [key1 key2]) |
| 10:54 | mec | also assoc-in, and update-in |
| 10:54 | mec | err is that what you're asking |
| 10:57 | no_mind | mec: lets say I have a map {"user" {"admin" {"status "1"}}} and a sequence ("user" "admin" "status") . I want to find the value of "status". What is the easiest way to do this ? |
| 10:58 | clgv | it's like mec suggested: ##(get-in {"user" {"admin" {"status "1"}}} ["user" "admin" "status"]) |
| 10:59 | clgv | &(get-in {"user" {"admin" {"status" 1}}} ["user" "admin" "status"]) |
| 10:59 | sexpbot | ⟹ 1 |
| 11:01 | clgv | and ##(assoc-in {"user" {"admin" {"status" 1}}} ["user" "admin" "status"] 2) |
| 11:01 | sexpbot | ⟹ {"user" {"admin" {"status" 2}}} |
| 11:08 | dakrone | when you have something like http://pastebin.com/DwCrYqNw how can I get it to resolve correctly and not give me "More than one matching method found: writeNumber"? |
| 11:09 | clgv | dakrone: type hints. I guess you need them for "jg" as well |
| 11:09 | mec | I believe the args are being passed to instance? backwards |
| 11:10 | mec | try #(instance? %2 %1) |
| 11:10 | clgv | mec: ah yes. that as well ;) |
| 11:11 | mec | err nope, im wrong |
| 11:12 | clgv | &(instance? java.lang.Integer (int 0)) |
| 11:12 | sexpbot | ⟹ true |
| 11:12 | dakrone | the condp is correct, this worked on 1.2, on 1.3 it trows, even if I type hint both the obj and jg |
| 11:12 | dakrone | *throws |
| 11:12 | clgv | what does it throw? |
| 11:13 | dakrone | java.lang.IllegalArgumentException: More than one matching method found: writeNumber |
| 11:13 | mec | what arities does writeNumber have? |
| 11:14 | dakrone | they're all 1 arity, just different classtypes |
| 11:15 | mec | do you have a generic Object one? |
| 11:16 | dakrone | no, only ones for Integer, Long, Float, BigDecimal, etc number types |
| 11:17 | scottj | cake channel name? |
| 11:20 | raek | scottj: #cake.clj |
| 11:21 | clgv | thats weird: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Class |
| 11:22 | clgv | ok it's not lol |
| 11:22 | fliebel | clgv: Reversed the arguments? |
| 11:22 | clgv | examples for condp should use asymmetric predicates ;) |
| 11:23 | mec | clgv: what do you mean |
| 11:23 | clgv | mec: I also did think that the argument order should be reversed ^^ |
| 11:24 | mec | ,(condp instance? 5 Integer 'Integer Long 'Long Float 'Float Double 'Double BigInteger 'BigInteger) |
| 11:24 | clojurebot | Integer |
| 11:25 | raek | ,(instance? Integer 5) |
| 11:25 | clojurebot | true |
| 11:25 | raek | the order condp applies the function always surprises me |
| 11:25 | raek | but it does fit isa?... |
| 11:26 | mec | ,(isa? 5 Integer) |
| 11:26 | clojurebot | false |
| 11:28 | raek | ,(isa? (class 5) Integer) |
| 11:28 | clojurebot | true |
| 11:43 | clgv | I tried to provide one of my deftypes with meta-data like: clojure.lang.IObj (withMeta [this, new-meta-data] ...) |
| 11:43 | clgv | but I get: java.lang.AbstractMethodError with no description |
| 11:44 | mec | did you define (meta [this]) also? |
| 11:45 | fliebel | clgv: Typehints maybe? |
| 11:45 | clgv | mec: humm no. lol. which interface is it? |
| 11:45 | fliebel | clgv: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IObj.java |
| 11:45 | mec | IObj |
| 11:46 | clgv | ah it's in IMeta. thats why I forgot it |
| 11:48 | clgv | java.lang.ClassCastException: "MyDeftype cannot be cast to clojure.lang.IPersistentMap" :( |
| 11:49 | clgv | ah found it |
| 12:13 | fliebel | ((match (literal 1) (coll (literal 3) (other #(every? even? %))) _ (literal 3)) [1 [3 4 2] 2 3]) ; true |
| 12:27 | clgv | can incanter handle a list of maps as dataset or do I have to build seq for every row? |
| 12:52 | clgv | ok I converted the data. |
| 12:53 | Ramblurr | can anyone please explain why the nullpointerexception is thrown in this example: http://www.ideone.com/COjaV ? |
| 12:54 | joegallo | extra parens |
| 12:54 | joegallo | (defn foo [n] (<--- this one right here, delete it |
| 12:55 | fliebel | nice one :) |
| 12:55 | Ramblurr | joegallo: Ahh! thanks |
| 12:55 | joegallo | np |
| 12:56 | Ramblurr | joegallo: why did that almost work, but fail at the end? how did the interpreter interpret (hehe) that ? |
| 12:56 | joegallo | 1. do the work of printing the numbers, 2. execute the function returned by 1. |
| 12:56 | joegallo | but 1 (doseq ...) returns nil |
| 12:57 | joegallo | so you are (nil) |
| 12:57 | joegallo | invoking nil as a function, hence npe. |
| 12:57 | Ramblurr | joegallo: gotcha, thanks again |
| 12:58 | joegallo | np, again :) |
| 13:05 | fliebel | How does a transient decide whether to mutate or copy? I looked at the source with clgv, be we couldn't figure it out. |
| 13:12 | amalloy | fliebel: fwiw, i test for quoting with (= (first s) 'quote) |
| 13:13 | amalloy | needed it for sexpbot so he can macro-expand your form for sneakiness, but still leave quoted sections alone so that code you provide doesn't get mangled |
| 13:13 | amalloy | eg ##(macroexpand '(.getName x)) |
| 13:13 | sexpbot | ⟹ (. x getName) |
| 13:13 | mec | fliebel: what do you mean? doesn't a transient always mutate? |
| 13:14 | amalloy | mec: no |
| 13:14 | amalloy | whereas if you asked him to eval (.getName x) he expands that into pages and pages of code to verify that it's an allowed operation |
| 13:16 | amalloy | &(let [x (transient [])] (dotimes [n 100] (conj! x n)) (persistent! x)) |
| 13:16 | sexpbot | ⟹ [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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99] |
| 13:16 | amalloy | hm |
| 13:16 | mec | would you know an example of where a transient copies instead of mutating? |
| 13:16 | amalloy | well, i expected that example to be one |
| 13:17 | amalloy | the point is that conj! returns to you a new list. that list may be a pointer to the same one you gave it, if it chose to mutate that; or it may give you a new one back if that was more efficient |
| 13:17 | amalloy | if you throw away the result of conj! you're doing it wrong |
| 13:19 | fliebel | &*clojure-version* |
| 13:19 | sexpbot | ⟹ {:major 1, :minor 2, :incremental 0, :qualifier ""} |
| 13:20 | fliebel | &(let [x (transient {})] (dotimes [n 100] (assoc! x n n)) (persistent! x)) |
| 13:20 | sexpbot | ⟹ {0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7} |
| 13:21 | mec | ah i forgot maps swap to more efficient implementations |
| 13:21 | fliebel | Would that be it? Just the move from array-map to hash-map? |
| 13:22 | fliebel | &(let [x (transient (hash-map)] (dotimes [n 100] (assoc! x n n)) (persistent! x)) |
| 13:22 | sexpbot | java.lang.Exception: Unsupported binding form: (dotimes [n 100] (assoc! x n n)) |
| 13:22 | fliebel | &(let [x (transient (hash-map))] (dotimes [n 100] (assoc! x n n)) (persistent! x)) |
| 13:22 | sexpbot | ⟹ {0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7} |
| 13:24 | fliebel | &(let [x (transient (apply hash-map (range 20)))] (dotimes [n 100] (assoc! x n n)) (sort (persistent! x))) |
| 13:24 | sexpbot | ⟹ ([0 0] [1 1] [2 2] [3 3] [4 4] [5 5] [6 6] [7 7] [8 8] [9 9] [10 10] [11 11] [12 12] [13 13] [14 14] [15 15] [16 16] [17 17] [18 18] [19 19] [20 20] [21 21] [22 22] [23 23] [24 24] [25 25] [26 26] [27 27] [28 28] [29 29] [30 30] [31 31] [32 32] [33 33] [34 34] [35 35... http://gist.github.com/946808 |
| 13:27 | fliebel | There you have it, that seems to work, only the second example is weird. |
| 13:27 | fliebel | If it changed back to an array map it would contain nothing, if it did not, it would contain everything. |
| 13:29 | fliebel | no_mind had some code this morning that did this. I wonder what he had. |
| 13:29 | amalloy | fliebel: you have mismatched parens in your second example |
| 13:29 | fliebel | amalloy: Third one then... |
| 13:29 | amalloy | sexpbot tried to fix them but guessed wrong |
| 13:30 | fliebel | I count like a repl. |
| 13:30 | no_mind | fliebel: well my code was creating an acyclic directed graph |
| 13:30 | amalloy | fliebel: i feel sure there are other situations in which it might give you a different pointer |
| 13:32 | fliebel | amalloy: clgv and I traced the code down to the transient, and it looked like it modifies the root attribute, but always returns the same object. |
| 13:48 | apgwoz | has anyone heard from Raynes? |
| 13:49 | amalloy | apgwoz: his power is out, and cell service is spotty |
| 13:49 | apgwoz | (or anyone else from the affected tornado states for that matter?) |
| 13:49 | apgwoz | amalloy: cool. |
| 13:49 | apgwoz | (well, uncool about power, but cool that he's ok) |
| 13:49 | amalloy | yeah |
| 13:50 | astoddard | A question with an apparently erroneous answer on stackoverflow piqued my interest. http://stackoverflow.com/questions/5821585/clojure-proxy-and-override |
| 13:51 | astoddard | It appears a call to proxy can attempt to implement an non-existing base method: (proxy [Object] [] (nonExistingBaseMethod [] "Foo")) |
| 13:51 | astoddard | Is that nonExistingBaseMethod actually callable in any way? |
| 13:51 | fliebel | I'd say so. |
| 13:52 | amalloy | &(.getName (proxy [Object] [] (getName[] "test"))) |
| 13:52 | sexpbot | java.lang.IllegalStateException: Var null/null is unbound. |
| 13:52 | amalloy | hm |
| 13:52 | amalloy | that looks like a clojail bug, but it doesn't work in the repl either |
| 13:54 | amalloy | astoddard, fliebel: clojure.contrib.repl-utils/show indicates that a proxy created in that way does not have a method with that name |
| 13:54 | fliebel | amalloy: So do you have to define an interface first? |
| 13:55 | amalloy | probably |
| 13:55 | amalloy | though in that case you may just want to reify? |
| 13:55 | amalloy | i guess not |
| 13:56 | astoddard | amalloy: agreed, no method in the proxy. Interestingly an entry is in the IPersistentMap available from __getClojureFnMappings. |
| 13:59 | Ramblurr | I'm using a for to put strings inside a list basically (for [...] (fun-that-returns-a-str)), these strings contain spaces |
| 13:59 | Ramblurr | and when I call count on the result of the for loop, its interpreting each word as a separate element |
| 14:00 | Ramblurr | what's the proper way to put a string into a list so the spaces between words are preserved? |
| 14:01 | amalloy | huh? you are wrong; ##(count ["this has spaces"]) |
| 14:01 | sexpbot | ⟹ 1 |
| 14:02 | Ramblurr | herm |
| 14:03 | fliebel | Teh codez for my micro matcher. Comments? https://gist.github.com/946857 |
| 14:04 | amalloy | &(count (for [x (range 10)] (clojure.string/join " " (repeat x "word")))) |
| 14:04 | sexpbot | ⟹ 10 |
| 14:39 | thorwil | given that (ds/defentity Quark [^:key milch sahne yoghurt]) expands to (clojure.core/defrecord Quark [milch sahne yoghurt] appengine-magic.services.datastore/EntityProtocol ... |
| 14:40 | thorwil | how could i access the vector [milch sahne yoghurt] afterwards? |
| 14:41 | mec | (nth (macroexpand-1 '(ds/defentity Quark [^:key milch sahne yoghurt]) 3) |
| 14:43 | dnolen | fliebel: nice. |
| 14:43 | thorwil | heh |
| 14:44 | thorwil | mec: but without repeating the macro call. i mean, this information has to be accessible from Quark afterwards, somehow |
| 14:45 | dnolen | thorwil: reflection is one way. |
| 14:45 | fliebel | dnolen: Thanks. What amount of dead tree would you think I can consume during 4 hours of train? |
| 14:46 | dnolen | fliebel: probably both papers, I read papers on the way to work, my commute is only 30 min on train, so it usually takes 2 rides to finish one. |
| 14:47 | mec | thorwil: you could probably use symbol capture but it really depends what you're doing |
| 14:47 | dnolen | of course, I usually have to read a paper 2 or 3 times before I understand it... |
| 14:47 | fliebel | dnolen: Okay, good :) I wonder if the empty cartridge will make it to the end of the 31 pages one :P |
| 14:56 | sritchie | ,((fn [f a b] (f a b)) (read-string "+") 2 3) |
| 14:56 | clojurebot | 3 |
| 14:56 | sritchie | does anyone know why that doesn't eval to 5? |
| 14:57 | justinlilly | ,(= (read-string "+") '+) |
| 14:57 | clojurebot | true |
| 14:57 | justinlilly | ,((fn [f a b] (f a b)) '+ 2 3) |
| 14:57 | clojurebot | 3 |
| 14:58 | justinlilly | do you have to unquote the + somehow? |
| 14:58 | justinlilly | ,('+ 2 3) |
| 14:58 | clojurebot | 3 |
| 14:58 | justinlilly | that's effectively what's happening. |
| 14:59 | technomancy | justinlilly: needs resolve or eval |
| 14:59 | technomancy | ,('+ {'+ :plus} :not-found) |
| 14:59 | clojurebot | :plus |
| 14:59 | sritchie | ,((fn [f a b c] (f a b c)) (read-string "+") 1 5 5) |
| 14:59 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args (3) passed to: Symbol |
| 14:59 | sritchie | yeah, interesting |
| 15:00 | hiredman | justinlilly: I'd suggest learning about lisp readers |
| 15:00 | justinlilly | ,((fn [f a b] ((eval f) a b)) (read-string "+") 2 3) |
| 15:00 | clojurebot | DENIED |
| 15:00 | justinlilly | tsk. |
| 15:00 | mec | you're calling a symbol, which take 1 or 2 args |
| 15:00 | hiredman | and following that up by learning about evaluators |
| 15:00 | hiredman | followed up by writing a lisp |
| 15:00 | justinlilly | hiredman: direct comments to sritchie :) |
| 15:00 | manutter | ,((fn [f a b] ((resolve f) a b)) (read-string "+") 2 3) |
| 15:00 | mec | the first arg is the environment to look themselves up, and the 2nd is not-found |
| 15:00 | clojurebot | 5 |
| 15:00 | sritchie | ah, that's really interesting |
| 15:00 | hiredman | mec: map |
| 15:01 | hiredman | not environment |
| 15:01 | sritchie | ,('+ {'+ 4} 2) |
| 15:01 | clojurebot | 4 |
| 15:02 | mec | ,(('+ {'+ +}) 2 3) |
| 15:02 | clojurebot | 5 |
| 15:02 | mec | ,(('+ {} -) 2 3) |
| 15:02 | clojurebot | -1 |
| 15:17 | TimMc | Wait, what does invoke on a Symbol do? |
| 15:17 | fliebel | TimMc: Lookup in a map |
| 15:17 | TimMc | ah, like keywords |
| 15:17 | fliebel | oh, maybe not, that was my python mind confusing me |
| 15:17 | TimMc | ,('foo {'foo :sym, :foo :key}) |
| 15:17 | clojurebot | :sym |
| 15:18 | TimMc | ,('bar {'foo :sym, :foo :key} :qux) |
| 15:18 | clojurebot | :qux |
| 15:18 | TimMc | with optional default |
| 15:18 | fliebel | oh, okay |
| 15:19 | TimMc | mec: And by "environment" you mean an associative data structure? |
| 15:21 | mec | TimMc: indeed |
| 15:22 | mec | on invoke symbol calls RT.get(arg1, this, not-found) |
| 16:09 | ordnungswidrig | hi all |
| 16:42 | ordnungswidrig | Can protocols extend protocols? |
| 16:50 | mec | ordnungswidrig: I dont think so |
| 16:54 | edw | Do the modular contrib projects work in 1.2.1? |
| 17:02 | ohpauleez | edw: I don't think so. I think they're only for 1.3 |
| 17:02 | ohpauleez | But I haven't personally tried |
| 17:02 | ohpauleez | some (most?) will probably work |
| 17:02 | ohpauleez | since most of the code of contrib isn't 1.3 specific |
| 17:03 | edw | OK. "Should I be using a 1.3 prerelease?" is a question I'm thinking of asking. |
| 17:05 | ohpauleez | If you're just playing around, I'd say go for it! |
| 17:05 | ohpauleez | if you're doing production work, I think you should stick to 1.2.1 |
| 17:07 | edw | I'm doing active development, so dealing with occasional changes isn't a biggie. I'd rather do that than deal with migrating to the new libs later. |
| 17:07 | ohpauleez | Yeah, sure. I've been working on 1.3 stuff. There's a lein plugin for working with multiple clojure version, I believe it's called lein-multi |
| 17:08 | edw | Doesn't it just come down to futzing with your project.clj? |
| 17:10 | technomancy | lein-multi is designed for testing libraries for cross-compatibility, though nothing prevents you from using it to test applications as well. |
| 17:11 | technomancy | edw: https://github.com/technomancy/swank-clojure/blob/master/project.clj#L7 |
| 17:12 | edw | Ah. I'm writing apps. (A Scheme -> JS translation web service right now.) |
| 17:13 | ohpauleez | edw: You're quite the polyglot programmer, huh? :) |
| 17:14 | ordnungswidrig | I try to solve the expression problem on event handling: events (data) and handlers (behaviour) |
| 17:15 | ordnungswidrig | I made the handlers protocol (with a single method) and deftyped the events that extend protocols |
| 17:15 | ordnungswidrig | https://gist.github.com/947353 |
| 17:15 | ordnungswidrig | any idea on this? I don't like the runtime registration of the handler protocols |
| 17:16 | edw | ohpauleez: I just hate writing CPS-style programs in JS (too much syntax) so I figured I'd write something that would compile Scheme to JS a la CoffeeScript so I can get on with my life. |
| 17:17 | ohpauleez | edw: For sure, I definitely understand. I think it's a cool project. |
| 17:19 | edw | Actually, I'm writing it because I'm sort of depressed, and I need something fun to do. I think I'm having a Bipolar Lisp Programmer kind of day. |
| 17:19 | apgwoz | edw: have you looked at cpscm? or did you just want to write it yourself? |
| 17:19 | edw | apgwoz: See above. ;) |
| 17:19 | apgwoz | yeah. we wrote at the same time :) |
| 17:20 | edw | But I'll check that out. Maybe it's a pile of mud I can help make a little bigger. |
| 17:20 | apgwoz | never as fun as writing it yourself though... |
| 17:20 | apgwoz | i'd vote for that |
| 17:20 | apgwoz | :) |
| 17:21 | dnolen | edw: have you seen scheme2js ? |
| 17:22 | edw | dnolen: No. What's it written in? |
| 17:22 | dnolen | edw: it's insane actively worked on, http://www-sop.inria.fr/indes/scheme2js/ |
| 17:22 | dnolen | supports call/cc |
| 17:23 | dnolen | pretty much all of r5rs is there. |
| 17:23 | dnolen | the main issue is that documentation is sparse. |
| 17:24 | edw | inria.fr... Is that home to OCaml? |
| 17:24 | dnolen | edw: yup. |
| 17:25 | edw | Ah. |
| 17:25 | dnolen | compiler does trampolining transformation, so tail recursive code is guaranteed to not stack overflow. |
| 17:25 | dnolen | was considering playing around with it and Node.js |
| 17:26 | edw | Maybe I should just cut out and go to Oscar's (local dive). Reintroducing myself to primitive java character i/o is causing my body to sigh. |
| 17:26 | ohpauleez | I think fogus has a functional JS/Node.js project going on. I don't know how far he's gotten with it though |
| 17:26 | technomancy | that seems a bit backwards; why put yourself on an untested runtime with no libraries when there are lots of really solid scheme compilers already? |
| 17:26 | ohpauleez | but it'd be worth looking at |
| 17:29 | edw | technomancy: Because I'm done hosting my own projects. I ran my consulting firm's web site on a framework I wrote in Scheme (Magic) and I sometimes had to connect to SLIME at 3am to re-start the mofo. The Joyent Node Service is nice. But I hear you. I miss Scheme48. |
| 17:32 | dnolen | edw: have you used Geiser? |
| 17:32 | edw | No. |
| 17:32 | dnolen | edw: works beautifully with Racket |
| 17:33 | edw | And by Racket, do you mean what MzScheme's become? |
| 17:34 | dnolen | edw: yes |
| 17:34 | edw | I just read the front page slash manifesto. Sounds like one of my people. I was bitching about having to bounce the JVM just to update a project's dependencies. |
| 17:34 | edw | ...just the other day. |
| 17:35 | edw | Oh noes, he supports Guile... |
| 17:37 | hiredman | you can add classes and what not, it just can run into odd scoping issues and can be tricky to deal with |
| 17:37 | edw | dnolen: Downloading Racket... |
| 17:37 | hiredman | so there is nothing preventing people from rolling their own runtime classloading whatever, clojure just doesn't provide something out of the box |
| 17:38 | ordnungswidrig | How can I extract all functions out of a protocol? |
| 17:38 | edw | hiredman: Right good point. [As edw sticks head in oven.] |
| 17:41 | no_mind | In a nested map how do I insert a new key at a any given level. Foreg. I have {"user" {"admin" {"status" "1"}}} and I want {"user" {"admin" {"status" "1", "roles" "2"}}} |
| 17:41 | hiredman | https://github.com/hiredman/clojurebot/blob/master/src/clojurebot/plugin.clj |
| 17:42 | ordnungswidrig | no_mind: ,(update-in {"user" {"admin" {"status" "1"}}} ["user" "admin"] assoc "roles" 2) |
| 17:42 | ordnungswidrig | (update-in {"user" {"admin" {"status" "1"}}} ["user" "admin"] assoc "roles" 2) |
| 17:42 | ordnungswidrig | ,(update-in {"user" {"admin" {"status" "1"}}} ["user" "admin"] assoc "roles" 2) |
| 17:42 | clojurebot | java.lang.Exception: Unable to resolve symbol: in this context |
| 17:42 | ordnungswidrig | *grr* |
| 17:42 | no_mind | alternatively, which data structure is most suitable for presenting hierarchical data |
| 17:44 | dnolen | ,(assoc-in {} [:foo :bar :baz] 1) |
| 17:44 | clojurebot | {:foo {:bar {:baz 1}}} |
| 17:44 | ordnungswidrig | no_mind: thats ok, however I'd user keywords: {:users {:admin {:status 1 :roles 2}}} |
| 17:44 | dnolen | no_mind: ^ |
| 17:44 | no_mind | assoc-in wont add a key but will replace |
| 17:45 | dnolen | no_mind: update-in |
| 17:47 | lancepantz | edw/hiredman: that's what classlojure is for |
| 17:47 | lancepantz | we use it in cake to update dependencies without bouncing the jvm |
| 17:47 | hiredman | ~cake |
| 17:47 | clojurebot | cake is http://wondermark.com/030/ |
| 17:47 | lancepantz | it has multiple application classloaders, you can use it to run multiple versions of clojure in the same jvm too |
| 17:53 | ordnungswidrig | can one determine if a value is a protocol? The type of a protocol seems to be PersistentArrayMap |
| 17:53 | ordnungswidrig | I'm on 1.2 |
| 17:53 | dnolen | sick, http://www.artisancoder.com/2011/04/cps-and-beta-reduction/ |
| 17:58 | ordnungswidrig | dnolen: nice |
| 17:59 | ataggart | protocols are not types, but you can check if an object satisfies a protocol with (satisfies? P obj) |
| 18:02 | ordnungswidrig | ataggart: I know. But I have (defprotocol Foo) (defprotocol Bar) and I wan't to register a protocol (-type) at runtime, say (defn add-handler [p] (alter handlers conj p)) But I want to make sure that p in the latter function is a protocol |
| 18:02 | ordnungswidrig | not something else |
| 18:03 | ataggart | protocols are not types |
| 18:03 | ohpauleez | ordnungswidrig: I'd look at the supers of the a protocol, and see what interface you can check for |
| 18:03 | ordnungswidrig | ataggart: I know. |
| 18:04 | ordnungswidrig | ohpauleez: the runtime representation of a protocol is a map, not a java type |
| 18:04 | ohpauleez | ah right |
| 18:05 | ohpauleez | but does it include any extra interfaces, outside of a standard map? |
| 18:05 | ataggart | the question is tantamount to asking if an argument is a multimethod. |
| 18:07 | ohpauleez | ordnungswidrig: There are a keys you can check for |
| 18:07 | ordnungswidrig | other question: is using protocols for dispatch faster than using multimethods? |
| 18:07 | Ramblurr | is there a function like (do ..) that evalutes all the exprs *and returns* all the results? |
| 18:07 | ordnungswidrig | ohpauleez: the keys, yes |
| 18:07 | ohpauleez | ordnungswidrig: yes |
| 18:08 | technomancy | Ramblurr: pvalues |
| 18:08 | amalloy | vector |
| 18:08 | amalloy | &(vector 1 2 3) |
| 18:08 | sexpbot | ⟹ [1 2 3] |
| 18:08 | technomancy | oh yeah, that's better |
| 18:08 | technomancy | or list |
| 18:08 | Ramblurr | yea i thought of that, but I don't want a list, because the returned values are already going into a list :\ |
| 18:09 | amalloy | Ramblurr: clojure does not have multiple-value return |
| 18:09 | amalloy | look at mapcat |
| 18:09 | ordnungswidrig | Ramblurr: what about with-meta |
| 18:09 | Ramblurr | inside a (for..) i want to evalute several exprs and have for return all the results |
| 18:09 | amalloy | &(mapcat #(if (even? %) [:even %] %) (range 10)) |
| 18:09 | sexpbot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer |
| 18:10 | amalloy | &(mapcat #(if (even? %) [:even %] [%]) (range 10)) |
| 18:10 | sexpbot | ⟹ (:even 0 1 :even 2 3 :even 4 5 :even 6 7 :even 8 9) |
| 18:10 | Ramblurr | ah interesting |
| 18:14 | hiredman | ,(for [x (range 10) :when (even? x) y [:even x]] y) |
| 18:14 | clojurebot | (:even 0 :even 2 :even 4 :even 6 :even 8) |
| 18:15 | hiredman | it's a shame that for doesn't have an explicit concat option |
| 18:17 | amalloy | i agree |
| 18:17 | amalloy | i feel dirty having to use mapcat |
| 18:18 | amalloy | hiredman: that's a pretty neat trick |
| 18:19 | Ramblurr | amalloy: i'm not sure how to apply mapcat to this example: http://www.ideone.com/Y4Sn9 |
| 18:19 | Ramblurr | you can see the (do.. ) where I'd like it to return both |
| 18:20 | Ramblurr | dont pay attention to the redundancy of (foo.. ) ;) |
| 18:21 | amalloy | Ramblurr: like hiredman says, you can't do it with for |
| 18:22 | amalloy | this is...almost exactly identical to the mapcat example i gave |
| 18:22 | Ramblurr | amalloy: yup, but where would you add the call to (foo ..) in the mapcat example |
| 18:22 | amalloy | (mapcat #(if (even? %) [(foo %) "even"] ["odd"]) (range 50)) |
| 18:22 | Ramblurr | oh :\ |
| 18:29 | mec | this sounds like a job for (fort [a (range 5) b (range 5) :transform (partial apply concat)] [a b]) |
| 18:33 | ataggart | xy? |
| 18:33 | clojurebot | xy is http://mywiki.wooledge.org/XyProblem |
| 18:34 | amalloy | speaking of xy, Ramblurr, did you figure out what was going on with your "strings with spaces" issue? |
| 18:35 | amalloy | mec: that's just silly. you can (apply concat) the result of the for; but that doesn't resolve the "issue" of wanting to return two things sometimes and one thing other times: you still have to wrap everything in a vector |
| 18:36 | mec | if none of those are collections themselves you could always flatten |
| 18:37 | mec | its too bad concat doesnt work as flatten-1 |
| 18:38 | amalloy | ugh. flatten is good, but the language would be better without putting it in core so that people stop trying to abuse it for one-level flattening |
| 18:39 | nickik | http://stackoverflow.com/questions/5232350/clojure-semi-flattening-a-nested-sequence/5232787#5232787 |
| 19:46 | devn | how can I passing something like a namespace as an arg without 'quoting it? |
| 19:46 | devn | s/passing/pass |
| 19:46 | sexpbot | <devn> how can I pass something like a namespace as an arg without 'quoting it? |
| 19:46 | devn | (myfn foo.core) => (myfn 'foo.core) |
| 19:49 | scgilardi | the arguments to a function are evaluated before the function is invoked. if you need exactly what you're saying, myfn needs to be a macro. |
| 19:50 | devn | scgilardi: *nod* |
| 19:50 | devn | i figured as much, no big deal |
| 19:50 | devn | thanks though |
| 19:57 | hiredman | foo.core is a symbol, 'fore.core is a quoted symbol, there is no literal syntax for namespaces |
| 20:08 | choffstein | anyone here use clj-cont? |
| 20:22 | dnolen | choffstein: clj-cont is now delimc |
| 20:23 | choffstein | ah, thanks. |
| 20:23 | choffstein | not available on clojars yet? |
| 20:23 | choffstein | Ah ... for 1.3.0 |
| 20:24 | dnolen | choffstein: lemme double check fi that's necessary |
| 20:27 | dnolen | choffstein: done, 0.1.0 pushed to Clojars, compat with 1.2.0 |
| 20:27 | choffstein | You're a lovely, beautiful person |
| 20:27 | choffstein | And I kiss you |
| 20:27 | dnolen | choffstein: not much documentation, but it basically works like shift/reset in Scheme. |
| 20:27 | dnolen | choffstein: relatively easy to sort out what's going no by looking at the test. |
| 20:29 | choffstein | I'll take a peek. Thanks. |
| 20:30 | choffstein | I'm trying to build a very simple component based web framework just to learn clojure |
| 20:30 | choffstein | and it seems like I can do it by passing around function objects and using refs and transactions ... but continuations seem sexier if I can figure em out |
| 20:31 | dnolen | choffstein: cool, that's why I originally developed delimc 2 1/2 years ago, to port weblocks. delimc is too slow for general use, but definitely more than fast enough for I/O bound things. |
| 20:31 | choffstein | i'm 99% sure i'm too stupid to get it working, but what doesn't kill me only makes me ... smarter? |
| 20:33 | carllerche | I'm trying to write a connection pool, would it be better to represent it as an atom -> { "hostname" PersistentQueue } or maybe ref -> { "hostname" ref -> PersistentQueue } and then use dosync? |
| 20:33 | dnolen | choffstein: yeah it was never completely clear to me how to implement it properly, but I never looked at weblocks or Seaside deeply enough. arc would be good to look at as well. |
| 20:33 | carllerche | or maybe a ref -> { "hostname PersistentQueue } directly and still use dosync? |
| 20:34 | choffstein | dnolen: yeah, I was playing around with seaside and was wondering if I could implement something really simple in clojure that captured the essence of the idea |
| 20:35 | dnolen | choffstein: it's definitely possible. just have to map unique keys to a frozen computation. and garbage collect those frozen computations somehow. |
| 20:37 | choffstein | dnolen: the reset/shift system is new to me, so I'm still trying to figure out how the freeze the computation. I come from a ruby background, so trying to understand the parallel is rocking the boat for me |
| 20:38 | dnolen | reset, mean start recording everything here and allow me to jump back at any time - shift. |
| 20:38 | dnolen | s/mean/means |
| 20:38 | sexpbot | <dnolen> reset, means start recording everything here and allow me to jump back at any time - shift. |
| 20:40 | choffstein | hmmm, interesting |
| 20:40 | choffstein | and reset won't actually execute the code? |
| 20:41 | dnolen | continuations are the new hotness at ICFP 2011, they're doing a whole workshop on them. |
| 20:41 | choffstein | I'm just really trying to figure out how to implement call-backs via continuations. |
| 20:41 | choffstein | I don't think I understand them well enough at the moment. |
| 20:41 | hiredman | "new" |
| 20:42 | choffstein | hiredman: isn't that how the world works? |
| 20:42 | dnolen | well the academics are excited about them - a lot of type theory to sort out. |
| 20:46 | choffstein | i'm not gonna lie, dnolen, the test cases don't help me at all :D |
| 20:52 | dnolen | choffstein: I would do something simple like try to solve the arc challenge. |
| 20:52 | choffstein | okay |
| 20:54 | carllerche | Is there a functional difference between ref-set and alter besides just convenience? |
| 20:54 | dnolen | choffstein: use ring for the server, handlers are just fns, so you can just use reset around the body of the fn. that would be pretty awesome to see actually. |
| 20:56 | dnolen | carllerche: you'd have to read the ref to change it with ref-set, I believe. (ref-set ref (inc @myref)) vs. (alter ref inc) |
| 20:57 | carllerche | dnolen: yeah... i'm just wondering if there are any functional differences under the hood |
| 20:57 | carllerche | or if one could implement ref-set in terms of alter (or vice versa) |
| 20:57 | TimMc | carllerche: Doesn't look like it. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Ref.java#L172 |
| 20:58 | carllerche | hmm... indeed, thanks :) |
| 20:58 | hiredman | ~alter |
| 20:58 | clojurebot | alter is always correct |
| 20:58 | TimMc | carllerche: Also, there doesn't appear to be any difference in the stated semantics, so that *probably* won't change out from under you. |
| 20:59 | TimMc | hiredman: Because it is easier to reason about? |
| 20:59 | dnolen | TimMc: if you look at the code ref-set and alter are quite different. alter is more "atomic" |
| 20:59 | hiredman | TimMc: that is an out of context quote of rich talking about alter vs. commute |
| 21:00 | carllerche | but, the transaction would restart if ref-set isn't atomic |
| 21:01 | hiredman | unless you really need the stm I would use an LBQ or similar instead of refs or atoms |
| 21:02 | dnolen | TimMc: but maybe not, my understanding of concurrency issues is still noob-level. |
| 21:09 | choffstein | dnolen: Hmm, don't think I really understand what you mean there by just wrapping the fns with reset. Where does that get me? |
| 21:10 | choffstein | I'm trying to basically implement a component system where call-backs are implemented using continuations |
| 21:10 | dnolen | choffstein: you create holes that you can callback into at any point. |
| 21:11 | dnolen | choffstein: on the delimc landing page you can see I'm saving points I can return while allow the function to run to completion as well. |
| 21:13 | choffstein | dnolen: Right. I think what I am trying to do is do that will the components. I am basically having each component be a set of state and procedures that renders itself with call-backs that affect the state. My thought was to use continuations to implement those call-backs for when a link is pressed or a form is submitted. |
| 21:14 | dnolen | choffstein: you can render a page, see that something is missing, store the continuation, call another function, produce a page with an input field, when the user submits that you can then call the stored continuation to finish the *original* page. |
| 21:14 | choffstein | ah, interesting |
| 21:15 | brehaut | dnolen: whats the link for this lib? |
| 21:16 | dnolen | brehaut: https://github.com/swannodette/delimc |
| 21:16 | brehaut | thanks! |
| 21:16 | dnolen | choffstein: that's the essence of the arc challenge which is why I recommended doing that. |
| 21:17 | dnolen | choffstein: http://www.paulgraham.com/arcchallenge.html |
| 21:17 | choffstein | i'll take a read |
| 21:18 | choffstein | hmm, interesting challenge. i'll give it a try :) |
| 21:19 | dnolen | choffstein: if you do it you should definitely do a blog post about, I've been hoping somebody would give it a shot with delimc. |
| 21:19 | choffstein | yeah, well, I just started using clojure a month ago and it is my first lisp, so don't hold your breath ;) |
| 21:19 | dnolen | choffstein: the cool thing is very complex form flows become trivial. |
| 21:20 | brehaut | dnolen, choffstein: it also seems useful for irc bots |
| 21:20 | dnolen | brehaut: true, never considered that. |
| 21:22 | choffstein | okay, I think I am getting this reset / shift stuff... |
| 21:23 | choffstein | Though, only in its simplest form... |
| 21:33 | choffstein | dnolen: how would funcall-3 and funcall-4 change if it had been (+ 2 (shift ...)) instead of (+ (shift ...) 2)? Does it matter? |
| 21:34 | choffstein | from reading up on scheme's reset / shift, it seems like anything between reset / shift is put into a lambda and applied where 'k' is in the shift statement |
| 21:38 | dnolen | choffstein: in that case it wouldn't matter no. |
| 21:43 | choffstein | okay, didn't think so. |
| 21:54 | Ramblurr | amalloy: regarding the strings as spaces, that was just me being confused by the toString version of the sequence |
| 21:54 | Ramblurr | amalloy: I had miscounted, the (count) result was correct |
| 21:55 | Ramblurr | its weird seeing a list printed like (This is a sentence broken into chunks, but you would never know it) |
| 21:56 | Ramblurr | when I had expected something like ("This is a sentence" "broken into chunks" ", but you would never know it") |
| 21:56 | amalloy | Ramblurr: instead of str, you can use pr-str, which prints in a way that preserves type information |
| 21:57 | amalloy | &((juxt str pr-str) '("string" "more")) |
| 21:57 | sexpbot | ⟹ ["(\"string\" \"more\")" "(\"string\" \"more\")"] |
| 21:58 | amalloy | &((juxt str pr-str identity) '("string" "more")) |
| 21:58 | sexpbot | ⟹ ["(\"string\" \"more\")" "(\"string\" \"more\")" ("string" "more")] |
| 21:58 | amalloy | okay whatever |
| 21:58 | amalloy | i'm not sure what you did to get that confusing output |
| 21:59 | choffstein | dnolen: I'm feeling like the examples of reset/shift I am seeing are just unnecessarily complex versions of let / fn... obviously, I must be missing something here. |
| 22:01 | dnolen | choffstein: let / fn doesn't let you continue from any point. |
| 22:01 | amalloy | choffstein: the chapter on continuations in On Lisp blew my mind. have you read it? |
| 22:01 | choffstein | amalloy: not yet. i'll try to read it |
| 22:02 | amalloy | i didn't really internalize it all |
| 22:04 | dnolen | choffstein: bascially shift let's you create a hole, this hole is a function. You can call this function to reinsert a new value and continue where that hole was made. |
| 22:04 | Ramblurr | amalloy: im having trouble applying the mapcat idiom to my actual function http://pastebin.com/dVQGJ7XG |
| 22:04 | Ramblurr | all of a sudden i'm getting the "wrong number of args" exception :\ |
| 22:04 | dnolen | choffstein: this is achievable if you write all your code in CPS style by hand - but delimc does that for you, it walks you code and applies that transformation automatically. |
| 22:05 | choffstein | dnolen: Ah, I see. I think I am just confusing myself with how I thought I would use callbacks with the code I was playing around with and how continuations really work. |
| 22:07 | dnolen | choffstein: it's pretty heady stuff, I still don't really understand it thoroughly myself. |
| 22:08 | choffstein | yeah. trying to figure out new concepts is like going around a drain. You just keep circling and circling until finally it clicks |
| 22:14 | amalloy | Ramblurr: the i in your original version has disappeared in the mapcat version |
| 22:14 | amalloy | clojure is complaining that you created an #(anonymous function) that takes 0 args (it has no % in it), and you're calling it with one arg |
| 22:15 | Ramblurr | oh! so that error is referring to the anonymous function, not the call to parsen |
| 22:16 | amalloy | yes. user$parsen$fn means "an anonymous function, nested inside of parsen, which is in the namespace user" |
| 22:17 | amalloy | since you're not *using* i at all, i'd rewrite this as something like (apply concat (repeatedly n #(do whatever, return a vector))) |
| 22:17 | amalloy | no point getting map(cat) involved if you don't use the input sequence for anything |
| 22:17 | amalloy | &(repeatedly 10 (rand-int 5)) |
| 22:17 | sexpbot | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn |
| 22:17 | amalloy | &(repeatedly 10 #(rand-int 5)) |
| 22:18 | sexpbot | ⟹ (2 3 0 2 4 0 2 0 3 0) |
| 22:19 | dnolen | choffstein: https://github.com/swannodette/delimc, perhaps example that don't involve arithmetic make it clearer |
| 22:20 | choffstein | dnolen: yeah, i'm trying to work through them now in my head. thanks. |
| 22:20 | dnolen | choffstein: I added an example w/ strings |
| 22:25 | daaku | i'm running into an issue where macro expansion is happening before the associated use statement runs, making the symbol references inside the macro be invalid (i think). code/output here: https://gist.github.com/754b1f7e4c5a65e1e58e ("app" is a macro).. anyone know how to get around this? |
| 22:25 | Ramblurr | amalloy: so i can put multiple function calls inside a [] and they'll all be evaluated for the return? |
| 22:26 | tomoj | is that moustache's app or is it under your control? |
| 22:26 | daaku | tomoj: moustache's app |
| 22:27 | tomoj | (appengine-environment-type) won't change, will it? |
| 22:27 | tomoj | I mean, in one jvm |
| 22:27 | daaku | tomoj: nope, it wont |
| 22:27 | tomoj | then decide at compile time which to do |
| 22:28 | tomoj | one solution, I think, would be (if (= :interactive (appengine-environment-type)) (defn wrap-dev [handler] ..) (def wrap-dev identity)) |
| 22:28 | daaku | i see, switch to def and let the if run |
| 22:28 | tomoj | but a bit ugly |
| 22:28 | tomoj | right, or that |
| 22:28 | tomoj | probably less ugly |
| 22:28 | daaku | lets try |
| 22:32 | tomoj | probably better to have the use call outside the handler |
| 22:33 | daaku | tomoj: not sure i follow (very much a n00b) |
| 22:33 | daaku | i tried this: https://gist.github.com/754b1f7e4c5a65e1e58e -- but still fails. seems like i'm misunderstanding how macro expansions work |
| 22:35 | tomoj | hmm.. right |
| 22:36 | tomoj | why not just always add those uses to the namespace? |
| 22:36 | tomoj | maybe a tiny bit of startup overhead, but that's it, right? |
| 22:37 | daaku | i guess to keep ring-devel and it's deps in :dev-dependencies i guess :).. but not terribly important i guess |
| 22:37 | tomoj | ah |
| 22:37 | daaku | but i want to understand why it still won't work anyways ;) |
| 22:37 | amalloy | daaku: (do a b c) compiles a b and c at the same time, so wrap-reload won't be linked in yet while you're compiling |
| 22:38 | daaku | amalloy: ah! that explains it |
| 22:38 | amalloy | there's a special exception if (do) is a form at the very top level, in which case it compiles/runs, compiles/runs, etc |
| 22:38 | tomoj | whoa |
| 22:39 | tomoj | so eval could save you, but, :'( |
| 22:39 | amalloy | tomoj: or a macro |
| 22:39 | tomoj | how? |
| 22:39 | clojurebot | with style and grace |
| 22:39 | amalloy | but really you probably shouldn't be making changes to the compilation environment at runtime |
| 22:40 | tomoj | the problem seems the opposite to me |
| 22:40 | choffstein | dnolen: can you have a continuation you don't pass anything to? |
| 22:40 | tomoj | we want to check at compile-time whether to make runtime changes, no? |
| 22:40 | tomoj | oh, I see |
| 22:40 | tomoj | "compilation environment" including which namespaces are used |
| 22:41 | amalloy | indeed |
| 22:41 | tomoj | you take the use call in the latest gist to be at runtime? |
| 22:41 | dnolen | choffstein: that seems reasonable/possible to me. |
| 22:42 | daaku | what is the best way to solve the problem of optional dependencies then? |
| 22:42 | amalloy | tomoj: (appengine-environment-type) is a runtime function |
| 22:42 | amalloy | maybe. i dunno |
| 22:42 | amalloy | daaku: depend on things anyway |
| 22:42 | amalloy | it costs so little |
| 22:42 | tomoj | depends.. |
| 22:43 | tomoj | ring-devel is probably small |
| 22:43 | tomoj | seems java deps can get quite costly in e.g. uberjar time |
| 22:43 | tomoj | ..and uberjar result size |
| 22:44 | amalloy | if you're actually shipping two (or N) different versions of the jar, then fine |
| 22:44 | tomoj | daaku: btw, I think #(identity) can never be called without error |
| 22:44 | amalloy | tomoj: wrong |
| 22:45 | amalloy | &((#(identity)) 10) |
| 22:45 | sexpbot | java.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$identity |
| 22:45 | amalloy | oh |
| 22:45 | amalloy | okay right |
| 22:45 | amalloy | haha |
| 22:45 | daaku | haha |
| 22:45 | tomoj | I had to try it out a few different ways before realizing.. |
| 22:45 | amalloy | i was thinking of (constantly identity), sorry |
| 22:45 | daaku | nice |
| 22:45 | tomoj | yeah, that's what I expected when I tried it I think |
| 22:46 | tomoj | daaku: to be clear #(identity) is (fn [] (identity)) |
| 22:47 | daaku | tomoj: yep, i didn't realize arity was enforced :) |
| 22:48 | daaku | which makes sense since defn seems to support arity based dispatch |
| 22:52 | tomoj | but only to the defined arities |
| 23:05 | choffstein | ...is there a reason why calling count on a dered reference to a list would return a list?! |
| 23:07 | choffstein | whoops, stupid mistake |
| 23:07 | choffstein | miiigghhhtt be time to stop coding |
| 23:46 | choffstein | dnolen: you still here? |
| 23:47 | dnolen | choffstein: what's up? |
| 23:47 | choffstein | dnolen: I'm pulling my hair out trying to create a continuation using shift / reset that doesn't take any args. any ideas? |
| 23:49 | choffstein | i'm looking at the rules for reset and shift at racket-lang.org, which I assume are similar to scheme's and therefore what you implemented. it's not looking very possible by design... |
| 23:49 | choffstein | see: http://docs.racket-lang.org/reference/cont.html#(form._((lib._racket/control..rkt)._reset)) |
| 23:49 | dnolen | choffstein: perhaps you can jump back to let expression and return a value you don't use? |
| 23:50 | dnolen | choffstein: but yes, it's not exactly goto. |
| 23:50 | choffstein | dnolen: hmm, maybe. |
| 23:50 | dnolen | choffstein: but I would argue, do you really need to do that? |
| 23:51 | choffstein | dnolen: well, for what I am trying to do, I do... |
| 23:51 | choffstein | dnolen: Which probably means I am going about doing this wrong :D |
| 23:51 | dnolen | choffstein: why would you want to return to a place without inserting the missing value? |
| 23:52 | choffstein | dnolen: hold on, i'll show you on github in 10 seconds |
| 23:54 | choffstein | okay, didn't quite get what I was looking for :( but here is the code anyway... https://github.com/newfoundresearch/surf |
| 23:55 | choffstein | the code is horrible, but I am just trying to use the continuations in the construct-callback function to delay potentially expensive callback calls. This way, I can put up 20 callbacks, and only actually execute the one that needs to be executed. |
| 23:56 | choffstein | The relevant lines are ~67. The program works as expected, but it doesn't seem to be delaying the callback calls ... just the redirect... |
| 23:57 | choffstein | Oh, shit, I got it |
| 23:57 | choffstein | Just had to move some lines around :D |
| 23:57 | dnolen | choffstein: cool. |
| 23:58 | choffstein | This is one of those times where I look at my code and say, "okay, it's working ... but there is no way it should be" |
| 23:58 | dnolen | choffstein: heh, yeah I would take a moment to sort that out :) Not sure why you need dosync in this code. |
| 23:59 | choffstein | because existing-callbacks is a ref that I am altering... |
| 23:59 | dnolen | choffstein: why does it need to be a ref? |
| 23:59 | choffstein | because if you go down to the 'render' implementation in the counter-component, using a ref prevents me from having to pass around new pages every time a add a call-back |