Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Fully lazy sequences are coming - feedback wanted!
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 69 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rich Hickey  
View profile  
 More options Feb 15 2009, 12:18 pm
From: Rich Hickey <richhic...@gmail.com>
Date: Sun, 15 Feb 2009 09:18:46 -0800 (PST)
Local: Sun, Feb 15 2009 12:18 pm
Subject: Fully lazy sequences are coming - feedback wanted!
I'm pretty much finished with the fully-lazy implementation and am
happy so far with the results. I think this will be an important
addition to Clojure and am planning to add it.

Now comes the hard part - names and change. The essence of the fully
lazy seqs is that they will not consume any resources, perform any
computation or trigger any side effects until they are consumed. This
is a change to the way the sequence functions work now, in that, in
order to determine whether they should return a seq or nil, they need
to touch at least one item. So, there will be an additional function
on seqs, one that returns the items other than the first as a logical,
non-nil, possibly empty collection. Calling seq on this collection
will give you what rest currently gives you - the next seq object or
nil if none. So the core operations on seqs will be:

;item
(first x)

;collection of remaining items, possibly empty
(possibly-empty-collection-of-the-remaining-items x)

;seq on next item, or nil if none
(seq-on-the-next-item-if-any-else-nil x)

(first x) is uncontroversial and won't change. The second is a new
function. The third is currently called 'rest'.

I have some ideas for names, and there are definitely tradeoffs
between short-term pain and long-term goodness in some of the options.
The first option is to leave rest alone, and give the new function a
new name, like more.

;item
(first x)

;collection of remaining items, possibly empty
(more x)

;seq on next item, or nil if none
(rest x)

Note that (rest x) === (seq (more x))

This is implemented in the lazy branch, SVN rev 1281. It has the
attribute of requiring the fewest changes to existing code, and the
drawback of leaving us with less-than-ideal names, especially insofar
as more (or whatever you choose to call it) will in some way seem
synonymous with rest. This naming scheme, and the changes it implies,
is documented here:

http://clojure.org/lazier1

The second option is to choose the best possible names, and deal with
some short term pain in porting and confusion. I think the best names
are:

;item
(first x)

;collection of remaining items, possibly empty
(rest x)

;seq on next item, or nil if none
(next x)

This is implemented in the lazy branch, SVN rev 1282. Note that this
changes the meaning of rest, and gives the current rest operation a
new name, next. It has the attributes of using the most appropriate
names (IMO) and the drawback of changing the semantics of a frequently
used function name, but still offering that functionality under a
different name. It would also break the compatibility of rest with
Common Lisp's. As with the previous model, the third function can be
defined in terms of the second - (next x) === (seq (rest x)). This
naming scheme, and the changes it implies, is documented here:

http://clojure.org/lazier

A third option would be to retire rest and use only new names:

;item
(first x)

;collection of remaining items, possibly empty
(more x)

;seq on next item, or nil if none
(next x)

I haven't implemented this.

I prefer first/rest/next. I think rest is the best complement to
first, and it should mean the logical collection once things are fully
lazy. I think next implies the next seq, as well as the eager nature
of the operation.

I am looking for feedback from people willing to read and understand
the linked-to documentation and the fully lazy model, and especially
from those trying the lazy branch code and porting some of your own.
Questions on the model welcome as well. Chouser has also blogged a bit
about this, with some useful descriptions of nil punning:

http://blog.n01se.net/?p=39

I've been working on this for a few months, in lieu of more
interesting things, because I knew it would be a breaking change and
we're trying to get the biggest of those behind us. I appreciate any
effort you spend in trying to provide informed input.

Thanks,

Rich


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Howard Lewis Ship  
View profile  
 More options Feb 15 2009, 1:08 pm
From: Howard Lewis Ship <hls...@gmail.com>
Date: Sun, 15 Feb 2009 10:08:21 -0800
Local: Sun, Feb 15 2009 1:08 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
I would vote that you change to the optimum names, but work with Stu
Halloway to ensure that either his book gets updated before it is
printed, or there is a "cheat sheet" on the Clojure site to translate
from his book to any new names.

