$SPAD/src/input assign.input

Timothy Daly December 3, 2016

Abstract

Contents

2

1 License

— license —

--Copyright The Numerical Algorithms Group Limited 1991.

———-

— * —

)set break resume
)spool assign.output
)set message test on
)set message auto off
)clear all
-- This file shows the difference between assignments and rewrite
-- rules.
--S 1 of 11
a := 1
--R
--R
--R   (1)  1
--R                                                        Type: PositiveInteger
--E 1
--S 2 of 11
b := a         -- the value of b is now 1
--R
--R
--R   (2)  1
--R                                                        Type: PositiveInteger
--E 2
--S 3 of 11
b              -- see, told you
--R
--R
--R   (3)  1
--R                                                        Type: PositiveInteger
--E 3
--S 4 of 11
a := 2         -- what is the value of b?
--R
--R
--R   (4)  2
--R                                                        Type: PositiveInteger
--E 4

--S 5 of 11
b              -- it is the value it had AT ASSIGNMENT
--R
--R
--R   (5)  1
--R                                                        Type: PositiveInteger
--E 5
--S 6 of 11
c == 1         -- c is a rule
--R
--R                                                                   Type: Void
--E 6
--S 7 of 11
c              -- it will evaluate to 1
--R
--R   Compiling body of rule c to compute value of type PositiveInteger
--R
--R   (7)  1
--R                                                        Type: PositiveInteger
--E 7
--S 8 of 11
d == c         -- d is a rule that will evaluate to c
--R
--R                                                                   Type: Void
--E 8
--S 9 of 11
d
--R
--R   Compiling body of rule d to compute value of type PositiveInteger
--R
--R   (9)  1
--R                                                        Type: PositiveInteger
--E 9
--S 10 of 11
c == 2         -- we have changed the rule for c
--R
--R   Compiled code for c has been cleared.
--R   Compiled code for d has been cleared.
--R   1 old definition(s) deleted for function or rule c
--R                                                                   Type: Void
--E 10
--S 11 of 11
d              -- and so the ultimate value computed from d will change
--R

--R   Compiling body of rule c to compute value of type PositiveInteger
--R   Compiling body of rule d to compute value of type PositiveInteger
--R
--R   (11)  2
--R                                                        Type: PositiveInteger
--E 11
)spool
)lisp (bye)

———-

References^{[1] nothing}

6