Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
17
Task/Search-a-list/Acornsoft-Lisp/search-a-list.lisp
Normal file
17
Task/Search-a-list/Acornsoft-Lisp/search-a-list.lisp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(defun first-index (word words (i . 0))
|
||||
(loop
|
||||
(until (null words)
|
||||
(error word '! is! missing))
|
||||
(until (eq word (car words))
|
||||
i)
|
||||
(setq words (cdr words))
|
||||
(setq i (add1 i))))
|
||||
|
||||
(defun last-index (word words (i . 0) (last-i . nil))
|
||||
(loop
|
||||
(until (null words)
|
||||
(cond (last-i) (t (error word '! is! missing))))
|
||||
(cond ((eq word (car words))
|
||||
(setq last-i i)))
|
||||
(setq words (cdr words))
|
||||
(setq i (add1 i))))
|
||||
19
Task/Search-a-list/EasyLang/search-a-list.easy
Normal file
19
Task/Search-a-list/EasyLang/search-a-list.easy
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
haystack$[] = [ "Zig" "Zag" "Wally" "Ronald" "Bush" "Krusty" "Charlie" "Bush" "Boz" "Zag" ]
|
||||
#
|
||||
func getind needle$ .
|
||||
for i to len haystack$[]
|
||||
if haystack$[i] = needle$
|
||||
return i
|
||||
.
|
||||
.
|
||||
return 0
|
||||
.
|
||||
# arrays are 1 based
|
||||
for n$ in [ "Bush" "Washington" ]
|
||||
h = getind n$
|
||||
if h = 0
|
||||
print n$ & " not found"
|
||||
else
|
||||
print n$ & " found at " & h
|
||||
.
|
||||
.
|
||||
Loading…
Add table
Add a link
Reference in a new issue