Re: AOT/gen-class docs

2008-12-02 Thread Chouser
amic classloader stuff still going on? --Chouser --~--~-~--~~~---~--~~ 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 gro

Re: Accept RE Pattern in (find-doc ...)?

2008-12-02 Thread Chouser
"in addition to the String" is important --Chouser --~--~-~--~~~---~--~~ 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

Re: Serializing Clojure objects

2008-12-02 Thread Chouser
gular 'read' function can read these *print-dup* strings to reproduce the original structure, a.k.a. deserialize: (def my-data (with-in-str my-string (read))) --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Building regex pattern literals (Noob question)

2008-12-03 Thread Chouser
xample: user=> (re-seq (re-pattern (str "a" ".*")) "bab") ("ab") But remember that you may need extra backslashes inside the "string" parts, compared to the equivalent #"regex" literal. Or if each piece of your regex can stand alone, you could tak

reduction

2008-12-05 Thread Chouser
Google groups files section is having issues. Here's 'reduction' as discussed in IRC, mostly written by Rich. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: reduction

2008-12-05 Thread Chouser
On Fri, Dec 5, 2008 at 10:50 AM, Chouser <[EMAIL PROTECTED]> wrote: > Google groups files section is having issues. > Here's 'reduction' as discussed in IRC, mostly written by Rich. I messed it up anyway -- tried to use if-let too early. Try thi

Re: Atoms

2008-12-05 Thread Chouser
On Fri, Dec 5, 2008 at 11:07 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > I'm working on that. It has utility even outside traditional reactive > contexts, in moving the imperative part of your logic outside of your state > transformation function. I think it'

Re: reduction

2008-12-05 Thread Chouser
Third time's charm? The previous versions of 'reduction' returned nil for empty collection when no init was given. This version follows 'reduce' more closely, calling the given function with no arguments: user=> (re

Re: reduction

2008-12-05 Thread Chouser
On Fri, Dec 5, 2008 at 9:55 PM, Chouser <[EMAIL PROTECTED]> wrote: > Third time's charm? Apparently not. Previous versions had a couple problems. One was that when when no init was provided, the first element of the collection was not emitted by itself. This is inconsistent

Re: reduction

