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 d

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

how to get concurrent - model design question

2009-02-26 Thread bOR_
Hi all. First. For those who remember, I posted an individual-based model in this group some time ago (eden.clj), and got some very helpful replies on where I misunderstood clojure and did things the hard way. I wanted to report that that model by now is written purely as nonblocking agents, and

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 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 the assertion f

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 i

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" 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 may

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 com

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

Re: Syntax-quote only as a reader macro?

2009-02-26 Thread Konrad Hinsen
On Feb 26, 2009, at 12:26, Konrad Hinsen wrote: > At the moment I am using the following function, which does a syntax- > quote for a single symbol: > > (defn symbol-in-current-ns >[s] >(symbol (str *ns*) (str s))) Of course that should better be (defn qualified-symbol [s] (let [s

Re: Waterfront Assertion Failure

2009-02-26 Thread Onorio Catenacci
On Feb 26, 6:10 am, Itay Maman 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. -- Onorio --~--

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Rich Hickey
On Feb 26, 4:00 am, Konrad Hinsen 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 added a type funct

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Rich Hickey
On Feb 26, 4:17 am, Laurent PETIT wrote: > 2009/2/26 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 proh

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 clojure+unsubscr...

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Rich Hickey
On Feb 26, 6:19 am, Konrad Hinsen 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 added a type func

Re: Is syntax quote "reader" only?

2009-02-26 Thread Chouser
On Mon, Feb 16, 2009 at 8:31 PM, Brian Will 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 punt the problem to eval

Re: Waterfront Assertion Failure

2009-02-26 Thread Itay Maman
On Feb 26, 2:11 pm, Onorio Catenacci wrote: > On Feb 26, 6:10 am, Itay Maman 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 assertio

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-26 Thread Itay Maman
On Feb 26, 2:02 pm, Konrad Hinsen 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 compiler, my guess

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 bei

Re: new laziness: terminology help

2009-02-26 Thread Rich Hickey
On Feb 25, 8:02 pm, Mark Engelberg 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 next. > > I unders

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-26 Thread Laurent PETIT
2009/2/26 Itay Maman > > > > On Feb 26, 2:02 pm, Konrad Hinsen 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 compile

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Laurent PETIT
2009/2/26 Rich Hickey > > > > On Feb 26, 4:17 am, Laurent PETIT wrote: > > 2009/2/26 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

Re: The Sequential interface (implementation question)

2009-02-26 Thread Rich Hickey
On Feb 26, 12:00 am, dmiller 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 RT.seq(x) will succe

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 > > 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 disp

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Rich Hickey
On Feb 26, 8:30 am, Laurent PETIT wrote: > 2009/2/26 Rich Hickey > > > > > > > On Feb 26, 4:17 am, Laurent PETIT wrote: > > > 2009/2/26 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 >

Re: Mini-Kanren

2009-02-26 Thread Michel S.
Hi Jim, On Feb 25, 6:38 pm, jim 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 way through

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

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Laurent PETIT
2009/2/26 Rich Hickey > > > > On Feb 26, 8:30 am, Laurent PETIT wrote: > > 2009/2/26 Rich Hickey > > > > > > > > > > > > > On Feb 26, 4:17 am, Laurent PETIT wrote: > > > > 2009/2/26 Konrad Hinsen > > > > > > > On 26.02.2009, at 01:51, Rich Hickey wrote: > > > > > > > > You raise interesting i

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 Do

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 load

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

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." wrote: > Hi Jim, > > "In Scheme, passing cons one parameter encloses that parameter in a > li

Re: Mini-Kanren

2009-02-26 Thread Pierpaolo Bernardi
On Thu, Feb 26, 2009 at 4:03 PM, jim 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 place of missin

Re: Clojure documentation problems

2009-02-26 Thread Chouser
On Wed, Feb 25, 2009 at 6:00 AM, David Sletten 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 svn version. -

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 wrote: > no. in scheme (and in all modern lisps), cons is a 2 arguments procedure. > Giving it 1 is an error. > > Some v

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 > > 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 partially-applied function from one o

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

some vs. contains? for a list

2009-02-26 Thread Mark Volkmann
I thought for sure it would be faster to use "some" to determine whether an item was in a list rather than convert the list to a set and then use "contains?", but it turns out I was wrong. The latter approach takes about 1/3 to 1/2 the time! This is the case even when the list contains 100 items.

Re: Richer 'partial'

2009-02-26 Thread Laurent PETIT
2009/2/26 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*. > Ah, I thought currying / uncurrying what the term reserved for this operation (as I reme

"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 > > 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") >(int

Re: "Adding" strings

2009-02-26 Thread pmf
On Feb 26, 5:11 pm, Peter Wolf 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" "

Re: "Adding" strings

2009-02-26 Thread Shawn Hoover
On Thu, Feb 26, 2009 at 11:11 AM, Peter Wolf 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 "

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: #(

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: #(

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 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 made a little test ?

Re: Richer 'partial'

2009-02-26 Thread mikel
On Feb 26, 9:24 am, Anand Patil 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 any such thing already

Re: Richer 'partial'

2009-02-26 Thread Anand Patil
On Feb 26, 4:41 pm, mikel 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, the way to > a

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 wrote

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread mikel
On Feb 25, 6:51 pm, Rich Hickey 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] (prn-str #^{:

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: > > (def

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 wrote: > Nice initiative! > > However, it the net-ssh dependency has problems: > > [cvh: ~]$ sudo gem install djspiewak-buildr > ERROR:  While executing gem ... (Gem::Remot

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 wi

Re: Richer 'partial'

2009-02-26 Thread mikel
On Feb 26, 10:58 am, Anand Patil wrote: > On Feb 26, 4:41 pm, mikel 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. What I meant was, other

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 k

Re: some vs. contains? for a list

2009-02-26 Thread Jason Wolfe
Well, I guess the second number is a bit misleading. Of course, when you're iterating the time taken will depend on the (expected) presence and position of the target in the list. Still, the order is the same even in the worst case: user> (time (dotimes [_ 10] (some #(= 100 %) (range 100)))

Re: Richer 'partial'

2009-02-26 Thread Anand Patil
On Feb 26, 5:27 pm, mikel wrote: > On Feb 26, 10:58 am, Anand Patil > wrote: > > > On Feb 26, 4:41 pm, mikel 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 i

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=browse&group_id=249246&atid=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 m

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 wrote: > For those of you who encountered issues/bugs with Waterfront, you not > submit reports > at:http://sourceforge.net/tracker2/?func=browse&group_id=249246&atid=112... > > My intention is to get W

Re: Richer 'partial'

2009-02-26 Thread mikel
On Feb 26, 12:34 pm, Anand Patil wrote: > On Feb 26, 5:27 pm, mikel wrote: > > > On Feb 26, 10:58 am, Anand Patil > > wrote: > > > > On Feb 26, 4:41 pm, mikel wrote: > > > > > Other people have explained currying and partial application, and why > > > > it doesn't normally spply the feature

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 lang

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

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

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 >

Mathy operations on non-numerics (was "Adding" strings)

2009-02-26 Thread Phil Hagelberg
Peter Wolf 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 loudly if basic mat

Re: Syntax-quote only as a reader macro?

2009-02-26 Thread Chouser
On Thu, Feb 26, 2009 at 9:36 AM, Konrad Hinsen 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] >   (if-let [var (reso

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 wrote: > > Peter Wolf 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

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,

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 Date: Thu, 26 Feb 2009 11:13:49 To: Clojure Subject: Re: "Adding" strings > Is there any reason that str is limited to 2 argum

Re: function call preconditions

2009-02-26 Thread Mark H.
On Feb 26, 5:55 am, Laurent PETIT 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 programming language?

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 clien

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 fro

Re: some vs. contains? for a list

2009-02-26 Thread Mark Volkmann
On Thu, Feb 26, 2009 at 12:02 PM, Jason Wolfe 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 > once, iterat

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 won

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 ge

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 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 output, and I ha

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 rule

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 wrote: > On Thu, Feb 26, 2009 at 6:17 PM, Daniel Spiewak wrote: > > > Odd.  Must be a problem with RubyForg

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 chec

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 /opt/local/lib/ruby/gems/1.8/g

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), the

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 unsubs

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 > > > > > > So my vote is that String are at

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

2009-02-26 Thread Phil Hagelberg
Laurent PETIT 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)) > > Agree I agre

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

2009-02-26 Thread Mike Benfield
On Feb 26, 4:56 pm, Peter Wolf 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, I haven

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

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 th

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 wrote: > > Hello Ilya, > Thanks for the workaround. > > I'm glad to hear you're

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 Daniel

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 manag

Re: read file into byte[]

2009-02-26 Thread Chouser
On Thu, Feb 26, 2009 at 3:04 PM, Martin DeMello 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 ary 0 (.length fl))

Re: read file into byte[]

2009-02-26 Thread Stuart Sierra
On Feb 26, 3:04 pm, Martin DeMello 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/ Specifically, http://tinyurl.com/cytspt -Stuart Sierra --~--~-~--~~~---~--~~ You received this

  1   2   >