Solve a Debate

castironpi at gmail.com castironpi at gmail.com
Sun Mar 9 22:11:37 EDT 2008


> days_in_month 12:
> 31
> 30
> 28
> 31
> ...
> 30
> 31
> assign $days days_in_month[$month]
>
> This program consists of 2 operations (table jump and assignment)
> and 12 values. This makes a memory consumption of 12+2 = 14

Along the same lines, you could populate the table somewhat sparsely,
and goto a modulo key.

You could even put functions in it:

setreturn $endoftable
hash month
goto
-0
-1
-2
jan.-> 3: setvjmp janfun
-4
-5
apr.-> 6: setvjmp aprfun
$endoftable

Sweet!  Are you stack-ops?



More information about the Python-list mailing list