Path: utzoo!yunexus!ists!jarvis.csri.toronto.edu!mailrus!wuarchive!psuvax1!rutgers!columbia!cs!mkamer From: mkamer@cs.columbia.edu (Matthew Kamerman) Newsgroups: comp.lang.lisp Subject: plet Summary: Explains the use of PLet and gives an example Message-ID: <467@cs.columbia.edu> Date: 16 Nov 89 19:50:36 GMT Article-I.D.: cs.467 Organization: Columbia University Department of Computer Science Lines: 30 Some people have been intrigued by the code for PLet and PLet* but apparently I didn't make clear what it was good for! These Macros provide lexically scoped variables whose values persist from call to call. These variables can be more useful than DefVars when privacy or efficiency gains due to improved locality of reference are important. EXAMPLE: > (DeFun Fibonacci (&Key (n-2 0 n-2p) (n-1 1 n-1p)) (PLet ((pn-2 0)(pn-1 1)) (AND n-2p (SetQ pn-2 n-2)) (AND n-1p (SetQ pn-1 n-1)) (PSetQ pn-2 pn-1 pn-1 (+ pn-2 pn-1)) pn-1)) FIBONACCI > (fibonacci) (fibonacci) 1 > (fibonacci) (fibonacci) 2 > (fibonacci) (fibonacci) 3 > (fibonacci) (fibonacci) 5 >