public override bool compareEqual(LithpPrimitive other) { // TODO: Find better way to do this LithpString otherString = (LithpString)other; return(Value == otherString.Value); }
public static LithpPrimitive Repeat(LithpList parameters, LithpOpChain state, LithpInterpreter interp) { LithpString str = (LithpString)parameters[0]; LithpInteger n = (LithpInteger)parameters[1].Cast(LithpType.INTEGER); return(new LithpString(new string(str.Value[0], n))); }
public static LithpPrimitive DictGet(LithpList parameters, LithpOpChain state, LithpInterpreter interp) { LithpDict dict = (LithpDict)parameters[0]; LithpString key = (LithpString)parameters[1].Cast(LithpType.STRING); return(dict[key]); }
public static LithpPrimitive DictPresent(LithpList parameters, LithpOpChain state, LithpInterpreter interp) { LithpDict dict = (LithpDict)parameters[0]; LithpString key = (LithpString)parameters[1].Cast(LithpType.STRING); return(dict.ContainsKey(key) ? LithpAtom.True : LithpAtom.False); }
public static LithpPrimitive ParseInt(LithpList parameters, LithpOpChain state, LithpInterpreter interp) { LithpString str = (LithpString)parameters[0].Cast(LithpType.STRING); string dropDecimals = Regex.Replace(str, @"[.][0-9]+$", ""); return(new LithpInteger(dropDecimals)); }