--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CuppoJava  
View profile  
 More options Feb 15 2009, 1:43 pm
From: CuppoJava <patrickli_2...@hotmail.com>
Date: Sun, 15 Feb 2009 10:43:24 -0800 (PST)
Local: Sun, Feb 15 2009 1:43 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
I'm also in support of the optimal names. Clojure is not too widely
used in production code yet, and it would be a shame to start
compromising design decisions for backwards compatibility already.

This is actually one of my (and many other people's) favorite parts
about Clojure, the beauty of Lisp without the baggage. I wouldn't like
for Clojure to start carrying baggage of its own.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CuppoJava  
View profile  
 More options Feb 15 2009, 1:58 pm
From: CuppoJava <patrickli_2...@hotmail.com>
Date: Sun, 15 Feb 2009 10:58:16 -0800 (PST)
Local: Sun, Feb 15 2009 1:58 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
One thing I did find confusing though was in regards to the doc.
Is there a way to more clearly differentiate between a seq and a
sequence? Up until now, I've always thought of "seq" as just being
shorthand for "sequence" which isn't the case apparently.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jim  
View profile  
 More options Feb 15 2009, 2:43 pm
From: jim <jim.d...@gmail.com>
Date: Sun, 15 Feb 2009 11:43:50 -0800 (PST)
Local: Sun, Feb 15 2009 2:43 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
I also favor the optimal names.  We're the pioneers in using clojure,
so we should expect a few arrows.  Hopefully, the number of clojure
users in the future will be an order of magnitude greater than where
we are now.  For us to take short term hit, we can save a large number
of people a lot of cycles later on.  I also prefer it on aesthetic
grounds.  Breaking compatibility doesn't bother me much.

Jim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vincent Foley  
View profile  
 More options Feb 15 2009, 2:48 pm
From: Vincent Foley <vfo...@gmail.com>
Date: Sun, 15 Feb 2009 11:48:09 -0800 (PST)
Local: Sun, Feb 15 2009 2:48 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
Hello Rich,

I'll play around with the lazy branch this week, and this is just a
name suggestion: what do you think of first/tail/rest where (rest s)
== (seq (tail s))?  tail is already used in other functional languages
such as Haskell and OCaml to represent all-but-the-first elements, so
it wouldn't be completely foreign.

Vincent.

On Feb 15, 12:18 pm, Rich Hickey <richhic...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aaron Scott  
View profile  
 More options Feb 15 2009, 2:04 pm
From: Aaron Scott <arsc...@gmail.com>
Date: Sun, 15 Feb 2009 11:04:30 -0800
Local: Sun, Feb 15 2009 2:04 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
I agree with the op. While the language is still relatively young  
please break things so they sit better in the long term. Accurate and  
descriptive names are totally valueable, and I'm pretty handy with  
find/replace on the editor anyway :p

Aaron

On Feb 15, 2009, at 10:43 AM, CuppoJava <patrickli_2...@hotmail.com>  
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Konrad Hinsen  
View profile  
 More options Feb 15 2009, 3:01 pm
From: Konrad Hinsen <konrad.hin...@laposte.net>
Date: Sun, 15 Feb 2009 21:01:58 +0100
Local: Sun, Feb 15 2009 3:01 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
On 15.02.2009, at 20:48, Vincent Foley wrote:

> I'll play around with the lazy branch this week, and this is just a
> name suggestion: what do you think of first/tail/rest where (rest s)
> == (seq (tail s))?  tail is already used in other functional languages
> such as Haskell and OCaml to represent all-but-the-first elements, so
> it wouldn't be completely foreign.

I like that choice as well.

Otherwise, I'll join the crowd who thinks that it's better to get  
everything in order now without making compromises for backwards  
compatibility.

Konrad.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rich Hickey  
View profile  
 More options Feb 15 2009, 3:25 pm
From: Rich Hickey <richhic...@gmail.com>
Date: Sun, 15 Feb 2009 12:25:04 -0800 (PST)
Local: Sun, Feb 15 2009 3:25 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2:48 pm, Vincent Foley <vfo...@gmail.com> wrote:

> Hello Rich,

> I'll play around with the lazy branch this week, and this is just a
> name suggestion: what do you think of first/tail/rest where (rest s)
> == (seq (tail s))?  tail is already used in other functional languages
> such as Haskell and OCaml to represent all-but-the-first elements, so
> it wouldn't be completely foreign.

That falls into the synonym category - tail/rest mean roughly the same
thing. tail complements head, which we aren't using. Coming from
outside, I'd have no idea which did what or why.

Rich


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kyle smith  
View profile  
 More options Feb 15 2009, 4:22 pm
From: kyle smith <the1physic...@gmail.com>
Date: Sun, 15 Feb 2009 13:22:28 -0800 (PST)
Local: Sun, Feb 15 2009 4:22 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
"It would also break the compatibility of rest with Common Lisp's"
This is of mild concern to me, but I think if there was a prominent
warning on clojure.org, I could get over it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen C. Gilardi  
View profile  
 More options Feb 15 2009, 4:30 pm
From: "Stephen C. Gilardi" <squee...@mac.com>
Date: Sun, 15 Feb 2009 16:30:50 -0500
Local: Sun, Feb 15 2009 4:30 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2009, at 12:18 PM, Rich Hickey wrote:

> I am looking for feedback from people willing to read and understand
> the linked-to documentation and the fully lazy model, and especially
> from those trying the lazy branch code and porting some of your own.

I'm trying svn rev 1282 with the following test (which depends on  
javadb, (derby)):

        user=> (use 'clojure.contrib.sql.test)
        nil
        user=> (db-write)

It hangs there. This works on the trunk.

I looked for uses of rest in the following libs and didn't find any:

        clojure.contrib.sql
        clojure.contrib.sql.internal
        clojure.contrib.sql.test

I tried using Chouser's "-Dclojure.assert-if-lazy-seq=please"  
facility. While I was able to trigger an exception from it using  
sample code, it wasn't triggered during the hang.

I'd like to figure this out.

- Has anyone gotten past this already?
- Does anyone see the problem by inspecting the lib code?
- This seems like an opportunity for me to use a Java debugger with  
Clojure for the first time. Has anyone written about using JSwat or  
another debugger with Clojure?

I would appreciate hearing any tips for getting to the cause of this.

--Steve

  smime.p7s
3K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen C. Gilardi  
View profile  
 More options Feb 15 2009, 4:35 pm
From: "Stephen C. Gilardi" <squee...@mac.com>
Date: Sun, 15 Feb 2009 16:35:08 -0500
Local: Sun, Feb 15 2009 4:35 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2009, at 4:30 PM, Stephen C. Gilardi wrote:

> - This seems like an opportunity for me to use a Java debugger with  
> Clojure for the first time. Has anyone written about using JSwat or  
> another debugger with Clojure?

:-) clojure.org Getting Started page.

