Hi Jon,

> If you read the docs carefully, you may know that (gt0 X) and (> X
> 0) are NOT equivalent. This is my small observation today:
>      X:    1   T
> -------------------
> (gt0 X) -> 1   NIL
> (> X 0) -> T   T

Yes, very true. Thanks for reminding about it!

This is in fact the intended behavior. Perhaps I should add some

1. '>' is a function for general comparisons, not only for numbers but
   for any data type. As described in


   all data in PicoLisp have a well-defined ordinal relationship. This
   defines that

      NIL < numbers < symbols < lists < T

   As a result, both '1' and 'T' are greater than '0'.

2. 'gt0', on the other hand, is a predicate for "numbers greater zero":


   Thus, it returns the numeric argument for '1', and 'NIL' for any non-
   numeric argument.

BTW, eeturning the argument itself instead of simply 'T' is very
convenient in many situations, e.g.

   (while (gt0 (foo))  # No need to store the result of (foo)
      (bar @) )        # in a local variable

> Have a nice weekend!

Thanks, you too!
♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to