CLIM mail archive
[Prev][Next][Index][Thread]
AVs of lists
Date: Tue, 12 Oct 1993 14:02 EDT
From: benjamin@ai.mit.edu (Benjamin Renaud)
My problem is: suppose you have a list of symbols; you don't know the
length of the list nor its possible members. You want to present this
list as accepting-values, and return (say) a destructively-modifed
list which has been modified by the user.
For example suppose you want to edit a unknown CLOS object. You get a
list of the slot names (no way to know in advance how many, nor what
their names are) which you'd use, say, as the prompt name, and a list
of current values which you would use as the variables of the
accepting-values. At the end you collect the list of modified values
and modify the object accordingly.
I hope this is clearer! :-)
Is this like what you might want? Another call to ACCEPT outside the
loop could be used to add new properties, although you'll probably need
to use :RESYNCHRONIZE-EVERY-PASS T to make that work.
-------- cut here --------
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Package: CLIM-USER; Base: 10; Lowercase: Yes -*-
(in-package :clim-user)
(defun accept-properties (plist types
&key (stream *standard-input*) own-window
(default-type 'form))
(declare (values new-plist))
(let ((plist (copy-list plist)))
(accepting-values (stream :own-window own-window)
(let ((properties plist)
(types types))
(loop
(let* ((indicator (pop properties))
(value (pop properties))
(type (or (pop types) default-type)))
(setf (getf plist indicator)
(accept type
:stream stream
:default value :prompt (format nil "~A" indicator)
:query-identifier indicator))
(fresh-line stream))
(when (null properties) (return)))))
plist))
#||
(accept-properties '(:antipasti "Crostini mista"
:primi "Polenta con funghi porcini"
:secondi "Arrosto di maiale"
:dolce "Formaggi")
nil
:default-type 'string)
||#
Main Index |
Thread Index