From bca7d0afed84bd97ccfc6dbb486746aefa9cc1f5 Mon Sep 17 00:00:00 2001 From: mryouse Date: Thu, 21 Jul 2022 02:47:30 +0000 Subject: function renames and return types --- libs/dict.neb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libs') 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)))) -- cgit v1.2.3