From e32472a9bb40468bd77db839d683bd15e89db2e1 Mon Sep 17 00:00:00 2001 From: bringert Date: Thu, 22 Dec 2005 23:16:15 +0000 Subject: Some performance improvements in the FA generation. --- src/GF/Speech/Graph.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/GF/Speech/Graph.hs') 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) -- cgit v1.2.3