I have poked around a bit in the code and can't find a good way to
die. I am currently using
perlReplicate n a = if n == 1/0
then error "Infinite replications would exhaust memory"
else if n < 0
then genericReplicate 0 a
else genericReplicate (truncate n) a
But that gives the following message
pugs> "a" x Inf
Internal error while running expression:
Infinite replications would exhaust memory
But this isn't an internal error; it is a user error, so I want a message like
pugs> "a" x Inf
*** Infinite replications would exhaust memory
at <interactive> line 1, column 1-9