[plt-scheme] v4 questions

From: Doug Orleans (dougorleans at gmail.com)
Date: Sun Mar 30 15:27:17 EDT 2008

Mark Engelberg writes:
 > What about integration with the pattern matching system?  What
 > about integration with sequence?  What about integration with the
 > reader?  There end up being a lot of pieces that are probably best
 > done in a definitive way by the people who control all the other
 > related pieces, if you really want streams to have "first-class"
 > status.  My own opinion is that streams are important enough to
 > warrant this kind of attention.

What I would like better (or in addition) is for PLT Scheme to have
enough extensibility that a third-party streams package could have
"first-class" status.  I suspect the reader does have this, and I'm
not sure about the pattern matching system, but sequence doesn't quite
yet.

 > >   > 6. It would be nice if assoc and its kin could take an optional
 > >   > default lookup value, like hash-table-get.
 > >
 > >  Unlike hash-table-get, assoc returns the whole association, i.e. the
 > >  key/value pair, instead of just the value.  What you want is alist-get:
 > >
 > >   (define (alist-get alist key (default #f))
 > >     (let ((pair (assoc key alist)))
 > >       (if pair (cdr pair) default)))
 > 
 > Does this function already exist in the libraries, and is it
 > documented anywhere, or are you just proposing it?  Seems like if
 > there are a bunch of "alist-" functions, maybe assoc should have a
 > synonym of "alist-get/key-value" or something like that?

I was just proposing it.  SRFI-1 has alist-cons, alist-copy,
alist-delete.  Note that SRFI-1's assoc and alist-delete take an
optional "=" comparison procedure, which you'd probably want to add to
alist-get also.

--dougorleans at gmail.com


Posted on the users mailing list.