--Steve

  smime.p7s
3K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rich Hickey  
View profile  
 More options Feb 15 2009, 4:40 pm
From: Rich Hickey <richhic...@gmail.com>
Date: Sun, 15 Feb 2009 13:40:41 -0800 (PST)
Local: Sun, Feb 15 2009 4:40 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 4:30 pm, "Stephen C. Gilardi" <squee...@mac.com> wrote:

> On Feb 15, 2009, at 12:18 PM, Rich Hickey wrote:

> > I am looking for feedback from people willing to read and understand
> > the linked-to documentation and the fully lazy model, and especially
> > from those trying the lazy branch code and porting some of your own.

> I'm trying svn rev 1282 with the following test (which depends on
> javadb, (derby)):

>         user=> (use 'clojure.contrib.sql.test)
>         nil
>         user=> (db-write)

> It hangs there. This works on the trunk.

Are you burning cycles while hung, or just blocked?

Rich


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chouser  
View profile  
 More options Feb 15 2009, 4:44 pm
From: Chouser <chou...@gmail.com>
Date: Sun, 15 Feb 2009 16:44:48 -0500
Local: Sun, Feb 15 2009 4:44 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
Here's an example of what I think will be the worst kind of breakage
resulting from changing the meaning of rest from
seq-on-the-next-item-if-any-else-nil to
possibly-empty-collection-of-the-remaining-items:

(defn my-interpose [x & coll]
  (loop [v [x] coll coll]
    (if coll
      (recur (-> v (conj (first coll)) (conj x)) (rest coll))
      v)))

This is a bit like the builtin interpose, except it takes multiple
args instead of a collection, and it returns a vector with the
interposed value surrounding all the others:

(my-interpose 'x 'a 'b 'c)
-> [x a x b x c x]

At least that's what it does in svn 1282 trunk.  In 1282 lazy branch,
it's an infinite loop.  Can you spot the problem?

When discussing this yesterday in IRC, I was pretty firmly against
Rich's preferred names, for exactly this reason.  And worse than
trying to fix my own code would be the potential confusion over which
versions of examples, libs, etc. work with which versions of Clojure.

...but my position has softened, as I tried to construct an example
for this post that actually broke in a bad way.  My first several
attempts produced code that worked in both versions.

For example, my-interpose above takes multiple args so that I could
safely assume that 'coll' is a seq.  My first (unposted) version took
a collection as a second argument, but in that case a simple
"(if coll" is probably already an error, in case a user passed in an
empty vector, or some other collection.  The solution would be to test
the seq of the coll:

(defn my-interpose [x coll]
  (loop [v [x] coll coll]
    (if (seq coll)         ; Don't assume coll is a seq-or-nil
      (recur (-> v (conj (first coll)) (conj x)) (rest coll))
      v)))

That also happens to solve the lazy-branch infinite-loop problem --
what's more correct in trunk is more correct in lazy, in this case.
So I kept refining my-interpose, trying to get a version that was
correct in trunk but caused a non-exception error in lazy.  After
several iterations I finally got the one at the top of this post.

...but even that one can be caught easily by turning on
clojure.assert-if-lazy-seq, in which case you get an exception
pointing directly to the line that needs to be changed:

java.lang.Exception: LazySeq used in 'if'

So the same changes that will already have to be made to nil puns for
the other seq functions would now have to be made for uses of the new
'rest' function.

Sorry if this has been a bit long-winded, but I wanted to explain why
I've changed my mind a bit -- changing the meaning of 'rest' may not
be as bad as I had been thinking.

--Chouser


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chouser  
View profile  
 More options Feb 15 2009, 4:52 pm
From: Chouser <chou...@gmail.com>
Date: Sun, 15 Feb 2009 16:52:24 -0500
Local: Sun, Feb 15 2009 4:52 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
On Sun, Feb 15, 2009 at 4:30 PM, Stephen C. Gilardi <squee...@mac.com> wrote:

> I'm trying svn rev 1282 with the following test (which depends on javadb,
> (derby)):

