diff options
author | Juan J. Martinez <jjm@usebox.net> | 2024-05-26 22:32:05 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2024-05-26 22:32:05 +0100 |
commit | 992d0ab8a72020420e2af2f199289fd739772879 (patch) | |
tree | 31de5938a75d25575271897211724b541c5e9ed9 | |
parent | 6be7eba8977a719146ffa8c3e9485bc22ec31855 (diff) | |
download | funco-992d0ab8a72020420e2af2f199289fd739772879.tar.gz funco-992d0ab8a72020420e2af2f199289fd739772879.zip |
Also strings
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | funco | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -93,7 +93,7 @@ Other built-in functions are: * `head(list)`: returns the first element of a list * `tail(list)`: returns the end of a list excluding the first element * `empty?(list)`: returns true if a list is empty -* `size(list)`: returns the size of a list +* `size(list)`: returns the size of a list or a string * `min(list)`: returns the smaller value in a list * `max(list)`: returns the larger value in a list * `contains(value list)`: returns true if a list contains a value @@ -407,7 +407,7 @@ def default_env(): "head": lambda xs: xs[0], "tail": lambda xs: xs[1:], "empty?": lambda xs: xs == [], - "size": lambda xs: len(xs) if isinstance(xs, list) else None, + "size": lambda xs: len(xs) if isinstance(xs, (list, str)) else None, "min": lambda xs: min(xs) if isinstance(xs, list) else None, "max": lambda xs: max(xs) if isinstance(xs, list) else None, "contains": lambda x, xs: x in xs, |