From 06c6dc6353d32f7b422488b8718e9e4eb08aa85c Mon Sep 17 00:00:00 2001 From: Julian Hyde Date: Sun, 3 May 2020 16:26:30 -0700 Subject: [PATCH] Update 'Morel: The basic language' and 'Word Count revisited' posts now that [MOREL-27] has been fixed See https://github.com/julianhyde/morel/issues/27; `List_rev` is now `List.rev`, etc. --- blog/_posts/2020-03-03-morel-basics.md | 9 ++++++--- blog/_posts/2020-03-31-word-count-revisited.md | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/blog/_posts/2020-03-03-morel-basics.md b/blog/_posts/2020-03-03-morel-basics.md index cc39c3a..ba70de4 100644 --- a/blog/_posts/2020-03-03-morel-basics.md +++ b/blog/_posts/2020-03-03-morel-basics.md @@ -102,7 +102,7 @@ variable called `it`, and prints the value and its type. You can use ```sml = "morel"; val it = "morel" : string -= String_size it; += String.size it; val it = 5 : int = it + 4; val it = 9 : int @@ -245,9 +245,9 @@ type variables. This means that if `f` has type `'a -> 'b`, for any types `'a` and `'b`, then `map f` will transform a list of '`a' to a list of '`b'. -For example, if `f` is the built-in function `String_length` of type +For example, if `f` is the built-in function `String.size` of type `string -> int`, then `'a` is `string` and `'b` is `int`, and `map -String_length` will convert a `string list` to an `int list`. +String.size` will convert a `string list` to an `int list`. Notice that we did not declare any types; the type system deduced everything for us. Type inference is perhaps ML's greatest feature. In @@ -463,3 +463,6 @@ If you have comments, please reply on Twitter:
{% twitter page.tweet limit=5 hide_media=true %}
+ +This article +[has been updated](https://github.com/julianhyde/share/commits/master/blog/_posts/2020-03-03-morel-basics.md). diff --git a/blog/_posts/2020-03-31-word-count-revisited.md b/blog/_posts/2020-03-31-word-count-revisited.md index 9b847fe..1a1f24f 100644 --- a/blog/_posts/2020-03-31-word-count-revisited.md +++ b/blog/_posts/2020-03-31-word-count-revisited.md @@ -390,8 +390,8 @@ fun wordCount lines = let fun split0 [] word words = word :: words | split0 (#" " :: s) word words = split0 s "" (word :: words) - | split0 (c :: s) word words = split0 s (word ^ (String_str c)) words - fun split s = List_rev (split0 (String_explode s) "" []) + | split0 (c :: s) word words = split0 s (word ^ (String.str c)) words + fun split s = List.rev (split0 (String.explode s) "" []) in from line in lines, word in split line @@ -446,3 +446,6 @@ If you have comments, please reply on Twitter:
{% twitter page.tweet limit=5 hide_media=true %}
+ +This article +[has been updated](https://github.com/julianhyde/share/commits/master/blog/_posts/2020-03-31-word-count-revisited.md).