Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Konrad Hinsen
On 26.02.2009, at 08:47, Jeff Valk wrote: String representation obviously uses :type now in a very particular way. I'm not sure where this happens though. Can anyone shed some light on the details? print-method now dispatches on type, rather than class as it did before. There is no

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Konrad Hinsen
On 26.02.2009, at 01:51, Rich Hickey wrote: You raise interesting issues and I'd like to explore them further. I'm not sure the issues you have with type-tag-or-class dispatch are all that prohibitive. In any case, I've added a type function that returns the :type metadata or the class if

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Laurent PETIT
2009/2/26 Konrad Hinsen konrad.hin...@laposte.net On 26.02.2009, at 01:51, Rich Hickey wrote: You raise interesting issues and I'd like to explore them further. I'm not sure the issues you have with type-tag-or-class dispatch are all that prohibitive. In any case, I've added a type

Re: Waterfront Assertion Failure

2009-02-26 Thread Itay Maman
Hi Onorio RC1-147 requires the use of Clojure's latest snapshot (can be obtained from the SVN). -Itay On Feb 26, 4:21 am, Onorio Catenacci catena...@gmail.com wrote: Hi Itay (and everyone else), Every time I try to run Waterfront I keep running into the same error.  On line 83 of kit.clj

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Konrad Hinsen
On Feb 26, 2009, at 1:51, Rich Hickey wrote: You raise interesting issues and I'd like to explore them further. I'm not sure the issues you have with type-tag-or-class dispatch are all that prohibitive. In any case, I've added a type function that returns the :type metadata or the class if

Syntax-quote only as a reader macro?

2009-02-26 Thread Konrad Hinsen
I am trying to do the equivalent of a syntax-quote (converting unqualified symbols to namespace-qualified symbols) inside a macro, but it seems there is no built-in function to do this. Am I overlooking something? At the moment I am using the following function, which does a syntax- quote

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-26 Thread Itay Maman
On Feb 26, 3:02 am, Stephen C. Gilardi squee...@mac.com wrote: On Feb 24, 2009, at 6:47 PM, Itay Maman wrote: This version is fully functional and so far I didn't encounter any bugs. I guess that over the course of the next few days, as people start using this version, a few issues

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-26 Thread Konrad Hinsen
On Feb 26, 2009, at 12:30, Itay Maman wrote: In Java6 @Override can also be attached to a method that overrides an interface-declared method. So, the code is not supposed to compile w/ a Java5 compiler. As for the Java6 compiler, my guess is that your compile is configured to be Java5

Re: how to get concurrent - model design question

