Changeset 40114 in project


Ignore:
Timestamp:
05/19/21 07:45:17 (4 weeks ago)
Author:
Idiomdrottning
Message:

Let's get some comprehensive call-tables up in this bee!

File:
1 edited

Legend:

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

    r40106 r40114  
    166166⇒ 2
    167167
    168 
    169168==== call-table
    170 The previous construct is so generally useful so let's just provide it as call-table.
     169The previous construct is generally useful so let's just provide it as {{call-table}}.
    171170
    172171 (define arity (call-table))
     
    179178
    180179⇒ (2 blue)
     180
     181{{call-table}} takes a keyword argument, {{default:}}, to set the default response for unknown keys.
     182
     183There is also {{call-table*}} which by default cons its values to a list instead of replacing them.
     184It takes three keyword arguments. {{proc:}} which defaults to {{cons}},
     185initial which defaults to {{'()}}, and unary which defaults to {{#f}}.
     186
     187Both versions of call-table lets you access the underlying hash-table
     188by calling them with no arguments, and to set them by calling them
     189with the keyword argument {{update:}}.
     190
     191 (color update: my-other-hash-table)
     192
     193[[https://idiomdrottning.org/call-table|Full documentation for call-tables.]]
    181194
    182195
Note: See TracChangeset for help on using the changeset viewer.