2008-12-05 Thread Chouser
azy-cons (first coll) (map f (reduction f coll) (rest coll))) (cons (f) nil))) ([f init coll] (lazy-cons init (map f (reduction f init coll) coll --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: reduction

2008-12-06 Thread Chouser
ack frames for the nth result? Anyway, either of the definitions presented together work fine for large collections and appear to operate in O(n) as you'd expect. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Re: Running out of memory when using filter?

2008-12-06 Thread Chouser
a > giant chain of lazy-conses: > > clojure.core$filter__3364$fn__3367 This may not be worth much, but can you see the data members of that object? It's not itself the head of a cons chain, presumably, so I'm wondering if the data member that *is* at t

Re: Zipper & Local Context?

2008-12-06 Thread Chouser
") > java.lang.ClassCastException: clojure.lang.LazyCons cannot be cast to > clojure.lang.IFn (zipper-test.clj:35) > > > What might explain this? Hard to guess with just a single line from a stack trace on an unknown .clj file, but I wouldn't be shocked if

Re: Clojure Blogs | Yahoo Pipes | Clojure Pipe

2008-12-06 Thread Chouser
bsorbed, though, I noticed that although my blog appears to be included in that diagram, none of my blog posts appear in the feed. I couldn't figure out how to examine the pipe to see the source of the problem. --Chouser --~--~-~--~~~---~--~~ You received this

Re: Running out of memory when using filter?

2008-12-06 Thread Chouser
the head of the seq. Fixing this is hard becasue RT.count() is holding onto the head as well. I've attached a patch that fixes the problem, but it's pretty ugly, perhaps only useful to demonstrate that this is the problem. --Chouser --~--~-~--~~~---~--~---

Re: List comprehension: :when AND :while for the same binding?

2008-12-08 Thread Chouser
thinking is that if the :while is false, there's no need to check the :when. Is this Good, and should 'for' work the same way? --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure&quo

Re: List comprehension: :when AND :while for the same binding?

2008-12-08 Thread Chouser
On Mon, Dec 8, 2008 at 10:42 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > On Dec 8, 10:08 am, Chouser <[EMAIL PROTECTED]> wrote: >> >> doseq currently supports both. If both appear on the same binding, >> the :while is always test first regardless of the

Re: Patch to add doc string support to defmulti [Was: (doc)strings after param in defn]

2008-12-08 Thread Chouser
'foo {:tag clojure.lang.MultiFn, :name foo, :file "NO_SOURCE_FILE", :ns #, :line 1, :b 2, :a 1} I'm not offering an opinion here on whether or not it's a good patch, just wanted to point out it changes currently defined behavior. --Chouser --~--~-~--~~

Re: List comprehension: :when AND :while for the same binding?

2008-12-08 Thread Chouser
On Mon, Dec 8, 2008 at 10:42 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > On Dec 8, 10:08 am, Chouser <[EMAIL PROTECTED]> wrote: >> >> doseq currently supports both. If both appear on the same binding, >> the :while is always test first regardless of the

Re: My quest to modify a leaf node in an arbitrarily deep map (question posed)

2008-12-10 Thread Chouser
our code looks fine -- nearly identical to 'assoc-in' in fact. It does the destructuring right in the function arguments, but everything else is merely stylistic differences. --Chouser --~--~-~--~~~---~--~~ You received this message because you are su

Re: My quest to modify a leaf node in an arbitrarily deep map (question posed)

2008-12-10 Thread Chouser
r XML and act as if you wrote: (xml-> atom1 (tag= :entry) (tag= :author) (tag= :name) text) A primary benefit of not having a special syntax is that it's easy to drop in custom filtering and mapping functions. For example, get the titles of atom entr

Re: In core structure editor, anyone?

2008-12-10 Thread Chouser
eeply committed to emacs or vim. It already has an 'open' function to pull up the source of a function in the edit pane. I'm not ready to provide a link yet, but go ahead and ask me in a few weeks how "textjure" is coming along. --Chouser --~--~-~--~~-

Re: In core structure editor, anyone?

2008-12-10 Thread Chouser
On Wed, Dec 10, 2008 at 4:01 PM, J. McConnell <[EMAIL PROTECTED]> wrote: > > On Wed, Dec 10, 2008 at 3:35 PM, Chouser <[EMAIL PROTECTED]> wrote: >> >> It's by no means emacs *or even vim* yet > > Ouch, that hurts ;) I'm a vim user, but although I do

Re: defining keywords ?

2008-12-11 Thread Chouser
namespace-qualified: user=> (namespace :foo) nil user=> (namespace :my-ns/foo) "my-ns" user=> (namespace ::foo) "user" The idea of using this feature to specify XML namespaces has been discussed. Rich even adjusted the reader rules to allow fully-qualified URLs as

Re: Purpose of memfn?

2008-12-11 Thread Chouser
t; "short" "message"]) > -> ("A" "SHORT" "MESSAGE") > > Are they cases where we cannot use the second form and the first is > required? 'memfn' predates the #(...) syntax and is unnecessary now, I think. --Chouser --~--~

Re: XML Namespaces :xmlns, was Re: xml/parse

2008-12-12 Thread Chouser
f this. I think it's often desirable to also maintain (somewhere) the original document's shortcut names, and use those where applicable when emitting XML text again. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Safe to delete namespace dirs in clojure-contrib?

2008-12-12 Thread Chouser
he namespace-is- > file change. Are people still using releases that require the old > contrib directories, or can we safely delete them? +1 The dirs are a bit confusing, and people can always get an old svn revision if they really must. --Chouser --~--~-~--~~~-

Re: re-gsub improvement

2008-12-12 Thread Chouser
This is good! Please send in your Contributor Agreement so this patch can be checked in. http://clojure.org/contributing --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to th

Updated 'show' and 'source'

2008-12-12 Thread Chouser
ms in coll for which (pred item) returns true. pred must be free of side-effects." [pred coll] (when (seq coll) (if (pred (first coll)) (lazy-cons (first coll) (filter pred (rest coll))) (recur pred (rest coll) nil u

Re: performance question

2008-12-13 Thread Chouser
uf (BufferedReader. (InputStreamReader. System/in))] (let [words (for [line (line-seq buf)] (.split line " "))] (print-words (sort-words (reduce read-words {} words)) (time (read-input)) --Chouser --~--~-~--~~~---~--~~ You received this

Re: Updated 'show' and 'source'

2008-12-13 Thread Chouser
your classpath for 'source' to work. I thought that they were no longer included in the clojure.jar, but checking just now they appear to still be there. Anyway, if 'source' prints "Source not found" for a Var you know to be defined an

Re: (con)current confusion

2008-12-14 Thread Chouser
ion you're sending to each agent. If you were maintaining a reference to each agent, you'd be able to dereference any of them and see it has errors: user=> (def x (agent nil)) #'user/x user=> @x nil user=> (send-off x nil) # user=> @x java.lang.Exception: Agent has

Re: (con)current confusion

2008-12-14 Thread Chouser
t; (dosync (commute year inc > (report) Note that you've now got popsize*9 agents, and the actions in your vector are not guaranteed to happen in order for any given 'i' -- I don't know if that matters to you or not. --Chouser --~--~-~--~~~-

Clojure classes graph (was chart.png)

2008-12-14 Thread Chouser
ed to create them: http://github.com/Chouser/clojure-classes/tree/master For a quick link to the main graphic, you can use: http://tinyurl.com/clojure-classes I won't be maintaining the chart.png in the file upload area of this group, since it's much easier to just push new version

Re: test-is source

2008-12-14 Thread Chouser
clj used by anything > or is it obsolete code? It's obsolete and has been removed from the latest version of clojure-contrib. See clojure/contrib/test_is.clj for the latest version of that lib. --Chouser --~--~-~--~~~---~--~~ You received this message

Re: Problem with XML attributes and HTML entities

2008-12-14 Thread Chouser
does not re-encode them: Good catch. I've added a fix to clojure.contrib.lazy-xml (svn 300), but the issue is still open for clojure.xml --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure&quo

Re: Clojure classes graph (was chart.png)

2008-12-15 Thread Chouser
nterfaces. --Chouser --~--~-~--~~~---~--~~ 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 group, send email to clojure+unsubscr.

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. D

Re: understanding quoting

2008-12-15 Thread Chouser
user=> ('+ '1) nil user=> ('+ '1 '2 '3) java.lang.IllegalArgumentException: Wrong number of args passed to: Symbol (NO_SOURCE_FILE:0) user=> ('b '{a 10, b 11, c 12}) 11 --Chouser --~--~-~--~~~---~--~~ You received this mes

Re: in-ns + refer

2008-12-15 Thread Chouser
he 'ns' macro (depending on whether you specify :refer-clojure or not). However 'in-ns', 'refer', 'require', and 'use' are lower-level functions and for use in the REPL. --Chouser --~--~-~--~~~---~--~~ You received this

Re: 'require' doc string out of date?

2008-12-16 Thread Chouser
ource /x/y/z.clj. The root resource should contain code to create the lib's namespace and load any additional lib resources. In general, clojure-contrib is a good place to look to find examples of properly laid-out libs, as well as generally idiomatic Clojure code. --Chouser --~--~---

Re: Does ANTS.CLJ still work?

2008-12-16 Thread Chouser
On Mon, Dec 15, 2008 at 11:54 AM, Peter Wolf wrote: > > I get the following error when I try ANTS.CLJ. Has something changed? Recent Clojure from SVN and a recent download of ants.clj from the google group seem to work fine together for me. --C

Re: Problems with "gen-and-load-class" (defn user-exception-test [] (try (throw (new user.UserException "msg: user exception was here!!")) (catch user.UserException e (prn "caught exception" e)) (fina

2008-12-16 Thread Chouser
message "java.lang.Exception: Unable to > resolve symbol: gen-and-load-class in this context (throwException.clj: > 1)". > > I have tried to load the file "clojure-path/classes/clojure/ > genclass.clj" but I still cannot use "gen-and-load-class". > > Can anyo

Re: FAQ

2008-12-17 Thread Chouser
know weren't really claiming otherwise, it's just a possible point of confusion. Perhaps: Answer: Because it expands to "(fn [x] ([x]))". #() always expands to include parens around the expression you give it. You might try #(vector x) instead. --Chouser --~--~-~--~~

Re: reload library, blowing away old public symbols

2008-12-17 Thread Chouser
;~ns s#))) >> > > (require :reload-all '~ns))) This has come up before: http://clojure-log.n01se.net/date/2008-11-04.html#13:59 Do you want to remove only the public vars, or all of them? (defn ns-unmap-all [nspc] (doseq [[n v] (ns-interns nspc)] (ns-unmap nspc n)))

Re: Listen on changes to refs

2008-12-17 Thread Chouser
ou answer this question as well. --Chouser --~--~-~--~~~---~--~~ 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 th

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

2008-12-17 Thread Chouser
On Wed, Dec 17, 2008 at 2:10 PM, Randall R Schulz wrote: > > Since Chouser asked on #clojure which REPL (I was using the Contrib > REPL), I tried this with the stock REPL and the hang does not occur. Specifically, this line causes the JVM to shut down, even if there are agent threads

Re: A quasiquote for Clojure?

2008-12-17 Thread Chouser
efined by Clojure, so still an error if allowed > to get evaluated. > > Things like your sql would be macros that handled (unquote x) > internally. I very much like the sound of this. +1 --Chouser --~--~-~--~~~---~--~~ You received this message because

Re: code golf

2008-12-17 Thread Chouser
gt; greatly improved on. I don't really care for the extremely obfuscated > examples. Sure, it's neat how far Perl can take things, but it's > gibberish to me. I tried to follow a middle ground between terse and > readable and constrained myself to Clojure only (no con

Re: code golf

2008-12-17 Thread Chouser
On Wed, Dec 17, 2008 at 9:53 PM, Mark Engelberg wrote: > > This shaves 14 characters off of Chouser's solution: > (defn enc[s e](apply str(map(apply hash-map(take-nth 2 e))s))) Very nice! --Chouser --~--~-~--~~~---~--~~ You received this message b

Re: code golf

2008-12-17 Thread Chouser
ake-nth 2 e)}s))) But here's a form that works, oddly, and still manages to shave off a couple chars: (defn enc[s e](apply str(map`{0~@(cons 0(take-nth 2 e))}s))) --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Re: (Ab)using agents for inter-process communication

2008-12-18 Thread Chouser
ads used by 'send' doesn't grow with demand, so too many blocking threads could cause new 'send' calls to queue up unnecessarily. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group

Re: Persistent storage

2008-12-18 Thread Chouser
r now it seems we'll have to make do with "normal" mechansims like SQL libraries. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Re: REPL Namespace Display

2008-12-18 Thread Chouser
7;user) > # > howdy> > > Switching to another ns corrects it. We now have several Repls, and each acts slightly differently. I couldn't reproduce this with clojure.lang.Repl. I'm guessing from your prompt that you're using emacs/slime. Is that correct? --Chouser --~--~

Re: groups-of

2008-12-19 Thread Chouser
272 587273) >> (587273 587274) user=> java.lang.OutOfMemoryError: Java heap space > [...] > > Actually, I suppose that's because it's printing the whole thing out? It's easy enough to test: user=> (nth (partition 2 1 (iterate inc 1)) 1000) (1001 1002) --Chous

