Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
keiravillekode committed Dec 19, 2023
1 parent 1484977 commit 69c7826
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions exercises/practice/scrabble-score/.meta/example.sml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
val score: string -> int =
let
fun letterValue (c: char): int = case c of
#"A" => 1
| #"E" => 1
| #"I" => 1
| #"O" => 1
| #"U" => 1
| #"L" => 1
| #"N" => 1
| #"R" => 1
| #"S" => 1
| #"T" => 1
| #"D" => 2
| #"G" => 2
| #"B" => 3
| #"C" => 3
| #"M" => 3
| #"P" => 3
| #"F" => 4
| #"H" => 4
| #"V" => 4
| #"W" => 4
| #"Y" => 4
| #"K" => 5
| #"J" => 8
| #"X" => 8
| #"Q" => 10
| #"Z" => 10
| _ => 0
fun letterValue (c: char): int =
case c of
#"A" => 1
| #"E" => 1
| #"I" => 1
| #"O" => 1
| #"U" => 1
| #"L" => 1
| #"N" => 1
| #"R" => 1
| #"S" => 1
| #"T" => 1
| #"D" => 2
| #"G" => 2
| #"B" => 3
| #"C" => 3
| #"M" => 3
| #"P" => 3
| #"F" => 4
| #"H" => 4
| #"V" => 4
| #"W" => 4
| #"Y" => 4
| #"K" => 5
| #"J" => 8
| #"X" => 8
| #"Q" => 10
| #"Z" => 10
| _ => 0
val sum: int list -> int = List.foldl (op +) 0
in
sum o List.map (letterValue o Char.toUpper) o String.explode
Expand Down

0 comments on commit 69c7826

Please sign in to comment.