diff options
| author | Troels Henriksen <athas@sigkill.dk> | 2022-04-24 14:57:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-24 14:57:53 +0200 |
| commit | 323a7056a7df342e2e4e9986204f5d80487fae56 (patch) | |
| tree | 42a91bfaef464690c06459b2624f6652e587fcfd /tests/examplefiles/futhark/example.fut | |
| parent | 3f4c7331a18b073209297a125131f860b4bd8220 (diff) | |
| download | pygments-git-323a7056a7df342e2e4e9986204f5d80487fae56.tar.gz | |
Futhark: add missing tokens (#2118)
Adds recognition of 'def'/'type^'/'type~' keywords and adds some
missing characters to the regexes for identifiers and punctuation.
Diffstat (limited to 'tests/examplefiles/futhark/example.fut')
| -rw-r--r-- | tests/examplefiles/futhark/example.fut | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/examplefiles/futhark/example.fut b/tests/examplefiles/futhark/example.fut index d2c7bfa8..2ad7b959 100644 --- a/tests/examplefiles/futhark/example.fut +++ b/tests/examplefiles/futhark/example.fut @@ -1,16 +1,17 @@ +local let dotprod [n] 't + (mul: t -> t -> t) (add: t -> t -> t) (zero: t) + (a: [n]t) (b: [n]t): t = + map2 mul a b |> reduce add zero + module matmul (F: numeric) = { type t = F.t open F - local let dotprod [n] (a: [n]t) (b: [n]t): t = - map2 (*) a b |> reduce (+) (i32 0) - - - let matmul [n1][n2][m] (xss: [n1][m]t) (yss: [m][n2]t): [n1][n2]t = - map (\xs -> map (\ys -> dotprod xs ys) <| transpose yss) xss + let matmul [n1][n2][m] (xss: [n1][m]t) (yss: [m][n2]t): *[n1][n2]t = + map (\xs -> map (\ys -> dotprod (*) (+) (i32 0) xs ys) <| transpose yss) xss } module matmul32 = matmul f32 -let main [n][m] (xss: [n][m]f32) (yss: [m][n]f32): *[n][n]f32 = +let main [n][m] (xss: [n][m]f32) (yss: [m][n]f32): ?[a][b].[a][b]f32 = matmul32.matmul xss yss |
