mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-08-16 09:20:24 +03:00
Tweak the type signature for scanl
and scanr
.
It is convenient for Coq extraction for the constant 1 factor to be on the left of the addition symbol.
This commit is contained in:
parent
253a7f26ab
commit
41613ade02
@ -1156,12 +1156,12 @@ product xs = foldl' (*) (fromInteger 1) xs
|
||||
/**
|
||||
* Scan left is like a foldl that also emits the intermediate values.
|
||||
*/
|
||||
primitive scanl : {n, a, b} (a -> b -> a) -> a -> [n]b -> [n+1]a
|
||||
primitive scanl : {n, a, b} (a -> b -> a) -> a -> [n]b -> [1+n]a
|
||||
|
||||
/**
|
||||
* Scan right is like a foldr that also emits the intermediate values.
|
||||
*/
|
||||
scanr : {n, a, b} (fin n) => (a -> b -> b) -> b -> [n]a -> [n+1]b
|
||||
scanr : {n, a, b} (fin n) => (a -> b -> b) -> b -> [n]a -> [1+n]b
|
||||
scanr f acc xs = reverse (scanl (\a b -> f b a) acc (reverse xs))
|
||||
|
||||
/**
|
||||
|
@ -1814,7 +1814,7 @@ foldl'V sym =
|
||||
go1 f a' bs
|
||||
|
||||
|
||||
-- scanl : {n, a, b} (a -> b -> a) -> a -> [n]b -> [n+1]a
|
||||
-- scanl : {n, a, b} (a -> b -> a) -> a -> [n]b -> [1+n]a
|
||||
scanlV :: forall sym. Backend sym => sym -> Prim sym
|
||||
scanlV sym =
|
||||
PNumPoly \n ->
|
||||
|
Loading…
Reference in New Issue
Block a user