Re: Fully lazy sequences are here!

2009-02-18 Thread Stefan Rusek

On Wed, Feb 18, 2009 at 8:02 PM, Rich Hickey richhic...@gmail.com wrote:



 On Feb 18, 12:20 pm, Frantisek Sodomka fsodo...@gmail.com wrote:
 How should I say it... It just didn't look symmetrical to me.

 So, basically, there is a difference between functions returning
 sequences - depending on if they are lazy or eager. Hmm...

 user= (reverse [])
 nil
 user= (if (reverse []) true false)
 false
 user= (if (seq (reverse [])) true false)
 false

 user= (lazy-seq nil)
 ()
 user= (seq (lazy-seq nil))
 nil
 user= (if (lazy-seq nil) true false)
 true
 user= (if (seq (lazy-seq nil)) true false)
 false

 As long as I remember which function is lazy and which one is eager, I
 should be fine then.

 Just wanted to really understand it.


 It shouldn't be that subtle. Sequence functions shouldn't return nil
 unless they are variants of seq/next. I've fixed reverse and sort to
 return () when passed empty colls - SVN 1294.

 Rich.


Wouldn't it make more sense to to return an empty version of the same
collection type? That way the following would work more like someone
would expect.

(conj (rest [1]) 2) - [2] instead of (2)

--Stefan

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure on CLR/DLR

2009-02-17 Thread Stefan Rusek

I've been working on Xronos which is also a c# version of clojure (I
need to be careful to not use the work port, since it doesn't share
any code with clojure). It compiles to the DLR as well. It is located
here:

http://www.bitbucket.org/stefanrusek/xronos/wiki/Home

One big difference is that Xronos is released under the BSD license
instead of the Eclipse Public License.

--Stefan Rusek
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread Stefan Rusek

At first I found this kind of confusing, but after reading Chouser's
article and the help. It makes a lot of sense. I found it easiest to
understand when I thought about it as two pairs of related names. The
first/rest pair and the seq/more pair.
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Strings as functions of maps

2008-12-11 Thread Stefan Rusek

If we have the following map:

(def m {:key 1 'sym 2 str 3})

The following are equivalent:

(:key m)
(m :key)

As are the following:

('sym m)
(m 'sym)

I think the commutativity of maps with symbols and keywords is a
valuable and good thing. I realize that the String class doesn't
implement the IFn interface, but it would be nice if maps and strings
were commutative. Unfortunately they aren't:

(str m) ; throws invalid cast
(m str) ; works fine

I realize that almost any type can be used as a key for a map, but
keywords, symbols, and strings are by far the most common, and it
would make sense to bring strings in line with the other two.
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---