Following java program creates an infinite fibonacci sequence (stream) an takes the first 42 values of it.

import java.util.function.UnaryOperator;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class test3 {
    public static void main(String[] args) {
        int beginvalue[] = new int[] { 0, 1 };
UnaryOperator<int[]> fibo_seq = a -> new int[] { a[1], a[0] + a[1] };
        Stream<int[]> s = Stream.iterate(beginvalue, fibo_seq);
        IntStream fibStream = s.mapToInt(a -> a[1]);
        IntStream limitedstream = fibStream.limit(42);
        limitedstream.forEach(System.out::println);
    }
}

How would this program look converted to dlang ?
Maybe there are multiple solutions ?

Reply via email to