Scala shorthand for ending a stream? -
With the practice of currents, I am searching for a normal pattern to end a stream like this:
stream.cons (lastValue, stream.empty)It seems that this would be a similar pattern that is probably a short story
stream. Finish (lastValue) // is not a real skial codeIs such a function made in Scala?
natural options,
stream (final value) does not work in general becauseNot applicable is not lazy, but you can use it when you do not care that you've already specified the value.You can probably use
Stream.fill (1) ()
lastValue #: stream.empty < P> personal.
Comments
Post a Comment