Beruflich Dokumente
Kultur Dokumente
This should attach the library (number 1652) to the directory in which
you were when you STO'ed the library.
The functions in fact only use the G-series commands HEAD, TAIL and
REVLIST
(as far was I can remeber now). I could easily rewrite REVLIST to use the
Gofer definition of reverse and something that gets the head and tail of
a
list with using only OBJ-> and ->LIST so a SX version should be possible.
This version however is GX only! I've tested it (though not that
thoroughly!)
on my HP48GX rev. P.
And now for the functions in the library. In the parameters column a
{} will mean a list, n will mean an integer number, p will mean a
program that takes one element from the stack and leaves a 0 or a 1
(boolean value) on the stack (a predicate), f will mean any program
that would give no type-error's when used in the equivalent Gofer use.
I know that last one is very vague, but Gofer is very strongly typed
while these functions only check for the right number of arguments and
if they are the right type.
NAME
PARAMETERS
PURPOSE
==========
===========
============================================
Head
{}
Gives the first element of a list
Last
{}
Gives the last element of a list
Tail
{}
Gives the last n-1 elements of a list
Init
{}
Gives the first n-1 elements of a list
Length
{}
Gives the number of elements of a list
Copy
{} n
Gives a list containing n copies of the
input list put end to end
Nub
{}
Removes duplicates from a list
Reverse
{}
Reverses the order of the list elements
Elem
Concat
Null
Map
list
Filter
predicate
{} obj
{{}}
{}
{} f
{} p
Foldl
4}"
Foldr
4}"
Take
Drop
elements
TakeWhile
0
DropWhile
0
Inits
Tails
Segs
Subs
f obj {}
f obj {}
{} n
{} n
{} p
{} p
{}
{}
{}
{}
Gives
Gives
Gives
Gives
all
all
all
all
2
B
2
1
2
2
+
4
4
3 4 5 } Last = 5
C } 3 Copy = { A B C A B C A B C }
2 3 4 1 5 3 6 } Nub = { 1 2 3 4 5 6 }
2 3 } { } { 4 } { 5 6 } } Concat = { 1 2 3 4 5 6 }
3 4 } << 1 + 7 R->C >> Map = { (2,7) (3,7) (4,7) (5,7) }
3 4 5 6 7 8 9 } << 2 MOD 0 == >> Filter = { 2 4 6 8 }
>> { } L Foldr" = the definition of "L Concat"
3 6 7 8 7 6 5 } 5 Drop = { 8 7 6 5 }
3 6 7 8 7 6 5 } << 7 < >> TakeWhile = { 1 4 3 6 }