33 lines
1 KiB
Text
33 lines
1 KiB
Text
( ( odd-word
|
|
= dothis doother forward backward
|
|
. ( forward
|
|
= ch
|
|
. fil$:?ch
|
|
& put$!ch
|
|
& ( low$!ch:~<a:~>z&forward$
|
|
| !ch:~"."
|
|
)
|
|
)
|
|
& ( backward
|
|
= ch
|
|
. fil$:?ch
|
|
& ( low$!ch:~<a:~>z
|
|
& backward$() (put$!ch&) { This reduces to the return value of backwards$()}
|
|
| '(.put$($ch)&$ch:~".") { Macro, evaluates to a function with actual ch. }
|
|
)
|
|
)
|
|
& fil$(!arg,r)
|
|
& ((=forward$).(=(backward$)$))
|
|
: (?dothis.?doother)
|
|
& whl
|
|
' ( !(dothis.)
|
|
& (!doother.!dothis):(?dothis.?doother)
|
|
)
|
|
& (fil$(,SET,-1)|) { This is how a file is closed: seek the impossible. }
|
|
)
|
|
& put$("what,is,the;meaning,of:life.","life.txt",NEW)
|
|
& put$("we,are;not,in,kansas;any,more.","kansas.txt",NEW)
|
|
& odd-word$"life.txt"
|
|
& put$\n
|
|
& odd-word$"kansas.txt" { Real file, as Bracmat cannot read a single character from stdin. }
|
|
);
|