Changeset 35192 in project


Ignore:
Timestamp:
02/23/18 20:49:09 (7 months ago)
Author:
kon
Message:

rel 1.4.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/list-utils

    r34654 r35192  
    1212=== skip+
    1313
    14 <procedure>(skip+ LIST COUNT) => (list integer)</procedure>
     14<procedure>(skip+ LIST COUNT) -> (list integer)</procedure>
    1515
    1616Returns 2 values, the {{COUNT}} {{pair}} from {{LIST}}, and the remaining
     
    2727=== split-at+
    2828
    29 <procedure>(split-at+ LIST COUNT [PADS]) => (list list)</procedure>
     29<procedure>(split-at+ LIST COUNT [PADS]) -> (list list)</procedure>
    3030
    3131Returns 2 values, the leading {{COUNT}} elements from {{LIST}} as a new
     
    5454=== section
    5555
    56 <procedure>(section LIST SIZE [[STEP] PADS]) => list</procedure>
     56<procedure>(section LIST SIZE [[STEP] PADS]) -> list</procedure>
    5757
    5858Returns a {{list}} of {{list}}, built by taking {{SIZE}} elements from
     
    7777=== length=0?
    7878
    79 <macro>(length=0? LIST) => boolean</macro>
     79<macro>(length=0? LIST) -> boolean</macro>
    8080
    8181List of length zero? (Just {{null?}}.)
     
    8383=== length=1?
    8484
    85 <macro>(length=1? LIST) => boolean</macro>
     85<macro>(length=1? LIST) -> boolean</macro>
    8686
    8787List of length one?
     
    8989=== length>1?
    9090
    91 <macro>(length>1? LIST) => boolean</macro>
     91<macro>(length>1? LIST) -> boolean</macro>
    9292
    9393List of length greater than one?
     
    9595=== length=2?
    9696
    97 <macro>(length=2? LIST) => boolean</macro>
     97<macro>(length=2? LIST) -> boolean</macro>
    9898
    9999List of length two?
     
    101101=== ensure-list
    102102
    103 <macro>(ensure-list OBJECT) => list</macro>
     103<macro>(ensure-list OBJECT) -> list</macro>
    104104
    105105Returns a list, either the list {{OBJECT}} or {{(list OBJECT)}}.
     
    107107=== not-null?
    108108
    109 <macro>(not-null? LIST) => (or list boolean)</macro>
     109<macro>(not-null? LIST) -> (or list boolean)</macro>
    110110
    111111Returns {{#f}} if the given {{LIST}} is empty, and {{LIST}} otherwise.
     
    159159{{TEST?}} is {{eqv?}} and {{NOT-FOUND}} is {{#f}}.
    160160
    161 === alist-delete-for-count
    162 
    163 <procedure>(alist-delete-for-count KEY ALIST [TEST? [COUNT]])</procedure>
     161=== alist-delete-duplicates
     162
     163<procedure>(alist-delete-duplicates KEY ALIST [TEST? [COUNT]]) -> alist</procedure>
    164164
    165165Deletes the first {{COUNT}} associations from alist {{ALIST}} with the given
     
    175175{{(TEST? KEY key[i])}}.
    176176
    177 {{COUNT}} defaults to essentially, infinity, and {{EQUALITY?}} defaults to
    178 {{eqv?}}.
    179 
    180 === alist-delete-for-count!
    181 
    182 <procedure>(alist-delete-for-count! KEY ALIST [TEST? [COUNT]])</procedure>
     177{{COUNT}} defaults to unlimited, & {{EQUALITY?}} defaults to {{eqv?}}.
     178
     179=== alist-delete-duplicates!
     180
     181<procedure>(alist-delete-duplicates! KEY ALIST [TEST? [COUNT]]) -> alist</procedure>
    183182
    184183Destructive version of {{alist-delete-with-count}}.
    185184
    186 {{alist-delete-first}} and {{alist-delete-first!}} are also available as
    187 procedures.
    188 
    189 === alist-delete-with-count
    190 
    191 <procedure>(alist-delete-with-count KEY ALIST [[COUNT] TEST?])</procedure>
    192 
    193 Deletes the first {{COUNT}} associations from alist {{ALIST}} with the given
    194 key {{KEY}}, using key-comparison procedure {{TEST?}}. The dynamic order in
    195 which the various applications of equality are made is from the alist head to
    196 the tail.
    197 
    198 Returns a new alist. The alist is not disordered - elements that appear in the
    199 result alist occur in the same order as they occur in the argument alist.
    200 
    201 The equality procedure is used to compare the element keys, {{key[i: 0 <= i <
    202 (length ALIST)}}', of the alist's entries to the key parameter in this way:
    203 {{(TEST? KEY key[i])}}.
    204 
    205 {{COUNT}} defaults to essentially, infinity, and {{EQUALITY?}} defaults to
    206 {{eqv?}}.
    207 
    208 === alist-delete-with-count!
    209 
    210 <procedure>(alist-delete-with-count! KEY ALIST [[COUNT] TEST?])</procedure>
    211 
    212 Destructive version of {{alist-delete-with-count}}.
    213 
    214 {{alist-delete-first}} and {{alist-delete-first!}} are also available as
    215 procedures.
     185{{alist-delete-first}} and {{alist-delete-first!}} are also available.
    216186
    217187=== unzip-alist
     
    230200=== plist->alist
    231201
    232 <procedure>(plist->alist PLIST) => list</procedure>
     202<procedure>(plist->alist PLIST) -> list</procedure>
    233203
    234204Returns the association-list form of {{PLIST}}.
     
    236206=== alist->plist
    237207
    238 <procedure>(alist->plist ALIST) => list</procedure>
     208<procedure>(alist->plist ALIST) -> list</procedure>
    239209
    240210Returns the property-list form of {{ALIST}}.
     
    242212=== shift!
    243213
    244 <procedure>(shift! LIST [DEFAULT]) => *</procedure>
     214<procedure>(shift! LIST [DEFAULT]) -> *</procedure>
    245215
    246216Returns the first element of {{LIST}}, or {{DEFAULT}} when {{LIST}} is null.
     
    253223=== unshift!
    254224
    255 <procedure>(unshift! OBJECT LIST) => list</procedure>
     225<procedure>(unshift! OBJECT LIST) -> list</procedure>
    256226
    257227The {{car}} of the first {{pair}} of {{LIST}} is set to {{OBJECT}}. The
     
    272242=== andmap
    273243
    274 <procedure>(andmap FUNC LIST...) => boolean</procedure>
     244<procedure>(andmap FUNC LIST...) -> boolean</procedure>
    275245
    276246The arity of the function {{FUNC}} must be the length of {{LIST...}}.
     
    280250=== ormap
    281251
    282 <procedure>(ormap FUNC LIST...) => boolean</procedure>
     252<procedure>(ormap FUNC LIST...) -> boolean</procedure>
    283253
    284254The arity of the function {{FUNC}} must be the length of {{LIST...}}.
     
    286256{{(or (FUNC (car LIST)...) (ormap FUNC (cdr LIST)...))}}.
    287257
     258=== pair-ref
     259
     260<procedure>(pair-ref LIST IDX) -> list</procedure>
     261
     262Returns the {{IDX}}th {{pair}} of {{LIST}}.
     263
     264=== list-set!
     265
     266<procedure>(list-set! LIST IDX OBJ) -> list</procedure>
     267
     268Replaces the {{car}} the {{(pair-ref LIST IDX)}} with {{OBJ}}.
     269
     270=== list-copy*
     271
     272<procedure>(list-copy* LIST START END FILL) -> list</procedure>
     273
     274Returns a copy of {{LIST}}, from {{START}} until {{END}}, where {{END}} maybe
     275{{>}} {{(length LIST))}}. In which case {{FILL}} is used.
    288276
    289277== Usage
     
    309297== Version history
    310298
     299; 1.4.0 : Add {{alist-delete-duplicates(!)}}, {{pair-ref}}, {{list-set!}}, {{list-copy*}}. Deperecate {{alist-delete-with/for-count(!)}}.
    311300; 1.3.0 : Add {{alist-delete-with-count}} & {{alist-delete-with-count!}}.
    312301; 1.2.0 : Add {{alist-delete-for-count}} & {{alist-delete-for-count!}}.
Note: See TracChangeset for help on using the changeset viewer.