[m-users.] Higher order term vw. lamda abstraction
Volker Wysk
post at volker-wysk.de
Tue Oct 8 17:21:03 AEDT 2019
Hi!
The following fails to compile:
map(string.from_char_list, [['a','b']], L).
Whereas this does compile:
map( (pred(L1::in, L2::out) is det :-
string.from_char_list(L1, L2)),
[['a','b']], L).
The error message is:
test_listen.m:013: In clause for `main(di, uo)':
test_listen.m:013: mode error in conjunction. The next 2 error
messages
test_listen.m:013: indicate possible causes of this error.
test_listen.m:013: In clause for `main(di, uo)':
test_listen.m:013: in call to predicate `list.map'/3:
test_listen.m:013: mode error: arguments `V_9, V_10, _L' have the
following
test_listen.m:013: insts:
test_listen.m:013: free,
test_listen.m:013: unique,
test_listen.m:013: free
test_listen.m:013: which does not match any of the modes for
predicate
test_listen.m:013: `list.map'/3.
test_listen.m:013: In clause for `main(di, uo)':
test_listen.m:013: in argument 1 of call to predicate `map'/3:
test_listen.m:013: mode error in unification of `V_9' and higher-
order term
test_listen.m:013: based on multi-moded predicate
`string.from_char_list'/2.
test_listen.m:013: The modes of the argument variables match more
than one of
test_listen.m:013: the called predicate's modes.
I don't understand the difference. Shouldn't the two be the same?
Regards,
Volker
More information about the users
mailing list