2009-10-09
| 10:13 | snowwhite | liwp, Can you please tell me that tracing library in contrib? |
| 10:14 | arbscht | clojurebot: trace |
| 10:14 | clojurebot | trace is (in contrib) http://github.com/kevinoneill/clojure-contrib/commit/43e4168fc8772225c7f749ffb363b0e2a8f7b84f |
| 10:14 | arbscht | hrm, that's no good |
| 10:14 | arbscht | try http://richhickey.github.com/clojure-contrib/trace-api.html |
| 10:14 | durka42 | clojurebot: your link is dead |
| 10:14 | clojurebot | You don't have to tell me twice. |
| 10:15 | arbscht | clojurebot: trace is http://richhickey.github.com/clojure-contrib/trace-api.html |
| 10:15 | clojurebot | You don't have to tell me twice. |
| 10:15 | durka42 | clojurebot: how's my link doing? |
| 10:15 | clojurebot | with style and grace |
| 10:54 | LauJensen | ,(condp = 5 2 "two" 3 "three" :else "no dice") |
| 10:54 | clojurebot | java.lang.IllegalArgumentException: No matching clause: 5 |
| 10:55 | LauJensen | Why doesn't that give me "no dice" ? |
| 10:56 | arbscht | ,(condp = 5 2 "two" 3 "three" "no dice") |
| 10:56 | clojurebot | "no dice" |
| 10:56 | arbscht | "A single default expression can follow the clauses, and its value will be returned if no clause matches." |
| 10:57 | LauJensen | Ah, how inconsitent, thanks arbscht |
| 10:58 | arbscht | if there was :else or :default semantics, I think you couldn't use those keywords as a test-expr |
| 10:59 | JAS415 | ,(= :z :z) |
| 10:59 | clojurebot | true |
| 10:59 | JAS415 | wonder why that is broken on my clojure |
| 11:00 | arbscht | JAS415: what is your clojure? |
| 11:00 | JAS415 | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"} |
| 11:01 | JAS415 | i must need to update again from the repository |
| 11:30 | gerryxiao | hello |
| 11:31 | gerryxiao | what's "Exception in thread "main" java.lang.Exception: No dispatch macro for: / (clj:1)"? |
| 11:32 | gerryxiao | when run clojure as script |
| 11:32 | gerryxiao | clj somefile.clj |
| 11:33 | raek | gerryxiao: what does your clj file look like? |
| 11:34 | gerryxiao | just common clj file |
| 11:34 | gerryxiao | if i loaded in repl, it works |
| 11:35 | JAS415 | i think clojure github link might be broken |
| 11:36 | raek | the script must be run with java -cp /sq/ext/clojure/clojure.jar clojure.lang.Script |
| 11:37 | gerryxiao | raek: i have tested "(defn add [ a b] (+ a b)) (add 3 4) " as a clj file, i still got that msg |
| 11:38 | gerryxiao | is there something wrong with my clj script? but i have been worked till recently |
| 11:38 | gerryxiao | s/i/it |
| 11:39 | raek | echo "(defn add [ a b] (+ a b)) (print (add 3 4))" > test.clj |
| 11:39 | raek | java -cp your-classpath/clojure.jar clojure.lang.Script test.clj |
| 11:40 | raek | dont forget the "clojure.lang.Script" part |
| 11:40 | raek | also, the program will have to print the values |
| 11:40 | raek | not just evaluate them |
| 11:40 | JAS415 | oh |
| 11:40 | JAS415 | well you have like a bash script named clj though |
| 11:41 | gerryxiao | ok, it seems working |
| 11:42 | JAS415 | o |
| 11:42 | JAS415 | what did you do? |
| 11:42 | gerryxiao | so, that's problem of my clj script |
| 11:42 | JAS415 | oo |
| 11:43 | gerryxiao | but my clj script is copyed from clojure wiki |
| 11:45 | gerryxiao | java -server -cp $CLOJURE_JAR:$CONTRIB_JAR:$SWT_JAR:$JSR:./classes:./src clojure.lang.Script $0 - |
| 11:45 | gerryxiao | $0 -- $@ |
| 11:45 | gerryxiao | what's wrong? |
| 11:45 | ngoc | Hi, how to tell Ivy to download clojure and clojure-contrib from http://tapestry.formos.com/maven-snapshot-repository/? |
| 11:47 | ngoc | It seems that Ivy only search http://repo1.maven.org/maven2. How to tell it to search http://tapestry.formos.com/maven-snapshot-repository/? |
| 11:47 | JAS415 | for the ./classes and ./src, what is that? |
| 11:47 | JAS415 | current directory? |
| 11:47 | lpetit | hello, do you know if there is a way to correctly print enclojure wiki's pages ? |
| 11:52 | raek | gerryxiao: what happens when you run the same thing, but with clojure.lang.Repl instead of .Script? |
| 11:53 | gerryxiao | repl works |
| 11:53 | raek | strange |
| 11:54 | raek | I'm afraid I'm out advice... |
| 11:55 | gerryxiao | first output result then into repl user prompt |
| 11:56 | gerryxiao | what's the meaning of "no dispatch macro for :/"? |
| 12:01 | raek | ,(keyword "" "") |
| 12:01 | clojurebot | :/ |
| 12:03 | raek | what is the first line of the file? |
| 12:03 | raek | a shebang line? |
| 12:03 | gerryxiao | JAS415 ./classes ./src , yes classes and src dir under current dir |
| 12:04 | JAS415 | assuming that the cp is right, the only thing that changed is the args |
| 12:05 | JAS415 | $0 -- $@ |
| 12:14 | gerryxiao | it's odd |
| 12:14 | gerryxiao | just type: clj a , i 'll get same error |
| 12:16 | gerryxiao | BREAK_CHARS="(){}[],^%$#@\"\";:''|\\" |
| 12:17 | gerryxiao | raek: yes shebang line |
| 12:18 | gerryxiao | #/bin/bash |
| 12:18 | gerryxiao | oops, no bang :) |
| 12:18 | raek | what's the first line in the .clj file? |
| 12:22 | gerryxiao | append ! to # still not work |
| 12:31 | gerryxiao | ok, solved |
| 12:31 | gerryxiao | change $0 to $1 |
| 12:31 | gerryxiao | thx |
| 12:31 | gerryxiao | i have forgot what's bash :) |
| 12:35 | gerryxiao | raek: #/bin/bash |
| 12:42 | raek | #/bin/bash |
| 12:42 | raek | in a clojure script file? |
| 12:42 | technomancy | what determines which milestone a ticket should be on? |
| 12:43 | technomancy | should I just leave it on backlog and let a committer move it if it's appropriate? |
| 12:46 | gerryxiao | raek: bash script |
| 12:47 | gerryxiao | $0 is bash script itself,so i got that error |
| 12:48 | technomancy | there are an awful lot of open tickets in assembla... do we need more people reviewing patches? |
| 12:52 | chouser | technomancy: only rich changes the milestone |
| 12:52 | technomancy | chouser: gotcha |
| 12:53 | chouser | also, only rich changes a ticket with a patch from unapproved to approved. |
| 12:54 | technomancy | chouser: seems like it would be helpful to have others try out patches and leave comments etc so he doesn't have to waste his time with stuff that's broken |
| 12:54 | chouser | The big queues are generally tickets with "next release" milestone that have no patches. |
| 12:54 | jaiganesh | hi |
| 12:54 | chouser | technomancy: yes, that could be helpful -- I'm sure he'd appreciate comments to that effect. |
| 12:54 | jaiganesh | i was attempting problem no 4 from projecteuler.net |
| 12:55 | jaiganesh | i came up with this solution |
| 12:55 | technomancy | chouser: just thinking since we copied the patch submission process from rails, what they do is get people to vote +1 for patches, and they don't get considered until a patch has at least three votes |
| 12:55 | chouser | the other place they tend to queue up is when they have a patch but rich hasn't had the time yet to approve, but I don't think much can be done about that except as you said to help improve the patch as much as possible before he looks at it, and then have more people recommending approval. |
| 12:55 | technomancy | obviously that's a larger community, but it might be worth trying to get more people involved. |
| 12:56 | jaiganesh | , (apply max (map (fn [[x y]] (* x y)) (filter #(= (seq(str (* (nth %1 0) ( |
| 12:56 | jaiganesh | nth %1 1))))(reverse (str (* (nth %1 0) (nth %1 1)))))(selections (range 100 1000 |
| 12:56 | jaiganesh | ) 2)))) |
| 12:56 | clojurebot | EOF while reading |
| 12:56 | technomancy | chouser: does he personally vet all patches to contrib as well? |
| 12:56 | chouser | technomancy: no |
| 12:56 | jaiganesh | but it takes long time..can anyone please tell me y |
| 12:56 | chouser | I was speaking only of clojure itself. |
| 12:57 | technomancy | chouser: I see. does that include things like clojure.test too? |
| 12:57 | chouser | yes, everything in the main clojure git repo ... though I think changes to tests get rather less scrutiny |
| 12:58 | technomancy | chouser: thanks for the explanation |
| 12:58 | chouser | sure. |
| 12:59 | chouser | yeah, contrib is a rather more distributed process. That should theoretically help things move quicker though in practice it's sometimes take some effort to find someone to take reponsibility for a particular patch to be applied. |
| 13:00 | technomancy | well it makes sense given the purpose. if something graduates to clojure itself, it will get plenty of additional review |
| 13:00 | chouser | yes |
| 13:00 | jaiganesh | how to write a code snippet here so that it does not wrap to multiple lines |
| 13:00 | technomancy | speaking of finding someone to take responsibility... I took the liberty of assigning my delete-file patch that I mentioned a few weeks ago to you. =) |
| 13:01 | chouser | jaiganesh: that depends mostly on your irc client. You can use a paste site for bigger things. |
| 13:01 | chouser | lisppaste8: url |
| 13:01 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 13:01 | chouser | technomancy: ok, thanks for the heads up. I'll try to take a look at it. |
| 13:02 | technomancy | thanks. =) |
| 13:02 | jaiganesh | ok thks |
| 13:03 | lisppaste8 | jaiganesh pasted "Problem No 4 projecteuler" at http://paste.lisp.org/display/88432 |
| 13:04 | jaiganesh | the above code is taking lot of time..can anyone please tell me why so? |
| 13:04 | jaiganesh | though i get the correct answer |
| 13:47 | ambient | jump to definition in emacs/clojure would be pretty sweet |
| 13:48 | technomancy | ambient: you mean M-.? |
| 13:48 | ambient | iirc there was metadata in function in which file it was defined, the feature wouldn't even necessarily be that hard to implement? |
| 13:48 | ambient | wot? |
| 13:48 | technomancy | =) |
| 13:49 | ambient | that seems to work with tags :/ |
| 13:49 | technomancy | not if slime is enabled |
| 13:49 | technomancy | "M-. runs the command slime-edit-definition" |
| 13:50 | ambient | that only works in the current directory? |
| 13:51 | technomancy | no, it works in any clojure buffer where slime is enabled |
| 13:51 | technomancy | the buffer has to be loaded, of course |
| 13:52 | ambient | i did M-x slime, and M-. doesn't even work inside the same file |
| 13:53 | technomancy | ambient: do you have slime-mode turned on in your .clj buffer? |
| 13:53 | ambient | (Clojure ElDoc Slime[clojure]) |
| 13:54 | ambient | it either telle me that there is no such class or "No known definition for: ... (in ...)" |
| 13:54 | technomancy | weird; I wonder what's wrong with your setup |
| 13:56 | ambient | *shrug* |
| 13:58 | ambient | fwiw here's my .emacs http://pastebin.com/m23f3fe9c |
| 13:59 | dnolen | cgrand: thanks for starting the Enlive group, I posted my ramblings about template inheritance there. |
| 14:04 | cgrand | dnolen: ok. Is there an html file for the inheriting template or only an html file per part (column here)? |
| 14:07 | dnolen | cgrand: well I suppose in Enlive it wouldn't really be template inheritance... um... is the idiomatic Enlive approach. pageTemplat <- navTemplate <- [widgetA, widgetB] ? |
| 14:08 | dnolen | if so it would just be nice to have an example saying you can accomplish the same means, you just have to think about it differently |
| 14:08 | cgrand | dnolen: I think both are possible |
| 14:14 | hiredman | http://www.youtube.com/watch?v=iHIaH12f2Ek <-- I call lisp machine |
| 14:15 | dnolen | cgrand: cool, how would you organize your code to do it the "traditional way" ? |
| 14:16 | wavis | hiredman: Guest VM = Lisp Machine ? |
| 14:17 | cgrand | dnolen: I'll reply on the group |
| 14:17 | dnolen | cgrand: thx |
| 14:17 | hiredman | wavis: Yes. |
| 14:17 | hiredman | well, it is a metacircular jvm running as a xen guest |
| 14:26 | snowwhite | i am still not sure how to use deftrace for debugging a clojure function? |
| 14:26 | snowwhite | Chousuke, ? |
| 14:30 | hircus | rhickey: ping |
| 14:31 | hiredman | ~seen rhickey |
| 14:31 | clojurebot | rhickey was last seen joining #clojure, 461 minutes ago |
| 14:31 | hircus | hiredman: aha, nice. thanks. I forgot about clojurebot |
| 14:44 | G0SUB | where can I find the docs of clojure.test ? |
| 14:52 | rhickey | hircus: pong |
| 14:52 | rongenre | Is classpath the only way to specify where namespaces can be loaded? It'd be convenient to mess with it within the clojure program. |
| 14:54 | stuartsierra | GOSUB: at the moment, in the source |
| 14:54 | JAS415 | penumbra is sweet, i need a new graphics card though, this one is melting... |
| 14:56 | ambient | yeah |
| 15:04 | ambient | i can't quite believe that gpu programming could be so simple as it seems with penumbra |
| 15:05 | ambient | penumbra seems to be using pixel shaders or such, im not sure how well the DSL would work with CUDA or respective ATI interfaces |
| 15:06 | G0SUB | stuartsierra: ping |
| 15:06 | G0SUB | stuartsierra: deftrace apparently has a bug. it doesn't work if the function has a doc string. as in, it does not entirely replace defn |
| 15:08 | stuartsierra | GOSUB: ok, please make a ticket |
| 15:10 | wavis | why is pushThreadBindings on the Var class static? it seems odd to me to manage an instance of Var as global state... |
| 15:11 | JAS415 | ambient: well the amount of abstraction that clojure allows makes me believe that you could probably do a similar thing for other interfaces |
| 15:12 | JAS415 | ambient: admittedly i've only played with it enough to tweak the mandelbrot example around a bit and have that kind of blow my mind |
| 15:13 | G0SUB | stuartsierra: wow, I can't find the link to create a new ticket on Assembla. |
| 15:14 | Chousuke | G0SUB: are you a member? |
| 15:14 | G0SUB | Chousuke: no. I just registered. |
| 15:14 | Chousuke | if not, you need to use the support tab. |
| 15:16 | G0SUB | Chousuke: OK. Now watching that page. |
| 15:23 | G0SUB | stuartsierra: there you go https://www.assembla.com/spaces/clojure-contrib/support/tickets/35-clojure-contrib-trace-deftrace-does-not-work-with-function-definitions-with-doc-strings |
| 15:23 | G0SUB | stuartsierra: thanks. |
| 15:24 | stuartsierra | thx |
| 15:25 | riddochc | Comment, then question: last weekend, I was dubious about clojure. Then, I read the book, documentation, and watched the videos this week, and now I'm rather impressed and pleased that clojure's an option. So, thanks for clojure. |
| 15:30 | JAS415 | where was the question |
| 15:31 | riddochc | question: not being as familiar with the concurrency primitives, I'm having some difficulty making an idiomatic code that triggers a function if another function takes longer than a given time. |
| 15:31 | Chousuke | hmm |
| 15:31 | Chousuke | I think Futures support a timeout |
| 15:32 | riddochc | Imagine a library that would support something a little like 'expect' on Linux/Unix, for an use-case. |
| 15:34 | riddochc | I'm not quite familiar enough with functional algorithms to know how to map something that seems most natural for me to think of as a state-machine, with timeouts or pattern matches determining transitions. |
| 15:35 | riddochc | Suggestions? |
| 15:36 | riddochc | Most other algorithms I've tried to implement with clojure so far are pretty natural to do in a functional style, but this one has me stumped. |
| 15:39 | Chousuke | hmm |
| 15:40 | Chousuke | a state machine is not too difficult to do functionally I think |
| 15:40 | wavis | riddochc: I don't know about idiomatic, but why not run one function in a thread, and start another thread that joins it with at timeout, checking if it's running and then calling fn2? |
| 15:40 | drhodes | there's neat article, http://eli.thegreenplace.net/2009/08/29/co-routines-as-an-alternative-to-state-machines/ but the language is python |
| 15:40 | Chousuke | you could consider a timeout simply another kind of state. |
| 15:43 | Chousuke | I suppose the whole process wouldn't really be functional (since you'd get different results from the state machine run depending on where timeouts happen) but the logic implementing the state machine itself could be just a function of state -> next state. |
| 16:03 | riddochc | Chousuke: Okay, I'll look into that. |
| 16:07 | riddochc | wavis: That was my first thought... as far as I can tell, that would want an agent? |
| 16:10 | hiredman | headius is everywhere |
| 16:10 | hiredman | http://kenai.com/projects/maxine/lists/users/archive/2009-10/message/4 |
| 16:10 | arohner | Chouser: in clojurescript, how do you distinguish between property access and function calls? |
| 16:10 | headius | hiredman: this is what I do :) |
| 16:11 | hiredman | headius: every where I go, "HEADIUS WAS HERE" |
| 16:12 | headius | well, we're pushing the boundaries with jruby...gotta dig deep |
| 16:12 | hiredman | maxine looks really cool |
| 16:16 | headius | hiredman: yeah, it definitely is |
| 16:16 | headius | I'm hoping to work with them on it to potentially make a "JRuby VM" out of it |
| 16:16 | hiredman | nah, maxine is going to be my lisp machine :P |
| 16:16 | headius | lisp is easy |
| 16:16 | clojurebot | "if you never learnt Lisp, then you never learned to program" -- some rant on some blog somewhere |
| 16:17 | hiredman | sure, tell that to cll |
| 16:18 | headius | but what I want out of maxine is similar to what lisp (or clojure) would want: fixnums, maybe smarter support for enclosed variable scopes |
| 16:18 | headius | tail calls would help lisp/clojure more than it would help ruby |
| 16:18 | headius | but they'd be nice too :) |
| 16:18 | hiredman | now if only maxine would build on freebsd |
| 16:20 | headius | well, that is one limitation :) it's fairly platform-limited right now |
| 16:20 | headius | I only need OS X and 64-bit linux though |
| 16:22 | hiredman | I think the osx target should build on freebsd with some tweaking |
| 16:23 | headius | probably |
| 16:24 | riddochc | I started learning CL about 10 years ago. Spent more of my time using Ruby, over the past 5 years, occasionally missing things from CL. |
| 16:25 | riddochc | Can I assume that the lack of multiple return values is a limitation of the JVM rather than a design choice by Clojure? |
| 16:26 | hiredman | I think it is needed for compatibility with the java callstack |
| 16:29 | riddochc | hiredman: I figured as much. I like CL's gethash: 1st retval, the value in the hash. 2nd retval, whether key's found. |
| 16:31 | hiredman | I've never used multiple return values, single return just seems cleaner |
| 16:31 | hiredman | if I want to return multiple things, I can return a contained containing multiple things |
| 16:49 | kunley | Hi. |
| 16:49 | kunley | Is anyone using slime to conenct to an existing clojure repl? |
| 16:50 | arbscht | connecting to swank, yes |
| 16:57 | drewr | I do too |
| 16:57 | drewr | but yeah, it needs to speak swank |
| 16:59 | kunley | well I just assumed it will be the standard way to use slime, so for a moment I wondered why it seems to be omitted in the wikibooks and in the clojure-mode readmes. |
| 16:59 | kunley | Anyway, I found in swank-clojure.el how swank server should be started. |
| 17:00 | drewr | I imagine most people just do the standard let-slime-manage-the-inferior-lisp thing |
| 17:00 | arbscht | which readmes? |
| 17:01 | kunley | arbscht: ones of swank-clojure and clojure-mode. Anyway, the bits needed to run on the clojure side are in the source. |
| 17:01 | arbscht | the standard way to use slime is to invoke "M-x slime" in emacs, and that will instantiate a new clojure (or other lisp) process |
| 17:03 | kunley | arbscht: yes, for some values of 'standard'. Anyway, after I asked here I found my answer in the source. |
| 17:12 | riddochc | Anybody got a tutoral for building java code/fighting with classpath? Google's giving me a lot of random useless links of people asking the same question, rather than answers. :/ |
| 17:13 | riddochc | As much as I'd like to stay as far inside Clojure as possible, I need to make stuff I'm working on available as a thrift service, and running into brick walls just knowing how to use javac/ant correctly. |
| 17:14 | arbscht | riddochc: this might explain some things http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html |
| 17:15 | riddochc | arbscht: That looks decidedly useful. Thanks! |
| 17:24 | itistoday | modest proposal: improve the API? |
| 17:25 | itistoday | err, rather, the documentation on the API? |
| 17:25 | itistoday | i'm coming from newLISP and i really like how they've organized their api, here's a link: |
| 17:25 | itistoday | http://www.newlisp.org/downloads/manual_frame.html |
| 17:26 | itistoday | the clojure api docs are organized by what seems to be namespaces |
| 17:26 | itistoday | or some extremely primitive form of organization |
| 17:26 | itistoday | where a whole bunch of stuff in placed in "clojure.core" |
| 17:27 | itistoday | right now i'm learning clojure, and it would really help if the api docs were better organized |
| 17:27 | itistoday | for example, in newLISP there's a function called lambda? to check if something is a function |
| 17:27 | ambient | i found that just reading the source is about the same as reading the API doc |
| 17:27 | ambient | (if not even better) |
| 17:27 | itistoday | ambient: the source for what? |
| 17:27 | ambient | seems like most of the API doc is direct copy & paste from clojure source |
| 17:28 | itistoday | well that's probably why it could use so much improvement :-p |
| 17:28 | itistoday | i'd even be happy to dedicate some time to it myself |
| 17:28 | itistoday | (don't know who to ask though) |
| 17:28 | itistoday | but just as an example |
| 17:28 | ambient | itistoday core.clj from src/clj/clojure |
| 17:28 | itistoday | i wanted to know what the equivalent to lambda? was in clojure |
| 17:28 | ambient | fn |
| 17:29 | itistoday | and it wasn't easy to find that because fn? is just thrown in amongst the hundreds of other functions with zero organization |
| 17:29 | itistoday | check the newLISP link |
| 17:29 | ambient | http://java.ociweb.com/mark/clojure/article.html |
| 17:29 | ambient | this is pretty good introduction to clojure imo |
| 17:29 | itistoday | well i'm not talking about a tutorial |
| 17:29 | itistoday | but a useful set of reference documentation |
| 17:29 | itistoday | the newLISP stuff is organized by purpose |
| 17:30 | itistoday | i.e., it has a section on the left called Predicates, and *all* of newLISP's built-in predicates are there |
| 17:30 | itistoday | so instantly at a glance you know exactly where to look if you want to compare something |
| 17:30 | technomancy | any old java hands around that could tell me what's wrong with this simple 3-line log4j config? http://p.hagelb.org/log4j.properties.html |
| 17:32 | itistoday | who/where should I speak to about helping out with clojure's api docs? |
| 17:33 | ambient | most of the dev team hangs out in this channel afaik, there's also clojure dev http://groups.google.com/group/clojure-dev .. im a total newb though :) |
| 17:33 | itistoday | btw, are strings in clojure utf8 or ascii? |
| 17:33 | hiredman | they are java strings |
| 17:34 | ambient | as clojure supports utf8 as language constructs, i'd reckon utf8 |
| 17:34 | technomancy | utf16 |
| 17:34 | technomancy | the JVM predates utf8 iirc |
| 17:34 | arbscht | itistoday: you could try the mailing list. I'd suggest producing some kind of documentation first and seeing if anyone else likes it |
| 17:34 | itistoday | so java strings are UTF16 by default? |
| 17:34 | hiredman | ~jdoc String |
| 17:35 | Chousuke | the default encoding is defined by a property |
| 17:35 | itistoday | arbscht: well there's already the newlisp documentation, i would just be proposing to do a similar thing |
| 17:35 | ambient | itistoday your link to the newlisp doc didn't work btw |
| 17:35 | Chousuke | but a java char is a 16-bit UTF-16 character |
| 17:36 | itistoday | ambient: really? what's wrong? it's working for me.. |
| 17:36 | ambient | nvm it was just my irc client |
| 17:36 | itistoday | Chousuke: is there a way to change to utf8 by default? |
| 17:36 | itistoday | over the past year or so i've come to worship utf8 |
| 17:36 | Chousuke | sure, but don't ask me how :P |
| 17:37 | Chousuke | you need to just configure the property somewhere |
| 17:37 | hiredman | no |
| 17:37 | itistoday | hiredman: not possible? |
| 17:37 | hiredman | strings and chars are utf16 |
| 17:37 | itistoday | hiredman: hard-wired in the jvm? |
| 17:37 | hiredman | it is possible to change file encodings |
| 17:37 | stuartsierra | The JVM spec says chars are 16 bits. |
| 17:37 | hiredman | or the encodings on output streams |
| 17:38 | hiredman | ~jdoc Character |
| 17:38 | itistoday | you know one day we're going to meet an alien species and that's when they're finally going to get around to realizing that utf8 is the best encoding (currently) available.. |
| 17:38 | hiredman | "The char data type (and therefore the value that a Character object encapsulates) are based on the original Unicode specification, which defined characters as fixed-width 16-bit entities." |
| 17:40 | Chousuke | itistoday: it's not just the encoding that matters :/ |
| 17:40 | Chousuke | itistoday: though of all the options, unicode is the least bad :P |
| 17:40 | technomancy | Chousuke: says the Finn. =) |
| 17:41 | Chousuke | but even unicode isn't perfect. Having multiple possible representations for a single string is not quite ideal :P |
| 17:43 | itistoday | Chousuke: yeah, but like you said, it's the least bad, or the converse, the best we have so far :-p |
| 17:43 | itistoday | ambient: thanks for the clojure-dev link, i'll offer the suggestion there |
| 17:44 | Chousuke | normalisation algorithms exist, but then you run into problems if two systems expect the strings to be in their preferred normalised form ;/ |
| 17:44 | Chousuke | since there are multiple |
| 17:44 | arbscht | technomancy: I think you want File, not Target |
| 17:44 | Chousuke | What this all means is, I can't share files from Debian to my OS X laptop over NFS. |
| 17:44 | technomancy | arbscht: thanks; I tried that and got the same error |
| 17:44 | arbscht | what's your error? |
| 17:45 | technomancy | arbscht: it's quite helpful: log4j:WARN No appenders could be found for logger (user). |
| 17:45 | technomancy | and then it helpfully suggests that I "initialize the log4j system properly." |
| 17:45 | technomancy | which sounds like a great idea to me. |
| 17:49 | arbscht | technomancy: is the properties file in the classpath? |
| 17:50 | technomancy | arbscht: actually it's using the -Dlog4j.configuration= flag, which is likely the problem |
| 17:50 | technomancy | I pointed it at a known good file and it gave the same error |
| 17:52 | tomoj | where is the clojure finger tree stuff at? |
| 17:53 | tomoj | oh I found it.. Chouser/finger-tree |
| 17:54 | tomoj | looking for a priority queue which can tell me quickly whether something is already in the priority queue |
| 17:54 | tomoj | do finger trees sound right? reading the paper now |
| 17:56 | hiredman | I don't think so |
| 17:56 | tomoj | darn |
| 17:56 | hiredman | you might keep a set+pq |
| 17:57 | tomoj | yeah |
| 17:57 | tomoj | actually I guess I can just use a seq of queues too |
| 17:59 | technomancy | arbscht: properties file has to be on the classpath; go figure |
| 17:59 | technomancy | a "file not found" message would have been great |
| 18:01 | arbscht | technomancy: did you try passing log4j.debug? I wonder if that would have given more info |
| 18:01 | technomancy | ah, the irony of a logging system hiding crucial messages because the wrong level was set is just too much! =) |
| 18:02 | arbscht | hah |
| 18:02 | technomancy | arbscht: yeah, that certainly helps; will try that in the future |
| 18:02 | technomancy | thanks |
| 18:02 | arbscht | great |
| 18:25 | rongenre | One question -- I'm running clojure and slime, which did its own clojure install. Any idea how to upgrade clojure? |
| 18:25 | ambient | i use M-x clojure-update |
| 18:26 | rongenre | Urgh.. I did a ^H-a upgrade and got nothing. Ok, thanks |
| 18:28 | itistoday | rongenre: you using OS X? |
| 18:29 | rongenre | Nope, this was on a linux box |
| 18:29 | itistoday | ah k, nm |
| 18:29 | rongenre | I did have a hell of a time getting clojure to install on osx, since ports put git in /opt/local |
| 18:29 | rongenre | but I messed with dotfiles and eventually it worked |
| 18:29 | technomancy | rongenre: apps launched from the GUI don't inherit env vars from properties... submit a bug report to Apple. =( |
| 18:30 | itistoday | rongenre: took me no time at all: http://github.com/citizen428/ClojureX/tree/master |
| 18:30 | itistoday | (I didn't do it through ports) |
| 18:31 | rongenre | Gotcha.. yeah, I had my emacs and git installed through ports, and then tried to use the emacs package stuff to get slime |
| 18:31 | rongenre | Eventually it worked... clojure mode's a strange beast. It also ignores CLASSPATH unless you mess with .emacs |
| 18:32 | technomancy | rongenre: again, environment variables get ignored due to that bug. nothing we can do about it. |
| 18:32 | rongenre | Well this is on linux. |
| 18:33 | technomancy | oh, right. the java command accepts either a -cp argument or the $CLASSPATH variable, not both |
| 18:33 | Chousuke | isn't use of the CLASSPATH env var usually discouraged? |
| 18:33 | rongenre | Yeah, I put some code in .emacs to do stuff with swank-clojure-classpath |
| 18:33 | Chousuke | you should just use -cp every time. |
| 18:34 | rongenre | I can't answer -- I'm slowly using clojure scripts in place of jython scripts. And we've always built up a CLASSPATH env. |
| 18:34 | rongenre | Trying to make it painless |
| 18:34 | technomancy | that's not a word you hear in connection to the classpath very often. =\ |
| 18:35 | rongenre | No I really dislike classpaths, but they work ok for a bunch of console apps. |
| 18:36 | Chousuke | my emacs config is a bit more complicated than itistoday's, but clojure+slime is not too hard to set up once you figure out the basics :) |
| 18:36 | Chousuke | I don't use any of the automagic though. |
| 18:37 | rongenre | key, for me, was setting up (and knowing about ) swank-clojure-classpath |
| 18:37 | tomoj | I just use swank-clojure-project |
| 18:39 | Chousuke | http://github.com/Chousuke/emacs.d/blob/master/init-clojure.el this is what I do. |
| 18:39 | Chousuke | I wonder if the custom lisp implementation is even required anymore though |
| 18:39 | Chousuke | I needed it to get slime/clojure use UTF-8 :/ |
| 18:40 | Chousuke | latin1 is not quite satisfactory :P |
| 18:42 | Chousuke | I think I've also quite succesfully butchered the starter kit, but if it works for me, it's good enough :) |
| 18:42 | tomoj | anyone else noticed problems with the clojure repl and the | character?@ |
| 18:43 | arbscht | eurk, that looks a lot like the mess in my init file |
| 18:44 | itistoday | Chousuke: I think the emacs-starter-kit is a misnomer, it's pretty bloated |
| 18:44 | itistoday | right now i'm putting off fighting with it to slim down all the excess to get decent loading emacs loading times |
| 18:45 | itistoday | s/loading emacs/emacs/g |
| 18:45 | technomancy | itistoday: spoiler alert: 90% of that is nxhtml |
| 18:45 | arbscht | tomoj: problems? |
| 18:46 | tomoj | arbscht: as in, it gets confused about whether or not the input is complete |
| 18:46 | tomoj | maybe it's paredit's fault, I dunno |
| 18:46 | Chousuke | itistoday: it contains lots of good stuff though. |
| 18:46 | itistoday | technomancy: don't get me wrong, i like that you've put in this work, I'm just saying i'd have done it much differently. there's wayyy too much stuff in there by default |
| 18:46 | Chousuke | itistoday: and it's pretty easy to disable stuff I don't use, anyway |
| 18:47 | technomancy | itistoday: most of it is autoloaded so it doesn't affect startup time. nxhtml is the main offender since it's so complicated |
| 18:47 | technomancy | jabber.el might be bad too |
| 18:48 | itistoday | technomancy: yeah, and paredit mode by default i think is another offender |
| 18:48 | technomancy | itistoday: paredit will pay you back many times over if you give it the chance. |
| 18:49 | itistoday | technomancy: it's actually a nice package, but i don't like how it works. i spent several hours hacking it to get it to behave the way TextMate does |
| 18:49 | tomoj | I am glad the emacs-starter-kit dropped me into it :) |
| 18:49 | technomancy | tomoj: that was my plan! glad to see it worked. =) |
| 18:51 | itistoday | i'm sure i could get used to it, but you have to keep in mind that some people are perfectly happy with the way they're used to writing code, and just because you think it's great doesn't mean they should spend a couple of hours figuring out how the hell it works and adjusting to it... </rant> |
| 18:51 | technomancy | yeah... I should put a note in the readme about how to turn it off |
| 19:52 | LauJensen | For those who like MacSwing, Enlive and Clojure: http://www.dzone.com/links/macswing_meets_enlive_functional_social_webscrapi.html |
| 19:58 | arbscht | LauJensen: have you looked at fnparse? |
| 19:58 | LauJensen | A long time ago, yes |
| 19:59 | tomoj | "Well all that's true of Perl, but people still use that" haha |
| 19:59 | arbscht | I find fnparse alleviates the readability and maintainability issues to some extent |
| 20:00 | LauJensen | arbscht, more so than enlive? |
| 20:00 | LauJensen | tomoj, couldn't help it :) |
| 20:00 | arbscht | LauJensen: no :] |
| 20:01 | LauJensen | I figured :) |
| 20:01 | arbscht | but for those cases where you need regexes, it's nice to have 1.5 problems rather than 2 |
| 20:01 | LauJensen | I was quite impressed with Enlive - Look forward to spending some more time on it |
| 20:01 | LauJensen | arbscht, but you noticed that I totally weed out regex in that post, and use Enlive instead? |
| 20:01 | LauJensen | Finally concluding that regex and perl are the shortcut to getting fired? |
| 20:02 | arbscht | LauJensen: right - but maybe it's worth mentioning fnparse in your post, in passing, so the clojure solution to regular expressions isn't forgotten? |
| 20:03 | LauJensen | arbscht, it's 02:00 here now, so can you hang on while I consider it till tomorrow? :) |
| 20:03 | arbscht | sure thing |
| 20:04 | LauJensen | Great - good night all - Please leave a comment if you liked the post, if you hated it, please email cgrand |
| 20:36 | gilbertleung | hi... i'm a newbie in clojure |
| 20:36 | gilbertleung | could someone explain y |
| 20:37 | gilbertleung | (apply + [ 1 2 3 4 5]) |
| 20:37 | gilbertleung | works |
| 20:37 | gilbertleung | but (apply + (1 2 3 4 5)) |
| 20:37 | gilbertleung | gives me "java.lanag.Integer cannot be cast to clojure.lang.IFn" ? |
| 20:40 | gilbertleung | wait nvm |
| 20:40 | gilbertleung | missing quote |
| 20:43 | ambient | yep |
| 20:44 | ambient | half of the problems can be usually solved by simple rubber ducking ;) |
| 20:44 | ambient | http://c2.com/cgi/wiki?RubberDucking |
| 21:24 | redalastor | I'm strugling with seqs. I'm trying to convert some Python code. I have a list of sudoku square ("A1", "B2", etc...) and a list of units (groups of nine sudo squares). I'm looking for a way to get a map where the keys are the squares and the values are the associated squares. |
| 21:24 | redalastor | There's probably an easy way to do that, but I'm currently confused. |
| 21:26 | arbscht | redalastor: can you link to the python code? (I don't know sudoku) |
| 21:26 | redalastor | Sure, http://norvig.com/sudoku.html |
| 21:27 | redalastor | I'm trying to get "units". |
| 21:30 | redalastor | The dict constructor trick he's using is that he feeds it a list of (key, value) tuples. |
| 21:39 | hiredman | ,(into {} '([s b] [c d])) |
| 21:39 | clojurebot | {s b, c d} |
| 21:39 | hiredman | ,(zipmap '(s c) '(b d)) |
| 21:39 | clojurebot | {c d, s b} |
| 21:40 | rottcodd | ,(apply assoc {} (interleave [:a :b :c] [1 2 3])) |
| 21:40 | clojurebot | {:c 3, :b 2, :a 1} |
| 21:44 | redalastor | Any insight on my sudoku problem? |
| 21:56 | arbscht | redalastor: here's a poor first pass http://gist.github.com/206521 |
| 21:58 | arbscht | I won't even guarantee that's correct yet ;) |
| 21:58 | redalastor | I think it's good, I was mucking with loop/recur and not getting anywhere. |
| 21:58 | briancarper | redalastor: if you use Clojure's `for` you can almost use Norvig's version verbatim. |
| 21:58 | arbscht | well, it's correct as far as units |
| 21:59 | arbscht | right, but there's likely better idioms, especially if you were to use c.c. libs |
| 21:59 | redalastor | briancarper: With a few str thrown in, so that characters and strings will mix. |
| 22:00 | lisppaste8 | briancarper pasted "Sudoku units (lame version)" at http://paste.lisp.org/display/88456 |
| 22:02 | redalastor | briancarper: Yes, very close indeed! |
| 22:04 | arbscht | my peers appears correct, too |
| 22:05 | arbscht | it isn't pretty clojure, though, despite its similitude to the python version |
| 22:06 | redalastor | What would make it prettier clojure? |
| 22:06 | arbscht | I'll have to think about that :) |
| 22:07 | redalastor | The Python version is actually pretty Python. |