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 code   

Is such a function made in Scala?

natural options, stream (final value) does not work in general because Not 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

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -