2011-07-04
| 00:00 | hugod | next release of pallet will have image downloading for vbox built in |
| 00:00 | hugod | no, pallet has its own interface to vbox api |
| 00:00 | technomancy | cool |
| 00:00 | technomancy | I've got to say, the features of vagrant have really won me over the past few weeks |
| 00:01 | hugod | we have a computeservice abstraction that gets used to talk to jclouds, vbox, or a node list |
| 00:01 | technomancy | having your VM environment be just another file that's checked in is a big win for repeatability |
| 00:01 | ihodes | xiaolongxia: i think you'd be able to show him some practical applications using racket pretty quickly-they've got some great stuff going on. otherwise, i'd point him to stewart's Programming Clojure, and keep an eye on things that are out of date. i still think that's the best book for a beginner. |
| 00:01 | hugod | technomancy: yes, definitely |
| 00:02 | cemerick | technomancy: see, here I was idly thinking of creating yet another build tool, and you're out there showing me why that's just not a healthy life choice ;-) |
| 00:02 | ihodes | building is horrible. horrible. horrible. (still emotional over a week of time spent recovering from usign SVN 1.4, an insane ant build, and a 3mil line codebase) :( |
| 00:05 | technomancy | cemerick: yeah, I, uh... I try to lead by example. |
| 00:05 | technomancy | "eat your veggies, boys, or you will turn out like technomancy" |
| 00:07 | hugod | cemerick: any particular features you were idly planning? |
| 00:07 | cemerick | It's a cautionary tale, to be sure. I've mostly tried to stay away from bikeshed domains, just to avoid the mental anguish it would seem to entail. |
| 00:10 | cemerick | hugod: I've just been taking notes here and there about things various tools get right, and others different tools get wrong, etc. I'm wondering if it's worth trying to find a global maxima, at least for my fanbase. |
| 00:10 | cemerick | That population being me, of course. |
| 00:10 | cemerick | :-P |
| 00:10 | amalloy | hugod: https://github.com/pallet/ritz links to a 404 version of slime.el |
| 00:10 | hugod | amalloy oops, thanks |
| 00:12 | cemerick | ihodes: sorry, missed your msg; 3m LOC? |
| 00:12 | cemerick | My condolences. |
| 00:13 | hugod | amalloy: should be fixed |
| 00:15 | amalloy | hugod: thanks. apparently i had to completely rip apart my emacs config to start using marmalade so i could have a crack at ritz. it's an adventure so far |
| 00:15 | hugod | amalloy: I try and put of the faint of heart in the readme |
| 00:15 | technomancy | amalloy: fwiw emacs 24 is fairly painless |
| 00:15 | technomancy | plus you can write elisp with lexical scope! |
| 00:16 | technomancy | which I know you've always wanted |
| 00:16 | amalloy | technomancy: i switched my office machine from 24 to 23 a week or so ago |
| 00:16 | technomancy | oy |
| 00:16 | amalloy | i *could not* figure out how to get 24 to stop creating new windows and frames of ridiculous sizes every time something wanted to open in a different window |
| 00:17 | technomancy | weird |
| 00:17 | technomancy | the only things I know that try to create new frames are ediff and speedbar |
| 00:17 | technomancy | the former which is easy to disable, the latter which is best avoided |
| 00:17 | amalloy | technomancy: i was getting new frames for completion buffers |
| 00:18 | amalloy | all i got from #emacs was the usual "bleeding edge is your problem" |
| 00:18 | technomancy | wow, crazy |
| 00:18 | technomancy | in cocoa? |
| 00:18 | amalloy | lucid |
| 00:19 | technomancy | madness |
| 00:19 | amalloy | actually natty, i guess |
| 00:24 | amalloy | hugod: you mention cake in the Install section, implying it's supported, but i don't see how to launch ritz with cake |
| 00:26 | technomancy | is resolve supposed to work with nested classes? |
| 00:26 | amalloy | technomancy: eh? |
| 00:27 | technomancy | (resolve 'org.apache.lucene.util.Version/LUCENE_30) ; => nil |
| 00:27 | amalloy | technomancy: try $ instead of /? |
| 00:27 | hiredman | ^- |
| 00:27 | technomancy | err... I guess it's a field |
| 00:27 | technomancy | never mind |
| 00:28 | technomancy | how do you dynamically determine whether a class has a given field? |
| 00:28 | hiredman | having resolve work on fields is an interesting idea |
| 00:28 | hiredman | reflection |
| 00:29 | hiredman | I can lend you my java reflection in action book |
| 00:29 | technomancy | hiredman: right, because I don't care about the difference |
| 00:29 | technomancy | (def *version* (try (eval 'org.apache.lucene.util.Version/LUCENE_30) |
| 00:29 | technomancy | (catch Exception _ |
| 00:29 | technomancy | org.apache.lucene.util.Version/LUCENE_29))) |
| 00:29 | technomancy | dang it |
| 00:30 | technomancy | mispaste, but you get the idea. it's icky. |
| 00:30 | amalloy | &(-> String .getFields seq) |
| 00:30 | sexpbot | ⟹ (#<Field public static final java.util.Comparator java.lang.String.CASE_INSENSITIVE_ORDER>) |
| 00:30 | amalloy | technomancy: there's a named .getField, i'm fairly sure |
| 00:31 | hiredman | there is a wallhack-field function somewhere in contrib |
| 00:31 | amalloy | but all you need should be available in the javadoc for java.lang.Class |
| 00:31 | technomancy | amalloy: that's perfect; thanks. |
| 00:31 | hiredman | http://richhickey.github.com/clojure-contrib/java-utils-api.html#clojure.contrib.java-utils/wall-hack-field |
| 00:31 | hiredman | for static fields you use nil for obj |
| 00:32 | hugod | amalloy: add ritz as a dev dependency, and cake ritz |
| 00:33 | hugod | cemerick: commiserations, just been doing that for my ritz maven plugin |
| 00:33 | amalloy | hugod: no good, but that might be because i'm on an unstable version of cake |
| 00:33 | hugod | mm, my version of cake seems very broken |
| 00:34 | cemerick | hugod: ritz? I'm behind the times :-( |
| 00:34 | amalloy | cemerick: swank-clj's new name |
| 00:34 | cemerick | Annotations in Clojure are mostly *bleh*. It's JAX-RS that's absolutely dead-nuts infuriating. |
| 00:34 | cemerick | ah, ok |
| 00:34 | cemerick | nice |
| 00:34 | amalloy | yeah, i like the name |
| 00:35 | amalloy | one day, far in the future, when i've resurrected my computer, i hope to like the tool too |
| 00:35 | cemerick | It's amazing to me that that's what's considered the web services hotness in Java-land these days. |
| 00:35 | hiredman | also the clojure tests fail in annotations tests when run on openjdk7 on osx |
| 00:37 | cemerick | I think it's the only place in the book where we have a "don't use this stuff, really" warning. |
| 00:54 | hugod | amalloy: I'll have a look at the cake plugin tomorrow when I get cake to run again |
| 00:55 | amalloy | hugod: thanks. in the meantime i'll just use lein; cake seems to have a lot of headaches |
| 00:58 | amalloy | hugod: actually it doesn't work with lein either: Exception in thread "main" java.lang.ClassNotFoundException: com.sun.jdi.VirtualMachine (jdi.clj:1) |
| 00:58 | amalloy | i imagine this is because i have openjdk rather than sun/oracle |
| 06:03 | lnostdal-laptop | ring seems to mess around with stdout (*out* ?) or something .. debug output using println doesn't show up in slime here |
| 06:04 | lnostdal-laptop | ..and exceptions end up in the terminal; where i started `lein swank' |
| 06:04 | lnostdal-laptop | ..is there some way of fixing this? .. i.e. println output should end up in slime, and exceptions also |
| 06:05 | hoeck | lnostdal-laptop: the server code runs in a different thread than the slime repl, and slime only redirects stdout of its own repl thread |
| 06:06 | lnostdal-laptop | ah, i remember this being an issue with SBCL also .. there was a fix for it though .. hmm |
| 06:07 | lnostdal-laptop | (setf swank:*globally-redirect-io* t) ;; fixed it for SBCL |
| 06:08 | hoeck | for exceptions, you could wrap your handler bodies in (try (do ) catch Exception e (swap! *server-exceptions* conj e)) and then manually throw the last exception or so from the slime repl |
| 06:08 | hoeck | or mess with the default exception handler of the thread the ring handler is invoked in, probably by modifying some server config |
| 06:11 | hoeck | lnostdal-laptop: maybe (System/setOut *out*) works |
| 06:15 | lnostdal-laptop | (let [*out* *out*] (defn handler [req] (binding [*out* *out*] ...))) |
| 06:15 | lnostdal-laptop | seems to work |
| 06:16 | lnostdal-laptop | ..with regards to output and stuff |
| 06:18 | halfprogrammer | lnostdal-laptop: the stacktrace middleware prints the exception in *err* stream |
| 06:18 | halfprogrammer | that is why you see exception in lein repl |
| 06:23 | lnostdal-laptop | ok |
| 06:24 | lnostdal-laptop | i'm not using that middleware though |
| 06:24 | halfprogrammer | oh |
| 06:25 | lnostdal-laptop | (..should i? .. i'm not sure what that middleware does; i thought it was used to display the stacktrace on the web page; which is not what i'm after..) |
| 06:28 | lnostdal-laptop | is there a `break' ..for triggering an exception? |
| 06:29 | halfprogrammer | lnostdal-laptop: as far as I remember it displays the stacktrace both on the web page and on the *err* stream. |
| 06:30 | halfprogrammer | I am not getting what you mean by `break |
| 06:31 | lnostdal-laptop | like http://www.lispworks.com/documentation/HyperSpec/Body/f_break.htm |
| 06:32 | halfprogrammer | if you want to insert breakpoints you can use swank.core/break. |
| 06:33 | lnostdal-laptop | using this Javaish thing seems to work: (throw (Exception. "I got here")) |
| 06:33 | lnostdal-laptop | ah |
| 06:33 | halfprogrammer | :) |
| 07:45 | peteriserins | I want to create a macro that serves as with-connection-to-my-database (with known credentials) |
| 07:46 | peteriserins | (defmacro with-connection-to-mydb [db-spec & body] (let [credentials ..] (with-connection ~db-spec ~@body))) |
| 07:46 | peteriserins | tried unquoting the let and it didn't work |
| 07:46 | peteriserins | *backquoting |
| 07:52 | rlb | peteriserins: what are you trying to do? i.e. when should credentials be computed? |
| 07:52 | peteriserins | rlb: compile time |
| 07:52 | rlb | So what didn't work? |
| 07:53 | peteriserins | for starters, I need to have db-spec as a symbol |
| 07:53 | peteriserins | and I cannot find how to do that |
| 07:55 | rlb | Do you have an example of a form the expansion you'd like? |
| 07:56 | peteriserins | (with-c-mydb db (print "Credentials: " db)) |
| 07:59 | peteriserins | rlb: I actually see now that the db parameter is redundant |
| 07:59 | peteriserins | rlb: it should just be [& body] |
| 08:00 | rlb | OK. |
| 08:01 | peteriserins | rlb: OK, it works now |
| 08:01 | peteriserins | rlb: I surrounded everything with # |
| 08:50 | gfrlog | if I have a long (millions) seq of numbers, (apply + coll) and (reduce + coll) ought to perform equivalently, right? |
| 09:02 | halfprogrammer | gfrlog: should it necessarily be the same? |
| 09:03 | gfrlog | well I can't think of why it ought to be different. I only ask because it feels weird to call a function with millions of args. |
| 09:03 | halfprogrammer | wont reduce take more time? |
| 09:04 | gfrlog | you think + is optimized for lots of args? |
| 09:04 | Chousuke | apply + calls reduce so no |
| 09:04 | gfrlog | ah yeah, I see that in the source now |
| 09:04 | halfprogrammer | hmmm |
| 09:04 | gfrlog | ([x y & more] (reduce + (+ x y) more)) |
| 09:04 | Chousuke | in some cases apply is faster though |
| 09:04 | Chousuke | like apply str |
| 09:05 | gfrlog | StringBuilder |
| 09:05 | halfprogrammer | hmm |
| 09:05 | gfrlog | Chousuke: interesting, thanks |
| 09:06 | Chousuke | in general, if you expect that a function can do something smart if it controls what to do with more than two args, then use apply. |
| 09:06 | Chousuke | otherwise, reduce is fine |
| 09:30 | archaic` | hi. anyone out there?, how come in compojure/ring? a route (GET "/" [] (println "foo")) will print foo twice whenever i refresh the browser at uri / ? |
| 10:30 | msappler | hi |
| 10:30 | msappler | i want to share the source code of a clojure game I developed on google code ... what licence is appropriate? |
| 10:49 | gfrlog | archaic`: you could use CURL to check if the repetition happens in the app or the browser |
| 11:19 | msappler | okay I open sourced my game under MIT: http://resatori.com/open-sourcing-cyber-dungeon-quest |
| 11:33 | ejackson | msappler: congrats ! |
| 11:35 | cemerick | msappler: looks pretty fun — reminds me of gauntlet from my C64 days :-D |
| 11:36 | cemerick | you should put a new video up on the google code page — I had to hunt around for the one you did in March |
| 11:37 | msappler | thanks ... just have to find out how to put videos pictures on google code |
| 11:37 | cemerick | Or, just a permalink to it on your blog or something *shrug* |
| 11:40 | msappler | put the old video there :) https://code.google.com/p/clojure-rpg/ |
| 11:42 | cemerick | nice; I'll tweet tomorrow when more people are around |
| 12:08 | matthias__ | ,(doc replicate) |
| 12:08 | clojurebot | "([n x]); Returns a lazy seq of n xs." |
| 12:14 | pcavs | What's the best way to test reading from standard input with clojure + leiningen? |
| 12:37 | matthias__ | someone should add a list of the most popular clojars to clojars.org |
| 12:55 | fliebel | What is "the best" was of serializing Clojure data structures? Just print and read, or is there something more advanced? |
| 12:55 | fliebel | *way |
| 13:06 | rlb | fliebel: if you're just going to/from clojure, I'd think read/write unless you have special needs. |
| 13:06 | rlb | fliebel: (for clojure s/write/pr/) |
| 13:22 | fliebel | rlb: Okay, fine :) |
| 13:26 | mids | and if you need performance / compatibility probably thrift or protocol buffers |
| 13:26 | fliebel | mids: But then you'd need to specify the format beforehand, right? Or can you just say (thrift ["aa" 3]) |
| 13:28 | mids | yes |
| 13:28 | mids | err, yeah you need to specify the format beforehand |
| 13:28 | fliebel | I that case I'd rather use... the ztellman thing. |
| 13:29 | fliebel | gloss |
| 13:30 | rlb | and if you need to speak to python, etc., perhaps json... |
| 13:31 | mids | or XML :P |
| 13:41 | babilen | technomancy: ping |
| 13:47 | ilyak | Thing I don't like about Clojure: |
| 13:48 | ilyak | Sometimes it treats java collections as first-class collections. Sometimes it doesn't. |
| 13:48 | ilyak | It's not mentioned in docs and it's painful |
| 13:48 | ilyak | I guess I'll have to roll out some my own collection functions |
| 13:48 | ilyak | ,(contains? (Collections/singleton 1) 1) |
| 13:48 | clojurebot | false |
| 13:49 | ilyak | This sucks |
| 13:53 | gfrlog | that's funny it returns anything |
| 13:53 | gfrlog | ,(contains? :foo :bar) |
| 13:53 | clojurebot | false |
| 13:53 | gfrlog | weerd. |
| 14:25 | agumonkey | hi all |
| 14:29 | agumonkey | anybody knows why jline fails when moving cursor or deleting/backspacing ? |
| 16:45 | amalloy | &(java.util.Collections/singleton 1) |
| 16:45 | sexpbot | ⟹ #<SingletonSet [1]> |
| 16:45 | amalloy | &(java.util.Collections/singleton (into-array [1])) |
| 16:45 | sexpbot | ⟹ #<SingletonSet [[Ljava.lang.Integer;@72fd0e]> |
| 16:45 | amalloy | hm. well duh, of course that's not variadic. never mind :P |
| 17:03 | pcavs | How does one support default values in a idiomatic, succinct way? Does one have to use multimethods and then pass the default value to the expanded version of the function? |
| 17:06 | amalloy | pcavs: your suggested solution doesn't make any sense as far as i can tell. by "multimethod" do you mean "function with multiple arities/bodies"? |
| 17:06 | pcavs | yes, sorry |
| 17:06 | amalloy | if so, that's one common way to do it |
| 17:06 | pcavs | alrighty, what's the other? |
| 17:06 | amalloy | another is to use a map and destructure it with the :or key |
| 17:07 | amalloy | &((fn [& {:keys [a b] :or {b 10}}] [a b]) :a 9) |
| 17:07 | sexpbot | ⟹ [9 10] |
| 17:23 | amalloy | matthias__: btw, i've never used replicate. these days repeat does the same thing in fewer characters; i think replicate was probably written when repeat didn't take an N argument? |
| 17:23 | davekong | I am getting the error: Wrong number of args (1) passed to ... for a function that always takes one argument, any ideas what could be going on? I tested it in the repl and I don't get an error but within my program I do |
| 17:24 | matthias__ | ,(doc repeat) |
| 17:24 | clojurebot | "([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs." |
| 17:24 | amalloy | davekong: is it a macro? |
| 17:24 | davekong | amalloy: no |
| 17:26 | gfrlog | davekong: is it a function you defined? |
| 17:26 | davekong | gfrlog: yes |
| 17:27 | davekong | The argument I am passing is a map if that is of significance |
| 17:28 | gfrlog | shouldn't be. For lack of any other ideas, could you show us the function definition and call? |
| 17:28 | davekong | sure |
| 17:31 | davekong | http://codepad.org/h2RwYCif gfrlog , the call is on the line with the CALLE HERE comment, with-client-socket is a macro |
| 17:38 | Somelauw | Has cake, leininingen, emacs or anything an interactive mode? Does clojure-jack-in have a manual which possibly explains it? |
| 17:38 | amalloy | emacs is one giant interactive mode |
| 17:39 | amalloy | davekong: fwiw, the (((game :rules) :max-raises) (betting-round game)) construct is confusing to me |
| 17:40 | amalloy | i'd probably write it as a get-in |
| 17:41 | davekong | amalloy: okay thanks, I'm I still pretty new to clojure |
| 17:43 | amalloy | davekong: i'm not sure if it's a common thing or just my personal preference, but (:foo m) feels a lot more natural to me than (m :foo), though the first only works for keywords |
| 17:43 | ibdknox | amalloy: I'm the same way |
| 17:43 | amalloy | but i'm afraid i don't see anything in your code that would throw the exception you're seeing |
| 17:43 | Somelauw | amalloy: what manual page of emacs should I read to learn about interactive mode? |
| 17:44 | amalloy | Somelauw: if you have a version of clojure-mode that has jack-in, you should just be able to call it and it will start up a repl buffer. but ask technomancy, if that doesn't seem to work |
| 17:46 | Somelauw | amalloy: that already works. But I have a file with code and want to test the code in that file. |
| 17:46 | amalloy | C-c C-k compiles/runs the current file |
| 17:46 | Somelauw | So I want to make the functions in that file accesible from the repl. |
| 17:47 | amalloy | C-c C-c compiles the top-level form you're currently pointing at; C-x C-e evaluates the form (not necessarily top-level) immediately before point |
| 17:47 | amalloy | there's http://www.pchristensen.com/slimecommands.pdf for a slime cheat sheet - clojure's swank doesn't support all of these yet, but you can try something and hope |
| 17:48 | Somelauw | Well thanks. C-k, C-k seems to work. Any good tutorial or reference since I want to learn more? |
| 17:49 | Somelauw | Okay, thanks for slime-commands. |
| 17:49 | amalloy | i bet technomancy's screencast covers this sort of thing |
| 17:52 | Somelauw | Which screencast do you mean? |
| 17:55 | amalloy | http://technomancy.us/120 i think. i haven't watched it |
| 17:56 | Somelauw | okay, thanks, I will take a look at it |
| 18:05 | davekong | amalloy: I figured it out, the wrong number of args was to #(= \r) not the function itself.. that should be #(= \r) or using partial |
| 18:06 | amalloy | davekong: good lesson. always paste the stacktrace |
| 18:06 | amalloy | which would be pretty clear in your case |
| 18:07 | amalloy | wrong number of arguments (1) passed to my.game$legal-actions$fn__5786 or something |
| 18:07 | amalloy | rather than: wrong number of arguments (1) passed to my.game$legal-actions |
| 18:07 | davekong | amalloy: http://codepad.org/X1iawnyY |
| 18:10 | davekong | hopefully now that I understand the stack a little better I won't need to ask next time |
| 18:10 | davekong | stack trace |
| 18:10 | amalloy | davekong: in this case the thing that's useful is knowing how clojure creates classnames for functions |
| 18:11 | amalloy | actually i'm not sure why there's no numbers after the $fn in your example. but basically, each closure is named <enclosing-function-name>$fn__nnnn |
| 18:12 | amalloy | eg, ##(class (partial + 5)) |
| 18:12 | sexpbot | ⟹ clojure.core$partial$fn__3678 |
| 18:12 | davekong | ##(class #(+ 5)) |
| 18:12 | sexpbot | ⟹ sandbox10545$eval13084$fn__13085 |
| 18:13 | davekong | ##(class #(= \r)) |
| 18:13 | sexpbot | ⟹ sandbox10545$eval13093$fn__13094 |
| 18:13 | davekong | hmm |
| 18:14 | amalloy | davekong: of course learning that you need to include % in the function is a good lesson, but i'd solve your problem by using a set as a function: (filter #{\r} (round-actions game) |
| 18:14 | gfrlog | davekong: sorry bout wandering off. |
| 18:15 | davekong | np |
| 18:15 | amalloy | and you can do the same in the cond expression in play-game: (cond (nil? msg) game, (#{\# \;} (first msg)) (recur game)) |
| 18:15 | gfrlog | did it get sorted out? lotta stuff to read through... |
| 18:15 | amalloy | yeah |
| 18:16 | gfrlog | oh I see it was the anon function |
| 18:16 | gfrlog | those are fun |
| 18:16 | amalloy | gfrlog: today's lesson was for us to always demand a real stacktrace, not a summary |
| 18:17 | gfrlog | amalloy: could you repeat that as a stacktrace? |
| 18:17 | amalloy | $kill gfrlog |
| 18:17 | sexpbot | KILL IT WITH FIRE! |
| 18:19 | davekong | neat |
| 18:19 | davekong | I like how concise clojure can get |
| 18:20 | mrnex2010 | What would be a simple way to execute code upon invoking lein repl? (edgar goncalves sais that since lein 1.3 u cant just put it in the project.clj) |
| 18:22 | gfrlog | woah |
| 18:22 | gfrlog | I was gonna make a joke that you could make a user.clj and just stick your code in there |
| 18:22 | gfrlog | then I tried it and it worked |
| 18:23 | gfrlog | it worked...twice actually. |
| 18:23 | davekong | Well I noticed core.clj gets loaded automatically? |
| 18:23 | amalloy | i think user.clj is deprecated though |
| 18:23 | gfrlog | probably has something to do with that "server listening..." |
| 18:23 | gfrlog | oh does it? |
| 18:23 | mrnex2010 | da hell? if i have a user.clj in the project, it will execute that code? |
| 18:23 | amalloy | or something like that |
| 18:23 | gfrlog | mrnex2010: did it for me |
| 18:24 | gfrlog | $ lein repl |
| 18:24 | gfrlog | USER |
| 18:24 | gfrlog | USER |
| 18:24 | gfrlog | REPL started; server listening on localhost:27883. |
| 18:24 | gfrlog | user=> |
| 18:24 | gfrlog | where user.clj contains (println "USER") |
| 18:24 | mrnex2010 | oh thats nice!! |
| 18:24 | gfrlog | lemme def something and see if it's there... |
| 18:25 | gfrlog | that works too |
| 18:25 | amalloy | pft. you wish |
| 18:25 | mrnex2010 | coz i wanna make something that imports all namespace in the project for developement purposes |
| 18:25 | gfrlog | yeah core.clj don't work |
| 18:25 | davekong | maybe it is only when you say it is main |
| 18:26 | gfrlog | davekong: confirmed |
| 18:26 | gfrlog | davekong: and once again it loads it twice |
| 18:29 | mrnex2010 | thank you very much guyse |
| 18:32 | Somelauw | I think I really hate emacs, but like its interaction mode. So I will just program in vim and refresh the file in emacs whenever I want to test something. |
| 18:32 | mrnex2010 | srry gfrlog, where did you place the user.clj? |
| 18:33 | gfrlog | mrnex2010: src/user.clj |
| 18:33 | mrnex2010 | ty |
| 18:33 | mrnex2010 | YaY! |
| 18:37 | amalloy | Somelauw: a lot of the benefit comes from things like having documentation available while editing |
| 18:37 | amalloy | eg, start typing a function call and it gives you hints about what args it takes |
| 18:39 | gfrlog | why nobody builds SLIMV? |
| 18:39 | amalloy | gfrlog: you need it built for you? |
| 18:39 | amalloy | i can't tell if you're punning or clueless; slimv does exist, though i assume slime is better |
| 18:40 | gfrlog | oh I'm clueless |
| 18:40 | gfrlog | I need to learn to google before I announce stuff I make up |
| 18:41 | gfrlog | man if this thing works halfway decently that might be the nail in the coffin of me learning emacs |
| 18:42 | amalloy | gfrlog: you should hang out in here when someone asks how to install slimv |
| 18:42 | amalloy | it's like having to invent the wheel every time you build a car. so many things to do |
| 18:43 | gfrlog | but every 5th question is about swank/slime |
| 18:47 | amalloy | gfrlog: right at the moment my slime is broken because i wanted to try out ritz. so i guess i'm not in a position to brag about slime's simplicity. although i did get it set up on a fresh ubuntu install in no time at all |
| 18:48 | gfrlog | what about SLIMW? |
| 18:48 | gfrlog | (Word) |
| 18:49 | gfrlog | sorry, I won't do it again... |
| 18:52 | amalloy | gfrlog: you should be able to put together a convincing demo of SLIMW by next april 1st |
| 18:53 | amalloy | or the conj. surely there's space for some comic relief |
| 18:55 | gfrlog | amalloy: if it didn't require mucking about in all that windows stuff I'd think about it |
| 18:55 | amalloy | $google microsoft word apple osx |
| 18:55 | sexpbot | First out of 2600000 results is: Microsoft Office for Mac Downloads and Updates | Office For Mac |
| 18:55 | sexpbot | http://www.microsoft.com/mac/downloads |
| 18:56 | gfrlog | amalloy: half as gross |
| 18:56 | amalloy | *chuckle* sometimes you have to get your hands dirty for a laugh |
| 18:57 | gfrlog | now with manual syntax-coloring! |
| 18:58 | amalloy | heh |
| 18:59 | amalloy | Clippy: It looks like you're trying to: call a function! Would you like me to insert the closing ")" for you? Y/N |
| 18:59 | gfrlog | oh I know which letter I'm clicking |
| 19:00 | gfrlog | it's never been easier to export your .clj files to outlook! |
| 19:03 | gfrlog | I wish I knew how to get jvisualvm to tell me the total executation time for the functions... |
| 19:25 | gfrlog | if (binding [*warn-on-reflection* true] ...) does not output any warnings, does that mean that there's no benefit to adding type hints to the code? |
| 19:49 | __name__ | .w abdicate |
| 19:49 | __name__ | ]dict abdicate |
| 19:49 | __name__ | Gosh darned. |
| 19:49 | __name__ | Tabs are evil. |
| 19:49 | __name__ | How did I end up in this tab anyway? |
| 19:50 | gfrlog | you mean that wasn't some strange invocation of sexpbot? |
| 19:50 | __name__ | I blame … GTK. |
| 19:50 | __name__ | No it was not. |
| 19:50 | __name__ | It was me being an idiot. |
| 19:50 | gfrlog | it looks like vim? |
| 19:51 | amalloy | $dict abdicate |
| 19:51 | sexpbot | amalloy: verb-transitive: To relinquish (power or responsibility) formally. |
| 19:51 | __name__ | That would be : |
| 19:51 | amalloy | (for what it's worth) |
| 19:51 | gfrlog | :) |
| 19:51 | __name__ | I blame the time of day. |
| 19:51 | __name__ | It's 1.51 AM. |
| 19:51 | amalloy | gfrlog: i don't expect the (binding) to have any effect at all |
| 19:51 | amalloy | you have to (set! *warn-on-reflection* true) before you compile the code |
| 19:51 | gfrlog | amalloy: this sounds like useful information |
| 19:51 | amalloy | because it's a flag that's checked at compile time |
| 19:52 | gfrlog | okay. So if I'm using lein, when does the code get compiled? |
| 19:52 | amalloy | uhhh |
| 19:52 | gfrlog | I guess "lein compile" would have to do it at some point |
| 19:52 | gfrlog | so then where should the (set! ...) go? |
| 19:52 | gfrlog | in my user.clj? :) |
| 19:52 | amalloy | gfrlog: i usually set! it in the repl before require'ing my code |
| 19:53 | gfrlog | that sounds worth a try. I'ma do it. |
| 19:54 | gfrlog | I think it worked. |
| 19:54 | amalloy | gfrlog: $ cake check |
| 19:54 | gfrlog | okay, so back to the original question -- does a type hint only help in a situation that produces a reflection warning? |
| 19:54 | amalloy | yes |
| 19:55 | gfrlog | this is weird because I get almost none |
| 19:55 | gfrlog | the only warning is when I call (.join ...) on a thread |
| 19:55 | amalloy | okay...so don't add type hints? |
| 19:55 | gfrlog | I guess so. :/ |
| 19:55 | amalloy | you only need them if you're doing direct interop with (.foo) or really-really want to work with primitive numbers |
| 19:56 | gfrlog | I have some integer + :infinity arithmetic that I feel like is probably slower than it could be |
| 19:56 | amalloy | (and getting it right for primitives is a lot harder than you think) |
| 20:03 | amalloy | gfrlog: but type-hinting can definitely help by getting you to work with primitives, even in the absence of reflection warnings |
| 20:03 | gfrlog | hmm :/ |
| 20:03 | amalloy | it's just hard to do right |
| 20:04 | gfrlog | or I could use an array instead of a hash.... |
| 20:49 | amalloy | gfrlog: i don't think i want to live in a universe where that suggestion makes sense |
| 21:54 | pcavs | Where's a good place to look (outside of the source) to see how Clojure implements its parallelism? I am under the impression that it is done automatically by the runtime + compiler, but maybe I am incorrect. |
| 21:54 | hiredman | you are |
| 21:55 | pcavs | incorrect? |
| 21:55 | pcavs | Any places to look/read? |
| 21:55 | hiredman | yes |
| 21:56 | pcavs | http://clojure.org/concurrent_programming is the concurrency screencast good? |
| 22:08 | pcavs | Is it possible to convert a string to a keyword? |
| 22:14 | pcavs | sorry, stupid question |
| 22:15 | pcavs | ,(keyword "My answer is thus") |
| 22:15 | clojurebot | :My answer is thus |
| 22:16 | amalloy | augh who put mixed tabs&spaces in clojure.xml? |
| 22:25 | hiredman | must be clojure/core |
| 22:34 | technomancy | !guards |
| 22:34 | technomancy | oops |
| 22:34 | technomancy | ~guards |
| 22:34 | clojurebot | SEIZE HIM! |
| 22:36 | seancorfield | quick Q... if i have a vector, is there a built in function to find the index of a given value? |
| 22:37 | seancorfield | and what's the bot command to find functions based on arguments |
| 22:37 | hiredman | ,(.indexOf [1 2 3] 1) |
| 22:37 | clojurebot | 0 |
| 22:37 | seancorfield | oh.... a java method... that explains why i couldn't find it :) |
| 22:38 | seancorfield | i'm a bit surprised there isn't a clojure fn for that (but thank you hiredman ) |
| 22:40 | seancorfield | what about finding the key in a map for which the value matches? (just curious now) |
| 22:41 | hiredman | nope |
| 22:41 | seancorfield | ok, just checking |
| 22:41 | seancorfield | (again, just a bit surprised) |
| 22:41 | technomancy | (zipmap (vals m) (keys m)) |
| 22:41 | hiredman | ,(first (some (comp #{:a} second) {:z :a})) |
| 22:41 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword |
| 22:41 | technomancy | rich doesn't like to expose things unless they're performant; see contains? |
| 22:42 | hiredman | bleh |
| 22:42 | seancorfield | (somefn map value) was what i was looking for |
| 22:42 | seancorfield | (first (vals (filter (fn [[k v]] (= v stuff)) map))) was what i came up with (for stuff in map) |
| 22:42 | hiredman | technomancy: well, that is not a very performant solution |
| 22:43 | hiredman | creating a reverse map |
| 22:43 | hiredman | seancorfield: right |
| 22:57 | semperos | say I have an arbitrary map m which is {:a "y" :b "z"}, and I need to create (and (= "y" (:a m)) (= "z" (:b m))) to verify the values of the map |
| 22:57 | semperos | how would I go about generating that and expression? |
| 22:58 | seancorfield | do you want to test the whole map or just some key/value pairs? |
| 22:58 | semperos | whole map |
| 22:59 | seancorfield | so you can just test the whole map |
| 22:59 | seancorfield | (= {:a "y" :b "z"} other-map) |
| 23:00 | semperos | I'm actually using it as part of a clojureql `select` function, which is generating a SQL query behind the scenes from this and expression |
| 23:00 | semperos | I've been able to generate the and expression using templating |
| 23:00 | semperos | https://gist.github.com/1064187 |
| 23:01 | semperos | but I'm not sure what to do with it, and was hoping there was some other way |
| 23:13 | pcavs | Hey, I'm trying to represent a 2D game-map. I was thinking of going with a vector of vectors, does that sound like a good idea? If so, what's the best way to define such a thing? The game-map is generated, so there's a variable number of rows and cols |
| 23:28 | amalloy | $findfn [1 2 3] 1 0 |
| 23:28 | sexpbot | [] |
| 23:28 | amalloy | seancorfield: ^ would get your answer if it were a plain function |
| 23:29 | seancorfield | thanx amalloy |
| 23:30 | amalloy | semperos: there's no way that gist makes any sense. you're not unquoting inside the for |
| 23:30 | seancorfield | $findfn [1 2 3] 2 2 |
| 23:30 | sexpbot | [clojure.core/max-key clojure.core/cond clojure.core/dosync clojure.core/sync clojure.core/char-escape-string clojure.core/with-loading-context clojure.core/*clojure-version* clojure.core/case clojure.core/min-key clojure.core/and clojure.core/locking clojure.core/c... http://gist.github.com/1064215 |
| 23:30 | seancorfield | :) |
| 23:30 | seancorfield | *clojure-version*... interesting match :) |
| 23:31 | amalloy | seancorfield: ##({:k :v} :whatever 2) |
| 23:31 | sexpbot | ⟹ 2 |
| 23:31 | amalloy | but yes, clearly silly |
| 23:33 | amalloy | semperos: clojure.core/and is, guaranteed, not the thing you want to be using here. i'd guess you want every?, but your gist doesn't really make it clear what your intent is if you don't like seancorfield's solution, so i can't solve it "for" you |
| 23:33 | semperos | amalloy: yeah, I realized it didn't make much sense |
| 23:33 | semperos | shouldn't tinker while watching movies with family :) |
| 23:34 | semperos | not looking for anyone to solve it for me |
| 23:34 | semperos | using clojureql.core/select to do a query of a database |
| 23:34 | semperos | I want to be able to have a map/record with certain keys that match column names in a database table |
| 23:35 | semperos | and write a function where I pass in this map/record and use all of the entries to fill out the "where" clause of the select function |
| 23:35 | semperos | basic use looks like (clojureql.core/select (table :foo) (where (= :id (:id my-map)))) |
| 23:36 | amalloy | blugh. iirc clojureql has a lot of macro stuff, which makes this not easy |
| 23:45 | semperos | turns our clojureql's `where` macro for which I was trying to do this just puts together a WHERE clause as a string |
| 23:46 | semperos | since I already wrote code to mangle that with some functions for clojure.contrib.sql with strings, this is a non-issue |
| 23:56 | seancorfield | it's pretty easy to do that with clojure.java.jdbc already |
| 23:57 | seancorfield | https://gist.github.com/1064231 |
| 23:57 | seancorfield | q and qi and naming strategies |
| 23:58 | seancorfield | updated gist with those |
| 23:58 | semperos | seancorfield: thanks for sharing |
| 23:59 | semperos | still using 1.2 myself, but that all makes sense |
| 23:59 | seancorfield | that's from our production code (hence ws/worldsingles-db-readonly) |
| 23:59 | semperos | yeah |
| 23:59 | seancorfield | naming strategies are new in c.j.j (compared to c.c.sql) but the rest should work |
| 23:59 | semperos | yep |
| 23:59 | seancorfield | you know you can depend on c.j.j 0.0.3 even tho' you're on clojure 1.2? |