From add335bd0bc51313dd6c86578c275898b69b6b55 Mon Sep 17 00:00:00 2001 From: Kartik Singhal Date: Tue, 8 Aug 2017 17:19:21 -0700 Subject: Redundancy is not permitted in pattern matching --- standard-ml.html.markdown | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'standard-ml.html.markdown') diff --git a/standard-ml.html.markdown b/standard-ml.html.markdown index c9eb2a2e..22086699 100644 --- a/standard-ml.html.markdown +++ b/standard-ml.html.markdown @@ -351,7 +351,10 @@ val _ = print (say(Red) ^ "\n") fun say Red = "You are red!" | say Green = "You are green!" | say Blue = "You are blue!" - | say _ = raise Fail "Unknown color" + +(* We did not include the match arm `say _ = raise Fail "Unknown color"` +because after specifying all three colors, the pattern is exhaustive +and redundancy is not permitted in pattern matching *) (* Here is a binary tree datatype *) -- cgit v1.2.3 From 985d23a52b76593a120adff5381c2df3a80fe298 Mon Sep 17 00:00:00 2001 From: HairyFotr Date: Wed, 23 Aug 2017 10:14:39 +0200 Subject: Fix a bunch of typos --- standard-ml.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'standard-ml.html.markdown') diff --git a/standard-ml.html.markdown b/standard-ml.html.markdown index c286366b..9ebf345b 100644 --- a/standard-ml.html.markdown +++ b/standard-ml.html.markdown @@ -395,7 +395,7 @@ fun failing_function [] = raise Empty (* used for empty lists *) | failing_function xs = raise Fail "This list is too long!" (* We can pattern match in 'handle' to make sure - a specfic exception was raised, or grab the message *) + a specific exception was raised, or grab the message *) val err_msg = failing_function [1,2] handle Fail _ => "Fail was raised" | Domain => "Domain was raised" | Empty => "Empty was raised" -- cgit v1.2.3 From b4634d490df3d9e6b89f674d67450941c58d93ca Mon Sep 17 00:00:00 2001 From: Pratik Karki Date: Fri, 25 Aug 2017 14:11:50 +0545 Subject: Add filename(#2832) --- standard-ml.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'standard-ml.html.markdown') diff --git a/standard-ml.html.markdown b/standard-ml.html.markdown index 9ebf345b..fe0f6971 100644 --- a/standard-ml.html.markdown +++ b/standard-ml.html.markdown @@ -1,5 +1,6 @@ --- language: "Standard ML" +filename: standardml.sml contributors: - ["Simon Shine", "http://shine.eu.org/"] - ["David Pedersen", "http://lonelyproton.com/"] -- cgit v1.2.3