Esempio n. 1
0
        LpObject convertReturnValue(object result)
        {
            if (null == result)
            {
                return(LpNl.initialize());
            }

            var t = result.GetType();

            switch (t.ToString())
            {
            case "System.UInt16":
            case "System.UInt32":
            case "System.UInt64":
            case "System.Int16":
            case "System.Int32":
            case "System.Int64":
                return(LpNumeric.initialize((int)result));

            case "System.Double":
                return(LpNumeric.initialize((double)result));

            case "System.String":
            case "System.Symbol":
                return(LpString.initialize((string)result));

            default:
                return(LpNl.initialize());
            }
        }
Esempio n. 2
0
File: LpObject.cs Progetto: baban/lp
 protected static LpObject hash(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpNumeric.initialize(self.GetHashCode()));
 }
Esempio n. 3
0
        private static LpObject pow(LpObject self, LpObject[] args, LpObject block = null)
        {
            var v = args[0];

            return(LpNumeric.initialize(Math.Pow((double)self.doubleValue, (double)v.doubleValue)));
        }
Esempio n. 4
0
        private static LpObject mod(LpObject self, LpObject[] args, LpObject block = null)
        {
            var v = args[0];

            return(LpNumeric.initialize((double)(self.doubleValue % v.doubleValue)));
        }
Esempio n. 5
0
 protected static LpObject to_i(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpNumeric.initialize((int)self.doubleValue));
 }
Esempio n. 6
0
File: LpHash.cs Progetto: baban/lp
 private static LpObject len(LpObject self, LpObject args)
 {
     return(LpNumeric.initialize(self.hashValues.Count));
 }
Esempio n. 7
0
File: LpArray.cs Progetto: baban/lp
 static LpObject len(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpNumeric.initialize(self.arrayValues.Count));
 }
Esempio n. 8
0
 protected static LpObject to_i(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpNumeric.initialize(0));
 }
Esempio n. 9
0
File: LpString.cs Progetto: baban/lp
 protected static LpObject size(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpNumeric.initialize(self.stringValue.Length));
 }