Changeset 38850 in project


Ignore:
Timestamp:
08/17/20 10:53:08 (6 weeks ago)
Author:
juergen
Message:

callable-sequences docu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/callable-sequences

    r38845 r38850  
    55
    66This is a variant of Mario's callable-datastructures. But contrary to
    7 that egg, I don't consider hash-tables, but only ordered sequences,
    8 presently lists, pseudolists, vectors and strings. Additionally, there are two
    9 constructors for handling arbitrary sequential- and random-access
    10 sequences. Of course both types are implemented differently.
    11 
    12 Since those sequences are ordered, it makes sense to consider not only
    13 references but slices as well. So, for example, if vec is (make-callable
    14 #(0 1 2 3 4 5)), then (vec 1 4) or (vec 4 1) are callables comprising
    15 #(1 2 3) or #(4 3 2) respectively. Note, that the left index is always
    16 included, while the right one is excluded.
    17 
    18 For ease of use, one of the two arguments of slices can be #f. This
    19 argument then represents the sequence's length in (vec 1 #f) or its
    20 length minus one in (vec #f 3).
     7that egg, I don't consider hash-tables, but only ordered sequences.
     8
     9The most important procedure, make-callable, is a generic procedure with
     10a local database supporting lists, pseudolists, vectors and strings. But
     11this database can be enhanced, by giving make-callable two unary
     12procedures as arguments, a type predicate and a maker, the latter being
     13a spezialization of make-sas-callable or make-ras-callable, handling
     14sequential-access or random-access sequences respectively.
     15
     16Giving make-callable one argument, a sequence, a procedure of zero, one
     17or two arguments is returned. The first call returns the encapsulated data
     18and its length, the second the data's value at its index argument and
     19the third the slice between its two index arguments, in either
     20direction, the first included, the second excluded. For convenience, the
     21argument #f is allowed in slices, representing the length.
     22
     23So, for example, if vec is (make-callable #(0 1 2 3 4 5)), then
     24(vec 1 4) or (vec 4 1) are callables comprising #(1 2 3) or #(4 3 2)
     25respectively, and, using length, (vec 3 #f) or (vec #f 3) comprise
     26#(3 4 5) or #(5 4) respectively.
    2127
    2228=== API
     
    3238==== make-callable
    3339
     40<procedure>(make-callable)</procedure>
    3441<procedure>(make-callable seq)</procedure>
    35 
    36 constructor: transforms the sequence into a procedure of zero, one or
    37 two arguments.
     42<procedure>(make-callable seq? seq-maker?)</procedure>
     43
     44generic procedure.
     45
     46The first resets the local datbase to standard form, which can handle
     47lists, vectors, strings and pseudolists.
     48
     49The second transforms the sequence into a procedure of zero, one or
     50two arguments, meaning
    3851
    3952* zero: returns the original sequence and its length
     
    4154* two:  returns the slice of its integer arguments respecting their order
    4255
     56The third updates the local database inserting the new pair in next to
     57last position. The seq-maker argument specializes one of the two
     58constructors make-sas-callable and make-ras-callable respectively.
     59
    4360==== make-sas-callable
    4461
     
    185202== Last update
    186203
    187 Aug 14, 2020
     204Aug 17, 2020
    188205
    189206== Author
     
    223240
    224241== Version History
    225 ; 1.0 ; initial version
     242; 1.0.0 ; initial version
Note: See TracChangeset for help on using the changeset viewer.