[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Keyword-style sequence functions
- To: common-lisp at SU-AI
- Subject: Keyword-style sequence functions
- From: Guy.Steele at CMU-10A
- Date: Wed, 02 Jun 1982 20:25:00 -0000
Folks,
At the November meeting there was a commission to produce
three parallel chapters on the sequence functions. I'm going nuts
trying to get them properly coordinated in the manual; it would
be a lot easier if I could just know which one is right and do it
that way.
As I recall, there was a fair amount of sentiment in favor of
Fahlman's version of the keyword-oriented proposal, and no serious
objections. As a quick summary, here is a three-way comparison
of the schemes as proposed:
;; Cross product
(remove 4 '(1 2 4 1 3 4 5)) => (1 2 1 3 5)
(remove 4 '(1 2 4 1 3 4 5) 1) => (1 2 1 3 4 5)
(remove-from-end 4 '(1 2 4 1 3 4 5) 1) => (1 2 4 1 3 5)
(rem #'> 3 '(1 2 4 1 3 4 5)) => (4 3 4 5)
(rem-if #'oddp '(1 2 4 1 3 4 5)) => (2 4 4)
(rem-from-end-if #'evenp '(1 2 4 1 3 4 5) 1) => (1 2 4 1 3 5)
;; Functional
(remove 4 '(1 2 4 1 3 4 5)) => (1 2 1 3 5)
(remove 4 '(1 2 4 1 3 4 5) 1) => (1 2 1 3 4 5)
(remove-from-end 4 '(1 2 4 1 3 4 5) 1) => (1 2 4 1 3 5)
((fremove #'< 3) '(1 2 4 1 3 4 5)) => (4 3 4 5)
((fremove #'oddp) '(1 2 4 1 3 4 5)) => (2 4 4)
((fremove-from-end #'evenp) '(1 2 4 1 3 4 5) 1) => (1 2 4 1 3 5)
;; Keyword
(remove 4 '(1 2 4 1 3 4 5)) => (1 2 1 3 5)
(remove 4 '(1 2 4 1 3 4 5) :count 1) => (1 2 1 3 4 5)
(remove 4 '(1 2 4 1 3 4 5) :count 1 :from-end t)=> (1 2 4 1 3 5)
(remove 3 '(1 2 4 1 3 4 5) :test #'>) => (4 3 4 5)
(remove-if #'oddp '(1 2 4 1 3 4 5)) => (2 4 4)
(remove-if '(1 2 4 1 3 4 5) :count 1 :from-end t :test #'evenp) => (1 2 4 1 3 5)
Remember that, as a rule, for each basic operation the cross-product
version has ten variant functions ({equal,eql,eq,if,if-not}x{-,from-end}),
the functional version has four variants ({-,f}x{-,from-end}),
and the keyword version has three variants ({-,if,if-not}).
What I want to know is, is everyone willing to tentatively agree on
the keyword-style sequence functions? If so, I can get the next version
out faster, with less work.
If anyone seriously and strongly objects, please let me know as soon
as possible.
--Guy