2009-04-13
| 00:27 | joha1 | no updates of ClojureCLR in clojure-contrib since late February. Is the project dead, resting, or pining for the fjords? (or perhaps hosted somewhere else?) |
| 00:36 | kadaver | figured a really dead simple way to compile haskell to java (each function into a class) but it's basically interpretation.. not sure how to do better |
| 00:37 | kadaver | does clojrue do that? |
| 00:41 | durka42 | do which? |
| 00:41 | durka42 | clojure source is compiled to bytecode |
| 02:17 | kadaver | durka42: ok but is there an intermediate step which turn clojrue code into java classes? |
| 02:19 | durka42 | well, the bytecode encodes java classes |
| 02:19 | durka42 | there is no intermediate step with java source code, if that's what you mean |
| 02:20 | kadaver | i dont mean .class files, i mean class FunctionFoo {...} |
| 02:21 | kadaver | but ok |
| 02:21 | kadaver | so any info on how? a namespace is what really, a static class with functions as methods? |
| 02:22 | Raynes | kadaver: You've earned first prize for most misspellings of 'Clojure'. |
| 02:23 | hiredman | kadaver: no |
| 02:24 | hiredman | ~def c.l.Compiler |
| 02:24 | hiredman | functions are themselves objects |
| 02:24 | hiredman | ,(class (fn [] )) |
| 02:24 | clojurebot | sandbox$eval__2839$fn__2841 |
| 02:31 | DTrejo | Hey guys, I come from an eclipse and java background; what do you suggest I start learning clojure on? (what ide/setup?) |
| 02:32 | hiredman | whatever you are most comfortable with, that being said, there is a large emacs following |
| 02:32 | hiredman | I personally use vim |
| 02:32 | durka42 | does clojure-dev work? |
| 02:32 | hiredman | no idea |
| 02:32 | durka42 | the eclipse plugin |
| 02:32 | durka42 | http://code.google.com/p/clojure-dev/ |
| 02:33 | DTrejo | I've installed it, played around a bit |
| 02:33 | kadaver | DTrejo: lisp+emacs works very well together, that said you can run a repl in eclispe too so if you are more comfortable with that... |
| 02:33 | hiredman | clojurebot: clojure-dev is the eclipse plugin http://code.google.com/p/clojure-dev/ |
| 02:33 | clojurebot | Alles klar |
| 02:33 | kadaver | ah |
| 02:34 | durka42 | ~eclipse |
| 02:34 | clojurebot | I don't understand. |
| 02:34 | DTrejo | has anyone tried out multiple configs/ides/editors? which is the most well developed? |
| 02:34 | DTrejo | err, best user experience |
| 02:35 | hiredman | well, vim, obviously :P |
| 02:35 | DTrejo | (:)) |
| 02:35 | durka42 | ;) |
| 02:35 | DTrejo | I'll look into it |
| 02:35 | DTrejo | the link is on the clojure site? for the vim config file or whatever |
| 02:35 | Raynes | DTrejo: I use Enclojure with NetBeans 6.5. |
| 02:36 | DTrejo | how is that raynes? |
| 02:36 | DTrejo | how do you like it |
| 02:36 | Raynes | I love it, it works fine for my needs. It's a bit buggy, but everything is being worked out. Clojure-dev would be okay if it weren't for the crappy indentation. |
| 02:36 | Raynes | I hear that will be fixed soon as well. |
| 02:36 | DTrejo | mm |
| 02:37 | DTrejo | hiredman is the situation similar for cloj on vim? |
| 02:38 | Raynes | I'd have to say the best possible editor to use for Clojure is Emacs, but if you don't want to go through setting it up and stuff then use Enclojure or La Clojure. I for one, don't feel like setting up Emacs so I use Enclojure. I hear VimClojure is good as well. |
| 02:38 | hiredman | I don't think I am person to ask |
| 02:38 | hiredman | I don't go in for much besides syntax highlighting |
| 02:38 | hiredman | vimclojure's repl is nice, when I get it to work |
| 02:38 | DTrejo | k |
| 02:39 | hiredman | are you on windows? |
| 02:39 | DTrejo | yes, xp |
| 02:39 | hiredman | you might look at clojure in a box |
| 02:39 | DTrejo | I have the same emecs setup shyness |
| 02:39 | hiredman | which is something that installs clojure+emacs |
| 02:39 | DTrejo | nice |
| 02:39 | DTrejo | that looks so easy :) |
| 02:40 | DTrejo | have you tried it Raynes ? |
| 02:40 | Raynes | DTrejo: Nope. |
| 02:41 | Raynes | I'm a NetBeans man. (: |
| 02:41 | Raynes | Plus if I don't test for Eric he never seems to get Windows specific bug reports. I'm one of the few Vista users around these parts :\ |
| 02:42 | DTrejo | mm |
| 02:43 | DTrejo | the guy who put together clojure box needs to host it on some faster server |
| 02:43 | DTrejo | err host it on some filehost |
| 02:43 | Raynes | ,(println "Welcome to the wonderful world of Clojure DTrejo :)") |
| 02:43 | clojurebot | Welcome to the wonderful world of Clojure DTrejo :) |
| 02:45 | DTrejo | ,(+ 60 9) |
| 02:45 | clojurebot | 69 |
| 02:46 | Raynes | DTrejo: clojurebot is hiredman's work. hiredman is my hero <3 |
| 02:46 | DTrejo | I was thinking: wow hiredman knows how to use the bot |
| 02:46 | DTrejo | cool project |
| 02:49 | DTrejo | loving clojure box :) |
| 02:49 | DTrejo | thanks for the recommendation |
| 02:58 | DTrejo | ~eclipse |
| 02:58 | clojurebot | Huh? |
| 03:01 | Raynes | It seems even the people who /use/ Scala don't seem to like it very much. |
| 03:02 | Raynes | DTrejo: http://code.google.com/p/clojure-dev/ |
| 03:04 | DTrejo | Raynes yes I tried that. That's too bad about scala |
| 03:04 | DTrejo | I know a guy who likes it tho |
| 03:05 | Raynes | DTrejo: It's just odd, when I see the enthusiasm people have about Clojure, and then look at what the Scala community is saying, it's as dull as it gets. |
| 03:05 | DTrejo | Raynes ohh you're saying they aren't in love with clojure |
| 03:05 | DTrejo | I misunderstood |
| 03:06 | DTrejo | well, its cus they already have a substitute I'd say |
| 03:06 | DTrejo | it steals their thunder |
| 03:06 | Raynes | DTrejo: No, you understood. They aren't enthusiastic about Scala the way Clojure users are enthusiastic about Clojure |
| 03:08 | zakwilson | That's sad. I'm thinking maybe I should take that as a sign to not bother with Scala. |
| 03:09 | DTrejo | oh, ok |
| 03:09 | Raynes | zakwilson: I'm trying to learn Clojure, but when I hear stuff like that about it, it really takes away my motivation. :| Maybe I should just learn Smalltalk for object orientation. :\ |
| 03:09 | DTrejo | glad you clarified |
| 03:09 | Raynes | Scala* |
| 03:09 | Raynes | I can't type tonight. :| |
| 03:09 | DTrejo | now everythings all mixed up hehe :) |
| 03:09 | DTrejo | how is smalltalk? I don't hear much about it |
| 03:10 | DTrejo | I mean the community |
| 03:10 | zakwilson | I suppose it depends on why you want to learn OO, or what you want to learn about it. |
| 03:10 | Raynes | DTrejo: I dunno. Pretty dead as far as I can tell. |
| 03:11 | zakwilson | Though I had some exposure to C++ and such, the first object system I really *used* was CLOS. |
| 03:11 | DTrejo | too bad |
| 03:11 | Raynes | zakwilson: Because I'll never get very far without decent knowledge of object orientation. But I really... Really don't want to learn Java or C#. |
| 03:11 | DTrejo | zakwilson: I wish lisp had been my first language, like a buddy of mine - he took it for 4 years in HS |
| 03:12 | zakwilson | Raynes: Well, I'm not sure about not getting very far... the basic concepts are simple enough. |
| 03:12 | DTrejo | and had a hardass funciontional fanatic teacher |
| 03:12 | zakwilson | Lisp wasn't my first language, but it's the first language I did non-trivial OO in. |
| 03:13 | DTrejo | Ideally I want to know clojure, python, maybe R/ROR. (already decent in java) |
| 03:14 | Raynes | I could learn Python, it has some object orientation. |
| 03:14 | Raynes | :| |
| 03:14 | DTrejo | mostly I just need to get out there and code, starting this summer when things open up |
| 03:14 | DTrejo | Raynes why that face? |
| 03:14 | zakwilson | Raynes: you may want to make an object system, or study one implemented in the language from which it is used. |
| 03:15 | zakwilson | I think somebody made one for Clojure |
| 03:17 | DTrejo | what languages do you know right now Raynes ? |
| 03:17 | Raynes | DTrejo: Clojure, some Haskell, and enough Java to know a little about object orientation. |
| 03:18 | DTrejo | I thought cloj had some OO |
| 03:18 | zakwilson | Wow... good choices! |
| 03:18 | zakwilson | It has some OO-like things, but they don't work in the traditional way. |
| 03:18 | zakwilson | Traditional being Smalltalk/Ruby/Python/Java-like |
| 03:19 | DTrejo | i think clof is more 100yr than arc |
| 03:19 | DTrejo | cloj* |
| 03:20 | DTrejo | opinions? |
| 03:20 | zakwilson | I think Arc has not been developed enough to tell. |
| 03:20 | DTrejo | mm |
| 03:20 | DTrejo | yes |
| 03:20 | Raynes | DTrejo: Arc could probably be good, but Paul Graham will end up dying of old age before he gets 0.0.4 out :\ |
| 03:20 | zakwilson | Clojure feels like a great language for the next decade, and it probably has a lot of what a 100 year language will have. |
| 03:21 | zakwilson | Arc feels really unfinished. I'm sure revision 3 of Clojure did too. |
| 03:22 | DTrejo | I think clojure is going to do well just because it has a great pursuasive website. Really is open about the nature of itself |
| 03:23 | DTrejo | and the community of cours |
| 03:23 | DTrejo | Raynes I agree |
| 03:23 | zakwilson | It convinced me to use the JVM. That's impressive pursuasion right there. |
| 03:23 | DTrejo | :) |
| 03:24 | Raynes | http://stackoverflow.com/questions/743256/why-does-scala-have-very-little-enthusiasm-about-it Get your thoughts in before it's closed. |
| 03:25 | DTrejo | (I don't have anything to say) |
| 03:25 | leafw | s/pursuasive/persuasive |
| 03:25 | leafw | (hurts my eyes :) |
| 03:26 | DTrejo | I don't understand the slashes, what does that mean? |
| 03:26 | DTrejo | [sic] ? |
| 03:27 | zakwilson | My only attempt at using stack overflow didn't impress me. |
| 03:27 | Raynes | DTrejo: It's a regex s/replacethis/withthis/ |
| 03:28 | zakwilson | http://stackoverflow.com/questions/513523/what-language-features-can-you-live-without-closed |
| 03:31 | leafw | DTrejo: in vi editor, it means "substitute first expr. by second expr." |
| 03:31 | DTrejo | ah |
| 03:31 | DTrejo | now I know more |
| 03:31 | leafw | DTrejo: in skype, it fixes typos in previous lines as well. |
| 03:34 | DTrejo | oh dang |
| 03:34 | DTrejo | s/dang/dangg |
| 03:34 | DTrejo | aw it doesn't work here |
| 03:34 | leafw | no, IRC is a different beast. |
| 03:38 | Raynes | DTrejo: Though it doesn't work in IRC, users use it as symbolism to correct their previous messages. |
| 03:40 | zakwilson | I have not seen any signs of that actually altering a conversation in skype. |
| 03:40 | Raynes | http://xkcd.com/528/ |
| 03:49 | leafw | zakwilson: AFAIK only works in macosx skype. |
| 03:49 | zakwilson | leafw: that would explain it. |
| 03:50 | DTrejo | so it updates other people's screens too? |
| 03:52 | leafw | I think so. |
| 03:52 | leafw | very orwellian. |
| 03:54 | DTrejo | mm, another reason for me to get a mac |
| 03:54 | DTrejo | haha |
| 04:01 | Raynes | http://stackoverflow.com/questions/743256/why-does-scala-have-very-little-enthusiasm-about-it/743285#743285 |
| 04:01 | Raynes | The man has a point. |
| 04:05 | leafw | yes: clojure is the first JVM language that attracted people per se, not by the need of avoiding the horror of writing java code. |
| 04:08 | zakwilson | leafw: agree - I might never have used the JVM without Clojure. |
| 04:16 | leafw | with our fiji setup, one isn't even aware of the JVM at all ... I can launch clojure with all jars in classpath just with ./fiji --clojure |
| 04:17 | leafw | ( http://pacific.mpi-cbg.de/wiki/index.php/Clojure_Scripting ) |
| 06:00 | joha1 | I'm translating Java code with the "instanceof" operator. How can I express this in Clojure? (.instanceOf ...) didn't work |
| 06:02 | joha1 | nor (.instanceof ...) |
| 06:07 | antifuchs | (isa? (class object) TheDesiredClass) ; wfm |
| 06:07 | joha1 | aha, (instance? <class> <obj>) seems to work |
| 06:08 | antifuchs | oh, heh. looks like I should rewrite some of my code, then (: |
| 06:08 | antifuchs | thanks, joha1 (: |
| 06:08 | joha1 | np |
| 06:15 | Raynes | joha1: There is also instance? |
| 06:15 | Raynes | ,(instance? Integer 3) |
| 06:15 | clojurebot | true |
| 06:16 | joha1 | yes, I just found instance? in the API doc |
| 06:17 | Raynes | And class? |
| 06:17 | Raynes | Which is less useful, but still. :) |
| 07:32 | yason | How to extract the local name out of a fully qualified symbol? |
| 07:36 | leafw | ,(doc name) |
| 07:36 | clojurebot | "([x]); Returns the name String of a symbol or keyword." |
| 07:36 | leafw | yason: I guess that answers it. |
| 07:40 | mihand | hey guys. do next and rest differ only in how they handle empty seqs? |
| 07:41 | leafw | mihand: no. |
| 07:41 | mihand | in core they seem to have runtime support |
| 07:41 | leafw | mihand: rest is eager, I think. |
| 07:43 | mihand | did rest change recently? because i have the feeling that in the screencasts it returned nil |
| 07:43 | durka42 | yes |
| 07:44 | durka42 | rest changed with the introduction of lazy sequences |
| 07:44 | durka42 | you should now use next instead, unless you are writing a lazy seq |
| 07:45 | leafw | mihand: it changes about 2 months ago or so |
| 07:45 | mihand | thanks |
| 08:47 | powr-toc | Hey... I was wondering, is there an idiomatic clojure way to wrap an object into a seq-able abstraction? |
| 08:48 | powr-toc | assuming I have a java object that's similar to an Iterator |
| 08:50 | powr-toc | I've seen there is iterator-seq... the problem is I don't have an iterator |
| 08:50 | powr-toc | or rather, the object doesn't implement Iterator directly |
| 08:55 | powr-toc | Ok, just looking at re-seq's implementation... looks like the pattern is to use lazy-seq to build a sequence out of consing iterations together... |
| 08:59 | yason | leafw: yes, thanks! exactly what I was looking for |
| 10:54 | StartsWithK | fyuryu: hi, your the author of cloak? |
| 12:22 | fyuryu | StartsWithK: hi, yes |
| 12:23 | StartsWithK | hi again :) |
| 12:23 | StartsWithK | whats the state of cloak? |
| 12:23 | StartsWithK | i looked at it, last update was 2 months ago |
| 12:24 | StartsWithK | it looks good, i would like to use it to replace someting like 40-60 ant builds, they are all small script and call external programs like jar or ant, svn.. |
| 12:25 | StartsWithK | is this kind of thing you had in mind for cloak? |
| 12:25 | fyuryu | StartsWithK: needs an update, some of the code that I've written for it is now in contrib |
| 12:25 | StartsWithK | can it be usead as library? |
| 12:25 | gnuvince_ | What's cloak? |
| 12:26 | hiredman | "simple automation tool inspired by rake, written in Clojure" |
| 12:26 | fyuryu | StartsWithK: are you familiar with rake? |
| 12:26 | StartsWithK | any plans for, lets say that rm could be more sensitive to content, like if do rm in svn project, it uses svn remove |
| 12:26 | StartsWithK | fyuryu: to some extent, i used buildr |
| 12:26 | StartsWithK | and rake is just a thing i would like to use, light, simple.. |
| 12:27 | StartsWithK | or things like (cp ["%s/text.file" root-dir] ["%s/dest.file" dest-dir]) |
| 12:27 | fyuryu | StartsWithK: the idea was to automate calling external commands |
| 12:28 | fyuryu | and have some Clojure/Java specific bonuses (eq. compiling) |
| 12:28 | StartsWithK | so you have a CA signed? |
| 12:29 | fyuryu | StartsWithK: yes, I sent one, but don't know if Rich got it |
| 12:30 | fyuryu | StartsWithK: it is also possible to use cloak with Lancet - that gives you access to all the ant tasks |
| 12:30 | fyuryu | and there are a lot of them |
| 12:31 | StartsWithK | well my build is ant, i would like to use just cloack, looked at lancet and skipped it |
| 12:31 | StartsWithK | cloak* |
| 12:32 | fyuryu | one thing that Lancet doesn't have is resolving circular dependencies |
| 12:32 | StartsWithK | also, i see for now only one problem |
| 12:32 | StartsWithK | it has no build system |
| 12:32 | StartsWithK | in ant |
| 12:33 | Drakeson | Do you have a snippet to put in user.clj that `use's all utilities in contrib, as their name? conceptually: (doseq [x *clojure-contrib-libraries*] (use '[clojure.contrib.x as x])) |
| 12:33 | StartsWithK | i would need something like that so i cn bootstrap my build |
| 12:33 | StartsWithK | would you accept such a patch? |
| 12:33 | fyuryu | StartsWithK: you mean an build.xml to compile cloak? |
| 12:33 | StartsWithK | yes |
| 12:33 | lisppaste8 | lethe pasted "xml-zip filtering" at http://paste.lisp.org/display/78492 |
| 12:34 | lethe | Why does xml1-> in ^ seem to return a function and not the location? |
| 12:35 | fyuryu | StartsWithK: yeah, I was supposed to write that, but since I hava a special script with CLASSPATH for cloak set, I forgot about it |
| 12:35 | fyuryu | StartsWithK: but sure, a patch would be nice :-) |
| 12:36 | StartsWithK | fyuryu: ok, i'll find you in couple of days when i sort cloak intergation with my build |
| 12:36 | StartsWithK | thanks for replays |
| 12:36 | fyuryu | StartsWithK: will you be doing any Clojure code compilation from cloak? |
| 12:37 | StartsWithK | fyuryu: only calling of ant thro shell |
| 12:37 | StartsWithK | some jar manipulations and svn git hg checkouts |
| 12:38 | fyuryu | StartsWithK: ah, ok. Just wanted to be sure you are aware abt. the standard CLASSPATH pains |
| 12:38 | StartsWithK | will it run ok if i call multiple cloak files (separate processes) from inside ant <parallel> task? |
| 12:40 | powr-toc | Is there a reason why (seq? []) returns false? |
| 12:40 | fyuryu | StartsWithK: it should, unless you're going to try to access the same resources from different processes |
| 12:40 | powr-toc | I thought vectors were sequences |
| 12:40 | fyuryu | StartsWithK: etc |
| 12:40 | dakrone_hb | ,(seq? []) |
| 12:40 | clojurebot | false |
| 12:40 | powr-toc | ,(seq? ()) |
| 12:40 | clojurebot | true |
| 12:41 | StartsWithK | fyuryu: thanks |
| 12:41 | gnuvince_ | powr-toc: it implementes the sequence interface |
| 12:41 | hiredman | vectors are not seqs |
| 12:41 | gnuvince_ | ,(iseq? []) |
| 12:41 | clojurebot | java.lang.Exception: Unable to resolve symbol: iseq? in this context |
| 12:41 | fyuryu | StartsWithK: you're welcome |
| 12:41 | hiredman | ,(seq? (seq [])) |
| 12:41 | clojurebot | false |
| 12:41 | hiredman | well |
| 12:41 | hiredman | ,(seq? (seq [1])) |
| 12:41 | clojurebot | true |
| 12:41 | dakrone_hb | ,(list? []) |
| 12:41 | clojurebot | false |
| 12:42 | hiredman | a seq is a view over a collection |
| 12:42 | dakrone_hb | ,(set? []) |
| 12:42 | clojurebot | false |
| 12:42 | dakrone_hb | ,(vector? []) |
| 12:42 | clojurebot | true |
| 12:42 | powr-toc | hiredman: Then is there a common (testable) abstraction across vectors, lists and hashmaps? |
| 12:43 | hiredman | yeah |
| 12:43 | hiredman | ,(ancestors (class [])) |
| 12:43 | clojurebot | #{clojure.lang.IPersistentStack clojure.lang.Seqable java.util.RandomAccess clojure.lang.Counted clojure.lang.Sequential java.util.List clojure.lang.IPersistentVector clojure.lang.IFn clojure.lang.Associative java.lang.Runnable clojure.lang.IObj java.util.Collection java.io.Serializable clojure.lang.IPersistentCollection clojure.lang.Reversible clojure.lang.IMeta java.util.concurrent.Callable clojure.lang.Streamable java. |
| 12:44 | hiredman | ,(ancestors (class {})) |
| 12:44 | clojurebot | #{clojure.lang.Seqable clojure.lang.Counted java.util.Map clojure.lang.IFn clojure.lang.Associative java.lang.Runnable clojure.lang.IObj java.io.Serializable clojure.lang.IPersistentCollection clojure.lang.IMeta java.util.concurrent.Callable java.lang.Iterable clojure.lang.IPersistentMap java.lang.Object clojure.lang.Obj clojure.lang.APersistentMap clojure.lang.AFn} |
| 12:44 | hiredman | actully |
| 12:44 | hiredman | I think you should just use coll? |
| 12:44 | dakrone_hb | ,(seqable? []) |
| 12:44 | clojurebot | java.lang.Exception: Unable to resolve symbol: seqable? in this context |
| 12:44 | hiredman | ,(coll? []) |
| 12:44 | clojurebot | true |
| 12:45 | hiredman | ,(coll? (java.util.ArrayList.)) |
| 12:45 | clojurebot | false |
| 12:45 | hiredman | erm |
| 12:45 | hiredman | ,(doc coll?) |
| 12:45 | clojurebot | "([x]); Returns true if x implements IPersistentCollection" |
| 12:45 | hiredman | I see |
| 12:45 | powr-toc | hiredman: cheers... that's exactly what I'm after |
| 12:46 | hiredman | (instance? java.util.Collection []) |
| 12:46 | hiredman | ,(instance? java.util.Collection []) |
| 12:46 | clojurebot | true |
| 12:46 | hiredman | even more general |
| 12:46 | hiredman | and seq works on most (all?) Collections |
| 12:46 | hiredman | ,(seq (java.util.ArrayList. [1 2])) |
| 12:46 | clojurebot | (1 2) |
| 12:47 | hiredman | I kind of assumed coll? was a test for java.util.Collections |
| 12:49 | hiredman | ,(seq (java.util.HashMap. {:a 1})) |
| 12:49 | clojurebot | (#<Entry :a=1>) |
| 12:49 | hiredman | ,(first (first (seq (java.util.HashMap. {:a 1})))) |
| 12:49 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: Entry |
| 12:50 | hiredman | ,(seq (first (seq (java.util.HashMap. {:a 1})))) |
| 12:50 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: Entry |
| 12:50 | hiredman | interesting |
| 12:52 | marklar | How do you type hint the Math.abs function? java.lang.Math/abs is showing a reflection warning |
| 12:52 | Chouser | marklar: it wants to know the type of the arg |
| 12:53 | marklar | Chouser: Ah, thanks |
| 13:32 | twansit | hmm.. can someone show me a example of using the 'update-in' function? |
| 13:34 | twansit | disregard ... got it. |
| 13:35 | hiredman | http://log.damog.net/2009/04/rubx-twitters-ruby-shell/ |
| 13:35 | hiredman | oooo |
| 13:37 | leafw | "her" |
| 13:37 | leafw | clever way to gather publicity. |
| 13:38 | hiredman | I guess I'd better write a real twitter interface to start |
| 13:43 | cp2 | heh |
| 14:22 | hiredman | I do feel slightly unmaned by the fact that every attempt (of mine) at translating a java twitter poster to clojure seems to result in 401's |
| 14:24 | technomancy | hiredman: running into API limits? |
| 14:25 | technomancy | I'm trying to write a function to return the absolute filename of the caller. I tried using .getStackTrace on a new Throwable, but that doesn't give the full path, just the base name. |
| 14:25 | technomancy | any ideas? |
| 14:26 | technomancy | sorry, the absolute file name of the file containing the caller |
| 14:26 | hiredman | the caller of a function? |
| 14:26 | technomancy | yes |
| 14:27 | hiredman | hmmm |
| 14:27 | technomancy | this is what I've got that gives me the base name: (defn caller-file [] (.getFileName (second (.getStackTrace (Throwable.))))) |
| 14:27 | technomancy | but StackTraceElement doesn't seem to have any other methods that deal with filenames |
| 14:28 | hiredman | r1349 |
| 14:29 | hiredman | that might help, if that information is then propagated in the stacktrace |
| 14:29 | technomancy | interesting; thanks |
| 14:30 | technomancy | I get the feeling like it's trying to protect me from thinking about whether a file is source on disk or compiled in a jar or something, but in this case it's getting in the way. |
| 14:30 | Chouser | but vars and fns are very different things |
| 14:33 | Chouser | technomancy: it's entirely possible the information you want is simply not stored anywhere that you can get to |
| 14:34 | Chouser | technomancy: you can't redefine the problem at all? use a macro call instead of a function call, for example? |
| 14:40 | technomancy | oh, if I used a macro I would have access to *file*; is that right? |
| 14:40 | Chouser | *source-path* yeah |
| 14:41 | technomancy | thanks |
| 14:42 | technomancy | hrm; *source-path* is a relative filename as well. |
| 14:43 | Chouser | yeah, just noticed that. |
| 14:43 | Chouser | what are you using to load the file? 'require', 'load-file'? |
| 14:43 | technomancy | it'd be load-file since it's not on the classpath |
| 14:44 | Chouser | you were right: *file* |
| 14:57 | hiredman | google code is dead |
| 15:02 | leafw | hiredman: http://code.google.com/ ? |
| 15:03 | hiredman | leafw: requests for project pages like http://code.google.com/p/java-twitter/ are timing out |
| 15:08 | hiredman | I really wish I could figure this twitter thing out |
| 15:09 | hiredman | shelling out to curl is lame, and the code seems simple enough, every example I have seen is so similar that I can code it from memory |
| 15:12 | hiredman | I wonder if it is a user-agent thing |
| 15:15 | pjstadig | what's up with code.google.com lately? |
| 15:18 | hiredman | weird |
| 15:19 | hiredman | when I change my username I get two requests in the logs |
| 15:48 | hiredman | java.io.IOException: Not enough storage is available to process this command |
| 15:48 | hiredman | bah |
| 17:40 | technomancy | sets are unordered by default, right? |
| 17:40 | technomancy | so conj'ing on to them could add the new value at any position? |
| 17:41 | gnuvince_ | technomancy: hash-sets, yes. |
| 17:41 | technomancy | if *inventory* is a ref to a regular set, this seems to work: (str-join "\n " (conj @*inventory* "You are carrying:")) |
| 17:42 | technomancy | but in this case it's working by coincidence, right? |
| 17:42 | technomancy | there's no guarantee |
| 17:51 | Chouser | technomancy: but use (seq @*inventory*) instead to get consistent results |
| 17:59 | technomancy | oh sure; that works. I think it's cleaner to put the message outside the str-join though. |
| 18:25 | Chouser | sure |
| 18:29 | powr-toc | Is there a clojure equivalent of Ruby's String#succ http://www.ruby-doc.org/core/classes/String.html#M000794 |
| 18:29 | powr-toc | that'd turn a string of "abcd" into "abce" |
| 18:34 | Cark | powr-toc : have a look in tge java luibrary, i wouldn't bet on it though |
| 18:35 | powr-toc | Cark: it's nto |
| 18:35 | powr-toc | not |
| 18:36 | Cark | i wonder what's the use case =) |
| 18:37 | powr-toc | being able to generate sequential names |
| 18:42 | technomancy` | what's a good way to generate a filename that's based on a URL? |
| 18:43 | technomancy` | was thinking of either replacing all illegal-in-filename chars or just hashing it. |
| 18:44 | powr-toc | technomancy`: hashing it is probably the easiest way... but if you want them to be human readable then you have to replace chars |
| 18:44 | technomancy` | yeah, I don't think human-readability is important here |
| 18:47 | technomancy` | hrm; looks like to calculate SHA1 with Java you need to do it a byte at a time? |
| 18:49 | technomancy` | never mind |
| 18:50 | powr-toc | technomancy`: Yeah, I think so... Checkout Integer.toHexString though |
| 18:51 | lisppaste8 | dnolen pasted "md5" at http://paste.lisp.org/display/78517 |
| 18:52 | dnolen | perhaps someone might find this useful, I converted it from an example I found somewhere on the Internet, short and sweet. |
| 18:52 | technomancy` | thanks |
| 18:52 | powr-toc | dnolen: nice... |
| 18:53 | technomancy` | short for Java anyway. =) |
| 18:54 | dnolen | ;) |
| 18:55 | aperotte | hello everyone |
| 19:11 | technomancy` | I'm a little shaky on Java IO; how would you finish this snippet to write the contents of a URL to disk? (with-open [*in* (reader url) *out* (writer filename)] [...]) |
| 19:12 | technomancy` | some kind of variation on this I guess? (while (not (eof? *in*)) (print (read-line))) |
| 19:20 | st3fan | is there a concept like Python's yield in Clojure? |
| 19:28 | Cark | stefan : we do loops from the outside with constructs like map and reduce |
| 19:30 | technomancy` | I'm trying to instantiate a CharBuffer for writing data to disk... what's wrong with this? (java.nio.CharBuffer. (make-array Character 1000)) |
| 19:31 | Cark | isn't there an allocate static function on char buffers ? |
| 19:31 | technomancy` | ah, I didn't realize that's what it was for; thanks |
| 19:33 | technomancy` | oh... but writers don't work with CharBuffers. |
| 19:35 | technomancy` | silly me for assuming that readers and writers worked the same way. |
| 19:35 | Cark | but they should work with bytebuffers |
| 19:35 | Cark | so just wrap a bytebuffer around your charbuffer (i guess) |
| 19:36 | technomancy` | nope, the reader won't work with a byte buffer |
| 19:37 | technomancy` | there's got to be a better way to write the contents of a URL to disk |
| 19:37 | Cark | what are the classes of your writer and reader ? |
| 19:37 | technomancy` | I'm using duck-streams |
| 19:38 | technomancy` | maybe that's a mistake |
| 19:38 | Cark | why do you need a charbuffer then ? |
| 19:39 | technomancy` | because that's what my reader's .read method accepts |
| 19:39 | technomancy` | and I'm assuming read-line and println won't work with binary data |
| 19:40 | Cark | ah that's a binary file ? |
| 19:40 | technomancy` | well it could be |
| 19:40 | Cark | then you surely don't need a charbuffer =) |
| 19:40 | Cark | that's some kind of a file copy function ? |
| 19:40 | technomancy` | at this point I'm tempted to shell out to curl |
| 19:40 | technomancy` | because this should not be ten lines. =\ |
| 19:41 | Cark | you need to use errr ...one second |
| 19:42 | Cark | fileinputstream and fileoutputstream for possibly binary data |
| 19:42 | technomancy` | thanks |
| 19:42 | technomancy` | java.net.URL could construct the input stream for me, right? |
| 19:43 | Cark | hum try passing that to the stream constructor |
| 19:44 | Cark | is that doesn't work, there might be some way to convert to a File object |
| 19:48 | technomancy` | (.openStream (java.net.URL. "http://technomancy.us")) |
| 19:48 | Cark | ah nice =) |
| 19:49 | technomancy` | so when I call read on that, how do I know when it's done? |
| 19:50 | technomancy` | I'd expect it to throw an exception if I keep reading from it, but it just keeps going forever. |
| 19:50 | technomancy` | does it do something silly like return -1? |
| 19:51 | technomancy` | hah; it does. wow. |
| 19:51 | Cark | don't you loce java programming ? |
| 19:51 | Cark | love |
| 19:52 | powr-toc | how do you perform a primitive cast in clojure? I want to cast an int as a char |
| 19:52 | dnolen | ,(char 10) |
| 19:52 | dnolen | oops clojurebot is dead |
| 19:53 | dnolen | but that should work |
| 19:53 | powr-toc | cool |
| 20:16 | hiredman | ~how much do you know? |
| 20:17 | clojurebot | I know 280 things |
| 20:17 | hiredman | I guess that'll do |
| 20:21 | Chouser | :-) |
| 20:52 | powr-toc | how do I flatten a sequence? |
| 20:53 | powr-toc | I can't seem to find a function for it |
| 20:53 | hiredman | I think there is a flatten in seq-utils in contrib |
| 20:53 | hiredman | there is also apply concat |
| 20:54 | gnuvince_ | ,(filter (complement seq?) (tree-seq [1 [2 3 [4 5] 6 7] 8 [9]])) |
| 20:54 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$tree-seq |
| 20:54 | hiredman | ,(apply concat [[1 2 3] [4 5 6]]) |
| 20:54 | clojurebot | (1 2 3 4 5 6) |
| 20:54 | gnuvince_ | ,(doc tree-seq) |
| 20:54 | clojurebot | "([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree." |
| 20:56 | hiredman | ,(tree-seq vector? seq [1 [2 3 [4 5] 6 7] 8 [9]])) |
| 20:56 | clojurebot | ([1 [2 3 [4 5] 6 7] 8 [9]] 1 [2 3 [4 5] 6 7] 2 3 [4 5] 4 5 6 7 8 [9] 9) |
| 20:58 | hiredman | ,(re-seq #"\w+" "foo bar baz") |
| 20:58 | clojurebot | ("foo" "bar" "baz") |
| 20:59 | powr-toc | I think apply concat'll do... but I wish flatten was in the core libs |
| 20:59 | powr-toc | it seems like a common thing to want to do |
| 20:59 | hiredman | ,(reduce vector (re-seq #"\w+" "foo bar baz")) |
| 20:59 | clojurebot | [["foo" "bar"] "baz"] |
| 20:59 | rhickey | Is the person responsible for incanter (http://github.com/liebke/incanter/tree/master) ever here? |
| 21:00 | hiredman | ,(reduce vector (re-seq #"\w+" [] "foo bar baz")) |
| 21:00 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$re-seq |
| 21:00 | hiredman | ~seen liebke |
| 21:00 | clojurebot | no, I have not seen liebke |
| 21:01 | hiredman | 2009:Apr:13:06:24:59-!- dliebke [n=dliebke@134.192.133.202] has joined #clojure |
| 21:02 | rhickey | ~seen dliebke |
| 21:02 | clojurebot | no, I have not seen dliebke |
| 21:02 | hiredman | the seen information doesn't persist |
| 21:16 | rhickey | http://lotrepls.appspot.com/ |
| 21:20 | Chouser | huh |
| 21:20 | hiredman | wow |
| 21:20 | hiredman | cute |
| 21:24 | dliebke | rhickey: Hi, do you have a question about incanter? |
| 21:24 | Chouser | all those langages hooked up, and he wrote it in java. |
| 21:24 | hiredman | :P |
| 21:25 | rhickey | dliebke: Hi - incanter looks neat. I was wondering what you were doing with Colt, and whether you had tried Parallel Colt? |
| 21:26 | dliebke | thanks, I've looked at parallel colt in the past, but I'm not using it at this point -- although it might be a good idea |
| 21:27 | rhickey | are you happy with Colt? |
| 21:28 | dliebke | yes, nice scope, good performance -- better than anything else I've used written in Java |
| 21:29 | dliebke | I've extended the colt matrix class and implemented the ISeq interface, which has been really powerful |
| 21:29 | rhickey | I've thought about providing direct support for (some of) Colt in Clojure |
| 21:30 | dliebke | that would be fantastic! |
| 21:31 | rhickey | some sort of DSL for defining/combining Colt Functions |
| 21:34 | djkthx | is it possible to have an array of bytes or bits in clojure, instead of just an int-array? |
| 21:34 | gnuvince_ | djkthx: yes |
| 21:35 | hiredman | ,(byte \a) |
| 21:35 | clojurebot | java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number |
| 21:35 | hiredman | ,(byte (int \a)) |
| 21:35 | clojurebot | 97 |
| 21:35 | gnuvince_ | ,(make-array Byte/TYPE 10) |
| 21:35 | clojurebot | #<byte[] [B@15d601f> |
| 21:36 | djkthx | ah, nice |
| 21:37 | djkthx | didn't realize /TYPE would make it a primitive |
| 21:38 | djkthx | thanks |
| 21:40 | dliebke | rhicky, I'd like to hear more about your ideas on colt as you flesh them out :) |
| 21:40 | djkthx | colt? |
| 21:43 | rhickey | dliebke: nothing too radical, just something to let you write functions and chains using normal */+- syntax, plus something to wrap assign to make it functional |
| 21:44 | cp2 | rhickey: i dont quite understand |
| 21:44 | dliebke | djkthx, colt is a numeric library written in Java |
| 21:44 | cp2 | oh |
| 21:44 | cp2 | i see |
| 21:44 | dnolen | this will be super cool |
| 21:44 | dliebke | that would have made it much easier to write incanter :) |
| 21:46 | rhickey | there you go |
| 21:48 | djkthx | nifty |
| 21:48 | rhickey | http://piotr.wendykier.googlepages.com/parallelcolt |
| 21:49 | gnuvince_ | When they say "high performance numeric library", do they mean for complex numeric types or even for simple ints? |
| 21:49 | cp2 | 20:37 ::: netjoin/#clojure rhickey (n=rhickey@ool-457e4394.dyn.optonline.net) |
| 21:49 | cp2 | er |
| 21:49 | cp2 | JCublas provides Java bindings for the NVIDIA CUDA BLAS implementation, thus making the parallel processing power of modern graphics hardware available for Java programs. |
| 21:49 | cp2 | awesome |
| 21:53 | dliebke | gnuvince_: all my work with colt has been with doubles, I don't think it supports complex numbers or ints. |
| 21:55 | gnuvince_ | ok |
| 21:57 | arohner | rhickey: I've seen a few people mention the idea of gradual typing recently. What is your opinion on gradual typing in clojure? |
| 22:44 | toplay22 | Hey, I'm having problems with the interactions between clojure and slime. |
| 22:45 | toplay22 | I'm using clojure-mode (which uses slime and swank-clojure), but in Emacs when I do a "M-x slime", it takes a REALLY long time to finally connect. |
| 22:45 | toplay22 | I get this error: |
| 22:46 | toplay22 | Polling "/tmp/slime.29096".. (Abort with `M-x slime-abort-connection'.) [644 times] |
| 22:47 | toplay22 | But it eventually connects. |
| 22:47 | toplay22 | I don't have any trouble using another lisp, like sbcl or cmucl. |
| 22:48 | gnuvince_ | toplay22: how long is a really long time? |
| 22:50 | toplay22 | About 10 minutes. |
| 22:52 | gnuvince_ | Are all your versions up to date? Clojure, slime, clojure-swank? |
| 22:56 | toplay22 | yes |
| 22:59 | toplay22 | Do you know of any way I can get more information about why it is just repeatedly polling and not connecting? |
| 23:03 | toplay22 | Oh, and this is why happens in the buffer that is starting the *inferior-lisp*: |
| 23:03 | toplay22 | http://pastebin.com/m21ca2c11 |
| 23:04 | toplay22 | *why happens -> what happens |