Paste: refactor

Author: pltonik
Mode: factor
Date: Thu, 13 May 2010 11:25:52
Plain Text |
How do you factor out the quotation below to avoid the boilerplate?  the quotation stack effects are below:


: add-at ( value key assoc -- )
    rot [ ?adjoin ] curry change-at ;

: remove-at ( value key assoc -- )
    rot [ ?delete ] curry change-at ;

: ?adjoin ( set elt -- set )
: ?delete ( set elt -- set )

Annotation: quotation factored

Author: doublec
Mode: factor
Date: Thu, 13 May 2010 11:33:25
Plain Text |
: change-set ( value key assoc quot -- ) 
  [ rot ] dip curry change-at ; inline

: add-at ( value key assoc -- )
  [ ?adjoin ] change-set ;

: remove-at ( value key assoc -- )
  [ ?delete ] change-set

New Annotation

Summary:
Author:
Mode:
Body: