#clojure log - Oct 03 2009

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:00 ngoc: (def h (remove (fn [[k v]] (= k :a)) h))

0:00 (h :b) --> java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0)

0:00 hiredman: remove is part of the sequence library

0:30 ngoc: How to cast Integer to int? (class 1) -> java.lang.Integer

0:31 hiredman: are you in a tight inner loop?

0:32 ngoc: No, I want to pass argument to a Java method

0:32 (import '[java.util Timer TimerTask])

0:32 (def timer (Timer.))

0:32 (def task

0:32 (proxy [TimerTask] []

0:32 (run [] (println "hi"))))

0:33 hiredman: I see

0:33 ngoc: (.schedule timer task 1000) -> java.lang.IllegalArgumentException: No matching method found: schedule for class java.util.Timer (NO_SOURCE_FILE:0)

0:33 I think the argument type is incorrect

0:34 hiredman: ngoc: have you looked at the javadoc for Timer?

0:34 .schedule takes a float

0:35 (find-doc "float") or (find-doc "int")

0:36 ngoc: No, it takes a long: void schedule(TimerTask task, long delay)

0:36 hiredman: pardon, I mistyped

0:36 but it does not take an int

0:39 ngoc: Thanks, this works: (.schedule timer task (clojure.core/long 1000))

0:41 hiredman: if you use a scheduledthreadpoolexecutor you don't need to proxy

0:46 ngoc: ah, it take a runnable or callable, thanks

0:49 pjb3: Does anyone know if there is already a function that is like assoc but if the map already has a value for the key it will conj the value onto the exiting value instead of replacing it?

0:49 assoc-conj maybe?

0:50 ngoc: pjb3: I think keys in a map are unique

0:51 pjb3: ngoc: right

0:51 so here's what I want to do

0:51 (def m {:x 1 :y 2})

0:51 hiredman: ,(merge-with conj {:a nil} {:a 1} {:a 2})

0:51 clojurebot: {:a (2 1)}

0:52 pjb3: hiredman: that looks like it, I'll try that

0:52 hiredman: I would look at update-in and merge-with

0:52 there is also assoc-in

0:53 but that is not it

1:10 pjb3: Here's how I implemented that function I mentioned earlier:

1:10 http://gist.github.com/200412

1:12 arbscht: pjb3: must it be a vector?

1:12 pjb3: arbscht: no, I guess not

1:13 arbscht: just in the right order

1:20 Updated with tests: http://gist.github.com/200412

1:20 arbscht: Is there a better way to do this that doesn't use vectors? Should I use a list instead of a vector?

1:37 arbscht: pjb3: no, it depends what you intend to use it for

1:38 pjb3: arbscht: Well, I don't need to access into random elements, so it doesn't need to be a vector

1:38 any sequence would do

1:39 I just wanted it in the order they are added, which is easier with a vector, they end up in the reverse order if you conj on to a list

1:40 arbscht: that's fine

1:58 ngoc: What is "future" form used for?

1:59 kotarak: ngoc: It does things in the background. Threads requiring the result can derefence it. When the future is not finished, they will block. Otherwise they get the result and continue. It's for syncronisation.

2:02 ngoc: kotarak: Can it be used for multithreaded processing?

2:08 kotarak: ngoc: what do you mean be multithreaded processing? Distributing the work on multiple processes?

2:08 eg. like pmap (the parallel map)?

2:18 ngoc: kotarak: Sorry, I think I understand it now: If I save the future to a var, I can take out the result later: (def f (future-call (fn [] (+ 1 2)))), then later @f will become 3

2:20 API doc without example usecase is really hard to understand for newbie

2:21 kotarak: ,(doc future)

2:21 clojurebot: "([& body]); Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block."

2:22 kotarak: Hmm... seems rather clear....

2:22 But maybe, it's just because we know it should mean..

3:26 hiredman: is anyone making snapshot clojure builds available?

4:49 ~ant

4:49 clojurebot: ants is http://clojure.googlegroups.com/web/ants.clj

4:49 hiredman: useless git

5:17 namor: Noob question: How would you `read' from a String?

5:19 hiredman: read-string

5:19 leafw: namor: read from where ?

5:20 namor: I have that String (which I received over a socket), and I want to call 'read' on it, so that I get a data structure.

5:21 But read only accepts Streams...

5:21 yason: namor: (StringReader. yourstring) creates a Java stream

5:22 hiredman: read-string

5:22 seriously, the function is called read-string

5:22 namor: Ok, that's easy. Thanks. (Indeed a noob question...)

5:25 Yay, works.

5:27 hiredman: http://www.thelastcitadel.com/lab/appengine.m4v

5:27 how easy is that

7:36 vy: I plan to host Clojure documentation pages in a wiki, to encourage the collabration and sharing among Clojure users. And, maybe, improvements can be back patched to the official Clojure documentation as well if developers agree on the content. Are there any such projects already done? If I'm not mistaken, there is an unofficially categorized version of Clojure documentation somewhere.

7:47 ambient: no projects that I'm aware of

7:49 the general documentation for clojure is pretty good, imo. it's the API functionality by example that I'd wish there was more of

7:49 especially clojure-contrib

7:50 how to use immutable data structures, parallel programming and functional style for dummies in 24 hours :p

7:50 each of those really should be their own separate book

7:52 hoeck: vy: there is http://en.wikibooks.org/wiki/Clojure_Programming

7:53 ambient: take python for example, you can just say that x=x+1 and that's almost the whole language. 1 core mutable state seems so easy for me to get (might be just because I've done it so much) but twisting the whole mental model to fit clojure requires work. clojure being a lot closer in philosophy of how i think programming should be done </rant>

8:00 LauJensen: nice python tutorial, thx

8:02 ambient: np

8:03 LauJensen: :)

9:25 sgtzx_: LauJensen: not sure if you noticed, but I submitted your brian's functional brain to Reddit

9:25 LauJensen: quite a few clojure fans there, well, theoretically

9:25 LauJensen: sgtzx_, Yea I noticed some 5000 hits coming from there, so I read the comments and noticed you were the initiator

9:26 sgtzx_: 5k? nice

9:27 LauJensen: Yea - In total 8000 people stopped by yesterday, so it's nice that Clojure is drawing so much attention these days

9:27 sgtzx_: indeed!

9:27 LauJensen: og i danmark, er det mange clojure fans?

9:28 LauJensen: Yea I think we're coming up on approximately 6 Clojurians now

9:28 sgtzx_: that's a good start

10:59 jhawk28: has anyone ported the lisp from the Intro to AI to clojure yet?

12:55 duck11231: is there a way to find the set of all the namespaces that are required to be loaded to load a ns?

12:56 got it

12:57 I wanted to look at clojure.org, but that was down, so I remembered ClojureCategorized

13:14 gcv: anyone have any experience using visualvm with Clojure? I can't get it to profile my own code, so I'm wondering if it requires AOT compilation.

13:15 LauJensen: I tried it out 2 days ago, worked fine w/o AOT

13:16 gcv: my classes show up in the heap dump, but not in the profiling results

13:18 duck11231: Is it possible, given a namespace, to modify that namespaces name and try to require the new name?

13:19 I'm trying to find a way to discover all of my test namespaces without resorting to looking for files.

13:20 I've found that if I start my compilation, and then start editing a file in emacs, the srarch for test/**/*.clj method chokes on the emacs autosave files

13:21 hoeck1: duck1123: I've completely disabled auto-saving and auto-backup in emacs for this reason (cluttering dirs)

13:22 duck1123: I have my backups go to ~/.save works great for me

13:22 but I haven't done anything with my auto-saves

13:23 technomancy: hoeck1: you can set it to put all your autosaves/backups within ~/.emacs.d/

13:23 clojurebot: emacs is best configured for Clojure with instructions at http://technomancy.us/126

13:23 duck1123: also, I'm concerned that the testing wouldn't work if the source directory wasn't present

13:24 I played with modifying namespaces before, but I abandoned it in favor of a less evil approach

13:24 hoeck1: technomancy: yeah, could do that, but I never needed autosaves anyway, especially when working on versioned files it makes no sense (to me)

13:25 technomancy: hoeck1: you never need it until you need it. =)

13:25 duck1123: I've had either emacs or the computer crash when I was editing a one off file that was never part of any scm that I hadn't saved in a while

13:26 technomancy: it's nice if you accidentally discard uncommitted changes to the wrong file

13:28 hoeck1: I have the (bad?) habit of pressing C-x C-s every ten seconds or so

13:28 duck1123: I even do it in firefox sometimes

13:29 technomancy: holding down C-n in firefox is more annoying to me.

13:58 gcv: turns out that to get VisualVM to do the right thing, namespaces must have at least two segments, just like the rule for AOT compilation. with a one-segment namespace, it skips instrumenting the generated classes in the JVM

14:02 jo42: question about the add2 example from http://clojure.org/functional_programming

14:02 technomancy: is that a JVM limitation or a Clojure-specific thing?

14:02 jo42: how does z take the value of 4?

14:02 technomancy: (no single-segment namespaces)

14:05 gcv: I can easily run code with a single-namespace from the REPL, but read this: http://groups.google.com/group/clojure/msg/58e3f8e5dfb876c9

14:06 judging by that post, and by VisualVM's (bad) behavior earlier, it seems related to the way the JVM expects to see namespaces

14:06 * gcv shrugs

14:10 gcv: jo42: 4 is the argument to the function on the third line of the example, which was def'd to add2

14:15 LauJensen: Ola mon kotarak

14:15 kotarak: Salut

14:16 LauJensen: I'm working on my blog. :)

14:16 LauJensen: Weee :) Where's it at ?

14:17 kotarak: LauJensen: Currently on my hard disk. Working on the layout. Just a sec

14:17 cschreiner: ,classpath

14:17 clojurebot: java.lang.Exception: Unable to resolve symbol: classpath in this context

14:17 LauJensen: kotarak, Please start with "Why I use Vim and how it's ruined my life" :D

14:18 kotarak: LauJensen: I will start with "Functional programming in Vim and poor man's closures..."

14:18 LauJensen: poor mans ?

14:19 kotarak: LauJensen: well. you have to specify manually the values to close over. But you'll see in my post.

14:19 LauJensen: Can't wait

14:20 kotarak: LauJensen: what do you say for the layout?

14:20 LauJensen: sec

14:21 kotarak: soso, fullrate.dk...

14:21 nz and no were faster ;)

14:22 LauJensen: done loading

14:22 I think it's very nice :)

14:22 jo42: to me it seems as if make-adder [x] takes 1 argument referred to as x, having the value 2

14:22 kotarak: LauJensen: have only 160kbit upstream at the moment...

14:23 LauJensen: Consider wordpress.com ?

14:23 Anyway, lets go priv

14:24 gcv: jo42: correct, make-adder returns a function whose parameter is z

14:25 jo42: ok, i understand now

14:25 thks

14:36 gcv: is clojure.lang.Reflector.invokeMatchingMethod a sure sign of reflection going on? it dominates my profiling results, even though I type-hinted nearly everything *warn-on-reflection* pointed out.

14:38 Chousuke: are you using arrays?

14:39 gcv: you mean Java arrays? no

14:41 chouser: gcv: pretty sure sign, yeah. You're using *warn-on-reflection*?

14:42 gcv: yeah, I loaded the code using *warn-on-reflection*

14:43 chouser: but no warnings? hm.

14:44 gcv: could invokeMatchingMethod be called by something like the instance? function? I do use that for some dispatching, and it happens fairly often

14:45 chouser: you should be able to check the stack trace to invokeMatchMethod to see what's causing it to be called

14:45 with sufficient type hinting, I believe it's possible to avoid all calls to it

14:48 gcv: I'd better figure out why it gets called, then. the code spends more time in that method than it does doing IO, and I fully expected the whole benchmark I'm playing with to be IO-limited.

14:55 Raynes: http://www.google.com/trends?q=Clojure&ctab=0&geo=all&date=all&sort=0 Clojure is certainly skyrocketing.

14:56 technomancy: Rich's speaking schedule is certainly contributing.

14:56 he's making quite the splash

14:56 kotarak: Korean?

14:56 technomancy: that big spike must be the 1.0/book release

14:56 kotarak: wow

14:56 technomancy: either that or the peepcode. =)

15:09 hiredman: http://www.thelastcitadel.com/lab/appengine.m4v

15:59 ambient: i've been thinking lately if I should be using Clojure or F#

15:59 LauJensen: Go with F#

15:59 ambient: platform independence is not such a huge deal for me

16:00 cschreiner: yeah, go with F#

16:00 ambient: im not sure F# has such a good support for concurrency as clojure

16:01 there really aren't that many options for a functional programming language with a great library support

16:02 konr: how can I find out which are the dependencies of a library when they are not on the README?

16:02 LauJensen: ambient... :) We can't make the decision for you, but if you are really torn between the two, something tells me you're not levering the power of Clojure to a very great extent, so maybe F# comes more natural for you.

16:02 ambient: LauJensen I was just wondering if somebody had some experience in both and could provide some insight into the matter

16:03 but even with great experience it's a hard question to answer in a general sense so I digress

16:08 konr check the imports on top of the files

16:16 LauJensen: ambient, how widely is F# used in industry ?

16:17 ambient: none that I'm aware of

16:17 but microsoft is including it as a full language into VS 2010

16:17 hiredman: there was a presentation I saw somewhere (extremely boring) about F# starting to show up in the industry

16:18 LauJensen: Amazing what MS marketing department can do - truely amazing

16:19 First they make Vista, then they inject tons of bloat slowing it to a crawl, then they sell millions of licenses - wait a year or two - strip the bloat, sell it as Windows 7 and make millions again

16:19 somnium: ,(str >=)

16:19 clojurebot: "clojure.core$_GT__EQ___4493@1adff28"

16:20 hiredman: ,(str '>=)

16:20 clojurebot: ">="

16:20 hiredman: ,(name '>=)

16:20 clojurebot: ">="

16:22 somnium: ,(map #(str (quote %)) '(>= = <=))

16:22 clojurebot: ("p1__2375" "p1__2375" "p1__2375")

16:22 somnium: doh

16:22 hiredman: the list is already quoted

16:23 and if you are only doing this on symbols you should use name instead of str

16:23 somnium: if you have an arglist that may contain one of these, how would you filter to get "=" as a str?

16:24 ,(apply str (re-seq #"[A-Z]" (str >=)))

16:24 clojurebot: "GTEQ"

16:24 hiredman: I would call symbol on the string

16:24 somnium: right now doing this, to avoid using a macro just to get to the symbols

16:24 kinda ugly though

16:24 hiredman: ,(filter (partial = (symbol ">")) '(> < = + -))

16:24 clojurebot: (>)

16:28 somnium: partial = curry?

16:29 hiredman: ,(doc partial)

16:29 clojurebot: "([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."

16:44 kanak: Hi I'm trying to use swank-clojure for both sbcl and clojure. I got to the last step, but I don't know what this means: M-- M-x slime clojure

16:44 Can anyone help me? Thanks

16:45 somnium: meta dash, meta x

16:45 LauJensen: or: Alt - Alt x

16:45 kanak: thanks. but what about the space? When i type a space it shows up as a dash

16:46 somnium: alt - enter alt x enter

16:46 arbscht: type "slime" first, it will prompt again for "clojure"

16:46 kanak: woo that works. thank you guys so much :) :)

16:46 arbscht: for convenience, you can define something like this in your emacs init file: (defun slime-clojure () (interactive) (slime 'clojure))

16:47 then you can use M-x slime-clojure

16:47 technomancy: kanak: I'll clarify in the readme.

16:47 kanak: that would be really neat :)

16:47 crios: ambient: have you already read this? : http://www.atalasoft.com/cs/blogs/rickm/archive/2008/03/21/clojure-impressions.aspx

16:48 technomancy: I don't use CL, so I hear about all that stuff secondhand. =)

16:49 crios: ambient: for what matters... http://stackoverflow.com/questions/915145/f-vs-clojure

16:49 "The closest thing to Clojure on .NET platform is IronScheme"

16:49 ambient: so really is a good resource :)

16:50 kanak: another question. so should my (add-to-list 'slime-lisp-implementations '(sbcl ("sbcl"))) line be above or below the (clojure-slime-config) line? I just got a "symbol's value as variable is void: slime-lisp-implementations" error. (it's currently below the clojure-slime-config line)

16:50 arbscht: crios: surely clojure-clr is closer

16:51 LauJensen: arbscht, if not I think Rich needs to have a talk with the good people behind IronScheme :)

16:52 technomancy: kanak: you'll need to put it somewhere that will run after that list is defined... I recommend: (eval-after-load 'slime '(add-to-list [...]))

16:52 once again; that should be in the readme; heh

16:53 kanak: technomancy. thank you so much. it works now :)

17:06 hiredman: flash works on my freebsd machine to the point where I can watch stuff on hulu, but not to the point where I can watch rich's talk on infoq

17:06 technomancy: rich is a good speaker, but not good enough for me to suffer through having flash installed to watch him.

17:11 hiredman: I have a build.xml that will grab the appengine sdk, compojure, clojure, and contrib and generate the skeleton of an appengine clojure project, I have tentatively named it clambango (it was the first thing that popped into me head) but I don't feel right taking that name, any suggestions?

17:14 ambient: gaejure?

17:14 technomancy: please, no more puns on the name clojure. =\

17:14 Chousuke: no more jures, please.

17:14 :P

17:15 ambient: heh

17:15 technomancy: hiredman: take a name from literature or a beverage.

17:15 I recommend Fingolfin or Darjeeling.

17:16 hiredman: Clojure on Cyclotrons

17:16 crios: applejure

17:16 :)

17:16 Chousuke: Apple will sue.

17:16 :P

17:16 crios: lol

17:16 technomancy: http://en.wikipedia.org/wiki/Fingolfin <= extremely badass

17:17 ambient: ganja, it's almost like jure and has google app in it

17:17 hiredman: I saw some eye-pod contact lens cases at target a while back

17:17 technomancy: (especially the last three paragraphs)

17:17 Chousuke: I still remember when I first tried reading the Silmarillion in English. It was a bit too much for me at the time.

17:18 LauJensen: Anybody have some tips on how to do fast 2d painting with Swing?

17:18 technomancy: Chousuke: have you heard Nightfall on Middle Earth?

17:18 Chousuke: I couldn't understand the word "comprehend" ;P

17:18 ambient: LauJensen fast? opengl

17:18 LauJensen: swing

17:18 Chousuke: Later I tried to read it again but it really got a bit boring after the first half ;/

17:19 technomancy: Probably not. :P

17:19 hiredman: the first half?!

17:20 Chousuke: hiredman: yes?

17:20 technomancy: Chousuke: http://en.wikipedia.org/wiki/Nightfall_in_Middle-Earth <= if you like heavier music, it's phenomenal

17:21 ambient: LauJensen then draw everything into a memory buffer which you blit using the fastest method available. i can't really see any faster ways unless it's hardware accelerated

17:21 have done very little java 2d though

17:21 hiredman: Chousuke: I think it got boring a little before then

17:21 Chousuke: hiredman: heh.

17:22 LauJensen: k

17:22 Chousuke: Which reminds me, I still have to read LoTR in English. I've read it twice, but in Finnish :/

17:22 ambient: i think there were some options in java2d that could use some hardware accel

17:22 but they are so crappy that i just used straight opengl

17:24 http://www.gamedev.net/reference/articles/article2418.asp

17:25 technomancy: Chousuke: didn't Tolkien study Finnish? IIRC it was an influence on Quenya

17:25 LauJensen: Thanks.... Maybe I should pick up penumbra again, it is bundled with x-platform dependencies now ?

17:25 Chousuke: technomancy: yeah.

17:27 ambient: LauJensen well if you don't know opengl it would mean learning new stuff. java bufferstrategy might be enough for your purposes. *shrug*

17:27 Chousuke: technomancy: Some Quenyan words are rather amusing to a Finn as a result. For example, the word "amme" which AFAIK means "mother" in Quenya is "bath tub" in Finnish :P

17:27 LauJensen: You're probably right, and since it's for blogging it's best to keep it simple

17:27 I'll let the Tellerman supply the GL version :)

17:27 technomancy: heh

17:27 ambient: Epäharavoitseskentelehdittelemattomimmaistuttelevaisuudellammekaankopashan <- actual finnish word

17:28 crios: ambient: ??

17:28 ambient: crios just taking part into the off-topic Tolkien discussion

17:28 Chousuke: ambient: no Finn can tell you what that actually means though :)

17:29 ambient: you would probably have to write AI program to interpret it

17:29 crios: is that a real Finnish work??

17:29 word

17:29 ambient: yes

17:29 Chousuke: yes and no.

17:29 crios: and what does it mean?

17:30 Chousuke: it's apparently possible to derive such a word using all the possible word derivation facilities Finnish has but it's nonsensical :P

17:30 ambient: Ryypiskentelemättömyydellänsäkään <- this might be even interpreted

17:30 crios: very lispy, in that sense

17:30 ambient: derived from "ryypiskellä"

17:30 Chousuke: technomancy: http://www.saunalahti.fi/~alboin/finn_que.htm :D

17:31 technomancy: wow

17:31 LauJensen: ambient, I think I'll go with what you linked

17:32 ambient: LauJensen yeah haven't tried it but it looks like it makes an hardware accelerated double-buffer, which is completely fine for simple pixel per pixel graphics

17:39 danlei: works in german, too: donauschifffahrtsdampferkapitänsmützenhalterung(... ad lib)

17:39 Chousuke: is that a single word or a compound of multiple words though? :

17:40 danlei: compund ... was the first finnish one a non-compund one?

17:40 Chousuke: yes.

17:40 ambient: it was just a single word

17:40 danlei: *compound

17:40 wow

17:41 Chousuke: its base being the verb "haravoida", which comes from "harava", meanin a rake :P

17:42 danlei: o.O

17:42 impressive language, I must say :)

17:42 Chousuke: but really, it's just trivia. no-one uses words like that. Though they do get fairly complicated at times.

17:42 ambient: haravattomuuksilla = with the absence of any rakes

17:43 danlei: hm, I guess it's an agglutinative language (don't know anything about finnish)

17:43 like turkish perhaps

17:43 Chousuke: yeah

17:44 crios: mmm... the most long Italian word should be: "precipitevolissimevolmente" :)

17:44 ambient: it's a total bitch to stem :s

17:44 * danlei only knows "cornuto" .)

17:44 ambient: porter stemmer for english is so easy :\

17:44 crios: danlei: :D I don't ask as you know it

17:45 danlei: :)

17:45 well, I also know "una penna", but that's not really that impressive I guess ;)

17:45 crios: no, itsn't

17:46 danlei: but italian is on my languages-to-learn-list

17:46 technomancy: Italian is awesome; it's like Latin, but useful.

17:46 and with fewer edge-cases

17:47 danlei: yes

17:47 but my university insists in latin first :)

17:48 crios: well, knowing Latin you can then study French, Italian, Spanish, Portugese ...

17:48 Chousuke: and English :P

17:48 crios: mmm

17:48 hiredman: Esperanto

17:49 danlei: kind of, yes. but esp. french derived quite a bit from latin

17:49 crios: Engish should be born from old German + French languages

17:49 danlei: it's almost an isolating language (spoken) these days

17:50 crios: danlei: French?

17:50 danlei: yes

17:51 for example, you can't really hear the different forms in the singular of regular verbs

17:52 hiredman: I heard frenchs kids either drop the gender from nouns, or use either gender, these days

17:52 danlei: thus, inflection (which ubiquitous was in latin) is almost only visible in the written form (at least for a big part)

17:52 ambient: yet one thing i like about finnish that it is genderless

17:54 crios: English is also genderless... isnt'it?

17:54 Chousuke: but there are many other things that make life hell for anyone trying to learn it. :P

17:54 ambient: crios he/she

17:54 in finnish that is "hän"

17:54 Chousuke: consonant gradation being the worst I suppose.

17:54 danlei: lost it's neuter though

17:55 *its

17:55 Chousuke: heh, in colloquial speech it's actually pretty common to just call everyone and everything with the nonpersonal pronoun :P

17:56 that is, everything is just "it"

17:56 ambient: true

17:56 it's practical

17:56 crios: in French, il / elle

17:56 danlei: in my dialect (of german), we can say "et" (it) for feminine things

17:57 but we have some rests of a dual left, which is quite seldom in german dialects

17:57 Chousuke: another interesting feature is that literary Finnish is basically a constructed language.

17:57 no-one speaks it :)

17:57 hiredman: http://www.languagehat.com/archives/003043.php

17:59 crios: so what language do Finnish peoplo speak?

17:59 [people]

17:59 English?

17:59 ambient: onksul = do you have? when literally that would be "onko sinulla"

17:59 etc..

17:59 depends on location

18:00 crios: Is it similar to Sweden?

18:00 hiredman: I read somewhere that dutch was dying out as a spoken language

18:00 danlei: huh?

18:00 last time I was in holland, I had not the impression :)

18:00 hiredman: something about dutch speakers mostly just speaking english

18:01 Chousuke: crios: we speak spoken Finnish ;)

18:01 danlei: hm

18:02 I mostly was near the belgian border, most people were speaking dutch and french (but almost every young person knows english, more or less)

18:02 Chousuke: crios: the thing is, literary Finnish combines features from several dialects (and apparently some vestigial stuff too), and as a result it doesn't match any spoken dialect.

18:03 ubii: hey folks, just starting to hack around with clojure a bit and was wondering which clojure-based web framework(s) are worth looking at

18:03 somnium: is contemporary finnish literature written using that language?

18:03 arbscht: ubii: try compojure

18:03 crios: Chousuke: I understand - [similar to the "Sardish" language, spoken in Sardinien]

18:04 ubii: arbscht: thx

18:04 ambient: somnium all finnish is written using the literal form, it's just never spoken that way

18:04 Chousuke: somnium: yeah. it's called the "Book language" in Finnish :P

18:05 somnium: interesting, some written japanese uses an archaic form, but most novels are written in more or less colloquial language. I don't know anyone who tries to write English in Elizabethan these days...

18:05 danlei: how about people in television (say in the news). do they use this book language?

18:06 hiredman: ubii: I would check out conjure too

18:06 ~conjure

18:06 clojurebot: It's greek to me.

18:06 Chousuke: somnium: there's actually a national agency that determines what's "proper Finnish" and occasionally tries to promote new words and stuff

18:06 hiredman: clojurebot: useless pile of junk

18:06 clojurebot: excusez-moi

18:06 danlei: s/in/on/

18:06 Chousuke: danlei: not quite

18:07 hiredman: clojurebot: you heard me

18:07 clojurebot: hiredman: I'm just giving you a second chance

18:07 Chousuke: danlei: they use a "relaxed" version of it :P

18:07 danlei: :)

18:07 hiredman: clojurebot: I swear, one of these days...

18:07 clojurebot: I don't understand.

18:08 Chousuke: danlei: sometimes there are people who are overformal and try to "speak like a Book". They just end up sounding creepy.

18:09 somnium: has anyone experimented with ring?

18:09 ubii: not feeling the love from github right now. looks like it is "overcapacity", so will have to wait to look at either compojure or conjure :(

18:09 danlei: Chousuke: where I live, it's a bit similar: because we have a fairly strong dialect (almost lëtzebuergesch), people tend to "hypercorrect", which mostly sounds pretty strange

18:10 crios: BTW: were you aware that some Italian scientist is trying to locate Troy in Finland?

18:10 ubii: hiredman: thx

18:10 crios: http://www.centrostudilaruna.it/felicevincilocationoftroy.html

18:10 somnium: I hope conjure moves toward a unique vision instead of just cloning rails

18:10 technomancy: crios: I guess that would explain how Odysseus got so lost on the way home!

18:10 ubii: somnium: nope, but I am interested in taking a look at ring, as it is similar to rack in the ruby world

18:11 crios: [Chousuke: http://www.ibs.it/ame/book/9781594770524/vinci--felice/the-baltic-origins.html]

18:11 technomancy: crios: also makes the Briton's claim to Trojan ancestry slightly more believable. =)

18:12 hiredman: http://www.thelastcitadel.com/lab/appengine.m4v is a video of my appgengine skeleton project generator thing

18:12 crios: :)

18:12 ambient: i wish they find the first stargate under my city :(

18:12 ubii: having not done much research on the various clojure web frameworks, are most of them MVC-based are any of them more component based like IOWA (ruby) or Seaside (smalltalk)?

18:12 ambient: and then i win in a computer game and get to be part of the expedition

18:13 technomancy: ubii: MVC is a pretty OO-centric mindset

18:15 ubii: ambient: hopefully, unlike Skippy, you can figure out to use Earth as the source point and get the gate to dial the first time

18:16 Chousuke: crios: interesting :)

18:16 crios: well, maybe in Finland they should speak Greek :D

18:16 http://www.philipcoppens.com/troy.html

18:16 Well, time to go

18:16 (bed)

18:16 'night

18:18 ambient: hiredman opening that link just killed my firefox :(

18:18 somnium: I'm working on a component-based system (mostly an odd collection of macros and functions grafted onto compojure at this point). functional style seems very powerful, (-> request (logic) (logic) (db-side-effects) (render)), can store the input, return-value, and source code at any point in the chain

18:19 hiredman: ambient: :(

18:21 recordmydesktop makes an ogv and I used ffmpeg to turn it into a m4v

18:23 ubii: I use IOWA, which is a ruby component-based web framework, because all of the sites that I support run on it, but I also used more traditional MVC-based ruby frameworks, such as rails, merb, and ramaze

18:24 IOWA was written by Avi Bryant who later went on to write Seaside, which is a smalltalk web framework

18:24 somnium: I looked at seaside, I found the obligatory gui to be rather unpleasant

18:24 I guess it might grow on you, I prefer emacs at this point :)

18:25 ubii: now that github is accessible again, it appears that conjure is very rails like and uses a MVC approach

18:25 licoresse: ,(doc pprint)

18:25 clojurebot: "clojure.contrib.pprint/pprint;[[object] [object writer]]; Pretty print object to the optional output writer. If the writer is not provided, print the object to the currently bound value of *out*."

18:27 somnium: I think something like a smalltalk-gui-lite should be embeddable via javascript for a web framework, since capturing source is just wrapping a function. lots of cool development tools are possible.

18:29 ubii: just curious if anyone here has written a production web app, using clojure and one of the clojure-based web frameworks

18:30 if so, what did you use and how well has it stood up in a production environment?

18:30 technomancy: most uses of Clojure so far have not been web-facing to my knowledge

18:31 somnium: I'm still using rails for work... clojure web tools aren't quite mature enough yet

18:31 ubii: the reason why I ask, is that I am looking at the viability of moving away from ruby to something like clojure and wondering if any of the web frameworks are ready for prime time

18:31 ah, well that answers that, thx

18:32 somnium: you could always wrap struts2 :)

18:32 technomancy: consider it an opportunity to blaze a new trail. =)

18:32 ambient: wrap JSF...

18:33 Makoryu: ubii: Even if you're stuck using Java libraries from Clojure, that's still a lot less painful than using Java libraries from Java

18:34 ubii: well, one nice that about clojure is that it provides you the ability to leverage a ton of Java goodness, including I am assuming the ability to run on one of the many robust Java application servers

18:34 s/that/thing/

18:35 hiredman: http://github.com/hiredman/appengine-helper

18:35 you check that out, then ant -buildfile pathtothat/build.xml -Dname=projectname setup

18:36 ambient: quite useful

18:36 hiredman: and it will setup an appengine project in ./projectname/

18:36 ubii: nice

18:36 hiredman: ant runserver will run the developement webserver

18:36 (from inside the project directory)

18:37 my first buid.xml

18:39 ubii: how about clojure itself, how mature is it and what kind of stability and performance should I expect out of it?

18:39 hiredman: compojure doesn't seem to distribute prebuilt jars anywhere

18:39 ubii: also, what type of apps are most of you using clojure for?

18:39 hiredman: so setup rebuilds compojure from source everytime :(

18:40 ambient: ubii i use clojure for prototyping/general purpose

18:41 procedural audio/graphics atm

18:41 somnium: hiredman: did you push to appengine with all of compojure.http without issues? multipart (using commons.fileupload) was causing problems with appengine security environment. (maybe its not now? I don't know)

18:42 hiredman: somnium: ah

18:42 I haven't gotten that far

18:43 ubii: been getting tired of drinking the ruby Kool-Aid lately, so I have been exploring other languages, such as erlang and lisp, which is how I got interested in clojure

18:43 somnium: just using everything but multipart from compojure.http seems to fix it

18:43 technomancy: ubii: you're not the only one. =)

18:47 hiredman: somnium: hmmmm

18:47 somnium: I think clojure has improved my ruby style a lot, its made me very conscious of side effects and mutating values.

18:50 ubii: I am thinking about buying Programming Clojure (http://www.pragprog.com/titles/shcloj/programming-clojure) and was curious if it is worth it or if there are more useful resources on the net, to help me get started

18:50 licoresse: ubii: def. worth it

18:51 but I find the structure of the book a little confusing

18:51 ambient: one could do fine with the resources on the net but the book is ok too

18:51 licoresse: but I only have the digital version

18:52 somnium: if its something I really intend to read carefully I always print it out and put it in a notebook

18:53 sproingie: i just copy it to my kindle

18:53 somnium: this is the clearest free web tutorial I found -> http://java.ociweb.com/mark/clojure/article.html

18:54 sproingie: clojure book reads all right on kindle. font size in code examples never changes tho, and it's pretty small

18:54 licoresse: I only have an iPod, not a printer in our house

18:54 ubii: somnium: sweet, thx for the link

18:54 licoresse: I could use a larger screen though

18:54 sproingie: seems to be the same problem for all tech books on kindle

18:55 ubii: I have a unlimited Safari Library subscription, but unfortunately, the do not yet have the Programming Clojure book

18:56 sproingie: got mine from pragprog.com

18:56 ubii: they did have the PeepCode video on clojure, so I watched that

18:56 sproingie: yep, was thinking about buying both versions from them

18:57 sproingie: they have some nice books. the scala book is very nice.

18:59 ubii: sproingie: yes they do, I bought half a dozen or so books from them, as well as some of their videos

19:00 kanak: (newbie question): When should my variables be surrounded by asterisks: like so *variable*?

19:02 sproingie: it's a convention for dynamically-scoped variables

19:02 or more commonly in clojure, special ones where changing them has some systemwide side-effect

19:04 kanak: sproingie, thank you.

19:05 somnium: how do you reset/clear a namespace?

19:07 something like (doseq [v (ns-map n)] (ns-unmap n v)) ?

19:07 Makoryu: kanak: The reason you're supposed to mark globals that way in Common Lisp is that it has no way of declaring a lexically scoped global

19:07 (Except functions)

19:08 kanak: Makoryu, the variables i create using def in clojure are lexically scoped right (unless i use bindings)?

19:09 somnium: hmm, just wiped out every var in user...

19:09 Makoryu: kanak: Yep.

19:10 kanak: CL's DEFVAR/DEFPARAMETER only work that way for reasons of compatibility with older Lisp dialects. Clojure has no such concerns

19:10 kanak: Makoryu: does this mean that I mark my variables with a ** when I think they might be used with bindings?

19:10 Makoryu: kanak: .....Good question.

19:11 * Makoryu shrugs

19:11 Makoryu: Honestly, no idea

19:11 The only example of bindings that I've seen is... the one on the Clojure site that rebinds str

19:11 kanak: Makoryu: :). When might i want to use dynamic variables?

19:11 Chousuke: if you intend them to be thread-locally bound by the user, use the asterisks

19:17 ubii: what editor or IDE do most of you use for writing clojure code?

19:17 I am assuming emacs or vim

19:18 kanak: I'm using Emacs with swank-clojure

19:18 ambient: emacs, i just started using irc inside it even..

19:19 somnium: slime + paredit beats any ide experience I've ever had

19:19 ambient: i've been wondering about paredit, is it hard to learn and does it replace some of the functionality of slime or does it add on top of it?

19:20 arbscht: emacs, vim, enclojure are popular

19:21 somnium: it just adds utilities, C-k scoops up an s-expression, C-<right> adds the rightmost symbol to an s-expression, C-<left> the opposite

19:21 apparently it can do more, but that makes editing lisp code a breeze already

19:23 ubii: mostly a vim guy myself, but I really should start using emacs more

19:26 ambient: yep, i use vim also most of the time. lisp is just inherently suited for emacs

19:26 Makoryu: ambient: Ever used TextMate? Paredit is basically the bracket matching feature with extra checking

19:27 ambient: nope, don't have a mac

19:27 ubii: is there a clojure bundle for TextMate?

19:29 technomancy: ubii: yeah, but it's not very featureful

19:29 paredit is highly badass

19:30 Makoryu: ubii: I think so, but I wouldn't bother with it. You'd have to struggle with the indentation.

19:30 ubii: ok, thx

19:30 technomancy: ambient: paredit is orthogonal to slime

19:30 you can even use it for JS

19:30 though it's designed for lisp

19:31 ubii: spend most of my time on linux, even though I have a couple of Macs

19:31 ambient: spend most of my time on windows vista, because i have crappy hardware :|

19:32 ubii: ambient: feel for you, I try my best to avoid anything Windows

19:32 Makoryu: ambient: That's *almost* an oxymoron

19:33 ambient: Whatever hardware you've got, Vista is probably the worst way to get any usefulness at all out of it

19:33 somnium: ambient: if your hardware can handle vista surely you could run linux

19:33 ambient: somnium: nope, wireless drivers suck

19:33 somnium: they've gotten a lot better

19:33 santosh: (def mouse

19:33 (fn [a]

19:33 (print a)

19:33 (if (< a 100)

19:33 (recur (+ a 4)))))


19:33 mouse(10)

19:33 somnium: ...

19:33 Makoryu: santosh: LEARN TO PASTE

19:33 santosh: will this work?

19:34 Makoryu : ok ..i will

19:34 Makoryu: santosh: http://gist.github.com/ http://paste.lisp.org/

19:34 Pick one

19:34 santosh: Makoryu : Thanks :)

19:34 somnium: I have a laptop from 2003 and its wireless works with ubuntu

19:35 right out of the box

19:35 ambient: well you're lucky then

19:35 mine disconnects every 2 minutes or so

19:35 somnium: well, I have to plug it into lan during the install, but it finds the drivers automatically

19:35 ubii: ambient, which wireless card do you have and what linux distro(s) have you tried?

19:36 ambient: ubuntu 32 and 64 bits, intel 4965 AGN

19:36 santosh: Makoryu: http://paste.lisp.org/display/88125

19:37 Chousuke: santosh: the function definition will work, but the mouse(10) thing won't :P

19:37 santosh: im just started clojure today ...was trying the pasted example ..but it won't work as expected...

19:37 oh

19:37 ubii: heck, even the wireless support in openbsd is good these days, had no problem getting the wireless card on my thinkpad x61 to work

19:37 santosh: oops ..its still java style call :D

19:37 Chousuke: santosh: also, you should use two spaces for indentation instead of a tab. :)

19:38 and defn instead of def, but that's nitpicking.

19:39 (yes, indentation is more important than your code!)

19:39 ;P

19:43 ubii: ambient: the iwiwifi driver, which supports the 4965AGN is now part of the kernel, as of 2.6.24, so I would think it should work

19:43 ambient: it works. it's just that it's bugged

19:44 which causes random disconnects in short intervals

19:46 somnium: ambient: when was the last time you tried it? ubuntu seems to put a priority on wireless support

19:46 ubii: hmm, my X61 has a 4965AGN REV=0x4 and doesn't see to have any issues

19:47 ambient: somnium: about a week ago

19:48 ubii: I am running Ubuntu 9.04, but it also worked on 8.10 and 8.04

19:51 raek: speaking about a lenovo X61?

19:51 ubii: yep

19:52 raek: I have a X61s

19:52 ubii: ambient: a quick google search indicates that you are not alone, I guess there are several bugs associated with the driver for this card

19:52 ambient: i know

19:53 ubii: raek: how do you like yours, I love mine, though since I work mostly from home, I always have an external keyboard, mouse, and monitor hooked up to it

19:53 I love the keyboards on them

19:54 ambient: maybe I don't use my wireless enough to notice it, since I typically have it connected via Ethernet

19:55 ambient: in any case, hopefully they will resolve the issue soon, because no one should have to suffer Vista if they don't need to

19:56 ambient: they haven't solved in about two years so i don't really expect much

19:56 raek: ubii: I love my thinkpad, except for one thing

19:56 the heat generated by the wifi card

19:57 ubii: yep, it can get a bit warm

19:57 ambient: iwconfig power on, its disabled by default

19:57 raek: when the ac adapter i pluged in, you cannot use its power management

19:57 ambient: is that all?

19:57 ambient: well i can

19:58 it drops the temp to half for me

19:58 ubii: yeah, I think I had to do the same thing

19:58 it helps

19:59 of course, it really isn't much of a factor now, since I am using an external keyboard

19:59 btw, is it a sin to use an Apple keyboard on my X61? :)

19:59 raek: well, apple keyboards are nice..

19:59 kanak: ubii: I'm using the apple mouse with my dell laptop because the touchpad is broken

20:00 raek: if you paint the enter key blue, I guess it's okay...

20:00 ubii: raek: the only thing I dislike about the x61 is that the native resolution is limited to 1024x768

20:01 kanak: raek: I see an enter key, and i want to paint it blue. no colors anymore i want to turn them blue

20:01 ubii: this is why I have it hooked up to a 24" monitor running 1920x1200

20:01 raek: yes, it's limiting to not be able to have two 80 character columns of text beside each other

20:03 ubii: I wish I would had waited until the x200 or the x301 came out, as both have better native resolutions

20:03 oh well

20:03 raek: a friend of mine has the x300

20:03 ambient: i hear the quality in lenovo laptops is dropping

20:03 raek: it's NICE.

20:04 ubii: I will say that the lcd on the X61 is in no way as nice as on my Macbook Pro

20:04 but then again, the MacBook Pro was twice as much

20:05 santosh: Chousuke : Thanks for your help and suggestions

20:06 ubii: guess I will try setting up emacs, slime, and paredit

20:06 later all, thx for the help

20:07 ambient: apt-get install emacs-snapshot-gtk -> install elpa -> package-install clojure-mode -> clojure-install

20:09 ubii: ambient: sweet, thx

20:22 ben_m: Hey there :)

20:22 arbscht: hello

20:23 ben_m: Can anyone recommend a clojure/Java game development library?

20:23 One that doesn't require OpenGL would be great, but at this point, I'd take anything ;)

20:23 kanak: (how do i specify default values in a struct?

20:23 ambient: i dont think there's a clojure game dev lib currently. jmonkeyengine seems to be the most widely used game engine for java

20:24 ben_m: I should've specified 2D :D

20:25 I've tried to use sdljava, but I just can't get it to work.

20:25 UnsatisfiedLinkError stuff :/

20:26 arbscht: ben_m: jgame might be enough for 2D games. lwjgl can also be useful for 2D games using opengl

20:27 ben_m: lwjgl looks pretty good, yeah

20:27 The problem is that my PC has a broken video card and the onboard chip can't handle OpenGL, apparently.

20:27 So I'm looking for non-gl alternatives...

20:27 ambient: opengl does have software rendering options also

20:29 ben_m: So I've heard, but lwjgl refused to do stuff for me, because of opengl.

20:30 hamza: hey guys, is there a range equivalent that will return numbers indefinitly from 1 to infinity?

20:32 hiredman: (iterate inc 0)

20:32 ben_m: hamza: (iterate inc start)

20:33 hamza: thanks.

20:35 drhodes: I've got a macro, it compiles, if I copy and paste the macroexpand-1 output, it works. When the macro is invoked normally it fails. Is that supposed to be possible?

20:36 arbscht: drhodes: paste your code

20:38 drhodes: arbscht: http://paste.lisp.org/display/88129

20:39 it's not trying to do OO btw, just reduce some boilerplate

20:40 hiredman: uh

20:40 it looks like you are making a bunch of symbols prefixed by ":" is there a reason you are doing this?

20:41 drhodes: not particularly

20:41 hiredman: then I would recomend you don't do that

20:42 drhodes: ok, thanks for the tip

20:42 hiredman: drhodes: what is the exception you get?

20:43 I imagine it's something about symbols cannot be cast as keywords or some such

20:43 beccause keywords start with a :

20:43 drhodes: Unable to resolve symbol: ::vcbnm in this context

20:44 but I've tried it a dozen ways from friday. ok. I'll go with taking those out and trying some more, thanks guys.

20:44 somnium: but copy and paste works ? reader is probably creating (keyword :vcbnm) when you paste

20:45 drhodes: ok :)

20:45 hiredman: drhodes: my guess is macroexpand prints out a bunch of symbols that start with : and when you paste that into clojure, it reads them as keywords

20:45 drhodes: I don't enough about the reader.

20:45 hiredman: keywords and symbols are different

20:45 ,:x

20:45 clojurebot: :x

20:45 hiredman: ,::X

20:45 clojurebot: :sandbox/X

20:46 hiredman: ,x

20:46 clojurebot: java.lang.Exception: Unable to resolve symbol: x in this context

20:46 hiredman: .'x

20:46 er

20:47 raek: ,':x

20:47 clojurebot: :x

20:47 raek: :x

20:47 ,:x

20:47 clojurebot: :x

20:47 hiredman: that is a quote keyword

20:47 quoted

20:48 raek: ,(class :x)

20:48 clojurebot: clojure.lang.Keyword

20:48 raek: ,(class ':x)

20:48 clojurebot: clojure.lang.Keyword

20:48 hiredman: keywords are sort of self quoting

20:50 somnium: drhodes: key thing is at end of macro expansion datastructures are fed right to the compiler

20:50 ,(read-string "[::foo ::bar]")

20:50 clojurebot: [:sandbox/foo :sandbox/bar]

20:56 somnium: are double colons some kind of reader-macro?

20:57 ,(list (keyword ":foo") :foo ::foo)

20:57 clojurebot: (::foo :foo :sandbox/foo)

20:58 hiredman: double colons qualify the keyword in the current namespace

20:58 also if you have an alias for a namespace setup double colons resolve keywords in those

20:58 ,(require '[clojure.zip :as zip])

20:58 clojurebot: nil

20:58 hiredman: ,:zip/foo

20:58 clojurebot: :zip/foo

20:59 hiredman: ,::zip/foo

20:59 clojurebot: :clojure.zip/foo

20:59 somnium: cool

21:06 ,(symbol "foo" (str (ns-name *ns*)))

21:06 clojurebot: foo/sandbox

21:07 somnium: is there a similar way to qualify a symbol?

21:08 ,(symbol "foo" (ns-name *ns*))

21:08 clojurebot: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String

21:09 hiredman: ,(resolve 'foo)

21:09 clojurebot: nil

21:09 hiredman: bah

21:12 santosh: (def hello (print "hello"))

21:16 somnium: ,(+ 2 2)

21:16 clojurebot: 4

21:17 somnium: I thought he used to do something else

21:21 chouser: , 1foo

21:21 clojurebot: Invalid number: 1foo

21:21 chouser: , `foo

21:21 clojurebot: sandbox/foo

21:21 somnium: ah, so its not just for macros

21:24 hiredman: (+ 2 2)

21:24 clojurebot: 4

21:24 hiredman: (+ 2 3)

21:24 clojurebot: *suffusion of yellow*

21:26 drhodes: Great! it works, keywords are not symbols, thanks helpful clojure chan :]

21:27 somnium: drhodes: out of curiosity, what was it for?

21:28 drhodes: well this started in python as a code generation scheme, built a parser for custom architecture modeling language (yuk yuk yuk)

21:29 but macros preclude the need of 2/3 of all that.

Logging service provided by n01se.net