[REBOL] RFF: empty? for blocks Re:(2)

1999-12-12 Thread news . ted

By the Dictionary:

"empty? This is a synonym for TAIL? The check is made relative to the
current location in the series."

Most of the problems here seem to be semantics. When we create a
series, we (usually) assign a variable to a location in that series.
But the variable and the series are two separate things. The variable
and the series are two separate things. The variable and the series are
two separate things. This is important: The variable and the series are
two separate things. 

Using a variable in a Core series operation does not automatically
change it's value (or index). All the operations return a new value (or
index) that you can use, or ignore. The original, seminal variable is
not an automatic "cursor" into the series. It has no special
privileges, and any other variable pointing to the series will work
just as well (right down to the bugs). The variable and the series are
two separate things. 

As mentioned by others, the proper way to determine if an entire series
is empty is to test the series from its head

 empty? head aSeries

It's very important to understand that this does not test whether
"aSeries" is empty. aSeries is not itself a series, it is an index to a
position in a series.This is a subtle but crucial point, and explains
why the series operations work the way they do.

" ... the block exists on its own, and that colors simply refers to the
head of the block."

In other languages, we would usually have to use extra punctuation to
"dereference" a pointer to another variable, but REBOL handles this all
automatically (and consistently!). 

Every series is a movie, and all the variables only frames.



-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Tel 716 425-0252; Fax 716 223-2506.
-- http://www.husted.com/




[REBOL] RFF: empty? for blocks Re:(2)

1999-12-12 Thread icimjs

Hi Eric,
Clearing from the head of the data while you've got other pointers farther
along in the series doesn't make sense, which is no doubt why this bug has
taken so long to be discovered.

Oh well, different things make sense to different people. I think that the
evaluation of a sequence of legal expressions should not result in an
error. Isn't that a necessary formal criteria of the language definition? 

Elan



[REBOL] RFF: empty? for blocks Re:(2)

1999-12-10 Thread mailinglists

Hi Eric,

Empty? isn't a synonym for tail?, as far as I know. Your example is a weird
construction, because if I try to test empty? with tail I do this:

 test: [1 2 3]
== [1 2 3]
 tail test
== []
 empty? test
== false

Why do you do:

  test-block: tail [1 2 3 4 5]

It strikes me strange to define 'test-block with the index at the tail. It
influences 'test-block from the get-go:

 test-block: tail [1 2 3 4 5]
== []
 index? test-block
== 6
 head test-block
== [1 2 3 4 5]
 index? test-block
== 6

While:

 test: [1 2 3]
== [1 2 3]
 index? test
== 1
 tail test
== []
 index? test
== 1

The index is set to 6 no matter what, and I don't think that's "healthy" for
a block. =)

Regards,
Rachid



[REBOL] RFF: empty? for blocks Re:(2)

1999-12-09 Thread robert . muench

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 09, 1999 3:10 AM
 To: [EMAIL PROTECTED]
 Subject: [REBOL] RFF: empty? for blocks Re:

 empty? is kind of confusing, since it's just a synonym for
 tail? and doesn't really tell you if there are no elements in the block,
 as there might be some before the index point:

Hi, that's the point (!!) and that's why I don't use empty? blind less with
blocks.

 You can always use:

  empty? head test-block
 == false

 to find out if test-block is really empty.

Well, I would like to avoid this and that's why I would like to see that
empty? works on the whole block and not in relation to the index point.
Robert



[REBOL] RFF: empty? for blocks Re:(2)

1999-12-09 Thread icimjs

At 03:10 PM 12/9/99 +0100, you wrote:
[EMAIL PROTECTED] wrote:

 Hi, I would like to propose that empty? should be useable with blocks and
 return true if the block doesn't contain an element.

 empty? []
== true

Good idea. empty?'s current functionality is supplied by the word tail? We
don't lose functionality by modifying the word empty?.

Another option would be to supply a word really-empty? ;-)

So you could say:

if empty list2 [really-empty? list2]

Elan