Re: question regarding agents

2009-09-24 Thread Roger Gilliar
Thanks for the answer. Wrapping a mutable thing like an output stream in an agent seems dubious to me. It was intended to use an agent here since I need to control the access to the write object. But what I forgot was ' the validator succeeds or if no validator was given, the return

Re: Getting REPL transcript

2009-09-24 Thread Emeka
Hello John , A standalone REPL on Windows is amenable to making the command prompt window's backscroll big enough, if needed, and then copying from it using the prompt window's mark/copy mode. A standalone REPL on MS-DOS is tougher. The only way I know of short of installing Windows is to

Re: Getting REPL transcript

2009-09-24 Thread Richard Newman
Actually, that suggests a more general point: that we can have programmatic access to the REPL's backlog if we modify the REPL process's Java code somewhat. A simple example would be to make a repl.class that would provide an interactive stdin/stdout repl but log everything to a

Naming structs

2009-09-24 Thread Miron Brezuleanu
Hello, I find that I tend to name struct instances like the struct. For instance, (defstruct person :name) and then (let [person (struct person John)] ) which breaks further use of (struct person ...) in that let. Is there an established naming convention that I could use? (I'm trying

Re: Bug in count for hash-maps with nil values

2009-09-24 Thread Richard Newman
Can anyone else confirm? I see the same thing. Both working and non-working lengths are PersistentArrayMaps, so this isn't a hash map thing. user= (type {1 nil 2 nil 3 nil 4 nil 5 nil 6 nil 7 nil 8 nil 9 nil}) clojure.lang.PersistentArrayMap user= (type {1 nil 2 nil 3 nil 4 nil 5 nil 6 nil 7

Re: Naming structs

2009-09-24 Thread Richard Newman
Is there an established naming convention that I could use? (I'm trying to use (let [aperson (struct person John)]...) but I'm not completely happy with it.) AppleScript uses the-person, but I don't recommend that :) I'd go for one of two avenues — descriptive: (let [recipient (struct

Schema for data structures

2009-09-24 Thread Miron Brezuleanu
Hello, is there a way to check if a data structure complies to a given schema? (e.g. people is a vector of persons). I'm using C# a lot and maybe the static typing has changed the way I think. I feel like adding type checks in unit tests and being able to say something like: (is-type (people

Re: Can anyone here give a comparison between Clojure and Erlang on concurrent programming?

2009-09-24 Thread Lance Carlson
I'd recommend an architecture where you utilize ejabberd and create bots/components that read XML stanzas and react. That way you can just scale your application servers separately and use any language you choose. You also get chat for free. On Thu, Sep 24, 2009 at 4:23 AM, ngocdaothanh

Re: Naming structs

2009-09-24 Thread Jarkko Oranen
On Sep 24, 11:01 am, Miron Brezuleanu mbr...@gmail.com wrote: Hello, I find that I tend to name struct instances like the struct. For instance, (defstruct person :name) and then (let [person (struct person John)] ) which breaks further use of (struct person ...) in that let. Is

Re: Architecting a large multi-threaded process

2009-09-24 Thread Jimmy
From Mark Volkmann tutorial - http://java.ociweb.com/mark/clojure/article.html The send function uses a fixed thread pool (see the newFixedThreadPool method in java.util.concurrent.Executors) where the number of threads is the number of processors plus two. If all of those threads are busy, the

Re: Getting REPL transcript

2009-09-24 Thread Emeka
Rich, Hmm, it is what I'm looking for.Just the way I planned it to be. The next issue now is on how to craft it into clojure. Regards, Emeka On Thu, Sep 24, 2009 at 7:59 AM, Richard Newman holyg...@gmail.com wrote: Actually, that suggests a more general point: that we can have

Re: Schema for data structures

2009-09-24 Thread tmountain
You might be looking for the instance? function. It can be used to determine if something is an instance of a particular class. user= (instance? java.lang.Integer 5) true user= (instance? java.lang.Integer 5) false To apply that to a data structure, you'd need to walk your structure and compare

Re: Can anyone here give a comparison between Clojure and Erlang on concurrent programming?

2009-09-24 Thread mmwaikar
With respect to Stuart's comment above - Erlang is designed for distributed operation across many machines; Clojure is designed for a single machine with many cores., how are Clojure and Haskell different? I am just curious to know how do Haskell, Clojure and Erlang compare. On Sep 24, 4:36 am,

Re: Naming structs

2009-09-24 Thread Miron Brezuleanu
Hi, On Thu, Sep 24, 2009 at 12:12 PM, Jarkko Oranen chous...@gmail.com wrote: On Sep 24, 11:01 am, Miron Brezuleanu mbr...@gmail.com wrote: Hello, I find that I tend to name struct instances like the struct. For instance, You could name the struct base person or something. I vaguely

Re: Schema for data structures

2009-09-24 Thread Miron Brezuleanu
Hello, On Thu, Sep 24, 2009 at 5:09 PM, tmountain tinymount...@gmail.com wrote: To apply that to a data structure, you'd need to walk your structure and compare the elements contained within against the desired type. Depending on the structure, you could do something similar to this. (defn

Re: Can anyone here give a comparison between Clojure and Erlang on concurrent programming?

2009-09-24 Thread tmountain
Clojure and Haskell both include STM systems for controlled access to shared resources. There's a Haskell distribution known as Glasgow Distributed Haskell (GdH), which provides facilities for small-scale distributed programming. Clojure can achieve the same effect through the use of third-party

Re: Can anyone here give a comparison between Clojure and Erlang on concurrent programming?

2009-09-24 Thread wmacgyver
Excellent summary of each language's sweet spot. I'd like to suggest a different book for Erlang though. For learning Erlang, I'd suggest Erlang Programming by Francesco Cesarini Simon Thompson, published by O'Reilly On Thu, Sep 24, 2009 at 11:16 AM, tmountain tinymount...@gmail.com wrote: ...

Re: Schema for data structures

2009-09-24 Thread Constantine Vetoshev
On Sep 24, 10:59 am, Miron Brezuleanu mbr...@gmail.com wrote: Well, I only want to enforce duck-typing :-) - for instance, make sure via unit tests that a function that should return a data structure with certain properties always returns such a data structure. Not exactly what you asked for,

Re: Schema for data structures

2009-09-24 Thread Richard Newman
Use it just like you use defstruct, e.g.: (defstruct* person :first- name :last-name :age), but it will also create a little type-checker function: is-person? Here are some tests to see how it works: Note that your type checker will give false positives if you're intending to use accessors:

Re: Namespace/class visibility in eval

2009-09-24 Thread Eric Tschetter
Thanks for the replies, everyone. I'll look into the clojurebot and see how that works. Also, I do understand that this is potentially opening the door to mis-use of resources, but for now, I'm running in a sufficiently trusted environment that the benefits outweigh the risks (an OOM or CPU DoS

Re: Bug in count for hash-maps with nil values

2009-09-24 Thread MarkSwanson
Confirmed. I'm using clojure from git: $ git status # On branch master nothing to commit (working directory clean) I also tried with the ':' Clojure= (count {:1 nil :2 nil :3 nil :4 nil :5 nil :6 nil :7 nil :8 nil :9 nil}) 0 --~--~-~--~~~---~--~~ You received

Re: Method combination (as in CL)?

2009-09-24 Thread Meikel Brandmeyer
Hi, Am 15.09.2009 um 23:05 schrieb Elliott Slaughter: But suppose I want to (foo ::b) to print both It's a b! and It's an a!? (This is equivalent to a super.foo() call in Java, or method combination in CL.) A little late answer, but well... (defmethod foo ::b [b] ((get-method foo ::a)

Re: Getting REPL transcript

2009-09-24 Thread Michael Wood
2009/9/23 Emeka emekami...@gmail.com: Mic, Or use script . I don't think I understood clearly what you are referring to. There's a UNIX command called script which records a command line session to a file (called typescript by default). mich...@egret:/tmp$ script Script started, file is

Re: Catching from Eval

2009-09-24 Thread Michel Alexandre Salim
On Sep 24, 12:33 am, Phil Hagelberg p...@hagelb.org wrote: It looks like it's actually a subclass of Exception instead:     user= (eval '(throw (InterruptedException.)))     java.lang.InterruptedException (NO_SOURCE_FILE:7)     user= (class *e)     clojure.lang.Compiler$CompilerException  

Re: Bug in count for hash-maps with nil values

2009-09-24 Thread Jason Wolfe
I guess this is already ticketed. I should have searched first, sorry for the noise. http://www.assembla.com/spaces/clojure/tickets/192-hashmaps--count-is-not-always-updated-when-associng-dissocing-a-nil-key -Jason --~--~-~--~~~---~--~~ You received this message

Clojure.net - MonoTouch - iPhone?

2009-09-24 Thread Raoul Duke
anybody tried that route? --~--~-~--~~~---~--~~ 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

Re: Bug in count for hash-maps with nil values

2009-09-24 Thread Richard Newman
I guess this is already ticketed.  I should have searched first, sorry for the noise. It's not already ticketed, even if the root cause might be the same. As I pointed out in my message, these are not hash maps, they're array maps. You should file a new ticket and refer to #192.