new example: unu in retro

FossilOrigin-Name: 5edd4a53544b383fed144cbb40f99ffc9fca62bc7fd6b6fc761a4bfbdddea563
This commit is contained in:
crc 2018-11-19 16:44:36 +00:00
parent b32cb2b842
commit 6d452fcb97

22
example/retro-unu.forth Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env retro
~~~
{{
'Fenced var
:toggle-fence @Fenced not !Fenced ;
:fenced? (-f) @Fenced ;
:handle-line (s-)
fenced? [ over call ] [ drop ] choose ;
---reveal---
:unu (sq-)
swap [ dup '~~~ s:eq?
[ drop toggle-fence ]
[ handle-line ] choose
] file:for-each-line drop ;
}}
~~~
~~~
#0 sys:argv [ s:put nl ] unu
~~~