From 9b272d898f6a71ed9f7c79548b1150679b622303 Mon Sep 17 00:00:00 2001 From: James Hannah Date: Thu, 16 Feb 2017 13:42:40 -0800 Subject: [PATCH] Fixed Haskell substring example Doing the drop after the take will result in unexpected strings in all cases except where drop 0 is called --- markup/ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/markup/ml b/markup/ml index 56e7863..7498716 100644 --- a/markup/ml +++ b/markup/ml @@ -422,7 +422,7 @@ Real.toString 3.14||7 + int_of_string "12" _ ||[[# str-len]][#str-len-note length] _ @< >@||size "hello"||String.length "hello"||"hello".Length||length "hello"|| ||[[# index-substr]][#index-substr-note index of substring]|| || ||"hello".IndexOf("hell")|| || -||[[# substr]][#substr-note extract substring]||substring ("hello",0,4)||String.sub "hello" 0 4||"hello".Substring(0, 4)||drop 0 (take 4 "hello")|| +||[[# substr]][#substr-note extract substring]||substring ("hello",0,4)||String.sub "hello" 0 4||"hello".Substring(0, 4)||take 4 (drop 0 "hello")|| ||[[# extract-char]][#extract-char-note extract character]||String.sub ("hello", 0)||"hello".[0]||"hello".[0]||"hello" !! 0|| ||[[# chr-ord]][#chr-ord-note chr and ord]||ord #"a" _ chr 97||Char.code 'a' _ @@ -1973,4 +1973,4 @@ The OCaml top level provides [http://caml.inria.fr/pub/docs/manual-ocaml/manual0 + Haskell [http://www.haskell.org/onlinereport/haskell2010/ Haskell 2010 Language Report] -[http://www.haskell.org/ghc/docs/latest/html/libraries/index.html Haskell Hierarchical Libraries] \ No newline at end of file +[http://www.haskell.org/ghc/docs/latest/html/libraries/index.html Haskell Hierarchical Libraries]