lispモドキ

using System;

module M {
  Main () : void {
    def car (ls) {
      match (ls) {
        | x :: _ => x;
        | _ => null;
      }
    };

    def cdr (ls) {
      match (ls) {
        | _ :: xs => xs;
        | _ => 
      }
    };

    def ls = [10, "Hello", 30, "World", 50 : object];

    Console.WriteLine (ls);

    mutable xs =  : list [object];
    xs = car (cdr *1 :: xs;

    Console.WriteLine (xs);
  }
}
/*
[10, Hello, 30, World, 50]
[Hello, World]
 */

*1:cdr (cdr (ls))))) :: xs; xs = car (cdr (ls