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()); } }
protected static LpObject hash(LpObject self, LpObject[] args, LpObject block = null) { return(LpNumeric.initialize(self.GetHashCode())); }
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))); }
private static LpObject mod(LpObject self, LpObject[] args, LpObject block = null) { var v = args[0]; return(LpNumeric.initialize((double)(self.doubleValue % v.doubleValue))); }
protected static LpObject to_i(LpObject self, LpObject[] args, LpObject block = null) { return(LpNumeric.initialize((int)self.doubleValue)); }
private static LpObject len(LpObject self, LpObject args) { return(LpNumeric.initialize(self.hashValues.Count)); }
static LpObject len(LpObject self, LpObject[] args, LpObject block = null) { return(LpNumeric.initialize(self.arrayValues.Count)); }
protected static LpObject to_i(LpObject self, LpObject[] args, LpObject block = null) { return(LpNumeric.initialize(0)); }
protected static LpObject size(LpObject self, LpObject[] args, LpObject block = null) { return(LpNumeric.initialize(self.stringValue.Length)); }