Re: understanding quoting

2008-12-15 Thread Mon Key
For FAQ style plain text I like having the RHS comments moved below the S-Expression as I can C-n down the file and do C-x C-e evaluation to REPL as I go. Once the RHS ;;;Comments are below the S-Expressions I find i like having a symbol to indicate the eval => I took the liberty of re-formattin

Re: jEdit Mode for Clojure

2008-12-15 Thread Daniel Spiewak
Also, it's worth noting that my trick to highlight def-initions probably isn't going to work if we have hierarchical parsing of S- expressions. I'm not entirely sure how jEdit is going to handle certain cases if we try to merge the two. It might be possible to make it work, but I suspect that jE

Re: macroexpand-1 vs. macroexpand

2008-12-15 Thread Konrad Hinsen
On 16.12.2008, at 02:58, Mark Volkmann wrote: > I'm trying to understand the difference between these. Is it that > macros expanded by macroexpand-1 could result in calls to additional > macros that won't be expanded, but macroexpand will continue expanding > until no macro calls remain? Right.

Re: Gorilla: key combinations

2008-12-15 Thread Meikel Brandmeyer
Hi, On 16 Dez., 04:08, Alex Burka wrote: > I put plugin/gorilla.vim in /Applications/MacVim.app/Contents/ > Resources/vim/runtime/plugin/. The correct way to install Gorilla is to copy the contents of the plugin, after and doc directories to your .vim directory in your home directory. Be sure t

Re: jEdit Mode for Clojure

2008-12-15 Thread Daniel Spiewak
> I been thinking about this during the weekend, and I think I prefer the mode > to be aware of nesting (unless you can cause it to blow the stack on a large Well, this would be my question: why? :-) Auto-indent needs to be aware of nesting, but that's already handled in a separate pass from th

template.clj (r306) in clojure.contrib won't compile

2008-12-15 Thread walterc
the template function is missing parameter binding part of a let --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this

Re: doall and dorun

