News for hackers. Stuff that matters.
Re:Show HN: Functional programming for modern Fortran by milancurcic on Thursday November 24, 2016 @08:02AM (#13030084)
Thank you jerf and sampo for your very helpful comments. This is something that I had on my mind during the implementation but focused primarily on expressiveness.

While the array slicing in Fortran is O(1), the implementation of tail does make a copy. Though a good compiler should be able to replace tail(x) with x(2:), the Fortran standard does not guarantee it to do so. The first step forward that I see would be to replace tail(x) with x(2:) in the internal implementations of fold[lr].

In any case, the time complexity for these functions is definitely something I plan to document soon.

Re:Show HN: Functional programming for modern Fortran by sampo on Thursday November 24, 2016 @11:49AM (#13031244)
> replace tail(x) with x(2:) in the internal implementations of fold[lr].

Tried this for foldl with gfortran. Totally helps. Summing 10 000 int64's, memory consumption drops from 400M to 4M. Also time complexity becomes linear.