Changeset 40155 in project


Ignore:
Timestamp:
05/29/21 11:18:29 (2 weeks ago)
Author:
Idiomdrottning
Message:

The life-changing magic of call-key*

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/brev-separate

    r40151 r40155  
    204204[[https://idiomdrottning.org/call-table|Full documentation for call-tables]]
    205205[[https://idiomdrottning.org/call-vector|Full documentation for callable arrays]]
     206
     207
     208==== call-key*
     209Sometimes you think {{call-table}} is convenient but you only need one key.
     210
     211For {{call-key}}, instead just use parameters with {{make-parameter}}.
     212
     213But {{call-key*}} is awesome since it accumulates its values.
     214
     215It has the same {{proc}}, {{unary}}, and {{initial}} keyword arguments as
     216{{call-table*}}. It doesn't have {{seed}} because the idea is that you
     217just use {{inititial}}. The generated procedure has {{update}} (which
     218takes a new list as argument) and {{get}} (which you only need for
     219{{unary}} call-keys).
     220
     221 (define horses (call-key*))
     222 
     223 (horses 'ruby)
     224 (horses 'kind-girl)
     225 (horses 'tornado)
     226 
     227 (horses)
     228
     229⇒ (tornado kind-girl ruby)
    206230
    207231
Note: See TracChangeset for help on using the changeset viewer.