Re: Listen on changes to refs

2008-12-19 Thread Chouser
'await' for now. Another option, as long as you don't tell Rich, is that you could abuse the validator function to send to your agent. Anyway, apparently watchers for Refs are planned, so you could just wait for that. --Chouser --~--~-~--~~~---~--~~

Re: multiple sets on one item - is this a good idea?

2008-12-20 Thread Chouser
tions from some other already-loaded namespace into your current namespace. 'use' does both in one step (use can use the :verbose flag to see it do this) All of these are for working with namespaces defined via Clojure code. 'import' is different in that it

Re: multiple sets on one item - is this a good idea?

2008-12-20 Thread Chouser
just the docs. Regardless, this is a good explanation. As far as I can tell, libs aren't really documented anywhere (besides in the docs strings for 'ns' and the various helper function). If I've missed it somewhere, please correct me, but I

Re: Functional way to implement a VM?

2008-12-22 Thread Chouser
o do) itself, and then return the whole new state. --Chouser --~--~-~--~~~---~--~~ 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 u

Re: jEdit Mode for Clojure

2008-12-22 Thread Chouser
me. However, the set of internal escape sequences recognized by each are different. For example \w means 'whitespace' in a regex (and is colored differently from the rest of the regex by vim in perl code) but is currently illegal in a Clojure string. --Chouser --~--~-~--~~---

