2012-01-10
| 01:59 | adiabatic | If I'm trying to figure out how to make (require 'clojure.string) work inside of a fn, does that mean I'm getting way off track on http://www.4clojure.com/problem/29 (filter all non-capital-letters out of a string)? |
| 02:04 | tufflax | adiabatic i don't know if that's possible, but probably the easiest way to do it is something with regular expressions |
| 02:04 | tufflax | ...maybe :p |
| 02:05 | adiabatic | I got an idea to do something with reduce that isn't + or *. Now I need to get the "is capital letter" bit working again… |
| 02:07 | tufflax | adiabatic take a look at this, should work pretty well http://clojuredocs.org/clojure_core/clojure.core/re-seq |
| 02:10 | tufflax | adiabatic at least that's what I would use. Some re-thing could be made to do the "is capital letter" fn |
| 02:17 | tufflax | adiabatic is it working out? :p |
| 02:17 | adiabatic | All the other things that I thought would be simpler aren't. Trying it now… |
| 02:17 | tufflax | hehe |
| 02:21 | adiabatic | (fn caps [s] (reduce str (re-seq #"[A-Z]" s))) ; jwz was wrong this time, |
| 02:21 | adiabatic | s/,// |
| 02:22 | Raynes | &(.isUpperCase \A) |
| 02:22 | lazybot | java.lang.IllegalArgumentException: No matching field found: isUpperCase for class java.lang.Character |
| 02:22 | adiabatic | Turns out the overwhelming majority of the useful methods for java.lang.Character are static |
| 02:22 | adiabatic | and I never figured out how to call them |
| 02:22 | Raynes | &(Character/isUpperCase \A) |
| 02:22 | lazybot | ⇒ true |
| 02:22 | tufflax | I'd to it like this #(apply str (re-seq #"[A-Z]" %)) |
| 02:23 | Raynes | Hahaha. |
| 02:23 | Raynes | So you resorted to regex over figuring out how to call static methods? |
| 02:24 | tufflax | I kind of suggested that he should, I just looked at the String class and didn't find anything useful :P |
| 02:24 | Raynes | :) |
| 02:25 | adiabatic | if tufflax's hint hadn't been staring me in the face I probably would have |
| 02:28 | tufflax | Raynes maybe you could answer this too: can/should one use require etc inside fns and such? I can't imagine where one'd want to... |
| 02:29 | Raynes | No. There is generally never a good reason to do that. |
| 02:29 | Raynes | Only under very special circumstances. |
| 02:29 | amalloy | tufflax: it's like jumping off a cliff. you generally shouldn't do it, but if you're in a big hurry to get to the bottom... |
| 02:29 | tufflax | hehe |
| 02:29 | Raynes | Smooth. |
| 02:38 | adiabatic | There isn't a relative of concat that adds just one item to the 'end' of a seq, is there? |
| 02:40 | nickmbailey | conj? |
| 02:40 | clojurebot | (conj {:a 1} (when true {:b 2})) |
| 02:41 | G0SUB | adiabatic: `end` of a seq? that's an O(n) operation. you might just use concat for that. |
| 02:42 | amalloy | adiabatic: re your earlier adventures with scoping: in (let [x 1] (loop [x x] ...)), the [x x] only contains one symbol that's evaluated |
| 02:42 | amalloy | the first x creates a new local named x, entirely unrelated to the x in the outer scope; the second x causes this new local's initial value to be the value of x in the outer scope (since its initializer is, necessarily, evaluated before the new x enters scope) |
| 02:42 | adiabatic | amalloy: I figured that's how it worked because my function wouldn't have worked otherwise |
| 02:44 | adiabatic | G0SUB: well, since it is O(n), having it be clunky and ugly is probably the better option…but (concat coll [x]) still seems silly |
| 02:44 | amalloy | adiabatic: if it's a vector, conj is what you want |
| 02:45 | adiabatic | I'm doing http://www.4clojure.com/problem/30. vector…icity isn't guaranteed. |
| 02:45 | amalloy | for a general collection, adding to the end is generally not very nice, so i sorta support it being inconvenient |
| 02:45 | amalloy | &(let [coll '(1 2 3)] `(~@coll 4)) ;; this is another option |
| 02:45 | lazybot | ⇒ (1 2 3 4) |
| 02:46 | G0SUB | heh |
| 02:46 | amalloy | one of the neatest things i learned from 4clojure is some creative ways to abuse ` outside of macros |
| 03:29 | Blkt | good morning everyone |
| 03:29 | jowag | good morning |
| 03:29 | kedoodek | good morning! |
| 03:29 | kedoodek | though in what time zone? |
| 03:29 | kedoodek | it's jus past midnight here in cali |
| 03:29 | Blkt | :D |
| 03:29 | jowag | I'm in CET |
| 03:36 | frankvilhelmsen_ | good morning (UTC time) |
| 03:39 | kral | morning |
| 03:53 | amalloy | kedoodek: it's morning in UGT |
| 03:53 | amalloy | $google universal greeting time irc |
| 03:53 | lazybot | [UGT] http://thinkmoult.com/ugt.html |
| 03:55 | Fossi | that's a nice concept :) |
| 04:10 | kedoodek | haha |
| 04:15 | kral | sorry, never thought about different timezones :) |
| 04:15 | Fossi | kral: that wasn't directed at you :) |
| 04:15 | Fossi | your greeting was pretty ugt conform ;) |
| 06:59 | casperc | I am having a bit of a problem getting gen-class to work |
| 07:00 | casperc | when I run the following (ns some.Example (:gen-class)) and then (some.Example.) I get a CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: some.Example |
| 07:01 | casperc | any tips on why this is not working? This is a direct copy from some tutorial site, so I have no idea why this is messing up |
| 07:09 | raek | casperc: evaluating the ns form is not enough (see the docs for 'gen-class'). you also need to perform ahead of time compilation of the namespace |
| 07:09 | raek | for example via lein compile |
| 07:10 | raek | (lein help compile) |
| 10:39 | dak__ | hi@all |
| 10:39 | dak__ | have smb used clojuratica with clojure 1.3 with Wolfram Math 8? |
| 10:40 | dak__ | it's serious |
| 10:41 | dak__ | joly, have you used WM8 + clojure1.3 + clojuratica ? |
| 10:42 | Vinzent | dak__, it'd be better if you ask the actual question |
| 10:43 | joly | I have used clojure 1.3; no idea on the other two |
| 10:44 | dak__ | Vinzent, ok, i think problem with ^:dynamic for varibales that defined in clojuratica |
| 10:45 | dak__ | i'm new in clojure after common lisp, so it's have a lot of java-specific things |
| 10:46 | Vinzent | dak__, https://github.com/gasc/Clojuratica - looks like it wasn't updated for 2 years |
| 10:46 | noidi | hmm.. I just noticed that my keywords are no longer highlighted in clojure-mode |
| 10:46 | noidi | has this changed at some point, or is my emacs broken :) |
| 10:47 | noidi | ah, the issue might be in the color theme as well, gotta check that next |
| 10:48 | noidi | yup, that's it |
| 10:54 | dak__ | Vinzent, yes, it's true, but it's too small proj - simply bindings for java api of wolf mathematica... in some moments i will try clojure 1.2 |
| 10:55 | Vinzent | dak__, you can fork it and make 1.3-compatible. That would be cool :) |
| 10:58 | pandeiro | Is there a way to create a new type that encompasses a previously defined type and changes one or two method definitions? |
| 10:58 | dak__ | yep, |
| 10:58 | dak__ | pandeiro, "yes" for Vinzent ) |
| 10:59 | pandeiro | dak__: i figured :) |
| 10:59 | pandeiro | ...but i hope you're right :) |
| 10:59 | TimMc | pandeiro: Do you mean subclassing concrete classes or overriding multimethods for a subtype? |
| 11:01 | dak__ | oh, cljouratica still works with clojure-1.2 and WM8 |
| 11:02 | TimMc | You could probably make it compatible with both. |
| 11:04 | pandeiro | TimMc: I'm not sure... sorry I am still learning about interfaces and protocols... it is a deftype statement from a different piece of code, and I want to implement something very similar but with one method defined differently - just wondering if I need to copy all that code, or if I can use some kind of inheritance |
| 11:05 | pandeiro | (I am unclear if a deftype statement creates a "concrete class"... it does, right?) |
| 11:05 | TimMc | It does |
| 11:05 | pandeiro | So I want to subclass a concrete class, ahem |
| 11:05 | TimMc | Clojure really tries to get away from subclassing concrete classes, but you gotta do what ya gotta do. |
| 11:06 | pandeiro | I see... would reify help me here at all? |
| 11:06 | TimMc | I'm not sure. reify, proxy, deftype... something in there. |
| 11:08 | pandeiro | ok I guess I will just repl away at it |
| 11:10 | AWizzArd | pandeiro: you can use proxy, which should work for most cases. |
| 11:10 | AWizzArd | But there are limitations for protected methods. |
| 11:12 | raek | pandeiro: extend takes the methods as a map from keywords to functions. you can store the "base map" somewhere and then do (extend FooType SomeProto base-map) (extend BarType SomeProto (assoc base-map :method1 (fn ...) :method2 (fn ...))) |
| 11:14 | raek | pandeiro: clojure does not endorse subclassing concrete classes, but there is probably another way of solving the problem. |
| 11:15 | pandeiro | raek: thanks yes i'm seeing that i am swimming against the current with this... i am going to look at solving this at the protocol level instead |
| 11:15 | pandeiro | AWizzArd: thanks for the tip re: proxy, too |
| 11:15 | tscheibl | damn... clojureql, korma, carte or clj-record? ...that's the question... |
| 11:16 | raek | pandeiro: can you tell us about the situation where you need to define a new type that changes a method? |
| 11:16 | Vinzent | tscheibl, what's the carte> |
| 11:16 | Vinzent | *? |
| 11:16 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack> |
| 11:16 | tscheibl | https://github.com/brentonashworth/carte |
| 11:17 | raek | (e.g. if it is like in InputStream where you have a lot of convenience methods that all call one abstract method that the subclasses is supposed to implement) |
| 11:17 | tscheibl | Vinzent: a database dsl like korma or clj-record... |
| 11:17 | pandeiro | raek: yes I am actually trying to implement something mentioned here: https://gist.github.com/1485920 |
| 11:18 | raek | pandeiro: a rule of thumb: only put the functions that actually are polymorphic in the protocol. the other ones can be implemented as ordinary functions that call the protocol methods. |
| 11:18 | raek | no need to put them in" the protocol |
| 11:18 | Vinzent | tscheibl, never heard of it, thanks. But I'd choose between clojureql and korma, according to what you need |
| 11:19 | pandeiro | raek: in the linked example, a couchdb "view" represents an object very similar to a couchdb, except the seq would be built from a different uri |
| 11:19 | tscheibl | Vinzent: what about clj-record? It's activiely developed... |
| 11:19 | pandeiro | so what i was hoping to do was just 'inherit' all of CouchDB's implementation, and overwrite seq |
| 11:21 | tscheibl | Vinzent: ok :) that's clj-records problem: For the time being, the primary key column of the table must be named ‘id’. |
| 11:21 | raek | pandeiro: is the implementation of seqable the only difference? |
| 11:21 | tscheibl | don't like that kind of restrictions |
| 11:22 | Vinzent | tscheibl, I haven't use it, but I thought it's part of some web framework... Cascade, if I recall correctly |
| 11:22 | tscheibl | COnjure |
| 11:22 | Vinzent | ah, right! |
| 11:23 | pandeiro | raek: yes |
| 11:24 | tscheibl | Vinzent: hmm I'll propably go for Lobos (DDL) and Korma next time .. if only Korma would support recursive queries :( |
| 11:24 | raek | pandeiro: then you probably want to use extend + a map (chech the extend docs) |
| 11:25 | pandeiro | raek: ok, yeah i was looking at it but i couldn't understand if it created a new type or not |
| 11:25 | raek | pandeiro: proxy is not really a solution here since it works with Java concepts (interfaces and classes) and not Clojure ones (protocols and types) |
| 11:25 | Vinzent | tscheibl, but korma generates db scheme itself, no? |
| 11:25 | tscheibl | Vinzent: don't think so |
| 11:25 | pandeiro | Vinzent: nope |
| 11:26 | raek | pandeiro: no, it doesn't. remember that types, protocols, and implementations of protocols can be specified completely separately |
| 11:26 | pandeiro | I think ibdknox is working on adding that to it eventually though, i asked him a while back |
| 11:26 | tscheibl | Vinzent: Lobos looks quite interesting for that purpose |
| 11:26 | tscheibl | it supports quite some DBs |
| 11:26 | raek | (deftype Foo [x y z] Proto ...) is an optimized shortcut for (deftype Foo [x y z]) (extend Foo Proto ...) |
| 11:27 | tscheibl | pandeiro: If' he did that I would be his biggest fan :) |
| 11:28 | raek | (deftype has some additional feature too, though. for example x, y, and z will be bound in the method bodies) |
| 11:28 | tscheibl | pandeiro: I've adapted clojureql for that purpose in the meantime using modified code from bendlas |
| 11:28 | pandeiro | raek: gotcha... gonna take me a while to wrap my head around this and figure out what i am really trying to do... but much thanks for the explanations |
| 11:29 | Vinzent | pandeiro, then maybe I've heard that there is plans to implement it and because of it thiught that it's implemented already :) |
| 11:29 | Vinzent | tscheibl, yeah lobos is cool |
| 11:29 | pandeiro | tscheibl: yeah I was very close to using clj-record or korma for my current project, but decided to stick with Couch |
| 11:32 | tscheibl | pandeiro: apache couchdb or the commercial couchbase branch? |
| 11:34 | pandeiro | tscheibl: apache |
| 11:35 | tscheibl | I was really excited by starting off my current project using OrientDB in Graph mode.. but couldn't cope with fixing the many bugs it contained after weeks of struggling with it... |
| 11:35 | tscheibl | although I really like the graph abstraction |
| 11:36 | pandeiro | tscheibl: not sure if you like couchdb or not but I think the abstractions cemerick came up with here are very cool: https://gist.github.com/1485920 |
| 11:36 | pandeiro | admit i know nothing about graph databases... have about 7 other rabbitholes i need to fall down first |
| 11:36 | tscheibl | pandeiro: some 2 years ago I've used CouchDB in a project and really liked it but haven't used it since... |
| 11:37 | tscheibl | I'll take a look at cemericks stuff :) |
| 12:01 | johncourtland | hi everyone, i'm working on a macro that constructs a defprotocol/deftype pair, and i'm having a pretty hard time figuring out how to put type annotations on the deftype methods. |
| 13:02 | pandeiro | cemerick: https://gist.github.com/1565537 - very feeble attempt to add views to your CouchDB type, curious your opinion of the semantics |
| 13:05 | cemerick | back in a sec |
| 13:07 | cemerick | Sorry, colloquy was flipping out. |
| 13:08 | cemerick | pandeiro: why add-view? |
| 13:08 | pandeiro | cemerick: sugar? |
| 13:08 | pandeiro | i really wasn't sure how to try to implement it |
| 13:08 | cemerick | that is, why not (get-view db design-doc view-name opts)? |
| 13:08 | cemerick | It all ends up calling through to clutch's get-view anyway |
| 13:09 | pandeiro | right, so i guess i wanted to ask you how you planned to include views since that was your first bulletpoint |
| 13:09 | cemerick | Or, are you trying to set up a db value that has all of the view config stuff set up once? |
| 13:10 | pandeiro | cemerick: tbh i'm not really sure what i was going for... i liked the CouchDB type abstraction but I wanted to be able to iterate over different views easily |
| 13:10 | pandeiro | i guess the CouchView protocol doesn't really save much work though in that regard, as opposed to (get-view ...) |
| 13:11 | cemerick | Looking at your usage, it seems you'd want to be able to define the different views you're going to be using, perhaps each with different query defaults, etc. |
| 13:11 | cemerick | Then be able to say (view db :name-of-your-configured-view {:additional :opts}) |
| 13:11 | pandeiro | yeah, that is the basic use case... some descending, some limit, etc |
| 13:12 | cemerick | Some more Clojuresque view introspection and such would be nice, too. |
| 13:12 | pandeiro | right, that's what i wanted to get your opinion on |
| 13:12 | pandeiro | what would be the way to think about views |
| 13:12 | cemerick | (list-views db) and (list-views db "_design/foo") could list all and just one ddoc's views, etc. |
| 13:13 | zakwilson | I have an app that uses swank and is AOT-compiled as a jar. It starts swank on startup. Sometimes, a while after loading new code through swank, I'll get random NoClassDefFoundErrors. |
| 13:14 | cemerick | I think it's perfectly reasonable to be able to define "named views" (bad term) on a CouchDB instance. Especially on views where you have one set of query params for reduce=true and one for reduce=false, (same with group), it's surely common to have multiple logical views springing from a single ddoc/view-name combination. |
| 13:15 | pandeiro | right, maybe even a view shortcut that takes a param? ie for pagination purposes with skip? |
| 13:15 | pandeiro | maybe that's too much, just brainstorming |
| 13:15 | pandeiro | i guess the goal is to reduce the amount of boilerplate stuff |
| 13:17 | cemerick | right |
| 13:17 | pandeiro | cemerick: one other question - at what point (if any) do you think a db would be too large to load into an object like the CouchDB type does? |
| 13:18 | cemerick | the CouchDB type doesn't retain any data at all |
| 13:18 | cemerick | it's just a more convenient abstraction than com.ashafa.clutch |
| 13:18 | pandeiro | So it gets the seq each time I do (count...) etc? |
| 13:18 | cemerick | (count db) uses the database metadata — that's a very small call. |
| 13:18 | pandeiro | Ah ok of course |
| 13:18 | cemerick | If you seq over a very large database, well, that's a full table scan :-) |
| 13:19 | cemerick | "table scan" |
| 13:19 | unlink | Reading through many clojure projects, I've found that many library developers structure the extension points of their APIs as application specific macros (e.g. defroute, defsynth, deftemplate, etc.), where other programming languages might use interfaces, monads, or classes. I prefer to avoid macros on general principle. What are some popular alternatives for expressing complex APIs in Clojure? |
| 13:20 | cemerick | I guess one of the hazards of a type like that is that it gives people the opportunity to think that something clever is going on re: caching, when it's really just a higher-level API |
| 13:20 | cemerick | ;-) |
| 13:20 | cemerick | pandeiro: so what would have kept you from thinking something more clever was going on? |
| 13:21 | pandeiro | knowing where to look for the implementation details of the different clojure protocols |
| 13:21 | cemerick | you mean conj, assoc, etc? Those aren't protocols (yet). |
| 13:22 | pandeiro | clojure.lang.ILookup for instance |
| 13:22 | pandeiro | I had never seen this valAt thing |
| 13:23 | Vinzent | cemerick, so they will be? |
| 13:23 | cemerick | pandeiro: the atlas provides a decent way to browse / discover these sorts of things, FWIW. |
| 13:24 | cemerick | Vinzent: who knows. Maybe, hopefully someday. |
| 13:24 | pandeiro | cemerick: i will check it out, thanks... gotta run but i will keep going at this and try not to bother you too much about it :) cheers |
| 13:24 | cemerick | pandeiro: no worries, I like getting the feedback/ideas. :-) |
| 13:24 | TimMc | unlink: Usually (I hope) each API macro is backed by a function or two that can be composed to the user's desire. |
| 13:28 | unlink | TimMc: Yes, although often one wants to express a more declarative or rich API than a single function. For example, there might be qualitatively different events the library might want to call you back on, or instance-global configuration which affects the behavior of your callbacks (e.g. what events to subscribe to). It would be nice to expose this and not lose composability. |
| 13:56 | boodle | anyone know why log4j.properties still not found in <projectroot>/resources even though that shows on the class path (lein classpath) in a noir project? |
| 13:56 | anntzer | I am trying to run lein-marginalia 0.6.1 with lein 1.6.2 |
| 13:56 | anntzer | but I get some unmatched delimiter error |
| 13:56 | clojurebot | excusez-moi |
| 13:56 | anntzer | though my code runs fine otherwise |
| 13:56 | anntzer | anyone has some idea of why? |
| 13:57 | TimMc | You'd have to be more specific about the error. |
| 13:57 | anntzer | sure |
| 13:58 | anntzer | so I do lein plugin install lein-marginalia "0.6.1" |
| 13:58 | anntzer | now lein marg outputs |
| 13:58 | anntzer | Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: clojure.lang.LispReader$ReaderException: java.lang.Exception: Unmatched delimiter: ] (NO_SOURCE_FILE:0) |
| 13:58 | anntzer | (etc etc.) |
| 14:02 | anntzer | I have the nagging feeling this has something to do with the versions of clojure / leiningen / marginalia |
| 14:02 | anntzer | but has anyone experienced this before? |
| 14:02 | technomancy | anntzer: can you repro on a fresh "lein new scratch" project? |
| 14:04 | anntzer | hum |
| 14:04 | anntzer | indeed no :p |
| 14:07 | anntzer | does that mean there is some problem with the parsing of my source file (which runs fine)? |
| 14:07 | anntzer | I guess so... |
| 14:07 | technomancy | yeah, IIRC marginalia doesn't use Clojure's reader exactly? |
| 14:08 | anntzer | ugh |
| 14:10 | TimMc | But it reuses LispReader? |
| 14:26 | Magnars | I've got a problem with char-encoding (*shiver*) ... My .clj file is in UTF-8. My terminal is in UTF-8. My project.clj has :jvm-opts ["-Dfile.encoding=utf-8"] ... and still doing 'lein run' on the terminal results in '?' in place of non-ascii chars. Any ideas? |
| 14:27 | johncourtland | i have a macro that looks like this: https://gist.github.com/1590658 and i can't seem to get the meta information for my deftypes formatted quite right |
| 14:28 | johncourtland | right now they come out looking like: (clojure.core/deftype clojure.core/name [] ITest (^"test" (index [this] "foo")) (^"test" (blah [this] "bar")))) |
| 14:29 | johncourtland | i've tried like 4 different mechanisms for getting the metadata and the method declaration on the same level and i keep running into the same issue |
| 14:30 | Magnars | * spitting the text into a file does work tho, it's just println that misbehaves |
| 14:30 | clj_newb | is there ever a valid reason to wrap a let around a defn, say: (let [x 20] (defn foo [] x)) |
| 14:30 | clj_newb | why does clojure not require all defns to be at the "top level" ? |
| 14:30 | amalloy | clj_newb: i do that all the time |
| 14:31 | clj_newb | amalloy: why is this useful? |
| 14:31 | raek | Magnars: ok, could you try installing rlwrap? by default leiningen uses JLine (which breaks UTF-8) if it's not available. |
| 14:31 | clj_newb | amalloy: there is this mental hurdle for me how that a "global level" defn is syntatically embedded within a "let" |
| 14:31 | raek | Magnars: at least Leiningen uses it for "lein repl". I'm not sure about "lein run" |
| 14:31 | jweiss | what would cause resolve to return nil, like (resolve 'myns/myvar) when I've already done a :require myns in the current ns? seems to happen in during 'lein run' but not in the repl. |
| 14:32 | technomancy | jweiss: resolve uses the value of *ns* |
| 14:32 | amalloy | it avoids repeated work, and "privatizes" the things that defn depends on. for example, (let [x (expensive-calculation)] (defn foo [a b] (blah a b x)) |
| 14:32 | technomancy | maybe you want ns-resolve? |
| 14:32 | hiredman | technomancy: he is using a namespace qualified symbol |
| 14:33 | clj_newb | amalloy: so now "x" (1) is only calculated once and (2) does not pollute the global namespace? and clojure cna get away with this since let does NOT create var bindings? |
| 14:33 | jweiss | yeah, i want to pass in a ns qualified symbol |
| 14:33 | Magnars | raek: thanks for the answer. I tried installing rlwrap using brew, but no change. Got this warning tho: In order to prevent conflicts when programs look for libreadline we are |
| 14:33 | Magnars | defaulting this GNU Readline installation to keg-only. |
| 14:33 | technomancy | oh hey, look who's not paying attention |
| 14:33 | amalloy | johncourtland: holy smokes, all those hashes make the code hard to read. none of them are actually creating gensyms, so step one is to just remove all of them |
| 14:34 | jweiss | thought there might be some kind of weird timing issue where even after i've called :require maybe that namespace hasn't been loaded somehow? |
| 14:34 | hiredman | called :require? |
| 14:34 | raek | Magnars: could you try setting that option in an environment variable? |
| 14:34 | hiredman | :require is a keyword |
| 14:34 | johncourtland | amalloy: you mean in the initial let bindings? |
| 14:34 | jweiss | hiredman - i mean in the (ns ... ) declaration at the top of the current file |
| 14:34 | hiredman | can you show the exect line you are using? |
| 14:34 | amalloy | i mean every hash in that entire gist |
| 14:35 | raek | Magnars: also, the reason this is broken on OS X is that Java is told that the OS default encoding is Mac Roman, but actually it is UTF-8 |
| 14:36 | Magnars | raek: I see, thanks. Which option should I be setting? |
| 14:36 | raek | Magnars: another way to debug this: run "java -jar lib/clojure-...jar" and try evaluating (seq "åäö") in the repl |
| 14:36 | jweiss | hiredman: https://github.com/weissjeffm/fn.trace/blob/clojure-1.3/src/fn/trace.clj#L82 |
| 14:36 | johncourtland | guess i went a little overboard w/ the gensyms |
| 14:36 | johncourtland | i had issues with variable capture earlier |
| 14:36 | raek | Magnars: -Dfile.encoding=utf-8 |
| 14:36 | jweiss | i'm getting NPE on that line, looks like resolve returns nil, and then i try a var-get on it |
| 14:37 | hiredman | jweiss: fuh, that is not the same as what you said at all |
| 14:37 | Raynes | johncourtland: Yeah, but they aren't actually gensyms because they aren't being created inside of syntax quote. |
| 14:37 | raek | Magnars: the best way is if you could set that option globally |
| 14:37 | Raynes | So you've got a bunch of hideous names there is all. |
| 14:37 | jweiss | hiredman: that's the code i'm calling, i don't have a simple example of the calling code, since it always works at the repl |
| 14:37 | Magnars | raek: I'll try that. |
| 14:37 | TimMc | johncourtland: You still do -- "name" in the deftype. |
| 14:38 | johncourtland | yeah that was a typo |
| 14:38 | jweiss | hiredman: oh and that was also the wrong link. sorry ;) |
| 14:38 | amalloy | TimMc: eh? |
| 14:38 | johncourtland | i was trying to make a smaller, more succinct version of what i have and forgot to quote it |
| 14:38 | TimMc | amalloy: (deftype name ...) should be (deftype ~name ...) |
| 14:39 | amalloy | oh, right |
| 14:40 | johncourtland | ok, i've yanked the #'s out of the gist: https://gist.github.com/1590658 and quoted the name |
| 14:40 | jweiss | hiredman: https://github.com/weissjeffm/fn.trace/blob/use-var/src/fn/trace.clj#L76 |
| 14:41 | raek | Magnars: the (seq "åäö") should evaluate to (\å \ä \ö) if the encoding of stdin/stdout from the JVM's point of view patches that of your terminal |
| 14:41 | hiredman | jweiss: are you actually using a namespace qualified symbol? |
| 14:42 | hiredman | (as you indicated you were) |
| 14:42 | raek | if you get another number of chars in that seq, or if any of the chars are jumbled, then something is wrong |
| 14:42 | Magnars | raek: in 'lein repl' the seq-command above worked like it should. |
| 14:42 | Magnars | raek: but not in 'lein run' |
| 14:42 | anntzer | ok I got it |
| 14:43 | jweiss | hiredman: well that's where i get a little fuzzy. if i do (:require [long.name.myns :as myns]) and then (resolve 'myns/myvar) does that count? |
| 14:43 | hiredman | no |
| 14:43 | amalloy | so...what typehinting are you trying to do here, johncourtland? i don't think any hints on protocol signatures are meaningful |
| 14:43 | raek | Magnars: what does it result in in 'lein run'? |
| 14:43 | johncourtland | amalloy: i'm actually trying to add annotations to the methods |
| 14:43 | Magnars | raek: question marks |
| 14:43 | johncourtland | this is a part of a grails plugin |
| 14:44 | anntzer | marginalia doesn't like ' (primes) in symbols |
| 14:44 | amalloy | ah |
| 14:44 | jweiss | hiredman: ok that would explain it, then. the compiler knows which var i'm referring to, so how do i make the same query? |
| 14:44 | johncourtland | and it looks like it wants @Action on all controller actions |
| 14:44 | hiredman | jweiss: do like technomancy said |
| 14:44 | johncourtland | this works if i manually type it all in |
| 14:44 | jweiss | hiredman: ok will try, thanks |
| 14:45 | johncourtland | haha |
| 14:45 | clj_newb | given an variable "obj", I want to figure out if "obj" has type defrecord or java.lang.*****. Is there a better way to do this than (str (type obj)) <-- and doing string comparison on some prefix? [this method seems awfully inefficient] |
| 14:46 | clj_newb | is there something like (record?) that goes along with defrecord? |
| 14:46 | Raynes | Has type 'defrecord'? |
| 14:46 | Raynes | You mean, you want to check if an object is an instance of some defrecord? |
| 14:46 | clj_newb | has a type created by defrecord |
| 14:46 | clj_newb | Raynes: exactly |
| 14:47 | jweiss | hiredman: i don't see why this works at the repl: (require '[clojure.set :as set]) (resolve 'set/difference) -> #'clojure.set/difference |
| 14:47 | jweiss | i think that is what i want ^ |
| 14:47 | hiredman | jweiss: read what technomancy said |
| 14:48 | Raynes | clj_newb: https://refheap.com/paste/228 |
| 14:48 | Raynes | clj_newb: Creating a record creates a Java class. |
| 14:48 | amalloy | johncourtland: it seems to work for me, afaict. i've forked to https://gist.github.com/1590781 and cleaned up the code without changing semantics |
| 14:48 | Raynes | With a name like any other. |
| 14:48 | Magnars | raek: running the script with 'java -Dfile.encoding=utf-8 -cp clojure-1.3.0.jar' outputs the correct chars. |
| 14:48 | jweiss | hiredman: yeah, resolve uses the current value of *ns*. i am trying to think of what would cause *ns* to not be what I want. |
| 14:49 | Magnars | raek: seems like a problem with leiningen |
| 14:49 | hiredman | jweiss: what makes you think it should be what you want? |
| 14:49 | raek | Magnars: yes. I'd expect 'lein repl' and 'lein run' to behave the same. |
| 14:49 | clj_newb | Raynes: is there a way to make this check if it's an instance of "any defrecord" rather than if it's an instance of "defrecord Foo" ? |
| 14:49 | Vinzent | clj_newb, why do you need this? |
| 14:49 | Raynes | So you don't care which defrecord, you just want to know if it is an instance of a record? |
| 14:50 | clj_newb | Raynes: yes |
| 14:50 | Magnars | raek: yes, must be the rlwrap issue - and that brew didn't install it properly for leiningen. |
| 14:50 | clj_newb | Vinzent: part of the type system I'm building |
| 14:50 | jweiss | hiredman: from the docs of ns-resolve: "Returns the var or Class to which a symbol will be resolved in the namespace...". the namespace i want it to resolve in is the current one. |
| 14:50 | raek | Magnars: maybe it's best to ask in #leiningen or on the leiningen mail list if this is a known problem and/or file a bug |
| 14:50 | Raynes | I doubt there is a trivial way to do that. Records produce Java classes. |
| 14:50 | hiredman | jweiss: *ns* is a compile time thing, it is almost never set to your namespace at runtime |
| 14:50 | hiredman | it happens that in the repl it is |
| 14:50 | jweiss | hiredman: ah |
| 14:50 | Magnars | raek: aye, I'll look at that. Thanks a lot for your help! |
| 14:50 | jweiss | i see the problem now. ok thanks hiredman |
| 14:50 | Vinzent | clj_newb, wow! I don't think it's possible. Records are just classes implementing IMeta and PersistentMap |
| 14:51 | raek | Magnars: I'd expect 'lein repl' to fail and 'lein run' to succeed if rlwrap/jline was the problem |
| 14:51 | raek | (assuming the java option worked in both cases) |
| 14:52 | Magnars | raek: yes, those are the symptoms |
| 14:52 | raek | Magnars: not the other way around? |
| 14:52 | johncourtland | amalloy: thanks for tidying it up, i still have a bad sense for idiomatic clojure, however i believe the annotations must go in the same paren level as the method declaration, directly before the name, like this (^"test" x [this a] (inc a)) |
| 14:53 | Magnars | raek: oh, no, it's the other way around. repl works, run fails. |
| 14:54 | amalloy | oh right. i did change the semantics of that part, because what you were doing was clearly broken. but it seems i guessed the wrong intent |
| 14:55 | johncourtland | yeah i can't figure out how to... make it good |
| 14:55 | amalloy | updated https://gist.github.com/1590781 to reflect desires |
| 14:58 | johncourtland | amalloy: thank you, i was so stuck with the way i was doing it |
| 14:59 | johncourtland | didn't even think of pulling the let bindings out |
| 15:01 | amalloy | eh, that doesn't matter so much except for readability. i think all you were doing "wrong" was putting metadata on something other than the thing you wanted metadata on :P |
| 15:02 | amalloy | oh, and sneezing hashes all over the screen |
| 15:03 | johncourtland | see i thought i was going to cause variable capture if i didn't use hashes |
| 15:03 | johncourtland | i guess i still don't "get" it |
| 15:03 | amalloy | those are intended for symbols you're introducing in the expanded code |
| 15:03 | amalloy | &(let [x 1] `(let [var# ~x] var#)) |
| 15:03 | lazybot | ⇒ (clojure.core/let [var__11566__auto__ 1] var__11566__auto__) |
| 15:04 | amalloy | x is not captured here because it's not included in the expanded code; it's just a local that the macro uses to decide what code to expand into |
| 15:06 | johncourtland | i see |
| 15:07 | johncourtland | since all of my vars were in bindings of some kind they weren't going to capture |
| 15:07 | johncourtland | thanks again |
| 15:33 | Guest51270 | Bronsa : ) |
| 15:33 | Bronsa | oh. |
| 15:33 | Guest51270 | anche qui mi kickerai? |
| 15:35 | bart1 | hey |
| 15:35 | bart1 | (first '(a b)) |
| 15:35 | bart1 | is: |
| 15:35 | bart1 | a |
| 15:35 | bart1 | (def x "(a b)") |
| 15:35 | bart1 | (first (>>some-functions-here<< x)) |
| 15:35 | bart1 | and should give: |
| 15:35 | bart1 | a |
| 15:35 | bart1 | What should I put in 'some-functions' place? |
| 15:36 | metajack | read-string |
| 15:36 | bart1 | this is correct, thanks :) |
| 15:43 | TimMc | bart1: Read about *read-eval*, by the way. |
| 15:43 | TimMc | http://clojuredocs.org/clojure_core/clojure.core/*read-eval* |
| 15:47 | clj_newb | (let [private-x ...] (defmacro Foo [ ] ... )) (Foo ...) <-- is it somehow possible to reference the value of private-x here? |
| 15:47 | clj_newb | (let [private-x ...] (defmacro Foo [ ] ... )) (Foo ...) <-- is it somehow possible to reference the value of private-x here? [EDIT: I don't actually need this (yet); I'm just curious if it's possible.] |
| 15:49 | joegallo | my inclination is to say no, but i await a more authoritative answer with bated breath. |
| 15:49 | joegallo | hiredman? |
| 15:49 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack> |
| 15:49 | hiredman | depends |
| 15:49 | hiredman | "reference" is very vague |
| 15:50 | hiredman | reference how, for what purpose? at macroexpand time? at runtime? |
| 15:50 | clj_newb | [computing] |
| 15:51 | clj_newb | runtime |
| 15:51 | hiredman | you should have enough data to come up with the answer for yourself |
| 15:52 | hiredman | think about it and play with macroexpand |
| 15:52 | clj_newb | the "obvious" ansewr is "NO" since defmacro just returns a list, which is spliced in |
| 15:52 | clj_newb | however, this does not prevent some trick to make it work |
| 15:53 | clj_newb | maybe the problem is my lack of understanding clojure's execution system |
| 15:53 | clj_newb | in my mind, clojure first sees the defmacro and it's like "okay; I have some shit registered for Foo" |
| 15:53 | clj_newb | then it goes on, sees (Foo ....) , and it's like "alright; let's call the macro Foo, get a list, and splice the code in" |
| 15:53 | clj_newb | so this whole "splice the code in" , taking the output of Foo as a list, would imply that private-x is NOT reachable |
| 15:54 | clj_newb | however, I can't prove that other tricks can't work. |
| 15:54 | clj_newb | hiredman: can you point out where I'm going wrong? |
| 15:55 | hiredman | how would such a trick work, what would it have to do? how could a compiler support something like that? |
| 15:55 | hiredman | (actually I think I could make it work, but it would be really really nasty) |
| 15:55 | clj_newb | I do not know; but I assume lisp/clojure language developers are smarter than me. |
| 15:55 | clj_newb | so I can't rule out the possibility. |
| 15:56 | clj_newb | I.e. my ignorance != proof of non-existence. |
| 15:57 | hiredman | you would have to refence prive-x in the macro, so it would get closed over by the fn class, and then emit reflective calls to pull it out |
| 15:59 | hiredman | clj_newb: locals (bindings of names to values using let) don't really exist at runtime, so there is nothing a macro can emit to get at the runtime value |
| 15:59 | hiredman | (unless you want to do horrible things) |
| 16:03 | clj_newb | hiredman: above, "locals" refers to "locals accessible by the defmacro" right? |
| 16:33 | amalloy | hm, interesting. in 1.3 if you call (with-meta f {...}) on a function, you get something back that doesn't print nearly as nicely as it did in 1.2 |
| 16:34 | amalloy | eg, compare ##[first (with-meta first {})] |
| 16:34 | lazybot | ⇒ [#<core$first clojure.core$first@8f905c> #< clojure.lang.AFunction$1@14ec5da>] |
| 16:34 | amalloy | in 1.2 those printed similarly, because https://github.com/clojure/clojure/commit/877c875235aaa7d9bc1bf5392f1c4991e9ea3f63 hadn't happened yet |
| 16:35 | hiredman | fn metadata has been iffy since it was added |
| 16:36 | hiredman | the idea is kind of iffy even |
| 16:38 | amalloy | how so? it seems like a good way to be able to add additional information like "here's how the function behaves in certain edge cases", which particular consumers might care about but most will just want a function |
| 16:44 | hiredman | amalloy: (with-meta x y) conceptually returns x' which is = to x and has metadata y, but does with-meta on a function return a new function? and is it equal the old one? |
| 16:44 | hiredman | I don't mean it's not useful, the implementation is just sketchy |
| 16:45 | amalloy | *nod* i'll buy that |
| 16:45 | hiredman | http://code.google.com/p/dexmaker/ who wants to port the clojure compiler to generate dex code? |
| 16:49 | amalloy | on a related note, (set! *print-meta* true) (with-meta (fn[]) {:x 1}) doesn't print the metadata map, on either 1.2 or 1.3. this makes some sense because the resulting form isn't readable anyway, but it would be nice if i could see the metadata on my functions without calling (meta) on them |
| 16:55 | bobhope | Hi, I have a question about how agents are run |
| 16:56 | bobhope | When multiple actions are enqueued to an agent, is there any attempt at making sure those actions run back-to-back on the same core? |
| 16:56 | bobhope | *same thread? |
| 16:56 | hiredman | no |
| 16:56 | bobhope | Would that be a useful enhancement? |
| 16:57 | hiredman | no |
| 16:57 | bobhope | why not? |
| 16:57 | bobhope | It seems like you could improve perf. of certain classes of problems by improving the locality tremendously |
| 16:58 | hiredman | it would complicate the design a lot, you would basically have to implement a fair scheduler for agent actions to guard against starvation and so loose guarantees of "back-to-back on the same core" anyway |
| 16:59 | bobhope | I was thinking you could bundle up to K agent actions on a single stealable task, and use transactions to either add a new action to a task that's currently running/queued, and if that task has already run >100[0] actions, then a new task is inserted in the back |
| 17:00 | bobhope | so you'd end up with an approximation of fairness |
| 17:00 | bobhope | and yet for workloads that have more communication/concurrency, they naturally tend to execute on several cores less often |
| 17:01 | bobhope | That is, I think that the work-stealing thread pool could form a good basis for this |
| 17:01 | hiredman | your checks have most likely killed any locality benefit |
| 17:01 | bobhope | what checks are you referring to? |
| 17:02 | bobhope | you'd only have to do a transactional addition of an action to a collection when you enqueue |
| 17:02 | hiredman | well, the thread is going to run an action and then check for more work |
| 17:02 | bobhope | everything else relies on the immutability |
| 17:03 | bobhope | the thread could have a private array of work to-be-done |
| 17:03 | hiredman | that check is really the same in both cases, and is going to kill any benefit |
| 17:03 | hiredman | how big of an array? arrays are not immutable |
| 17:03 | bobhope | so that the task that gets executed in the thread pool has a list of the actions to-be-executed |
| 17:04 | bobhope | the size of the array controls the amount of locality and frequency of round-robining |
| 17:04 | bobhope | it would either be fixed at 100-10000, or it would require a change to the agent api to pass parameters, or it could be dynamically tuned |
| 17:04 | hiredman | do it if you like, but I would be very surprised if you got a decent return on the added complexity |
| 17:05 | hiredman | if you have a tight loop you really should be using loop |
| 17:05 | bobhope | I have some applications for agents that have to do with making big graphs of agents that send actions all over |
| 17:06 | hiredman | sounds horrid |
| 17:06 | bobhope | sometimes an agent needs to receieve 3-4 messages before it can do the "computationally intense" part of the workload |
| 17:06 | bobhope | so the first several actions do something trivial, so it'd be great to make them happen back-to-back |
| 17:06 | hiredman | I would write it first and profile it |
| 17:07 | bobhope | why would a graph of computation be horrid? |
| 17:07 | hiredman | very complex, and it's going to be a real pain to debug and make changes to. |
| 17:08 | bobhope | some problems are like that |
| 17:08 | bobhope | I like trying to solve them :) |
| 17:08 | hiredman | have you considered jsut using fork join? |
| 17:09 | bobhope | yeah, but it's really a kind of dataflow problem |
| 17:09 | bobhope | with a huge number of discrete elements |
| 17:09 | bobhope | 100k+ |
| 17:09 | bobhope | fork-join doesn't seem suited for this problem, but I'd use the fork-join thread pool for it |
| 17:10 | bobhope | the problem is making big enough "chunks" of work so that the work-stealing scheduling would be efficient |
| 17:10 | bobhope | which is why I thought of the transactionally-updated lists that are sitting in the work queues |
| 17:10 | bobhope | those lists coarsen the granularity of the problem a bit |
| 17:13 | hiredman | it's a shame revelytix's forkjoin stuff isn't available |
| 17:13 | bobhope | I think that if forkjoin included reducers I could implement a decent dataflow executor |
| 17:13 | bobhope | but without them, it's hard |
| 17:13 | bobhope | what is revelytix's forkjoin stuff? |
| 17:14 | solussd | how can I tell, from clojure, if a file is a symlink? |
| 17:14 | hiredman | they have this while async forkjoin workflow for processing graphs |
| 17:14 | hiredman | whole |
| 17:15 | hiredman | they had a presentation about it at the conj |
| 17:15 | bobhope | solussd, there is no java way to detect symlinks as I recall |
| 17:15 | bobhope | solussd, you best bet is http://stackoverflow.com/questions/813710/java-1-6-determine-symbolic-links |
| 17:15 | bobhope | but with clojure |
| 17:15 | solussd | k. found that- was hoping someone wrote an io lib that does it. :) |
| 17:16 | bobhope | hiredman, did they say there were ever planning on open-sourcing it? |
| 17:17 | adiabatic | I've been working on http://www.4clojure.com/problem/30 and I've got a tangential question. In Usual Imperative Languages it's easy to process an array of things when you need to look ahead a bit or behind a bit because instead of referring to `things[i]` you can peek ahead and/or behind with `things[i-1]` or somesuch. However, when I'm using a single-assignment language — or just normal iterators in multipl |
| 17:17 | adiabatic | e-assignment languages — that sort of thing seems much harder to do. What are some lispy ways to map, filter, and/or reduce when you need to peek ahead or behind when processing? Are there some functions in clojure.core that I should be looking at? |
| 17:18 | hiredman | bobhope: it sounded like it |
| 17:18 | amalloy | &(partition 2 1 (range 4)) ;; adiabatic |
| 17:18 | lazybot | ⇒ ((0 1) (1 2) (2 3)) |
| 17:19 | adiabatic | Oooooh… |
| 17:19 | amalloy | solussd: Raynes would probably accept a pull request to https://github.com/Raynes/fs/blob/master/src/fs/core.clj if you want to implement that for him |
| 17:19 | adiabatic | Thanks! |
| 17:21 | solussd | amalloy: think Ill do it in a more ugly way-- since I'm already using clojure.java.shell/sh to get the permission's string (e.g. rwxr-xr-x), I can tell if it is a link from that too. :/ |
| 17:22 | bobhope | hiredman, do you know if there are slides posted? or what type of graph processing they were doing? |
| 17:24 | hiredman | bobhope: executing sparql queries on large data sets I believe, dunno about slides |
| 17:25 | mabes | I seem to remember a handy slime/emacs function that would take you do the function defnition.. M-. I thought was the default key binding, but I can't seem to use/find it.. does that sound familiar to anyone? |
| 17:25 | llasram | mabes: slime-edit-definition, which is on M-. by default |
| 17:26 | mabes | llasram: thats the one! thanks |
| 17:30 | bobhope | I'm trying to understand how best to use vimclojure's repl. Should I be using \et, \ef, etc. to execute expressions in my code? If so, do they each exist in separate repl instances, or is it as if every expression I send to nailgun is running in the same repl? What about using \sr or \sR? Is there a way to make \et send the expression under my cursor to that repl? |
| 17:36 | nican | Hello, could somebody help me with this: https://gist.github.com/1591641 I do not seem to find the right function to acomplish it. |
| 17:39 | llasram | nican: at first glance, note that `def', `defn', etc always create a top-level var in the current namespace |
| 17:40 | nican | I see. |
| 17:40 | nican | I just started this; What would be the recommended way? |
| 17:41 | adiabatic | flatten? |
| 17:41 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack> |
| 17:41 | adiabatic | (sorry, I was trying to pump one of the bots for Why You Shouldn't Use Flatten) |
| 17:41 | nican | erm, give me a moment |
| 17:41 | llasram | nican: You can create a closure bound to a local identifier using either (let [name (fn name [] ...)]) or (letfn [(name [] ...)]) |
| 17:42 | amalloy | ~flatten |
| 17:42 | clojurebot | flatten just means you failed to use ->> and mapcat correctly |
| 17:42 | amalloy | haha, that's a new one |
| 17:42 | hiredman | ~botsnack |
| 17:42 | clojurebot | Thanks! Can I have chocolate next time |
| 17:43 | llasram | nice |
| 17:43 | amalloy | clojurebot: who taught you that? |
| 17:43 | clojurebot | I don't understand. |
| 17:43 | amalloy | hiredman: can we get that feature for future factoids? |
| 17:43 | hiredman | oh sure, yeah, in the future |
| 17:43 | nican | Thanks, llasarm. |
| 17:44 | nican | Now, is possible to create a lazy seq, given a function that intakes the whole sequence, it returns the next element? |
| 17:45 | llasram | nican: Check out the `lazy-seq' macro :-) |
| 17:45 | adiabatic | ~flatten |
| 17:45 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 17:46 | adiabatic | oh right, concat |
| 17:46 | nican | *Doing more research* I will take a look. Thanks again. |
| 17:46 | amalloy | hiredman: i can't tell if you're sarcastically saying "yes, someday in the future that might happen", or reaffirming that it would not work retroactively for existing factoids |
| 17:48 | hiredman | amalloy: can't it be both? |
| 17:48 | amalloy | *chuckle* |
| 18:47 | adiabatic | w.t.f |
| 18:48 | adiabatic | I clicked on the "guest" thingy in the top right corner of http://clojure.org/cheatsheet and now I can't click on URLs past the first screenful |
| 18:49 | amro | "guest" isn't clickable |
| 18:50 | adiabatic | something up there |
| 18:50 | hiredman | looks like wikispaces decided to add broken html to everything |
| 18:50 | adiabatic | I fiddled with it and now 3/4 of the page is broken because some piece of javascript written by a lobotomized crab throws in a div#pageEditor.editorWrapper.editorLayer |
| 18:51 | adiabatic | oh, it's broken for everyone? |
| 18:52 | adiabatic | well, it's broken for Chrome, too. Hopefully someone will notice, then. |
| 18:57 | arohner | does anyone get an error with slime, where you just get "Evaluation aborted", with no stacktrace, no return value? Seems to happen when a command at the repl throws |
| 18:57 | amalloy | adiabatic: you can delete that element with the Inspector, at least, and get back to browsing |
| 18:57 | adiabatic | Entirely true, but I shouldn't have to do that once, much less on every page load |
| 18:58 | amalloy | of course not |
| 18:58 | amalloy | really clojure.org is not very well maintained, so i'm a bit surprised someone has gone to the trouble of adding something that breaks it |
| 18:58 | adiabatic | Might be wikispaces-level silly. |
| 18:59 | amalloy | could be. i don't know anything about wikispaces |
| 19:00 | johncourtland | hey amalloy, remember that hash riddled monster you helped me with earlier? |
| 19:00 | amalloy | i may never be able to forget :) |
| 19:00 | johncourtland | heh |
| 19:01 | johncourtland | well, apparently, clojure 1.3 + 1.4 don't read annotations from metadata in macros like that |
| 19:01 | johncourtland | i wrote a little proof |
| 19:02 | Raynes | Clojure should just do everything on Github. Even the sure should be github pages. |
| 19:02 | johncourtland | https://gist.github.com/1592051 |
| 19:02 | Raynes | site |
| 19:02 | Raynes | Typing on a phone while on a bumpy ride in the rain. |
| 19:07 | johncourtland | i'm curious if that's by design or not |
| 19:08 | amalloy | dunno. i'm not the one to ask |
| 19:10 | hiredman | johncourtland: you may need to quote the classname in the macro |
| 19:12 | franks42 | Q: can I use slurp somehow on *in* to keep reading from stdin until EOF? |
| 19:12 | johncourtland | hiredman: you mean the annotated class name or the deftype classname? |
| 19:12 | hiredman | the annotation name |
| 19:12 | johncourtland | the syntax-quote is expanding the annotation correctly as far as i can tell |
| 19:12 | johncourtland | but i will rty |
| 19:12 | johncourtland | *or try |
| 19:12 | hiredman | right |
| 19:13 | hiredman | but the code that is looking to add annotations looks for symbols, not classes |
| 19:13 | johncourtland | wonderful |
| 19:14 | johncourtland | that worked |
| 19:14 | johncourtland | if you don't mind me asking, as a complete newbie to clojure, how could i have figured that out on my own? |
| 19:15 | hiredman | read the source |
| 19:15 | hiredman | I opened up compiler.java, looked for annotations, which pointed be back to the add-annotations function in core.clj |
| 19:16 | franks42 | (slurp *in*) simply doesn't seem to return... |
| 19:16 | JohnnyL | is there a API for making basic graphics easily in clojure? |
| 19:18 | johncourtland | makes sense, i guess i should have been more diligent, i had those open as well from rich's original commits to add annotations, thanks for your help |
| 19:19 | hiredman | sure |
| 19:20 | hiredman | http://groups.google.com/group/clojure-dev/browse_thread/thread/dc46c4e80e895dd6?hl=en we'll see who bites |
| 19:21 | franks42 | same for (slurp (java.io.BufferedReader. *in*)) |
| 19:23 | tmciver | franks42: looks like *in* is a Reader; slurp is expecting a File. |
| 19:24 | johncourtland | cool, i'll keep an eye on that |
| 19:26 | franks42 | tmciver: yup - slurp seems to accept a lot of file-like things… like reader - just don't understand if I can convert *in* into something that slurp could use... |
| 19:26 | JorgeB | are there any good debuggers that work with Clojure atm? |
| 19:27 | hiredman | JorgeB: define good? jvm level debuggers work with clojure (jswat, etc) there are some tools built on top of jvm debuggers, but those can run into issues with clojure's locals clearing |
| 19:28 | hiredman | cdt is integrated to some extent in the next version of swank-clojure |
| 19:28 | hiredman | (clojure debugging toolkit) |
| 19:30 | JorgeB | hiredman, I am trying to get a sense of how they compare to pure-Java debuggers as found in the main IDEs |
| 19:47 | JohnnyL | is there a clojure to javascript convertor? |
| 19:47 | espringe | clojurescript |
| 19:48 | JohnnyL | ok |
| 19:48 | JohnnyL | thanks espringe |
| 20:19 | TimMc | JohnnyL: It's not done. |
| 20:20 | JohnnyL | TimMc: At the present moment I only wanted it for turtle graphics , perhaps on an html5 canvas. |
| 20:21 | brehaut | JohnnyL: are you wanting html based turtle graphics in particular, or just turtle graphics in general? |
| 20:21 | TimMc | You can use the Swing canvas just fine from Clojure. |
| 20:21 | adiabatic | Ew, Java-in-a-browser. |
| 20:21 | JohnnyL | TimMc: well, thats fine, but I wanted to use browser only. |
| 20:21 | TimMc | Ah, OK. |
| 20:22 | JohnnyL | brehaut: browser. |
| 20:23 | adiabatic | like this?: http://www.calormen.com/Logo/ |
| 20:27 | JohnnyL | yah thats nice but I was looking at http://nakkaya.com/2010/01/09/a-simple-turtle-graphics-implementation-in-clojure/ from a developer's standpoint. |
| 21:02 | sritchie | is anyone seeing this from clojars? |
| 21:02 | sritchie | Caused by: org.apache.maven.artifact.versioning.OverConstrainedVersionException: No versions are present in the repository for the artifact with a range [1.2.0,1.2.0],[1.2.1,1.2.1],[1.3.0,1.3.0] |
| 21:02 | sritchie | this just started happening right now with [midje "1.3.0"] in dev-dependencies or dependencies |
| 21:04 | sritchie | @alexbaranosky I'm not seeing it with anything but midje, actually |
| 21:17 | TimMc | Here's a surprising error message: |
| 21:17 | TimMc | ,(require '[clojure.main :as m clojure.core :as c]) |
| 21:17 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: true> |
| 21:21 | pandeiro | sritchie: were you planning on bumping the clutch version of your couch-session for ring? |
| 21:29 | sritchie | pandeiro: good call, I need to do that |
| 21:29 | pandeiro | sritchie: i just made the necessary changes here on my local copy, will test later tonight |
| 21:30 | sritchie | great, thanks |
| 21:30 | sritchie | did you upgrade ring as well? |
| 21:30 | pandeiro | yes |
| 21:56 | adiabatic | I'm trying to drop every nth item from a list. I've threaded 'coll' through to the end of this line: |
| 21:56 | adiabatic | (map #([%1 %2]) (cycle (range 1 n))) |
| 21:56 | technomancy | sritchie: that's a problem with maven version ranges, not with clojars. |
| 21:56 | technomancy | (apologies if I'm repeating myself; wifi is spotty) |
| 21:57 | sritchie | technomancy: no worries, I don't know why it just started happening with me |
| 21:57 | adiabatic | but I keep getting an error — wrong number of args (0) passed to PersistentVector. How have I got the lambda wrong? |
| 21:57 | sritchie | try #(vector %1 %2) |
| 21:58 | adiabatic | Why that and not #((vector %1 %2))? |
| 21:58 | technomancy | one of your deps needs to stop using version ranges; they suck. |
| 21:58 | sritchie | technomancy: that's midje |
| 21:59 | adiabatic | sritchie: doesn't work — can't class Boolean to IFn |
| 21:59 | sritchie | adiabatic: yeah, sorry about that, I just looked at the lambda and thought you were trying to make 2-vectors |
| 22:00 | adiabatic | https://gist.github.com/1592765 |
| 22:01 | adiabatic | I was actually surprised that there's no zip function |
| 22:05 | sritchie | adiabatic: https://gist.github.com/1592781 |
| 22:07 | TimMc | adiabatic: Is this for 4clojure? |
| 22:07 | adiabatic | yeah, #41 |
| 22:07 | TimMc | OK, then I won't tell you the one function call that will do it for you. :-) |
| 22:08 | TimMc | (OK, there's a little setup for the args...) |
| 22:13 | alexbaranosky | midje? |
| 22:13 | alexbaranosky | something needs a fixin? |
| 22:16 | sritchie | alexbaranosky: looks like these version ranges are giving me some trouble! |
| 22:17 | sritchie | though it just started happening, not sure why |
| 22:17 | tmciver | TimMc: submitted my solution for #73. It's much better than what I had earlier but not nearly as Clojur-ish as your and chouser's solutions. |
| 22:17 | tmciver | TimMc: love the use of some with a map! |
| 22:17 | tmciver | TimMc: I'm still trying to figure out the diagonal part. |
| 22:18 | alexbaranosky | sritchie, would you mind opening an issue for your troubles? |
| 22:18 | sritchie | no problem, will do |
| 22:18 | alexbaranosky | thanks |
| 22:21 | sritchie | alexbaranosky: https://github.com/marick/Midje/issues/88 |
| 22:22 | alexbaranosky | sritchie, I want Brian to see it. He's likely to know if there is any good reason we are using version ranges |
| 22:22 | sritchie | nathanmarz couldn't recreate it when he ran that example project, and it just started for me |
| 22:22 | sritchie | not really sure what's going on |
| 22:22 | sritchie | but that sounds good |
| 22:55 | amalloy | ~zip |
| 22:55 | clojurebot | zip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c)) |
| 22:55 | amalloy | adiabatic: ^ |