<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="hyrax.xsl"?>
<funcs>
<func>
	<name>cons</name>
	<class>list constructor</class>
	<return>List</return>
	<arg>
		<name>i</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>x</name>
		<type>Object</type>
	</arg>
	<desc>
		Creates a new cons cell whose head is i and tail is x
	</desc>
	<example>(cons 'a '(b)) => (a b)</example>
	<example>(cons 'a 'b) => (a . b)</example>
</func>
<func>
	<name>list</name>
	<class>list constructor</class>
	<return>List</return>
	<arg>
		<name>val1</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>... valn</name>
		<type>Object</type>
	</arg>
	<desc>
		Creates a list from a variables number of arguments
	</desc>
	<example>(list 1 2 3) => (1 2 3)</example>
	<example>(list 1 (* 2 1) (+ 2 1)) => (1 2 3)</example>
</func>
<func>
	<name>range</name>
	<class>list constructor</class>
	<return>List</return>
	<arg>
		<name>start</name>
		<type>Number</type>
	</arg>
	<arg>
		<name>end</name>
		<type>Number</type>
	</arg>
	<arg>
		<name>[interval]</name>
		<type>Number</type>
	</arg>
	<desc>
	Builds a list ranging from <i>start</i> to <i>end</i>, inclusive. The interval can be ommitted, and defaults to 1.0
	</desc>
	<example>(range 1 5) => (1 2 3 4 5)</example>
	<example>(range 1 2 0.2) => (1.0 1.2 1.4 1.6 1.8 2.0)</example>