Re: Exercise: how to print multiplication table?

2008-12-22 Thread Chouser
seqs separately is much of a win. This combines the entire operation into a single function: (defn multiplication-table-string [n] (let [r (range 1 (inc n))] (apply str (for [y r] (apply str (concat (for [x r] (format "% 3d" (* x y))) ["\n&quo

Re: Behavior of equals (==) w/r/t keywords

2008-12-22 Thread Chouser
s names, aliases, etc. > "Symbols and keywords have two parts: a namespace part, which may be > nil or a string; and a name part, which is a string." I tried very very hard, but couldn't find anything to complain about for this one. :-) Thanks for taking the initiative, Stuart. --Ch

Re: transaction failed after retry limit

2008-12-23 Thread Chouser
ask-switching overhead, or anything ugly like that. In short, it's ok to have a lot of agents, and to queue up a lot of work for them. 'send-off' uses a different thread pool that does grow the more 'send-off's you do. I don't know its exact performance profile, b

Re: Best practice for handling errors inside macros?

2008-12-23 Thread Chouser
ay to get the error at compile time is to eval the args -- and is that still compile time? Anyway, I'd agree that for (B) something like option (1) (but without the quoted args) would be the best. > Or is it considered bad form to throw exceptions at mac

Re: A quasiquote for Clojure?

2008-12-23 Thread Chouser
s this. > > Feedback welcome on its utility for macro writers. Here's an example of one way to use it: user=> (where (and (> i (- 3 1)) (< i ~(+ 3 1 "where i > 3 - 1 and i < 4" user=> (let [my-name "'chouser'"] (where (and (> id 0)

Re: Proxying in clojure

2008-12-23 Thread Chouser
I've also updated the code for "modern" Clojure, including stylistic changes, plus some other changes that turned out to be mostly gratuitous. Anyway, here it is. To run: java -cp clojure.jar clojure.lang.Repl snake.clj --Chouser --~--~-~--~~~-

Re: Proxying in clojure

2008-12-24 Thread Chouser
nsidered it, but wasn't sure it was right. There are two mutable objects, after all -- do they not need to be coordinated? I realize that in a program like this it doesn't really matter, and maybe that's part of my problem. Great use of :grow instead of 'true' when calli

Re: Proxying in clojure

2008-12-25 Thread Chouser
On Thu, Dec 25, 2008 at 5:52 PM, Emeka wrote: > Exception in thread "AWT-EventQueue-0" > java.lang.UnsupportedOperationException: keyReleased It was to avoid this exception that my version included an empty implementation of keyRele

Re: Proxying in clojure

2008-12-26 Thread Chouser
On Fri, Dec 26, 2008 at 4:40 AM, Emeka wrote: > Chooser, "Chouser" > Please send me yours then. Already did: http://groups.google.com/group/clojure/msg/4f00d2a3b5da8444 And Mr. Gilardi improved on it here: http://groups.google.com/group/clojure/msg/90316675320

Re: Exercise: words frequency ranking

2008-12-28 Thread Chouser
ooked like: (ns word-count (:require [clojure.contrib.duck-streams :as ds])) ...and later... (ds/spit ...) --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: take 1 element from each coll, make all possible strings?

2008-12-28 Thread Chouser
; form for use within the function. This allows the (slightly repetitive) pattern: (defn str-up-to [n] (let [foo (fn foo [i] (str i "," (when (< i n) (foo (inc i)] (foo 0))) Note there are much better ways to do th

Re: Parallel words frequency ranking

2008-12-28 Thread Chouser
this can generally be done with Ctrl-D. In a Script, use (shutdown-agents). I imagine this ought to be done by the same level of code that calls parallel-top-words, since p-t-w itself can't know that no other agent work is being done. --Chouser --~--~-~--~~~--

Re: Accessing "this" in gen-class constructor

2008-12-29 Thread Chouser
idding. Note that because I didn't use a mutable object for myState, (instead using the string "this is my state"), there's no way to change the value of myState. user=> (compile 'net.n01se.MyThread) net.n01se.MyThread user=> (def x (net.n01se.MyThread.))

Re: making code readable

2008-12-29 Thread Chouser
Conversely, tutorial-style code may be very useful in appropriate contexts, but is hardly ever fun to write. ...and now this post is at an extreme of the verbosity scale. Sorry all, I'll quit now before I get any further behind. --Chouser --~--~-~--~~~---~--~--

Re: making code readable

2008-12-29 Thread Chouser
I also was careful to refer to the global nature of the Vars, not anything about const-ness. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: Accessing "this" in gen-class constructor

2008-12-29 Thread Chouser
u do this in Clojure? The example I posted does exactly this -- the name of all MyThreads start as "my derived class" as demonstrated by: user=> (.getName x) "my derived class" --Chouser --~--~-~--~~~---~--~~ You received this message becaus

Re: 12 Days of Christmas in idiomatic(?) clojure

2008-12-29 Thread Chouser
uses a single StringBuilder internally when given more than 1 argument, so it's much more efficient to call (apply str foo) than (reduce str foo) for large collections. user=> (time (last (reduce str (range 3 "Elapsed time: 5570.028441 msecs" \9 user=> (time (last (ap

Re: In core structure editor, anyone?

2008-12-30 Thread Chouser
On Tue, Dec 30, 2008 at 1:24 AM, falcon wrote: > > How's textjure coming along? Not ready yet. :-/ Current sub-project: setting up sufficiently flexible system to handle vi-style keybindings. --Chouser --~--~-~--~~~---~--~~ You received this mess

Re: Accessing "this" in gen-class constructor

2008-12-30 Thread Chouser
:-) As far as I know, this is not currently possible with gen-class. Seems like you'd need some kind of post-constructor hook, provided just to deal with mutable state of the base class. I wonder if Rich would accept a patch providing an :after-ctor option to gen-class. --Chouser --~-

Re: send-off *agent* #' func

2008-12-30 Thread Chouser
ded for self-sending agents: user=> (defn act [i] (Thread/sleep 1000) (prn i) (send-off *agent* act) (inc i)) #'user/act user=> (send-off (agent 100) act) # user=> 100 101 102 103 (defn act [i]) #'user/act user=> 104 After the manual 'send-off', a number was printe

Re: metaprogramming: finding function arity and other information about the envrionment

2008-12-30 Thread Chouser
l) (if (pred (first coll)) (lazy-cons (first coll) (filter pred (rest coll))) (recur pred (rest coll) --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To p

Re: what's the new syntax for (dotimes _ (apply f [i]) (print "*")) ?

2008-12-31 Thread Chouser
e distracting _ and the extra 'println', and also allows us to use the optional args for 'range': (plot #(* % %) 8) --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojur

Re: Local mutually recursive functions?

2009-01-01 Thread Chouser
(if (zero? i) true (my-odd? (dec i)) (my-odd? 4)) Ick. But perhaps a macro could make style less terrible to use? --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &qu

Re: Trivial use of pmap results in RejectedExecutionException ?

2009-01-01 Thread Chouser
ge 0 10)) Works for me, SVN 1193 --Chouser --~--~-~--~~~---~--~~ 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 group

Re: Local mutually recursive functions?

2009-01-01 Thread Chouser
On Thu, Jan 1, 2009 at 6:40 PM, Christian Vest Hansen wrote: > > On Thu, Jan 1, 2009 at 11:48 PM, Chouser wrote: >> >> On Thu, Jan 1, 2009 at 2:47 PM, Rock wrote: >>> >>> Given that there's nothing like letrec in Clojure, and that let acts >>&

shelling out, convenience function for Runtime.exec()

2009-01-01 Thread Chouser
I've added shell-out to clojure-contrib, with an 'sh' function that allows usage like: user=> (use '[clojure.contrib.shell-out :only (sh)]) nil user=> (print (sh "ls" "-l")) total 1316 drwxrwxr-x 5 chouser chouser 4096 2008-12-16 11:32 classes d

Re: What is this function called?

2009-01-02 Thread Chouser
(9 10 11 12 13) (10 11 12 13 14)) For this particular example, you could use 'partition': (take 10 (partition 5 1 (iterate inc 1))) > Does this fn already exist in clojure? If not what would an idiomatic name > be for it from Has

Re: reduction

2009-01-02 Thread Chouser
is isn't in clojure.core yet (any reason why not?) so would you mind if I add it to clojure.contrib.seq-utils? Or of course you can do it if you prefer. :-) --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group

Re: Release of VimClojure 1.3.0

2009-01-02 Thread Chouser
On Thu, Jan 1, 2009 at 11:23 AM, Meikel Brandmeyer wrote: > a long overdue release of VimClojure is available. Thanks, works great! --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure&qu

Re: literate snake

2009-01-02 Thread Chouser
worse than a lack of comments, especially in code meant to teach. --Chouser --~--~-~--~~~---~--~~ 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 uns

Re: literate snake

2009-01-02 Thread Chouser
n Fri, Jan 2, 2009 at 4:47 PM, Mark Volkmann wrote: > > On Fri, Jan 2, 2009 at 3:09 PM, Chouser wrote: >> >> On Fri, Jan 2, 2009 at 4:05 PM, Tom Ayerst wrote: >>> That def inside a function doesn't look right but I'm a noob at this too. I >>>

Re: literate snake

2009-01-02 Thread Chouser
On Fri, Jan 2, 2009 at 5:20 PM, Mark Volkmann wrote: > > On Fri, Jan 2, 2009 at 4:04 PM, Chouser wrote: >> >> I don't feel I have much authority in the realm of designing >> concurrent programs, but here are a couple thoughts: >> >> It seems to me that

Re: why two list comprehensions are different?

2009-01-03 Thread Chouser
tch that adds even-ness and related assertions to a bunch of core macros. It introduces a private macro 'assert-args' that allows these checks without too much impact on the verbosity and readability of the code. --Chouser --~--~-~--~~~---~--~~ You received th

Re: Bugs in contains? (?)

2009-01-03 Thread Chouser
that it's much faster than =, and responds well to working with primitive numbers: (time (dotimes [_ 123456789] (= 1 1.0))) ==> 1350.525414 msecs (time (dotimes [_ 123456789] (== 1 1.0))) ==> 18.603425 msecs (time (dotimes [_ 123456789] (== (int 1) (float 1.0 ==> 10.348273 ms

Re: Adding user-defined state to classes created with (proxy ...)

2009-01-03 Thread Chouser
-state) Of course these could be wrapped in regular functions as well get a more idiomatic api. Finally, if this is just too clumsy, I would still prefer gen-interface over gen-class. This would allow you to declare all the state-manipulation and -access methods you'd need. Then you coul

Re: Updating website and Clojure files

2009-01-03 Thread Chouser
e Eclipse > licence, but CPL (for example rev 1193). Not much I can do about that, but thanks for the report. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this grou

Re: re-gsub improvement

2009-01-03 Thread Chouser
On Sat, Jan 3, 2009 at 8:49 PM, Juergen Gmeiner wrote: > > On Dec 13 2008, 6:04 am, Chouser wrote: > >> Please send in your Contributor Agreement so this patch >> can be checked in. > > Oops, almost missed this, sorry. > > I did send the CA and I am even lis

Re: Questions & workaround regarding Clojure, true laziness, and nil-terminated sequences

2009-01-03 Thread Chouser
he seq is empty, the value 1 isn't computed: user=> (-> (test-stack) (single-pop) (push-seq [9]) (single-pop) (single-pop) (empty?)) (first 2 ) (rest after 2 ) false > I wanted to avoid this extra evaluation, without introducing "delay" > and "force" everywher

Re: Slow nested subvecs (+ fix)

2009-01-03 Thread Chouser
d; >} >} > > I've tested this a bit and it appears to work properly. Does this > seem like a good idea? It seems like a good idea to me. Have you sent in your CA? See: http://clojure.org/contributing --Chouser --~--~-~--~~---

Re: broken link http://clojure.org/api#condp

2009-01-04 Thread Chouser
by with (doc condp) --Chouser --~--~-~--~~~---~--~~ 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 group, send email to clojure+uns

  1   2   3   4   5   6   7   8   >