#clojure log - Sep 10 2009

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

4:06 LauJensen: Top of the morning gents

4:06 AWizzArd: Moin Lau

4:06 Guys, I must be blind. How/Where can I open a new ticket on https://www.assembla.com/spaces/clojure-contrib/ ?

4:09 cgrand: AWizzArd: tickets -> new ticket. Are you logged in?

4:09 AWizzArd: I am logged in, and I am a watcher.

4:10 But I don't have the "new ticket" button

4:11 liwp: AWizzArd: I think you have to be a member to add a new ticket

4:11 AWizzArd: rich needs to add you as one

4:11 I can open one for you if you like

4:11 AWizzArd: Okay, I see.

4:11 stuartsierra asked me to open two tickets, but so far I couldn't do it

4:12 liwp: one is about a potential bug in clojure.contrib.profile.

4:12 When you have (defn foo [x] (prof :foo (+ x 10))) and then do (profile (map foo (range 5))) ==> java.lang.IllegalArgumentException: Wrong number of args passed to: core$max

4:13 but profiling a doseq works fine

4:13 liwp: ok...

4:13 I've never used profile myself

4:14 AWizzArd: Another problem is in clojure.contrib.duck-streams, with append-spit. I start appending with the *default-encoding* bound to "UnicodeLittle" (can be something else also). This format has a marker at the beginning of the file.

4:14 The problem is: when I append-spit to that file again, then again this marker is written

4:14 append-spit must only write it once, when the file is created for the first time.

4:15 liwp: ok

4:15 AWizzArd: those are the two

4:15 liwp: can you write up the issue and provide a test case of some kind, PM them to me and I'll open the tickets

4:15 AWizzArd: yes

4:16 liwp: and include your name so I can attribute the issues to you

5:47 tomoj: how do you test macros?

5:49 mccraig: ,(doc macroexpand-1)

5:49 clojurebot: "([form]); If form represents a macro form, returns its expansion, else returns form."

5:49 tomoj: I guess one level is enough for testing

5:49 yeah, otherwise it would get crazy

5:50 mccraig: (,doc macroexpand)

5:51 oops

5:51 ,(doc macroexpand)

5:51 clojurebot: "([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms."

5:51 liwp: mccraig: is there any way to expand e.g. cond which has a cond subform in it?

5:51 tomoj: liwp: c.c.macro-utils

5:52 mexpand-all

5:52 liwp: tomoj: and that _will_ expand subforms?

5:52 tomoj: yep

5:53 ,(require 'clojure.contrib.macro-utils)

5:54 clojurebot: nil

5:54 tomoj: ,(clojure.contrib.macro-utils/mexpand-all '(cond t 3 :else 4))

5:54 clojurebot: (if t 3 (if :else 4 nil))

5:54 liwp: ahh, seems like slime-macroexpand-all does exactly what I want after all. I don't know how I missed that earlier

5:54 tomoj: does slime-macroexpand-all use mexpand-all, I wonder?

5:55 ,(macroexpand '(cond t 3 :else 4))

5:55 clojurebot: (if t 3 (clojure.core/cond :else 4))

5:55 tomoj: maybe it does the recursion itself

5:56 liwp: I think I must have tried macroexpand-1 and macroexpand and then decided that one cannot expand the subforms

5:56 tomoj: I think it'll call macroexpand repeatedly unitl the form does not change

5:56 or something

5:56 tomoj: that won't help

5:57 that's pretty much what macroexpand does itself

5:57 ,(macroexpand '(if t 3 (clojure.core/cond :else 4)))

5:57 clojurebot: (if t 3 (clojure.core/cond :else 4))

5:58 liwp: true

5:59 there doesn't seem to be anything related to macroexpansion in swank-clojure...

6:00 tomoj: I think the one from regular old swank works just fine

6:00 since we have macroexpand and macroexpand-1

6:01 liwp: i'm just confused how it expands the subforms then

6:01 tomoj: I don't really know how swank works

6:02 liwp: hmm

6:03 tomoj: slime-macroexpand-all doesn't work for me

6:03 it expands (cond 1 3 2 7) to (if 1 3 (cond 2 7))

6:04 liwp: I get: (if 1 2 (if 3 4 nil))

6:04 tomoj: weird

6:04 maybe different swank-clojure versions..?

6:04 liwp: possibly

6:04 tomoj: or different slime setups, or I dunno what the hell else

6:04 slime/swank is a mystery to me

6:05 liwp: to most people I would expect ;)

6:06 tomoj: I see something in swank-clojure

6:06 but it says "not implemented yet, needs walker" for me

6:06 liwp: I think my swank-clojure is from a checkout made on april 17th

6:06 which function is that?

6:07 tomoj: in swank/commands/basic.clj, there's a (defslimefn swank-macroexpand-all ...)

6:07 liwp: ahh, I just searched the *.el files!

6:08 tomoj: and some code in swank/clj_contrib/macroexpand.clj

6:08 liwp: I have the same comment in basic.clj

6:09 The body is (apply-macro-expander macroexpand-all string)

6:10 it seems to rely on some code from contrib. Is that code included in swank-clojure or does it expect you to have contrib in your swank classpath?

6:11 AFAICT macroexpand.clj tries to load clojure/contrib/walk.clj and if that succeeds it sets walk-enabled? to true

6:12 so do you have contrib in your classpath? That might expains why it's not working for you

6:14 tomoj: I have contrib, but no walk.clj

6:15 ah, walk.clj has moved into core

6:16 so I have it, but swank-clojure thinks I don't because it's looking in the wrong place

6:16 liwp: I probably then have a somewhat old clojure / contrib checkout

6:16 clojurebot: clojure is cheating

6:16 tomoj: just like clojure-test-mode doesn't work because it still uses clojure.contrib.test-is

6:16 (which is now clojure.test)

6:16 liwp: try updating swank-clojure

6:16 or maybe you tried that already

6:16 tomoj: yeah, when I last checked they hadn't fixed it

6:16 but that one was an easy fix

6:17 this one looks to be too, just gotta change the path

6:17 liwp: yep

7:13 AWizzArd: cgrand: do you remember the bug I found on August 27? StringSeq is counted but doesn't implement count().

7:15 rhickey: AWizzArd: fixed - http://www.assembla.com/spaces/clojure/tickets/186

7:16 AWizzArd: rhickey: good, thanks

7:16 rhickey: thanks cgrand

7:16 and chouser

7:16 AWizzArd: Thank you, you two *handshaking*

7:18 rhickey: btw, as a watcher one can't open new tickets on assembla right? stuartsierra asked me to open two of them, but I can't do it. (liwp offered to submit them for me, and I already forwarded a mail to him)

7:18 rhickey: AWizzArd: sure you can, use the Support tab

7:19 AWizzArd: I see several links and buttons there, but they don't look like "Open new ticket". Maybe I am just blind...

7:23 rhickey: AWizzArd: you are a watcher?

7:26 AWizzArd: ah, I see contrib was not set up same as core, try now, you should see big New Ticket button

7:31 AWizzArd: rhickey: yes, now there is this button

7:31 thanks

7:33 liwp: AWizzArd: I got your email but I haven't submitted the defect yet. Do you want to do it yourself, if that's possible now?

7:48 AWizzArd: It's possible. Okay, then I submit it myself. Thanks liwp.

7:52 liwp: AWizzArd: ok.

8:16 fsodomka: hello!

8:17 I have been wondering about handling nil value...

8:17 lisppaste8: fsodomka pasted "Handling nil value" at http://paste.lisp.org/display/86860

8:18 fsodomka: is there any improvement possible in these cases?

8:18 something like adding error messages etc. ?

8:20 Chousuke: I think checking for nils would incur a performance penalty

8:20 fsodomka: yes, that's what I thought...

8:20 Chousuke: the JVM doesn't do it, so I don't think Clojure should :)

8:22 Fossi: do you think it's possible to check the types of things as kind of a post-compile task?

8:23 Chousuke: well, Clojure being dynamic there's not much it can do.

8:23 though, the Compiler at the moment does not even try :)

8:24 Fossi: i mean if you make take type hints serious, it should be possible to infer them as far as possible

8:24 and warn when they aren't any

8:24 fsodomka: so it looks that we can check only for direct nil - and that case isn't all that interesting :-)

8:24 Chousuke: I suppose no-one is interested in hacking the Java compiler.

8:25 it needs to be rewritten in Clojure first

8:26 Fossi: can't you do the checking while you walk the source anyway?

8:26 hiredman: ~deft

8:26 clojurebot: deft is http://gist.github.com/128259

8:27 Chousuke: I don't think the type hints should be considered anything more than what they are: a way to avoid reflection.

8:28 Fossi: well, left aside the debate about usefulness of static typing i'd like to be able to shut up people who bitch about how scala and haskell are so much superiour because of their static typing

8:29 Chousuke: And then you can just walk away and write some working code while they fight with the compiler

8:29 Fossi: :D

8:30 the deft looks like a good example of how it might work and also how painful it would be, thanks :)

