[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Things to consider for CLtL'97
- To: Guy Steele <gls@THINK-AQUINAS.ARPA>, DCP@SCRC-QUABBIN.ARPA, Common-Lisp@SU-AI.ARPA
- Subject: Things to consider for CLtL'97
- From: David C. Plummer <DCP@SCRC-QUABBIN.ARPA>
- Date: Fri, 28 Feb 86 17:06 EST
- In-reply-to: <860228150412.8.GLS@GUIDO.THINK.COM>
Date: Fri, 28 Feb 86 15:04 EST
From: Guy Steele <gls@THINK-AQUINAS.ARPA>
Date: Tue, 25 Feb 86 11:15 EST
From: David C. Plummer <DCP@SCRC-QUABBIN.ARPA>
reduce should have a :KEY keyword argument. For example, suppose you
have a sequence of sequences, and you want to know the sum of the
lengths of the inner sequences. Currently, I think you have to do
(reduce #'(lambda (so-far subsequence)
(+ so-far (length sub-sequence)))
but I would prefer to do
(reduce #'+ sequence :key #'length)
(REDUCE #'+ (MAP (TYPE-OF sequence) #'length sequence))
Yours conses. Mine doesn't.
There should be a modify-seq (or some name) that looks roughly like
modify-seq sequence modifier &key start end from-end test test-not
that modifies the elements of the sequence between start and end that
past the TEST function. The element is replaced by the modifier applied
to the old element. For example, if a sequence is a sequence of
integers and you want to change it into a sequence of arrays whose
lengths are based on those integers, one could do
(modify-seq sequence #'(lambda (n) (make-array (round (* n 1.1)))))
There should be a modify-hash function.
This isn't consistent with the syntax of other functions that have a test.
Did you mean:
[I assume this is in response to modify-seq instead of modify-hash.]
modify-seq item sequence modifier &key start end from-end test test-not
modify-seq-if predicate sequence modifier &key start end from-end
modify-seq-if-not predicate item sequence modifier &key start end from-end
I see, I think. Yes, I want the -IF and -IF-NOT forms as well.
And should they all also take a :KEY argument?
I don't think so. Consider what :KEY does. It extracts a part of the
datastructure. To put it back, the implementation would have to do
(setf (funcall key sequence-element)
(funcall key sequence-element)))
and SETF of FUNCALL isn't generally invertable.