Re: ClojureCLR - clojure.contrib.repl-utils
Hello, On Sat, Oct 31, 2009 at 11:57 PM, dmiller wrote: > There is very little progress on clojure-clr.contrib. The process is > not that hard, just tedious. I can give hints to anyone who wants to > work on it. I plan to work on it next after finishing BigDecimal. Great. I'll try to get some work done on repl-utils. > I do see the issues tab on the github site. However, I've got > contributor status on that, so I may see things other don't. I don't > have admin capabilities on that site, so I can't enable it. That > would be up to Rich. > > I hope you can at least see the wiki tab. The issues tab is obviously right where it should be. I think I was looking at another repository when writing that email :-| > Regarding this specific issue, (apply (fn [] 1)) doesn't work in > ClojureJVM either, at least not the build I have. > > user=> (apply (fn [] 1)) > java.lang.IllegalArgumentException: Wrong number of args passed to: > core$apply (NO_SOURCE_FILE:0) Correct. My Clojure JVM version was a little (too) old, and ClojureCLR was fresh out of GitHub :-) Thanks, -- Miron Brezuleanu --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
update-proxy doc - what is "this" ?
user=> (doc update-proxy) - clojure.core/update-proxy ([proxy mappings]) Takes a proxy instance and a map of strings (which must correspond to methods of the proxy superclass/superinterfaces) to fns (which must take arguments matching the corresponding method, plus an additional (explicit) first arg corresponding to this, and updates (via assoc) the proxy's fn map. nil can be passed instead of a fn, in which case the corresponding method will revert to the default behavior. Note that this function can be used to update the behavior of an existing instance without changing its identity. nil user=> --- It says:"the first arg corresponding to this" What is meant with "this"? --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: update-proxy doc - what is "this" ?
msappler wrote: > user=> (doc update-proxy) > > It says:"the first arg corresponding to this" > > What is meant with "this"? "this" means the proxy object itself (like the "this" keyword in Java). --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
throw-if
There seems to be a bit of wasteful duplication in clojure: there's a private clojure.core/throw-if and there's clojure.contrib.except/throw-if. Making matters sillier, they have somewhat different argument lists. Probably they should be merged into a public clojure.core/throw-if. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
java.lang.ClassFormatError: Duplicate field name&signature in class file
Im having difficulties using gen-class in some cases (clojure.core/gen-class :name rcp.MyView :extends org.eclipse.ui.part.ViewPart :prefix "MyView362" :init init) (clojure.core/defn MyView362init [] [[] []]) (clojure.core/defn MyView362createPartControl [this parent] (println "HI")) (clojure.core/defn MyView362setFocus [this]) When i type in rcp.MyView i get an error java.lang.ClassFormatError: Duplicate field name&signature in class file Looking at the class expansion in eclipse, theres a duplicate init_var However, when i replace org.eclipse.ui.part.ViewPart with org.eclipse.core.commands.AbstractHandler there is no duplicate var. Whats going on here? --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Periodic tasks
John, Is like I am missing something? This thread mentioned making periodic tasks, there was a java example to it. However, what you posted I am yet to figure out how to make a periodic tasks possible. Regards, Emeka On Sat, Oct 31, 2009 at 6:27 PM, John Harrop wrote: > On Sat, Oct 31, 2009 at 12:36 PM, Luke VanderHart < > luke.vanderh...@gmail.com> wrote: > >> Why not just run an agent that does something, then calls sleep for N >> seconds, then calls the next thing? >> >> Granted, it will eat up a thread in your agent thread pool, but if >> you've only got one of these in the app it shouldn't be a problem. >> >> Or you could go the Java route, and start a daemon thread manually. > > > Or you could use send-off instead of send; send-off doesn't consume from a > finite thread pool and is thus suitable for long-running (or blocking, e.g. > I/O) tasks. > > Incidentally, if you ever want to simply reset the state of an agent to a > particular value, analogously to ref-set and reset!, this can work: > > (defn set-agent [a v] (send a (fn [_] v))) > > > > > --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Creating custom exceptions in clojure & gen--class use?
Hi folks, greetings from a beginning clojurian! Below a dilemma I noticed recently. I think/hope I've missed something, since what I am trying to do does not sound too exotic. Any clues are appreciated! I want to use my own exceptions to control program flow. I want to catch my own exceptions and let the surrounding container worry about other exceptions. In order to do this, I must catch my exceptions selectively by type name, say FooException. But how do I define a _named_ java class in clojure? Function proxy creates an anonymous class and I cannot refer to it in the catch expression! The only way I have managed to achieve this so far is to pre-compile the class using gen-class and a separate compilation step. While googling for solution I came across the old gen-and-load-class, which seemed to do the trick in the old days (?) but is there a current way do achieve the same? Looking for clues, Teemu --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: can I make this faster (and leaner) ?
Hello Sir, (def *valid-chars* (vec "abcdefghijklmnopqrstuvwxuz0123456789" )) This looks cleaner. Regards, Emeka On Sat, Oct 31, 2009 at 1:15 PM, John Harrop wrote: > On Fri, Oct 30, 2009 at 7:47 PM, DavidF wrote: > >> >> Try this: >> >> (def *valid-chars* [ \a \b \c \d \e \f \g \h \i \j \k \l \m >> \n \o \p \q \r \s \t \u \v \w \x \u \z >> \0 \1 \2 \3 \4 \5 \6 \7 \8 \9 ] ) >> >> (defn generate-key [keylength] >>(for [x (range keylength)] (nth *valid-chars* (rand-int (count >> *valid- >> chars*) > > > There's a perfectly good reusable function hidden in there: > > (defn rand-elt [coll] > (nth coll (rand-int (count coll > > (defn generate-key [key-length] > (for [x (range key-length)] (rand-elt *valid-chars*))) > > And you might want to wrap that for loop in (apply str ~the-loop). It also > might be more idiomatic to call *valid-chars* +valid-chars+ if it's not > normally going to be rebound or otherwise changed. > > (While we're on the topic of valid chars, how come the reader page > http://clojure.org/reader at clojure.org doesn't list as legal identifier > characters some characters that occur in identifiers in clojure.core? > Specifically, =, >, and <. > > > > --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Periodic tasks
On Sun, Nov 1, 2009 at 3:20 PM, Emeka wrote: > John, > > Is like I am missing something? This thread mentioned making periodic > tasks, there was a java example to it. However, what you posted I am yet to > figure out how to make a periodic tasks possible. > Agents can perform periodic tasks, if under some conditions they send to themselves. Also, in my earlier post I linked to another post of mine. The pq-agent-jobs and ppq-agent-jobs there allow giving agents jobs that are done in an order determined by a priority queue instead of in the order the jobs were enqueued. In another thread I posted "actor" code that explicitly set up jobs to be done periodically: http://groups.google.com/group/clojure/msg/b20c9390046b9746 --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Creating custom exceptions in clojure & gen--class use?
On Nov 1, 8:47 pm, Teemu Antti-Poika wrote: > I want to use my own exceptions to control program flow. I want to > catch my own exceptions and let the surrounding container worry about > other exceptions. In order to do this, I must catch my exceptions > selectively by type name, say FooException. But how do I define a > _named_ java class in clojure? Function proxy creates an anonymous > class and I cannot refer to it in the catch expression! If you don't need to expose these exceptions to Java you could look into clojure.contrib.error-kit, which allows for much nicer error handling and includes facilities to create named hierarchical errors. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Creating custom exceptions in clojure & gen--class use?
On Sun, Nov 1, 2009 at 3:47 PM, Teemu Antti-Poika wrote: > > Hi folks, > > greetings from a beginning clojurian! > > Below a dilemma I noticed recently. I think/hope I've missed > something, since what I am trying to do does not sound too exotic. Any > clues are appreciated! > > I want to use my own exceptions to control program flow. That's usually not a very good idea. What exactly are you trying to do, for which this would be useful? --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Periodic tasks
Maybe I'm confused, but can't you just do a regular java thread for this? (defn periodicly [fun time] "starts a thread that calls function every time ms" (let [thread (new Thread (fn [] (loop [] (fun) (Thread/sleep time) (recur] (.start thread) thread)) (periodicly #(println "foo foo foo") 3000) I'm not really sure about the error handling thing, but I guess you could wrap the function in a try-catch where it reinitialized itself. (although I guess that could get dangerous if you start throwing a lot of errors). On Oct 29, 11:05 pm, Stefan Arentz wrote: > What is a good and simple way to run periodic tasks in Clojure? I need > to run a simple function every couple of minutes. And make sure that > if it throws an exception that it won't kill the periodic task. > > I come from a Spring world where XML, Timers, Jobs and Quartz rule the > world, so am hoping for something small and elegant for Closure :-) > > S. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
clojure parser
Is there any way to access the clojure parser, i.e. something that gives you all the elements contained in an expression? I.E. (parse (+ 1 2)) would give you something like [:list [[:symbol +] [:literal 1] [:literal 2]]]. Thanks, Nick. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: clojure parser
nchubrich wrote: > Is there any way to access the clojure parser, i.e. something that > gives you all the elements contained in an expression? I.E. (parse (+ > 1 2)) would give you something like [:list [[:symbol +] [:literal 1] > [:literal 2]]]. Do you mean the reader? user=> (read-string "(+ 1 2)") (+ 1 2) user=> (first (read-string "(+ 1 2)")) + user=> (type (first (read-string "(+ 1 2)"))) clojure.lang.Symbol user=> (type (second (read-string "(+ 1 2)"))) java.lang.Integer Or perhaps quote is what you're looking for? user=> (second '(+ 1 2)) 1 There's no need for a syntax like [:list [[:symbol +]]] etc as (+ 1 2) literally is just a list of a symbpl and two Integers, you just need to use quote to tell Clojure not to evaluate it. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: clojure parser
Thanks, that's exactly what I was looking for. I didn't realize you could use read like that. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Is it possible to implement break or return in Lisp?
Hi, For the purposes of a DSL that I'm writing, it would be very convenient to have a break/return statement that early exits from a subroutine. Is it possible to implement this in Clojure? or any Lisp-like language? I've given it some thought and it seems it has to be a compiler level feature. Am I right? Thanks -Patrick --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
A couple questions about the language
1. Can I have compile time evaluation forms like in Lisp? For example, I want to obtain current namespace during macro expansion, or make Java imports in compile time. Is it possible? 2. Can I precompile Clojure code (not generated classes) and load precompiled version instead of text script? Thanks. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Creating custom exceptions in clojure & gen--class use?
Hi, Am 01.11.2009 um 20:47 schrieb Teemu Antti-Poika: > The only way I have managed to achieve this so far is to pre-compile > the class using gen-class and a separate compilation step. While > googling for solution I came across the old gen-and-load-class, which > seemed to do the trick in the old days (?) but is there a current way > do achieve the same? gen-class is what you are looking for. You can also use clojure.contrib.condition, but that also requires a compilation step. Be aware: you have to compile the class only once! As long as you don't change the signatures, you can redefine the underlying clojure code for the methods as you like without the need of recompilation. So compilation is a very weak argument against a solution if it solves your problem. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: Is it possible to implement break or return in Lisp?
> I've given it some thought and it seems it has to be a compiler level > feature. Am I right? You could implement Common Lisp-style "return-from" with a custom exception class: public class BlockException extends Exception { String name; Object val; public BlockException(String name, Object val) { this.name = name; this.val = val; } public String name() { return this.name; } public Object value() { return this.val; } } (defmacro block [name & body] `(try (do ,@body) (catch BlockException e (if (= (.name e) (name ,name)) (.value e) (throw e) (defmacro return-from [name expr] `(throw (BlockException. (name ,name) ,expr))) Then use it: (defn foo [] (block outside (do-something ;; ... (return-from outside 5) ;; ... ))) --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A couple questions about the language
> 1. Can I have compile time evaluation forms like in Lisp? For example, > I want to obtain current namespace during macro expansion, or make > Java imports in compile time. Is it possible? You can evaluate whatever you like at macroexpansion time. I don't think there's an equivalent to eval-when, but you can check the value of *compile-files*: clojure.core/*compile-files* nil Set to true when compiling files, false otherwise. Clojure always compiles (just like SBCL). > 2. Can I precompile Clojure code (not generated classes) and load > precompiled version instead of text script? http://clojure.org/compilation --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A couple questions about the language
Andrew wrote: > 1. Can I have compile time evaluation forms like in Lisp? For example, > I want to obtain current namespace during macro expansion, or make > Java imports in compile time. Is it possible? Unless I'm misunderstanding what you want, sure. Just access *ns* or (import 'whatever) in your macro. Also anything that is at the top-level (not in a function) will be called at compile-time (eg put in println at the top-level and compile it and the compiler will print something out). > 2. Can I precompile Clojure code (not generated classes) and load > precompiled version instead of text script? Sure. If your source file is called foo.clj (and is the in the classpath) just do (compile 'foo) and Clojure will spit out a compiled version. Put the compiled version in the classpath and then you can (use 'foo) just as if it were source code. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Creating custom exceptions in clojure & gen--class use?
it'd be nice if clojure came with an Exception class that extended IMeta so you could use (catch MetaException e (if (= :my-exception (type e)) do-stuff (throw e))) On Sun, Nov 1, 2009 at 1:07 PM, Meikel Brandmeyer wrote: > Hi, > > Am 01.11.2009 um 20:47 schrieb Teemu Antti-Poika: > > >> The only way I have managed to achieve this so far is to pre-compile >> the class using gen-class and a separate compilation step. While >> googling for solution I came across the old gen-and-load-class, which >> seemed to do the trick in the old days (?) but is there a current way >> do achieve the same? > > gen-class is what you are looking for. You can also use > clojure.contrib.condition, but that also requires a compilation step. > > Be aware: you have to compile the class only once! As long as you > don't change the signatures, you can redefine the underlying clojure > code for the methods as you like without the need of recompilation. So > compilation is a very weak argument against a solution if it solves > your problem. > > Sincerely > Meikel > > -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Creating custom exceptions in clojure & gen--class use?
> it'd be nice if clojure came with an Exception class that extended > IMeta so you could use (catch MetaException e (if (= :my-exception > (type e)) do-stuff (throw e))) Indeed. A couple of little macros later (catch-type?), and maybe adding additional values into the metadata, and the need for generating exception classes is greatly reduced. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Periodic tasks
On Sun, Nov 1, 2009 at 7:39 PM, Jonathan Smith wrote: > > Maybe I'm confused, but can't you just do a regular java thread for > this? > > (defn periodicly [fun time] > "starts a thread that calls function every time ms" > (let [thread (new Thread (fn [] (loop [] (fun) (Thread/sleep time) > (recur] >(.start thread) >thread)) > > (periodicly #(println "foo foo foo") 3000) > > I'm not really sure about the error handling thing, but I guess you > could wrap the function in a try-catch where it reinitialized itself. > (although I guess that could get dangerous if you start throwing a lot > of errors). The actor code makes it easy to start, stop, and modify the periodic task and not just to start it. :) --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to implement break or return in Lisp?
On Sun, Nov 1, 2009 at 9:14 PM, Richard Newman wrote: > > > I've given it some thought and it seems it has to be a compiler level > > feature. Am I right? > > You could implement Common Lisp-style "return-from" with a custom > exception class: > > public class BlockException extends Exception { > String name; > Object val; > public BlockException(String name, Object val) { > this.name = name; > this.val = val; > } > public String name() { return this.name; } > public Object value() { return this.val; } > } > > (defmacro block [name & body] > `(try > (do ,@body) > (catch BlockException e >(if (= (.name e) (name ,name)) > (.value e) > (throw e) > > (defmacro return-from [name expr] > `(throw (BlockException. (name ,name) ,expr))) > > > Then use it: > > > (defn foo [] > (block outside > (do-something > ;; ... > (return-from outside 5) > ;; ... > ))) For this to work, you'd first have to implement Common Lisp style unquoting. :) --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to implement break or return in Lisp?
Thanks for the pointer! I haven't considered using Exceptions to influence the control-flow. This will work perfectly. -Patrick PS: I've always found it a little strange for exception-handling to be treated as a special case in language design. It seems like it ought able to be expressed in terms of some simpler elements (eg. a function return). Is there a book or article that discusses this? --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to implement break or return in Lisp?
Maybe could be done using continuation passing style? (http:// en.wikipedia.org/wiki/Continuation-passing_style) On Nov 1, 7:04 pm, CuppoJava wrote: > Hi, > For the purposes of a DSL that I'm writing, it would be very > convenient to have a break/return statement that early exits from a > subroutine. > > Is it possible to implement this in Clojure? or any Lisp-like > language? > > I've given it some thought and it seems it has to be a compiler level > feature. Am I right? > > Thanks > -Patrick --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to implement break or return in Lisp?
CuppoJava writes: > I've always found it a little strange for exception-handling to be > treated as a special case in language design. It seems like it ought > able to be expressed in terms of some simpler elements (eg. a function Note sure exactly what you want, but you could try Lisp in Small Pieces by Christian Queinnec. If I remember right he talks about exceptions in terms of continuations. Or you could just start reading up on continuations if you're not familiar with them. Wikipedia has a call/cc page at http://en.wikipedia.org/wiki/Call-with-current-continuation Cheers, Chris Dean --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to implement break or return in Lisp?
> For this to work, you'd first have to implement Common Lisp style > unquoting. :) Heh, good catch :) I've been switching between the two too much recently! At least I didn't miss out the semicolons in the Java code ;) --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to implement break or return in Lisp?
On Mon, Nov 2, 2009 at 12:19 AM, Richard Newman wrote: > > > For this to work, you'd first have to implement Common Lisp style > > unquoting. :) > > Heh, good catch :) > > I've been switching between the two too much recently! > > At least I didn't miss out the semicolons in the Java code ;) I'd be more worried about the parentheses, or switching the order of the object and method. When I need to drop down to Java it always seems like "for ..." is naked without an open parenthesis first. --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: java.lang.ClassFormatError: Duplicate field name&signature in class file
Looking at this again, i notice that ViewPart is an abstract class. Can we extend these ? --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
ClojureCLR: out parameters
Hello, One question about CLR interop: what is the correct way to handle 'out' parameters in Clojure code? The following doesn't work: Clojure 1.1.0-alpha-SNAPSHOT user=> (def a (DateTime.)) #'user/a user=> (DateTime/TryParse "2009/10/20" a) True user=> a 1/1/0001 12:00:00 AM user=> I guess TryParse creates another instance of a DateTime, and the instance passed via 'a' is left unmodified. I believe the same problem applies to 'ref' parameters. Thanks, -- Miron Brezuleanu --~--~-~--~~~---~--~~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---