Conditional handling (was Re: Reading a file into a "sequence")

new topic     » topic index » view thread      » older message » newer message

On Thu, 18 Nov 2004 12:28:57 -0800, Alexander Toresson
<guest at RapidEuphoria.com> wrote:

>Jason Gade wrote:
>[snip]
>> Be equivalent to equal(s1, s2) when found in a conditional (if, when)
>> Have the result sequence (1, 0, 1, 1) be reduced to an atom that is TRUE if
>> and only
>> if all of its elements are true, again only in a conditional statement (if,
>> when).
>> 
>> Personally I prefer the second example.
>
>Me too. The second example would make it more flexible.

Although this may be a moot point, I have to disagree completely with
the selection of the second as "preferred". I hope you'll forgive me
for being a bit blunt about it.

There is no point in generating a sequence if you plan to immediately
"reduce" it to a boolean.

It would be much faster just to create the boolean in the first place.
(Which of course I firmly believe it should do)

While the above (second) idea might be workable for equal, it would
not be for other relational operators. For example:

"if {1,2,3} >= {1,2,2} then" creates {1,1,0} "reduced" to FALSE.

"if {1,2,3} >= {1,1,2} then" creates {1,1,0}, "reduced" to TRUE.

Unless, of course, you have a magic routine which converts {1,1,0}
into true in some cases and false in others.

As for flexibility, the concept of arbitrarily interpreting a sequence
as either true or false is just nonsense.

It should produce an error, as it currently does.

What the language should not do is create a sequence in situations
where the only possible outcome of so doing is a crash.

Regards,
Pete

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu