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

Things to consider for CLtL'97

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)

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.