www.delorie.com/gnu/docs/kawa/kawa_31.html   search  
Buy GNU books!

Kawa, the Java-based Scheme system

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.1 Procedure properties

You can associate arbitrary properties with any procedure. Each property is a (key, value)-pair. Usually the key is a symbol, but it can be any object.

The system uses certain internal properties: 'name refers to the name used when a procedure is printed; 'emacs-interactive is used to implement Emacs interactive specification; 'setter will be (not yet implemented) used to associate a setter prcedure.

Function: procedure-property proc key [default]
Get the property value corresponding to the given key. If proc has no property with the given key, return default (which defaults to #f) instead.

Function: set-procedure-property! proc key value
Associate the given value with the key property of proc.

To change the print name of the standard + procedure (probably not a good idea!), you could do:
(set-procedure-property! + 'name 'PLUS)
Note this only changes the name property used for printing:
+ => #<procedure PLUS>
(+ 2 3) => 5
(PLUS 3 4) => ERROR

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003