[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Arguments and values to get.



Received: from SCRC-QUABBIN.ARPA by SU-AI.ARPA with TCP; 3 Oct 85  14:36:29 PDT
Received: from NEPONSET.SCRC.Symbolics.COM by SCRC-QUABBIN.ARPA via CHAOS with CHAOS-MAIL id 207346; Thu 3-Oct-85 17:40:11-EDT
Date: Thu, 3 Oct 85 17:39 EDT
From: David C. Plummer <DCP@SCRC-QUABBIN.ARPA>
Subject: Arguments and values to get.
To: Gregor.pa@XEROX.ARPA, Scott E. Fahlman <Fahlman@C.CS.CMU.EDU>,
    Kent M Pitman <KMP@SCRC-STONY-BROOK.ARPA>, Common-Lisp@SU-AI.ARPA
cc: cl-object-oriented-programming@SU-AI.ARPA
In-Reply-To: <850919-174345-1059@Xerox>,
             <FAHLMAN.12144621737.BABYL@C.CS.CMU.EDU>,
             <850920100928.2.KMP@RIO-DE-JANEIRO.SCRC.Symbolics.COM>
Message-ID: <851003173940.1.DCP@NEPONSET.SCRC.Symbolics.COM>

Consider
	(incf (get foo bar))
when the property does not exist.  INCF would die adding to NIL.  Thus,
to maintain simple style, you need
	(incf (get foo bar 0))
I think this is a LOT prettier than
	(setf (get foo bar)
	      (multiple-value-bind (value valid-p)
		  (get foo bar)
		(if valid-p (1+ value) 1)))
and the programmer doesn't have to worry about multiple evaluation of
FOO and BAR, since INCF is supposed to take care of that.