2009-02-26 Thread Timothy Pratley
Hi Boris,  (doseq [e [retire-host slowdown-host infect-hosts naturalrecovery- host pair-host breakup-host] i world]            (send-off (agent nil) (fn [_] (e i)) There doesn't seem to be any concurrency happening, and the whole thing just slows down to not doing much at all. This

Re: Waterfront Assertion Failure

2009-02-26 Thread Onorio Catenacci
On Feb 26, 6:10 am, Itay Maman itay.ma...@gmail.com wrote: Hi Onorio RC1-147 requires the use of Clojure's latest snapshot (can be obtained from the SVN). I figured that was probably the case but I thought you might want to know about the assertion failure in case it were some other issue.

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Rich Hickey
On Feb 26, 4:00 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 26.02.2009, at 01:51, Rich Hickey wrote: You raise interesting issues and I'd like to explore them further. I'm not sure the issues you have with type-tag-or-class dispatch are all that prohibitive. In any case, I've

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Rich Hickey
On Feb 26, 4:17 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/2/26 Konrad Hinsen konrad.hin...@laposte.net On 26.02.2009, at 01:51, Rich Hickey wrote: You raise interesting issues and I'd like to explore them further. I'm not sure the issues you have with

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-26 Thread Timothy Pratley
super slick, I love 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 To unsubscribe from this group, send email to

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Rich Hickey
On Feb 26, 6:19 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On Feb 26, 2009, at 1:51, Rich Hickey wrote: You raise interesting issues and I'd like to explore them further. I'm not sure the issues you have with type-tag-or-class dispatch are all that prohibitive. In any case, I've

Re: Is syntax quote reader only?

2009-02-26 Thread Chouser
On Mon, Feb 16, 2009 at 8:31 PM, Brian Will brian.thomas.w...@gmail.com wrote: I'm a bit mystified how syntax quote does what it does. I don't see how syntax quote can quote the whole while unquoting parts without some evaluation-time intervention. If I had to implement it myself, I'd just

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-26 Thread Itay Maman
On Feb 26, 2:02 pm, Konrad Hinsen konrad.hin...@laposte.net wrote: On Feb 26, 2009, at 12:30, Itay Maman wrote: In Java6 @Override can also be attached to a method that overrides an interface-declared method. So, the code is not supposed to compile w/ a Java5 compiler. As for the Java6

Re: how to get concurrent - model design question

2009-02-26 Thread bOR_
Thanks for the reply Timothy! I'll look into the future things :). The main reason for using refs was because I am constructing a contact network between different refs (a graph, consisting of nodes and edges.), which changes over time (all the short-term and long-term relations between hosts

Re: new laziness: terminology help

2009-02-26 Thread Rich Hickey
On Feb 25, 8:02 pm, Mark Engelberg mark.engelb...@gmail.com wrote: On Wed, Feb 25, 2009 at 6:59 AM, Stuart Halloway I believe it would be simpler to leave out this footnote. In my perfect world, seq/ISeq/sequence are synonyms, and nillability is a property only of *functions*: seq and

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-26 Thread Laurent PETIT
2009/2/26 Itay Maman itay.ma...@gmail.com On Feb 26, 2:02 pm, Konrad Hinsen konrad.hin...@laposte.net wrote: On Feb 26, 2009, at 12:30, Itay Maman wrote: In Java6 @Override can also be attached to a method that overrides an interface-declared method. So, the code is not supposed to

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Laurent PETIT
2009/2/26 Rich Hickey richhic...@gmail.com On Feb 26, 4:17 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/2/26 Konrad Hinsen konrad.hin...@laposte.net On 26.02.2009, at 01:51, Rich Hickey wrote: You raise interesting issues and I'd like to explore them further.

Re: The Sequential interface (implementation question)

2009-02-26 Thread Rich Hickey
On Feb 26, 12:00 am, dmiller dmiller2...@gmail.com wrote: Regarding the Sequential interface: There are a number of places where (x instanceof Sequential) is taken to imply something else about x: (a) that casting in the form of ((IPersistentCollection)x) is okay, or (b) that

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Laurent PETIT
Would it make sense to make instance?/type-instance?/type .. multimethods themselves ? 2009/2/26 Konrad Hinsen konrad.hin...@laposte.net On 26.02.2009, at 01:51, Rich Hickey wrote: You raise interesting issues and I'd like to explore them further. I'm not sure the issues you have with

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Rich Hickey
On Feb 26, 8:30 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/2/26 Rich Hickey richhic...@gmail.com On Feb 26, 4:17 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/2/26 Konrad Hinsen konrad.hin...@laposte.net On 26.02.2009, at 01:51, Rich Hickey wrote: You

Re: Mini-Kanren

2009-02-26 Thread Michel S.
Hi Jim, On Feb 25, 6:38 pm, jim jim.d...@gmail.com wrote: I've just uploaded a file that has the Mini-Kanren logic programming system described in The Reasoned Schemer implemented in idiomatic Clojure. The file is: http://clojure.googlegroups.com/web/mini_kanren.clj I'm still reading my

function call preconditions

2009-02-26 Thread Laurent PETIT
Hello, While not checking types at compile time, it seems to me that a lot of clojure code still needs in the docstring some sort of preconditions warnings. For example, that you can't pass a first argument if it cannot be callable as a function, or if it cannot succeed the (seq) test ...

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Laurent PETIT
2009/2/26 Rich Hickey richhic...@gmail.com On Feb 26, 8:30 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/2/26 Rich Hickey richhic...@gmail.com On Feb 26, 4:17 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/2/26 Konrad Hinsen konrad.hin...@laposte.net

Re: Extensive use of let?

2009-02-26 Thread Luke VanderHart
Very interesting ideas, everyone... thanks a lot for the input. Yeah, I recognize that each case is going to be different - I guess I was just looking for suggestions on how to manage it. Which I found... Comp and partial look particularly interesting. Thanks! -Luke On Feb 25, 5:09 pm, Kevin

Re: Clojure plugin for IntelliJ IDEA published

2009-02-26 Thread Ilya Sergey
Hello. Simplest way to run empty REPL is to create empty Clojure script and invoke new run configuration on it (marking appropriate checkbox in configuration settings). In next version we're going to integrate support for background REPL, but for now we have no, so there is no possibility to

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-26 Thread Itay Maman
What ? You used Eclipse, and still wanted to get rid of it and of clojuredev ! How sad I am ... ;-) :)) I've taken a look at what you've done, wow ! How long did it take to realize that ? Were you working on it daily, or nightly ? I had a couple of weeks off at Dec. Since Jan. it is

