diff options
| author | bringert <bringert@cs.chalmers.se> | 2005-12-22 23:16:15 +0000 |
|---|---|---|
| committer | bringert <bringert@cs.chalmers.se> | 2005-12-22 23:16:15 +0000 |
| commit | e32472a9bb40468bd77db839d683bd15e89db2e1 (patch) | |
| tree | e2756756fc5b75f577a500438e34922c3b7b6d5f /src/GF/Speech/Graph.hs | |
| parent | 29ba681242acd62a28e2facdad733619bf8d994f (diff) | |
Some performance improvements in the FA generation.
Diffstat (limited to 'src/GF/Speech/Graph.hs')
| -rw-r--r-- | src/GF/Speech/Graph.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/GF/Speech/Graph.hs b/src/GF/Speech/Graph.hs index 2f80ef0ca..7ebecdc34 100644 --- a/src/GF/Speech/Graph.hs +++ b/src/GF/Speech/Graph.hs @@ -13,7 +13,7 @@ ----------------------------------------------------------------------------- module GF.Speech.Graph ( Graph(..), Node, Edge, Incoming, Outgoing , newGraph, nodes, edges - , nmap, emap, newNode, newEdge, newEdges + , nmap, emap, newNode, newNodes, newEdge, newEdges , incoming, outgoing, getOutgoing , getFrom, getTo, getLabel , reverseGraph, renameNodes @@ -52,6 +52,11 @@ emap f (Graph c ns es) = Graph c ns [(x,y,f l) | (x,y,l) <- es] newNode :: a -> Graph n a b -> (Graph n a b,n) newNode l (Graph (c:cs) ns es) = (Graph cs ((c,l):ns) es, c) +newNodes :: [a] -> Graph n a b -> (Graph n a b,[Node n a]) +newNodes ls (Graph cs ns es) = (Graph cs' (ns'++ns) es, ns') + where (xs,cs') = splitAt (length ls) cs + ns' = zip xs ls + newEdge :: Edge n b -> Graph n a b -> Graph n a b newEdge e (Graph c ns es) = Graph c ns (e:es) |
