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

Things to consider for CLtL'97



    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)))
		    sequence)
    but I would prefer to do
	    (reduce #'+ sequence :key #'length)

(REDUCE #'+ (MAP (TYPE-OF sequence) #'length sequence))

    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:

    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 item sequence modifier &key start end from-end

?  And should they all also take a :KEY argument?

--Guy