Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2379

8-bit acorn software: other • Re: Comal from Basic, Recursive Variable Scope?

$
0
0
So far, so good. Except the Comal runs far too quickly and returns the wrong answer (6, it should be 7).
You get 6 if your THEN/ELSE clauses are swapped.

Here is working code on COMAL 80 for C64:

Code:

0010 FUNC tak(x#,y#,z#)0020  IF y#<x# THEN0030   RETURN tak(tak(x#-1,y#,z#),tak(y#       -1,z#,x#),tak(z#-1,x#,y#))0040  ELSE0050   RETURN z#0060  ENDIF0070 ENDFUNC tak0080 TIME 00090 PRINT tak(18,12,6)0100 PRINT TIME/60,"s"0110 END
This returns 7 in 392.6 s.

I haven't had much luck running AcornSoft COMAL, but I know it uses the nonstandard END IF and END FUNC syntax

Statistics: Posted by scruss — Tue Oct 08, 2024 1:18 am



Viewing all articles
Browse latest Browse all 2379

Trending Articles