Re: Syntax-quote only as a reader macro?

2009-02-26 Thread Konrad Hinsen
On Feb 26, 2009, at 13:04, Konrad Hinsen wrote: Of course that should better be ... so that it doesn't mess up already qualified symbols. And even that is not good enough: it won't handle symbols/vars from other namespaces that are referred to. And that's where I am lost. I can't find

Re: Mini-Kanren

2009-02-26 Thread jim
I don't have a Scheme here to check it out, but doesn't (cons 1) yield '(1) or am I wrong? In either case how could it be stated more accurately/clearly? Thanks Jim On Feb 26, 7:52 am, Michel S. michel.syl...@gmail.com wrote: Hi Jim, In Scheme, passing cons one parameter encloses that

Re: Mini-Kanren

2009-02-26 Thread Pierpaolo Bernardi
On Thu, Feb 26, 2009 at 4:03 PM, jim jim.d...@gmail.com wrote: I don't have a Scheme here to check it out, but doesn't (cons 1) yield '(1) no. in scheme (and in all modern lisps), cons is a 2 arguments procedure. Giving it 1 is an error. Some very old lisp dialects supplied NIL in

Re: Clojure documentation problems

2009-02-26 Thread Chouser
On Wed, Feb 25, 2009 at 6:00 AM, David Sletten da...@bosatsu.net wrote: Whoops...it's rational? that was missing from the API page and still is. The API page is programmaticly generated from the docstrings, but like the rest of the site generally reflects the latest release, not the latest

Re: Mini-Kanren

2009-02-26 Thread jim
Looking at the code, lcons does indeed require two parms. I must've been zoned out when I wrote the comment. Thanks for catching that. On Feb 26, 9:10 am, Pierpaolo Bernardi olopie...@gmail.com wrote: no. in scheme (and in all modern lisps), cons is a 2 arguments procedure. Giving it 1 is an

Richer 'partial'

2009-02-26 Thread Anand Patil
Hi all, I could use a version of 'partial' that would allow me to: - Partially apply a function to any of its arguments, not just the first one - 'Unapply' a partially-applied function from one of its arguments. Is any such thing already available? Thanks, Anand

Re: Richer 'partial'

2009-02-26 Thread Laurent PETIT
2009/2/26 Anand Patil anand.prabhakar.pa...@gmail.com Hi all, I could use a version of 'partial' that would allow me to: - Partially apply a function to any of its arguments, not just the first one That's already the case, haven't you made a little test ? - 'Unapply' a

Re: Richer 'partial'

2009-02-26 Thread Jeffrey Straszheim
partial is a currying function. It can be provided any number of parameter(s), but it is always behaves sequentially from start to finish. That is what currying *is*. You can easily partially apply to other arguments by doing this: #(fred %1 some-arg %2 other-arg). partial could not easily

Re: Richer 'partial'