8:37 fsodomka: ok, thanks for discussion!

8:40 AWizzArd: Fossi: it is possible to statically check Clojure code in principle.

8:40 Chousuke: except if you allow runtime modification. :/

8:40 AWizzArd: true

8:41 Fossi: that's what i expected, just that nobody who has ever used lisp cares about it a lot ;)

8:41 AWizzArd: If you want a statically checked program then your program may not be modified at runtime.

8:41 Chousuke: I think Common Lisp compilers do quite a lot of static type checking

8:41 Fossi: well, you can't type check dynamic modifications to java code either

8:43 AWizzArd: Chousuke: sbcl can do some, but it is very far from doing what is possible.

8:44 Fossi: but i guess type infering could still be better than the deft things

8:44 Chousuke: But if Clojure gets static type checking at some point I imagine it would have to be done so that you can't actually *require* that the types match. That would lead to the kind of inflexible type hierarchies that Clojure tries to avoid

8:44 Fossi: would result in a more scala way of typing as opposed to having to add the type all over the place

8:44 hiredman: defintely

8:45 Fossi: could still be an option

8:45 i mean if people must...

8:45 hiredman: deft was just me exploring, and I don't know anything about type systems

8:45 Fossi: neither do i ;)

8:46 AWizzArd: Chousuke: only optional static typing

8:46 Chouser: the thing is, if a type system isn't completely optional, it's just a matter of time before it forces you to solve your problem in a less natural (and therefore harder to understand, maintain, etc.) way.

8:47 AWizzArd: Yes, it should be fully optional.

8:47 I want to remind interested people of http://groups.google.com/group/clojure/browse_frm/thread/7a48f48e4b197a15

8:48 liwp: Erlang has some sort of type checker thingy (the name escapes me now - analyzer?) that looks at type annotations and warns you of possible type errors

8:48 AWizzArd: liwp: the Erlang Dyalizer

8:48 It is also mentioned in the GG post.

8:48 liwp: it's a static analyser that's run against the source independently of compilation

8:48 Chouser: and in an attempt to avoid that without actually making the type system option, you end up with more and more complex type systems that take more and more time to create, understand, and use.

8:48 liwp: AWizzArd: yeah, that's it

8:48 Fossi: yeah. i toyed around with it a year or such ago

8:48 works pretty well

8:49 AWizzArd: Chouser: yes, it can become complex.

8:49 Fossi: still, some people like that

8:49 AWizzArd: It can help to eliminate many bugs.

8:50 If it is completely optional, then nothing needs to be changed in any Clojure program.

8:50 But when Clojures core and Contrib get completely type hinted, then lots of information will be already there.

8:51 One way may be: implement this functionality in FindBugs.

8:51 It already can do very good analyses, and it could be extended to also use Clojures meta data.

8:52 Chouser: I've not used a language with a fully optional static type system -- dunno how that work or feel. Maybe I should learn Erlang.

8:52 AWizzArd: Chouser: you can code as you do it now. Your editor would be connected with the type engine and get feedback.

8:53 For example, you write (def x 10). Then your editor can ask the type engine for the type of x. It will suggest int. Then your editor can either add the meta data for you (and show/hide it via code folding, depending on your preferences).

8:53 Or the editor could offer a button: static analyses, and then show you all cases.

8:53 Chouser: ick

8:54 AWizzArd: Chouser: try FindBugs.

8:54 I used it already to find several unused vars in Clojure :)

8:54 Enclojure could be connected to FindBugs via a plugin. Same with emacs or vimclojure, etc.

8:54 rhickey: I want runtime types like GoodCustomer, LateTrain etc - that's where the semantics of the program lie

8:55 liwp: ~google FindBugs

8:55 clojurebot: First, out of 139000 results is:

8:55 FindBugs™ - Find Bugs in Java Programs

8:55 http://findbugs.sourceforge.net/

8:55 AWizzArd: rhickey: a declerative mechanism would be needed to declare some types.

