From 997399661be0350e12d1b8eb4cad90ce56ed68f2 Mon Sep 17 00:00:00 2001 From: nodist Date: Sat, 11 Jul 2026 21:36:30 -0400 Subject: remove non typed args --- ack.kpl | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'ack.kpl') diff --git a/ack.kpl b/ack.kpl index 2161836..bba01ea 100644 --- a/ack.kpl +++ b/ack.kpl @@ -1,26 +1,20 @@ // Ackermann function -`export ack : ([m; n] - t : `type m; - ? t != `type n { - `panic "m and n must be the same type" - } - ? |(t = Int_signed; t = Float) { - ? |(m < 0; n < 0) { `return 0 } - } +`export ack : ([I64; I64.m; I64.n] ? { + |(m < 0; n < 0) { 0 } m = 0 { n + 1 } &(m > 0; n = 0) { ack `sync (m - 1; 1) } { ack `sync (m - 1; ack `sync (m; n - 1)) } } ) -`export ack_string : ([m; n] +`export ack_string : ([String; I64.m; I64.n] "#MAGENTA#ack#(#CYAN#%#, #CYAN#%#) #WHITE#=# #GREEN#%#\n" `format (m; n; ack `sync (m; n)) ) -`is_main ([] +`is_main ([Void] `use "sys" [args] ? 4 != `length args { `return `error String $ ( @@ -28,5 +22,5 @@ "#BOLD#WHITE#Usage: % % #\n" `format (args `get 0; args `get 1) ) } - `value ack_string `sync (U64 $ args `get -2; U64 $ args `get -1) + `value ack_string `sync (I64 $ args `get -2; I64 $ args `get -1) ) -- cgit v1.2.3