Questions tagged [lazy-sequences]

Lazy sequences are sequences that are constructed as their members are accessed.

Lazy sequences are sequences that are constructed as their members are accessed.

For example, all haskell sequences are lazy because of the lazy semantics of the language; python's generators can also be considered lazy sequences.

273 questions
-1
votes
1 answer

Lazily create a colour map in Java

I created a function to create a colour map in java. final void setDefaultColourMap() { colourMap = new HashMap<>(); colourMap.put(0, Color.BLACK); colourMap.put(1, Color.RED); colourMap.put(2, Color.GREEN); …
Tarun Maganti
  • 3,076
  • 2
  • 35
  • 64
-1
votes
2 answers

Retry function without recursion

This is a follow-up to my previous question. I would like to write a non-recursive retry function using the signature from the reply. Note that this implementation uses view as a lazy sequence. def withRetries[T](retries: Short)(fun: => T): Try[T] =…
Michael
  • 41,026
  • 70
  • 193
  • 341
-1
votes
1 answer

Clojure: lazy-sequence and "ordinary" sequence

In Clojure, what is the difference between an "ordinary" sequence and a lazy-sequence ? Please look at this link: https://clojuredocs.org/clojure.core/partition#partition-by It says that function "partition" returns a lazy-sequence. How makes the…
CrazySynthax
  • 13,662
  • 34
  • 99
  • 183
1 2 3
18
19