14
inter/db/14 · 1.8 KB
From the archive interlude_1beta5.tar.gz
Download the archive « Back to the archive contents
1
set-add
(method (elem inlist)
(if (not (search elem inlist)) (insert elem inlist 1) inlist))
/
set-remove
(method (elem inlist)
(var i (begin
(set i (search elem inlist))
(if (not i) inlist
(+ (before i inlist) (after i inlist))))))
/
strip-surrounding
(method (char instring)
(begin
(while (= (search char instring) 1)
(set instring (after 1 instring)))
(while (= (range (length instring)
(length instring) instring) char)
(set instring (range 1
(- (length instring) (length char))
instring)))
instring))
/
strip-spaces
(method (instring) (strip-surrounding " " instring))
/
accept-child
(method (inchild) (search inchild list-connected))
/
ext-range
(method (p q s)
(if (and (<= p q)
(<= 1 p)
(<= q (length s)))
(range p q s)
""))
/
spaces
(method (nums)
(if (> nums 0)
(if (< nums 40)
(range 1 nums " ")
(+ (spaces (- nums 40)) " "))
""))
/
list-to-string
(method (inlist)
(implode "\n" inlist))
/
maximum
(method (num1 num2)
(if (> num1 num2) num1 num2))
/
minimum
(method (num1 num2)
(if (< num1 num2) num1 num2))
/
square
(method (innum) (* innum innum))
/
pro-search
(method (pronoun wlist)
(var in-quote (begin
(set in-quote 0)
(dotimes (word (length wlist))
(var tempstring (begin
(set tempstring (index word wlist))
(while (search "\"" tempstring)
(begin
(set tempstring (after "\"" tempstring))
(set in-quote (not in-quote))))
(if (and (not in-quote) (= pronoun tempstring))
(return word)))))
0)))
/
move-to
(method (dest) '())
/
/
/+++++++++ end of object #14 ... no lines after this ++++++++++