diff options
Diffstat (limited to 'p99/p03.neb')
| -rw-r--r-- | p99/p03.neb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/p99/p03.neb b/p99/p03.neb new file mode 100644 index 0000000..05e0457 --- /dev/null +++ b/p99/p03.neb @@ -0,0 +1,10 @@ +; P03 - Find the K'th element of a list. +; The first element in the list is number 1. + +(def a (list "a" "b" "c" "d")) + +(func kth (lst k) + (first (slice lst k 1))) ; since slice returns a list, get the element with first + +(print (kth a 3)) +;(kth a 8) ; panic! there is no 8th element |
