Warning, file /frameworks/syntax-highlighting/autotests/html/highlight.sml.html was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 <!DOCTYPE html> 0002 <html><head> 0003 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 0004 <title>highlight.sml</title> 0005 <meta name="generator" content="KF5::SyntaxHighlighting - Definition (SML) - Theme (Breeze Light)"/> 0006 </head><body style="background-color:#ffffff;color:#1f1c1b"><pre> 0007 <span style="font-weight:bold;">datatype</span> Colour = R | B 0008 0009 <span style="font-weight:bold;">datatype</span> 'a RBtree = E | N <span style="font-weight:bold;">of</span> Colour * 'a * 'a RBtree * 'a RBtree 0010 0011 <span style="color:#898887;">(* Dieses lookup funktioniert nur fuer Elemente vom Typ int *)</span> 0012 0013 <span style="font-weight:bold;">fun</span> lookup (x,E) = <span style="font-weight:bold;">false</span> 0014 | lookup (x,N(_,y,l,r)) = 0015 <span style="font-weight:bold;">if</span> x < y <span style="font-weight:bold;">then</span> lookup(x,l) 0016 <span style="font-weight:bold;">else</span> <span style="font-weight:bold;">if</span> y < x <span style="font-weight:bold;">then</span> lookup(x,r) 0017 <span style="font-weight:bold;">else</span> <span style="font-weight:bold;">true</span> 0018 0019 <span style="font-weight:bold;">fun</span> balance (B,x,N(R,y,N(R,z,t1,t2),t3),t4) = 0020 N(R,y,N(B,z,t1,t2),N(B,x,t3,t4)) 0021 | balance (B,x,N(R,y,t1,N(R,z,t2,t3)),t4) = 0022 N(R,z,N(B,y,t1,t2),N(B,x,t3,t4)) 0023 | balance (B,x,t1,N(R,y,N(R,z,t2,t3),t4)) = 0024 N(R,z,N(B,x,t1,t2),N(B,y,t3,t4)) 0025 | balance (B,x,t1,N(R,y,t2,N(R,z,t3,t4))) = 0026 N(R,y,N(B,x,t1,t2),N(B,z,t3,t4)) 0027 | balance t = N t 0028 0029 <span style="font-weight:bold;">fun</span> insert(x,t) = 0030 <span style="font-weight:bold;">let</span> 0031 <span style="font-weight:bold;">fun</span> ins E = N(R,x,E,E) 0032 | ins (t <span style="font-weight:bold;">as</span> N(c,y,l,r)) = 0033 <span style="font-weight:bold;">if</span> x < y <span style="font-weight:bold;">then</span> balance (c,y,ins l,r) 0034 <span style="font-weight:bold;">else</span> <span style="font-weight:bold;">if</span> y < x <span style="font-weight:bold;">then</span> balance (c,y,l,ins r) 0035 <span style="font-weight:bold;">else</span> t 0036 <span style="font-weight:bold;">val</span> N(_,y,l,r) = ins t 0037 <span style="font-weight:bold;">in</span> N(B,y,l,r) 0038 <span style="font-weight:bold;">end</span> 0039 </pre></body></html>