Changeset 25900 in project


Ignore:
Timestamp:
02/14/12 07:14:22 (9 years ago)
Author:
Ivan Raikov
Message:

vlist doc: added hash list procedures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/vlist

    r25899 r25900  
    3030since vlist elements are adjacent, which plays well with caches.
    3131
    32 === Procedures
     32=== List procedures
    3333
    3434
     
    119119
    120120Calls {{proc}} on each element of {{vlist}}.
     121
     122=== Hash list procedures
     123
     124Hash vlists are analogous to association lists.
     125
     126
     127<procedure>vhash? obj -> boolean</procedure>
     128
     129Returns true if {{obj}} is a hash vlist, false otherwise.
     130
     131<procedure>vhash-cons key value vhash [hash] -> vhash</procedure>
     132<procedure>vhash-consq key value vhash [hash] -> vhash</procedure>
     133<procedure>vhash-consv key value vhash [hash] -> vhash</procedure>
     134
     135Return a new hash list based on {{vhash}} where {{key}} is associated with
     136{{value}}.  Use {{hash}} to compute {{key}}'s hash.
     137
     138<procedure>vhash-fold* proc init key vhash -> value</procedure>
     139
     140Folds over all the values associated with {{key}} in {{vhash}}, with
     141each call to {{proc}} having the form {{(proc value result)}}, where
     142{{result}} is the result of the previous call to {{proc}} and {{init}}
     143the value of {{result}} for the first call to {{proc}}.
     144
     145<procedure>vhash-foldq* proc init key vhash -> value</procedure>
     146
     147Same as {{vhash-fold*}}, but using {{eq?-hash}} and {{eq?}}.
     148
     149<procedure>vhash-foldv* proc init key vhash -> value</procedure>
     150
     151Same as {{vhash-fold*}}, but using {{eqv?-hash}} and {{eqv?}}.
     152
     153<procedure>vhash-assoc key vhash [equal?] [hash] -> (key . value)</procedure>
     154
     155Returns the first key/value pair from {{vhash}} whose key is equal to
     156{{key}} according to the {{equal?}} equality predicate.
     157
     158<procedure>vhash-assq key vhash -> (key . value)</procedure>
     159
     160Returns the first key/value pair from {{vhash}} whose key is {{eq?}}
     161to {{key}}.
     162
     163<procedure>vhash-assv key vhash -> (key . value)</procedure>
     164
     165Returns the first key/value pair from {{vhash}} whose key is {{eqv?}}
     166to {{key}}.
     167
     168<procedure>vhash-delete key vhash [equal?] [hash] -> vhash</procedure>
     169<procedure>vhash-delq key vhash [equal?] [hash] -> vhash</procedure>
     170<procedure>vhash-delv key vhash [equal?] [hash] -> vhash</procedure>
     171
     172Removes all associations from {{vhash}} with {{key}}, comparing keys
     173with {{equal?}}.
     174
     175
     176<procedure>vhash-fold proc init vhash</procedure>
     177
     178Folds over the key/pair elements of {{vhash}} from left to right, with
     179each call to {{proc}} having the form {{({{proc}} key value result)}},
     180where {{result}} is the result of the previous call to {{proc}} and
     181{{init}} the value of {{result}} for the first call to {{proc}}.
     182
     183
     184<procedure>vhash-fold-right proc init vhash</procedure>
     185
     186Folds over the key/pair elements of {{vhash}} from right to left, with
     187each call to {{proc}} having the form {{({{proc}} key value result)}},
     188where {{result}} is the result of the previous call to {{proc}} and
     189{{init}} the value of {{result}} for the first call to {{proc}}.
     190
     191
     192<procedure>alist->vhash alist [hash] -> vhash</procedure>
     193
     194Returns the vhash corresponding to {{alist}}, an association list.
     195
    121196
    122197
Note: See TracChangeset for help on using the changeset viewer.