This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Error of using <integer>?
- From: "Yaroslav Kavenchuk" <kavenchuk at gmail dot com>
- To: kawa <kawa at sourceware dot org>
- Date: Thu, 24 Jan 2008 12:37:02 +0200
- Subject: Error of using <integer>?
(define (!i x :: <integer>) :: <integer>
(letrec ((!!i (lambda (i :: <integer> k :: <integer>) :: <integer>
(if (= i 1)
k
(!!i
(- i 1)
(* i k))))))
(!!i x 1)))
#|kawa:36|# (define x (!i 2352))
#|kawa:37|# (define x (!i 2353))
java.lang.StackOverflowError
at gnu.math.IntNum.times(IntNum.java:497)
at gnu.math.IntNum.times(IntNum.java:509)
at gnu.kawa.functions.MultiplyOp.applyN(MultiplyOp.java:60)
at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
at atInteractiveLevel$12.lambda1$Ex$ExI(stdin:18)
at atInteractiveLevel$12.lambda1$Ex$ExI(stdin:18)
at atInteractiveLevel$12.lambda1$Ex$ExI(stdin:18)
...
where `stdin:18` is (* i k))))))
When I write untyped version:
(define (!u x)
(letrec ((!!u (lambda (i k)
(if (= i 1)
k
(!!u
(- i 1)
(* i k))))))
(!!u x 1)))
all works:
#|kawa:46|# (define x (!u 2353))
#|kawa:47|# (define x (!u 5000))
#|kawa:48|#
--
WBR, Yaroslav Kavenchuk