You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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) "" [])
in
from line in lines,
word in split(line)
group word compute count of 1 as count
end;
gives error
Exception in thread "main" java.lang.AssertionError: unknown FUN_DECL; 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
at net.hydromatic.morel.compile.Compiler.compileDecl(Compiler.java:327)
at net.hydromatic.morel.compile.Compiler.compileLet(Compiler.java:301)
Also note that in the error message, split0 ( :: s) word words should be split0 (#" " :: s) word words.
The text was updated successfully, but these errors were encountered:
The function
gives error
Also note that in the error message,
split0 ( :: s) word words
should besplit0 (#" " :: s) word words
.The text was updated successfully, but these errors were encountered: