39 lines
924 B
Plaintext
39 lines
924 B
Plaintext
to items :n :thing
|
|
if :n >= count :thing [output :thing]
|
|
output items :n butlast :thing
|
|
end
|
|
|
|
to butitems :n :thing
|
|
if or :n <= 0 empty? :thing [output :thing]
|
|
output butitems :n-1 butfirst :thing
|
|
end
|
|
|
|
to middle :n :m :thing
|
|
output items :m-(:n-1) butitems :n-1 :thing
|
|
end
|
|
|
|
to lastitems :n :thing
|
|
if :n >= count :thing [output :thing]
|
|
output lastitems :n butfirst :thing
|
|
end
|
|
|
|
to starts.with :sub :thing
|
|
if empty? :sub [output "true]
|
|
if empty? :thing [output "false]
|
|
if not equal? first :sub first :thing [output "false]
|
|
output starts.with butfirst :sub butfirst :thing
|
|
end
|
|
|
|
to members :sub :thing
|
|
output cascade [starts.with :sub ?] [bf ?] :thing
|
|
end
|
|
|
|
; note: Logo indices start at one
|
|
make "s "abcdefgh
|
|
print items 3 butitems 2 :s ; cde
|
|
print middle 3 5 :s ; cde
|
|
print butitems 2 :s ; cdefgh
|
|
print butlast :s ; abcdefg
|
|
print items 3 member "d :s ; def
|
|
print items 3 members "de :s ; def
|