public LispPtr ToList() throws Exception { LispObject head = LispAtom.New(_env, "List"); LispPtr p = new LispPtr(head); for (Map.Entry<LispPtr, LispPtr> e : _map.entrySet()) { LispPtr q = new LispPtr(LispAtom.New(_env, "List")); p.Get().Set(LispSubList.New(q.Get())); p = p.Get().Next(); q.Get().Set(e.getKey().Get().Copy(true)); q = q.Get().Next(); q.Get().Set(e.getValue().Get().Copy(true)); } return new LispPtr(LispSubList.New(head)); }
LispPtr Head() throws Exception { assert (!_map.isEmpty()); Map.Entry<LispPtr, LispPtr> e = _map.entrySet().iterator().next(); LispObject p = LispAtom.New(_env, "List"); LispPtr q = new LispPtr(p); q.Get().Set(e.getKey().Get().Copy(true)); q = q.Get().Next(); q.Get().Set(e.getValue().Get().Copy(true)); return new LispPtr(LispSubList.New(p)); }