File: shape-params3.fut

package info (click to toggle)
haskell-futhark 0.25.27-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 17,836 kB
  • sloc: haskell: 99,384; ansic: 12,821; python: 3,394; yacc: 783; javascript: 558; sh: 550; lisp: 395; makefile: 263
file content (8 lines) | stat: -rw-r--r-- 274 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
-- A higher-order function that uses the shape parameter as a value term.
-- ==
-- input { [12,17,8,23] } output { [13,18,9,24] 4i64 }

def map_length [n] (f: i32 -> i32) (xs: [n]i32) : ([n]i32, i64) =
  (map f xs, n)

def main (xs: []i32) = map_length (\(x:i32) -> x+1) xs