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
The functions catstr and catstr' defined in Haskell are equivalent, but the Scala code defines two functions (named the same, catstr?) that are not equivalent, despite what the text says. The proposed changes are about code snippets 3, 4, and 5. The first Scala definition should perhaps become
val catstr(s: String)(s1: String):String= s ++ s1
The second definition could become
val catstr2(s: String):String=>String= s1 => s + s1
The third snippet is then
valgreet:String=>String= catstr("hello")
and then indeed the definition of greet can use either catstr or catstr2 interchangeably, just like in the Haskell code.
The text was updated successfully, but these errors were encountered:
winitzki
added a commit
to winitzki/milewski-ctfp-pdf
that referenced
this issue
Oct 21, 2019
The functions
catstr
andcatstr'
defined in Haskell are equivalent, but the Scala code defines two functions (named the same,catstr
?) that are not equivalent, despite what the text says. The proposed changes are about code snippets 3, 4, and 5. The first Scala definition should perhaps becomeThe second definition could become
The third snippet is then
and then indeed the definition of
greet
can use eithercatstr
orcatstr2
interchangeably, just like in the Haskell code.The text was updated successfully, but these errors were encountered: