Changeset 39566 in project


Ignore:
Timestamp:
01/31/21 21:11:10 (5 weeks ago)
Author:
Kon Lovett
Message:

list elm trim is option, correct type for unique

Location:
release/5/list-utils/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/5/list-utils/trunk/comma-list-utils.scm

    r39553 r39566  
    3838(define not-string-null? (o not string-null?))
    3939
    40 ; "a, b", not "a,b"
    41 ;string-nulls & nulls are removed
     40;the input list is flattened, so nulls are removed
     41;comma : ", " so "a, b"
     42;allow-empty? : do not remove string-nulls
    4243;
    4344(define (list->comma-string ls #!optional allow-empty? (comma ", "))
     
    4647    (ls (map ->string (list-flatten ls)))
    4748    (ls (if allow-empty? ls (filter not-string-null? ls))) )
    48     (if (null? ls)
    49       ""
     49    (if (null? ls) ""
    5050      (string-concatenate (intersperse ls comma)) ) ) )
    5151
    52 (define (comma-string->list str)
    53   (map! string-trim-whitespace-both (string-split str ",")) )
     52(define (comma-string->list str #!optional (proc string-trim-whitespace-both))
     53  (map! proc (string-split str ",")) )
    5454
    5555(define (list-comma-join . rest)
  • release/5/list-utils/trunk/list-utils.egg

    r39553 r39566  
    33
    44((synopsis "list-utils")
    5  (version "2.3.1")
     5 (version "2.3.2")
    66 (category data)
    77 (author "Kon Lovett")
  • release/5/list-utils/trunk/list-utils.scm

    r39550 r39566  
    5656(define-type alist (or null (list-of pair)))
    5757
    58 (: list-unique/duplicates (list #!optional procedure -> list list))
    59 (: list-unique (list #!optional procedure -> list))
     58(: list-unique/duplicates (forall (e (s (list-of e))) (s #!optional (e e -> *) -> s s)))
     59(: list-unique (forall (e (s (list-of e))) (s #!optional (e e -> *) -> s)))
    6060(: sort-alist (alist #!optional procedure -> alist))
    6161(: sort-alist! (alist #!optional procedure -> void))
Note: See TracChangeset for help on using the changeset viewer.