>        user=> (use 'clojure.contrib.sql.test)
>        nil
>        user=> (db-write)

> It hangs there. This works on the trunk.

I just tried this on 1282 lazy branch with assert-if-lazy-seq, and I
get no exception and no hang:

user=> (time (db-write))
"Elapsed time: 802.020886 msecs"

I wonder what's different?

I seem to have version 1.6.0_07 of javadb, java, and javac, running on
Ubuntu.

--Chouser


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen C. Gilardi  
View profile  
 More options Feb 15 2009, 4:55 pm
From: "Stephen C. Gilardi" <squee...@mac.com>
Date: Sun, 15 Feb 2009 16:55:38 -0500
Local: Sun, Feb 15 2009 4:55 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2009, at 4:40 PM, Rich Hickey wrote:

> Are you burning cycles while hung, or just blocked?

One core is pinned.

--Steve

  smime.p7s
3K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Konrad Hinsen  
View profile  
 More options Feb 15 2009, 5:00 pm
From: Konrad Hinsen <konrad.hin...@laposte.net>
Date: Sun, 15 Feb 2009 23:00:26 +0100
Local: Sun, Feb 15 2009 5:00 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
On 15.02.2009, at 18:18, Rich Hickey wrote:

> I've been working on this for a few months, in lieu of more
> interesting things, because I knew it would be a breaking change and
> we're trying to get the biggest of those behind us. I appreciate any
> effort you spend in trying to provide informed input.

For those who want to play with this without keeping two versions of  
their source code files, I have added a new macro lazy-and-standard-
branch to clojure.contrib.macros. Here is an example of how to use it:

(lazy-and-standard-branch

   (defn value-seq [f seed]
     (lazy-seq
       (let [[value next] (f seed)]
         (cons value (value-seq f next)))))

   (defn value-seq [f seed]
     (let [[value next] (f seed)]
       (lazy-cons value (value-seq f next))))

)

Konrad.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Feb 15 2009, 5:01 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Sun, 15 Feb 2009 14:01:46 -0800
Local: Sun, Feb 15 2009 5:01 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Sun, Feb 15, 2009 at 1:44 PM, Chouser <chou...@gmail.com> wrote:
> (defn my-interpose [x coll]
>  (loop [v [x] coll coll]
>    (if (seq coll)         ; Don't assume coll is a seq-or-nil
>      (recur (-> v (conj (first coll)) (conj x)) (rest coll))
>      v)))

You know, there is an empty? predicate.  Why not write it as:
 (defn my-interpose [x coll]
  (loop [v [x] coll coll]
    (if (empty? coll) v         ; Don't assume coll is a seq-or-nil
      (recur (-> v (conj (first coll)) (conj x)) (rest coll)))))

I know that your first version is viewed as more idiomatic in Clojure,
but I've never understood why Rich and others prefer that style.  It
assumes that converting something to a seq is guaranteed to be a
computationally cheap operation, and I see no reason to assume that
will always be the case.   I can certainly imagine seq-able
collections that take some time seq-ify, so converting to a seq to
test for empty, and then just throwing it away causing it to be
recomputed in rest doesn't seem as future-proof as just using empty?.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen C. Gilardi  
View profile  
 More options Feb 15 2009, 5:03 pm
From: "Stephen C. Gilardi" <squee...@mac.com>
Date: Sun, 15 Feb 2009 17:03:33 -0500
Local: Sun, Feb 15 2009 5:03 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2009, at 4:52 PM, Chouser wrote:

> I just tried this on 1282 lazy branch with assert-if-lazy-seq, and I
> get no exception and no hang:

> user=> (time (db-write))
> "Elapsed time: 802.020886 msecs"

> I wonder what's different?

Based on it working for you, the current theory I'm working to verify  
is that this was caused by a clojure-contrib.jar compiled with trunk  
interacting with a clojure.jar from lazy 1282.

Should we branch contrib and do the fixups on a lazy branch? Chouser,  
have you already fixed it enough to compile with clojure contrib's  
build.xml?

--Steve

  smime.p7s
3K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Konrad Hinsen  
View profile  
 More options Feb 15 2009, 5:09 pm
From: Konrad Hinsen <konrad.hin...@laposte.net>
Date: Sun, 15 Feb 2009 23:09:36 +0100
Local: Sun, Feb 15 2009 5:09 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
On 15.02.2009, at 23:00, Konrad Hinsen wrote:

> For those who want to play with this without keeping two versions of
> their source code files, I have added a new macro lazy-and-standard-
> branch to clojure.contrib.macros. Here is an example of how to use it:

BTW, my library modules in clojure.contrib (accumulators, monads,  
probabilities) now work with the lazy branch as well as with the  
standard one. The changes were minor and quick to do. The nil-punning  
compiler flag was quite helpful.

Konrad.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen C. Gilardi  
View profile  
 More options Feb 15 2009, 5:12 pm
From: "Stephen C. Gilardi" <squee...@mac.com>
Date: Sun, 15 Feb 2009 17:12:19 -0500
Local: Sun, Feb 15 2009 5:12 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2009, at 5:03 PM, Stephen C. Gilardi wrote:

> Based on it working for you, the current theory I'm working to  
> verify is that this was caused by a clojure-contrib.jar compiled  
> with trunk interacting with a clojure.jar from lazy 1282.

I've confirmed this. Thanks for the help. The test I wrote about is  
now working for me with lazy 1282.

--Steve

  smime.p7s
3K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rich Hickey  
View profile  
 More options Feb 15 2009, 5:17 pm
From: Rich Hickey <richhic...@gmail.com>
Date: Sun, 15 Feb 2009 17:17:49 -0500
Local: Sun, Feb 15 2009 5:17 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2009, at 4:44 PM, Chouser wrote:

While not knowing if sample code has been ported will still be an  
issue, anyone following the porting recipe:

http://clojure.org/lazier#toc7

will avoid this one as well, as the call will be to next, not rest.

I would just clarify that to say that the best route is *not* to  
structurally change code that uses rest, just have it call next  
instead  (unless you are writing a lazy-seq body). Using next is going  
to let you preserve your code structure and yields the simplest idioms  
- since next (still) nil puns!

core.clj e.g. is full of code that presumes it is walking a seq chain,  
and so contains lots of next calls:

http://code.google.com/p/clojure/source/diff?spec=svn1282&r=1282&form...

There's nothing wrong with that idiom. I do not recommend that people  
leave their rest calls and 'fix' the nil puns - instead, change your  
rest calls to next, then deal with your own lazy-cons calls (possibly  
restoring some rest calls in lazy-seq bodies), then try the  
clojure.assert-if-lazy-seq flag to find any conditional use of lazy  
sequences.

Rich


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rich Hickey  
View profile  
 More options Feb 15 2009, 5:33 pm
From: Rich Hickey <richhic...@gmail.com>
Date: Sun, 15 Feb 2009 17:33:21 -0500
Local: Sun, Feb 15 2009 5:33 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2009, at 5:01 PM, Mark Engelberg wrote:

When walking a chain of seqs, empty? made no sense as there is no such  
thing as an empty seq. Now that rest returns a collection, this makes  
more sense (although still not my preference), but to each his own.  
Let's please not get bogged down in a style discussion now. You should  
be quite happy for this:

(rest [1])
-> () ;an empty sequence, note - not a canonic/sentinel value!

Also note empty? is still defined like this:

(not (seq coll))

Rich


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chouser  
View profile  
 More options Feb 15 2009, 5:39 pm
From: Chouser <chou...@gmail.com>
Date: Sun, 15 Feb 2009 17:39:53 -0500
Local: Sun, Feb 15 2009 5:39 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!
On Sun, Feb 15, 2009 at 5:03 PM, Stephen C. Gilardi <squee...@mac.com> wrote:

> Should we branch contrib and do the fixups on a lazy branch? Chouser, have
> you already fixed it enough to compile with clojure contrib's build.xml?

I don't ever compile clojure-contrib, I just put its src dir in my
classpath.  I've fixed a couple functions here and there using a macro
something like Konrads, but I think that's going to make the code
cluttered pretty quickly.  A branch of clojure-contrig is probably
quite sensible at this
point.

--Chouser


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rich Hickey  
View profile  
 More options Feb 15 2009, 5:53 pm
From: Rich Hickey <richhic...@gmail.com>
Date: Sun, 15 Feb 2009 17:53:02 -0500
Local: Sun, Feb 15 2009 5:53 pm
Subject: Re: Fully lazy sequences are coming - feedback wanted!

On Feb 15, 2009, at 5:09 PM, Konrad Hinsen wrote:

> On 15.02.2009, at 23:00, Konrad Hinsen wrote:

>> For those who want to play with this without keeping two versions of
>> their source code files, I have added a new macro lazy-and-standard-
>> branch to clojure.contrib.macros. Here is an example of how to use  
>> it:

> BTW, my library modules in clojure.contrib (accumulators, monads,
> probabilities) now work with the lazy branch as well as with the
> standard one. The changes were minor and quick to do. The nil-punning
> compiler flag was quite helpful.

Great! Thanks for the report.

Rich


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 69   Newer >
« Back to Discussions « Newer topic     Older topic »