GIML: Tutorial 1: duplicate

duplicate: the answer

fun duplicate s = s ^ s; duplicate "go"; The label s is the formal parameter - given in the definition of duplicate. The value "go" is the actual parameter - given in an execution of duplicate. A common mistake is to put the formal parameter in quotes, perhaps in order to convince the interpreter that it really is a string. For example: fun duplicate "s" = "s"^"s"; ML will accept this, however defines a function which is defined at exactly one value only. You can evaluate the expression duplicate "s"; only any other parameter value will fail. The expression duplicate "x"; for example will not evaluate, you will an error message such "uncaught Match exception".