$SPAD/src/input fns.input

Timothy Daly December 3, 2016

Abstract

Contents

2

1 License

— license —

--Copyright The Numerical Algorithms Group Limited 1991.

———-

— * —

)set break resume
)spool fns.output
)set message test on
)set message auto off
)clear all
--S 1 of 20
odd(i) == 2*i - 1
--R
--R                                                                   Type: Void
--E 1
--S 2 of 20
[odd(i) for i in 1..10]
--R
--R   Compiling function odd with type PositiveInteger -> Integer
--R
--R   (2)  [1,3,5,7,9,11,13,15,17,19]
--R                                                          Type: List(Integer)
--E 2
--S 3 of 20
odd == i +-> 2*i - 1
--R
--R   Compiled code for odd has been cleared.
--R   1 old definition(s) deleted for function or rule odd
--R                                                                   Type: Void
--E 3
--S 4 of 20
odd(1111)
--R
--R   Compiling function odd with type PositiveInteger -> Integer
--R
--R   (4)  2221
--R                                                        Type: PositiveInteger
--E 4
--S 5 of 20
[i for i in 2.. | prime? i]

--R
--R
--R   (5)  [2,3,5,7,11,13,17,19,23,29,...]
--R                                                Type: Stream(PositiveInteger)
--E 5
--S 6 of 20
primes := /
--R
--R
--R   (6)  /
--R                                                            Type: Variable(/)
--E 6
--S 7 of 20
primes == [p := nextPrime(i = 0 => 2; p) for i in 1..]
--R
--R                                                                   Type: Void
--E 7
--S 8 of 20
primes
--R
--R   There are 1 exposed and 0 unexposed library operations named
--R      nextPrime having 1 argument(s) but none was determined to be
--R      applicable. Use HyperDoc Browse, or issue
--R                            )display op nextPrime
--R      to learn more about the available operations. Perhaps
--R      package-calling the operation or using coercions on the arguments
--R      will allow you to apply the operation.
--R   Cannot find a definition or applicable library operation named
--R      nextPrime with argument type(s)
--R                             Polynomial(Integer)
--R
--R      Perhaps you should use "@" to indicate the required return type,
--R      or "$" to specify which version of the function you need.
--R   AXIOM will attempt to step through and interpret the code.
--R
--RDaly Bug
--R   AXIOM can only iterate over lists now and you supplied an object of
--R      type UniversalSegment(PositiveInteger) .
--E 8
--S 9 of 20
primes(20)
--R
--R   There are 1 exposed and 0 unexposed library operations named
--R      nextPrime having 1 argument(s) but none was determined to be
--R      applicable. Use HyperDoc Browse, or issue
--R                            )display op nextPrime

--R      to learn more about the available operations. Perhaps
--R      package-calling the operation or using coercions on the arguments
--R      will allow you to apply the operation.
--R   Cannot find a definition or applicable library operation named
--R      nextPrime with argument type(s)
--R                             Polynomial(Integer)
--R
--R      Perhaps you should use "@" to indicate the required return type,
--R      or "$" to specify which version of the function you need.
--R   AXIOM will attempt to step through and interpret the code.
--R
--RDaly Bug
--R   AXIOM can only iterate over lists now and you supplied an object of
--R      type UniversalSegment(PositiveInteger) .
--E 9
--S 10 of 20
firstPrimes(n) == [primes(i) for i in 1..n]
--R
--R                                                                   Type: Void
--E 10
--S 11 of 20
firstPrimes(25)
--R
--R   There are 1 exposed and 0 unexposed library operations named
--R      nextPrime having 1 argument(s) but none was determined to be
--R      applicable. Use HyperDoc Browse, or issue
--R                            )display op nextPrime
--R      to learn more about the available operations. Perhaps
--R      package-calling the operation or using coercions on the arguments
--R      will allow you to apply the operation.
--R   Cannot find a definition or applicable library operation named
--R      nextPrime with argument type(s)
--R                             Polynomial(Integer)
--R
--R      Perhaps you should use "@" to indicate the required return type,
--R      or "$" to specify which version of the function you need.
--R   AXIOM will attempt to step through and interpret the code.
--R   Cannot compile map: primes
--R   We will attempt to interpret the code.
--R
--RDaly Bug
--R   AXIOM can only iterate over lists now and you supplied an object of
--R      type UniversalSegment(PositiveInteger) .
--E 11
--S 12 of 20
primesLessThan(n) == [p for p in primes while p < n]
--R