2009-02-26 Thread Laurent PETIT
2009/2/26 Jeffrey Straszheim straszheimjeff...@gmail.com partial is a currying function. It can be provided any number of parameter(s), but it is always behaves sequentially from start to finish. That is what currying *is*. Ah, I thought currying / uncurrying what the term reserved for

Adding strings

2009-02-26 Thread Peter Wolf
Hey all, What is the idiomatic way to concatenate strings? Here are some things that I expected to work, but didn't (+ foo bah) (conj foo bah) (into foo bah) For the moment I am doing (.concat foo bah) But it seems wrong Thanks P

Re: Adding strings

2009-02-26 Thread Laurent PETIT
(str foo bah) and if you have a collection you can (apply str coll) HTH, -- Laurent 2009/2/26 Peter Wolf opus...@gmail.com Hey all, What is the idiomatic way to concatenate strings? Here are some things that I expected to work, but didn't (+ foo bah) (conj foo bah) (into

Re: Adding strings

2009-02-26 Thread pmf
On Feb 26, 5:11 pm, Peter Wolf opus...@gmail.com wrote: What is the idiomatic way to concatenate strings?  Here are some things that I expected to work, but didn't     (+ foo bah)     (conj foo bah)     (into foo bah) For the moment I am doing     (.concat foo bah) (str foo bah)

Re: Adding strings

2009-02-26 Thread Shawn Hoover
On Thu, Feb 26, 2009 at 11:11 AM, Peter Wolf opus...@gmail.com wrote: Hey all, What is the idiomatic way to concatenate strings? Here are some things that I expected to work, but didn't (+ foo bah) (conj foo bah) (into foo bah) For the moment I am doing (.concat foo bah)

Re: Richer 'partial'

2009-02-26 Thread Anand Patil
Thanks for the responses, guys. - Partially apply a function to any of its arguments, not just the first one That's already the case, haven't you made a little test ? I meant I want to apply it out of sequence, sorry. You can easily partially apply to other arguments by doing this: #(fred

Re: Richer 'partial'

2009-02-26 Thread Anand Patil
Thanks for the responses, guys. - Partially apply a function to any of its arguments, not just the first one That's already the case, haven't you made a little test ? I meant I want to apply it out of sequence, sorry. You can easily partially apply to other arguments by doing this: #(fred

Re: Richer 'partial'

2009-02-26 Thread Anand Patil
Sorry, I thought I had pushed 'stop' in time to stop the first response. On Feb 26, 4:16 pm, Anand Patil anand.prabhakar.pa...@gmail.com wrote: Thanks for the responses, guys. - Partially apply a function to any of its arguments, not just the first one That's already the case, haven't you

Re: Richer 'partial'

2009-02-26 Thread mikel
On Feb 26, 9:24 am, Anand Patil anand.prabhakar.pa...@gmail.com wrote: Hi all, I could use a version of 'partial' that would allow me to: - Partially apply a function to any of its arguments, not just the first one - 'Unapply' a partially-applied function from one of its arguments. Is

Re: Richer 'partial'

