Previous Next Contents

5   Some PLAN Primops

Here we describe some of the more interesting PLAN primitive operations (namely, network and list operations).

5.1   Network Primitives

The network primitives are the most interesting aspect of PLAN, as they enable mobile computation via generating and sending new active packets.

5.2   List Iterators

The list iterators are based upon the well-known functional programming construct fold, with left-associative and right-associative varieties provided. Since PLAN does not (currently) support language-level parametric polymorphism or higher-order functions2 the list iterators are provided as language primitives, rather than as proper functions.

5.3   Summary of Other Operators

Unary Operators
~ integer negation
not boolean negation
hd return the first element of a list (car)
tl return the list without its first element (cdr)
fst return the first element of a tuple
snd return the second element of a tuple
#n return the nth element of a tuple
Binary Operators
/ integer division
% modulo
* integer multiplication
+ integer addition
-- integer subtraction
and boolean conjunction
or boolean disjunction
< integer less than
<= integer less than or equal to
> integer greater than
>= integer greater than or equal to
= equality
<> inequality
:: cons
<< left shift arithmetic
>> right shift arithmetic
xori bitwise xor
andi bitwise and
ori bitwise or
noti bitwise negation
explode convert a string to a list of characters
implode convert a list of characters into a string
ord return the ASCII value of a character
chr return the character with the given ASCII value
^ string concatenation


Previous Next Contents