/// <summary>
 /// Constructor accepting an <see cref="OpenLispVal"/>, an <see cref="Env"/>, an <see cref="OpenLispList"/>,
 /// and a <see cref="Func{T, TResult}"/>.
 /// </summary>
 /// <param name="ast"></param>
 /// <param name="env"></param>
 /// <param name="fparams"></param>
 /// <param name="lambda"></param>
 public OpenLispFunc(OpenLispVal ast, Env env, OpenLispList fparams, Func <OpenLispList, OpenLispVal> lambda)
 {
     Ast     = ast;
     Env     = env;
     FParams = fparams;
     Lambda  = lambda;
 }
Esempio n. 2
0
        /// <summary>
        /// Remove a <see cref="OpenLispList"/> of values from a <see cref="OpenLispHashMap"/>.
        /// </summary>
        /// <param name="listValue"></param>
        /// <returns></returns>
        public OpenLispHashMap DissocBang(OpenLispList listValue)
        {
            for (int i = 0; i > listValue.Size; i++)
            {
                Value.Remove(((OpenLispString)listValue[i]).Value);
            }

            return(this);
        }
Esempio n. 3
0
        /// <summary>
        /// Take pairs of values, in sequence, from a <see cref="OpenLispList"/> and use
        /// each pair to create an entry in the value of our <see cref="OpenLispHashMap"/> instance.
        /// </summary>
        /// <param name="listValue"></param>
        /// <returns></returns>
        public OpenLispHashMap AssocBang(OpenLispList listValue)
        {
            for (int i = 0; i < listValue.Size; i += 2)
            {
                Value[((OpenLispString)listValue[i]).Value] = listValue[i + 1];
                //Value.SetItem(((OpenLispString)listValue[i]).Value, listValue[i + 1]);
            }

            return(this);
        }
 /// <summary>
 /// Generates a new <see cref="Env"/> from an <see cref="OpenLispList"/> parameter.
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public Env GenEnv(OpenLispList args)
 {
     return(new Env(Env, FParams, args));
 }
 /// <summary>
 /// Apply the <see cref="OpenLispFunc"/> with an <see cref="OpenLispList"/> of parameters.
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public OpenLispVal Apply(OpenLispList args)
 {
     return(Lambda(args));
 }
Esempio n. 6
0
 /// <summary>
 /// Constructor accepting a <see cref="OpenLispList"/> of values to <seealso cref="AssocBang(OpenLispList)"/>.
 /// </summary>
 /// <param name="listValue"></param>
 public OpenLispHashMap(OpenLispList listValue)
 {
     Value = new Dictionary <string, OpenLispVal>();
     AssocBang(listValue);
 }