2009-09-04
| 00:00 | duck1123 | but the problem still exists for the general case |
| 00:06 | tomoj | maybe you'd need to define your own report? |
| 00:06 | tomoj | I dunno, I'm not very familiar with clojure.test |
| 02:35 | hiredman | http://bldgblog.blogspot.com/2009/08/dissection-of-cathedral.html |
| 02:35 | hiredman | whoops, mischan |
| 02:51 | subhadeep | join/left |
| 02:51 | subhadeep | too much for this chan |
| 02:51 | subhadeep | the bot should do something to handle join floods |
| 02:55 | hiredman | subhadeep: mosts irc clients have some way of ignoring them |
| 02:56 | LauJensen | Top of the morning gents |
| 02:56 | hiredman | and the rest of the day to you, sir |
| 02:59 | LauJensen | Why thank you kindly hiredman |
| 03:03 | subhadeep | yea hinderman but still could be handled by a bot here |
| 03:03 | subhadeep | but dunno if freenode allows chan moderating bots |
| 03:04 | opqdonut | what? |
| 03:04 | opqdonut | a bot can't moderate joins or parts |
| 03:05 | subhadeep | it can make +R |
| 03:05 | subhadeep | and stuff to hold on the fort long enough |
| 03:06 | subhadeep | +l |
| 03:06 | subhadeep | and loads of stuff |
| 03:06 | hiredman | or we could prmote individual responsibility and action |
| 03:07 | subhadeep | which is bit hard |
| 03:07 | subhadeep | there r kiddies out there |
| 03:07 | hiredman | … |
| 03:09 | subhadeep | which client u guys using ? |
| 03:09 | subhadeep | i'm using chatzilla at work |
| 03:09 | subhadeep | but mirc rulez |
| 03:10 | opqdonut | irssi |
| 03:10 | subhadeep | wokay |
| 03:11 | hiredman | ~irssi is the client of the future |
| 03:11 | clojurebot | Ik begrijp |
| 03:11 | opqdonut | hehe |
| 03:11 | opqdonut | it's been the client of the future for some 10 years already |
| 03:11 | opqdonut | i'd say weechat is the client of the future |
| 03:30 | LauJensen | Never heard of ERC? |
| 03:30 | opqdonut | sure, and found it very unusable |
| 03:30 | opqdonut | was very sluggish in large channels |
| 03:30 | LauJensen | yes, it takes a little skill to set up |
| 03:30 | opqdonut | seems due to some bad data structure choices |
| 03:32 | LauJensen | Anybody working on some interesting libraries nowadays ? |
| 04:23 | subhadeep | back from lunch |
| 04:23 | subhadeep | mirc is the client of the future |
| 04:23 | subhadeep | though runs on winblows |
| 04:23 | LauJensen | subhadeep: say hi in #ircclients :) |
| 04:23 | subhadeep | but its scripting language is the best |
| 04:23 | subhadeep | :D |
| 04:23 | subhadeep | hehe |
| 04:25 | AWizzArd | subhadeep: extended it so it supports Clojure :) |
| 04:25 | subhadeep | yo |
| 04:25 | subhadeep | will try my best |
| 04:26 | subhadeep | :D |
| 04:27 | subhadeep | no |
| 04:27 | subhadeep | oops |
| 04:27 | subhadeep | wrong window |
| 04:56 | alinp | hi |
| 04:56 | alinp | I compiled the clojure files to class files (bytecode) |
| 04:56 | alinp | is there a way to use them in my clj repl ? |
| 04:57 | alinp | it seems that this doesn't work for some reason |
| 04:57 | AWizzArd | what are "the" clojure files? |
| 04:57 | AWizzArd | You mean you compiled a Clojure namespace via compile? |
| 04:57 | alinp | (ns my.package) |
| 04:57 | alinp | (defn test [a b] (+ a b)) |
| 04:57 | AWizzArd | Then you can (use 'my.package) |
| 04:57 | AWizzArd | in a fresh repl |
| 04:57 | alinp | it doesn't work |
| 04:58 | alinp | I compiled the clj files to bytecode |
| 04:58 | AWizzArd | then the package is not on the classpath |
| 04:58 | alinp | Could not locate my/package__init.class or my/package.clj on classpath |
| 04:59 | alinp | well .. I added there |
| 04:59 | alinp | that's why I asked here |
| 04:59 | AWizzArd | not yet added, even if you think it should be added already |
| 05:00 | alinp | well, I have the jar with all class files |
| 05:00 | alinp | and for sure the repl started having it in the classpath |
| 05:00 | alinp | so, once again, there are not clj files |
| 05:00 | alinp | are compiled files |
| 05:01 | AWizzArd | On Windows you can run this: (doseq [path (.split (System/getProperty "java.class.path") ";")] (println path)) |
| 05:01 | AWizzArd | on Linux split at "," |
| 05:01 | alinp | yeah .. it seems is not there ... |
| 05:01 | alinp | for a strage reason |
| 05:02 | AWizzArd | but it is good, because we now know very exactly on what we can work |
| 05:02 | alinp | yeah, it's working now |
| 05:02 | AWizzArd | grats :) |
| 05:02 | alinp | thanks dude |
| 05:02 | alinp | it was my fault, indeed |
| 05:02 | alinp | shouldn't be good a clj constant for the classpath ? |
| 05:03 | alinp | seems to be handy in this situation |
| 05:03 | alinp | in fact |
| 05:03 | alinp | ps ax|grep java will do the trick :D |
| 05:50 | triyo | I am using the clojure.xml/parse function. What would be the best way to query the data thats returned from the parse function? Its a map with many nested vectors and maps. So, for example, give me all elements that have the label attribute. |
| 05:51 | jdz | ~enlive |
| 05:51 | clojurebot | Pardon? |
| 05:51 | jdz | hmm, what was it called then? or is the bot unaware of it? |
| 05:51 | jdz | http://clj-me.blogspot.com/2009/01/enlive-yet-another-html-templating.html |
| 05:51 | jdz | might be helpful. have not personally used it. |
| 05:53 | subhadeep | ~scala |
| 05:53 | clojurebot | Unfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala |
| 05:54 | subhadeep | ~scala |
| 05:54 | clojurebot | Scala often gets in the way when trying to write neat code -- seen in #scala |
| 05:54 | subhadeep | hehehehe |
| 05:54 | triyo | thanks jdz, I'll have a look and enlive ... selector-based approach is what I am after |
| 05:54 | eevar2 | ~haskell |
| 05:54 | clojurebot | Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you compute. |
| 05:54 | eevar2 | ~haskell |
| 05:54 | clojurebot | Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you compute. |
| 05:56 | LauJensen | clojurebot: forget haskell |
| 05:56 | clojurebot | I forgot haskell |
| 05:56 | LauJensen | clojurebot: haskell is Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you don't compute. |
| 05:56 | clojurebot | In Ordnung |
| 05:57 | subhadeep | ~erlang |
| 05:57 | clojurebot | erlang is http://clojure.googlegroups.com/web/erlang.clj |
| 05:57 | subhadeep | ~java |
| 05:57 | clojurebot | ☕ |
| 05:57 | subhadeep | ~ruby |
| 05:57 | clojurebot | Chunky bacon! |
| 05:57 | subhadeep | hehehehe |
| 05:57 | subhadeep | ~lisp |
| 05:57 | clojurebot | lisp is the red pill |
| 05:57 | eevar2 | ~scheme |
| 05:57 | clojurebot | excusez-moi |
| 05:57 | subhadeep | ~scheme |
| 05:58 | clojurebot | excusez-moi |
| 05:58 | subhadeep | hehe |
| 06:00 | triyo | ~python |
| 06:00 | clojurebot | Pardon? |
| 06:00 | triyo | hmm :( |
| 06:01 | triyo | how do you guys do that, or is python not a language anymore? |
| 06:03 | jdz | nobody has cared enough to teach clojurebot anything about it |
| 06:14 | LauJensen | clojurebot: python is If Clojure is too hard for you, try Python |
| 06:14 | clojurebot | Roger. |
| 06:16 | triyo | ~python |
| 06:16 | clojurebot | python is If Clojure is too hard for you, try Python |
| 06:16 | jdz | umm, If Clojure is too hard for you, try Scheme. |
| 06:16 | jdz | or, If Clojure is too hard for you, try Haskell :) |
| 06:16 | ambient | nah, scheme is just more pure |
| 06:17 | triyo | hehe, I see how this works.... teaching the bot first. |
| 06:17 | LauJensen | jdz: The point being, Python is specifically developed for programmers with... lets say,, IQ challenges :) |
| 06:17 | LauJensen | ~forget python |
| 06:17 | clojurebot | I forgot python |
| 06:17 | ambient | i smell something... |
| 06:18 | ambient | actually i think it's way easier to program larger projects with lisp than it is with python |
| 06:19 | LauJensen | Then you should do it in Lisp - You're not in the challenged category :) |
| 06:27 | ole3 | free advice is seldom cheap |
| 06:28 | ambient | but good advice is sometimes free |
| 06:31 | ole3 | :) |
| 06:52 | alinp | hi |
| 06:53 | alinp | I want to define a function, in my namespace, but the name conflicts with clojure.core |
| 06:53 | alinp | what's the way to exclude the function used by the core |
| 07:04 | achim | alinp: (ns foo (:refer-clojure :exclude [map])) |
| 07:05 | alinp | java.lang.IllegalStateException: test already refers to: #'clojure.core/test in namespace: user (NO_SOURCE_FILE:0) |
| 07:05 | alinp | yeah, did that and still, this is the message |
| 07:05 | alinp | this appears when (use 'foo) is called |
| 07:06 | alinp | from REPL |
| 07:07 | achim | alinp: so you're in the "user" ns and you're trying to call |
| 07:07 | alinp | yeah, can this be done ? |
| 07:08 | achim | sorry, hit return to early :) - you're trying to use another namespace that defines names that are in core? |
| 07:08 | alinp | yes |
| 07:08 | alinp | I can use require in fact |
| 07:09 | achim | that's not possible AFAIK. by default, user refers to all of core. require would work |
| 07:09 | alinp | I don't need use :) |
| 07:09 | alinp | ok, thanks achim ;) |
| 07:38 | triyo | jdz: btw, I tried enlive lib you suggested. Works great for doing selects on parsed html data for me. Very neat tool. |
| 08:03 | cschreiner | today I've seen the light! |
| 08:34 | raphinou | Are there ways to get better error messages from clojure? |
| 08:34 | raphinou | I again lost some time due to an error message "java.lang.IllegalArgumentException: No matching method found: addListener for class eu.webtoolkit.jwt.Signal" |
| 08:34 | raphinou | which is not very clear about what it was looking for |
| 08:34 | raphinou | I had read on this channel that in the furture clojure release it was getting better, but I'm using 1.1 alpha |
| 08:38 | Chouser | raphinou: right. this is better. :-/ |
| 08:39 | Chouser | raphinou: you know how to get the full stack trace when there's an exception? |
| 08:39 | raphinou | Chouser: no |
| 08:39 | raphinou | I thought I had the full stack trace printed |
| 08:39 | raphinou | but your question makes me thin I missed something |
| 08:39 | Chouser | raphinou: are you at a plain console repl? emacs something? |
| 08:40 | raphinou | plain console repl |
| 08:40 | Chouser | ok, so when there's an exception you usually just see a one-line error, like you pasted. |
| 08:40 | raphinou | ha, no |
| 08:40 | Chouser | oh? |
| 08:40 | raphinou | I saw w lot of lines |
| 08:41 | raphinou | always was like that actually |
| 08:42 | Chouser | really? if you just type (nil) you see more that one line back? |
| 08:42 | raphinou | no. But when the server app is raising an exception I get the whole trace |
| 08:42 | Chouser | ah, ok. |
| 08:42 | Chouser | so yes, you're seeing the whole trace in that case. |
| 08:43 | Chouser | that almost always points out the line causing the problem. |
| 08:44 | Chouser | there are a couple functions people have written to change the format of the trace, or to filter out lines they think you won't care about. Dunno if they can be hooked into a server app. |
| 08:44 | raphinou | the problem is more with the info returned in the stactrace |
| 08:45 | raphinou | a C++ dev even told me "even gcc does better" :-) |
| 08:45 | Chouser | :-) |
| 08:47 | Chouser | well, if you have a specific recommendation for a message that would make it clearer in some cases but never less clear in any case, feel free to post it to the group. |
| 08:48 | Chouser | I don't think tweaking error messages is a very high priority at the moment, but there are lots of general complaints so it'd be nice to improve. |
| 08:49 | raphinou | Chouser: I'm just learning clojure, and am not a wizzard in java. So I have not the pretention to know what has to be done. But I can share the problems I had due to the error message being not so clear. |
| 08:50 | Chouser | Well, you're told the line, the class being called and the name of the method, so that should get you very close to the real problem. |
| 08:51 | cddr` | is there a built-in function to find the index of an object in a collection/sequence? |
| 08:51 | Chouser | if the name of the method and class look right, the only thing left is the types in the arg list not matching any of the overloads available for addListener in that class. |
| 08:52 | Chouser | cddr`: yes, but there's also a 'set' datatype that's better if you're going to be doing a lot of membership lookups. |
| 08:53 | Chouser | oh, hm. you're sure you need an index? |
| 08:54 | cddr` | think so, I'm making a javax.tree.TreeModel on top of a parsed XML doc |
| 08:54 | Chouser | ,(.indexOf [:a :b :c :d :e] :c) |
| 08:54 | clojurebot | 2 |
| 08:54 | cddr` | Cool. Cheers |
| 08:55 | Chouser | beware the linear search time. not a fast operation. |
| 08:55 | raphinou | chouser: adding what it was looking for method signature could be helpful though. |
| 08:55 | Chouser | raphinou: but there can be a very large number of possibilities. |
| 08:55 | AWizzArd | I would like to connect to a local MS sql server which has "named pipes" enabled. Does anyone have an idea how the connection spec should look like for doing so? |
| 08:56 | LauJensen | Is there a take-from-end-of-seq similar to take? |
| 08:56 | Chouser | String has 14 different options for ctor. |
| 08:56 | AWizzArd | I can do it when I also activate tcp/ip as connection method, but when this is not enabled I don't know how to do that. |
| 08:56 | LauJensen | AWizzArd: (make-connection-info "mysql" "//localhost/dbname" "user" "psw") ? |
| 08:57 | raphinou | Chouser: would just printing what it got as argument type not already be helpful? Anyway, it's fixed now... |
| 08:57 | Chouser | raphinou: yeah, this is what happens. |
| 08:58 | Chouser | LauJensen: awaiting approval: http://www.assembla.com/spaces/clojure/tickets/151 |
| 08:58 | Chouser | LauJensen: finger trees will be very good at such operations. |
| 08:59 | raphinou | Chouser: it just told me "No matching method found" without the argument types it used to do the lookup |
| 08:59 | LauJensen | Chouser, great - surprising amount of code |
| 09:00 | Chouser | raphinou: sorry, I meant "this" being a vague effort is made at improving a message immediately after an annoying debugging session that included that message, but interest in fixing it wanes rapidly. |
| 09:00 | Chouser | LauJensen: part of that is because 'last' is defined pretty early in core.clj, so a lot of Clojure features are missing, like destructuring, if-let, etc. |
| 09:01 | LauJensen | aha - so why not move it further down ? |
| 09:01 | Chouser | LauJensen: oh, and pos?, dec, int, <, > ... hardly anything defined yet. |
| 09:01 | Chouser | LauJensen: because other code that's also defined early needs it. |
| 09:02 | Chouser | something has to come first! |
| 09:02 | LauJensen | Chouser, yea ok - I just figured we've lived without so far, whats another year ? :) |
| 09:03 | raphinou | Chouser: I see :-) If it's not a high priority for the developers I don't feel like annoying them. As you told it's a known problem, I won't loose my time insisting especially as I don't have the possibility to fix it myself |
| 09:04 | LauJensen | ~reverse? |
| 09:04 | clojurebot | Gabh mo leithscéal? |
| 09:04 | LauJensen | ~reverse |
| 09:04 | clojurebot | Pardon? |
| 09:07 | LauJensen | Why isnt reverse lazy?! |
| 09:07 | Chouser | LauJensen: you write it, I'll check it in. |
| 09:08 | Chouser | *if* you write it, I'll check it in. |
| 09:08 | LauJensen | hehe, sec :) |
| 09:09 | Chouser | then you can write a paper on it and astound the world. |
| 09:09 | clojurebot | what the world needs is more higher order functions |
| 09:10 | LauJensen | that would be fantastic |
| 09:11 | AWizzArd | LauJensen: it is a microsoft sql server. But a localhost is not available, because it works over named pipes. |
| 09:11 | AWizzArd | I would like to connect over a named pipe, but not over tcp/ip. So, no host, no port. |
| 09:11 | LauJensen | Yes sorry, I just read that :) |
| 09:21 | LauJensen | AWizzArd: Is it a 2005 server ? |
| 09:22 | AWizzArd | yes |
| 09:25 | LauJensen | Then as far as I can tell, no driver supports named pipes |
| 09:28 | AWizzArd | Okay, I see. And then shared memory is most likely also not an option. |
| 09:31 | LauJensen | _most likely not_ :) |
| 09:33 | drewr | mssql over named pipe? didn't realize you could do that on windows |
| 09:34 | AWizzArd | yes, and "Shared Memory" is the third option the sql server offers. |
| 09:34 | AWizzArd | I don't know which of those three my customer has enabled. |
| 09:35 | AWizzArd | So in principle I should support all three. tcp/ip is no problem, I can do that. But the other two seem not to work. At least I don't know what the connection spec should look like. |
| 09:36 | LauJensen | AWizzArd: Your best bet is to convince your client to stick with the tried and proven tcp/ip protocol :) |
| 09:40 | AWizzArd | I think that they have that activated, as the other two options can only query the server from localhost which is not a real option. |
| 09:41 | AWizzArd | Would just be interesting to see if/how it could work otherwise. |
| 10:02 | Chouser | stuartsierra: nice blog post. I haven't ever looked at maven but I will now. |
| 10:03 | stuartsierra | Chouser: thanks |
| 10:10 | ole3 | hello, is there a function to create xml from a map? |
| 10:12 | cddr` | what's the clojure version of (case ..)? |
| 10:12 | djpowell | AWizzArd: what jdbc driver are you using? |
| 10:13 | Chouser | ole3: there are many around, even one built into clojure, though most want a partiuclarly-formatted map to support generating all possible xml |
| 10:13 | Chouser | cddr`: cond or condp |
| 10:13 | Chousuke | hmm |
| 10:14 | djpowell | AWizzArd: http://jtds.sourceforge.net/ is probably much better than the microsoft driver, and I think it supports named pipes if you really need that |
| 10:16 | ole3 | Chouser: thankss |
| 10:17 | liwp | stuartsierra: yeah, a very nice blog post. I'm eagerly waiting for the next installments. |
| 10:17 | AWizzArd | djpowell: I am using the official MS JDBC driver so far. Thanks for the tip, I will now have a look at that lib. |
| 10:18 | liwp | how are people switching clojure projects with slime, i.e. how do you get all the required stuff on your classpath? |
| 10:18 | Chousuke | I think my reader is now pretty close to feature complete. Next up in the list is finding out if I'm missing anything and probably lots of cleanup and bugfixing :P |
| 10:18 | liwp | at the moment I'm just piling everything on a single, global classpath, but that doesn't really scale very well |
| 10:26 | raphinou | A blog post about my latest jwt development with clojure: http://www.nsa.be/index.php/eng/Blog/From-OO-to-Lisp-style-structuring-my-Clojure-Jwt-app |
| 10:27 | raphinou | There's a good illustration of why I'm interested in Jwt (not difference between server side and client side in my code) |
| 10:27 | raphinou | I'm very interested in feedback and remarks to improve this code! |
| 10:28 | raphinou | Let me know your advices if you read it |
| 10:28 | lisppaste8 | stuartsierra pasted "clojureshell-maven-plugin sample pom.xml" at http://paste.lisp.org/display/86560 |
| 10:29 | cddr` | can you call "super" on a method you've proxied from another class? |
| 10:29 | stuartsierra | cddr`: no |
| 10:29 | cddr` | so what do people do instead? |
| 10:29 | stuartsierra | If you really, really need super, use gen-class. |
| 10:30 | Chouser | so sad. proxy-super could sometimes work, right? |
| 10:31 | stuartsierra | Oh yeah, I always forget about that. |
| 10:31 | stuartsierra | Maybe that will work. |
| 10:31 | cddr` | looks like it might. I'll give it a try |
| 10:31 | drewr | AWizzArd: fwiw, I use jtds exclusively |
| 10:31 | Chouser | cddr`: note proxy-super is not thread-safe. |
| 10:33 | cddr` | I'm open to alternatives. Just trying to port a TreeCellRenderer which does it. Suppose I could create the Component manually but I'm not sure what DefaultTreeCellRenderer does |
| 10:35 | Chouser | I think proxy could extended to provide automatically-named public methods for super methods and fields (public and protected), but I haven't heard rhickey's opinion on the idea. |
| 10:37 | AWizzArd | drewr: I managed to connect with it to the server via tcp/ip. I will also now test the named pipes. The only sad thing about jtds is that it seems its development has stopped. |
| 10:39 | drewr | I can't say that I use it to its fullest potential, but for what I need it for it works fine. |
| 10:45 | Chouser | is there any way to type-hint the value in a reference type? |
| 10:46 | Chouser | so I don't have to say #^Foo @foo every time? |
| 10:47 | cgrand | none that I'm aware of |
| 10:47 | Chouser | seems like it'd be useful. I guess the compiler would have to be aware of some special tag on the ref obj. |
| 10:49 | Chouser | hm, though it already transfers :tag on a var to the var's value... |
| 10:49 | stuartsierra | Have you tried (ref thing :meta {:tag Foo}), though I don't know if that works |
| 10:51 | Chouser | ah, I'm actually using a delay here, so it's IDeref, not IRef. |
| 10:53 | Chouser | stuartsierra: doesn't seem to work on either ref or delay |
| 10:53 | stuartsierra | ah well |
| 10:54 | Chouser | the (deref ...) form itself is all the compiler has to go on. what's inside could of course be any expression. |
| 10:54 | stuartsierra | I suppose you could (defn #^Foo get-foo [r] @foo) and use that. |
| 10:54 | Chouser | stuartsierra: ah, good point! |
| 10:55 | stuartsierra | One extra layer of indirection, but gives you a clean interface. |
| 10:55 | Chouser | hm, I had that for other reasons and got rid of it so I could have a succinct @foo instead of (get-foo). I guess I'll put it back. :-) |
| 10:55 | Chouser | thanks for the idea! |
| 10:55 | stuartsierra | welcome |
| 11:03 | Chouser | there you go. |
| 11:04 | cddr` | Chouser: you wrote xml-zip right? |
| 11:04 | Chouser | but we should not repeat the problem of :tag on a var meaning either the value is that type or the value is a fn that returns that type |
| 11:04 | Chouser | cddr`: no, just the filter stuff in contrib. |
| 11:05 | cddr` | ok, I think that's what I'm trying to use, the (xml-> ..) stuff |
| 11:05 | Chouser | cddr`: yes, I wrote that. |
| 11:06 | cddr` | what's the easiest way to get the element name of a node? |
| 11:06 | cddr` | I'm using (xml-> node #((zip/node %) :tag) |
| 11:07 | cddr` | but believe there must be a better way |
| 11:09 | cddr` | but believe there must be a better way |
| 11:09 | Chouser | cddr`: hm, I think that's about it. |
| 11:09 | cddr` | sorry, didn't mean to send that second message |
| 11:10 | cddr` | ok cheers |
| 11:11 | Chouser | (defn tag-name [n] (:tag (zip/node n))) |
| 11:11 | Chouser | then you can just (xml-> node tag-name) |
| 11:12 | Chouser | I guess I was expecting people to query on tag names more than select them. |
| 11:12 | Chouser | since tag= is included but tag-name is not |
| 11:15 | Chouser | cgrand: I promise this is an Integer: @(nums :five) |
| 11:16 | Chouser | (def #^{:tag IPersistentMap, :tag-fn IDeref, :tag-fn-deref Integer} nums {:five (delay 5)}) |
| 11:16 | Chouser | :-P |
| 11:19 | cgrand | Chouser: there's no good evil plan without a turing-complete type system |
| 11:19 | Chouser | heh. too evil for me. |
| 11:20 | Chouser | I was hoping that something like destructuring would be sufficient |
| 11:22 | Chouser | except even regular destructuring doesn't support deref or fn calls (yet). |
| 11:24 | Chouser | (let [{[a] :k} {:k [5]}] a) is 5, so should (let [{@a :k} {:k (delay 5)}] a) also be 5? |
| 11:24 | Chouser | I guess the @ there is the inverse. hmph. |
| 11:25 | stuartsierra | I feel like dereferencing is a fundamentally different operation from binding. |
| 11:27 | Chouser | rhickey: http://clojure-log.n01se.net/date/2009-09-04.html#10:45-11:03 |
| 11:28 | rhickey | ah, evil plans :) |
| 11:29 | Chouser | I think you saw everything else. |
| 11:30 | Chouser | Oh, except: but we should not repeat the problem of :tag on a var meaning either the value is that type or the value is a fn that returns that type |
| 11:31 | rhickey | anything other than a very simplistic mechanical thing is going to invite many of the complexities of a full type system |
| 11:31 | rhickey | what we have now is a simple mechanical thing |
| 11:33 | Chouser | so no (def {:tag [Integer String]} [5 "hello, typiness!"]) ? |
| 11:34 | rhickey | (deref IDeref<T>) - > T is much more involved |
| 11:34 | rhickey | as are collections |
| 11:35 | Chousuke | some kind of an optional type system would be nice, but I don't think it ought to be based on :tag :P |
| 11:40 | rhickey | (conj [] "foo") -> vector<String> or vector<Object>? |
| 11:41 | Chouser | I like how (def foo 5) is Object now -- just because a thing is an Integer doesn't mean I'm promising anything. |
| 11:41 | rhickey | (ref nil) -> ? |
| 11:41 | Chouser | but I can say (def #^Integer foo) to promise that if it's not nil it will be Integer |
| 11:41 | rhickey | (ref foo) -> ? |
| 11:42 | MarkVolkmann | What's the consensus on a different syntax for type hints? I know syntaxes like this have been suggested. (defn some-function [i:Integer s:String] ... ) |
| 11:43 | rhickey | (= 'i:Integer 'i:Long)? |
| 11:43 | rhickey | :) |
| 11:45 | stuartsierra | I don't think the type hint syntax is all that bad. |
| 11:45 | Chouser | who wrote the macro for :Long ... Halloway? |
| 11:45 | MarkVolkmann | I think for newcomers, #^ is a bit off-putting. |
| 11:46 | Chouser | MarkVolkmann: It's possible that's intentional. |
| 11:46 | rhickey | possibly because I've been up since 4am formulating an argument against over-specifying types, and the lack of semantics in types, for my JVM Language Summit keynote... |
| 11:47 | rhickey | the (= 'i:Integer 'i:Long) question is important, where is this stuff going to go in the code-as-data world? |
| 11:48 | Chouser | (= 'i:Integer 'i:Long) --> (= '#^Integer i '#^Long i) --> true |
| 11:48 | MarkVolkmann | How does that issue affect the syntax that is used for type hints? It seems like the same issue exists with #^Integer and #^Long. |
| 11:48 | rhickey | #^ isn't syntax for type hints, it's metadata |
| 11:48 | Chouser | I'm not defending i:Long though |
| 11:49 | Chouser | #^ is special syntax of metadata :Foo suffix could be as well. |
| 11:49 | rhickey | Chouser: you write the reader for that :) |
| 11:50 | Chouser | But I'm don't think I like the integrated feeling of i:Foo |
| 11:50 | rhickey | one nice thing about the prefix metadata is it fits with the read-as-you-go nature of Lisp reading, all special things are prefixes affecting what's to come |
| 11:51 | Chouser | the reader is easy, it's the semantics that are hard. |
| 11:51 | Chouser | #^{:this :that, :tag 'Foo} i:Bar --> ? |
| 11:51 | MarkVolkmann | Okay, then (defn some-function [Integer:i String:s] ... ) ;-) |
| 11:51 | rhickey | (foo):Bar too? ivk |
| 11:52 | Chouser | #^{:this :that, :tag 'Foo} url:Foo:Bar --> ? |
| 11:52 | rhickey | 'foo:bar |
| 11:52 | rhickey | ,'foo:bar |
| 11:52 | clojurebot | foo:bar |
| 11:52 | Chouser | exactly |
| 11:53 | rhickey | I think if I had it to do over I would use ^ for reader metadata and make you say (meta x) to get it |
| 11:53 | rhickey | ^String s |
| 11:54 | rhickey | Clojure 2.0? |
| 11:54 | Chouser | yeah, meta lookup turns out to be not so common as to justify ^ |
| 11:54 | MarkVolkmann | That's an improvement. |
| 11:54 | rhickey | Chouser: |
| 11:54 | rhickey | right |
| 11:54 | stuartsierra | yeah, that's good |
| 11:55 | MarkVolkmann | Hey Rich, any thoughts on my question about getHistoryCount using a write lock instead of a read lock? I'm sure there's a reason that I'm overlooking. |
| 11:55 | stuartsierra | rhickey: speaking of releases, do you have a date / feature list for 1.1? |
| 11:56 | rhickey | I guess we could patch in a deprecation warning and get people to switch off of ^x for (meta x) ... |
| 11:57 | MarkVolkmann | I like that idea! |
| 11:58 | rhickey | stuartsierra: other than fixes that make it under the wire, I'll probably use reify as the marker for features, pull any not yet far enough along (scopes) into backlog |
| 11:58 | subhadeep | ~c |
| 11:58 | clojurebot | cheesecake is delicious. |
| 11:58 | subhadeep | ~python |
| 11:58 | clojurebot | Excuse me? |
| 11:58 | subhadeep | hehe |
| 11:59 | stuartsierra | rhickey: nice, reify will be useful. |
| 11:59 | leafw_ | #^ to ^ would de-perl-ify clojure code a bit |
| 12:00 | rhickey | But I have one big one I might want to tackle, it's pretty easy - allow for :rollback and (maybe) :commit callbacks in STM transactions. Would let you tie, e.g. RDF commits or transactional queue I/O to dosync |
| 12:00 | Chouser | leafw_: I know what you mean, but # is just a comment in perl |
| 12:00 | leafw_ | also the gen-syms # makes reading a macro quite hard too. |
| 12:00 | leafw_ | but i actually like it: makes macros stand out a lot. |
| 12:00 | rhickey | MarkVolkmann: I haven't had time to look at that deeply but there probably is no reason for write locks, just copy and paste |
| 12:02 | leafw | Chouser: I kown # is a comment ... i about half the languages I know. Lots of baggage |
| 12:04 | MarkVolkmann | Do you think it would be useful to add a retry function that simply throws a RetryEx inside a transaction so user code could request a retry ... like in Haskell? |
| 12:04 | rhickey | stuartsierra: as to timing, I don't know. I'm extremely jammed up prepping for JVM language summit, plus the RDF stuff (which I hope to move to contrib once we have a strategy for deps). Then I'll get back to reify... |
| 12:05 | rhickey | MarkVolkmann: what will be different when you manually retry? Without the orelse system I'm not sure it makes sense |
| 12:06 | stuartsierra | rhickey: Ok, no worries. :) I've joined the crew chipping away at the dependency problem via maven. |
| 12:07 | rhickey | How many of you all work for companies that might pay for Clojure support? Without a business model I can't afford to keep spending this kind of time, unfortunately... |
| 12:08 | stuartsierra | Not me, I'm afraid. I have to rely on grants for web servers. |
| 12:08 | MarkVolkmann | I guess I need to study the Haskell implementation in more detail. |
| 12:09 | Chouser | unlikely at this point, but the more clojure code that gets more deeply into production, the better the chances get. |
| 12:09 | MarkVolkmann | My company isn't using Clojure at all yet ... just my own personal interest for now. |
| 12:10 | rhickey | MarkVolkmann: a description of retry/orElse is here: http://en.wikipedia.org/wiki/Software_transactional_memory - it requires read tracking |
| 12:11 | stuartsierra | rhickey: Start a consulting company, I'll join! |
| 12:11 | MarkVolkmann | Yikes! I don't think we want read tracking. |
| 12:17 | ambient | oh man, how am i going to debug null pointer exception? :/ |
| 12:19 | stuartsierra | ambient: follow the stack trace until you find a function that could have returned nil |
| 12:20 | Chouser | most common is (.someMethod <nil here> ...) |
| 12:20 | ambient | i know the function but dont know at which point it gets broken because all i see is clojure.core/seq.invoke, core.clj:103 |
| 12:23 | leafw | ambient: ask (.getCause *e) |
| 12:23 | leafw | a second time even, if needed |
| 12:23 | ambient | it just says nullpointerexception |
| 12:24 | lisppaste8 | ambient pasted "null pointer exception" at http://paste.lisp.org/display/86567 |
| 12:35 | ambient | seems that if i already ate a sequence, in a loop/recur testing for first causes it |
| 13:11 | rhickey | what were the suggestions for the Clojure gg welcome message again, other than mentioning the moderation delay? |
| 13:12 | hiredman | ambient: (song-distinct-times song) |
| 13:15 | poet | is this pretty much the way to use c libraries from clojure?: http://github.com/Chouser/clojure-jna/tree/master |
| 13:18 | stuartsierra | poet: JNA and JINI are your only options from Java. JINI is said to be faster, JNA is said to be much easier to use. |
| 13:19 | poet | stuartsierra: ok, gotcha |
| 13:22 | hamza | (ns name (:use :reload-all namespace :only func)) this creates an error i am trying to just import one func from namespace? |
| 13:22 | stuartsierra | func has to be in a list |
| 13:23 | stuartsierra | And I don't think :reload-all can go in a ns form. |
| 13:23 | stuartsierra | (ns name (:use namespace :only (func))) |
| 13:23 | hamza | reload all works if i don;t add :only part |
| 13:23 | stuartsierra | ok |
| 13:24 | stuartsierra | Then it's just :only (func) |
| 13:24 | stuartsierra | Or :only [func], the syntax hasn't been entirely formalized. |
| 13:25 | hamza | i am still getting ->Don't know how to create ISeq from: Boolean |
| 13:25 | hamza | tried both vector and list |
| 13:26 | stuartsierra | Try (ns name (:use [namespace :only [func]])) |
| 13:26 | hamza | that worked thx |
| 13:26 | stuartsierra | np |
| 13:31 | rhickey | why do wiki tools barf on irc:// links? |
| 13:32 | rhickey | new welcome message, feedback welcome: http://groups.google.com/group/clojure |
| 13:36 | replaca | rhickey: I just saw that. Nice! |
| 13:37 | rhickey | I can't believe I had missed that area for so long! |
| 13:38 | Chouser | looks good to me |
| 13:39 | rhickey | that search is so much better, why isn't that the default for "Search this group"? |
| 13:40 | replaca | ahh, the mysteries that are google |
| 13:41 | grosours | hi |
| 13:41 | rhickey | grosours: hi |
| 13:47 | ericthorsen | rhickey: Where do you edit that on the google group menu? |
| 13:48 | Chouser | ericthorsen: on the home page itself there's a [edit welcome message] link |
| 13:50 | ericthorsen | Chouser: thanks...no wonder I could not find it...wonder why it is not with the other settings. |
| 13:54 | cemerick | man, I missed the obj:Type discussion! :-( |
| 13:55 | cemerick | I keep meaning to get that clojure.main wrapper put together so people can try that approach out. |
| 13:55 | cemerick | if we can just squeeze this release out, I'll have a lot more bandwidth available. |
| 13:56 | Chouser | ah, you wrote the macro. Sorry, I forgot and was too lazy to search. |
| 13:57 | rhickey | cemerick: clojure.main wrapper? |
| 13:58 | cemerick | rhickey: yeah, I think it was stu who suggested that I make a clojure.main wrapper that bolted in the arg:Type macro so it'd be easily globally available. |
| 13:58 | cemerick | (rather than using special def-hinted macros or whatever) |
| 13:58 | rhickey | cemerick: I don't like it |
| 13:59 | cemerick | Chouser: hey, I probably should be glad someone else gets the "credit" for it ;-) |
| 13:59 | cemerick | See! :-P |
| 13:59 | Chouser | heh |
| 13:59 | rhickey | we had talked about moving to ^Type thing for metadata and requiring (meta thing) later |
| 13:59 | cemerick | rhickey: but it Makes Type Hinting Fun Again!™ |
| 14:01 | rhickey | hmm, no download counts on github? |
| 14:02 | Chouser | just "watchers" I guess |
| 14:03 | cemerick | Eh, ^Type doesn't tickle my fancy either. Postfixing types is one thing that I really loved in scala. |
| 14:03 | cemerick | (and python, these days) |
| 14:05 | Chousuke | would symbols containing : become forbidden then? |
| 14:05 | cemerick | yeah, that'd be one of the downsides |
| 14:05 | rhickey | cemerick: and you'd type hint calls as (foo):Type ? |
| 14:07 | cemerick | rhickey: surely not. foo:Type is just sugar, certainly not a 100% replacement for #^Type foo |
| 14:08 | rhickey | cemerick: but #^Type foo reads a symbol with metadata, a macro-thing for : would do what? |
| 14:10 | cemerick | rhickey: it splits the symbol on the colon, using the second part as the :tag metadata. http://groups.google.com/group/clojure/tree/browse_frm/thread/0b90ed336e76edb6/adefabb7f6ced7df?rnum=1&q=defh+group%3Aclojure&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fb90ed336e76edb6%2Fe18e9b89b1c51231%3Fq%3Ddefh%2Bgroup%253Aclojure%26#doc_75b7fafe84e7ce8c |
| 14:12 | rhickey | cemerick: ah, you must use enclojure, where type hints aren't (yet) colorized |
| 14:13 | rhickey | it is a completely different experience when they are |
| 14:13 | cemerick | rhickey: heh, I do. Nevertheless, I don't like #^, visually or w.r.t. typing. |
| 14:14 | cemerick | e.g. beyond the keying itself, typing foo, then having to back up because I realized that I need to type-hint foo is mildly irritating |
| 14:17 | rhickey | cemerick: well, ^Type foo is likely and foo:Type is not. It simply is too fragile. Earlier people were discussing types hints for refs - what if they end up being described by composite data structures (i.e. not valid symbol components)? |
| 14:18 | cemerick | Yeah, it's definitely not generally-applicable. |
| 14:19 | cemerick | I'd be happy to have both available, which would make the simplest case simple. I can understand not wanting to do that, though. |
| 14:20 | rhickey | they are not significantly different from a simplicity perspective |
| 14:20 | rhickey | maybe from familiarity perspective |
| 14:21 | cemerick | maybe I should have said, 'make the simple case more readable' :-) |
| 14:21 | rhickey | anyway, : is already allowed as a name component, and possibly important to RDF and XML folks |
| 14:21 | cemerick | it's all aesthetics in this corner of the shop |
| 14:21 | rhickey | cemerick: readable is vague |
| 14:21 | cemerick | what, people use XML a lot in programming these days? |
| 14:21 | rhickey | I agree in general about prefixes and scanning, although the color here mitigates that completely |
| 14:22 | cemerick | rhickey: I'll go bother ericthorsen, then. ;-) |
| 14:22 | rhickey | foo^String would at least keep it to one magic character |
| 14:23 | rhickey | and could still be read-time |
| 14:23 | cemerick | oh, that's not bad |
| 14:24 | rhickey | I don't think people are relying on ^ being a non-constituent character |
| 14:26 | tomoj | say you have a seq like ([key1 val1] [key2 val2] [key2 val3] ...), what's a good way to get to {key1 [val1], key2 [val2 val3]} ? |
| 14:26 | tomoj | should I instead build a seq like ({key1 val1} {key2 val2}) and then use merge-with? |
| 14:27 | hiredman | tomoj: update-in and conj |
| 14:29 | hiredman | ,(reduce #(update-in % conj %2) '([:k1 :v1] [:k2 :v2] [:k2 :v3])) |
| 14:29 | clojurebot | java.lang.UnsupportedOperationException: nth not supported on this type: core$conj__3823 |
| 14:29 | hiredman | ,(reduce #(update-in % conj %2) {} '([:k1 :v1] [:k2 :v2] [:k2 :v3])) |
| 14:29 | clojurebot | java.lang.UnsupportedOperationException: nth not supported on this type: core$conj__3823 |
| 14:30 | hiredman | oh |
| 14:30 | hiredman | I forgot the vector and stuff |
| 14:31 | tomoj | hiredman: thanks, that worked great |
| 14:32 | eyeris | When manually constructing a swing gui, how do most people maintain references to the controls they need to manipulate? The best idea I can come up with is to keep a map inside an atom. |
| 14:33 | rhickey | cemerick: foo^metadata could also support type hints et al of arbitrary structure, as the thing following ^ need not be a valid symbol component |
| 14:33 | eyeris | However that makes my construction code look disjointed. |
| 14:33 | rhickey | foo^{:some :meta} |
| 14:34 | rhickey | but I'm not convinced trailing is such a big deal |
| 14:35 | stuartsierra | I'd prefer ^ to : as the delimiter, but I also don't care about ordering. |
| 14:37 | cemerick | Without any kind of data, it's hard to make an argument one way or the other without appealing to personal preferences. |
| 14:38 | rhickey | first step in any case is freeing up plain ^ by deprecating ^foo ==> (meta foo) |
| 14:40 | stuartsierra | Should be easy enough. |
| 14:41 | rhickey | patch welcome |
| 14:42 | stuartsierra | just a doc string change? |
| 14:42 | stuartsierra | Or what, since ^ doesn't have a definition? |
| 14:43 | rhickey | tough to say since ^ is a reader thing |
| 14:43 | rhickey | complain to *err* when reading? |
| 14:43 | stuartsierra | Won't show up in SLIME by default. |
| 14:46 | cemerick | but will show up in build output. Are people really only using clojure in SLIME interactively? |
| 14:46 | stuartsierra | true, that's good enough, I guess |
| 14:50 | tomoj | I only use clojure in slime interactively :) |
| 14:50 | cemerick | *shudder* |
| 14:50 | tomoj | (but that's cus I haven't built anything useful yet I suppose) |
| 14:51 | cemerick | slime has that effect on people |
| 14:51 | liwp` | is there a replacement for scheme's boolean? in clojure? |
| 14:52 | liwp` | or do I have to write it |
| 14:52 | hiredman | ,(doc boolean?) |
| 14:52 | clojurebot | Pardon? |
| 14:52 | stuartsierra | ,(boolean? true) |
| 14:52 | clojurebot | java.lang.Exception: Unable to resolve symbol: boolean? in this context |
| 14:52 | hiredman | guess not |
| 14:52 | hiredman | ,(true? true) |
| 14:52 | clojurebot | true |
| 14:53 | hiredman | ,(false? true) |
| 14:53 | clojurebot | false |
| 14:53 | stuartsierra | ,(instance? Boolean true) |
| 14:53 | clojurebot | true |
| 14:53 | hiredman | liwp`: unless you dealing in java interop, true and false are nil and not nil |
| 14:54 | liwp` | indeed... I'll have to think about this. At the moment I check for false / true, but maybe that's too strict |
| 14:54 | liwp` | thanks |
| 14:54 | stuartsierra | "Falsy" things are nil, false, and Boolean/FALSE. |
| 14:54 | stuartsierra | "Truthy" is anything else. |
| 14:54 | rhickey | ,(instance? Boolean true) |
| 14:54 | clojurebot | true |
| 14:54 | rhickey | ,(instance? Boolean 42) |
| 14:54 | clojurebot | false |
| 14:54 | rhickey | ,(instance? Boolean nil) |
| 14:54 | clojurebot | false |
| 14:55 | stuartsierra | ,(false? nil) |
| 14:55 | clojurebot | false |
| 14:55 | stuartsierra | beware |
| 14:55 | liwp` | so if I restrict myself to true/false then I can do the instance check and be done with it |
| 14:55 | stuartsierra | yes |
| 14:55 | liwp` | I think that'll be fine |
| 14:55 | rhickey | the "truth" test is simply if |
| 14:57 | liwp` | I have funky macros that generate sort of like algebraic datatypes and the constructors check the types of the arguments, so my datatype has a boolean member and the constructor is checking that that is really the case |
| 14:58 | liwp` | actually just a single macro, the other one does pattern matching and destructuring of the values |
| 14:58 | clojurebot | destructuring is http://clojure.org/special_forms#let |
| 15:00 | stuartsierra | Heh, (defn coerce-to-boolean [it] (if it true false)) |
| 15:01 | rhickey | ,(doc boolean) |
| 15:01 | clojurebot | "([x]); Coerce to boolean" |
| 15:01 | stuartsierra | ,(boolean 42) |
| 15:01 | clojurebot | true |
| 15:02 | liwp` | ,(boolean nil) |
| 15:02 | clojurebot | false |
| 15:02 | stuartsierra | Eh, ok, spoil my fun. :) |
| 15:02 | stuartsierra | ~def boolean |
| 15:02 | liwp` | sorry, couldn't resist |
| 15:15 | stuartsierra | new blog post: how to track nightly builds of Clojure and contrib with Maven: http://stuartsierra.com/2009/09/04/cutting-edge-clojure-development-with-maven |
| 15:15 | liwp` | stuartsierra: excellent, I'll have to check it out asap. Thank you for writing about maven. |
| 15:16 | stuartsierra | thanks, this is my own process of figuring stuff out. |
| 15:31 | stuartsierra | rhickey: possibly relevant to Clojure-in-RDF, http://n2.talis.com/wiki/RDF_JSON_Specification |
| 15:34 | rhickey | stuartsierra: I'd seen that, thanks |
| 16:07 | Chouser | shoot. I think there will be a snag with reversable finger trees and concat. |
| 16:09 | Chousuke | :/ |
| 16:09 | Chouser | ft-concat is built on a function (app3 tree1 node-seq tree2) The version in the paper uses pattern matching on the specific type of both tree1 and tree2 |
| 16:10 | Chouser | a tree can be a deep tree, a single (one node) or empty. |
| 16:10 | Chouser | so I have these as different classes implementing the same interface, and I call (.app3 t1 nseq t2) |
| 16:11 | Chouser | but because of Java, that's only polymorphic on t1, so if t1 is a deep tree, I (cleverly, I thought) turn around and call (.app3deep tree2 nseq tree1) |
| 16:12 | Chouser | that way every class can implement an .app3deep that assumes tree1 is deep and do the right thing. |
| 16:14 | Chouser | this seems to be working great until we get to reversed trees, which are made with a simple wrapper around a regular tree. Call (first rev-tree) and it will do a peek on the underlying finger tree: first/rest/cons swap with peek/pop/conj |
| 16:15 | Chouser | but ... how to implement app3 and app3deep? |
| 16:15 | Chouser | I'm afraid I might need rev-tree-single and rev-tree-deep |
| 16:16 | Chouser | oh! |
| 16:16 | Chousuke | I have no idea what the app operation even does :) |
| 16:16 | rhickey | how important is reversing given rseq (or do you need them for rseq)? |
| 16:16 | Chouser | yeah, that's how rseq works |
| 16:17 | Chouser | the other options would be for rseq to return a regular lazy seq walking backwards instead of a real finger-tree |
| 16:17 | Chouser | wait, a reversed single or reversed empty is the same as the simple of each.... |
| 16:17 | Chouser | right? yes! so I can assume a rev-tree is actually a rev-deep-tree |
| 16:18 | Chouser | hm... except for non-commutative reducers. |
| 16:20 | Chouser | so I guess that's a separate question: is it worth having rseq return a finger-tree in constant time when it means the reducers will run backwards? |
| 16:21 | Chouser | the alternatives being that rseq returns a simple lazy seq or a fresh-built finger tree in linear time. |
| 16:27 | Chouser | I guess I should get split working first, then see what it will take to make reversed trees work and be useful. |
| 16:35 | Chouser | rev-tree can't support non-commutative reducers -- the semantics are just broken. measuring (ft-concat t1 t2) should make sense, but if either is reversed and there's a non-commutative reduce, they'll just be wrong |
| 16:37 | Chouser | lazy-seq it is. |
| 18:13 | triyo | http://jacobian.org/writing/snakes-on-the-web/ Jacob is one of the Django (python) web framework developers. His post says "Unfortunately, nearly all of this awesome work is going on in relatively obscure languages like http://www.scala-lang.org/, http://erlang.org/, http://clojure.org/, or http://www.haskell.org/." .. So how is Clojure obscure? :) |
| 18:14 | triyo | guess he has some major issues with python's GIL, I dpn' |
| 18:14 | triyo | I don't blame him, GIL is shocking. |
| 18:19 | lisppaste8 | hamza pasted "passing functions" at http://paste.lisp.org/display/86585 |
| 18:20 | hamza | hey guys i am trying to pass a component and a function to the function i pasted but wierd things are happening what is the correct way of doing this? |
| 18:22 | Chousuke | hamza: you probably mean to call the function |
| 18:22 | Chousuke | hamza: that code right there just *returns* the function. |
| 18:23 | Chousuke | put parens around the fn to call it :) |
| 18:24 | hamza | yes i would like the function to be called. thanks. |
| 18:26 | Chousuke | oh, and you shouldn't call it fn |
| 18:26 | Chousuke | because that shadows the built in fn |
| 18:26 | Chousuke | usually arguments that are functions are just "f", |
| 18:27 | hamza | kk |
| 18:28 | triyo | Hmm fn being a special form I though it'd throw an exception instead of it being shadowed. |
| 18:28 | hamza | one other thing is it possible to disable full stack trace in repl? |
| 18:32 | lisppaste8 | hamza pasted "null pointer" at http://paste.lisp.org/display/86586 |
| 18:32 | hamza | (f) now causes null pointer exception? |
| 18:35 | triyo | what does your f function do? |
| 18:35 | hamza | (add-action-listener copy-password (set-clipboard (nth row 2) )) |
| 18:35 | hamza | just sets the clipboard |
| 18:36 | hamza | i call it like above |
| 18:36 | Chousuke | triyo: fn isn't actually a special form. fn* is |
| 18:36 | Chousuke | triyo: but that's a secret |
| 18:37 | Chousuke | er, set-clipboard doesn't look like it returns a function |
| 18:37 | triyo | ,(doc fn) |
| 18:37 | clojurebot | "([& sigs]); (fn name? [params* ] exprs*) (fn name? ([params* ] exprs*)+) params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol Defines a function" |
| 18:38 | hamza | set-clipbard doesn't return a function. is that the mistake? it just sets the clipboard. |
| 18:38 | Chousuke | hamza: I suppose you meant #(set-clipboard (nth row 2)) |
| 18:38 | Chousuke | to create a lambda. |
| 18:39 | hamza | kk now worked. so i need a anon. function. can't pass a regular function blindly. |
| 18:39 | Chousuke | no, no. |
| 18:40 | Chousuke | you weren't passing in a function at all. |
| 18:40 | Chousuke | function arguments are evaluated, so you called (set-clipboard (nth row 2)) and passed the return value of that to the function |
| 18:40 | Chousuke | which was nil. |
| 18:41 | hamza | kk so # let me pass the actual function not the return value? |
| 18:42 | Chousuke | no. |
| 18:42 | Chousuke | #(foo bar) is a shortcut for (fn [] (foo bar)) |
| 18:42 | Chousuke | which creates a new function that executes the code (foo bar) |
| 18:43 | Chousuke | you're thinking that (set-clipboard (nth row 2)) is a function |
| 18:43 | Chousuke | that's wrong. |
| 18:43 | Chousuke | set-clipboard is a function. (set-clipboard (nth row 2)) is a function *call* |
| 18:44 | hamza | kk now i got it. :) thanks.. |
| 18:45 | Chousuke | you could also have done (defn clipboard-setter [] (set-clipboard (nth row 2))) (assuming row is a global value here! in your case it's probably a local) and call (add-action-listener component clipboard-setter) |
| 18:46 | Chousuke | but the lambda approach is more useful than doing defns every time because it creates closures |
| 18:47 | Chousuke | and defn creates a global binding which you most likely want to avoid doing unnecessarily, too :) |
| 18:47 | hamza | kk that was the thing which confused me, i passed a function with defn before and it worked i assumed it would work in this case to. i'll stick to lambda approach. |
| 18:48 | Chousuke | only use defn from the top level |
| 18:48 | Chousuke | at least until you understand better how it works. |
| 18:48 | Chousuke | (top level means not within any other function or let block) |
| 18:49 | hamza | kk |
| 18:52 | octe | i'm starting a clojure repl with the clojure-contrib.jar in the classpath, am i suppose to be able to do something like "(use 'clojure.contrib.sql)"? |
| 18:52 | hiredman | are you sure contrib is in the classpath? |
| 18:53 | octe | i statr the repl with "java -classpath ~/src/clojure/clojure.jar:~/src/clojure-contrib/clojure-contrib.jar clojure.lang.Repl" |
| 18:54 | octe | and that file exists.. |
| 18:54 | triyo | maybe -classpath doesnt like ~ |
| 18:54 | Chouser | ~ won't work |
| 18:54 | clojurebot | Huh? |
| 18:54 | hiredman | well first, use clojure.main instead of Repl |
| 18:54 | triyo | lol |
| 18:55 | octe | thanks, that worked better.. |
| 19:05 | octe | hmm.. |
| 19:05 | octe | using slime+clojure in emacs is working with M-x slime |
| 19:05 | octe | but i'm trying to start an external swank-server and using M-x slime-connect to use it |
| 19:05 | octe | by copying the text in the inferior lisp buffer and adding a :port argument |
| 19:06 | octe | i can connect to it but when i try to send something to eval i get an error |
| 19:07 | octe | error in process filter: slime-dispatch-event: Elisp destructure-case failed: (:write-string "0") |
| 19:07 | octe | when sending (print "0") |
| 19:27 | slyrus_ | rhickey: got time to answer some stupid questions about ants.clj? |
| 19:28 | slyrus_ | and, on another note... is anybody doing any image processing/computer vision stuff with clojure? |
| 19:29 | Chouser | slyrus_: you can try asking your ants.clj question. someone else might be able to help. |
| 19:58 | octe | i'm parsing a string of records into a map: http://pastebin.ca/1554413 |
| 19:58 | octe | what's a better way to do this? |
| 20:04 | octe | http://pastebin.ca/1554420 a little better i suppose.. |
| 20:04 | Chouser | http://pastebin.ca/1554421 |
| 20:06 | octe | hmm, i tried vector-method |
| 20:09 | octe | can't say i understand the difference between vector and vec |
| 20:31 | tomoj | ,(vector 1 2 3) |
| 20:31 | clojurebot | [1 2 3] |
| 20:31 | tomoj | ,(vec '(1 2 3)) |
| 20:31 | clojurebot | [1 2 3] |
| 20:31 | tomoj | what's wrong with (:use [clojure.contrib.duck-streams :only reader]) in ns? |
| 20:31 | tomoj | require's doc say a libspec can be a vector containing a lib name followed by options |
| 20:35 | drewr | tomoj: (:use [.... :only [reader]]) |
| 20:35 | tomoj | oh, d'oh |
| 20:35 | tomoj | thanks |
| 22:40 | duck1123 | I'm still having no luck figuring out how to read the result of running tests |
| 22:41 | duck1123 | it seems it always returns nil, and I don't see any sort of global var with the results or anything |
| 22:53 | duck1123 | anyone know what I'm missing? I've been pouring over the email history |
| 22:56 | hiredman | duck1123: this is using clojure.test? |
| 22:56 | duck1123 | yes |
| 22:56 | duck1123 | I'm trying to get clojure-maven-plugin to fail on test failure |
| 22:57 | duck1123 | and to do that, I need the script to fail |
| 22:58 | duck1123 | if (run-all-tests) returned false on failure, I could wrap it in an if and return accordingly |
| 23:00 | duck1123 | although (if (:success (run-all-tests)) ... ) is just as good |
| 23:01 | hiredman | duck1123: I would look at rebinding the report function |
| 23:01 | lisppaste8 | _mst pasted "catching test results" at http://paste.lisp.org/display/86594 |
| 23:01 | hiredman | ;; You can plug in your own test-reporting framework by rebinding |
| 23:01 | hiredman | ;; the "report" function: (report event) |
| 23:01 | _mst | yep, that's what I did :) |
| 23:02 | duck1123 | _mst awesome, that'll work for me |
| 23:03 | _mst | lovely |
| 23:19 | duck1123 | _mst one note, if you store away report as old-report, and then bind a function that calls old-report and does the swap!, you still get the testing output |
| 23:20 | duck1123 | other than that, my project is failing to build, so I am happy :) |
| 23:20 | _mst | ah yep, good idea |
| 23:27 | bou_fon_ | http://www.clodogame.fr/change_please/2789046/ |