2011-11-25
| 00:07 | hhutch | can anybody remind me how to use javascript's this in clojurescript? somebody wrote a macro or something but for the life of me I can't find it again |
| 00:13 | hhutch | ah, found it, this-as |
| 01:12 | ben_m | Hi everyone :) I'm trying to use lwjgl with Clojure, but I can't seem to get everything working. I included lwjgl in project.clj (clojars), but when I try to actually import lwjgl, I get ClassNotFound errors |
| 01:13 | amalloy | you're importing the wrong class, probably |
| 01:13 | amalloy | $google lwjgl javadoc |
| 01:13 | lazybot | [LWJGL javadoc] http://lwjgl.org/javadoc/ |
| 01:13 | ben_m | Appears to be correct :/ |
| 01:14 | amalloy | ben_m: so what does your import look like? |
| 01:14 | alexbaranosky | I think I just got the lein-midje plugin to work with lazytest! |
| 01:15 | alexbaranosky | lein midje --lazytest |
| 01:15 | ben_m | Wait a second, just realized I probably can't use imports the same way in the ns macro as I do in the (import) function, checking ... |
| 01:15 | amalloy | you can, actually |
| 01:17 | ben_m | Now I get an UnsatisfiedLinkError, pasting source... |
| 01:17 | ben_m | Actually, I can take everything out but "(:import (org.lwjgl.opengl Display DisplayMode GL11))" |
| 01:17 | ben_m | Only relevant part I suppose |
| 01:18 | amalloy | uhhhhh, missing a native library maybe? not really my area anymore |
| 01:19 | ben_m | No idea ... I'll just continue googling, thanks anyways though! |
| 01:38 | ben_m | Mhh, do I need anything else to use :native-dependencies in leiningen? |
| 03:51 | ben_m | Is there a nice way call a series of static methods without having to repeat the Class everytime? |
| 03:51 | ben_m | As in (GL11/foo) (GL11/bar) (GL11/cake 1 2) |
| 03:56 | amalloy | no. you can write a simple macro for it, though |
| 03:56 | Chousuke | probably not, but if you do it often, it's easy to write a macro |
| 03:56 | Chousuke | you could probably use doto and the . form somehow, too |
| 03:56 | amalloy | Chousuke: no, actually |
| 03:57 | amalloy | &(Integer/valueOf "10") |
| 03:57 | lazybot | ⇒ 10 |
| 03:57 | amalloy | &(let [x Integer] (.valueOf x "10")) |
| 03:57 | lazybot | java.lang.IllegalArgumentException: No matching method found: valueOf for class java.lang.Class |
| 03:57 | Chousuke | I didn't mean like that. |
| 03:57 | amalloy | that's what doto is going to expand to, so...? |
| 03:58 | Chousuke | oh right it does the let internally. |
| 03:58 | ben_m | Ah, too bad |
| 03:58 | Chousuke | Why not just (-> Integer (. (foo)) ...) or something? |
| 03:58 | Chousuke | does that work |
| 03:59 | amalloy | Chousuke: works for the first call |
| 03:59 | Chousuke | I guess you'd need something like doto-> :P |
| 03:59 | amalloy | (defmacro static-calls [c & calls] (cons `do (for [arglist calls] `(. ~c ~@arglist)))) is probably enoguh? |
| 04:00 | ben_m | Smart, thanks :) |
| 04:00 | Chousuke | I really don't remember the . syntax anymore |
| 04:00 | amalloy | it's handy to have the primitive . available for macros |
| 04:00 | Chousuke | yeah it is |
| 04:01 | ben_m | That static-calls macro should be in clojure-contrib :D |
| 04:01 | Chousuke | there's little use for generating sugared forms in macros. |
| 04:01 | amalloy | blech. clojure-contrib should not contain "everything useful someone might ever need but could build themselves in thirty seconds" |
| 04:02 | Blkt | good morning everyone |
| 04:02 | amalloy | however, what you can do, and i do encourage, is create your own utilities library, put it on clojars, and then use it from your own prijects |
| 04:02 | ben_m | Morning :) |
| 04:02 | Chousuke | sometimes it's less trouble to just rewrite the same piece of code whenever you need it. |
| 04:03 | ben_m | Probably yeah :) |
| 04:05 | amalloy | for a single function that's sometimes true |
| 04:06 | amalloy | but really you'll have a lot of functions you want in several places. hence, a library on clojars |
| 08:04 | Guest68196 | hello all - again a noob question from someone with lisp-2 background concerning workflow. let say i have a data structure where i have functions. and at the client side i traverse this structure and from time to time call some of the functions. then i change the implementation of one of this functions, in lisp-2 i could have just reevaluated this function and call it over the structure... |
| 08:04 | Guest68196 | ...again and get the desired result. now - in lisp-1 i'm not sure how to do that without the need to reload everything in my datastructure before seeing the changes i did to that concerned function. an example follows: |
| 08:04 | Guest68196 | (defn x [] "hi") |
| 08:04 | Guest68196 | (def f (ref x)) |
| 08:04 | Guest68196 | (defn y [] (@f)) |
| 08:06 | Guest68196 | now - if i change x to print "bye" instead of "hi" - is there any possibility to call y and see the changes without reloading f? (in real world f is pretty big and timeconsuming to create) |
| 08:06 | raek | Guest68196: yes. instead of storing the then current value of x in the data structure, store the var x: #'x |
| 08:07 | raek | when you call a var, it will delegate the call to its current value |
| 08:07 | raek | (def m {:f #'x}) |
| 08:08 | raek | when you call (:f m), it will always use the most recent definition of x |
| 08:09 | raek | also, not this: in (defn y [] (x)) the most recent definition of x will always be used |
| 08:09 | raek | *note this |
| 08:09 | Guest68196 | raek - now it works - thank you a lot! now i'll have to reread the section about vars... didn't got that from the first reading. |
| 08:10 | raek | a var is a cell that holds a value. it is the thing that changes when you reevaluate a def form. |
| 08:17 | Guest68196 | now i found the relevant documentation, ty again, raek! |
| 09:09 | malkomalko | when using anon functions #(), I'm getting 'Wrong number of args (2)' when used as my reduce function.. this only happens if I don't use %2 in my anonymous function.. is there a way with anon functions to just take some of the params you need without receiving that error message? |
| 09:12 | raek | malkomalko: yes, use the full fn form |
| 09:12 | raek | (fn [x y] ...only use one of x and y here...) |
| 09:13 | raek | also, why are you using reduce when you are ignoring one of the args? |
| 09:13 | malkomalko | going through a 4clojure example |
| 09:18 | malkomalko | i can use the anonymous form and just throw away the variable with do I guess.. ok thanks for the help |
| 09:38 | rads | when I try to open a REPL with vimclojure using MacVim (\sr), vim freezes. however, if I try it with vim in the shell, it works fine. anyone know why? |
| 09:41 | gmcnulty | hi, can anybody here help me with an bit of code that I think is holding the head of a sequence? |
| 09:43 | bhenry | post your question and we'll find out |
| 09:44 | gmcnulty | ok, so I have a piece of code to split a sequence of strings into files of roughly x-size, the code is at http://pastebin.com/5Bw7S2Hj |
| 09:44 | gmcnulty | so when I call split-file with 4 args (so it only returns the first split) my memory profile is fine |
| 09:45 | gmcnulty | but when I call it with the 3 args, my memory goes up until everything runs very slowly (not swapping, just hit jvm xmx) |
| 09:45 | gmcnulty | when the first split finishes, memory usage goes down again and cpu runs fine until end of 2nd split etc |
| 09:46 | gmcnulty | so I'm convinced the head is being held in this bit of code: |
| 09:46 | gmcnulty | (defn split-file |
| 09:46 | gmcnulty | ([path strs split-size] |
| 09:46 | gmcnulty | (loop [ss (seq strs), part 0] |
| 09:46 | gmcnulty | (when-let [more (split-file path ss split-size part)] |
| 09:46 | gmcnulty | (recur more (inc part))))) |
| 09:46 | gmcnulty | I'm using clojure 1.3.0 |
| 09:47 | rads | nevermind, my problem with vimclojure was that my MacVim.app was symlinked to an old version rather than the latest one from homebrew |
| 10:23 | gmcnulty | hm, so if nobody can help me with my head holding seq. issue, can anybody link me somewhere that I can learn to debug it? |
| 10:48 | bhenry | gmcnulty: perhaps you can put a doc string and/or a sample of input? |
| 11:07 | gmcnulty | bhenry: http://pastebin.com/7Az7cXGa |
| 11:07 | gmcnulty | how's that look? |
| 11:10 | bhenry | gmcnulty: i'll check it out in a bit |
| 11:39 | ljos | Any one have any good ideas for how I could replace a random child in a zipper? |
| 11:43 | ljos | Or, what I want to do is replace a random node in a tree. I have been using a zipper right now to iterate through it. The tree is represented by a list. |
| 12:23 | antoineB | hello, what are the 7 core "macro"? |
| 12:23 | antoineB | set, if, ... |
| 12:24 | tolstoy | antoineB: http://clojure.org/special_forms ? |
| 12:27 | antoineB | thanks tolstoy , but i remember there were 7, and all other macro are built with them |
| 12:30 | tolstoy | antoineB: According to Paul Graham, they're: quote atom eq car cdr cons cond. |
| 12:30 | tolstoy | http://lib.store.yahoo.net/lib/paulgraham/jmc.ps |
| 12:46 | antoineB | thanks tolstoy but your first link seems to be what i want |
| 12:46 | tolstoy | Heh. Okay. |
| 12:52 | TimMc | Because of Clojure's logo, I finally got off my ass and downloaded the SICP textbooks + lectures. :-) |
| 12:52 | TimMc | (and am using them) |
| 12:52 | ejackson | TimMc: good stuff dude. |
| 12:53 | TimMc | I was explaining to someone about the yin-yang aspect of the logo and how I thought it was a reference to the eval-apply thing on SICP's cover. |
| 12:58 | TimMc | "Computer science in some sense isn't real. [...] Computer science deals with idealized components. [...] We don't have to worry about tolerance. And that means that in building a large program, thaere's not all that much difference between what I can build and what I can imagine. [...] The constraints on large software systems are the limitations of our own minds." |
| 12:58 | TimMc | *fantastic* stuff |
| 13:00 | ejackson | yeah... until that vastness lays waste tracts of your mind :P |
| 13:01 | ejackson | it is like the abys that peers back |
| 13:43 | pmooser | I don't suppose anyone here happens to be a marginalia expert? |
| 14:27 | pmooser | Marginalia's parser seems rather fragile … I'm finding that I'm frequently breaking it, but don't understand the marg code quite well enough to usefully debug it. |
| 14:27 | pmooser | It's also possible that I'm doing particularly crazy things … |
| 14:56 | reiddraper | any ideas on debugging something where the only output is: ClassCastException [trace missing] |
| 15:02 | pmooser | Do you know offhand why the stack trace is being omitted ? |
| 15:02 | reiddraper | nope, that's part of why i'm confused |
| 15:03 | pmooser | I ask because there's a condition under which hotspot will cause stack traces to be omitted from exceptions, and there's a JVM option to disable it. |
| 15:03 | pmooser | If you google for OmitStackTraceInFastThrow, you can find that information. |
| 15:03 | pmooser | I've seen that issue in our production java apps, but I'm not sure it's likely to happen if you're just interactively developing something. |
| 15:03 | reiddraper | fwiw, this is "just" lein repl |
| 15:03 | pmooser | Does the exception at least tell you what is being cast to what ? |
| 15:04 | reiddraper | no, that's the whole of the output |
| 15:04 | reiddraper | however I've changed something and now I can at least get: |
| 15:04 | reiddraper | ClassCastException clojure.lang.Keyword cannot be cast to java.util.Map$Entry clojure.lang.APersistentMap$KeySeq.first (APersistentMap.java:132) |
| 15:05 | pmooser | There you go, so at least you know what is being cast to what … |
| 15:05 | reiddraper | I have an idea of which of my clojure code could be the entry-point to that, but it doesn't make sense to me |
| 15:06 | pmooser | When does this occur - just at the repl ? |
| 15:06 | pmooser | Or are you compiling a larger file ? |
| 15:06 | reiddraper | yes, haven't tried it any other way |
| 15:06 | reiddraper | repl |
| 15:06 | pmooser | So what's the code that causes this ? |
| 15:07 | pmooser | i.e., what are you entering into the repl |
| 15:07 | reiddraper | pmooser: here's the program https://gist.github.com/2c9e46d5bd26f0779a48 |
| 15:07 | reiddraper | and at the repl i type |
| 15:09 | reiddraper | https://gist.github.com/2c9e46d5bd26f0779a48#file_repl.clj |
| 15:09 | pmooser | I can compile that code fine |
| 15:09 | pmooser | Ok, looking at your repl thing |
| 15:11 | reiddraper | pmooser: it seems to be this line in `conj`: (assoc adds k now) |
| 15:12 | reiddraper | or rather, it at least doesn't through an exception if i construct a LWW type by just calling (LWW. {} {}) there |
| 15:12 | reiddraper | s/through/throw |
| 15:13 | pmooser | Hmm … I'm getting a weird error from my slime repl when I try to conj onto your thing |
| 15:13 | pmooser | but that doesn't tell us anything interesting unfortunately |
| 15:14 | reiddraper | pmooser: thanks for helping btw |
| 15:14 | pmooser | No problem, I don't mind trying at least |
| 15:16 | reiddraper | so if I just make this call: (assoc adds k :foo) |
| 15:16 | reiddraper | before the LWW constructor, it does not throw an exception |
| 15:18 | pmooser | hmmm |
| 15:19 | reiddraper | but if I just replace L36 in that gist with "adds", no exception either |
| 15:20 | fliebel | Which parts of Java doe Clojure need to run? |
| 15:22 | pmooser | I'm having a hard time even testing this, reid, due to some peculiarity of my repl environment |
| 15:22 | pmooser | Even evaluating simple expressions creating LWWs in my repl is hanging with an error |
| 15:23 | pmooser | It may be that I'm having a more general deftype issue or something |
| 15:23 | pmooser | but i don't think it's particular to your code |
| 15:23 | pmooser | (my errors are not, that is) |
| 15:24 | reiddraper | pmooser: clojure 1.3.0? |
| 15:24 | reiddraper | that's what i'm using fwiw |
| 15:24 | pmooser | Yeah, 1.3.0 |
| 15:27 | pmooser | I did not realize you could do what you are doing with java.util.Set there. |
| 15:28 | reiddraper | pmooser: maybe you can't :), haha |
| 15:28 | pmooser | Yeah, I'm not sure what the semantics of it would be. |
| 15:28 | pmooser | I know in deftype you can provide overrides of methods on Object |
| 15:29 | pmooser | But I have no idea what it means if you pass in arbitrary classes (as opposed to interfaces or protocols) |
| 15:29 | reiddraper | well as i understand, java.util.Set is a java interface, not a class |
| 15:29 | reiddraper | so that's why it *should* work |
| 15:29 | reiddraper | pmooser: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/class-use/Set.html |
| 15:29 | pmooser | Sorry, you're absolutely right |
| 15:30 | reiddraper | np |
| 15:30 | pmooser | I was thinking HashSet |
| 15:31 | pmooser | I'm still trying to figure out what precisely about your definition is freaking out my repl |
| 15:33 | reiddraper | pmooser: i can add you in the whole github project if you want to just try lein repl in the root dir |
| 15:35 | pmooser | I'm going to have to leave the cafe I am in shortly, but I am trying a few other things … |
| 15:35 | reiddraper | ok, I appreciate your help either way :) |
| 15:36 | pmooser | The definition of seq is what is freaking out my repl |
| 15:36 | pmooser | I'm not sure why yet |
| 15:37 | reiddraper | pmooser: aha, that might be the problem actually! |
| 15:37 | pmooser | Yeah, I'm looking at your code for minus-deletes now |
| 15:38 | pmooser | Did you find an underlying issue ? |
| 15:38 | reiddraper | i think, one moment |
| 15:38 | reiddraper | yes, so the (keys minus-deletes...) call should just be (minus-deletes) |
| 15:39 | reiddraper | and I'm guessing that maybe seq gets called on the obj trying to print it at the repl, or something |
| 15:39 | reiddraper | so the cons call was fine, and if nothing got added to the set, seq would just return nil |
| 15:39 | pmooser | So does it work for you now then ? |
| 15:40 | reiddraper | it seems so |
| 15:40 | reiddraper | thanks again for your help pmooser |
| 15:40 | pmooser | Yes, it looks like it fixed it for me as well |
| 15:40 | pmooser | Glad to be of assistance, and sorry again for the false alarm about java.util.Set |
| 15:41 | pmooser | See you later ! |
| 15:41 | reiddraper | you too, thanks |
| 16:03 | technomancy | woo; got a patch together for http://dev.clojure.org/jira/browse/CLJ-879 |
| 16:04 | technomancy | man, is there a way to turn off jira's stupid "hey bro, looks like you just posted a comment! here it is in case you forgot: [...]" emails? |
| 16:05 | AWizzArd | One can configure the email settings of Jira. |
| 16:05 | AWizzArd | In my first install I was informed about every event, which meant a trillion of mails per time unit. |
| 16:08 | technomancy | this is a feature whose only use case applies to chronic amnesiacs. |
| 16:08 | technomancy | that's taking accessibility to a whole new level, I guess. |
| 16:10 | AWizzArd | This is partly meant for people who use their email client as the UI for Jira, and who also comment or open issues via email. |
| 16:11 | technomancy | for your _own_ comments though? I dunno. |
| 16:11 | AWizzArd | Maybe to comment your comments… (: |
| 16:12 | AWizzArd | technomancy: please have a look at your private query windows. |
| 16:19 | devn | technomancy: i don't get jira email |
| 16:20 | technomancy | devn: are you sure you didn't just dev/null it one day in a fit of rage and forget about it? =) |
| 16:20 | devn | technomancy: i was actually just wondering whether or not I did that. :) |
| 16:22 | devn | technomancy: but no, I'm pretty certain I didn't do a giant purge of subscriptions in the last couple years -- I've been pretty jucicious ever since The Great Junk Inbox of 2007 |
| 16:30 | choffstein | Hey all. I have a quick question. Is there a function similar to ->, but instead of threading a value into different functions, it threads a function across multiple values? So, for example, let's say I have (defn adder [x] (fn [y] (fn [z] (+ x y z)))), instead of calling (((adder 1) 2) 3), I can call (??? adder 1 2 3) ? |
| 16:34 | hiredman | so, like, reduce? |
| 16:34 | choffstein | …no |
| 16:35 | choffstein | Well … maybe |
| 16:35 | choffstein | Basically, I have a function that keeps returning functions |
| 16:35 | choffstein | That I want to pass values into |
| 16:35 | hiredman | ,(reduce #(%1 %2) (fn [a] (fn [b] (fn [c] (+ a b c)))) [1 2 3]) |
| 16:35 | clojurebot | 6 |
| 16:36 | dakrone | choffstein: auto-currying? |
| 16:36 | dakrone | sort of |
| 16:36 | choffstein | Yeah, sort of |
| 16:37 | choffstein | (this is more of an intellectual curiosity more than anything) |
| 16:47 | choffstein | I guess I could just take that reduce and turn it into a simple macro, huh hiredman? |
| 16:57 | choffstein | Okay, I'm horrible with macros. Any idea why this works: (defn auto-curry [fn & args] (reduce #(%1 %2) fn args)) (auto-curry adder 1 2 3), but this doesn't: (defmacro auto-curry [fn & args] `(reduce #(%1 %2) fn args)) (auto-curry adder 1 2 3). |
| 16:58 | amalloy | choffstein: you forgot some ~ thingies |
| 16:58 | choffstein | …stupid, stupid, stupid |
| 16:58 | amalloy | probably ~fn ~@args |
| 16:58 | choffstein | right. no, just forgot to add that into IRC. Have that in my code. |
| 16:58 | amalloy | okay |
| 16:59 | amalloy | so f here is expected to be a curried function already, and you're applying it by "uncurrying" it? |
| 16:59 | choffstein | I thought ~@ spliced the array. With reduce, I think I want to keep the args as an array |
| 16:59 | amalloy | yes, so you do. i was just noticing that |
| 17:00 | choffstein | Yeah. Basically, instead of calling (((curried-fn 1) 2) 3) I can called (uncurry curried-fn 1 2 3) or something like that |
| 17:00 | amalloy | so let me guess, you're getting an exception about casting a non-function to a function? |
| 17:00 | choffstein | You're a genius ;) |
| 17:00 | amalloy | replace ~args with ~(vec args) |
| 17:01 | choffstein | ... |
| 17:01 | choffstein | That worked |
| 17:01 | amalloy | the problem is that the macro's return value is executed as code, and & args prints as a seq, ie (x y z) |
| 17:01 | amalloy | if you want it to print as a collection, you need it to look like [x y z] |
| 17:01 | choffstein | Oohhh |
| 17:02 | choffstein | So, style question here: what would be preferred: making this a macro or just a function? |
| 17:02 | amalloy | function for sure |
| 17:02 | amalloy | you could consider making a macro to create a curried function from a normal function, but there's no need for a macro just to call reduce |
| 17:03 | choffstein | So, it seems to me like -> could be implemented as a recursive function. Why implement it as a macr? |
| 17:04 | amalloy | your premise is false |
| 17:04 | hiredman | how could you implement it as a function? |
| 17:04 | hiredman | ,(-> [a (range 10)] (for a)) |
| 17:04 | clojurebot | (0 1 2 3 4 ...) |
| 17:05 | choffstein | ...right |
| 17:05 | choffstein | just kidding. |
| 17:05 | choffstein | I forgot about the nicety that not all the functions are partials. |
| 17:05 | hiredman | huh? |
| 17:06 | choffstein | Sorry -- in my mind I was thinking ->>, not -> |
| 17:06 | hiredman | ,(->> a (for [a (range 10)])) |
| 17:06 | clojurebot | (0 1 2 3 4 ...) |
| 17:06 | hiredman | how could you rewrite either as a function? |
| 17:06 | choffstein | Right. You can't. |
| 17:08 | choffstein | I was just thinking if you had a list of partial functions that you just needed to apply a value to, you could implement it as some sort of recursive function |
| 17:08 | choffstein | but that's not what -> or ->> does |
| 17:09 | choffstein | (don't mind me -- I'm just being an idiot) |
| 17:11 | amalloy | so choffstein, just for fun here's a primitive not-very-good macro to create a curried function from a normal one: https://gist.github.com/1394517 |
| 17:11 | choffstein | Cool. I'll take a look. Thanks :) |
| 17:18 | amalloy | oh god. i never should have mentioned xmlns on clojure-dev, apparently. people are going nuts |
| 18:01 | miltondsilva | does recursiveness(specially from multiple points) complects data structure creation(trees) with their manipulation? |
| 18:09 | lucian | miltondsilva: i'm sure one could define an API for manipulating cyclic graphs |
| 18:12 | miltondsilva | are you a mind reader? :P actually I'm doing some work on that.. but I'm not sure it will become an API... still how do you link cyclic graphs with my question? |
| 18:12 | miltondsilva | a full API* |
| 18:16 | miltondsilva | on interesting idea I still didn't explore much but seem interesting is defining most graph operations with the aid of core.logic... maybe define graphs as relations and then define some set of constrains e.g. a path-> constrain 1 : begins on node S and ends on T, constrain2 : no repeated nodes |
| 18:23 | drks | hello. how to get convert '(\a \b \c) to "abc"? |
| 18:23 | duck1123 | (apply str |
| 18:24 | drks | thanks. how does that work though? I assumed I would get '("a" "b" "c") |
| 18:25 | amalloy | that would be (map str |
| 18:25 | duck1123 | (apply str '(\a \b \c)) is the same as (str \a \b \c) |
| 18:25 | drks | right, not thinking clearly |
| 18:52 | tolstoy | I'm running autodoc standalone in the root of my lein project, but it keeps giving me class not found exceptions for the files it clearly found. Anyone know what's up? |
| 18:55 | tolstoy | Alas, I've never been able to get autodoc to work in any context. Can't even install it under current clojure (1.3) and lein (1.6.2). |
| 18:55 | cgray` | is something like https://gist.github.com/1394690 in a standard clojure library? |
| 19:03 | amalloy | cgray`: looks like a special case of clojure.walk/prewalk-replace |
| 19:05 | amalloy | (prewalk-replace #(if (do-update? %) (how-to-update %) %) root). or if you want to pull in the `useful` library, you can write (prewalk-replace (to-fix do-update? how-to-update) root) |
| 19:07 | cgray` | amalloy: cool, it's a useful little function, so i thought i'd see if it's there... it doesn't surprise me that it is :) |
| 19:08 | cgray` | amalloy: from the docstring to prewalk-replace, it's a bit hard to see that your function would work, but it clearly does |
| 19:10 | cgray` | amalloy: i guess it's really more like prewalk than prewalk-replace |
| 19:10 | amalloy | it just replaces x at each layer with (f x). i gave it an f that says: "if you should change it, then change it, otherwise leave it alone" |
| 19:11 | amalloy | which is what you're doing, except that you don't walk the replaced element |
| 19:11 | cgray` | amalloy: yep, i get that. the fact that it talks about a map rather than a fn is what was throwing me off. |
| 19:12 | amalloy | haha wow, so it does |
| 19:12 | amalloy | that is a terrible docstring |
| 19:13 | cgray` | well you meant clojure.walk/prewalk :) |
| 19:15 | amalloy | yeah. does it actually work with prewalk-replace? it doesn't seem like it should |
| 19:15 | cgray` | no, prewalk-replace has a contains? |
| 19:19 | amalloy | incidentally, prewalk-replace would be better written as (prewalk (fn [x] (smap x x)) form). shorter, clearer, and faster |
| 19:38 | tolstoy | Is autodoc even currently maintained? Marginalia works great, but it's not so good at a simple API doc. |
| 19:51 | drks | how well does clojure work with slime? is this a commonly used environment? |
| 19:51 | cgray` | drks: it works well once you get it set up. |
| 19:53 | cgray` | i find the setup the easiest with emacs 24, so if you don't have that yet, you might want to upgrade |
| 19:53 | amalloy | drks: clojure works quite well with slime, though not as well as some other lisps (eg CL) |
| 19:54 | erider | works with vim too ;0 |
| 19:55 | amalloy | for example we don't get slime-who-calls, and you don't have as many options after an exception as CL does after a condition |
| 19:56 | cgray` | is there any work on getting locals in the stacktraces? that would be my number one wishlist feature... |
| 19:57 | amalloy | cgray`: i think that's probably something that will get into one of the "less lean" builds that rich was talking about at the conj. but hugod and gjahad surely know more than i do; maybe one of them's already done it |
| 19:59 | mark1 | Is there an update-in that works with multiple [k & ks]? |
| 19:59 | mark1 | Something like https://gist.github.com/1394768? |
| 20:00 | cgray` | mark1: (-> entity (update-in foo bar) (update-in baz quux))) |
| 20:01 | mark1 | cgray`: Ahh, seems obvious now! |
| 20:01 | mark1 | Thanks! |
| 20:33 | seancorfield | is there a "modern" equivalent to clojure.contrib.repl-utils/show? |
| 20:33 | amalloy | seancorfield: the slime inspector! |
| 20:33 | amalloy | C-c I (capital i), then an expression |
| 20:35 | seancorfield | what about for someone using a regular repl? |
| 20:35 | amalloy | *shrug* afaik show was not ported to 1.3. you can write a barebones version fairly quickly with reflection |
| 20:36 | drks | amalloy sorry was away. in what way doesn't it work as well with it as CL? |
| 20:36 | seancorfield | 'kthx |
| 20:37 | drks | anything else besides slime-who-calls and exceptions |
| 20:37 | amalloy | i'm not going to exhaustively list every feature that slime-cl has |
| 20:37 | amalloy | i don't even use CL, i just happen to know it has some better toys than we do |
| 20:38 | drks | ok. I'm just curious are there any technical reasons clojure doesn't have these |
| 20:38 | drks | or it's just a matter of them not being implemented yet |
| 20:38 | amalloy | it's just work to implement them swank-side. some of them are basically impossible on the jvm, like condition restarts |
| 20:57 | seancorfield | clojure.reflect/reflect looks like a good replacement for c.c.repl-utils/show, no? |
| 21:00 | amalloy | dunno, i've never looked at it. if it does what you want, you don't need my approval to use it :) |
| 21:01 | seancorfield | arohner: i'm trying to use lein-test-out 0.1.1 but it doesn't seem to be working... what's the latest version of lein it's been tested with? |
| 21:02 | arohner | seancorfield: oh, it's been a while. Probably lein 1.4.2 |
| 21:03 | seancorfield | ah, ok, i'm on lein 1.6.2... i think it worked with lein 1.5.x but i can't remember when i last tried it... |
| 21:03 | arohner | seancorfield: I actually need it to work too, soon. I'll see if I can get it working next week |
| 21:03 | arohner | and I'm happy to take patches if you get it working sooner |
| 21:04 | seancorfield | i'll see what the priorities are at world singles next week... |
| 21:04 | seancorfield | i have a high priority ticket around a new type of profile search but if i get that out of the way early on, i may have time to jump on lein-test-out next week |
| 21:05 | seancorfield | i'll clone it and bump the priority of the ticket (at world singles) for integrating our clojure unit tests with hudson etc |
| 21:20 | drks | is there a function like + that can sum chars or should I write my own? (char+ \0 1) => \1 |
| 21:23 | amalloy | i doubt if you want to sum chars. you probably want to add ints to them |
| 21:24 | amalloy | anyway, the answer is that java wishes you wouldn't treat characters as numbers, so if you want to you have to convert to int first: ##(+ (int \0) 1) |
| 21:24 | lazybot | ⇒ 49 |
| 21:24 | amalloy | &(char (+ (int \0) 1)) |
| 21:24 | lazybot | ⇒ \1 |
| 21:30 | drks | thanks |
| 21:43 | seancorfield | arohner: looks like something changed in eval-in-project and that's what has broken test-out |
| 21:49 | seancorfield | arohner: i have it generating junit XML again (yay!) but i haven't figured out how to use that with ant's junit report task (which means i'm about back where i was with test-out and lein 1.5.x so that's "ok") |
| 21:51 | lonstein | fiddling with clojurescript, cljsc compiles my src but in the browser it errors that subvec is undefined... |
| 21:52 | lonstein | are portions of clojure.core unimplemented? |
| 21:59 | seancorfield | arohner: sent you a pull request - not sure if it preserves the original semantics but it seems to "work"... i now need to do more work on my end to get the output transformed by ant (i think!) |
| 21:59 | seancorfield | lonstein: right, not all of clojure.core is implemented yet |
| 22:00 | lonstein | seancorfield: yeah, ok. skimming the src/. drat. |
| 22:06 | lonstein | I suppose I could rewrite it in terms of take |
| 22:19 | seancorfield | if you have a CA on file, you could write subvec and contribute it :) |
| 23:20 | lonstein | rewrote it in terms of split-at... also figured out a bit of interop. nice. |
| 23:23 | amalloy | i just put together a quick cljs subvec, but i don't actually know how to run cljs to test it. seancorfield, lonstein: any pointers? |
| 23:25 | Raynes | amalloy: https://github.com/clojure/clojurescript/wiki/Quick-Start |
| 23:30 | amalloy | thanks. nice to see it works without a hitch now; last time i tried it wasn't working on openjdk yet |
| 23:57 | amalloy | what about running cljs tests? ./script/test churns for a while and then exits without printing anything, even if i add (assert false) to cljs.core-test |