Changeset 35360 in project


Ignore:
Timestamp:
03/27/18 18:51:00 (4 weeks ago)
Author:
kon
Message:

rel 1.14.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/lookup-table

    r34953 r35360  
    3333=== make-dict
    3434
    35 <procedure>(make-dict [EQUALITY eq? [ESTIMATE <small-number>]]) -> dict</procedure>
     35<procedure>(make-dict [EQUALITY [ESTIMATE]]) -> dict</procedure>
    3636
    3737Returns a dictionary using the supplied {{EQUALITY}} test, optimized for the
    3838number of elements {{ESTIMATE}}.
    3939
     40; {{EQUALITY}} : {{procedure}} ; eq?
     41; {{ESTIMATE}} : {{fixnum}}
     42
    4043=== alist->dict
    4144
    42 <procedure>(alist->dict ALIST [EQUALITY eq?] [ESTIMATE 0]) -> dict</procedure>
     45<procedure>(alist->dict ALIST EQUALITY [ESTIMATE]) -> dict</procedure>
    4346
    4447Returns a dictionary constructed from {{ALIST}} using the supplied {{EQUALITY}}
    4548test, and optional {{ESTIMATE}}.
    4649
     50; {{EQUALITY}} : {{procedure}} ; eq?
     51; {{ESTIMATE}} : {{fixnum}} ; 0
     52
    4753=== dict?
    4854
    49 <procedure>(dict? OBJECT) -> boolean</procedure>
    50 
    51 Is the {{OBJECT}} a dictionary?
     55<procedure>(dict? OBJ) -> boolean</procedure>
     56
     57Is the {{OBJ}} a dictionary?
    5258
    5359=== dict-equivalence-function
    5460
    55 <procedure>(dict-equivalence-function DICT) -> (procedure (object object) boolean)</procedure>
     61<procedure>(dict-equivalence-function DICT) -> (* * --> boolean)</procedure>
    5662
    5763Returns the equality test predicate procedure for {{DICT}}.
     
    5965=== dict-count
    6066
    61 <procedure>(dict-count DICT) -> integer</procedure>
     67<procedure>(dict-count DICT) -> fixnum</procedure>
    6268
    6369Returns the number of items in the {{DICT}}.
     
    7783=== dict->alist
    7884
    79 <procedure>(dict->alist DICT) => list</procedure>
     85<procedure>(dict->alist DICT) -> list</procedure>
    8086
    8187Returns the {{DICT}} as an association list. The result may not be mutated!
     
    8389=== dict-ref
    8490
    85 <procedure>(dict-ref DICT KEY [DEFAULT #f]) => *</procedure>
     91<procedure>(dict-ref DICT KEY [DEF]) -> *</procedure>
    8692
    8793Returns the value associated with {{KEY}} in the {{DICT}}, otherwise
    88 {{DEFAULT}}.
     94{{DEF}}.
     95
     96; {{DEF}} : {{*}} ; #f
    8997
    9098=== dict-indempotent-ref!
    9199
    92 <procedure>(dict-indempotent-ref! DICT KEY FUNC [DEFAULT #f]) => *</procedure>
     100<procedure>(dict-indempotent-ref! DICT KEY FUNC [DEF]) -> *</procedure>
    93101
    94102Should a value for {{KEY}} exist in {{DICT}} it is returned. Otherwise {{FUNC}}
    95 is invoked on {{DEFAULT}}. Any result other than {{DEFAULT}} is the value for
    96 the {{KEY}} and that value is returned. Otherwise returns {{DEFAULT}}.
     103is invoked on {{DEF}}. Any result other than {{DEF}} is the value for
     104the {{KEY}} and that value is returned. Otherwise returns {{DEF}}.
     105
     106; {{DEF}} : {{*}} ; #f
    97107
    98108=== dict-exists?
    99109
    100 <procedure>(dict-exists? DICT KEY) => boolean</procedure>
     110<procedure>(dict-exists? DICT KEY) -> boolean</procedure>
    101111
    102112Does an entry with {{KEY}} exist in the {{DICT}} ?
     
    104114=== dict-set!
    105115
    106 <procedure>(dict-set! DICT KEY VALUE)</procedure>
    107 
    108 Associate {{VALUE}} with {{KEY}} in the {{DICT}}.
    109 
    110 {{VALUE}} must not be {{(void)}}!
     116<procedure>(dict-set! DICT KEY VAL)</procedure>
     117
     118Associate {{VAL}} with {{KEY}} in the {{DICT}}.
     119
     120{{VAL}} must not be {{(void)}}!
    111121
    112122=== dict-update!
    113123
    114 <procedure>(dict-update! DICT KEY DEFAULT-VALUE-PROCEDURE [FUNC identity])</procedure>
     124<procedure>(dict-update! DICT KEY DEF-VAL-PROCEDURE [FUNC])</procedure>
    115125
    116126Invokes {{FUNC}} on either the existing value for {{KEY}} in the {{DICT}}, or
    117 the result of the {{DEFAULT-VALUE-PROCEDURE}} when no existing value. The
     127the result of the {{DEF-VAL-PROCEDURE}} when no existing value. The
    118128result then becomes the value for {{KEY}} in the {{DICT}}.
    119129
    120130Returns the updated value for {{KEY}} in the {{DICT}}.
    121131
    122 {{DEFAULT-VALUE-PROCEDURE}} must not return {{(void)}}!
     132; {{FUNC}} : {{(* -> *)}} ; identity
     133
     134{{DEF-VAL-PROCEDURE}} must not return {{(void)}}!
    123135
    124136=== dict-update-list!
    125137
    126 <procedure>(dict-update-list! DICT KEY [OBJECT]...)</procedure>
    127 
    128 Updates the value for {{KEY}} in the {{DICT}} with a list of {{OBJECT}}.
     138<procedure>(dict-update-list! DICT KEY OBJ ...)</procedure>
     139
     140Updates the value for {{KEY}} in the {{DICT}} with the OBJ list.
     141
     142; {{OBJ ...}} : {{(list-of *)}}
    129143
    130144=== dict-update-dict!
    131145
    132 <procedure>(dict-update-dict! DICT KEY [EQUALITY eq? [ESTIMATE <small-number>]])</procedure>
     146<procedure>(dict-update-dict! DICT KEY [EQUALITY [ESTIMATE]])</procedure>
    133147
    134148Updates the value for {{KEY}} in the {{DICT}} with a {{dict}}.
    135149
    136 {{EQUALITY}} and {{ESTIMATE}} as for {{make-dict}}.
     150; {{EQUALITY}} : {{procedure}} ; {{eq?}}
     151; {{ESTIMATE}} : {{fixnum}}
    137152
    138153=== dict-delete!
     
    144159=== dict-for-each
    145160
    146 <procedure>(dict-for-each DICT (PROCEDURE (-> KEY VALUE <ignored>)))</procedure>
    147 
    148 Invokes the supplied {{PROCEDURE}} with each association in the {{DICT}}.
     161<procedure>(dict-for-each DICT PROC))</procedure>
     162
     163Invokes the supplied {{PROC}} with each association in the {{DICT}}.
     164
     165; {{PROC}} : {{(KEY VAL -> void)}}
    149166
    150167=== dict-merge!
    151168
    152 <procedure>(dict-merge! DICT [DICT1...]) => dict</procedure>
     169<procedure>(dict-merge! DICT DICT1 ...) -> dict</procedure>
    153170
    154171Returns the {{DICT}} as the {{(union DICT DICT1 ...)}} using overwrite
    155172semantics.
    156173
    157 Tables must have the same equality predicate.
     174Tables must have the same equality predicate!
    158175
    159176=== dict-search
    160177
    161 <procedure>(dict-search DICT PROCEDURE [DEFAULT #f]) => *</procedure>
    162 
    163 Returns the first entry value matched by the {{PROCEDURE}}. Otherwise the
    164 {{DEFAULT}} value is returned.)
    165 
    166 {{PROCEDURE}} is a {{(procedure (object object) boolean)}} where the first
    167 argument is the key and the second is the value.
     178<procedure>(dict-search DICT PRED [DEF]) -> *</procedure>
     179
     180Returns the first entry value matched by the {{PRED}}. Otherwise the
     181{{DEF}} value is returned.)
     182
     183; {{PRED}} : {{(KEY VAL --> boolean)}}
     184; {{DEF}} : {{*}} ; {{#f}}
    168185
    169186=== dict-print
    170187
    171 <procedure>(dict-print DICT [PORT (current-output-port)])</procedure>
     188<procedure>(dict-print DICT [PORT])</procedure>
    172189
    173190Pretty-print {{DICT}} to {{PORT}}.
     191
     192; {{PORT}} : {{output-port}} ; {{(current-output-port)}}
    174193
    175194
     
    216235== Version history
    217236
    218 ; 1.13.3 : Fix ''unsafe'' versions (not actually "unsafe").
    219 ; 1.13.2 : Fix for backwards incompatible use of ''module body string'' feature.
     237; 1.14.0 : Add types.
     238; 1.13.3 : Fix ''unsafe'' versions (not actually "unsafe").
     239; 1.13.2 : Fix for backwards incompatible use of ''module body string'' feature.
    220240; 1.13.1 : Made {{dict-safe-mode}} a plain procedure since it is a no-op.
    221241; 1.13.0 : Uses ''record-variants''.
     
    230250== License
    231251
    232 Copyright (C) 2009-2010 Kon Lovett.  All rights reserved.
     252Copyright (C) 2009-2018 Kon Lovett.  All rights reserved.
    233253
    234254Permission is hereby granted, free of charge, to any person obtaining a
Note: See TracChangeset for help on using the changeset viewer.