Hi Alex,

diving more into picoLisp utility functions I foud some functions that
could be extended:

For example 'pre?' and 'sub?' could understand lists:

(de pre (P L)
   (let X T
      (while (and X P L)
         (if (and (pair P) (pair L) (= (car P) (car L)))
            (setq P (cdr P) L (cdr L))
            (off X) ) )
      X ) )

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

'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)

(de fifoLength (F)
   (let (N (if F 1 0) H F)
      (until (== H (setq F (cdr F)))
         (inc 'N) )
      N ) )

: (fifo 'A 1 2 3 4 5 6)
-> 6
: A
-> (6 1 2 3 4 5 .)
: (length A)
-> T
: (fifoLength A)
-> 6

Actually, this would need to work differently together with the
original 'length'.

picoLisp does not have many types and it would be nice to have these
utility functions more generic.

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?

Thanks,

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to