Jump to content

Odd word problem: Difference between revisions

Line 1,498:
<lang M2000 Interpreter>
Module Checkit {
global out$
document out$
Function PrepareStream$ (buf$) {
\\ get a temporary file
Line 1,506 ⟶ 1,508:
Close #F
Open name$ for input as #f
=lambda$class f ->ref {
if f=-1000 then exit
class:
module ref (.f) { }
}
\\ make f closure by reference
m->ref(f)
=lambda$ m -> {
if m=>f=-1000 then exit
def r$
if not eof(#m=>f) then r$=Input$(#m=>f,2)
=r$
if r$="" or r$="." then close #m=>f : m=>f=-1000
}
}
Line 1,523 ⟶ 1,532:
\\ print before
Print one$;
out$<=one$
Call MyOdd, c$, &last$
}
Line 1,532 ⟶ 1,542:
\\ print after
Print one$;
out$<=one$
}
Do {
Line 1,538 ⟶ 1,549:
if one$="" then exit
Print one$;
out$<=one$
one$=""
Call MyOdd, c$, &one$
if one$="" then exit
Print one$;
out$<=one$
} Always
Print
out$<={
}
}
Odd PrepareStream$("what,is,the;meaning,of:life.")
Odd PrepareStream$("we,are;not,in,kansas;any,more.")
clipboard out$
}
Checkit
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.