score:2
Accepted answer
how about something like
val triangular: stream[int] = stream.from(2).scanleft(1)(_+_)
Source: stackoverflow.com
Related Query
- Triangular number sequence using Scala's Fibionacci
- Generate a sequence of Fibonacci number in Scala
- Modularising scenarios to run in sequence using Gatling
- How to return all positives and the first negative number in a list using functional programming?
- Proving associativity of natural number addition using Scala shapeless
- How do I generate a random number using functional state?
- Write and read raw byte arrays in Spark - using Sequence File SequenceFile
- Is there a more idiomatic way of getting IO[Option[A]] from Option[IO[Option[A]] then using sequence and mapping join?
- Wrong number of arguments invoking a Scala constructor using reflection
- Multiple constructors with the same number of parameters exception while transforming data in spark using scala
- Scalas (a,b).zipped (or Tuple2.zipped) notion using streams/infinite lists
- Dynamic Proxy using Scalas new Dynamic Type
- How to implement a recursive Fibonacci sequence in Scala using FS2?
- Count number of Ints in Scala list using a fold
- Using result from Scalas "fromURL" throws Exception
- add sequence number column in dataframe usnig scala
- removing elements from a sequence using for/yield
- Executing update using Anorm returns PSQLException: The column index is out of range: 2, number of columns: 1
- How to count the number of words per line in text file using RDD?
- How to generate a sequence of random integers less than a number in Scala?
- Making key value pairs from an HDFS sequence file using Apache Spark
- Calling arbitrary number of WS.url().get() in sequence
- Using Shapeless records to combine arbitrary number of state-changing functions
- Scala: Anagram of two strings using prime number
- Counting the number of inversions using Merge Sort
- Create Pairs of number without using catesian in spark
- How to limit the number of characters in a string displayed using Scala
- How to generate 15 digit random number using Scala
- Generating a random sequence using Scala
- Using `Seq::fill` with an existing sequence
More Query from same tag
- Get the changed HTML content after it's updated by Javascript? (htmlunit)
- Is there a Java version of Clojure's or Scala's persistent immutable vector?
- How do I create a Doobie Meta instance for MySQL using Play JSON?
- Default for a missing field when deserializing Json with Jerkson
- SBT AutoPlugin dependencies
- Jackson annotation or method to URL encode/decode during serialization?
- Is it possible to extend a package private class defined in a 3rd party jar in Scala
- Spark 2.4 drop columns based on value scala
- Recursive method call in Apache Spark
- implicit arguments is not passed to closure
- How do I implement User validations in Play!?
- Getting ClassCastException while trying to save file in avro format in spark
- Are Futures executed on a single thread? (Scala)
- Scala on Android with scala.concurrent.Future do not report exception on system err/out
- Unresolved dependency org.scala-lang:scala3-library_3.0.0:3.0
- How to create a key value pair from a csv file considering the first column as key
- Executors NewFixedThreadPool not giving the expected result
- SBT refuses to continue downloading
- Cannot prove that Unit <:< (T, U)
- I have multiple private repos in github, how can I place dependency from one to another?
- how to persist a spark Date type column into a DB Date column
- Impose more than one generic type constraint on a Scala type parameter
- how to parse un Array of object with Circe
- How to inject data from csv file in Gatling?
- the short-written rules of using "_" in scala anonymous function confused me
- how to use curried type arguments in matryoshka
- Extract emojis from Dataframe column and add them into a different Column of the same Dataframe Scala Spark
- Nesting of RDD's in Scala Spark
- Efficiently randomly sampling List while maintaining order
- Is lack of 3rd party libraries preventing you using Scala?