Skip to content

Commit

Permalink
Fix error reported by Jonathan Widén.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed May 26, 2024
1 parent ae70842 commit 93a669c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions blog/2019-04-10-what-is-the-minimal-basis-for-futhark.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ but for an interesting reason:
Futhark has special syntax for ranges, but this feels a bit like
cheating - ``iota`` is the primitive, and this syntax is just sugar.
Can we express ``iota`` in any other way? Sort of. It is possible to
Can we express ``iota`` in any other way? Sort of. It is possible to
express ``iota`` as a `prefix sum
<https://en.wikipedia.org/wiki/Prefix_sum>`_ on a replicated array:
<https://en.wikipedia.org/wiki/Prefix_sum>`_ on a replicated array
(with a ``map`` to adjust it so the array begins at zero):

.. code-block:: Futhark
let iota (n: i64): [n]i64 =
scan (+) 0 (replicate n 1)
map (\x -> x - 1) (scan (+) 0 (replicate n 1))
In some parallel languages (`NESL
<http://www.cs.cmu.edu/~scandal/nesl.html>`_), the prefix sum ``scan
Expand Down

0 comments on commit 93a669c

Please sign in to comment.