in Haskell:
\(a,b)->take b $ repeat a :: (a, Int) -> [a]
Example:
def **(x:Long,n:Int):Long = if (n == 0) 1 else List.make(n,x).reduceLeft[Long]((x,y)=>x*y)
Combine to Lists with a function;
in Haskell: zipWith :: [a]→[b]→(a→b→c)→[c]
Example:
List.map2(List.range(0,10),"12345678".toList.reverse.map(_.toLong - '0'.toLong )) {(p,n)=> **(10,p) * n}.reduceLeft[Long]((x,y)=>x+y)
To convert a strict collection xs to lazy, use
xs.projection
To go from a lazy collection xs (for example, from a comprehension) to strict:
xs.toList xs.toArray
See How do I write a loop? for how lazyness and eagerness affect for comprehensions of lists