Email list hosting service & mailing list manager

More on association lists (and other key-value collections) Lassi Kortela (10 Jun 2020 10:16 UTC)
Re: More on association lists (and other key-value collections) Marc Nieper-Wißkirchen (10 Jun 2020 10:42 UTC)
Re: More on association lists (and other key-value collections) Arne Babenhauserheide (11 Jun 2020 00:41 UTC)
Re: More on association lists (and other key-value collections) Marc Nieper-Wißkirchen (11 Jun 2020 10:07 UTC)
Git hosting sites Lassi Kortela (11 Jun 2020 11:13 UTC)
Re: Git hosting sites Marc Nieper-Wißkirchen (11 Jun 2020 11:35 UTC)
Re: Git hosting sites Lassi Kortela (11 Jun 2020 13:25 UTC)
Re: Git hosting sites Marc Nieper-Wißkirchen (12 Jun 2020 07:23 UTC)
Re: Git hosting sites Lassi Kortela (12 Jun 2020 13:05 UTC)
Re: Git hosting sites Marc Nieper-Wißkirchen (12 Jun 2020 13:24 UTC)
Re: Git hosting sites John Cowan (12 Jun 2020 14:53 UTC)
Re: Git hosting sites Marc Nieper-Wißkirchen (12 Jun 2020 15:21 UTC)
Re: Git hosting sites Lassi Kortela (12 Jun 2020 15:56 UTC)
Re: Git hosting sites Lassi Kortela (12 Jun 2020 15:36 UTC)
Re: Git hosting sites Marc Nieper-Wißkirchen (12 Jun 2020 15:43 UTC)
(missing)
Re: Git hosting sites elf (13 Jun 2020 18:27 UTC)
Re: Git hosting sites Arthur A. Gleckler (13 Jun 2020 19:24 UTC)
Re: Git hosting sites elf (14 Jun 2020 02:09 UTC)
On-topic vs off-topic and new lists Lassi Kortela (14 Jun 2020 10:41 UTC)
Re: On-topic vs off-topic and new lists Amirouche Boubekki (14 Jun 2020 12:38 UTC)
Re: On-topic vs off-topic and new lists Lassi Kortela (14 Jun 2020 13:23 UTC)
Re: On-topic vs off-topic and new lists Amirouche Boubekki (14 Jun 2020 16:08 UTC)
Re: On-topic vs off-topic and new lists Arthur A. Gleckler (14 Jun 2020 16:44 UTC)
Re: On-topic vs off-topic and new lists elf (14 Jun 2020 17:04 UTC)
Re: On-topic vs off-topic and new lists Arthur A. Gleckler (14 Jun 2020 19:46 UTC)
Re: Git hosting sites Lassi Kortela (12 Jun 2020 17:27 UTC)

More on association lists (and other key-value collections) Lassi Kortela 10 Jun 2020 10:16 UTC

>     I think convenience procedures like `alist-ref` or `assoc?` should not
>     make the distinction. Then they can return a single value.
>
> If `alist-ref' is to appear in any SRFI*, it should actually take a
> failure argument as it is common with all the other `-ref' procedures.
> (See my other post for the corresponding xlist example.)

Sounds reasonable.

>     SRFI 189
>     `lisp->maybe` can be used to convert that value to a Maybe.
>
> That would hardly be helpful at this stage because we would have already
> lost the distinction between a false entry and a missing association.

Ah, you are right. A `(maybe-assoc key alist)` would be in order. And
`maybe-list-ref`, `maybe-hash-table-ref`, etc.

IMHO, the RnRS `assoc` procedure sets a precedent that xlist and alist
should be regarded as the same data type. It returns the cdr, which in
an xlist's case is the full list of values for the given key.

For most people, hash-tables are a natural collection type since they
can't contain duplicate keys and the single-value case is eaiest to express.

Lisp is kind of funny in that alists came first, and those are more
specialized with support for duplicates and the multiple-value case is
easier to express (the natural `cdr` or a cons is a proper list, and
improper lists are something special).

So an API that "pretends" that an alist is like a "normal" collection
(single value, no duplicate keys) is useful. As is an API that
"pretends" that a "normal" collection like a hash-table is in fact a
multiple-value collections :)

>     In any case, alist convenience procedures are commonly needed enough
>     that they'd be better off not depending on fancier things like
>     Maybe/Either. Alist stuff is useful with R7RS-small, or even with
>     subsets of that language.
>
> It's all about control- vs data-driven workflows.  In the former case,
> we are looking for a failure argument; in the latter case we want to use
> Maybe's or overload #f.

Perhaps both are useful. RnRS specifies `assoc` and exceptions (and
multiple values), so minor variations on that are a natural starting point.

> *Lassi, would you be interested to write such a SRFI together with me?
> (Not in the very near future because there are still some I have to wrap
> up, but also not too far in the future). I think we would complement
> each other quite well. I'm thinking of a SRFI that organizes an
> interface to alists and xlists (help me with a better prefix) in the
> same shape as all the other interfaces for data structures we have in
> R7RS-large (SRFI 125, SRFI 146, ...).

Sure, sounds great, and agreed!

Arne has expressed an interest in standardizing alist stuff previously
as well, so we should also include him if he wants to join in.

A survey of existing alist procedures would be good preparation. I don't
know of any semi-standard library other than the RnRS, SRFI 1, and SLIB
ones which are minimal. We could do a quick check of the major
implementations' manuals.