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

*To*: KMP@stony-brook.scrc.symbolics.com*Subject*: Issue: FUNCTION-COMPOSITION (Version 1)*From*: Jim McDonald <edsel!jlm@labrea.stanford.edu>*Date*: Mon, 27 Jun 88 12:29:15 PDT*Cc*: CL-Cleanup@sail.stanford.edu*In-reply-to*: Kent M Pitman's message of Thu, 23 Jun 88 17:11 EDT <880623171122.6.KMP@RIO-DE-JANEIRO.SCRC.Symbolics.COM>

The following is a sketch of some other possibly useful operators. Maybe some kind soul out there will adopt them and make a real proposal to add them. Note that the notions of permutation-vector are actually just a first stab--one might really want some lambda-list -> lambda-list operator that understands &optional, &key, &rest, etc. It might also be useful to have an operator that permitted deletion or repetition of arguments. I think the caveat about redefinition of the given function should be added to the existing proposal and apply to all the composition functions. COMMUTE function [Function] Returns a function whose value is the same as that of the given function applied to the same arguments with the first two interchanged. PERMUTE function argument-permutation &optional value-permutation [Function] Returns a function whose values are a permutation of the values which would be returned by an application of the given function to a permutation of its arguments. If argument-permutation is NIL, the effect is as if all arguments were passed to the given function without being permuted. If it is non-NIL, it must be a sequence of integers containing a permutation of an initial subset of the natural numbers, and the effect is as if each argument, at position i, is first moved to position (elt argument-permutation i) before the given function is called. If values-permutation is NIL, the effect is as if values were returned from the given function without being permuted. If it is non-NIL, it must be a sequence containing a permutation of an initial subset of the natural numbers, and the effect is as if each value, at position j, is first moved to position (elt value-permutation j) before the result function returns. Note that in practice such argument and value movement could be implicit in the behavior of the result function, and the given function might never be called. Hence subsequent redefinitions of the given function may have unpredictable effects on the behavior of the result function. Examples: (FUNCALL #'(LAMBDA (X Y) (CONS Y X)) 1 2) == (FUNCALL (COMMUTE #'CONS) 1 2) => (2 . 1) (FUNCALL #'(LAMBDA (A B C D E F) (LIST C B A F E D)) 11 22 33 44 55 66) == (FUNCALL (PERMUTE #'LIST #(2 1 0 5 4 3)) 10 11 12 13 14 15 16) => '(12 11 10 16 15 14) (FUNCALL #'(LAMBDA (I J) (MULTIPLE-VALUE-BIND (Q R) (TRUNCATE I J) (VALUES R Q))) 10 3) == (FUNCALL (PERMUTE #'TRUNCATE nil '(1 0)) 10 3) => 1 3

**Follow-Ups**:**Re: Issue: FUNCTION-COMPOSITION (Version 1)***From:*masinter.pa@Xerox.COM

**References**:**Issue: FUNCTION-COMPOSITION (Version 1)***From:*Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>

- Prev by Date:
**Issue: PATHNAME-TYPE-UNSPECIFIC (Version 1)** - Next by Date:
**CL-Cleanup-mailer** - Previous by thread:
**Re: Issue: FUNCTION-COMPOSITION (Version 1)** - Next by thread:
**Re: Issue: FUNCTION-COMPOSITION (Version 1)** - Index(es):