% $Id: NthNEL.oz,v 1.1 2008/03/04 03:29:32 leavens Exp leavens $ % ::= sing(T) % | cons(T ) % Natural numbers, encoded as: % ::= zero | succ ( ) declare fun {NthNEL NEL N} case N of zero then {HeadNEL NEL} [] succ(M) then {NthNEL {TailNEL NEL} M} end end % Return the head of a NEL fun {HeadNEL NEL} case NEL of sing(N) then N [] cons(M _) then M end end % Return the tail of a NEL fun {TailNEL cons(_ T)} T end