Changeset 38845 in project


Ignore:
Timestamp:
08/15/20 18:09:47 (4 months ago)
Author:
juergen
Message:

callable-sequences demo updated

File:
1 edited

Legend:

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

    r38836 r38845  
    88presently lists, pseudolists, vectors and strings. Additionally, there are two
    99constructors for handling arbitrary sequential- and random-access
    10 sequences. Note that both types are implemented differently.
     10sequences. Of course both types are implemented differently.
    1111
    1212Since those sequences are ordered, it makes sense to consider not only
    1313references but slices as well. So, for example, if vec is (make-callable
    1414#(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.
     15#(1 2 3) or #(4 3 2) respectively. Note, that the left index is always
     16included, while the right one is excluded.
     17
     18For ease of use, one of the two arguments of slices can be #f. This
     19argument then represents the sequence's length in (vec 1 #f) or its
     20length minus one in (vec #f 3).
    1621
    1722=== API
     
    6873type predicate for arbitrary sequences
    6974
     75==== callable-null?
     76
     77<procedure>(callable-null? xpr)</procedure>
     78
     79is xpr a callable-sequence with empty data?
     80
    7081==== callable-length
    7182
     
    137148; -> #(0 1 2 3 4 5)
    138149
     150(callable-date (vec 2 4))
     151; -> #(2 3)
     152
    139153(callable-data (lst 2 4))
    140154; -> '(2 3)
    141155
     156(callable-data (lst 2 #f))
     157; -> '(2 3 4 5)
     158
     159(callable-data (vec #f 2)
     160; -> #(5 4 3)
     161
    142162(callable-data (pair 4 2))
    143163; -> '(4 3 . 6)
    144164
     165(callable-data (pair 2 2))
     166; -> 6
     167
     168(callable-null? (pair 2 2))
     169; -> #t
     170
    145171(callable-data (str 2 5))
    146172; -> "234"
     173
     174(callable-data (str 2 2))
     175; -> ""
    147176
    148177(callable-data (str 5 2))
Note: See TracChangeset for help on using the changeset viewer.