--R                                                                   Type: Void
--E 12
--S 13 of 20
primesLessThan 1000
--R
--R   There are 1 exposed and 0 unexposed library operations named
--R      nextPrime having 1 argument(s) but none was determined to be
--R      applicable. Use HyperDoc Browse, or issue
--R                            )display op nextPrime
--R      to learn more about the available operations. Perhaps
--R      package-calling the operation or using coercions on the arguments
--R      will allow you to apply the operation.
--R   Cannot find a definition or applicable library operation named
--R      nextPrime with argument type(s)
--R                             Polynomial(Integer)
--R
--R      Perhaps you should use "@" to indicate the required return type,
--R      or "$" to specify which version of the function you need.
--R   AXIOM will attempt to step through and interpret the code.
--R   Cannot compile map: primes
--R   We will attempt to interpret the code.
--R
--RDaly Bug
--R   AXIOM can only iterate over lists now and you supplied an object of
--R      type UniversalSegment(PositiveInteger) .
--E 13
--S 14 of 20
isPrime? n == reduce(_or,[n = p for p in primes while n <= p])
--R
--R                                                                   Type: Void
--E 14
--S 15 of 20
isPrime?(1111)
--R
--R   There are 1 exposed and 0 unexposed library operations named
--R      nextPrime having 1 argument(s) but none was determined to be
--R      applicable. Use HyperDoc Browse, or issue
--R                            )display op nextPrime
--R      to learn more about the available operations. Perhaps
--R      package-calling the operation or using coercions on the arguments
--R      will allow you to apply the operation.
--R   Cannot find a definition or applicable library operation named
--R      nextPrime with argument type(s)
--R                             Polynomial(Integer)
--R
--R      Perhaps you should use "@" to indicate the required return type,
--R      or "$" to specify which version of the function you need.

--R   AXIOM will attempt to step through and interpret the code.
--R   Cannot compile map: primes
--R   We will attempt to interpret the code.
--R
--RDaly Bug
--R   AXIOM can only iterate over lists now and you supplied an object of
--R      type UniversalSegment(PositiveInteger) .
--E 15
--S 16 of 20
twins := [p,p+2 for p in primes | prime?(p+2)]
--R
--R   There are 1 exposed and 0 unexposed library operations named
--R      nextPrime having 1 argument(s) but none was determined to be
--R      applicable. Use HyperDoc Browse, or issue
--R                            )display op nextPrime
--R      to learn more about the available operations. Perhaps
--R      package-calling the operation or using coercions on the arguments
--R      will allow you to apply the operation.
--R   Cannot find a definition or applicable library operation named
--R      nextPrime with argument type(s)
--R                             Polynomial(Integer)
--R
--R      Perhaps you should use "@" to indicate the required return type,
--R      or "$" to specify which version of the function you need.
--R   AXIOM will attempt to step through and interpret the code.
--R
--RDaly Bug
--R   AXIOM can only iterate over lists now and you supplied an object of
--R      type UniversalSegment(PositiveInteger) .
--E 16
--S 17 of 20
twins := [p, p+2 for i in 1.. | (p := primes(i)) + 2 = primes(i+1)]
--R
--R   There are 1 exposed and 0 unexposed library operations named
--R      nextPrime having 1 argument(s) but none was determined to be
--R      applicable. Use HyperDoc Browse, or issue
--R                            )display op nextPrime
--R      to learn more about the available operations. Perhaps
--R      package-calling the operation or using coercions on the arguments
--R      will allow you to apply the operation.
--R   Cannot find a definition or applicable library operation named
--R      nextPrime with argument type(s)
--R                             Polynomial(Integer)
--R
--R      Perhaps you should use "@" to indicate the required return type,
--R      or "$" to specify which version of the function you need.
--R   AXIOM will attempt to step through and interpret the code.
--R   Cannot compile map: primes

--R   We will attempt to interpret the code.
--R
--RDaly Bug
--R   Interpret-Code mode is not supported for stream bodies.
--E 17
--S 18 of 20
firsts := [p for i in 1.. | (p := primes(i)) + 2 = primes(i+1)]
--R
--R   Cannot compile map: primes
--R   We will attempt to interpret the code.
--R
--RDaly Bug
--R   Interpret-Code mode is not supported for stream bodies.
--E 18
--S 19 of 20
twins := [p, p + 2 for p in firsts]
--R
--R
--RDaly Bug
--R   AXIOM cannot iterate with p over your form now. Perhaps you should
--R      try using a conversion to make sure your form is a list or
--R      stream, for example.
--E 19
--S 20 of 20
twins(i) ==firsts(i),2 + firsts(i)
--R
--R   There are no library operations named firsts
--R      Use HyperDoc Browse or issue
--R                               )what op firsts
--R      to learn if there is any operation containing " firsts " in its
--R      name.
--R
--RDaly Bug
--R   Cannot find a definition or applicable library operation named
--R      firsts with argument type(s)
--R                                 Variable(i)
--R
--R      Perhaps you should use "@" to indicate the required return type,
--R      or "$" to specify which version of the function you need.
--E 20
)spool
)lisp (bye)

———-

References^{[1] nothing}

9