8:56 For example, a good customer could be a StructMap that has the two keys :name and :money, and where name is a string and money an integer greater than 1000

8:56 So, a declerative mechanism that allows the developer to describe what is in her collections.

8:57 rhickey: AWizzArd: I'd want full runtime predicate logic

8:57 overlapping taxonomies

8:57 implication

8:57 AWizzArd: maybe by connecting the meta data with Drools?

8:58 I made already some progress, i hope in the coming weeks my lib will be ready.

8:58 rhickey: rule engines are much closer to what people really need than are typical static type systems

8:59 AWizzArd: They are indeed very helpful. And as I said, I made some progress. I just don't have so much freetime at the moment, but soon I hope I can publish the lib.

8:59 Then we can use (defrule ...) and friends in our Clojure code.

9:06 LauJensen: AWizzArd: Got your code Gitted some where?

9:07 AWizzArd: Not yet, but soon it will be available. (via hg *g*)

9:08 LauJensen: k, then nevermind :)

9:08 AWizzArd: heh

9:13 Fossi: AWizzArd: why drools and not a port of something lispy?

9:13 AWizzArd: Drools is the engine which will do the rule checking. The language how we Clojure users interact with it is: Clojure.

9:14 Can't get more lispy than that :)

9:14 Fossi: but you can feel free to add support for Jess for example. It just is not so usable for most people, because they don't have the tens of thousands of dollars with which they could buy a license.

9:15 And also Drools seems to be better than most alternatives and can even compete performance-wise with commercial solutions.

9:15 Fossi: just wondering :)

9:15 didn't even know it

9:16 AWizzArd: stuartsierra: Today rhickey changed the options in assembla so that I could open the two new tickets for Clojure Contrib, as you requested.

9:16 stuartsierra: thanks

9:16 AWizzArd: Fossi: for us it will look completely like a Clojure program.

12:08 cemerick: 148 people in here now... soon we'll be back at the state we had in January.

12:08 manic12: how does one ask clojure repl what the java classpath is

12:08 AWizzArd: (System/getProperty "java.class.path")

12:09 Chouser: every classloader has its own classpath, however.

12:09 cemerick: AWizzArd: yeah, I suppose. Of course, you know I'm pretty unconcerned about numbers above "critical mass".

12:09 (which I think clojure has been above for some time

12:10 technomancy: speaking of classloaders, is there anything about the one returned by (.getContextClassLoader (Thread/currentThread)) that would prevent it from working with the Maven Embedder via plexus?

12:10 AWizzArd: Btw, is it possible to let Java GC some classes, and/or unload things?

12:11 manic12: ok, thanks, I found my jar file on the classpath

12:11 how do I access the classes in that jar file?

12:11 liwp: AWizzArd: I think that can only happen if the class loader that loaded the class is discarded

12:12 AWizzArd: I'm not sure how the mechanics of it work

12:13 manic12: huh? You mean how do instantiate one of the classes or how you access the byte code? or something else?

12:13 AWizzArd: I just have the requirements to generate a parser while my program is running. fnparse sounds like a good way, but will be very slow.

12:13 manic12: I would like to instantiate one of the classes

12:14 liwp: AWizzArd: so you'd like the parser to be unloaded after you don't need it any more?

12:14 AWizzArd: One other idea is that my program could output an input file for JavaCC. Then my program calls javac and compiles JavaCCs output, and loads it and can then use it.

12:14 liwp: manic12: (foo.bar.Baz. <args>)

12:14 AWizzArd: liwp: yes, like that.

12:14 liwp: if the jar is in your classpath, then you can just call new on it

12:14 which is what the above clojure code does

12:15 AWizzArd: I would say that it's not worth the effort

12:15 manic12: where foo.bar.baz is the package specified in the java file which created the class that went into the jar?

12:15 liwp: manic12: yep

12:15 Chouser: manic12: yes, and it must also match the path to the .class file within the jar

12:16 manic12: so the jar should contain a file foo/bar/Baz.class

12:16 manic12: that class should have been generated by a .jara file that starts with "package foo.bar" and has "class Baz { ..."

12:16 .java file

12:17 liwp: AWizzArd: IIRC in clojure each function gets loaded in with its own class loader so that the function can be garbage collected if it is no longer referenced by the clojure environment

12:17 Chouser: and the jar itself must appear on your classpath (not just the directory that contains the jar)

12:18 liwp: AWizzArd: there were some problems at some point with code that generated a lot closures and those were not GC'd properly and that was somehow related to classloaders

12:18 manic12: ok, so I'm sticking these java files in the wrong directory for their corresponding package name?

12:18 stuartsierra: liwp: that's mostly been fixed, I think

12:19 liwp: stuartsierra: yeah I think so too

12:19 AWizzArd: I should ask on the mailing list about ideas regarding my parser. Maybe there is a trick how to cope with dynamic grammars.

12:21 liwp: AWizzArd: maybe you can use a parsing framework that allows you to generate a parse at runtime and you just discard that parser once you're done with it. You'll keep the parser generator classes in memory, but the parser instantiation will be GC'd

12:22 I don't know if such frameoworks exist though

12:23 AWizzArd: liwp: the clojure lib "fnparse" can do this. That is a parser combinator.

12:23 liwp: AWizzArd: you said above that it would be slow, have you tried it?

12:24 AWizzArd: I have tried it.

12:24 but currently slow is better than a non-available feature :)

12:25 liwp: hehee

12:25 I guess a Java parser generator would generate a class file for you, which would result in the exact problem that you were trying to avoid...

12:33 AWizzArd: liwp: would be no problem: I just load the class file, when it is not needed anymore i delete it, and let javacc generate another .class file for me (a newer, updated version).

12:33 got to go

12:56 tomoj: AWizzArd: know of a guide for fnparse for dummies?

12:56 I tried reading the docs and become immensely confused

12:59 liwp: tomoj: you might want to look at some parsec tutorials. Parsec is a parser combinator library in haskell, but I think the concepts should translate well from haskell to clojure

13:00 tomoj: liwp: thanks, will investigate

13:02 lisppaste8: drewr pasted "print-dup bug?" at http://paste.lisp.org/display/86882

13:02 drewr: am I doing something wrong there?

13:05 hiredman: clojurebot: ticket #176

