Learning lisp by doing, but stuck on something simple...
- From: "foamdino@xxxxxxxxx" <foamdino@xxxxxxxxx>
- Date: 29 Aug 2006 21:05:22 -0700
Hi all,
Sorry to bother you - if you hate n00b stuff don't read further.
I'm writing a simple application that must read/modify/write
s-expressions, the obvious technology is Lisp (although a version was
written in Python).
At the moment I have reading/writing completed, but I'm stuck on
modifying a value from a p-list. My current function looks like:
;;; modify a value
(defun modify-value (field value)
(setf *config*
(mapcar
#'(lambda (x) (if (equal field x)
(setf (getf x field) value) <-- this is the problem
x))
*config*)))
Now I can simply overwrite any value by using (setf x value), but that
means that I overwrite the key from my p-list, not the value pointed to
by the key (ie (setf (:stuff) :test) - not what I'm after)
(getf :stuff *config*) is currently breaking with 'GETF: A proper list
must not end with :STUFF'
Any help would be appreciated.
Thanks,
Kev
envirnoment :lispbox 0.7
.
- Follow-Ups:
- Re: Learning lisp by doing, but stuck on something simple...
- From: Jack Unrue
- Re: Learning lisp by doing, but stuck on something simple...
- Prev by Date: Re: Lets talk about GUI and sound libraries
- Next by Date: How do you copy an array?
- Previous by thread: Re: perceived efficiency
- Next by thread: Re: Learning lisp by doing, but stuck on something simple...
- Index(es):
Relevant Pages
|