From: Eric S. Raymond Date: Tue, 10 Feb 2004 19:46:47 +0000 (+0000) Subject: Type deduction for formals of internal functions. X-Git-Tag: 1.0~124 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=d31c52be1c51f16b259af9f248ebc4246ecabddf;p=mad.git Type deduction for formals of internal functions. --- diff --git a/mad b/mad index 6d67add..189a38d 100755 --- a/mad +++ b/mad @@ -816,8 +816,12 @@ def print_statement(statement): elif statement[0] == 'if': return 'if (' + print_expr(statement[1]) + ') ' + print_statement(statement[2]) elif statement[0] == 'internal': - return '%s %s {return %s;}' % \ - (returntypes.get(statement[1], normalmode), print_expr(('apply', statement[1], statement[2])), print_expr(statement[3])) + rep = returntypes.get(statement[1], normalmode) + " " + statement[1][:-1] +"(" + for (dummy, var) in statement[2]: + rep += mode((dummy, var)) + " " + var + ", " + rep = rep[:-2] + rep += ') {return %s;}' % print_expr(statement[3]) + return rep elif statement[0] == 'map': global dummycount count = len(statement[3])