</func>
<func>
	<name>head</name>
	<class>list accessor</class>
	<return>Object</return>
	<arg>
		<name>x</name>
		<type>List</type>
	</arg>
	<desc>
		Returns the head (first item) of list x
	</desc>
	<example>(head '(a b c)) => a</example>
</func>
<func>
	<name>tail</name>
	<class>list accessor</class>
	<return>Object</return>
	<arg>
		<name>x</name>
		<type>List</type>
	</arg>
	<desc>
		Returns the tail (all items except first) of list x
	</desc>
	<example>(tail '(a b c)) => (b c)</example>
</func>
<func>
	<name>take</name>
	<class>list func</class>
	<return>List</return>
	<arg>
		<name>i</name>
		<type>Number</type>
	</arg>
	<arg>
		<name>s</name>
		<type>Sequence</type>
	</arg>
	<desc>
		Returns the first i elements of s
	</desc>
	<example>(take 3 '(a b c d e)) => (a b c)</example>
	<example>(take 3 "woof") => "woo" </example>
</func>
<func>
	<name>drop</name>
	<class>list func</class>
	<return>List</return>
	<arg>
		<name>i</name>
		<type>Number</type>
	</arg>
	<arg>
		<name>s</name>
		<type>Sequence</type>
	</arg>
	<desc>
		Returns the sequence s without the first i elements
	</desc>
	<example>(drop 3 '(a b c d e)) => (d e)</example>
	<example>(drop 3 "woof") => "f"</example>
</func>
<func>
	<name>def</name>
	<class>env</class>
	<return>Object</return>
	<arg>
		<name>sym</name>	
		<type>Symbol</type>
	</arg>
	<arg>
		<name>val</name>
		<type>Object</type>
	</arg>
	<desc>Binds sym to evaluated val in the current scope, returns val</desc>
	<example>(def x 3) => 3</example>
	<example>(do (def y 1) (-- y) y)) => 0</example>
</func>
<func>
	<name>let</name>
	<class>env</class>
	<return>Object</return>
	<arg>
		<name>sym</name>
		<type>Symbol</type>
	</arg>
	<arg>
		<name>val</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>... code</name>
		<type>Object</type>
	</arg>
	<desc>Binds sym to val in a nested scope, evaluates code</desc>
	<example>(let i 3 (print i)) => nil ;;prints 3</example>
	<example>(do (let i 3) (print i)) => error: unbound symbol i</example>
</func> 
<func>
	<name>let</name>
	<class>env</class>
	<return>Object</return>
	<arg>
		<name>((sym1</name>
		<type>Symbol</type>
	</arg>
	<arg>
		<name>val1)</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>... bindings)</name>
                <type>Object</type>
	</arg>
	<arg>
		<name>... code</name>
		<type>Object</type>
	</arg>
	<desc>The scheme-like syntax for let, binds multiple symbols and evaluates code</desc>
	<example>(let ((i 0)(j 2)) (+ i j))</example>
</func>
<func>
	<name>reverse</name>
	<class>list func</class>
	<return>List</return>
	<arg>
		<name>x</name>
		<type>List</type>
	</arg>
	<desc>Returns the sequence x in reverse order</desc>
	<example>(reverse '(a b c)) => (c b a)</example>
</func>
<func>
	<name>member?</name>
	<class>list func</class>
	<return>Boolean</return>
	<arg>
		<name>a</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>c</name>
		<type>Container</type>
	</arg>
	<desc>Returns true if a is in container c, false otherwise</desc>
	<example>(member? 'x '(x y z)) => #t</example>
	<example>(member? \a "waffle") => #t</example>
	<example>(member? \a "wolf") => #f</example>
</func>
<func>
	<name>remove</name>
	<class>list func</class>
	<return>Sequence</return>
	<arg>
		<name>a</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>c</name>
		<type>Container</type>
	</arg>
	<desc>Returns container c excluding every instance of object a</desc>
	<example>(remove 'muppet '(wolf baby muppet muppet)) => (wolf baby)</example>
	<example>(remove \c "clock") => "lock")</example>
</func>
<func>
	<name>splice</name>
	<class>list func</class>
	<return>Sequence</return>
	<arg>
		<name>a</name>
		<type>Sequence</type>
	</arg>
	<arg>
 		<name>b</name>
		<type>Sequence</type>
	</arg>
	<desc>Combines two sequences into one</desc>
	<example>(splice '(a b) '(c d)) => (a b c d)</example>
	<example>(splice "angry" "hyrax") => "angryhyrax"</example> 
</func>
<func>
	<name>eval</name>
	<class>eval</class>
	<return>Object</return>
	<arg>
		<name>expr</name>
		<type>Object</type>
	</arg>
	<desc>Evaluates the argument, returns the result</desc>
	<example>(eval '1) => 1</example>
	<example>(eval '(+ 1 1)) => 2</example>
	<example>(eval 'cons) => compiled-fn: (any any)</example>
</func>
<func>
	<name>quote</name>
	<class>eval</class>
	<return>Object</return>
	<arg>
		<name>expr</name>
		<type>Object</type>
	</arg>
	<desc>Returns argument unevaluated, can also be written as a single-quote: '</desc>
	<example>(quote x) => x</example>
	<example>'x => x</example>
	<example>'(+ 1 2) => (+ 1 2)</example>
</func>
<func>
	<name>do</name>
	<class>eval</class>
	<return>Object</return>
	<arg>
		<name>... code</name>
		<type>Object</type>
	</arg>
	<desc>Evaluates a code sequence in the current scope, returns the last evaluated value</desc>
	<example>(do (+ 1 2) (+ 1 3)) => 4</example>
</func>
<func>
	<name>local</name>
	<class>eval</class>
	<arg>
		<name>... code</name>
		<type>Object</type>
	</arg>
	<desc>Creates a local nested scope in which it evaluates a code sequence</desc>
	<example>(local (def i 0) (+ i 1)) => 1</example>
	<example>(do (local (def i 0) ) (+ i 1) => error: unbound symbol i</example>
</func>
<func>
	<name>if</name>
	<class>eval</class>
	<return>Object</return>
	<arg>
		<name>b</name>
		<type>Boolean</type>
	</arg>
	<arg>
		<name>exprT</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>[exprF]</name>
		<type>Object</type>
	</arg>
	<desc>If b is true then exprT is evaluated, else exprF is evaluated. If exprF is omitted, then #f is returned</desc>
	<example>(if #t 1 2) => 1 </example>
	<example>(if (= 0 7) 'x 'y)) => y</example>
	<example>(if #f 1) => #f </example>
</func>
<func>
	<name>apply</name>
	<class>higher order</class>
	<return>Object</return>
	<arg>
		<name>f</name>
		<type>Procedure</type>
	</arg>
	<arg>
		<name>argslist</name>
		<type>List</type>
	</arg>
	<desc>Apply argslist to function f, returns the evaluated result</desc>
	<example>(apply + '(1 1)) => 2</example>
	<example>(apply + '(1)) => error: arity mismatch, function + expects 2 arguments</example>
</func>
<func>
	<name>partial-apply</name>
	<class>higher order</class>
	<return>Function</return>
	<arg>
		<name>f</name>
		<type>Function</type>
	</arg>
	<arg>
		<name>arg1</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>... argn</name>
		<type>Object</type>
	</arg>
	<desc>Partially evaluates function f (of arity m) for given arguments, returns a function of arity m-n</desc>
	<example>(partial-apply + 1) => fn (number)</example>
	<example>((partial-apply + 1) 1) => 2</example>
	<example>((partial-apply cons ? '(b c)) 'a) => (a b c)</example>
</func>
<func>
	<name>map</name>
	<class>higher order</class>
	<return>Collection</return>
	<arg>
		<name>f</name>
		<type>Function</type>
	</arg>
	<arg>
		<name>c</name>
		<type>Collection</type>
	</arg>
	<arg>
		<name>... cn</name>
		<type>Collection</type>
	</arg>
	<desc>
		Passes each member of c to f and builds a list from the results
	</desc>
	<example>(map sqrt '(4 9 16 25 36)) => (2 3 4 5 6)</example>
	<example>(map odd? '(1 2 3 4)) => (#t #f #t #f)</example>
	<example>(map + '(1 2 3 4) '(2 3 4 5)) => (3 5 7 9)</example>
</func>
<func>
	<name>filter</name>
	<class>higher order</class>
	<return>Collection</return>
	<arg>
		<name>p</name>
		<type>Function</type>
	</arg>
	<arg>
		<name>c</name>
		<type>Collection</type>
	</arg>
	<desc>
		Applies the predicate p to every member of c, returns a collection of those members for which p was true.
	</desc>
	<example>(filter odd? '(1 2 3 4)) => (1 3)</example>
	<example>(filter (fn (x) (= x 1)) '(1 2 1)) => (1 1)</example>
</func>
<func>
	<name>reduce</name>
	<class>higher order</class>
	<return>Object</return>
	<arg>
		<name>f</name>
		<type>Function</type>
	</arg>
	<arg>
		<name>c</name>
		<type>Collection</type>
	</arg>
	<desc>
		Applies f pairwise to the elements of c, reducing the collectionto a single value</desc>
	<example>(reduce + '(1 2 3)) => 6</example>
	<example>(reduce + '(1)) => 1</example>
	<example>(reduce + '()) => error: list must not be empty</example>
</func>
<func>
	<name>type</name>
	<class>type func</class>
	<return>Symbol</return>
	<arg>
		<name>x</name>
		<type>Object</type>
	</arg>
	<desc>Returns the type of any object</desc>
	<example>(type 1) => int</example>
	<example>(type 1.0) => float</example>
	<example>(type '(a b c)) => list</example>
	<example>(type "gerbils") => string</example>
	<example>(type cons) => compiled-fn (any any)</example>
	<example>(type (fn (x) x)) => closure (any)</example>
</func>
<func>
	<name>subtype?</name>
	<class>type func</class>
	<return>Boolean</return>
	<arg>
		<name>s</name>
		<type>Symbol</type>
	</arg>
	<arg>
		<name>t</name>
		<type>Symbol</type>
	</arg>
	<desc>Returns true if s is a subtype of t, false otherwise</desc>
	<example>(subtype? (type 3.0) 'number) => #t</example>
	<example>(subtype? 'list 'list) => #t</example>
</func>
<func>
	<name>isa?</name>
	<class>type func</class>
	<return>Boolean</return>
	<arg>
		<name>s</name>
		<type>Symbol</type>
	</arg>
	<arg>
		<name>t</name>
		<type>Symbol</type>
	</arg>
	<desc>Accepts an object s and a type t, returns true if the the type of s is a subtype of t</desc>
	<example>(isa? 1 'number) => #t</example>
	<example>(isa? cons 'list) => #f</example>
	
</func>
<func>
	<name>new</name>
	<class>type func</class>
	<return>Object</return>
	<arg>
		<name>type</name>
		<type>Symbol</type>
	</arg>
	<arg>
		<name>... args</name>
		<type>Object</type>
	</arg>
	<desc>Creates a new instance of a specified type, passing args to the type constructor</desc>
	<example>(new 'int 1) => 1</example>
	<example>(new 'int) => error: args list () does not match constructor for int: (num)</example>
	<example>(new 'vector 1 2 3) => &lt;1 2 3&gt;</example>
</func>
<func>
	<name>while</name>
	<class>iter</class>
	<return>Object</return>
	<arg>
		<name>cond</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>... code</name>
		<type>Object</type>
	</arg>
	<desc>Repeatedly tests the condition, and while it is true evaluates code</desc>
	<example>(let x 3 (while (not (= x 0)) (-- x) (print x))) => nil ;;prints 321</example>
</func>
<func>
	<name>until</name>
	<class>iter</class>
	<return>Object</return>
	<arg>
		<name>cond</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>... code</name>
		<type>Object</type>
	</arg>
	<desc>Repeatedly evaluates code until condition is false. Returns the value of code from last iteration</desc>
	<example>(let x 0 (until (= x 10) (++ x))) => 10</example>
</func>
<func>
	<name>dotimes</name>
	<class>iter</class>
	<return>Object</return>
	<arg>
		<name>n</name>
		<type>Integer</type>
	</arg>
	<arg>
		<name>... code</name>
		<type>Object</type>
	</arg>
	<desc>Evaluates code n times</desc>
	<example>(dotimes 5 (print \x)) => nil ;;prints: xxxxx</example>
</func>
<func>
	<name>for</name>
	<class>iter</class>
	<return>Object</return>
	<arg>
		<name>init</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>test</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>update</name>
		<type>Object</type>
	</arg>
	<arg>
		<name>code</name>
		<type>Object</type>
	</arg>
	<desc>Similar to the C++ for loop, evaluates in a nested namespace</desc>
	<example>(for (def i 0) (&lt; i 5) (++ i) (print i)) => nil ;;prints 12345</example>
</func>
<func>
	<name>foreach</name>
	<class>iter</class>
	<return>Object</return>
	<arg>
		<name>i</name>
		<type>Symbol</type>
	</arg>
	<arg>
		<name>c</name>
		<type>Container</type>
	</arg>
	<arg>
		<name>... code</name>
		<type>Object</type>
	</arg>
	<desc>Iterates over contents of c, assigns i to the value of each element and evaluates code</desc>
	<example>(foreach x '(1 2 3) (print x)) => nil ;;prints 123</example>
</func>

</funcs>