2008-12-15 Thread Brian Doyle
I'll take a crack at this. It may appear that the doall and dorun return something different with subsequent calls but they don't actually. The doall always returns the sequence (1 2) and dorun always returns nil. The first time (doall x) is called the for loop executes and prints 1 2 (a side e

test-is uncaught exception behavior

2008-12-15 Thread Allen Rohner
In recent versions of test-is, it appears that exceptions are only caught inside of the 'is' macro, as opposed to during the whole test run. This is a problem when running test-is from slime, because when a test throws an exception outside of the 'is' macro, it requires user intervention to handle

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Mon Key
whoops, chopped of the end of that last message - forgot the nasake-no ichigeki user> (seq? '(nil)) ==|]==>true --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: understanding quoting

2008-12-15 Thread Daniel Eklund
> How did you know that it delegates to 'get'? sorry, I rushed that part. the keyword and symbol are instances of clojure.lang.Keyword and clojure.lang.Symbol which are _java_ classes found in Keyword.java and Symbol.java (I found these in the src/jvm directory) These are what the invoke( ) m

Initialize java.util.TreeSet/TreeMap using clojure set/map value

2008-12-15 Thread Feng
Hi, Because clojure set, vector and map all implements java.util.Comparator (indirectly via AFn), they interact with java.util.TreeSet/TreeMap in surprising way due to overloaded ctor (java.util.Comparator). user=> (def s (java.util.TreeSet. [1 2 3 3])) #'user/s user=> s #=(java.util.TreeSet. #{

Re: understanding quoting

2008-12-15 Thread Timothy Pratley
Neat :) Thanks for the in depth examination, that's a very clear explanation! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscr

Re: understanding quoting

2008-12-15 Thread Brian Doyle
On Mon, Dec 15, 2008 at 9:43 PM, Daniel Eklund wrote: > > > Looks like an if then else version of the map lookup?? > > ie: (if (%1 %2) (%1 %2) %3) > > Is this a special feature of maps in general, such that you can look > > up a key but return something else if it doesn't exist? > > I hadn't come

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Mon Key
> Flattening nothing gives something? "Nothing" was minding the gap until you put it inside flatten's sequence interface at which point you got a flattened sequence full of nil. Prior to that there was *not* an empty list waiting for nil. Returning nothing when in fact you expect a list (even on

Re: understanding quoting

2008-12-15 Thread Daniel Eklund
> Looks like an if then else version of the map lookup?? > ie: (if (%1 %2) (%1 %2) %3) > Is this a special feature of maps in general, such that you can look > up a key but return something else if it doesn't exist? > I hadn't come across it yet, but it sounds useful :) This is exactly right (I j

doall and dorun

2008-12-15 Thread wubbie
Hello, doall and dorun returns different results from seond run on... e.g. user=> (def x (for [i (range 1 3)] (do (println i) i))) #'user/x user=> (doall x) 1 2 (1 2) user=> (doall x) (1 2) user=> (doall x) (1 2) user=> user=> (def x (for [i (range 1 3)] (do (println i) i))) #'user/x user=> (dor

Re: understanding quoting

2008-12-15 Thread Timothy Pratley
> user=> ('b '{a 10, b 11, c 12}) > 11 Ah, yes so the 1 arg version is the map lookup, which also works in reverse user=> ('{a 10, b 11, c 12} 'b) 11 That makes perfect sense... What is the 2 arg version? user=> ('{a 10, b 11, c 12} 'b 'c) 11 user=> ('b '{a 10, b 11, c 12} 'c) 11 user=> ('b 'c '

Re: in-ns + refer

2008-12-15 Thread Chouser
On Mon, Dec 15, 2008 at 10:42 PM, Mike Perham wrote: > > Why do we have to do this? > > (in-ns 'myns) > (clojure/refer 'clojure) > > Java automagically imports java.lang. Shouldn't Clojure automagically > map the core namespace? It does if you use the 'ns' macro (depending on whether you specif

Re: understanding quoting

2008-12-15 Thread Timothy Pratley
What is the meaning of: ('+ '1 '2) On the surface it appears that '2 is simply the last evaluated, but lets try some similar calls: user=> ('+) java.lang.IllegalArgumentException: Wrong number of args passed to: Symbol user=> ('+ '1) nil user=> ('+ '1 '2) 2 user=> ('+ '1 '2 '3) java.lang.IllegalA

in-ns + refer

2008-12-15 Thread Mike Perham
Why do we have to do this? (in-ns 'myns) (clojure/refer 'clojure) Java automagically imports java.lang. Shouldn't Clojure automagically map the core namespace? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cloju

'require' doc string out of date?

2008-12-15 Thread Daniel Eklund
I've been trying to get 'ns' right. The doc for 'require' tells me the following about library loading: "The root resource path is derived from the root directory path by repeating its last component and appending '.clj'. For example, the lib 'x.y.z has root directory /x/y/z; root resource

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
SOLVED: Hi everyone, thanks for your help. I figured out what I was doing wrong. In my clojure directory there is a subfolder clojure/trunk I was supposed to run "ant" inside "clojure/trunk" and not "clojure". The correct generated "clojure.jar" is 1389436 bytes --~--~-~--~~---

Gorilla: key combinations

2008-12-15 Thread Alex Burka
Thanks for Gorilla. I am using it with MacVim. One (or :bug :pebkac) report... I put plugin/gorilla.vim in /Applications/MacVim.app/Contents/ Resources/vim/runtime/plugin/ and it seems to be loaded when MacVim starts. But the keybindings are not set up. \sr doesn't do anything (well, the '

Re: understanding quoting

2008-12-15 Thread Chouser
On Mon, Dec 15, 2008 at 9:41 PM, Mark Volkmann wrote: > > ; Quoting a list is *not* the same as quoting everyting inside it. > (println ('+ '1 '2)) ; outputs 2 which is the value of the last item evaluated Your example works, but your comment is not always true: user=> ('+ '1) nil user=> ('+ '1

understanding quoting

2008-12-15 Thread Mark Volkmann
Here's a summary of what I think I know about quoting in Clojure. I'd appreciate some feedback if I said anything wrong below or maybe didn't describe something well. ; One use of quoting is to prevent a list from being evaluated ; where the first item is treated as the name of a function ; and t

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
I'm running the REPL by typing "java -jar clojure.jar" in the directory "C:\clojure" which contains the "clojure.jar" file. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, sen

Re: Getting Started with Gen-Class

2008-12-15 Thread Dave Newton
--- On Mon, 12/15/08, CuppoJava wrote: > And i get the message "Unable to resolve symbol: > compile in this context" when i type "(compile)" > at the REPL. How are you running the REPL? It's working for me whether I build with Ant or Maven, rev 1160. Dave --~--~-~--~~

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
I tried "ant clean" followed by "ant" which built a clojure.jar which is exactly 488,904 bytes. And i get the message "Unable to resolve symbol: compile in this context" when i type "(compile)" at the REPL. Thanks very much for your help -Patrick --~--~-~--~~~---~--

Re: macroexpand-1 vs. macroexpand

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 17:58, Mark Volkmann wrote: > I'm trying to understand the difference between these. Is it that > macros expanded by macroexpand-1 could result in calls to additional > macros that won't be expanded, but macroexpand will continue > expanding until no macro calls remain?

macroexpand-1 vs. macroexpand

2008-12-15 Thread Mark Volkmann
I'm trying to understand the difference between these. Is it that macros expanded by macroexpand-1 could result in calls to additional macros that won't be expanded, but macroexpand will continue expanding until no macro calls remain? It tried: (macroexpand-1 '(or (< 2 1) (< 3 2) (< 1 2))) which

Best Way to Ensure a Call to (shutdown-agents)?

2008-12-15 Thread Randall R Schulz
Hi, I've just started using agents and as I've done that, I've noticed that once you use an agent, exiting the REPL leads to a hang (with zero CPU usage). As Rich pointed out to me, this is avoided by calling (shutdown-agents). So my question is this: What's a simple way to ensure that (shut

Re: Getting Started with Gen-Class

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 17:05, CuppoJava wrote: > I checked with SVN. > It says I checked out revision number 1160? As of this writing, that's the latest rev. In your previous message you said you tried "ant clean". I assume that you followed that by "ant jar" (or just did "ant clean jar").

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
I checked with SVN. It says I checked out revision number 1160? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this g

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
Tried "ant clean", it's still giving me the same error. Unable to resolve symbol: compile in this context. Is there a way to check my Clojure version from the REPL? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "C

Re: Agents & send-off

2008-12-15 Thread Bradbev
On Dec 15, 4:29 pm, Rich Hickey wrote: > On Dec 15, 5:57 pm, Bradbev wrote: Thanks for the quick reply. Very helpful. Cheers, Brad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Getting Started with Gen-Class

2008-12-15 Thread Rich Hickey
On Dec 15, 5:35 pm, CuppoJava wrote: > Hi, > I just ran into a need for using gen-class, and need some help getting > started. > > I upgraded to the latest Clojure version using > svn cohttps://clojure.svn.sourceforge.net/svnroot/clojureclojure > > and I run the REPL using > java -jar clojure.j

Re: possible bug with seq and Enumeration?

2008-12-15 Thread Brian Doyle
Using enumeration-seq does the trick! Thanks. user=> (enumeration-seq (.entries (java.util.zip.ZipFile. ""))) On Mon, Dec 15, 2008 at 5:14 PM, Rich Hickey wrote: > > > > On Dec 15, 6:01 pm, "Brian Doyle" wrote: > > According to the docs the seq function should be able to take an > > enumerati

Re: Agents & send-off

2008-12-15 Thread Rich Hickey
On Dec 15, 5:57 pm, Bradbev wrote: > I have the following scenario: > - a server that is listening on a socket for incoming connections. > - when the server accepts a connection it uses send-off to run a > handler function to handle the connection > - the handler function loops using recur

Re: possible bug with seq and Enumeration?

2008-12-15 Thread Rich Hickey
On Dec 15, 6:01 pm, "Brian Doyle" wrote: > According to the docs the seq function should be able to take an > enumeration, > but here is what I see: > > user=> (seq (.elements (doto (java.util.Vector.) (.add "hello") (.add > "world" > java.lang.IllegalArgumentException: Don't know how to cr

Re: Best Choice of Java Class For *out*

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 15:22, Stephen C. Gilardi wrote: > On Dec 15, 2008, at 6:08 PM, Randall R Schulz wrote: > > user=> (class *err*) > > java.io.PrintWriter > > PrintWriter is (as far as I can determine) the more modern of the two > classes that are accepted as an argument to > "Throwable.p

Re: Best Choice of Java Class For *out*

2008-12-15 Thread Stephen C. Gilardi
On Dec 15, 2008, at 6:08 PM, Randall R Schulz wrote: user=> (class *err*) java.io.PrintWriter PrintWriter is (as far as I can determine) the more modern of the two classes that are accepted as an argument to "Throwable.printStackTrace" which is used frequently in Clojure's implementatio

Re: Best Choice of Java Class For *out*

2008-12-15 Thread Randall R Schulz
On Sunday 14 December 2008 17:21, Randall R Schulz wrote: > Hi, > > I have quite a bit of Java code with I/O capabilities that generally > support both PrintStream and PrintWriter. I was a bit perplexed when > I tried to apply one of these methods to *out* and was rebuffed > thusly: > > java.lang.

possible bug with seq and Enumeration?

2008-12-15 Thread Brian Doyle
According to the docs the seq function should be able to take an enumeration, but here is what I see: user=> (seq (.elements (doto (java.util.Vector.) (.add "hello") (.add "world" java.lang.IllegalArgumentException: Don't know how to create ISeq from: (NO_SOURCE_FILE:0) SVN 1160, thanks. --

Agents & send-off

2008-12-15 Thread Bradbev
I have the following scenario: - a server that is listening on a socket for incoming connections. - when the server accepts a connection it uses send-off to run a handler function to handle the connection - the handler function loops using recur to handle packets - the handler function uses

Functional Geometry

2008-12-15 Thread Frantisek Sodomka
Hello all! I ported beatiful functional geometry: http://www.frank-buss.de/lisp/functional.html http://intricatevisions.com/index.cgi?page=nlcodetk into Clojure: http://intricatevisions.com/source/clojure/fg.clj (link from the page http://intricatevisions.com/index.cgi?page=clojure) When you ru

Re: Nested Java Types

2008-12-15 Thread Joost
Rich Hickey schreef: > On Dec 15, 2008, at 1:49 PM, Joost wrote: > > Rich Hickey schreef: > >> Dot is too overloaded in Java, and overloaded enough in Clojure. This > >> one doesn't seem too important to me. > > > > I ran into this issue yesterday. Or more precisely: I couldn't find > > any way to

Re: Common Lisp's symbol-name in Clojure?

2008-12-15 Thread Stuart Sierra
Yep, it is: (name symbol) -Stuart Sierra On Dec 15, 5:34 pm, Paul Reiners wrote: > Is there anything in Clojure that is equivalent to Common Lisp's > symbol-name function? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
Hi, I just ran into a need for using gen-class, and need some help getting started. I upgraded to the latest Clojure version using svn co https://clojure.svn.sourceforge.net/svnroot/clojure clojure and I run the REPL using java -jar clojure.jar However when I type: user=> (compile) I get the f

Common Lisp's symbol-name in Clojure?

2008-12-15 Thread Paul Reiners
Is there anything in Clojure that is equivalent to Common Lisp's symbol-name function? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To

Trace Tools

2008-12-15 Thread Craig McDaniel
Here is a minor update to what I posted previously (but this time as an attachment). This is just a small library that allows you turn on tracing for all functions in a namespace all at once, or toggle tracing for individual functions. --~--~-~--~~~---~--~~ You rece

Re: jEdit Mode for Clojure

2008-12-15 Thread David Moss
I been thinking about this during the weekend, and I think I prefer the mode to be aware of nesting (unless you can cause it to blow the stack on a large file or something, which I think would be unlikely anyway), so I'm going to take the keywords from your mode and bolt on the set structures I had

walkers, templates, and another stab at condp

2008-12-15 Thread Stuart Sierra
Hi Rich, hi everybody, I finally got around to trying an implementation of condp. I had to write two other libs to do it the way I wanted. Here's the result: (condp (instance? _ (* 99 99)) Number "it was a Number" String "it was a String" "it was something

Re: calling use with a seq of strings

2008-12-15 Thread Brian Doyle
I didn't know about the symbol function. Thanks! I just want to call use on all of the namespaces in the clojure.contrib jar when starting the repl and this will work nicely! On Mon, Dec 15, 2008 at 1:59 PM, Stuart Sierra wrote: > > You can do this: > (apply use (map symbol (list "clojure.contr

Re: calling use with a seq of strings

2008-12-15 Thread Stuart Sierra
You can do this: (apply use (map symbol (list "clojure.contrib.str-utils" "clojure.contrib.duck-streams"))) -Stuart Sierra On Dec 15, 3:51 pm, "Brian Doyle" wrote: > I have a seq of strings that are namespaces like, > ("clojure.contrib.str-utils", "clojure.contrib.duck-streams"). > I wanted to c

calling use with a seq of strings

2008-12-15 Thread Brian Doyle
I have a seq of strings that are namespaces like, ("clojure.contrib.str-utils", "clojure.contrib.duck-streams"). I wanted to call the use function on this seq. I can't seem to do that though. Any way I can do this or is this just a bad idea? Thanks. --~--~-~--~~~-

Re: Nested Java Types

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 07:44, Rich Hickey wrote: > On Mon, Dec 15, 2008 at 10:40 AM, Randall R Schulz wrote: > > On Friday 05 December 2008 15:36, Randall R Schulz wrote: > >> I make pretty extensive use of nested classes > >> (most significantly Enum types). > >> > >> I was wondering if it

Re: A newbie question on Agents and ants

2008-12-15 Thread kwatford
*agent* and a few others have recently been properly documented at http://clojure.org/api Unfortunately this isn't true for all of the 'standard' globals. *in* and *out* don't have entries of their own, though they are mentioned in the functions that use them, so a search within that page will fin

Re: Nested Java Types

2008-12-15 Thread Rich Hickey
On Dec 15, 2008, at 1:49 PM, Joost wrote: > > Rich Hickey schreef: >> Dot is too overloaded in Java, and overloaded enough in Clojure. This >> one doesn't seem too important to me. > > I ran into this issue yesterday. Or more precisely: I couldn't find > any way to refer to inner classes in the

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Lennart Staflin
How about adding a rest around tree-seq: (defn flatten "Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence." [x] (let [s? #(instance? clojure.lang.Sequential %)] (filter (complement s?) (rest (tree-seq s? seq

Re: “Don’t know how to create ISeq from: Symbol” error

2008-12-15 Thread James Reeves
On Dec 15, 5:34 pm, Paul Reiners wrote: > I have the following Clojure code and I'm not sure why it's not > working: > > (defn match (x y &optional binds) >   (cond >    ((eql x y) (values binds t)) >    ((assoc x binds) (match (binding x binds) y binds)) >    ((assoc y binds) (match x (binding

Re: “Don’t know how to create ISeq from: Symbol” error

2008-12-15 Thread kwatford
> I have the following Clojure code and I'm not sure why it's not working: The short answer is: That's not Clojure code, it is Common Lisp code. Longer answer: Despite having similar-looking syntax, the two are not particularly related. Of the functions/macros you tried to use, I think only "and

Re: Nested Java Types

2008-12-15 Thread Joost
Rich Hickey schreef: > Dot is too overloaded in Java, and overloaded enough in Clojure. This > one doesn't seem too important to me. I ran into this issue yesterday. Or more precisely: I couldn't find any way to refer to inner classes in the docs on the clojure.org site. I personally don't like

Re: “Don’t know how to create ISeq from: Symbol” error

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 09:34, Paul Reiners wrote: > I have the following Clojure code and I'm not sure why it's not > working: > > (defn match (x y &optional binds) > (cond >((eql x y) (values binds t)) >((assoc x binds) (match (binding x binds) y binds)) >((assoc y binds) (match

Re: A newbie question on Agents and ants

2008-12-15 Thread MattyDub
Should I interpret the silence on this topic to mean that there aren't any places I can go to find out about *agent*, etc.? In another thread on this group, I see that there is a *out*, as well; I assume therefore that there is a *in*. Perhaps those are documented somewhere - any pointers? (Per

“Don’t know how to create ISeq from: Symbol” error

2008-12-15 Thread Paul Reiners
I have the following Clojure code and I'm not sure why it's not working: (defn match (x y &optional binds) (cond ((eql x y) (values binds t)) ((assoc x binds) (match (binding x binds) y binds)) ((assoc y binds) (match x (binding y binds) binds)) ((var? x) (values (cons (cons x y) bi

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Stuart Sierra
On Dec 15, 12:30 pm, Mon Key wrote: > > > > I would expect (flatten nil) => nil > > Why? Sorry, Mon Key, but I have to agree with Randall here. All the sequence-related functions (first, rest, filter, map, etc.) return nil for nil. If flatten is returning a sequence, I expect it to do the same

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 09:30, Mon Key wrote: > > > > I would expect (flatten nil) => nil > > Why? > => nil > nil is not a sequence - your expectation is that Clojure flatten and > return `nothing'... which *would* be a bug Flattening nothing gives something? Flatten is not consistent with se

Where is the Clojure FAQ?

2008-12-15 Thread Mon Key
Clojure needs a FAQ - a plain old school vanilla FAQ. Clojure.org is useful; The wiki is useful; The gg Group is useful; The /# clojure is useful; (doc some-fn) is useful; (show some-fn) is useful; None of these are a FAQ. None accomplish what a FAQ accomplishes. Lots of people look for a FAQ

Re: Clojure classes graph (was chart.png)

2008-12-15 Thread Chouser
On Mon, Dec 15, 2008 at 11:02 AM, Chouser wrote: > On Mon, Dec 15, 2008 at 10:47 AM, Rich Hickey wrote: >> >> It seems the interface detection is not quite right - many things that >> are interfaces are shown as classes. > > Yes, the legend is misleading. Diamonds are for non-clojure > interfac

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Mon Key
> > > I would expect (flatten nil) => nil Why? => nil nil is not a sequence - your expectation is that Clojure flatten and return `nothing'... which *would* be a bug Not a bug. Implementation deficiency/wrong expectations/ preconceptions/mis-application of earlier idiom to new platform. @ http

Re: Updated 'show' and 'source'

2008-12-15 Thread Brian Doyle
This is great stuff. Thanks Chouser! On Fri, Dec 12, 2008 at 10:37 PM, Chouser wrote: > > I've added updated versions of 'show' and 'source' to a new lib named > clojure.contrib.repl-utils > > 'show' is for exploring classes at the REPL. What's new is that it > now displays the modifiers of th

Does ANTS.CLJ still work?

2008-12-15 Thread Peter Wolf
Hello I was just following the directions on Ubuntu setup directions on http://riddell.us/clojure/ I get the following error when I try ANTS.CLJ. Has something changed? Peter (defn setup "places initial food and ants, returns seq of ant agents" [] >>> (sync nil (dotimes [i food-pla

Re: Clojure classes graph (was chart.png)

2008-12-15 Thread Chouser
On Mon, Dec 15, 2008 at 10:47 AM, Rich Hickey wrote: > > It seems the interface detection is not quite right - many things that > are interfaces are shown as classes. Yes, the legend is misleading. Diamonds are for non-clojure interfaces, ovals are clojure.lang.* classes and interfaces. --Chou

Re: Macro Style Question: Expanding to Multiple (def ...) Forms

2008-12-15 Thread Michael Wood
On Mon, Dec 15, 2008 at 4:52 PM, Randall R Schulz wrote: > > Hi, > > I'm wondering whether it's a good idea to create a defsomething -style > macro that establishes multiple root bindings? In other one, a macro > that expands to multiple (def ...) forms? Well that sounds quite like declare: use

Re: Nested Java Types

2008-12-15 Thread Randall R Schulz
On Friday 05 December 2008 15:36, Randall R Schulz wrote: > I make pretty extensive use of nested classes > (most significantly Enum types). > > I was wondering if it might be a good idea to > allow "dot" resolution to find such types. > > > E.g.: > > user=> tau.run.TSEvent.TSEKind > java.lang.Cla

Re: Clojure classes graph (was chart.png)

2008-12-15 Thread Rich Hickey
On Dec 15, 10:27 am, Stuart Sierra wrote: > Cool, thanks! > -S > > On Dec 14, 4:47 pm, Chouser wrote: > > > I've updated the Clojure classes graph (thanks for the push, R. > > Schulz!) The new version includes the newest classes as well as Java > > interfaces that are applicable. These latte

Re: Nested Java Types

2008-12-15 Thread Rich Hickey
On Mon, Dec 15, 2008 at 10:40 AM, Randall R Schulz wrote: > > On Friday 05 December 2008 15:36, Randall R Schulz wrote: >> I make pretty extensive use of nested classes >> (most significantly Enum types). >> >> I was wondering if it might be a good idea to >> allow "dot" resolution to find such t

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 07:22, Stuart Sierra wrote: > On Dec 15, 9:08 am, Randall R Schulz wrote: > > > flatten returns a sequence  - in this case a sequence containing > > > 'nil. How else would you flatten on nil? > > > > I would expect (flatten nil) => nil > > I agree, it's a bug, but I'm n

Re: Clojure classes graph (was chart.png)

2008-12-15 Thread Stuart Sierra
Cool, thanks! -S On Dec 14, 4:47 pm, Chouser wrote: > I've updated the Clojure classes graph (thanks for the push, R. > Schulz!)  The new version includes the newest classes as well as Java > interfaces that are applicable.  These latter are shown inside > diamonds. > > A couple different .svg a

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Stuart Sierra
On Dec 15, 9:08 am, Randall R Schulz wrote: > > flatten returns a sequence  - in this case a sequence containing > > 'nil. How else would you flatten on nil? > > I would expect (flatten nil) => nil I agree, it's a bug, but I'm not sure how to fix it, unless it's just a special case that needs an

Re: Macro Style Question: Expanding to Multiple (def ...) Forms

2008-12-15 Thread Michael Reid
Hi Randall, Seems the general consensus is that there is nothing inherently bad with such a design. The idea of macros is to give you the power to generate code from commonly occurring templates. Emitting multiple def forms certainly falls under this umbrella. /mike. On Mon, Dec 15, 2008 at

Macro Style Question: Expanding to Multiple (def ...) Forms

2008-12-15 Thread Randall R Schulz
Hi, I'm wondering whether it's a good idea to create a defsomething -style macro that establishes multiple root bindings? In other one, a macro that expands to multiple (def ...) forms? The first thing I noticed when I did this is that (barring further machinations within the macro) it evalua

Re: Best Choice of Java Class For *out*

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 01:16, Albert Cardona wrote: > Randall R Schulz wrote: > > What might be the issues or consequences of making the root binding > > of *out* a PrintWriter? > > I've been using a PrintWriter for *out* for months now, and no > problems so far. Using always nearly latest svn

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Randall R Schulz
On Sunday 14 December 2008 21:56, Mon Key wrote: > > user=> (flatten nil) > > (nil) > > Not a bug. > > flatten returns a sequence - in this case a sequence containing > 'nil. How else would you flatten on nil? I would expect (flatten nil) => nil > ... Randall Schulz --~--~-~--~~

Re: The return of the monads: lessons learned about macros

2008-12-15 Thread Konrad Hinsen
Jim, you were quicker than me in implementing monad transformers! What I had in mind is exactly what you did: a monad transformer would be implemented as a function taking a monad as an argument. That's in fact why I defined the monad macro in addition to defmonad. > I did some more work

Re: reduction

2008-12-15 Thread Rich Hickey
On Dec 12, 3:35 pm, Christophe Grand wrote: > I was sure it was a job for iterate: > > (defn reductions > "Returns a lazy seq of the intermediate values of the reduction (as > per reduce) of coll by f, starting with init." > ([f coll] >(if (seq coll) > (for [s (iterate (fn [[x &

Re: clojure.contrib.sql (connection) public?

2008-12-15 Thread kunnar
+1. For example i did a function that calls some Oracle PL/SQL stored procedure (defn db-read-proc [callback] (sql/with-connection db (with-open [stmt (.prepareCall (connection) "{call STORED_PROCEDURE (?)}")] (. stmt registerOutParameter 1 -10) (. stmt execute) (callback (

clojure.contrib.sql (connection) public?

2008-12-15 Thread black...@ipowerhouse.com
Hi there This may be a problem with the way I'm doing things but I think it would be useful for the (connection) function of internal to not be internal. For example, lets say i do a query on a db to see if a user exists, if they don't I want to insert, so I need a new statement for that within

Re: The return of the monads: lessons learned about macros

2008-12-15 Thread Konrad Hinsen
On Dec 14, 2008, at 23:16, jim wrote: > Also, I came across set-state and fetch-state being implemented in > terms of update-state. Indeed, those are the implementations I had in my first monad implementation. I replaced them by manually inlining update-state when I wanted to get rid of mona

Re: Best Choice of Java Class For *out*

2008-12-15 Thread Albert Cardona
Randall R Schulz wrote: > What might be the issues or consequences of making the root binding of > *out* a PrintWriter? > I've been using a PrintWriter for *out* for months now, and no problems so far. Using always nearly latest svn clojure. Albert -- Albert Cardona http://albert.rierol.

Re: learning about AOT

2008-12-15 Thread Albert Cardona
> Wow, that's a lot of things that have to be in the classpath! > > In your example the namespace is fj.tests.process. > You say the classpath must contain: > 1) the "fj" directory > 2) the "process" directory > 3) the "classes" directory where the .class files will be written > > I would have gu

Re: DISCUSS: replace (rand)

2008-12-15 Thread Konrad Hinsen
On 15.12.2008, at 02:24, Mark H. wrote: >>(lazy-cons X1 (lazy-cons X2 (transform-to-gaussian uniform- >> rest)) > > Also much better -- the structs were ugly. Thanks for the nice > revision! In fact, this is a good test-case for the interface design for random- number generators. I