2009-02-26 Thread Anand Patil
On Feb 26, 4:41 pm, mikel mev...@mac.com wrote: Other people have explained currying and partial application, and why it doesn't normally spply the feature you want. I'd be interested in reading about this if you know of a link. Normally, in a lnaguage that supplies partial application,

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Christian Vest Hansen
Nice initiative! However, it the net-ssh dependency has problems: [cvh: ~]$ sudo gem install djspiewak-buildr ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) timed out (http://gems.rubyforge.org/gems/net-ssh-2.0.4.gem) On Sat, Feb 21, 2009 at 10:33 PM, Daniel Spiewak

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread mikel
On Feb 25, 6:51 pm, Rich Hickey richhic...@gmail.com wrote: user= (type #^{:type ::Fred} [1 2 3]) :user/Fred This is extremely appealing, as David said, for those of us building type systems for our application data. There's one wart for my particular use: (binding [*print-dup* true]

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Jeff Valk
Thanks for the insight, Konrad. I know this is a sideshow to the larger discussion on types, but it does present an unexpected usability issue. On 26 February 2009 at 02:44, Konrad Hinsen wrote: The fix is to provide a default implementation for print-method. Try executing this:

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Daniel Spiewak
Odd. Must be a problem with RubyForge. If you try again, does it work? Daniel On Feb 26, 10:58 am, Christian Vest Hansen karmazi...@gmail.com wrote: Nice initiative! However, it the net-ssh dependency has problems: [cvh: ~]$ sudo gem install djspiewak-buildr ERROR:  While executing gem

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Laurent PETIT
Wow, great ! Some notes I took while reading your e-mail : (those are some pitfalls I came through while implementing clojuredev's eclipse auto-build feature) * does it support namespaces separated in several files (handling files that begin with 'in-ns, or just not trying to compile them ?) *

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Daniel Spiewak
Note that you cannot mix Java and Clojure sources within the same project. Aww... :( Joint-compilation is actually a hard problem normally. However, since Clojure is late-bound, I should be able to do it without too much horror. Actually, I should be able to do joint compilation with

Re: Richer 'partial'

2009-02-26 Thread mikel
On Feb 26, 10:58 am, Anand Patil anand.prabhakar.pa...@gmail.com wrote: On Feb 26, 4:41 pm, mikel mev...@mac.com wrote: Other people have explained currying and partial application, and why it doesn't normally spply the feature you want. I'd be interested in reading about this if you

Re: some vs. contains? for a list

2009-02-26 Thread Jason Wolfe
Hi Mark, The results will depend on the objects you are comparing. If you need to search through the list multiple times, converting to a set once is almost certainly going to be faster. But, if you're just doing it once, iterating will usually be much faster: user (time (dotimes [_ 10]

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Daniel Spiewak
 * does it support namespaces separated in several files (handling files that begin with 'in-ns, or just not trying to compile them ?)  * if so, will it support the scenario of multiple files per ns, where just another file (and not the file defining the ns) is modified ? I didn't even know

Waterfront's Issue tracker is up

2009-02-26 Thread Itay Maman
For those of you who encountered issues/bugs with Waterfront, you not submit reports at: http://sourceforge.net/tracker2/?func=browsegroup_id=249246atid=1126790 My intention is to get Waterfront into contrib in the near future. Till then, Waterfront will stay on sf.net. Also, thank you very

Re: Waterfront's Issue tracker is up

2009-02-26 Thread Itay Maman
Should be you can now submit... Sorry for the typo. -Itay On Feb 26, 9:37 pm, Itay Maman itay.ma...@gmail.com wrote: For those of you who encountered issues/bugs with Waterfront, you not submit reports at:http://sourceforge.net/tracker2/?func=browsegroup_id=249246atid=112... My intention

Re: Richer 'partial'

2009-02-26 Thread mikel
On Feb 26, 12:34 pm, Anand Patil anand.prabhakar.pa...@gmail.com wrote: On Feb 26, 5:27 pm, mikel mev...@mac.com wrote: On Feb 26, 10:58 am, Anand Patil anand.prabhakar.pa...@gmail.com wrote: On Feb 26, 4:41 pm, mikel mev...@mac.com wrote: Other people have explained currying and

Re: Adding strings

2009-02-26 Thread Peter Wolf
Thanks all. I think appending a bunch of strings is a pretty common operation. Is there any reason that str is limited to 2 arguments? It would be nice to do (str foo bar baz) -- foobarbaz. Is there a good reason that + can't do the right thing as with other Java and scripting languages?

Re: Adding strings

2009-02-26 Thread Matt Revelle
On Feb 26, 2009, at 2:01 PM, Peter Wolf wrote: Thanks all. I think appending a bunch of strings is a pretty common operation. Is there any reason that str is limited to 2 arguments? It would be nice to do (str foo bar baz) -- foobarbaz. It does. Try it out. =) Is there a good

Re: Clojure plugin for IntelliJ IDEA published

2009-02-26 Thread CuppoJava
Hello Ilya, Thanks for the workaround. I'm glad to hear you're working on a surround with feature. Some other parenthesis commands that I most commonly use is: 1) Delete next Sexp. 2) Splice Sexp. (Remove the parenthesis around the current sexp). 3) Move cursor to next/previous sexp. Just

