Has anybody found a good solution for lazily-evaluated lists in Perl? I've tried a number of ways to turn something like
for my $item ( map { ... } @list ) {
}
into a lazy evaluation--by tie-ing @list, for example. I'm trying to avoid breaking down and writing a source filter to do it, because they mess with your ability to debug t...
What OCaml libraries are out there that provide lazy list handling? I am looking for something along these lines:
type 'a lazy_list = (*'*)
| Nil
| Cons of 'a * 'a lazy_list lazy_t
let from f =
let rec gen n =
lazy
(
match f n with
| Some x ->
Cons (x, gen (n + 1))
| None ->...
I wonder why F-Sharp doesn't support infinity.
This would work in Ruby (but not in f#):
let numbers n = [1 .. 1/0] |> Seq.take(n)
-> System.DivideByZeroException: Attempted to divide by zero.
I can write the same functionality in much complex way:
let numbers n = 1 |> Seq.unfold (fun i -> Some (i, i + 1)) |> Seq.take(n)
-> works...
I'm using an implementation of lazy lists where the type can be either Nil or Cons (value, thunk), where thunk is a function from unit to the rest of the list.
I'm trying to write a function cross, which would function as List.combine does. Unfortunately, I'm having syntax errors.
open Sequence;;
let rec (cross : 'a Sequence.t -> '...