From 4ef304c57938c9cc7e9ed5c637d820786c75527b Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 8 Mar 2024 15:55:58 -0800 Subject: [PATCH] (sierpinski) Optimization --- projects/examples/exercises/sierpinski.tal | 34 ++++++++++------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/projects/examples/exercises/sierpinski.tal b/projects/examples/exercises/sierpinski.tal index eb51695..f0572d4 100644 --- a/projects/examples/exercises/sierpinski.tal +++ b/projects/examples/exercises/sierpinski.tal @@ -1,22 +1,18 @@ -( uxncli sierpinski.rom ) +( uxncli sierpinski.rom ) -@on-reset ( -> ) - [ LIT &size 20 ] STHk #01 SUB - &ver ( -- ) - DUP - #00 EQUk ?{ - &pad ( -- ) - #2018 DEO - INC GTHk ?&pad - } POP - #00 - &fill - ANDk #202a ROT ?{ SWP } POP #18 DEO +@sierpinski ( -> ) + [ LIT &size 10 ] STHk #01 SUB + &>ver ( -- ) + DUP INCk + &>pad ( length -- ) #2018 DEO - INC ADDk STHkr LTH ?&fill - POP2 - #0a18 DEO - #01 SUB INCk ?&ver - POP POPr - BRK + #01 SUB DUP ?&>pad + &>fill ( length i -- ) + ANDk #202a ROT ?{ SWP } + POP #18 DEO + #2018 DEO + INC ADDk STHkr LTH ?&>fill + POP2 #0a18 DEO + #01 SUB INCk ?&>ver + POP POPr BRK