I wanted to know if the intersection of two csets is empty and wrote
but then I realized I wasn't sure ifif c1 ** c2 == ' ' then==
was the right operator to use.
c1 === c2
c1 == c2
first
converts c1
and c2
to strings and then compares
the resulting strings. The conversion is time-consuming and unnecessary.if *(c1 ** c2) = 0 then
in a real program, its equivalent happens to us all from time to time. Such problems are easy to understand if not always easy to find.while 1
L
:
(The functionevery write(L[seq()])
seq()
generates an endless sequence of integers,
1, 2, 3, ... .)every
expression does not stop even though the list reference fails; seq()
continues to generate, L[seq()]
continues to fail, and so on.|expr
, which stops if expr
ever fails to produce
a single result. Otherwise, evaluation of an expression such as |read()
would never stop.
I just discovered that
works just fine. How nice! I just figured out a use for that.record t(a, b, c) procedure main(args) tmp := t() every !tmp := get(args) every write(!tmp) end
tmp[1]
, and generated
as you've observed. In fact the operations X[i]
, !X
,
?X
, and *X
apply to all structure types with the
exception of X[i]
, which does not apply to sets, since there
is no concept of order for the members of a set (although we could invent
one).
procedure main() write(s := !&input) every write(s ~==:= !&input) end
procedure main() end