diff options
Diffstat (limited to 'src/GF/Data')
| -rw-r--r-- | src/GF/Data/Utilities.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/GF/Data/Utilities.hs b/src/GF/Data/Utilities.hs index 50d1f5195..a5ceb08d2 100644 --- a/src/GF/Data/Utilities.hs +++ b/src/GF/Data/Utilities.hs @@ -88,6 +88,12 @@ lookup' x = fromJust . lookup x find' :: (a -> Bool) -> [a] -> a find' p = fromJust . find p +-- | Set a value in a lookup table. +tableSet :: Eq a => a -> b -> [(a,b)] -> [(a,b)] +tableSet x y [] = [(x,y)] +tableSet x y (p@(x',_):xs) | x' == x = (x,y):xs + | otherwise = p:tableSet x y xs + -- * equality functions -- | Use an ordering function as an equality predicate. |
