Esempio n. 1
0
        public static Object Map(Cons args, Environment environment)
        {
            Cons temp = null;

            foreach (object o in (IEnumerable)args.Second())
            {
                temp = new Cons(
                    Runtime.Apply(args.First(), new Cons(o), environment),
                    temp);
            }
            return(temp.Reverse());
        }
Esempio n. 2
0
        /// <summary>
        /// (map function list) Maps function to each element in list return a new
        /// list of return values.
        /// </summary>
        /// <param name="args"></param>
        /// <param name="environment"></param>
        /// <returns></returns>
        public static Object Map(Cons args, Environment environment)
        {
            if (args.Second() == null)
                return null;

            Cons temp = null;
            foreach (object o in (IEnumerable)args.Second())
            {
                temp = new Cons(
                    Runtime.Apply( args.First(),new Cons(o),environment),
                    temp);
            }
            return temp.Reverse();
        }