io_calculator/program.txt

47 lines
550 B
Text
Raw Permalink Normal View History

2023-10-31 16:44:06 +00:00
clear
'defun '; defun
0 '_ 'noop ;
''~ '~ 'exec_if_0 '_ 'exec 'if_0_else ;
''noop '~ 'if_0_else 'exec_if_not_0 ;
'= 0 '= '!= ;
'read_word ': ''} '!= ''{ '~ ''_ '~ 'if_0_else '{ ;
{ quit q } ;
{ quit exit } ;
{ quit :q } ;
2023-10-31 16:44:06 +00:00
{ quote " } ;
2023-10-31 16:44:06 +00:00
{ clear cl } ;
2023-10-31 16:44:06 +00:00
{ ~ swap } ;
{ : dup } ;
2023-10-31 16:44:06 +00:00
{ 1 + ++ } ;
{ 1 - -- } ;
2023-10-31 16:44:06 +00:00
{ ~ _ backpop } ;
2023-10-31 16:44:06 +00:00
{ > ~ < } ;
2023-10-31 16:44:06 +00:00
{ : 1 - : 'countdown ~ exec_if_not_0 countdown } ;
2023-10-31 16:44:06 +00:00
{ size 2 - cons } ;
{ deref head } ;
{ ++ deref tail } ;
2023-10-31 16:44:06 +00:00
{ : 'next ~ 'current ~ if_0_else nth } ;
{ _ head current } ;
{ -- ~ tail ~ nth next } ;