13:05 clojurebot: {:url http://tinyurl.com/m253vo, :summary "structs printed with *print-dup* true cannot be read", :status :new, :priority :normal, :created-on "2009-08-18T16:11:11+00:00"}

13:06 drewr: bummer

13:18 LauJensen: ~def sort

13:27 travisbrady: i'm trying to follow these examples, how do I verify that I've actually connected?

13:32 oh gosh, *these* examples http://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples

13:36 LauJensen: travisbrady: get this and run the demo for whatever DB you're on

13:36 ~clojureql

13:36 clojurebot: clojureql is http://gitorious.org/clojureql

13:37 hiredman: :/ assembla will let you get a specific ticket (by number) without having to login, but not a list of all the tickets for a space

13:55 travisbrady: LauJensen: thanks, I'll check that out

13:55 LauJensen: k

14:00 (defn qsort [coll] (when-let [[x & xs] (seq coll)] (concat (qsort (filter #(< x %) xs)) [x] (qsort (filter #(>= x %) xs)))))

14:00 rhickey: Thats a quicksort (which I didn't write), and like so many other things it will quickly blow the stack. Is there any hope that one day the Clojure compiler will automatically handle its ressources in a way which prevents stack explosions?

14:01 travisbrady: how does one simply run a .clj file? I'm currently doing "java -cp $VIM_CLOJURE_CP:vertica_3.0_jdk_5.jar clojure.lang.Repl vclj_test.clj" but it drops me in the Repl when I'm done

14:02 Draggor: Is there a working example of gen-class somewhere? What's currently on clojure.org comes up with errors.

14:02 hiredman: :|

14:02 clojure.main

14:02 Draggor: if it doesn't work you are doing something wrong

14:03 technomancy: LauJensen: we're waiting on the JVM handling that; clojure's compiler will not.

14:03 LauJensen: Ok

14:03 hiredman: http://gist.github.com/179346 is a gen-calss test script

14:06 travisbrady: hiredman: thank you

14:06 dnolen: LauJensen: for what's it that implementation of qsort will definitely blow the stack on every lisp that I know of.

14:06 for what it's worth

14:07 LauJensen: I know, I was just hoping for Rich to mastermind our way out of that situation

14:07 travisbrady: Would using an IDE ease my introduction to clojure? I'm looking to be able to easily build distributable internal (mostly database) applications

14:08 hiredman: poorly executed algorithms will always behave poorly

14:08 dnolen: LauJensen: haha, you should just look for an iterative implementation of qsort.

14:08 LauJensen: dnolen: why? My desire is for nice looking elegant code to work, and not force me into a situation where I need to rewrite everything pretty to something ugly because of the stack

14:09 dnolen: LauJensen: except your implementation clearly shows that you want to blow the stack ;)

14:13 Licenser: I think from the readability point of view it is a very nice implementation of quicksort

14:13 cgrand: dnolen: maybe a smart enough compiler could optimize it as (throw (StackOverflowException.))?

14:16 LauJensen: dnolen: Its not that I want to blow the stack, but its a beautiful example of clear lisp code, which anybody can read and deduct that it's a quicksort. It should work!

14:18 a5t3r1x: is there a way to pick up the automagically fill up the doc string in with-command-line as indicated here?

14:19 is there a way to automagically fill up the doc string in with-command-line as indicated here?

14:19 http://pastebin.ca/1561292

14:19 LauJensen: fill up ?

14:19 aah I get it

14:20 a5t3r1x: LauJensen: sorry typos!

14:21 LauJensen: (def

14:21 #^{:arglists '([coll])

14:21 :tag clojure.lang.ISeq

14:21 :doc "Returns a seq of the items after the first. Calls seq on its

14:21 argument. If there are no more items, returns nil."}

14:21 next (fn next [x] (. clojure.lang.RT (next x))))

14:21 oops

14:21 dnolen: cgrand: interesting idea, would have to be a smart compiler :) seems like it would have to preserve the stack, serialize it, store that somewhere, and continue. or something. seems like it might be difficult to make that fast as well.

14:22 LauJensen: ~def first

14:22 Check that out a5t3r1x

14:22 travisbrady: is there a Repl command ala ghci's :type?

14:23 dnolen: travisbrady: does that return the type of something?

14:24 travisbrady: dnolen: yes

14:24 dnolen: ,(type 1)

14:24 clojurebot: java.lang.Integer

14:24 dnolen: ,(type #^{type:'my-type} {:foo 'bar})

14:24 clojurebot: Invalid token: type:

14:25 dnolen: oops

14:25 ,(type #^{:type 'my-type} {:foo 'bar})

14:25 clojurebot: my-type

14:25 dnolen: too much javascript recently.

14:26 travisbrady: dnolen: thank you

14:26 dnolen: np

14:26 travisbrady: what's the idiomatic way to iterate over a map?

14:26 a5t3r1x: LauJensen: confused

14:27 LauJensen: a5t3r1x: What confuses you young man ?

14:27 cgrand: travisbrady: seq on a map returns a sequence of key-value pairs

14:29 ,(filter (fn [[k v]] (odd? v)) {:a 1 :b 2 :c 3})

14:29 clojurebot: ([:a 1] [:c 3])

14:29 a5t3r1x: LauJensen: it doesn't still tell me how I can access the ":doc" string defined at the namespace level for the script/module

14:30 LauJensen: a5t3r1x: The doc string in that case, is meta data, lookup meta and with-meta

14:30 ,(meta #^{:doc "foo"} {:a 1})

14:30 clojurebot: {:doc "foo"}

14:31 travisbrady: cgrand: ok, say for instance I had the map [:a 8 :b 9] and I just want to print to the screen one row for each kv pair in the format "Key: a, Value: 8"

14:33 cgrand: ,(doseq [[k v] {:a 8 :b 9}] (println "Key:" (name k) "Value:" v))

14:33 clojurebot: Key: a Value: 8 Key: b Value: 9

14:35 a5t3r1x: LauJensen: to get the meta info on an object, I can use (meta <object>), but lets say I've a file called Dummy.clj and if it has meta info at the top like this - http://tinyurl.com/p7lg2g, how do I access that?

14:36 Chousuke: (meta (find-ns 'nsname))

14:37 LauJensen: What he said

14:39 a5t3r1x: Chousuke: thanks

15:00 jbell: please could someone run me through an effective way to find out how to do the following with any available clojure documentation? I'd like to take every other item in a list and do something with all of those items. I'm currently just looking through the huge list of core functions, but I expect there's a better way?

15:01 dnolen: jbell: you could partition the list and map over that taking the first or second item.

15:01 clojurebot: map is *LAZY*

15:01 technomancy: jbell: (def t (atom false)) (map action (filter (fn [_] (swap! not t) @t) coll))

15:02 dnolen: , (map first (partition 2 (range 10)))

15:02 clojurebot: (0 2 4 6 8)

15:02 technomancy: you'd want to use let instead of def for the atom actually

15:03 jbell: that's a good version dnolen

15:03 thanks

15:03 I'm just working the other out

15:03 technomancy: yeah partition is probably better

15:04 konr: I'm studying Software Engineering this semester, using bread-and-butter Java and OO. I want to study how FP and Clojure can fit in this world. Can you recommend me some books/resources on the subject?

15:04 jbell: there are video lectures for people coming from Java on blip.tv

15:06 dnolen: konr: also you can't go wrong with Programming Clojure, http://www.pragprog.com/titles/shcloj

15:09 * hiredman just bought volume 1 of the art of computer programming for $3 at goodwill

15:10 jbell: lol, I bought the strings one from a library for about 50p

15:10 ~$1

15:10 clojurebot: excusez-moi

15:11 jbell: vol 3 sorting and searching

15:12 hiredman: nice

15:13 konr: dnolen: Well, I'm already using clojure in a personal project and reading this book, which is great... I'm interested, however, in modeling software outside the OO view. My Software Engineering material seems to be closely tied to this paradigm, and I'm wondering if there are alternatives...

15:14 jbell: hiredman: how do you know where all the functions are in clojure? do you just work through learning them from the clojure website?

15:15 hiredman: went through euler stuff up to around problem #20, which was nice for kind of familarizing myself with the sequence library

15:15 I still am often surprised by the existence of a function

15:18 fyuryu: jbell: reading core.clj is a good way to learn

15:21 Draggor: Whelp, got the basics of gen-class working. What I can't quite figure out is the following: I just want to have a constructor that calls a protected method from the parent class in it, and that constructor takes one string argument.

15:23 jbell: hiredman: in Java, I know where to look: if I don't know a library/package name I search on google -- like say regex -- and then there's either a trail to kick start or if I'm already a bit familiar I know everything's ordered into objects so I can just look at the Javadoc, which then provides examples etc. which is quite productive, because it's very task-focused...

15:26 hiredman: jbell: clojure.org

15:27 jbell: lol, no... although I think clojure.org is great, it's not like that: there isn't cross-referencing, for example

15:27 hiredman: *shrug*

15:27 jbell: well, linked cross-referencing on the long list of api functions

15:28 dnolen: jbell: it seems daunting at first. But really you only use a handful of functions. also 90% of the time if something seems like it would be useful, it exists. and lastly, there's almost always someone here who knows something.

15:29 jbell: this is also useful, http://java.ociweb.com/mark/clojure/ClojureCategorized.html

15:31 tmountain: +1 for clojure categorized, I use it whenever I'm trying to track down a specific type of function

15:32 there's also the clojure cheat sheet, which is great - http://tinyurl.com/qcxmrw

15:32 ambient: what's a good way to refer to the project root? i need to read resource files from res/ but don't know what the default path is?

15:32 Draggor: Anyone avialable to help with gen-class?

15:32 jbell: thanks dnolen and tmountain, I'm just looking

15:35 yeah, I saw that cheat sheet, but there's still a big void between me seeing many of the words and then comprehending what it means

15:35 Draggor: There is a distinct lack of good examples in clojure I've come to find.

15:35 Chouser: Draggor: you saw :exposes-methods ?

15:35 Draggor: Chouser: I did, poked with it, none of it was successful

15:36 Chouser: you need to use that to get at the protected method of the base class

15:36 Draggor: Hmm, I think I just read something I missed before, let me try again

15:37 Chouser: Draggor: then you probably want a :post-init to call that exposed method.

15:38 tmountain: jbell: admittedly, there are cases where examples would be helpful. I believe there's been some discussion on adding examples to the API docs recently.

15:40 Draggor: Chouser: almost there, I need to have a matching constructor

15:40 ambient: i can write "true" as a value in java interop?

15:40 like (def af (AudioFormat. (params :sample-rate) 8 1 true true))

15:40 hiredman: ,(= true (Boolean/valueOf "true"))

15:40 clojurebot: true

15:40 hiredman: true is java's true

15:41 ambient: ok cool :)

15:45 jbell: I just looked for partition in the ClojureCategorized, and it was under the heading 'sequence operations to do other things', lol

15:45 Draggor: Chouser: Even just trying to expose the method and call it, still yells at me for not having a matching method

15:46 Chouser: you're trying to call it via the new name you gave it?

15:47 do you have use contrib repl-utils? I rely heavily on the 'show' function to figure out java interop errors.

15:47 Draggor: Chouser: http://pastebin.org/16839

15:48 hiredman: Chouser: I could just give him the wallhack method

15:49 Draggor: I don't have repl-utils yet

15:51 Chouser: doesn't that gen-class usage error out? I think you want '{setName Name} or something.

15:51 I don't think bare words will work there, you need quoted symbols or strings or something.

15:51 hiredman: Draggor: I use something like http://paste.lisp.org/display/83651#1 to call setName on pircbot

15:51 Draggor: Doesn't error on me that I see

15:51 hiredman: so I don't have to AOT compile at all

15:52 Draggor: Hmm

15:52 hiredman: I just proxy PircBot

15:52 Draggor: will that work on a proxied pircbot instance?

15:52 there we go

15:53 Chouser: hiredman: why do you call it wallhack?

15:53 Draggor: It's using reflection to dig in and get it, despite 'walls' to keep the user out

15:53 or something like that?

15:53 hiredman: "Wallhacking is the changing of wall properties in first-person shooters. Most wallhacks are used to make a map's walls at least partially…"

15:54 wikipedia apparently has a whole article on it :P

15:54 ambient: (make-array Byte 100) is boxed bytes? how can i make non-boxed? (make-array (.type Byte) 100) doesnt seem to work

15:54 hiredman: Byte/TYPE

15:54 ambient: thanks

15:55 hiredman: http://clojure.org/java_interop#toc31

15:55 :(

15:55 (. Integer TYPE)

15:55 ambient: yeah, out of date or something

15:56 oops

15:56 seems it starting to be too late :P

15:56 i read that whole thing but somehow missed the last part

16:01 Draggor: hiredman: thank you very much! Success!

16:02 Chouser: proxy needs to expose base methods and fields automatically

16:02 have I mentioned that before? :-)

17:02 ambient: a bit off topic but anyone used Project Kenai from Sun (source hosting service)? is it any good?

17:02 LauJensen: Haven't tried, but Gitorious + Lighthouse is working very well for us

17:03 ambient: yeah, i'm currently on bitbucket.org myself

17:04 LauJensen: Ok

17:08 hiredman: ~ticket search struct

17:08 clojurebot: ("#176: structs printed with *print-dup* true cannot be read" "#50: GC Issue 46:\tcallable defstruct (PersistentStructMap$Def extends AFn)" "#174: Make c.l.Keyword Serializable" "#37: GC Issue 33:\tresultset-seq breaks when the result set contains duplicate column names (with patch)")

17:08 hiredman: *tada*

17:08 Chouser: nice. those are only open ones?

17:09 hiredman: nope

17:09 that is via screenscraping the assembla search page

17:09 Chouser: they have documented API too

17:09 hiredman: yeah

17:10 Chouser: which is great as long as you're not trying to attach a file to a ticket.

17:10 hiredman: but to get a list of tickets you need to login

17:10 Chouser: ah, ok.

17:10 hiredman: and it doesn't seem to work even when I give a login

17:11 ~ticket #176

17:11 clojurebot: {:url http://tinyurl.com/m253vo, :summary "structs printed with *print-dup* true cannot be read", :status :new, :priority :normal, :created-on "2009-08-18T16:11:11+00:00"}

17:11 hiredman: that is via the api though

17:11 drewr: hiredman: I wish you had put all of that effort into fixing that bug :-)

17:12 hiredman: which bug?

17:12 drewr: ~ticket #176

17:12 clojurebot: {:url http://tinyurl.com/m253vo, :summary "structs printed with *print-dup* true cannot be read", :status :new, :priority :normal, :created-on "2009-08-18T16:11:11+00:00"}

17:12 hiredman: http://gist.github.com/184831

17:13 gnarly

17:13 drewr: nice

17:13 is that using tagsoup?

17:13 cemerick: heh, zip-soup

17:14 hiredman: yeah

17:15 Chousuke: paren-soup, that :P

17:16 hiredman: the great thing about -> is you just reverse the order and wrap everything in comp, and suddenly you have a point free function

17:18 cemerick: point-free is getting a lot of press in these parts lately

17:28 clojure: hiredman: maybe that function should be called <-

17:29 hiredman: comp?

17:29 should be ·

17:29 clojure: revering -> order, and adding in comp

17:33 jbell: can anyone think of a good way to get every other item in a seq? (map first (partition 2 list)) doesn't work because partition doesn't create a partition of the last item in an odd-sized sequence

17:34 Chouser: (map second (cons nil (partition 2 list))) ?

17:34 er

17:34 hiredman: uh

17:34 Chouser: (map second (partition 2 (cons nil list))) ?

17:34 hiredman: what about nth?

17:35 er not nth

17:35 Chouser: take-nth

17:35 I always for get him

17:36 jbell: ,(map second (partition 2 (cons nil list)))

17:36 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from:

17:36 hiredman: ,(doc take_nth)

17:36 clojurebot: excusez-moi

17:36 hiredman: ,(doc take-nth)

17:36 clojurebot: "([n coll]); Returns a lazy seq of every nth item in coll."

17:37 ambient: ,(take-nth 2 (range 10))

17:37 clojurebot: (0 2 4 6 8)

17:37 jbell: ,(take-nth (range 5))

17:37 whoops

17:37 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$take-nth

17:38 jbell: ,(take-nth 2 (range 5))

17:38 clojurebot: (0 2 4)

17:38 jbell: that seems like a strange name for that function

17:39 ambient: i think it's pretty logical

17:41 (map #(foo %) (range array-len)) is a good idiom when generating arrays from a function?

17:42 because it's all lazy perhaps i don't have to even think about this

17:42 clojure: Chouser: what's the status of clojurescript?

17:42 hiredman: ambient: eh?

17:42 how does that generate an array?

17:43 ambient: (into-array Byte/TYPE (map

17:43 #(byte (* 127 (Math/sin (* % 0.2))))

17:43 (range (* (params :sample-rate) 2)))))

17:44 hmhm, but a better way perhaps would be to (take array-len fun-function)

17:45 hiredman: ,(doc amap)

17:45 clojurebot: "([a idx ret expr]); Maps an expression across an array a, using an index named idx, and return value named ret, initialized to a clone of a, then setting each element of ret to the evaluation of expr, returning the new array ret."

17:46 ambient: the point is that i'm not mapping over an existing array, i'm generating it

17:46 type-conversion happens at (into-array Byte/TYPE...

17:47 hiredman: I know, but you might find amap, areduce, etc useful if you are using arrays

17:47 ambient: i probably will :)

17:48 Sivajag: does anyone where I could find info on setting my carbon emac to run repl?

17:49 technomancy: Sivajag: http://technomancy.us/126

17:50 Chousuke: Why would you use carbon emacs? :/

17:51 Sivajag: i wish I could just use textmate

17:51 I am a begineer for emac :(

17:51 Chousuke: you could try aquamacs or at least emacs.app

17:51 Carbon emacs is obsolete. :/

17:52 rsynnott: Emacs.app is possibly the best at the moment

17:52 * technomancy seconds the notion

17:52 rsynnott: Aquamacs has horribly messed up keybindings, though I assume it can be fixed

17:52 Sivajag: ok I am bought :)

17:52 Chousuke: Aquamacs might be easier to get started with though. pick your poison: http://emacsformacosx.com/ or aquamacs.org

17:53 rsynnott: (Astonishingly, Emacs.app survived the upgrade to Snow Leopard; previously Tiger and Leopard killed it)

17:53 ctdean: What do you get if you just build it yourself from sources on a Mac? (That's what I do)

17:53 Chousuke: ctdean: Emacs.app, I should think.

17:53 or maybe just the command line version.

17:54 (which is still there with emacs.app, just inside the app bundle)

17:54 rsynnott: The X11 one is surprisingly usable

17:54 ctdean: Ok. I always thought I was running carbon emacs. it looks like a carbon app to me, but I'm no expert on the Mac variations

17:55 Chousuke: well, which version of emacs is it? if it's 23, it's probably the cocoa one, but 22 used carbon :/

17:55 ctdean: 22.2.50.1

17:56 so there ya go :)

17:56 rsynnott: ctdean: Emacs.app is carbon

17:56 but there was another thing called carbon emacs

17:56 ctdean: I see. very confusing!

17:56 winterstream: Hi everyone. I can't seem to compile a Clojure file to a Java class. I have a file nl.tudelft.nas.GraphvizPlugin that I try to compile with (compile 'nl.tudelft.nas.GraphvizPlugin), but Clojure complains that it cannot find the file GraphvizPlugin.clj. However, if I rename it, Clojure says: Could not locate nl/tudelft/nas/GraphvizPlugin__init.class or nl/tudelft/nas/GraphvizPlugin.clj on classpath. Any idea on what I'm doing wrong?

17:56 rsynnott: indeed; the great unix-nerd migration to macos a few years back produced many such oddities

17:57 Chousuke: rsynnott: emacs.app is Cocoa since 23.1 though. :/

17:57 rsynnott: oh, is it?

17:57 nice

17:57 Chousuke: yes.

17:57 rsynnott: I'm still on 22.something

17:58 hiredman: winterstream: so you have a file named GraphvizPlugin.clj is nl/tudelft/nas/?

17:58 Chousuke: I have no problems with 23.1 :)

17:58 ctdean: winterstream: is your *compile-path* setup?

17:58 hiredman: and the directory nl is in is on the classpath?

17:58 ~compile

17:58 clojurebot: the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation

17:58 winterstream: Oh, wait, I have to set *compile-path*? Okay, let me check...

17:59 ctdean: ,(doc compile)

17:59 clojurebot: "([lib]); Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath."

17:59 jbell: ambient: (take n list) means take the first n elements (I would have expected (first n list))... take-nth, that immediately makes me think 'will produce the nth' of this sequence, while I'd expect my intention to be achieved with something like (interval-seq n seq). I think 'take' is too ambiguous

17:59 hiredman: winterstream: have you read http://clojure.org/compilation

18:00 winterstream: hiredman: I have, but not thoroughly enough :)

18:00 ambient: jbell, i think it as take-nth, drop-nth, it takes a vector instead of values

18:01 drop-nth drops that vector and returns rest (i dont know if this is an actual function)

18:02 perhaps i should use the right terminology s/vector/sequence/

18:05 winterstream: Now I'm trying

18:05 (let [*compile-path* "/home/wynand/hacking/graphviz_cytoscape"]

18:05 (compile 'nl.tudelft.nas.GraphvizPlugin))

18:05 But I'm still getting no love from Clojure

18:05 hiredman: :/

18:05 ctdean: Is that dir in the classpath ?

18:05 hiredman: so much wrong

18:05 winterstream: Aye, it is

18:05 hiredman: a. forget about *compile-path*

18:06 technomancy: don't you need to use binding?

18:06 hiredman: sshhh

18:06 technomancy: or even def; heck

18:06 hiredman: don't confuse the man

18:06 he can deal with *compile-path* later

18:06 * technomancy shuts up

18:06 hiredman: winterstream: what is your classpath set to?

18:07 winterstream: A lot of things, but it includes that directory. I verified this by checking (.getURLs (java.lang.ClassLoader/getSystemClassLoader))

18:07 hiredman: winterstream: what does the ns form at the top of GraphvizPlugin.clj look like?

18:08 winterstream: (ns nl.tudelft.nas.GraphvizPlugin

18:08 (:import [cytoscape.plugin CytoscapePlugin])

18:08 (:gen-class

18:08 :extends CytoscapePlugin

18:08 :init init

18:08 :constructors {[] []}

18:09 :state state))

18:09 Sorry for that big paste

18:09 I should have pastebinned it

18:09 dnolen: a little bit behind, but does no one else find Emacs.app dog slow compared to Carbon Emacs. That's been my experience anyway.

18:10 hiredman: winterstream: and GraphvizPlugin lives in nl/tudelft/nas/ ?

18:10 winterstream: Yes

18:10 hiredman: GraphvizPlugin.clj

18:10 winterstream: Yes

18:10 hiredman: and the directory nl is in is on the classpath?

18:10 Chousuke: dnolen: hm. Well, I wouldn't know :/

18:10 winterstream: Yes

18:10 Chousuke: dnolen: I don't find it particularly slow

18:11 dnolen: Carbon is deprecated anyway though so Cocoa is the only way forward. Hopefully it will improve.

18:11 hiredman: winterstream: and what about ./classes/ ?

18:11 :|

18:12 dnolen: Chousuke: Carbon will be deprecated when QuickTime becomes modern. Not anytime soon.

18:12 hiredman: Chouser: what doesn't http://clojure.org/compilation mention ./classes/ ?

18:12 Chousuke: dnolen: carbon is already deprecated and Quicktime X was just released :P

18:12 hiredman: it just shows up in the examples

18:13 dnolen: Chousuke: only partially true. QuickTime X still has to call into old APIs.

18:13 the surface area of QuickTime is unbelievably large.

18:13 Chousuke: dnolen: yeah, but that's because they haven't implemented all of the old functionality.

18:13 hiredman: winterstream: anyway, you should make a directory called "classes" and put ./classes/ on the classpath

18:13 rsynnott: dnolen: well, more precisely QTKit uses Quicktime X for the stuff that it supports, Quicktime 7 otherwise

18:13 Chousuke: right.

18:14 winterstream: hiredman; cool, I'll do that quickly...

18:14 rsynnott: (Ars Technica's review of Snow Leopard has the full tedious details about the War on Carbon/Quicktime)

18:14 dnolen: in anycase, my eyes are on Emacs.app, just want the rendering to be about twice as quick and I'm sold :)

18:14 winterstream: hiredman: that did the trick indeed

18:15 Thanks

18:17 Chousuke: dnolen: I noticed some slowness if there is more than one frame open showing the same buffer but I don't often do that so it's not a problem. :/

18:32 powr-toc: when is it acceptable to use eval?

18:33 ctdean: You are writing your own repl or the equiv.

18:34 hiredman: ctdean: weeeel even then there is clojure.main/repl

18:34 ,(doc clojure.main/repl)

18:34 clojurebot: "([& options]); Generic, reusable, read-eval-print loop. By default, reads from *in*, writes to *out*, and prints exception summaries to *err*. If you use the default :read hook, *in* must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing CR, LF, and CRLF into a single \\newline. Options are sequential keyword-value pairs. Available options and their d

18:34 tomoj: I was thinking I might provide a spot in a swing gui for people to edit clojure code

18:34 I think that would be one place

18:35 for those that don't want to use their own editors I mean

18:35 hiredman: nah, use clojure.main/repl

18:36 powr-toc: I'm implementing a DSL and I want to have two interpretations of the same domain code... one that executes it literally, and the other which generates a graphical representation of the code... I was thinking I could eval the DSL in different environments, where the DSL macro's/functions had different interpretations... is that mad?

18:36 is there another, easier more sane way to do this kinda thing

18:36 ?

18:37 hiredman: :(

18:38 youd can use binding, or just read the code and then feed the datastructure to your display logic

18:39 powr-toc: hiredman: Yes I was considering that option too... which would be easiest?

18:40 hiredman: feeding the datastructure into your display logic

18:40 powr-toc: hiredman: cool... out of interest would macros work with eval under different bindings?

18:41 hiredman: yes

18:42 * hiredman rebinds the doc macro for clojurebot

18:42 powr-toc: hiredman: sweet

18:48 hiredman: so if I just read the stream containing my domain code in my display logic, what functions are there to convert it into a parsed s-expression/

18:48 ?

18:48 or would I need to quote it?

18:49 hiredman: read

18:49 ,(doc read)

18:49 clojurebot: "([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?]); Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* ."

18:50 powr-toc: hiredman: awesome!!

18:51 ,(first (read-string "(+ 10 20 (* 30 30))"))

18:51 clojurebot: +

18:52 powr-toc: hmmm... can you use zippers on s-expressions?

18:53 hiredman: sure

18:58 travisbrady: anyone know of a really simple page for clojure/java newbies that describes compilation and packaging? i'm looking to write a command line application with clojure

19:00 hiredman: ~compile

19:00 clojurebot: the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation

19:02 hiredman: http://github.com/nakkaya/clojure-stub/tree/master might be useful as well

19:02 clojurebot: clojure-stub?

19:02 clojurebot: clojure is cheating

19:02 hiredman: clojurebot: clojure-stub is http://github.com/nakkaya/clojure-stub/tree/master

19:02 clojurebot: 'Sea, mhuise.

19:02 hiredman: clojurebot: clojure-stub?

19:02 clojurebot: clojure-stub is http://github.com/nakkaya/clojure-stub/tree/master

19:03 powr-toc: Has anyone implemented clojure repl in clojure yet?

19:03 hiredman: ~def clojure.main/repl

19:04 powr-toc: wicked... I was looking through the clj source but couldn't see it...

19:05 but Repl.java seemed to delegate to a clojure one

19:14 travisbrady: hiredman: ok, clojure-stub looks really cool, I did ant setup and ant compile but now I'm not sure how to run this jar I've created

19:15 hiredman: java -jar jarfile.jar

19:16 or java -cp jarfile.jar class.Name

19:16 well

19:16 travisbrady: yes!

19:16 hiredman: you will need to have clojure on the classpath somewhere, but clojure-strub might take care of that

19:16 travisbrady: java -jar hello.jar works

19:20 ok so building with ant is definitely the way to go

19:35 I'm hitting an odd error, I do 'ant compile' and I can actually see that my code does a println which I can see in the ant output, but then i get this error http://gist.github.com/184921 "Exception in thread "main" java.lang.Exception: namespace 'vertoid' not found after loading '/vertoid'" what does this mean?

19:41 if i add an ns declaration it fails with "Exception in thread "main" java.lang.ClassCastException: clojure.lang.Cons (vertoid.clj:2)"

19:44 hiredman: ~compile

19:44 clojurebot: the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation

19:44 hiredman: ~namespaces

19:44 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

19:45 winterstream: I'm getting a NoClassDefFoundError when trying to load my Clojure generated plugin in Cytoscape. Now, clojure.jar is in my path and the plugin loads fine when I import it from Clojure. Any idea on what could be going wrong?

19:48 hiredman: lisppaste8: url?

19:48 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

21:39 strlen: hello. how is the programming clojure by by stuart halloway?

21:39 deciding to divde deeper into clojure :-)

21:53 tomoj: strlen: I quite liked it

21:54 it was my intro to clojure

22:09 manic12: one thing that I like about allegrocl that I would like to find an equivalent in clojure, is that any c++ object which is represented in memory as a contiguous array of floats or doubles I can pass in a lisp array of floats or doubles to the ff call

22:11 i'm wondering if java does the same thing, and how that looks from clojure code

22:28 hiredman: no

22:34 manic12: shoot

22:35 so there is no way in java to lock the heap during a native call?

22:37 hiredman: you know, I cannot say for sure, but I would be extremely surprised if there was

22:37 manic12: allegro has that option

22:37 hiredman: clojurebot: this?

22:37 clojurebot: this is not a bug

22:38 hiredman: clojurebot: this is also not allegro

22:38 clojurebot: Ik begrijp

22:38 manic12: you can say :release-heap :never for a ff call

22:38 hiredman: clojurebot: this?

22:38 clojurebot: this is not allegro

22:41 manic12: I'm a bit sad because I had all this working under allegro, then rhickey came along and said cl is sub-optimal

22:42 JAS415: cl is sub optimal?

22:42 hmmm

22:43 manic12: that's my impression of rhickey's talks

22:43 hiredman: in computer programming, a supple mind is of great importance

22:43 JAS415: well CL doesn't play well with others certainly, and doesn't solve the problems clojure is supposed to solve

22:44 although actually my impression of commercial CLs is that it does interoperate pretty well

22:44 manic12: allegrocl integrates well with C

22:44 JAS415: right

22:44 java/.net though i guess

22:45 well, I like both, for what its worth

22:45 they bring different stuff to the table

22:47 rhickey: I never said CL was sub-optimal

22:48 manic12: it's an impression

22:49 JAS415: then again saying something is sub optimal in the land of computer languages is kind of like saying water is wet

22:49 manic12: true

22:49 rhickey, you got a min or two to jump into this conversation about foreign code?

22:51 I have to make some tough decisions

22:53 rhickey: http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html

22:54 samhughes: 21:45 < JAS415> although actually my impression of commercial CLs is that it does

22:55 JAS415: i know, i contradict myself!

22:57 manic12: is that a no?

22:59 rhickey: http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp1265

23:00 I recommend reading the JNI docs for answers to JNI questions. It's outside the scope of Clojure, whose FFI is to Java itself, not C

23:01 manic12: I will, thx for the links, especially the second one

23:01 rhickey: my last JNI stuff was jFli, enabling CL to talk to Java :)

23:01 samhughes: sorry JAS415, I didn't mean to copy and paste your message onto the screen (I did, right?). My terminal froze up and that was the result.

23:02 manic12: but it would be nice to be able to treat C double arrays and float arrays similar to sequences in clojure

23:02 JAS415: ah

23:02 no worries

23:04 manic12: I'm asking too much...need to find the happy medium

23:10 this is interesting...about pinning...it's not the same as a statically declared array in CL

Logging service provided by n01se.net