diff options
| author | mryouse | 2022-07-21 02:47:30 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-21 02:47:30 +0000 |
| commit | bca7d0afed84bd97ccfc6dbb486746aefa9cc1f5 (patch) | |
| tree | b3101b4302797a964c0ecce47ee9a134264b776d | |
| parent | 9461eda584c4a853b1c3be2658807a8ac4f9a6e7 (diff) | |
function renames and return types
| -rw-r--r-- | libs/dict.neb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libs/dict.neb b/libs/dict.neb index 9dccf97..7dc3dcc 100644 --- a/libs/dict.neb +++ b/libs/dict.neb @@ -3,18 +3,18 @@ (and (list? val) ; TODO should this be automatic? (or - (eq? 0 (list-length val)) + (eq? 0 (length val)) (and - (eq? 1 (list-length val)) + (eq? 1 (length val)) (list? (first val))) (apply and (map list? val))) - (eq? 0 (list-length (filter (lambda (x) (not (eq? x 2))) (map list-length val)))))) + (eq? 0 (length (filter (lambda (x) (not (eq? x 2))) (map length val)))))) -(type :dict :list dict?) +(type :dict :[:any] dict?) -(func dict () (list)) +(func dict :dict () (list)) -(func has? (in :dict key) +(func has? :bool (in :dict key) (not (empty? (filter (lambda (x) (eq? (first x) key)) in)))) @@ -22,7 +22,7 @@ (first (rest (first (filter (lambda (x) (eq? (first x) key)) d))))) -(func set (d :dict key val) +(func set :dict (d :dict key val) (if (has? d key) (map (lambda (x) (if (eq? key (first x)) (list (first x) val) x)) d) (append d (list key val)))) |
