diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-14 21:29:25 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-14 21:29:25 -0700 |
commit | aeca5d81592de6bdbf485505fa867e36301d726a (patch) | |
tree | 82007d53f603cc6dded9f5949178da735ee31133 /cppawk-include | |
parent | e33a5c88d867eb8b7e518d9ca113757d8c5f650e (diff) | |
download | cppawk-aeca5d81592de6bdbf485505fa867e36301d726a.tar.gz cppawk-aeca5d81592de6bdbf485505fa867e36301d726a.tar.bz2 cppawk-aeca5d81592de6bdbf485505fa867e36301d726a.zip |
cons: document nth and nthcdr; add tests
Fixing semantics of nth for negative values.
Diffstat (limited to 'cppawk-include')
-rw-r--r-- | cppawk-include/cons-priv.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cppawk-include/cons-priv.h b/cppawk-include/cons-priv.h index 4c0a767..2f5bdce 100644 --- a/cppawk-include/cons-priv.h +++ b/cppawk-include/cons-priv.h @@ -693,7 +693,7 @@ function __nth(__pos, __lst) { for (; __pos > 0 && !__endp(__lst); __pos--) __lst = __cdr(__lst) - return __car(__lst) + return __pos == 0 ? __car(__lst) : __nil } function __nthcdr(__pos, __lst) |