Browse files

Add FindString

  • Loading branch information...
1 parent 71fe107 commit 32ff3013cfcbe9e225aa531538bd9fbc75244360 @laurentpetit committed Mar 6, 2014
Showing with 24 additions and 0 deletions.
  1. +24 −0 FindString.oz
View
24 FindString.oz
@@ -0,0 +1,24 @@
+declare
+fun {Prefix L1 L2}
+ case L1
+ of nil then true
+ [] H|T then
+ case L2
+ of nil then false
+ [] H1|T1 then
+ if H==H1 then {Prefix T T1}
+ else false end
+ end
+ end
+end
+
+{Browse {Prefix nil nil}}
+
+declare
+fun {FindString L1 L2}
+ if {Prefix L1 L2} then true
+ elseif L2==nil then false
+ else {FindString L1 L2.2} end
+end
+
+{Browse {FindString [a] [a]}}

0 comments on commit 32ff301

Please sign in to comment.