[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: seq-some-p and nil

From: Drew Adams
Subject: RE: seq-some-p and nil
Date: Wed, 9 Sep 2015 06:26:42 -0700 (PDT)

> I meant extra complexity for the user.  If seq-some was returning a
> value, I wouldn't expect it to be a cons cell, I'd almost always want
> the element of the sequence straight away.

Well, yes.  But what if the user wants the value returned by the
function?  And what if the element is nil?

1. You need a way to always return non-nil when an element is found.
   This includes the case where the element is nil - you cannot
   just return nil as the element.

2. You (I) want to be able to use the the `some' function to
   either get the element or get the return value of the predicate,
   which can be an arbitrary function that could return a rich value.
   Or both: get and use both the element and the value.

Conclusion: return both the element and the predicate value, as
a non-nil Lisp value.  (ELEMENT . VALUE) is one such simple value.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]