$SPAD/src/input pascal1.input

Timothy Daly December 3, 2016

Abstract

Contents

2

1 License

— license —

--Copyright The Numerical Algorithms Group Limited 1991.

———-

— * —

)set break resume
)spool pascal1.output
)set message test on
)set message auto off
)clear all

———-

This file shows some computations involving Pascal’s triangle — * —

--S 1 of 7
)set fun cache all
--R
--R   In general, interpreter functions will cache all values.
--E 1
--S 2 of 7
p(m,n | m = 1) == 1
--R
--R                                                                   Type: Void
--E 2
--S 3 of 7
p(m,n | m = n) == 1
--R
--R                                                                   Type: Void
--E 3
--S 4 of 7
p(i,n | 1 < i and i < n) == p(i-1,n-1)+p(i,n-1)
--R
--R                                                                   Type: Void
--E 4
--S 5 of 7
p(2,3)
--R
--R   Compiling function p with type (Integer,Integer) -> PositiveInteger
--R   p will cache all previously computed values.

--R
--R   (4)  2
--R                                                        Type: PositiveInteger
--E 5
--S 6 of 7
pr(n) == [p(i,n) for i in 1..n]
--R
--R                                                                   Type: Void
--E 6
--S 7 of 7
l := [center blankSeparate [p(i,n)::OUTFORM for i in 1..n] for n in 1..10] ;
--R
--R
--R                                                       Type: List(OutputForm)
--E 7
)spool
)lisp (bye)

———-

References^{[1] nothing}

5