Thanks Alex,

My sample code ("ABRA..) is wrong. Sorry about that.
I simplified too much from some other code  I have written that has a lot
of unrelated stuff in it.

However, what about these examples? Similar to those of the documentation:

: (rank 'c '((a . a) (b . b) (d . d)) T)   # ???
-> NIL
: (rank 'd '((a . a) (b . b) (d . d)) T)   # ???
-> NIL

: (rank 'd '((a . a) (b . b) (d . d)))
-> (d . d)
: (rank 'c '((a . a) (b . b) (d . d)))
-> (b . b)

The latter two work as I would expect.
I expected the first two to return '(d . d)....

/Lindsay



On Tue, May 23, 2017 at 12:32 PM, Alexander Burger <a...@software-lab.de>
wrote:

> Hi Lindsay,
>
> > : (nil (setq *BitsSA (sort (make (map link (chop "ABRAABRACADABRA"))))))
>
> *BitsSA is a list of lists of characters:
>
>    : (more *BitsSA)
>    ("A")
>    ("A" "A" "B" "R" "A" "C" "A" "D" "A" "B" "R" "A")
>    ("A" "B" "R" "A")
>    ("A" "B" "R" "A" "A" "B" "R" "A" "C" "A" "D" "A" "B" "R" "A")
>    ...
>
> > : (rank (chop "BR") *BitsSA)
> > -> ("R" "A" "C" "A" "D" "A" "B" "R" "A")
>
> This does not make sense. You search the ranking list with a *list*
> argument
> (chop "BR"), i.e. ("B" "R")
>
> Same here:
>
> > : (rank (chop "BRA") *BitsSA T)            # ???
> > -> NIL
>
> So you compare the CARs of *BitsSA - which are characters (i.e. symbols) -
> with
> lists. A list, however, is always greater than a symbol.
>
> >From https://software-lab.de/doc/ref.html#cmp:
>
>    For differing types, the following rule applies: Numbers are less than
>    symbols, and symbols are less than lists.
>
> ♪♫ Alex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>

Reply via email to