It doesn't much matter how you do an alist lookup for most programs. Go
ahead and learn and teach whatever makes most sense.
But, for practical application, sometimes you have to implement, say,
some large performance-sensitive graph algorithm, where even constant
overhead factors can make a
On Wed, Feb 10, 2016 at 11:02 AM, Neil Van Dyke
wrote:
> For your example, more traditional would be `(map cons` and `cdr`. Then
> it's more clear that `assoc` returning the matched pair lets you
> distinguish a `#f` `cdr` in a match from no match found.
>
>
And dict-ref lets you do this by allow
I don't know whether there's an advantage or not, but I can say that the
behavior of assoc is inherited from Scheme and other Lisps.
I usually want the behavior you describe, so I often use dict-ref with
dealing with association lists.
-Jon
On Wed, Feb 10, 2016 at 10:55 AM, Brian Adkins
wrote:
For your example, more traditional would be `(map cons` and `cdr`. Then
it's more clear that `assoc` returning the matched pair lets you
distinguish a `#f` `cdr` in a match from no match found.
Neil V.
--
You received this message because you are subscribed to the Google Groups "Racket
Users"
Is there an advantage to having assoc return the associated list vs. the tail
of the associated list? Wouldn't it be better for it to behave more like
hash-ref ? Do folks typically just define their own function such as the
following ?
(define daynums (map list
'(sunday mon
5 matches
Mail list logo