Re: Adding strings

2009-02-26 Thread Perry Trolard
Is there any reason that str is limited to 2 arguments? It would be nice to do (str foo bar baz) -- foobarbaz. Try it! (Hint: With more than one arg, returns the concatenation of the str values of the args.) Is there a good reason that + can't do the right thing as with other Java and

Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Phil Hagelberg
Peter Wolf opus...@gmail.com writes: Is there a good reason that + can't do the right thing as with other Java and scripting languages? I think this would be popular with non-LISPers. Putting a type check in + would slow down basic math, and there is a class of user who will complain

Re: Syntax-quote only as a reader macro?

2009-02-26 Thread Chouser
On Thu, Feb 26, 2009 at 9:36 AM, Konrad Hinsen konrad.hin...@laposte.net wrote: I figured out one way to do it, but it relies on features that are perhaps not safe to rely on: I get var first, and then I get the var's namespace from its public attribute ns: (defn qualified-symbol   [s]  

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Cosmin Stejerean
On Thu, Feb 26, 2009 at 1:18 PM, Phil Hagelberg p...@hagelb.org wrote: Peter Wolf opus...@gmail.com writes: Is there a good reason that + can't do the right thing as with other Java and scripting languages? I think this would be popular with non-LISPers. Putting a type check in +

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Daniel Spiewak
Note that you cannot mix Java and Clojure sources within the same project. It is supported in the latest changeset. The following configurations are possible: - Just Clojure: * src/main/clojure Clojure and Scala: * src/main/clojure * src/main/scala Clojure, Scala

Re: Adding strings

2009-02-26 Thread opus111
Doh! *engage brain BEFORE emailing* Sorry to be not thinking... Coffee now! :-P Sent via BlackBerry from T-Mobile -Original Message- From: Perry Trolard trol...@gmail.com Date: Thu, 26 Feb 2009 11:13:49 To: Clojureclojure@googlegroups.com Subject: Re: Adding strings Is there

Re: function call preconditions

2009-02-26 Thread Mark H.
On Feb 26, 5:55 am, Laurent PETIT laurent.pe...@gmail.com wrote: While not checking types at compile time, it seems to me that a lot of clojure code still needs in the docstring some sort of preconditions warnings. Do you mean something like Contract Programming, as in e.g., the Eiffel

Re: function call preconditions

