Re: Reminder: Bay Area Clojure User Group meeting in SF during JavaOne (6/3) with Rich Hickey

2009-06-10 Thread Alex
Just wanted to say I had a great time at the meetup. Really fun to see people using Clojure in earnest and hear Rich talk about stuff. I blogged it a bit here: http://tech.puredanger.com/2009/06/10/clojure-rich-hickey/ On Jun 4, 11:44 am, Paul Mooser wrote: > I wanted to say thank you to eve

Re: (Simple) Neural Net Simulation

2009-06-10 Thread Richard Newman
> fmap maps a function on the values in a data structure, returning an > equivalent data structure containing the function results. This is > different from map that applies a function to a sequence and returns > another sequence. Very neat, Konrad! That sure saves some typing. I always find loo

Re: (Simple) Neural Net Simulation

2009-06-10 Thread Konrad Hinsen
On 11.06.2009, at 06:52, alfred.morgan.al...@gmail.com wrote: > Again, thanks for all the help. One last question, though- how would > I apply the 'map' function to an actual associative mapping? I mean- > > (defn testFunc [x] (* x 2)) > (println (map testFunc {:a 1 :b 2 :c 3})) (use 'clojure.

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Robert Lehr
Thanks. See reponses inline. On Jun 10, 6:22 am, Toralf Wittner wrote: > On Wed, Jun 10, 2009 at 5:14 AM, Robert Lehr wrote: e in your system. > > > Q - What stops Clojure's agent send-off function from becoming a DOS > > ("denial of service") vulnerability in a server? > > As you noted, send-o

Re: (Simple) Neural Net Simulation

2009-06-10 Thread Richard Newman
> Again, thanks for all the help. One last question, though- how would > I apply the 'map' function to an actual associative mapping? I mean- > > (defn testFunc [x] (* x 2)) > (println (map testFunc {:a 1 :b 2 :c 3})) The items in a associative container come out as a pair, which you can dest

Re: (Simple) Neural Net Simulation

2009-06-10 Thread alfred.morgan.al...@gmail.com
Thanks for all the tips, particularly on the subject refs and atoms- that makes things substantially simpler now. (Pointer math... Grrr...) > I also wonder why you consider the construction of the network graph > (as above) to be an inherently stateful activity.  And why you choose > to have tho

Re: Status of Clojure on .NET?

2009-06-10 Thread David Miller
Actually, ClojureCLR is also DLR-based, relying on Expression Trees V2, but not the hosting goodies. Thus, it might be runnable directly in .NET 4.0 without the DLR. For ClojureCLR: Performance of the core libraries is quite good. Startup time is quite good. Of compiled Clojure code, not so go

Re: Reading files with nio.

2009-06-10 Thread Adrian Cuthbertson
Thanks, these are useful posts. On Thu, Jun 11, 2009 at 4:49 AM, Nicolas Buduroi wrote: > > I've got an even faster version using memory-mapped file I/O. It also > simplify the code a little bit. > > (defn fast-read-file [#^String filename #^String charset] >  (with-open [cin (. (new FileInputStr

Re: Reading files with nio.

2009-06-10 Thread Nicolas Buduroi
I've got an even faster version using memory-mapped file I/O. It also simplify the code a little bit. (defn fast-read-file [#^String filename #^String charset] (with-open [cin (. (new FileInputStream filename) getChannel)] (let [size (. (new File filename) length) char-buffer (. B

Re: (re)setting a function globally

2009-06-10 Thread Stuart Sierra
Can I help from the test-is side? Could test-expect be added to clojure-contrib? -Stuart On Jun 10, 1:36 pm, Matt Clark wrote: > Thanks for these ideas, I will give them a try tonight and update the > adapter namespace with the changes.  If anyone knows of a more > idiomatic way I could have i

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Nathan Hawkins
On Wed, 10 Jun 2009 12:44:00 -0600 Daniel Lyons wrote: > On Jun 10, 2009, at 12:03 PM, Toralf Wittner wrote: > > On Wed, 2009-06-10 at 10:22 -0600, Daniel Lyons wrote: > >> If the actions are executed serially, what is the benefit of having > >> multiple threads per agent? > > > > There is none.

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Toralf Wittner
On Wed, 2009-06-10 at 12:44 -0600, Daniel Lyons wrote: > However, I still feel like I am not understanding when agents should > be used or what an appropriate use of them would constitute, though. Well, since agents run independently and asynchronously I found them to be most useful when you ha

Re: Status of Clojure on .NET?

2009-06-10 Thread Cosmin Stejerean
On Tue, Jun 9, 2009 at 8:31 PM, John "Z-Bo" Zabroski wrote: > > I am basically in love with Clojure. It fixes everything I ever found > annoying about Lisp dialects, except for type safety (which I can live > without for many scenarios). > > But I feel like my love is unrequited: Clojure is a JV

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread Chris Dean
David Nolen writes: > The n has to be held onto to complete the computation, so the tail > call optimization cannot be performed. That's right. > ;; can be tail call optimized > (define (add-tail n) > (add-iter n 0)) > > (define (add-iter iter result) > (if (= iter 0) > result >

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Daniel Lyons
On Jun 10, 2009, at 12:03 PM, Toralf Wittner wrote: > On Wed, 2009-06-10 at 10:22 -0600, Daniel Lyons wrote: >> If the actions are executed serially, what is the benefit of having >> multiple threads per agent? > > There is none. Did anybody say there are multiple threads per agent? > There are t

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Toralf Wittner
On Wed, 2009-06-10 at 10:22 -0600, Daniel Lyons wrote: > > On Jun 10, 2009, at 4:22 AM, Toralf Wittner wrote: > > As written above the serial execution of an Agent's actions makes this > > thread-safe. > > > If the actions are executed serially, what is the benefit of having > multiple thread

Re: test-expect functional mocking/expectation library

2009-06-10 Thread Matt Clark
Stuart, it is wonderful to hear that someone out there is using test- expect. I'll get the CA signed so its migration to contrib can proceed. -Matt On Jun 10, 7:52 am, Stuart Halloway wrote: > Hi Matt, > > I would definitely like to see test-expect added to contrib. If you   > will sign the CA

Re: (re)setting a function globally

2009-06-10 Thread Matt Clark
Thanks for these ideas, I will give them a try tonight and update the adapter namespace with the changes. If anyone knows of a more idiomatic way I could have implemented the problem reporting functionality that would prevent the necessity of these "hacky" solutions, I'm all ears. - Matt On Jun

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Daniel Lyons
On Jun 10, 2009, at 4:22 AM, Toralf Wittner wrote: > As written above the serial execution of an Agent's actions makes this > thread-safe. If the actions are executed serially, what is the benefit of having multiple threads per agent? — Daniel Lyons http://www.storytotell.org -- Tell It! -

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread David Nolen
The examples given for Scheme and Common Lisp also blow the stack (I checked the Scheme example in PLT Scheme). Consider the following: ;; cannot be tail call optimized (define (add n) (if (= n 0) 0 (+ 1 (add (- n 1) ;; can be tail call optimized (define (add-tail n) (add-iter n

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread Laurent PETIT
Why not, but just understand that by doing you, you would give a good answer to the wrong question :-) So maybe better keep your energy when the right question shows up :-) :-) I say so, because I guess a good answer would not necessarily demonstrate (as its key 'selling point') mutually recursi

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread arasoft
I know, but wouldn't it be nice to show that using Clojure you can write a solution that "really" works? On Jun 10, 5:38 pm, Laurent PETIT wrote: > I don't see the solutions provided for other languages solving the > tail call problem. And I also don't see the problem explictly stating > that a

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread Laurent PETIT
I don't see the solutions provided for other languages solving the tail call problem. And I also don't see the problem explictly stating that a tail call optimized version is required. It seems rather to me that the page just want to exhibit that the language allows mutual recursion of calls, per

Re: Clojure at LispNYC tonight 7pm

2009-06-10 Thread Stuart Sierra
On Jun 9, 10:32 am, Stuart Sierra wrote: > Join us Tuesday, June 9 from 7:00-9:00 for Stuart Sierra's > presentation: > >     Implementing AltLaw.org in Clojure Slides and video here: http://lispnyc.org/wiki.clp?page=past-meetings We'll try to get something lighter than a 3GB mpeg soon. -Stuart

Re: (re)setting a function globally

2009-06-10 Thread Stuart Sierra
On Jun 10, 10:39 am, Stuart Halloway wrote: > (defn use-test-is! [] >   (require 'mdc.common.test-expect.test-is-adapter) >   (def report-problem (ns-resolve 'mdc.common.test-expect.test-is- > adapter 'report-problem))) > > This feels a little hacky, but is there a better way? It's not much less

(re)setting a function globally

2009-06-10 Thread Stuart Halloway
Matt Clark's test-expect library includes two versions of a report- problem function: a standalone version, and another that integrates with test-is. The comments suggest two ways to active the test-is version: wrapping calls to expect in a binding, and interning the specialized version of

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread arasoft
Thank you for the answers. I now understand why this cannot work with trampoline. Is there another way to avoid stack overflow? I'd like to submit the code to http://rosettacode.org/wiki/Mutual_Recursion to improve the Clojure coverage and also to learn more stuff myself... --~--~-~--~

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread Laurent PETIT
I guess trampoline allows to emulate tail call optimization on mutually recursive functions, that is functions that, without trampoline and in an environment that would do TCO automatically, have a tail call to the other function, and the other function also has a tail call to another function ...

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread Shawn Hoover
On Tue, Jun 9, 2009 at 6:04 PM, arasoft wrote: > > I tried this: > > (declare F) > > (defn M [n] > (if (zero? n) >0 >(- n (F (M (dec n)) > > (defn F [n] > (if (zero? n) >1 >(- n (M (F (dec n)) > > and for large n I got the expected stack overflow. Then I tried to > tramp

Re: [ANN] test-expect functional mocking/expectation library

2009-06-10 Thread Stuart Halloway
Hi Matt, I would definitely like to see test-expect added to contrib. If you will sign the CA I will move it there. I have a bunch of existing tests that are simply using binding to do cheap stubbing, and will be converting those tests to test-expect over the next several days. Thanks for

Re: Thoughts on bags?

2009-06-10 Thread Rich Hickey
On Jun 10, 2:09 am, Richard Newman wrote: > > I am very fond of the relational functions in Clojure. That was one of > > the first things that started winning me over actually. > > Indeed, they're very nice to have! > > > Forgive me if this is an obvious question, but what exactly is the > > di

(Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread arasoft
I tried this: (declare F) (defn M [n] (if (zero? n) 0 (- n (F (M (dec n)) (defn F [n] (if (zero? n) 1 (- n (M (F (dec n)) and for large n I got the expected stack overflow. Then I tried to trampoline the functions: (declare F) (defn M [n] (if (zero? n) 0

Re: (Simple) Neural Net Simulation

2009-06-10 Thread atucker
Hi! I would expect the implementation of any neural network to be dictated by the particular mathematical/algorithmic description. I am not at all sure what description might have given rise to your code. Do you have any particular type of neural network in mind? Or any particular task to perfo

Status of Clojure on .NET?

2009-06-10 Thread John "Z-Bo" Zabroski
I am basically in love with Clojure. It fixes everything I ever found annoying about Lisp dialects, except for type safety (which I can live without for many scenarios). But I feel like my love is unrequited: Clojure is a JVM language, and all my core libraries at .NET. The rest of this post di

Re: [ANN] test-expect functional mocking/expectation library

2009-06-10 Thread Stuart Halloway
Hi Matt, I would like to move this to contrib, if you will sign the CA. I'll be moving my simple binding-based stubs to use this and will send along suggestions if I have any. Thanks for writing this! Stu P.S. Apologies if variants of this message show up twice. Mail client wonkiness...

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Toralf Wittner
On Wed, Jun 10, 2009 at 5:14 AM, Robert Lehr wrote: > Q - What stops Clojure's agent send-off function from becoming a DOS > ("denial of service") vulnerability in a server? As you noted, send-off uses a cached thread pool, so there is no protection from creating more threads than your system can

Re: Clojure at LispNYC tonight 7pm

2009-06-10 Thread Baishampayan Ghose
Stuart Sierra wrote: > Join us Tuesday, June 9 from 7:00-9:00 for Stuart Sierra's > presentation: Will there be any video recording? Regards, BG -- Baishampayan Ghose oCricket.com signature.asc Description: OpenPGP digital signature

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Meikel Brandmeyer
Hi, disclaimer: I'm only a hobbyist with almost no clue about the concurrency. So take this with a grain of salt. The following are only my expressions how this stuff works. Am 10.06.2009 um 05:14 schrieb Robert Lehr: Q - What stops Clojure's agent send-off function from becoming a DOS ("denia

Re: Macro Design - by example

2009-06-10 Thread Emeka
Meikel, Could I be allowed to join your online class:) Regards, Emeka --~--~-~--~~~---~--~~ 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 fro

Re: clojure.contrib.except enhanced

2009-06-10 Thread Stephen C. Gilardi
Based on the discussion in this thread with Chouser, I've checked in code for "throwable maps with stack traces" at clojure.contrib.condition. It's a very generic scaffolding for flexible error handling. Here's Chouser's example implemented with clojure.contrib.condition: