It is often convenient to group related declarations into units that can be
shared between programs. The include
declaration offers a simple
way to do this. It names a source file containing a sequence of Orc declarations;
those declarations are incorporated into the program as if they had textually
replaced the include declaration. An include declaration may occur wherever any other
declaration occurs, even in a nested scope. An included file may itself contain
include
declarations. Included files may come from local files, any
URI recognized by the Java library (http, https, ftp, etc.), and include resources
found in the Orc JAR files.
{- Contents of fold.inc -} def foldl(f,[],s) = s def foldl(f,h:t,s) = foldl(f,t,f(h,s)) def foldr(f,l,s) = foldl(f,rev(l),s)
{- This is the same as inserting the contents of fold.inc here -} include "fold.inc" def sum(L) = foldl(lambda(a,b) = a+b, L, 0) sum([1,2,3])
Related Reference Topics
Related Tutorial Sections