2009-02-26 Thread Laurent PETIT
My first thought was just : could some information that is currently placed in the docstring be more useful is written differently, while still complying with the DRY principle (that is, the parts that are extracted from the current docstring should still be available in a useful form to the

read file into byte[]

2009-02-26 Thread Martin DeMello
Is there a quick way to read a file into a java array of bytes? martin --~--~-~--~~~---~--~~ 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: some vs. contains? for a list

2009-02-26 Thread Mark Volkmann
On Thu, Feb 26, 2009 at 12:02 PM, Jason Wolfe jawo...@berkeley.edu wrote: Hi Mark, The results will depend on the objects you are comparing.  If you need to search through the list multiple times, converting to a set once is almost certainly going to be faster.  But, if you're just doing it

Re: some vs. contains? for a list

2009-02-26 Thread Jason Wolfe
Ah, OK, a couple of things. First, if you're running timing experiments, you probably want the times to be measured in seconds for them to be at all reliable. It seems to take up to 10 seconds of executing a bit of code before HotSpot is done optimizing it (depending on complexity of what

Re: Syntax-quote only as a reader macro?

2009-02-26 Thread Konrad Hinsen
On 26.02.2009, at 20:25, Chouser wrote: I've got essentially the same thing for use in error-kit: (defn- qualify-sym [sym] (let [v (resolve sym)] (assert v) (apply symbol (map #(str (% ^v)) [:ns :name] Except that you get the information from the metadata. I wonder

order of the arguments for functions, think an easy way.

2009-02-26 Thread camponoblanco
This is an example: (contains? (set (range 100)) 10))) (some #(= 10 %) (range 100 I would like some way to rule the order of the arguments. For example what - where. contains? what where some what where I'm sure you can think some rules to cover many cases. As I am not so young, I'm

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Konrad Hinsen
On 26.02.2009, at 10:00, Konrad Hinsen wrote: I know, but as I said, my current implementation is just a proof of concept. It is not viable for production use for a variety of reasons. I was planning to replace it by something based on gen-class and proxy, but I will first try to get away

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Christian Vest Hansen
On Thu, Feb 26, 2009 at 6:17 PM, Daniel Spiewak djspie...@gmail.com wrote: Odd.  Must be a problem with RubyForge.  If you try again, does it work? I tried again at home and got quite a bit further. Maybe it was just a hiccup at rubyforge. However, I still see some questionable things in the

Re: order of the arguments for functions, think an easy way.

2009-02-26 Thread Stephen C. Gilardi
On Feb 26, 2009, at 3:57 PM, camponoblanco wrote: This is an example: (contains? (set (range 100)) 10))) (some #(= 10 %) (range 100 I would like some way to rule the order of the arguments. For example what - where. contains? what where some what where I'm sure you can think some

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Daniel Spiewak
I'm not sure what the File not found thing is all about, but you should still be ok (crazy gems). Try the following: buildr --version Daniel On Feb 26, 3:16 pm, Christian Vest Hansen karmazi...@gmail.com wrote: On Thu, Feb 26, 2009 at 6:17 PM, Daniel Spiewak djspie...@gmail.com wrote:

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Peter Wolf
OK had my coffee, and had several thoughts... 1 -- What are Strings? How should the Clojure programmer think about them? Are they sequences, in which case all the sequence functions should work. Or are they atomic built-in types like Integers and Floats? 2 -- There is already some type

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Christian Vest Hansen
rowe:~$ buildr --version /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- buildr (LoadError) from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require' from

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Allen Rohner
So my vote is that String are atomic built in objects, and at least +, and should work with Strings.  The behavior should be just like Java, so (+ foo 2) -- foo2 -1 Concatenation is not addition. I'm almost opposed to numeric operators all together. If we wrote (add 2 3), there would be

Re: unbean

2009-02-26 Thread Kevin Albrecht
Thanks. I will definitely be using this function... keep me up to date on any changes. Bill wrote: It occurs to me that the unbean function could be very useful when writing tests for code that calls Java objects. Yes, that is exactly the use I have in mind.

Re: how to get concurrent - model design question

2009-02-26 Thread Timothy Pratley
Ah I see, yes that makes sense. Relationships truly are a contract in this case! --~--~-~--~~~---~--~~ 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

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Laurent PETIT
Agree, I even think there *could* be some utility in having the opposite behavior (but I'm not even sure about that) : (+ 1 2) -- 3 by + trying to cast its non numeric arguments before throwing an exception ... -- Laurent 2009/2/26 Allen Rohner aroh...@gmail.com So my vote is that

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Phil Hagelberg
Laurent PETIT laurent.pe...@gmail.com writes: Concatenation is not addition. I'm almost opposed to numeric operators all together. If we wrote (add 2 3), there would be no confusion at all about what (add foo 2) should do, because you'd be writing (conj foo (str 2))

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Mike Benfield
On Feb 26, 4:56 pm, Peter Wolf opus...@gmail.com wrote: So my vote is that String are atomic built in objects, and at least +, and should work with Strings.  The behavior should be just like Java, so (+ foo 2) -- foo2 I have an HP calculator. (I may get some of the details wrong here,

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Allen Rohner
I agree regarding concatenation as well, but I think the case for comparison of non-numerics is still pretty strong. -Phil Are you referring to using , , =, with objects that implement java.lang.Comparable? i.e. given x.compareTo(y) == -1 ( x y) = true I would find that useful. Allen

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Allen Rohner
If we wrote (add 2 3), there would be no confusion at all about what (add foo 2) should do, because you'd be writing (conj foo (str 2)) I wrote this too hastily. This could more easily be written (str foo 2) --Allen --~--~-~--~~~---~--~~ You received this

Re: Clojure plugin for IntelliJ IDEA published

2009-02-26 Thread Howard Lewis Ship
I've only had a couple of minutes to work with it, but I'm already liking it. I just can't keep switching between Emacs and IDEA and IDEA is the work that pays the bills! On Thu, Feb 26, 2009 at 11:08 AM, CuppoJava patrickli_2...@hotmail.com wrote: Hello Ilya, Thanks for the workaround.

Re: ANN: Preliminary Clojure Support in Buildr

2009-02-26 Thread Daniel Spiewak
Crud. I suspect this is something weird with the way that the GitHib gem server works. I'll try to repeat the problem on Ubuntu as soon as I get back to my computer. In the meantime, you could try these commands: sudo gem uninstall djspiewak-buildr sudo gem install djspiewak-buildr

Please help me get rid of my mutable code.

2009-02-26 Thread CuppoJava
Hi, After having used Clojure for a few months now, I'm still having lots of trouble separating my mutable code from my immutable code. My use- case is pretty typical I think, so I'm wondering what sort of structure everyone else is using. Here's my current structure. I have an engine that

Re: read file into byte[]

2009-02-26 Thread Chouser
On Thu, Feb 26, 2009 at 3:04 PM, Martin DeMello martindeme...@gmail.com wrote: Is there a quick way to read a file into a java array of bytes? (let [fl (java.io.File. /tmp/datafile) ary (make-array Byte/TYPE (.length fl))] (with-open [strm (java.io.FileInputStream. fl)] (.read strm

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Phil Hagelberg
Allen Rohner aroh...@gmail.com writes: I agree regarding concatenation as well, but I think the case for comparison of non-numerics is still pretty strong. Are you referring to using , , =, with objects that implement java.lang.Comparable? i.e. given x.compareTo(y) == -1 ( x y) = true

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Eric Tschetter
I'm not sure of the details since I don't know much about Java, but that sounds about right. I'm working on a date library, and having to use functions like earlier? and later? rather than , , =, and = feels awkward. You are probably thinking of dates as numerical longs rather than actual

Re: read file into byte[]

2009-02-26 Thread Martin DeMello
On Feb 27, 8:01 am, Chouser chou...@gmail.com wrote: Seriously, what's with this API?  I give up. Yeah, I spent an hour or so sifting through nio before throwing up my hands :) Also, (getBytes (slurp file)) sounded like it would work, but it does charset encoding. martin

Re: read file into byte[]

2009-02-26 Thread Martin DeMello
On Feb 27, 8:02 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Feb 26, 3:04 pm, Martin DeMello martindeme...@gmail.com wrote: Is there a quick way to read a file into a java array of bytes? You want Apache Commons IO:http://commons.apache.org/io/

Re: Please help me get rid of my mutable code.

2009-02-26 Thread Tom Ayerst
If most of the state is in the sprites and they don't co-ordinate then could you make the sprites agents and use watchers to manage their forward notifications. Any global state (the event loop) can be managed functionally by recursively passing the updated state as a parameter into the event

Re: Mathy operations on non-numerics (was Adding strings)

2009-02-26 Thread Konrad Hinsen
On 26.02.2009, at 20:18, Phil Hagelberg wrote: One approach that's been proposed in #clojure is to make these functions more capable by default, but then provide a fast-math library that could redefine them in terms of numerics-only. I'm a big fan of functions doing the most helpful

namespace docstrings

2009-02-26 Thread Konrad Hinsen
I have been trying in vain to get the namespace docstring of anything with print-namespace-doc. It doesn't say what exactly it wants as an argument (a symbol, a string, or a namespace object), but it calls ns-name, which wants a symbol, so I give it a symbol. But the symbol doesn't have

  1   2   >