public static IoObject slotHasKey(IoObject target, IoObject locals, IoObject message) { IoMap dict = target as IoMap; IoMessage m = message as IoMessage; IoObject key = m.localsValueArgAt(locals, 0); if (dict.lookupMap(key) == null) { return(dict.tag.state.ioFalse); } return(dict.tag.state.ioTrue); }
public static IoObject slotAtIfAbsentPut(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoObject key = m.localsValueArgAt(locals, 0); IoObject value = m.localsValueArgAt(locals, 1); IoMap dict = target as IoMap; if (dict.lookupMap(key) == null) { dict.map[key.ToString()] = value; } return(target); }
public static IoObject slotAt(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoObject result = null; IoObject symbol = m.localsValueArgAt(locals, 0); IoMap dict = target as IoMap; result = dict.lookupMap(symbol) as IoObject; if (result == null && m.args.Count > 1) { result = m.localsValueArgAt(locals, 1); } return(result == null ? dict.tag.state.ioNil : result); }