RosettaCodeData/Task/Singleton/Oforth/singleton-1.fth
2023-07-01 13:44:08 -04:00

6 lines
224 B
Forth

Object Class new: Sequence(channel)
Sequence method: initialize(initialValue)
Channel newSize(1) := channel
@channel send(initialValue) drop ;
Sequence method: nextValue @channel receive dup 1 + @channel send drop ;