Re: 'pre?', 'sub?' and 'length'

2008-10-26 Thread Tomas Hlavaty
> This would make sense. That functionality is covered by 'head', though.

Oops, I did not notice this... must read ref more carefully:-o

> because 'T' has the meaning of "infinite" in comparisons.

Nice interpretation.

I will assume my case is too application specific.

> I'm very glad about this kind of discussions. It is difficult to decide
> for many functions what they should "mean" in general. Discussing about
> them would help all of us a lot.

Good to hear that;-)

Thank you,

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: 'pre?', 'sub?' and 'length'

2008-10-26 Thread Alexander Burger
Hi Tomas,

> : (pre '(1 2) '(1 2 3 4))
> -> T
> : (pre '(1 2) '(1 5 2 3 4))
> -> NIL

This would make sense. That functionality is covered by 'head', though.


> 'length' returns T for circular lists currently, which is not great.
> It could return the real length too (as the number of 'car' elements),
> maybe like => (T . 5)

One reason why it returns 'T' is to make it easily checkable (with '=T').

The real length has not so much meaning for a circular list, as an
iteration would never terminate. This is also why 'T' is returned,
because 'T' has the meaning of "infinite" in comparisons.


'size' comes close to what you want:

   : (size (1 2 3 .))
   -> 3

but it is also different

   : (size (1 (2) 3.))
   -> 4


> What are your thoughts?  Are you interested in hearing such
> suggestions or do you consider it too specific that everybody should
> implement these themselves if they need them?

I'm very glad about this kind of discussions. It is difficult to decide
for many functions what they should "mean" in general. Discussing about
them would help all of us a lot.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]