2010-02-14
| 01:03 | piccolino | Is there some way to test if a vector has a certain element in it? |
| 01:04 | hiredman | .contains |
| 01:04 | hiredman | ,(.contains [1 3] 3) |
| 01:04 | clojurebot | true |
| 01:05 | piccolino | Thanks. |
| 01:13 | piccolino | Oh, that only works on vectors. |
| 01:21 | hiredman | piccolino: no, the .contains method is part of the interface for java Collections, works on any Collection |
| 01:21 | hiredman | ,(.contains '(1 2 3) 3) |
| 01:21 | clojurebot | true |
| 01:21 | hiredman | ,(.contains (seq '(1 2 3)) 3) |
| 01:21 | clojurebot | true |
| 01:21 | piccolino | Hm, I had tried it on a map. |
| 01:23 | zaphyr | how do i specify a void return value in a :methods section? |
| 01:24 | hiredman | ,(instance? java.util.Collection {}) |
| 01:24 | clojurebot | false |
| 01:24 | hiredman | ,(instance? java.util.Collection (seq {})) |
| 01:24 | clojurebot | false |
| 01:24 | hiredman | on |
| 01:24 | hiredman | ,(instance? java.util.Collection (seq {:a 1})) |
| 01:24 | clojurebot | true |
| 01:25 | hiredman | zaphyr: did you try void? |
| 01:26 | zaphyr | no. :) |
| 01:26 | hiredman | I don't recall for sure, but I would try it |
| 01:28 | no_mind | is clojure google group moderated ? |
| 01:28 | zaphyr | hiredman- instant win. ta :) |
| 01:35 | hiredman | no_mind: yes |
| 01:36 | hiredman | google groups apparently have a pretty serious spam problem for people who don't read them via gmail |
| 01:53 | no_mind | ok, that is why my post did not appear :) |
| 01:55 | hiredman | it used to be only the first post had to be approved, but spam spoofing addresses of group members started to show up |
| 02:24 | defn | Anyone here use libcurl with clojure at all? |
| 04:01 | zaphyr | hmm. weirdness. i am trying to :use a regular clojure namespace within a :gen-class namespace |
| 04:01 | zaphyr | compilation works fine- but when i try to instance it i get error: java.lang.NoClassDefFoundError: Could not initialize class ui.action (ui.clj:21) |
| 04:03 | Chousuke | how are you instantiating it? |
| 04:03 | zaphyr | (ui.action. title) |
| 04:03 | Chousuke | is that the full namespace? :/ |
| 04:04 | zaphyr | yep |
| 04:04 | zaphyr | i know, that's a naughty namespace :) |
| 04:04 | Chousuke | and you have the classes/ dir in your classpath and all? |
| 04:04 | zaphyr | yep |
| 04:04 | Chousuke | hm |
| 04:04 | zaphyr | i can even disassemble it with javap |
| 04:04 | zaphyr | the class *is* there |
| 04:05 | Chousuke | did you define the init function? |
| 04:05 | zaphyr | yep |
| 04:05 | zaphyr | i'm doing some magic in post-init |
| 04:05 | zaphyr | np ;) |
| 04:05 | Chousuke | hmm. :/ |
| 04:06 | zaphyr | http://paste.lisp.org/display/94930 |
| 04:06 | zaphyr | that's the code for ui.action |
| 04:06 | zaphyr | i switched the :use to a :require to see if it made any difference, which it didn't :S |
| 04:08 | zaphyr | http://paste.lisp.org/display/94931 |
| 04:08 | zaphyr | that's the contents of ui.util |
| 04:08 | zaphyr | (a truly horrible function that could probably be a one liner, yea yea :)) |
| 04:10 | Chousuke | hmmh :/ |
| 04:11 | Chousuke | I wish the error message were a bit more descriptive |
| 04:12 | Chousuke | can you try instantiating the thing in a repl and then print the whole stacktrace? |
| 04:12 | Chousuke | though since it's a NoClassDefFoundError it's probably some classpath gotcha |
| 04:13 | Chousuke | and by the way, the actionPerformed method has a potential race |
| 04:13 | zaphyr | http://paste.lisp.org/display/94932 |
| 04:13 | zaphyr | oh really? |
| 04:13 | zaphyr | oh, of course |
| 04:14 | Chousuke | you should do (when-let [x @(.state this)] (x)) |
| 04:14 | zaphyr | fixed, ta |
| 04:15 | zaphyr | now i suppose i will see if i can put together a minimal example of this weirdness... |
| 04:15 | Chousuke | you did restart slime after you compiled the namespace, right? |
| 04:15 | zaphyr | several times :S |
| 04:16 | Chousuke | I wonder what that ui$eval... thing is :/ |
| 04:16 | Chousuke | looks like a single-segment namespace :P |
| 04:16 | zaphyr | ;) |
| 04:16 | zaphyr | it is, horrors, it's in (ns ui) |
| 04:16 | Chousuke | hm |
| 04:17 | zaphyr | maybe i should stick another directory up there |
| 04:17 | Chousuke | you should |
| 04:17 | Chousuke | single-segment namespaces can cause weird problems. |
| 04:19 | Chousuke | I doubt changing it will actually fix your problem, but at least it's not so evil anymore :) |
| 04:22 | zaphyr | nup. same old. |
| 04:22 | zaphyr | but, at least i can sleep at night now |
| 04:46 | zaphyr | hmm. kids? don't use single level namespaces. that does seem to cause the issue |
| 05:07 | ordnungswidrig1 | moin |
| 06:29 | LauJensen | Good afternoon team |
| 06:33 | zaphyr | bleh. anyone else find that (javax.swing.SwingUtilities/invokeAndWait #(javax.swing.JFileChooser.)) from the slime repl hangs everything dead? |
| 06:33 | zaphyr | (under win32 at least) |
| 06:35 | LauJensen | ehm... you said 'hang' and 'windows'..... |
| 06:35 | zaphyr | =P |
| 07:36 | underdev | is there a way that i can coerce a list of symbols to return a list of strings with each string the textual value of the symbol? |
| 07:36 | underdev | ie autoquote, or barewords |
| 07:37 | Chousuke | ,(map str '(foo bar)) |
| 07:37 | clojurebot | ("foo" "bar") |
| 07:37 | StartsWithK | (map name sym-seq) |
| 07:38 | Chousuke | name will leave out the namespace portion |
| 07:42 | Kenny164 | Hi all |
| 07:43 | Kenny164 | I'm having troubles with getting enlive to work in emacs, looked like a classpath error, but its ok on the clj? |
| 07:56 | underdev | thanks guys\ |
| 08:02 | underdev | speaking of emacs (i don't know enlive), i picked up the oreilly emacs extension book for $5 +s/h, there are more for that price if anyone wants one |
| 08:03 | underdev | its like tcl, one of the great things is that one can purchase an entire library for $3 a book |
| 08:05 | Kenny164 | yeah, I think i'll be getting a few books, heh, I could do with them, google's letting me down badly (too much cruft) |
| 08:06 | underdev | oic, enlive is clojure |
| 08:06 | underdev | oooh, neat |
| 08:06 | Kenny164 | yeah, another clojure library |
| 08:07 | Kenny164 | for webscraping. I've used lxml for this sort of work in python, but thought i'd try dipping into clojure |
| 08:11 | underdev | really love some of pythons libs (pygnents + moinmoin ftw), but never really loved python |
| 08:11 | underdev | pygments* |
| 08:13 | Kenny164 | my love for python started fading when i tried going async |
| 08:14 | Kenny164 | this time last week I wasn't even aware of the GIL |
| 08:34 | LauJensen | Fun to look at the search terms which generates traffic, like "work clj but no emacs" or "scala tutorial" :) |
| 08:35 | underdev | you should google bomb your site for "scala tutorial" |
| 08:35 | underdev | the world will thank you |
| 08:36 | underdev | eventually |
| 08:45 | Chousuke | does anyone know how to properly build Clojure using maven? neither mvn compile nor mvn install seem to do anything useful :/ |
| 08:45 | Chousuke | mvn install creates an empty jar and puts it in the local repository :P |
| 08:46 | ikitat | ant |
| 08:47 | ikitat | the pom.xml doesn't seem to be configured for a build |
| 08:47 | Chousuke | that's what I'm wondering. |
| 08:48 | Chousuke | it's just that leiningen uses maven and I'd like to have it use my own version of 1.2.0-snapshot :P |
| 08:48 | Chousuke | and I would like to know how to use maven to build and install one. |
| 08:48 | ikitat | clojure-contrib is being built with maven |
| 08:49 | Chousuke | these tools thoroughly confuse me. |
| 08:49 | ikitat | you can use mvn install-file or something like that |
| 08:49 | ikitat | it'll put the jar into your local repo |
| 08:50 | Chousuke | I'll try that. |
| 08:50 | ikitat | mvn install:install-file |
| 08:50 | ikitat | http://maven.apache.org/plugins/maven-install-plugin/usage.html |
| 08:54 | Chousuke | hm, looks like it worked. |
| 08:54 | ikitat | Chousuke: you can probably just mvn install:install-file -Dfile=clojure.jar -DpomFile=pom.xml |
| 08:54 | Chousuke | these tools are way too flexible :P |
| 08:55 | ikitat | maven can be really frustrating at first |
| 08:55 | ikitat | then again, making a custom build.xml can be frustrating too |
| 09:39 | Chousuke | ikitat: maybe you just need to bind *out* to something |
| 09:42 | ikitat | should all libraries print errors then bury specific exceptions into more general exceptions? |
| 09:43 | ikitat | we shouldn't expect running a database command to print anything |
| 09:44 | Chousuke | perhaps not. |
| 09:44 | ikitat | even if it does fail, just let the sqlexception propegate |
| 09:45 | ikitat | but even then, it jams the sqlexception into exception and throws! That (I think) is bad form as it is unecessarily hiding detail |
| 09:45 | Chousuke | I wonder why it's wrapping the exception though. |
| 09:45 | ikitat | it's using throwf from c.c.except |
| 09:46 | Chousuke | Sometimes Clojure needs to wrap things in RuntimeException to get around checked exception limitations but hm. |
| 09:46 | ikitat | that's not the case here, because you can throw and catch an sqlexception just fine (even though it is a checked exception) |
| 09:46 | ikitat | but wait, there is more |
| 09:47 | ikitat | c.c.sql expects that *err* has a .println method (which isn't really part of the contract for *out* and *err*) |
| 09:48 | Chousuke | actually I think it is. |
| 09:49 | Chousuke | (doc *err*) |
| 09:49 | clojurebot | "; A java.io.Writer object representing standard error for print operations. Defaults to System/err, wrapped in a PrintWriter" |
| 09:49 | Chousuke | hmm |
| 09:49 | ikitat | so it defaults to printwriter which has .println |
| 09:49 | ikitat | but java.io.Writer doesn't have a .println |
| 09:50 | ikitat | with all of that, I think c.c.sql is making a few incorrect assumptions |
| 09:50 | Chousuke | You could post on the group about it. |
| 09:51 | Chousuke | this rant will probably be missed by all the relevant people :) |
| 09:51 | ikitat | it's a good idea, I'm going to print out a contributor agreement too so I can submit a patch too |
| 09:51 | ikitat | :) |
| 09:52 | Chousuke | heh |
| 09:52 | ikitat | I dunno, I think the irc logs contain more useful info than the group most days :) |
| 09:52 | Chousuke | Well, yeah |
| 09:52 | Chousuke | but it's still easy to miss important bits |
| 09:53 | ikitat | I'll write it up in a moment |
| 09:53 | underdev | disclojure's intertweets are very good too |
| 09:54 | underdev | tbatchelli, if you are here, THANK YOU |
| 09:54 | ikitat | "Discussions aren't available right now. We're sorry. Try again shortly." |
| 09:54 | ikitat | doh |
| 10:01 | underdev | anyone know a way to get slime-repl clojure to report errors in its own buffer instead of opening another one? |
| 10:02 | underdev | or open the error replace its own buffer with the error instead of knocking out my clojure file's buffer? |
| 10:02 | underdev | or freaking anything but the default behavior???!?! |
| 10:42 | konr | Haha, I'm addicted to -> and ->>. Is it bad style to use them all the time? |
| 10:44 | Chousuke | :P |
| 10:47 | ikitat | uhg, google groups just swallowed my post :P |
| 11:27 | ikitat | google groups says my post was successful but doesn't display it!? |
| 11:27 | ikitat | things are not going my way today |
| 11:32 | qbg | ikitat: It be undergoing moderation |
| 11:32 | qbg | *it might be |
| 11:35 | no_mind | ikitat, the group is moderated |
| 11:36 | ikitat | ah, too bad google groups didn't mention that when I submitted :P |
| 12:02 | konr | Is there a way to run (foo) and if it raises an exception, return "bar"? |
| 12:04 | Chousuke | (try (foo) (catch Exception e "bar)) |
| 12:04 | Chousuke | oops, missing quote :P |
| 12:05 | Chousuke | I want paredit on irc :( |
| 12:06 | konr | haha thanks! |
| 12:17 | avarus | hi |
| 13:04 | hamza | guys, assuming i have the following two vectors [:a :b :c] [1 2 3] how can i turn this into [:a 1 :b 2 :c 3] ? |
| 13:04 | Chousuke | ,(interleave '[a b c] [1 2 3]) |
| 13:04 | clojurebot | (a 1 b 2 c 3) |
| 13:05 | hamza | Chousuke: thanks a lot... |
| 13:37 | wgl | Any users of slime for clojure using the latest version? I am getting odd hangs with the 2010-01-14 version. |
| 13:37 | jlilly | I'm actually having issues with slime / clojure as well. Getting a "not connected" error. |
| 13:39 | wgl | jlilly: I went back to the 2009-06-05 version and it seems to be working so far. |
| 13:39 | jlilly | thx, I may try that. |
| 13:40 | ikitat | the latest in ELPA seems to be 20091016 which is working well for me |
| 13:41 | jlilly | hmm. thinking my issue is slime moreso than clojure. :-/ |
| 13:42 | jlilly | m-x slime apparently fixed it. |
| 13:43 | qbg | Starting SLIME tends to help |
| 13:43 | jlilly | :-P |
| 13:44 | qbg | My only issue is that I need to add clojure to slime-lisp-implementations, even though swank-clojure should do that automatically. |
| 13:53 | bosie | anyone knows what i have to do to get a proper REPL console in Terminal.app under macosx? |
| 13:53 | ikitat | java -cp clojure.jar clojure.main |
| 13:53 | bosie | ikitat: yea but pressing the cursor results in 'user=> ^[[A' |
| 13:54 | ikitat | rlwrap or jline will help with that |
| 13:54 | ikitat | http://clojure.org/getting_started shows usage with jline |
| 13:57 | bosie | ikitat: interesting |
| 13:58 | bosie | ikitat: worked. thanks. |
| 14:53 | Raynes | Ioke's git repo is insanely large. |
| 14:54 | Raynes | Unreasonably large. :| |
| 14:57 | Chousuke | Raynes: does it contain binaries or something? :/ |
| 14:57 | Raynes | Chousuke: It must. It's like 300+ mb. |
| 14:59 | Chousuke | hm |
| 15:10 | bosie | is there a site/tutorial explaining how one would group functions in lisp/clojure? |
| 15:15 | ikitat | bosie: clojure uses namespaces for grouping functions |
| 15:15 | ikitat | bosie: you can look at the code in clojure-contrib for some good examples |
| 15:15 | bosie | ikitat: thanks |
| 15:19 | Chousuke | I suppose the functions of a single namespace should share a common "theme" |
| 15:21 | seths | a namespace seems more like a layer than a group |
| 15:21 | seths | since cyclic dependencies aren't supported |
| 15:24 | Raynes | chouser: You and fogus aren't writing fast enough for my taste. Get busy. :p |
| 15:48 | LauJensen | Agreed - Raynes, play the banjo to get them started! |
| 15:48 | Raynes | ;) |
| 15:51 | ordnungswidrig1 | Is maven the next best alternative to leiningen for multi-project builds? |
| 15:53 | Raynes | Leiningen is the best alternative to Leiningen when you can't use Leiningen. |
| 15:54 | Chousuke | :P |
| 15:56 | icey | I'm not sure which version of clojure I should be speficying in my project.clj. If I use 1.1.0-new-SNAPSHOT, congomongo doesn't work. If I use 1.1.0-master-SNAPSHOT, "lein compile" has problems. Which version are you guys using? |
| 15:56 | patrkris | does anyone know where the source code for lein-nailgun can be found? |
| 15:57 | Raynes | I use 1.2.0-master-SNAPSHOT, but I don't have any dependencies that require I don't. |
| 15:57 | icey | Raynes: is that fairly stable right now? |
| 15:58 | Raynes | icey: I suppose so. It's just snapshots of the current git repositories. |
| 15:59 | icey | hmm, gonna give that one a go and see what happens :D |
| 16:03 | icey | yeah, it looks like congomongo is picky about the clojure version it has available |
| 16:03 | LauJensen | ordnungswidrig1: Had a look at Clojuresque, the Gradle plugin ? |
| 16:04 | ordnungswidrig1 | LauJensen: not yet. |
| 16:05 | ordnungswidrig1 | LauJensen: but I sounds like a good idea |
| 16:05 | LauJensen | Have a look at kotka.de/blog |
| 16:08 | icey | hummm... it looks like I must have been doing something wrong. I reconfigured for 1.1 master, ran lein clean, lein deps and lein compile and now everything is working well together |
| 16:09 | icey | i can only imagine how painful this would have been without lein though; definitely happy it's around |
| 16:17 | LauJensen | One great thing about it is the simplicity. I'm regularity putting my blogpost code in lein projects, because people can get the code, get the deps and run it in less than a minute |
| 16:29 | icey | LauJensen: Actually, one of your blog postings is what made me take another look at lein :D |
| 16:29 | LauJensen | Really - Why ? |
| 16:31 | icey | Because it looked really nice and easy to create the uberjar (from the reddit clone post) |
| 16:31 | icey | I don't know anything about javaland, so it was attractive to me that it took care of it all |
| 16:31 | LauJensen | ah ok |
| 16:32 | LauJensen | Yes actually thats an insane amount of deployment power you get in about 10 lines of lein |
| 16:32 | LauJensen | "10 leins" :) |
| 16:32 | icey | lol; yeah.. between clojars / lein deps and the deployment story, it makes for a very compelling reason to use it |
| 16:33 | technomancy | ordnungswidrig1: someone has some patches to leiningen for multi-module builds, but they won't be merged until after the 1.1.0 release |
| 16:34 | ordnungswidrig1 | hmm, how can I pass a bindig into a fn definition? |
| 16:34 | ordnungswidrig1 | (def x nil) |
| 16:34 | ordnungswidrig1 | (trace "X" ((binding [x "X"] |
| 16:34 | ordnungswidrig1 | (fn [] x)))) |
| 16:34 | ordnungswidrig1 | this gives "nil" |
| 16:34 | ordnungswidrig1 | technomancy: ok, thanks. |
| 16:36 | technomancy | is there anything like elisp's "provide" function that will cause "require" to know that an ns has already been loaded? |
| 16:36 | technomancy | even if the file corresponding to it may not have been required? |
| 16:40 | sunkencity | where can I find a list of predicates in clojure? looking for something like "atom" in common-lisp, how can I check that? Not a sequence? |
| 16:42 | technomancy | ,(filter #(re-find #"\?$" (name (first %))) (ns-publics 'clojure.core)) |
| 16:42 | clojurebot | ([keyword? #'clojure.core/keyword?] [chunked-seq? #'clojure.core/chunked-seq?] [instance? #'clojure.core/instance?] [sequential? #'clojure.core/sequential?] [fn? #'clojure.core/fn?] [nil? #'clojure.core/nil?] [string? #'clojure.core/string?] [sorted? #'clojure.core/sorted?] [false? #'clojure.core/false?] [true? #'clojure.core/true?] [odd? #'clojure.core/odd?] [symbol? #'clojure.core/symbol?] [future-done? #'clojure.core/fu |
| 16:42 | technomancy | sunkencity: ^ |
| 16:42 | morphling | sunkencity: coll? is true for collections |
| 16:42 | sunkencity | technomancy: thanx! |
| 16:45 | sunkencity | morphling: thanx, coll works fine! |
| 17:02 | piccolino | I am all out of ideas on my problem here. Anyone see anything I don't? http://gist.github.com/304292 |
| 17:05 | chouser | try 'next' instead of 'rest', just for kicks. |
| 17:05 | piccolino | Yeah, I already did, it gives the exact same result. |
| 17:09 | Raynes | Oh no. The dreaded NullPointerException. |
| 17:09 | ordnungswidrig1 | ,(binding [g 1] ((fn [] g))) |
| 17:09 | clojurebot | java.lang.Exception: Unable to resolve var: g in this context |
| 17:10 | chouser | piccolino: you're sure the NPE is from the recur? |
| 17:10 | ordnungswidrig1 | ,(binding [g 1] ((fn [] g))) |
| 17:10 | clojurebot | java.lang.Exception: Unable to resolve var: g in this context |
| 17:10 | ordnungswidrig1 | ups |
| 17:10 | ordnungswidrig1 | sorry. |
| 17:10 | piccolino | Well, the actual stack trace has clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:263) at the top, and the next thing down the stack is blah$wrap_result__11091.invoke. |
| 17:11 | piccolino | And I have done println debugging to where if I change it to (do (println "Test") (recur ...)) that Test prints. |
| 17:11 | piccolino | So I think that is something from the recur. Though like I said, if I execute either clause separately right before, they work fine. |
| 17:12 | chouser | I bet it's coming after the recur. if remaining-kvs is empty, (.getFamily kv) will throw |
| 17:13 | piccolino | Ahhhhh. |
| 17:13 | piccolino | Yeah, you're right. |
| 17:13 | piccolino | I need to do that if (nil? kv) test sooner. |
| 17:14 | ordnungswidrig | piccolino: that's nice spot for an if-let |
| 17:14 | piccolino | I'd never even heard of if-let. Lemme look that up. |
| 17:16 | ordnungswidrig | are var bindings thread local? |
| 17:16 | chouser | yes |
| 17:18 | ordnungswidrig | hmm, so how can I solve the following problem: given a lib with a local var *config* and a with-config macro which expands to a binding [*config* …]. The lib is called from a jetty thread and does not receive it's binding. |
| 17:18 | technomancy | ordnungswidrig: take a look at bound-fn |
| 17:19 | piccolino | Wow, I cannot even figure out how to use if-let. |
| 17:20 | ordnungswidrig | piccolino: (if-let [kv (first remaining-kvs] (recur …) (kv-map)) |
| 17:21 | piccolino | OK, so the test is also the assigned value? |
| 17:21 | ordnungswidrig | piccolino: (if-let [x foo] (bar x) (baz x)) is (let [x foo] (if x (bar x) (baz x)) |
| 17:21 | ordnungswidrig | piccolino: yes |
| 17:21 | piccolino | OK, thanks. |
| 17:25 | piccolino | Wonderful, it's all working. Thanks guys. |
| 17:25 | ordnungswidrig | bound-fn to the rescue! |
| 17:25 | ordnungswidrig | thanks |
| 17:25 | ordnungswidrig | me - sleep - now. |
| 17:26 | bosie | anybody knows why, all of a sudden, i get this: http://gist.github.com/304306 |
| 17:28 | ikitat | clojure-contrib is not in your classpath? |
| 17:28 | AWizzArd | bosie: (System/getProperty "java.class.path") |
| 17:29 | bosie | AWizzArd: results in the right path |
| 17:29 | Raynes | bosie: It's been renamed. |
| 17:29 | Raynes | c.c.seq I believe. |
| 17:29 | Raynes | http://groups.google.com/group/clojure-dev/browse_thread/thread/49068754a8c2efb9# |
| 17:29 | piccolino | Hm, transients are apparently not collections. I was not expecting that. |
| 17:31 | AWizzArd | Raynes: good info, thx |
| 17:31 | Raynes | I got bit in the ass by the rename a few days ago. |
| 17:32 | technomancy | transients are collections |
| 17:33 | technomancy | they're just not persistent |
| 17:33 | piccolino | coll? returns false. |
| 17:34 | bosie | ikitat: crap, i don't know why but it wasn't there |
| 17:34 | technomancy | right; coll? also checks for persistence |
| 17:34 | technomancy | (doc coll?) |
| 17:34 | clojurebot | "([x]); Returns true if x implements IPersistentCollection" |
| 17:34 | piccolino | Ah. |
| 17:34 | piccolino | Is there some way to ask "Can I run map on this?" |
| 17:34 | technomancy | it's a bit unexpected though if you don't read the docstring |
| 17:35 | technomancy | piccolino: probably sequential? |
| 17:35 | technomancy | maybe not; it doesn't return true for arrays |
| 17:36 | piccolino | Well, I guess you can't run map on transients anyhow. |
| 17:36 | technomancy | it also doesn't work for strings, which you can map |
| 19:02 | fanatico | I'm writing a macro to turn (named-map :x :y :z) => (zipmap [:x :y :z] [x y z]). Right now I have http://gist.github.com/304345. This works for vars, but eval doesn't see local bindings. Any way to get around this? |
| 20:00 | underdev | oic, you press 0 at the exception and slime-repl clojure restores the previous buffer |
| 20:00 | underdev | vn |
| 20:09 | icey | noob question - i grabbed a jar from clojars (jbcrypt); and lein pulled it down with no problems. but i can't seem to (use) it the same way i do every other jar. |
| 20:10 | icey | is there a way to determine the name i should be using instead of the .jar name? |
| 20:10 | icey | (i get Could not locate jbcrypt__init.class or jbcrypt.clj on classpath: ) |
| 20:11 | ikitat | icey: jbcrypt is a java lib or clojure lib? |
| 20:12 | icey | ikitat it's a java lib |
| 20:12 | ikitat | so you don't want to 'use' it you want to 'import' it |
| 20:12 | icey | ahhhh |
| 21:16 | piccolino | Just wondering: Is there something about how transients work that means it doesn't make sense to define something like ISeq for them? |
| 21:17 | hiredman | yes |
| 21:17 | hiredman | transients are almost the antithesis of sequences |
| 21:18 | hiredman | sequences are generally lazy, transients are not, sequences are immutable, transients are not, etc |
| 21:36 | piccolino | Oh I know, but it just seems like it's very limiting to not be able to step through the contents of one. I didn't mean ISeq itself, maybe something like ITransientSeq, just so you could call map and stuff on them. |
| 21:41 | hiredman | piccolino: uses reduce |
| 21:42 | hiredman | er |
| 21:42 | hiredman | *shrug* |
| 21:44 | piccolino | Yeah, I tried that too |
| 21:44 | piccolino | Ah well |
| 22:29 | jlilly | hey folks. is there something like elisp's prog block which allows me to execute multiple things for a statement. |
| 22:29 | qbg | do |
| 22:29 | jlilly | ie: (if (mycond) (XXXX (statement 1) (statement 2)) (else block) |
| 22:29 | jlilly | so XXXX = do? |
| 22:29 | qbg | ,(doc do) |
| 22:29 | clojurebot | Excuse me? |
| 22:29 | ikitat | do is a special form no? |
| 22:29 | ikitat | but do would do it :) |
| 22:30 | ikitat | it'd be cool if (doc special-form) would work |
| 22:31 | hiredman | it does at the repl where it is special cased by doc |
| 22:31 | jlilly | also.. are there style guidelines for clojure code? |
| 22:31 | hiredman | actually at the repl it just gives you a url |
| 22:31 | ikitat | hiredman: really, I could have swore that didn't work |
| 22:33 | ikitat | jlilly, maybe this https://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards |
| 23:05 | technomancy | jlilly: there's a good one that's more general (scheme/CL-focused) at http://mumble.net/~campbell/scheme/style.txt |
| 23:06 | technomancy | still lots of good notions in there |
| 23:20 | jasapp | http://paste.lisp.org/display/94966 |
| 23:20 | jasapp | what would be the best way to do that? |
| 23:21 | jasapp | late I've gotten the impression that anaphora is bad, but I'm used to using it from cl |
| 23:22 | jasapp | lately |
| 23:23 | dakrone | what's the right way to cast nil to a different object type in Clojure? |
| 23:23 | jasapp | what different object type do you have in mind? |
| 23:24 | dakrone | implementing this java line: tagger = new PosTagger(model,(Dictionary)null); |
| 23:25 | dakrone | if I do nil without casting, can't find matching ctor |
| 23:25 | arbscht | jasapp: anaphora in CL is probably bad style too. in either case, it might be better to let the caller provide a symbol for binding |
| 23:26 | arbscht | (foo [y] (inc y)) |
| 23:26 | jasapp | ahh, ok |
| 23:26 | jasapp | bad style in CL? |
| 23:27 | arbscht | jasapp: yes, it is just as confusing in any lisp, imo |
| 23:27 | jasapp | that one guy from allegro used it everywhere |
| 23:27 | slyphon | multimethods...wow |
| 23:28 | jasapp | aif if I remember correctly |
| 23:28 | jasapp | arbscht: I think I'm starting to agree with you though |
| 23:28 | arbscht | well, there is no consensus on good CL style ;) in CL it is common to see things like (with-output-to-string (s) (foo s)) |
| 23:31 | qbg | darkrone: Applying a type hint to nil might work |
| 23:31 | yuuki | Is there a way to create cyclical objects in clojure? |
| 23:32 | yuuki | for intance, a list that contains itself? |
| 23:32 | jasapp | yuuki: I remember hearing no, but that was quite some time ago |
| 23:32 | qbg | yuuki: Why do you want that? |
| 23:33 | yuuki | I'm implementing a language that can be recursive, so I want to have a piece of code point to its enclosing block |
| 23:33 | qbg | Anyways, a reference type should be able to store a reference to itself |
| 23:35 | qbg | So you want the function to exist in its environment? |
| 23:36 | yuuki | hmm, I think I'm going about it in the wrong way |
| 23:40 | dakrone | qbg: I don't remember how to apply it to nil, [#^Dictionary nil] gives me errors |
| 23:40 | qbg | Try something like (let [foo nil] ... #^Dictionary foo ...) |
| 23:42 | qbg | Hmm, alternatively, try quoting nil |
| 23:48 | tomoj | why would you want a reference type to refer to itself? that sounds awesome |
| 23:49 | tomoj | I get a stack overflow error trying to make an atom refer to itself :( |
| 23:49 | qbg | Are you printing it? |
| 23:50 | qbg | ,(let [foo (atom nil)] (reset! foo foo) nil) |
| 23:50 | clojurebot | nil |
| 23:50 | tomoj | ah, yeah, I guess I tried to print it |
| 23:51 | tomoj | is there any reason to do that, though? |
| 23:51 | tomoj | seems cool, but I can't imagine a use |
| 23:53 | qbg | Well, how about an atom that holds a vector that also contains the atom? |
| 23:55 | qbg | That way you could hold on to old state, but have the current state available and settable. |